using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;
using Core.Mes.ClientFrameWork;
using Core.Mes.IBaseInterface;
namespace Core.Mes.ClientManager
{
///
/// FrmPasswd 的摘要说明。
///
public class FrmPasswd : System.Windows.Forms.Form
{
#region "Construct "
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
///
/// 必需的设计器变量。
///
private System.ComponentModel.Container components = null;
public FrmPasswd()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
///
/// 清理所有正在使用的资源。
///
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(64, 14);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(112, 21);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(64, 43);
this.textBox2.Name = "textBox2";
this.textBox2.PasswordChar = '*';
this.textBox2.Size = new System.Drawing.Size(112, 21);
this.textBox2.TabIndex = 1;
this.textBox2.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(64, 72);
this.textBox3.Name = "textBox3";
this.textBox3.PasswordChar = '*';
this.textBox3.Size = new System.Drawing.Size(112, 21);
this.textBox3.TabIndex = 2;
this.textBox3.Text = "";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(64, 101);
this.textBox4.Name = "textBox4";
this.textBox4.PasswordChar = '*';
this.textBox4.Size = new System.Drawing.Size(112, 21);
this.textBox4.TabIndex = 3;
this.textBox4.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 136);
this.button1.Name = "button1";
this.button1.TabIndex = 4;
this.button1.Text = "修改";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(101, 136);
this.button2.Name = "button2";
this.button2.TabIndex = 5;
this.button2.Text = "关闭";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(42, 17);
this.label1.TabIndex = 6;
this.label1.Text = "用户名";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(16, 45);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(42, 17);
this.label2.TabIndex = 7;
this.label2.Text = "旧密码";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(16, 74);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(42, 17);
this.label3.TabIndex = 8;
this.label3.Text = "新密码";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(4, 103);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(54, 17);
this.label4.TabIndex = 9;
this.label4.Text = "确认密码";
//
// FrmPasswd
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(192, 173);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmPasswd";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "修改密码";
this.Load += new System.EventHandler(this.FrmPasswd_Load);
this.ResumeLayout(false);
}
#endregion
#endregion
#region " Valiable "
public string strUserID = "";
public bool _remoteFlag = false;
#endregion
#region " Init "
private void FrmPasswd_Load(object sender, System.EventArgs e)
{
this.textBox1.Text = ClientCommon._UserInfo.LoginID;
}
#endregion
#region " Button Events "
private void button1_Click(object sender, System.EventArgs e)
{
if (this.textBox3.Text.Trim() != this.textBox4.Text.Trim())
{
MessageBox.Show("两次输入的新密码不一致,请重新设定。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
string strOut = "";
string loginID = this.textBox1.Text.Trim();
string passwd = this.textBox2.Text.Trim();
string passwdNew = this.textBox3.Text.Trim();
try
{
SimpleReturnObject _out;
object obj = ClientCommon._RemotingHelp.ExecuteMethod("ServerCommon", "Core.Mes.ServerCommon.UserInfoManager", "CheckPWD",
new object[] { passwdNew }, out _out);
if (_out.ErrCode != 0)
{
MessageBox.Show(_out.ErrMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
obj = ClientCommon._RemotingHelp.ExecuteMethod("ServerCommon", "Core.Mes.ServerCommon.UserInfoManager", "ChangePasswd",
new object[] { loginID, passwd, passwdNew }, out strOut);
if (strOut != "") throw new Exception(strOut);
if (Convert.ToInt32(obj) > 0)
{
MessageBox.Show("密码修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
return;
}
else
{
MessageBox.Show("密码修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show("密码修改失败!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void button2_Click(object sender, System.EventArgs e)
{
this.Close();
}
#endregion
}
}