Kaynağa Gözat

手工制单保存成功要在客户档案管理中添加客户信息

MicroWin10-1604\Administrator 7 yıl önce
ebeveyn
işleme
0d9d5ad3e1

+ 30 - 21
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

@@ -513,7 +513,7 @@ namespace CallCenterApi.Interface.Controllers.tel
513 513
                         //电话
514 514
                         string tel = RequestString.GetFormString("tel");
515 515
                         //来电所在省份
516
-                        //string prov = RequestString.GetFormString("province");
516
+                        string prov = RequestString.GetFormString("province");
517 517
                         //来电单位
518 518
                         string lddep = RequestString.GetFormString("lddep");
519 519
                         //反馈单位
@@ -678,25 +678,34 @@ namespace CallCenterApi.Interface.Controllers.tel
678 678
                                     new BLL.T_Call_CallRecords().Update(rec);
679 679
                                 }
680 680
                             }
681
-                            #region 将不存在的客户保存到客户基础信息中。已在来电弹屏左侧处理
682
-                            //如果客户不存在,需要同时添加到客户基础信息表中
683
-                            //Model.T_Cus_CustomerBase userModel = new BLL.T_Cus_CustomerBase().GetModel(tel);
684
-                            //if (userModel == null)
685
-                            //{
686
-                            //    int cusid = new BLL.T_Cus_CustomerBase().Add(new Model.T_Cus_CustomerBase()
687
-                            //    {
688
-                            //        F_CustomerName = callCustomer,
689
-                            //        F_Mobile = tel,
690
-                            //        F_CreateBy = userId,
691
-                            //        F_CreatedOn = DateTime.Now,
692
-                            //        F_DeleteFlag = 0,
693
-                            //        F_Province = prov,
694
-                            //        F_CustomerIndustry = lddep,
695
-                            //        F_RelationShipClass = fkdep
696
-                            //    });
697
-                            //    if (cusid > 0)
698
-                            //        res = Success("新增成功!");
699
-                            //}
681
+                            #region 将不存在的客户保存到客户基础信息中。
682
+                            //如果客户不存在,需要同时添加到客户基础信息表中,存在则修改
683
+                            Model.T_Cus_CustomerBase userModel = new BLL.T_Cus_CustomerBase().GetModel(tel);
684
+                            if (userModel == null)
685
+                            {
686
+                                int cusid = new BLL.T_Cus_CustomerBase().Add(new Model.T_Cus_CustomerBase()
687
+                                {
688
+                                    F_CustomerName = callCustomer,
689
+                                    F_Mobile = tel,
690
+                                    F_CreateBy = userId,
691
+                                    F_CreatedOn = DateTime.Now,
692
+                                    F_DeleteFlag = 0,
693
+                                    F_Province = prov,
694
+                                    F_CustomerIndustry = lddep,
695
+                                    F_RelationShipClass = fkdep
696
+                                });
697
+                                //if (cusid > 0)
698
+                                //    res = Success("新增成功!");
699
+                            }
700
+                            else
701
+                            {
702
+                                userModel.F_Province = prov;
703
+                                userModel.F_CustomerIndustry = lddep;
704
+                                userModel.F_RelationShipClass = fkdep;
705
+                                userModel.F_CustomerName = callCustomer;
706
+                                userModel.F_Mobile = tel;
707
+                                new BLL.T_Cus_CustomerBase().Update(userModel);
708
+                            }
700 709
                             #endregion
701 710
 
702 711
                             #region 新增工单后新的单位要保存到反馈单位和来电单位中
@@ -723,7 +732,7 @@ namespace CallCenterApi.Interface.Controllers.tel
723 732
                                 }
724 733
                                 else
725 734
                                     res = Error("获取失败,没有对应数据");
726
-                            }
735
+                            } 
727 736
                             #endregion
728 737
                             res = Success("新增成功!");
729 738
                         }