Browse Source

接团客户名单
客户生日 datetime 可为空

leiy 10 months ago
parent
commit
ff30a09be6

+ 7 - 15
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -4625,13 +4625,10 @@ namespace OASystem.API.Controllers
                             builder.MoveToCell(0, cultivateRowIndex, 2, 0);
 
                             string birthDay = "";
-                            if (!string.IsNullOrEmpty(item.Birthday))
+                            if (item.Birthday != null)
                             {
-                                var isDt = DateTime.TryParse(item.Birthday, out DateTime dt);
-                                if (isDt)
-                                {
-                                    birthDay = $"{dt.Year}.{dt.Month}";
-                                }
+                                DateTime dt = Convert.ToDateTime(item.Birthday);
+                                birthDay = $"{dt.Year}.{dt.Month}";
                             }
                             builder.Write(birthDay);
 
@@ -10479,13 +10476,9 @@ namespace OASystem.API.Controllers
                             if (clientInfo == null)
                             {
 
-
-                                string format1 = "yyyy-MM-dd";
-
-                                string data111 = "1990-01-01";
-
-                                var data11_1 = IsValidDate(item.Birthday, format1);
-                                if (data11_1) data111 = item.OPdate;
+                                DateTime? dateTime = null;
+                                var isDt = DateTime.TryParse(item.Birthday, out DateTime birthDayDt);
+                                if (isDt) dateTime = birthDayDt;
 
                                 var addInfo1 = new Crm_DeleClient()
                                 {
@@ -10499,8 +10492,7 @@ namespace OASystem.API.Controllers
                                     Marriage = 0,
                                     Phone = item.Phone,
                                     Job = item.Job,
-                                    BirthDay = Convert.ToDateTime(data111).ToString("yyyy-MM-dd"),
-
+                                    BirthDay = dateTime
 
                                 };
 

+ 0 - 1
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -663,7 +663,6 @@ namespace OASystem.API.Controllers
                                         });
                                     }
 
-
                                     //if (name.Length > 0)
                                     //{
                                     //    string nameLastStr = name[name.Length - 1].ToString();

+ 2 - 2
OASystem/OASystem.Domain/Entities/Customer/Crm_DeleClient.cs

@@ -67,8 +67,8 @@ namespace OASystem.Domain.Entities.Customer
         /// <summary>
         /// 出生日期
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "DateTime")]
-        public string BirthDay { get; set; }
+        [SugarColumn(IsNullable = true, ColumnDataType = "datetime")]
+        public DateTime? BirthDay { get; set; } = null;
 
         /// <summary>
         /// 机票喜好舱位

+ 8 - 1
OASystem/OASystem.Infrastructure/Repositories/CRM/VisaDeleClientRepository.cs

@@ -183,6 +183,13 @@ namespace OASystem.Infrastructure.Repositories.CRM
                 else if (dto.Status == 2)//修改
                 {
                     deleId=dto.DeleClient.Id;
+
+                    DateTime? dateTime = null;
+                    bool isDt = DateTime.TryParse(dto.DeleClient.BirthDay, out DateTime dt);
+
+                    if (isDt) dateTime = dt;
+
+
                     bool res = await UpdateAsync(a => a.Id == dto.DeleClient.Id, a => new Crm_DeleClient
                     {
                         DiId = dto.DeleClient.DiId,
@@ -195,7 +202,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
                         Phone = dto.DeleClient.Phone,
                         BirthProvince = dto.DeleClient.BirthProvince,
                         BirthCity = dto.DeleClient.BirthCity,
-                        BirthDay = dto.DeleClient.BirthDay,
+                        BirthDay = dateTime,
                         AirType = dto.DeleClient.AirType,
                         SeatPref = dto.DeleClient.SeatPref,
                         AirRemark = dto.DeleClient.AirRemark,

+ 2 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -391,7 +391,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                             param.IDCardNo = clientIDInfo.CertNo;
                             param.Remark = item.Remark;
-                            param.BirthDay = DateTime.TryParse(clientInfo.BirthDay, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
+                            param.BirthDay = clientInfo.BirthDay == null ? "" : DateTime.TryParse(Convert.ToDateTime( clientInfo.BirthDay).ToString("yyyy-MM-dd"), out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
                             param.FirstName = clientInfo.FirstName;
                             param.LastName = clientInfo.LastName;
                             param.CompanyFullName = Company.CompanyFullName;
@@ -437,7 +437,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                             param.IDCardNo = clientIDInfo.CertNo;
                             param.Remark = item.Remark;
-                            param.BirthDay = DateTime.TryParse(clientInfo.BirthDay, out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
+                            param.BirthDay = clientInfo.BirthDay == null ? "" : DateTime.TryParse(Convert.ToDateTime(clientInfo.BirthDay).ToString("yyyy-MM-dd"), out timeParam) ? timeParam.ToString("yyyy-MM-dd") : "";
                             param.FirstName = clientInfo.FirstName;
                             param.LastName = clientInfo.LastName;
                             param.CompanyFullName = Company.CompanyFullName;

+ 4 - 4
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -275,7 +275,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     Pinyin = dto.Pinyin,
                     Phone = dto.Phone,
                     Sex = dto.Sex,
-                    BirthDay = dto.BirthDay,
+                    BirthDay = dto.BirthDay == null ? null : Convert.ToDateTime(dto.BirthDay),
                     Job = dto.Job,
                     CreateUserId = dto.UserId
                 };
@@ -573,7 +573,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         Job = item.Job,
                         Sex = item.Sex,
                         Phone = item.Phone,
-                        BirthDay = item.BirthDay,
+                        BirthDay = item.BirthDay == null ? null : Convert.ToDateTime(item.BirthDay),
                     };
                     var clientAdd = await _sqlSugar.Insertable(_DeleClientInfo).ExecuteReturnIdentityAsync();
                     if (clientAdd < 0)
@@ -636,7 +636,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         Pinyin = item.Pinyin,
                         Sex = item.Sex,
                         Phone = item.Phone,
-                        BirthDay = item.BirthDay
+                        BirthDay = item.BirthDay == null ? null : Convert.ToDateTime(item.BirthDay)
                     };
                     var clientEdit = await _sqlSugar.Updateable(_DeleClient).UpdateColumns(it =>
                                                                                  new
@@ -750,7 +750,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         Pinyin = item.Pinyin,
                         Phone = item.Phone,
                         Sex = item.Sex,
-                        BirthDay = item.BirthDay,
+                        BirthDay = item.BirthDay == null ? null : Convert.ToDateTime(item.BirthDay),
                         Job = item.Job,
                         CreateUserId = userId
                     };