📄 frmrework.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using HouseBE;
using HouseBS;
namespace frmLogin
{
/// <summary>
/// frmRework 的摘要说明。
/// </summary>
public class frmRework : System.Windows.Forms.Form
{
private DevComponents.DotNetBar.ButtonX buttonX1;
private DevComponents.DotNetBar.Controls.TextBoxX textBoxX1;
private DevComponents.DotNetBar.LabelX labelX1;
private DevComponents.DotNetBar.LabelX labelX2;
private DevComponents.DotNetBar.Controls.TextBoxX textBoxX2;
private DevComponents.DotNetBar.Controls.TextBoxX textBoxX3;
private DevComponents.DotNetBar.LabelX labelX3;
private DevComponents.DotNetBar.ButtonX buttonX2;
private DevComponents.DotNetBar.LabelX labelX4;
private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private DataSet _ds;
private HouseBE.Login _login;
private HouseBS.LoginBS _logins;
public frmRework()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this._ds=new DataSet();
this._logins=new LoginBS();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmRework));
this.buttonX1 = new DevComponents.DotNetBar.ButtonX();
this.textBoxX1 = new DevComponents.DotNetBar.Controls.TextBoxX();
this.labelX1 = new DevComponents.DotNetBar.LabelX();
this.labelX2 = new DevComponents.DotNetBar.LabelX();
this.textBoxX2 = new DevComponents.DotNetBar.Controls.TextBoxX();
this.textBoxX3 = new DevComponents.DotNetBar.Controls.TextBoxX();
this.labelX3 = new DevComponents.DotNetBar.LabelX();
this.buttonX2 = new DevComponents.DotNetBar.ButtonX();
this.labelX4 = new DevComponents.DotNetBar.LabelX();
this.comboBoxEx1 = new DevComponents.DotNetBar.Controls.ComboBoxEx();
this.SuspendLayout();
//
// buttonX1
//
this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonX1.Location = new System.Drawing.Point(56, 184);
this.buttonX1.Name = "buttonX1";
this.buttonX1.Size = new System.Drawing.Size(75, 24);
this.buttonX1.TabIndex = 0;
this.buttonX1.Text = "修改";
this.buttonX1.Click += new System.EventHandler(this.buttonX1_Click);
//
// textBoxX1
//
this.textBoxX1.AutoSize = false;
//
// textBoxX1.Border
//
this.textBoxX1.Border.Class = "TextBoxBorder";
this.textBoxX1.Location = new System.Drawing.Point(144, 48);
this.textBoxX1.Name = "textBoxX1";
this.textBoxX1.Size = new System.Drawing.Size(120, 21);
this.textBoxX1.TabIndex = 1;
//
// labelX1
//
this.labelX1.Location = new System.Drawing.Point(48, 48);
this.labelX1.Name = "labelX1";
this.labelX1.Size = new System.Drawing.Size(75, 23);
this.labelX1.TabIndex = 2;
this.labelX1.Text = "<b>旧口令:</b>";
//
// labelX2
//
this.labelX2.Location = new System.Drawing.Point(48, 92);
this.labelX2.Name = "labelX2";
this.labelX2.Size = new System.Drawing.Size(75, 23);
this.labelX2.TabIndex = 3;
this.labelX2.Text = "<b>新口令:</b>";
//
// textBoxX2
//
this.textBoxX2.AutoSize = false;
//
// textBoxX2.Border
//
this.textBoxX2.Border.Class = "TextBoxBorder";
this.textBoxX2.Location = new System.Drawing.Point(144, 92);
this.textBoxX2.Name = "textBoxX2";
this.textBoxX2.Size = new System.Drawing.Size(120, 21);
this.textBoxX2.TabIndex = 4;
//
// textBoxX3
//
this.textBoxX3.AutoSize = false;
//
// textBoxX3.Border
//
this.textBoxX3.Border.Class = "TextBoxBorder";
this.textBoxX3.Location = new System.Drawing.Point(144, 136);
this.textBoxX3.Name = "textBoxX3";
this.textBoxX3.Size = new System.Drawing.Size(120, 21);
this.textBoxX3.TabIndex = 5;
//
// labelX3
//
this.labelX3.Location = new System.Drawing.Point(48, 136);
this.labelX3.Name = "labelX3";
this.labelX3.Size = new System.Drawing.Size(75, 23);
this.labelX3.TabIndex = 6;
this.labelX3.Text = "<b>确认口令:</b>";
//
// buttonX2
//
this.buttonX2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonX2.Location = new System.Drawing.Point(176, 184);
this.buttonX2.Name = "buttonX2";
this.buttonX2.Size = new System.Drawing.Size(75, 24);
this.buttonX2.TabIndex = 7;
this.buttonX2.Text = "退出";
this.buttonX2.Click += new System.EventHandler(this.buttonX2_Click);
//
// labelX4
//
this.labelX4.Location = new System.Drawing.Point(48, 8);
this.labelX4.Name = "labelX4";
this.labelX4.Size = new System.Drawing.Size(75, 23);
this.labelX4.TabIndex = 8;
this.labelX4.Text = "<b>用户名:</b>";
//
// comboBoxEx1
//
this.comboBoxEx1.DisplayMember = "Text";
this.comboBoxEx1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.comboBoxEx1.Location = new System.Drawing.Point(144, 8);
this.comboBoxEx1.Name = "comboBoxEx1";
this.comboBoxEx1.Size = new System.Drawing.Size(120, 22);
this.comboBoxEx1.TabIndex = 9;
//
// frmRework
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(304, 221);
this.Controls.Add(this.comboBoxEx1);
this.Controls.Add(this.labelX4);
this.Controls.Add(this.buttonX2);
this.Controls.Add(this.labelX3);
this.Controls.Add(this.textBoxX3);
this.Controls.Add(this.textBoxX2);
this.Controls.Add(this.labelX2);
this.Controls.Add(this.labelX1);
this.Controls.Add(this.textBoxX1);
this.Controls.Add(this.buttonX1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmRework";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "修改密码";
this.Load += new System.EventHandler(this.frmRework_Load);
this.ResumeLayout(false);
}
#endregion
private void frmRework_Load(object sender, System.EventArgs e)
{
this._ds=this._logins.load();
foreach(DataRow row in this._ds.Tables[0].Rows)
{
this.comboBoxEx1.Items.Add(row[0].ToString());
}
}
private void buttonX1_Click(object sender, System.EventArgs e)
{
if(this.textBoxX1.Text.Length<1||this.textBoxX2.Text.Length<1||this.textBoxX3.Text.Length<1)
{
MessageBox.Show("请填写完整");
return ;
}
this._login=new Login();
this._login.LoginName=this.comboBoxEx1.Text;
this._login.LoginPwd=this.textBoxX1.Text;
this._logins.login=this._login;
try
{
if(this._logins.Logins()==false)
{
MessageBox.Show("密码错误");
return ;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
if(this.textBoxX2.Text.Equals(this.textBoxX3.Text)==false)
{
MessageBox.Show("两次密码不一致!");
return ;
}
try
{
this._login.LoginPwd=this.textBoxX2.Text;
this._logins.login=this._login;
this._logins.update();
MessageBox.Show("修改成功!");
this.comboBoxEx1.Text="";
this.textBoxX1.Text="";
this.textBoxX2.Text="";
this.textBoxX3.Text="";
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void buttonX2_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -