You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
3.6 KiB
99 lines
3.6 KiB
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
|
|
/// Ð޸ĵ±Ç°Óû§ÃÜÂë
|
|
/// </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 where f_userid ='"+CStaticClass.UserID+"'").Tables[0].DefaultView;
|
|
if (dv.Count > 0)
|
|
{
|
|
this.lblUserID.Text = dv[0]["f_userid"].ToString();
|
|
this.lblUserName.Text = dv[0]["f_username"].ToString();
|
|
|
|
}
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
if (MessageBox.Show("ÄúÈ·ÈÏÒª±£´æÄúµÄµÇ¼ÃÜÂëÂð£¿", "²Ù×÷Ìáʾ£º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
if (this.tbPassword.Text.Trim()=="")
|
|
{
|
|
MessageBox.Show("¾ÉÃÜÂë²»ÔÊÐíÊÇ¿ÕÖµ£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
this.tbPassword.Focus();
|
|
return;
|
|
}
|
|
if (this.tbPassword1.Text.Trim() == "")
|
|
{
|
|
MessageBox.Show("ÐÂÃÜÂë²»ÔÊÐíÊÇ¿ÕÖµ£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
this.tbPassword1.Focus();
|
|
return;
|
|
}
|
|
if (this.tbPassword2.Text.Trim() == "")
|
|
{
|
|
MessageBox.Show("È·ÈÏÃÜÂë²»ÔÊÐíÊÇ¿ÕÖµ£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
this.tbPassword2.Focus();
|
|
return;
|
|
}
|
|
if (this.tbPassword1.Text.Trim() != this.tbPassword2.Text.Trim())
|
|
{
|
|
MessageBox.Show("ÐÂÃÜÂëºÍÈ·ÈÏÃÜÂë²»Ò»Ö£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
this.tbPassword2.Focus();
|
|
return;
|
|
}
|
|
DataView dv = dbo.ExceSQL("select * from t_base_users where f_userid ='" + CStaticClass.UserID + "' and f_password ='"+this.tbPassword.Text.Trim() +"'").Tables[0].DefaultView;
|
|
if (dv.Count <= 0)
|
|
{
|
|
MessageBox.Show("¾ÉÃÜÂë²»ÕýÈ·£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
this.tbPassword.Focus();
|
|
return;
|
|
|
|
}
|
|
dbo.ExceSQL("update t_base_users set f_password='" + this.tbPassword2.Text.Trim() + "' where f_userid ='" + CStaticClass.UserID + "'");
|
|
MessageBox.Show("ÃÜÂëÐ޸ijɹ¦£¡", "²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
CommonClassLib.CCarryConvert.WriteDarkCasket("Login", "UserID£º" + CStaticClass.UserID + "µÄ²Ù×÷ÈÕÖ¾", "µã»÷¡¾È·ÈÏ¡¿°´Å¥", "Ð޸ĵ±Ç°Óû§ÃÜÂë", "");
|
|
this.Close();
|
|
}
|
|
|
|
|
|
}
|
|
}
|