private void btnOK_Click(object sender, EventArgs e) { try { if (!cmn.Confirm("确定交班?")) { return; } SysUserInfoModel mUser = new SysUserInfoModel(); mUser.UserId = int.Parse(cboUser.SelectedValue.ToString()); mUser.UserPassWord = txtPsw.Text; if (bUser.CheckUserInfo(mUser)) { mHandOver.CurrentUserInfo.UserId = UserInfo.UserId; mHandOver.NextUserInfo.UserId = int.Parse(cboUser.SelectedValue.ToString()); mHandOver.HandInMoney = double.Parse(cmn.CheckIsDouble(txtHandIn, "上交金额").ToString("0.00")); mHandOver.ToNextMoney = double.Parse(lblToNext.Text); mHandOver.CommonInfo.CreateUserId = UserInfo.UserId; if (bHandOver.InsertHandOver(mHandOver) > 0) { UserInfo = bUser.GetUserInfo(mUser); this.DialogResult = DialogResult.OK; this.Close(); } } else { throw new Exception("密码验证错误!"); } } catch (Exception err) { cmn.Show(err.Message); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (UserInfo.UserId > 0) { if (string.IsNullOrEmpty(txtOldPsw.Text) || string.IsNullOrEmpty(txtNewPsw.Text) || string.IsNullOrEmpty(txtCfmPsw.Text)) { throw new Exception("信息不完整"); } if (txtNewPsw.Text != txtCfmPsw.Text) { throw new Exception("密码不一致"); } SysUserInfoModel mUser = new SysUserInfoModel(); mUser.UserId = UserInfo.UserId; mUser.UserNo = UserInfo.UserNo; mUser.UserPassWord = txtOldPsw.Text; if (bUser.CheckUserInfo(mUser)) { if (!cmn.Confirm("确定修改密码?你的新密码为" + txtNewPsw.Text)) { return; } mUser.NewPsw = MyMD5.MD5Encrypt(txtNewPsw.Text, "INDEXSFT"); if (bUser.UpdateUserInfo(mUser, new ObjectControls(MCtrl.SetPsw)) > 0) { cmn.Show("密码修改成功."); } else { cmn.Show("发生未知错误,密码修改失败."); } this.Close(); } else { throw new Exception("密码不正确"); } } } catch (Exception err) { lblMsg.Text = err.Message; } }
private void btnUnLock_Click(object sender, EventArgs e) { try { SysUserInfoModel mUser = new SysUserInfoModel(); mUser.UserId = UserInfo.UserId; mUser.UserPassWord = txtPsw.Text; if (bUser.CheckUserInfo(mUser)) { this.DialogResult = DialogResult.OK; this.Close(); } else { throw new Exception("密码错误!"); } } catch (Exception err) { lblMsg.Text = err.Message; } }