/// <summary> /// 添加员工信息 /// </summary> /// <param name="userViewModel"></param> /// <returns></returns> public bool SaveEmployeeData(UserViewModel userViewModel) { try { if (_accountInfoRepository.CheckAccount(userViewModel.Account)) { throw new Exception("账号重复"); } if (_employeeInfoRepository.CheckMobile(userViewModel.Mobile)) { throw new Exception("手机号重复"); } //创建账号 AccountInfo accountInfo = new AccountInfo(); accountInfo.Id = Guid.NewGuid(); accountInfo.Account = userViewModel.Account; accountInfo.Password = userViewModel.Password; accountInfo.EmployeeId = Guid.NewGuid(); _accountInfoRepository.Insert(accountInfo); //创建员工信息 EmployeeInfo employeeInfo = new EmployeeInfo(); employeeInfo.Id = accountInfo.EmployeeId; employeeInfo.CreateDate = DateTime.Now; employeeInfo.EmployeeNo = _autoincrementInfoRepository.UpdateAutoincrement("EmployeeNo").Value; employeeInfo = employeeInfo.SetEntity(userViewModel); _employeeInfoRepository.Insert(employeeInfo); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }