예제 #1
0
 public static void updateUserInfo(TB_User user)
 {
     try
     {
         user.Update();
         //MessageHelper.ShowMessage("I001");
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message);
         MessageHelper.ShowMessage("E999");
     }
 }
예제 #2
0
 public void delUser(TB_User user)
 {
     try
     {
         //user.Isdeleted = (int)EnmIsdeleted.已删除;
         user.Update();
         MessageHelper.ShowMessage("I002");
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message);
         MessageHelper.ShowMessage("E999");
     }
 }
예제 #3
0
 public static bool changePwd(int id, string newPwd)
 {
     try
     {
         TB_User user = TB_UserDao.FindFirst(new EqExpression("Id", id));
         user.PASSWORD = DES.Encode(newPwd, Global.DB_PWDKEY);
         user.Update();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #4
0
 /// <summary>
 /// 删除用户
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDel_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         TB_User user = this.dgUser.SelectedItem as TB_User;
         user.STATUS = 0;
         user.Update();
         MessageHelper.ShowMessage("删除成功");
         bindUserData();
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
예제 #5
0
 private void btnReset_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.dgUser.SelectedItem != null)
         {
             TB_User user = this.dgUser.SelectedItem as TB_User;
             user.PASSWORD = "******";
             user.Update();
             MessageHelper.ShowMessage("密码重置成功");
             bindUserData();
         }
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage(ex.Message);
     }
 }
예제 #6
0
 /// <summary>
 /// 更新用户
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.dgUser.SelectedItem != null)
         {
             TB_User user = this.dgUser.SelectedItem as TB_User;
             user.USER_CODE = this.txtCode.Text.Trim();
             user.USER_NAME = this.txtName.Text.Trim();
             user.ROLEID    = (this.cmbUserRole.SelectedValue as PTS_TABLE_SRC).ID;
             user.DEPT      = txtDept.Text;
             user.Update();
             //MessageHelper.ShowMessage("更新成功!");
             bindUserData();
         }
     }
     catch (Exception ex)
     {
         //MessageHelper.ShowMessage("更新失败:" + ex.Message);
     }
 }
예제 #7
0
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     //判断当前密码的有效性
     if (DES.Encode(this.txtpwd.Password, Global.DB_PWDKEY) == Global.g_password)
     {
         string newpwd  = this.txtnewpwd.Password;
         string newpwd2 = this.txtnewpwd2.Password;
         if (newpwd == newpwd2)
         {
             if (newpwd.Length < 6)
             {
                 MessageHelper.ShowMessage("新密码不能少于6位!");
                 return;
             }
             TB_User user = TB_UserDao.FindFirst(new EqExpression("STATUS", 1), new EqExpression("USER_CODE", Global.g_usercode));
             if (user != null)
             {
                 user.PASSWORD = DES.Encode(this.txtnewpwd.Password, Global.DB_PWDKEY);
                 user.Update();
                 MessageHelper.ShowMessage("密码更新成功!");
                 Global.g_password = DES.Encode(this.txtnewpwd.Password, Global.DB_PWDKEY);
                 this.Close();
             }
             else
             {
                 MessageHelper.ShowMessage("当前用户信息已失效,请与管理员确认!");
             }
         }
         else
         {
             MessageHelper.ShowMessage("新密码不一致,请重新确认!");
         }
     }
     else
     {
         MessageHelper.ShowMessage("原密码与登陆密码不一致,请重新输入!");
     }
 }