/// <summary> /// 修改邮箱 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tpChangeEmail_Press(object sender, EventArgs e) { if (isDemo == false) { frmUserPwdLayout UserLayout = new frmUserPwdLayout(); eInfo = EuserInfo.修改邮箱; Form.ShowDialog(UserLayout); } else { Toast("当前为演示账号,不能进行邮箱修改!"); } }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="Type"></param> /// <param name="Value"></param> public void UpdateUserInfo(EuserInfo Type, String Value) { try { coreUser UserInfo = new coreUser(); UserInfo.USER_ID = UserID; switch (Type) { case EuserInfo.修改地址: UserInfo.USER_ADDRESS = Value; break; case EuserInfo.修改头像: UserInfo.USER_IMAGEID = Value; break; case EuserInfo.修改性别: UserInfo.USER_SEX = Convert.ToInt32(Value); break; case EuserInfo.修改昵称: UserInfo.USER_NAME = Value; break; case EuserInfo.修改生日: UserInfo.USER_BIRTHDAY = Convert.ToDateTime(Value); break; case EuserInfo.修改所属区域: UserInfo.USER_LOCATIONID = Value; break; } ReturnInfo RInfo = autofacConfig.coreUserService.UpdateUser(UserInfo, Type); if (RInfo.IsSuccess) { Toast("修改信息成功!"); } else { throw new Exception(RInfo.ErrorInfo); } } catch (Exception ex) { Toast(ex.Message); } }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="Type"></param> /// <param name="Value"></param> public void UpdateUserInfo(EuserInfo Type, String Value) { //try //{ // coreUser UserInfo = new coreUser(); // UserInfo.USER_ID = UserID; // switch (Type) // { // case EuserInfo.修改地址: // UserInfo.USER_ADDRESS = Value; // break; // case EuserInfo.修改头像: // UserInfo.USER_IMAGEID = Value; // break; // case EuserInfo.修改性别: // UserInfo.USER_SEX = Convert.ToInt32(Value); // break; // case EuserInfo.修改昵称: // UserInfo.USER_NAME = Value; // break; // case EuserInfo.修改生日: // UserInfo.USER_BIRTHDAY = Convert.ToDateTime(Value); // break; // case EuserInfo.修改所属区域: // UserInfo.USER_LOCATIONID = Value; // break; // } // ReturnInfo RInfo = autofacConfig.coreUserService.UpdateUser(UserInfo, Type); // if (RInfo.IsSuccess) // { // Toast("修改信息成功!"); // } // else // { // throw new Exception(RInfo.ErrorInfo); // } //} //catch (Exception ex) //{ // Toast(ex.Message); //} }
public Boolean isDemo; //是否是演示账号 #endregion /// <summary> /// 修改密码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tpChangePwd_Press(object sender, EventArgs e) { try { if (isDemo) { throw new Exception("当前为演示账号,不能进行密码修改!"); } else { frmUserPwdLayout UserLayout = new frmUserPwdLayout(); eInfo = EuserInfo.修改密码; Form.ShowDialog(UserLayout); } } catch (Exception ex) { Toast(ex.Message); } }
/// <summary> /// 修改昵称 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Img_Press(object sender, EventArgs e) { eInfo = EuserInfo.修改昵称; ShowDialog(Dialog); }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="entity"></param> /// <param name="Type"></param> /// <returns></returns> public ReturnInfo UpdateUser(coreUser entity, EuserInfo Type) { ReturnInfo RInfo = new ReturnInfo(); coreUser coreUser = _coreUserRepository.GetByID(entity.USER_ID).FirstOrDefault(); if (coreUser == null) { throw new Exception("该用户不存在,请检查!"); } try { switch (Type) { case EuserInfo.修改地址: coreUser.USER_ADDRESS = entity.USER_ADDRESS; break; case EuserInfo.修改头像: coreUser.USER_IMAGEID = entity.USER_IMAGEID; break; case EuserInfo.修改性别: coreUser.USER_SEX = entity.USER_SEX; break; case EuserInfo.修改昵称: coreUser.USER_NAME = entity.USER_NAME; break; case EuserInfo.修改生日: coreUser.USER_BIRTHDAY = entity.USER_BIRTHDAY; break; case EuserInfo.修改所属区域: coreUser.USER_LOCATIONID = entity.USER_LOCATIONID; break; } _unitOfWork.RegisterDirty(coreUser); if (Type == EuserInfo.修改所属区域) //由于用户所在区域变更,用户所领用借用的资产区域也一起变更 { List <Assets> listAss = _assetsRepository.GetByUser(entity.USER_ID).ToList(); if (listAss.Count > 0) { foreach (Assets Row in listAss) { Row.LOCATIONID = coreUser.USER_LOCATIONID; _unitOfWork.RegisterDirty(Row); } } } bool result = _unitOfWork.Commit(); RInfo.IsSuccess = result; RInfo.ErrorInfo = "修改信息成功!"; return(RInfo); } catch (Exception ex) { _unitOfWork.Rollback(); RInfo.IsSuccess = false; RInfo.ErrorInfo = ex.Message; return(RInfo); } }