/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult UsrSave(UserView model) { var result = new ResultInfoModel { IsSuccess = true }; try { if (string.IsNullOrEmpty(model.UserId) || model.UserId.Equals("0")) { //新增 var user = new UserModel(); user.BUName = model.BUName; user.BUSex = model.BUSex; if (!string.IsNullOrWhiteSpace(model.BUAvatars)) { var path = model.BUAvatars.Substring(ServerInfo.RootURI.Length); user.BUAvatars = path; } else { user.BUAvatars = string.Empty; } user.BUPhoneNum = model.BUPhoneNum; user.BUEmail = model.BUEmail; //user.BUDepartId = int.Parse(EncryptHelper.DesDecrypt(model.DepartId)); user.BUTitle = model.BUTitle; user.BUIsValid = model.BUIsValid; user.BUCreateUserNo = LoginUser.JobNum; user.BUCreateUserName = LoginUser.UserName; user.BUCreateTime = DateTime.Now; user.BUOperateUserNo = LoginUser.JobNum;; user.BUOperateUserName = LoginUser.UserName; user.BUOperateTime = DateTime.Now; user.BUDepartName = model.BUDepartName; user.BUExtensionPhone = model.BUExtensionPhone; user.BUEnglishName = model.BUEnglishName; user.BUPosition = model.BUPosition; user.BUMobilePhone = model.BUMobilePhone; user.BUJobNumber = HomeBusiness.GenerateNewJobNumber(string.Empty); user.Account = model.Account; result = HomeBusiness.SaveNewUser(user); } else { //解密id model.UserId = EncryptHelper.DesDecrypt(model.UserId); var user = HomeBusiness.GetUserById(long.Parse(model.UserId)); user.BUName = model.BUName; user.BUSex = model.BUSex; user.BUAvatars = model.BUAvatars; user.BUPhoneNum = model.BUPhoneNum; user.BUEmail = model.BUEmail; //user.BUDepartId = int.Parse(EncryptHelper.DesDecrypt(model.DepartId)); user.BUTitle = model.BUTitle; user.BUIsValid = model.BUIsValid; user.BUOperateUserNo = LoginUser.JobNum; user.BUOperateUserName = LoginUser.UserName; //user.BUOperateUserNo = "33029"; //user.BUOperateUserName = "******"; user.BUOperateTime = DateTime.Now; user.BUDepartName = model.BUDepartName; user.BUExtensionPhone = model.BUExtensionPhone; user.BUEnglishName = model.BUEnglishName; user.BUPosition = model.BUPosition; user.BUMobilePhone = model.BUMobilePhone; user.Account = model.Account; var isExistAccount = model.IsExistAccount; result = HomeBusiness.SaveUser(user, isExistAccount); } } catch (Exception ex) { result.IsSuccess = false; result.Message = ex.Message; } return(Json(result)); }