using System; |
using System.Collections.Generic; |
using System.ComponentModel; |
using System.Data; |
using System.Drawing; |
using System.Text; |
using System.Windows.Forms; |
using Common; |
using System.Data.SqlClient; |
namespace Pos |
{ |
public partial class frmPwdChange : Form |
{ |
public frmPwdChange() |
{ |
InitializeComponent(); |
} |
private void btnOK_Click( object sender, EventArgs e) |
{ |
if (txtNew.Text != txtConfirm.Text) |
{ |
MessageBox.Show( "您输入的新密码与确认密码不一致!" , "友好提示" , MessageBoxButtons.OK, MessageBoxIcon.Information); |
return ; |
} |
string strsql = string .Format( "select User_pwd from cen_user where User_code='{0}'" , PUser.UserCode); |
DataSet ds = SQLHelper.ExecuteDataSet(strsql); |
if (ds.Tables[0].Rows[0][ "User_pwd" ].ToString() == txtOld.Text) |
{ |
string strsql2 = string .Format( "update cen_user set User_pwd='{0}' where User_code='{1}'" , txtNew.Text, PUser.UserCode ); |
SQLHelper.ExecuteNonQuery(strsql2); |
MessageBox.Show( "密码修改成功!" , "友好提示" , MessageBoxButtons.OK, MessageBoxIcon.Information); |
} |
else |
{ |
MessageBox.Show( "您输入的旧密码不对!" , "友好提示" , MessageBoxButtons.OK, MessageBoxIcon.Information); |
return ; |
} |
|
this .Close(); |
} |
private void btnCancel_Click( object sender, EventArgs e) |
{ |
this .Close(); |
} |
} |
} |