| | |
| | | var enterpriseEmployees = await rep.AsQueryable() |
| | | .Where(it => it.EnterpriseId == logier.EnterpriseId && identities.Contains(it.Identity)) |
| | | .ToListAsync(); |
| | | var successList = new List<ImportEnterpriseEmployeesCommandModel>(); |
| | | foreach (var model in models) |
| | | { |
| | | var errors = new List<string>(); |
| | |
| | | { |
| | | errors.Add("请填写手机号"); |
| | | } |
| | | else if (!model.ContactPhoneNumber.TryValidate(EnumValidationTypes.PhoneNumber).IsValid) |
| | | else if (!model.ContactPhoneNumber.TryValidate(EnumValidationTypes.ValidPhoneNumber).IsValid) |
| | | { |
| | | errors.Add("手机号格式不正确"); |
| | | } |
| | |
| | | { |
| | | errors.Add("请填写身份证号"); |
| | | } |
| | | else if (!model.Identity.TryValidate(EnumValidationTypes.Identity).IsValid) |
| | | else if (!model.Identity.TryValidate(EnumValidationTypes.ValiIdentity).IsValid) |
| | | { |
| | | errors.Add("身份证号格式不正确"); |
| | | } |
| | | else if (models.Any(it => it.Identity == model.Identity)) |
| | | else if (successList.Any(it => it.Identity == model.Identity)) |
| | | { |
| | | errors.Add("身份证号重复"); |
| | | } |
| | |
| | | Age = model.Age, |
| | | }; |
| | | await rep.InsertAsync(enterpriseEmployee); |
| | | successList.Add(model); |
| | | } |
| | | else |
| | | { |
| | |
| | | enterpriseEmployee.Birthday = model.Birthday; |
| | | enterpriseEmployee.Age = model.Age; |
| | | await rep.UpdateAsync(enterpriseEmployee); |
| | | successList.Add(model); |
| | | } |
| | | } |
| | | } |