103 lines
3.8 KiB
C#
103 lines
3.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using DBFactory;
|
|||
|
namespace ControlSystem
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Creator:Richard.liu
|
|||
|
/// <20>ĵ<DEB8>ǰ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public partial class FrmPassword : Form
|
|||
|
{
|
|||
|
private static FrmPassword _formInstance;
|
|||
|
public static FrmPassword FormInstance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_formInstance == null)
|
|||
|
{
|
|||
|
_formInstance = new FrmPassword();
|
|||
|
}
|
|||
|
return _formInstance;
|
|||
|
}
|
|||
|
set { _formInstance = value; }
|
|||
|
}
|
|||
|
DBOperator dbo =CStaticClass.dbo;
|
|||
|
public FrmPassword()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
_formInstance=this;
|
|||
|
}
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
|
|||
|
private void FrmPassword_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
DataView dv = dbo.ExceSQL("select * from t_base_users ").Tables[0].DefaultView;
|
|||
|
if (dv.Count > 0)
|
|||
|
{
|
|||
|
//this.lblUserID.Text = dv[0]["f_userid"].ToString();
|
|||
|
//this.lblUserName.Text = dv[0]["f_username"].ToString();
|
|||
|
this.comboBox1.DisplayMember = "f_username";
|
|||
|
this.comboBox1.ValueMember = "f_userid";
|
|||
|
this.comboBox1.DataSource = dv;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (MessageBox.Show("<22><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbPassword.Text.Trim()=="")
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbPassword.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbPassword1.Text.Trim() == "")
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbPassword1.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbPassword2.Text.Trim() == "")
|
|||
|
{
|
|||
|
MessageBox.Show("ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbPassword2.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbPassword1.Text.Trim() != this.tbPassword2.Text.Trim())
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>벻һ<EBB2BB>£<EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbPassword2.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
DataView dv = dbo.ExceSQL("select * from t_base_users where f_userid ='" + this.comboBox1.SelectedValue.ToString() + "' and f_password ='"+this.tbPassword.Text.Trim() +"'").Tables[0].DefaultView;
|
|||
|
if (dv.Count <= 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB>ȷ<EFBFBD><C8B7>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbPassword.Focus();
|
|||
|
return;
|
|||
|
|
|||
|
}
|
|||
|
dbo.ExceSQL("update t_base_users set f_password='" + this.tbPassword2.Text.Trim() + "' where f_userid ='" + this.comboBox1.SelectedValue.ToString() + "'");
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>ijɹ<C4B3><C9B9><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
|
|||
|
CommonClassLib.CCarryConvert.WriteDarkCasket("Login", "UserID<49><44>" + this.comboBox1.SelectedValue.ToString() + "<22>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>־", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD>ť", "<22>ĵ<DEB8>ǰ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>", "");
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|