yuanrf il y a 1 an
Parent
commit
297676e971

+ 12 - 3
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -396,6 +396,15 @@ namespace OASystem.Infrastructure.Repositories.CRM
             Result result = new Result() { Code = -2, Msg = "未知错误" };
             bool istrue = false;
             int AddReturnId = -1;
+            
+            string BirthdayStr = string.Empty;
+            if (!string.IsNullOrWhiteSpace(dto.Birthday))
+            {
+                DateTime Birthday = new DateTime();
+                var isParse = DateTime.TryParse(dto.Birthday, out Birthday);
+                BirthdayStr = isParse ? Birthday.ToString("yyyy-MM-dd") : "";
+            }
+
             try
             {
                 BeginTran();
@@ -410,7 +419,10 @@ namespace OASystem.Infrastructure.Repositories.CRM
                         {
                             dto.PassportDate = null;
                         }
+
                         Crm_NewClientData _NewClientData = _mapper.Map<Crm_NewClientData>(dto);
+                        _NewClientData.Birthday = BirthdayStr;
+
                         int id = await AddAsyncReturnId(_NewClientData); //添加市场客户资料表数据
 
                         if (id == 0)
@@ -442,9 +454,6 @@ namespace OASystem.Infrastructure.Repositories.CRM
                     {
                         PassportDate = null;
                     }
-                    DateTime Birthday = new DateTime();
-                    var isParse = DateTime.TryParse(dto.Birthday,out Birthday);
-                    string BirthdayStr = isParse ? Birthday.ToString("yyyy-MM-dd") : "";
 
                     bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Crm_NewClientData
                     {