100 lines
3.1 KiB
C#
100 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace JJMediSys
|
|
{
|
|
public partial class SetPassword : Form
|
|
{
|
|
public SetPassword()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public bool ShowPassWord = false;
|
|
private void label1_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void Bclose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void SetPassword_Load(object sender, EventArgs e)
|
|
{
|
|
int x = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
|
|
int y = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
|
this.Location = new Point(x, y);
|
|
|
|
PassWordOld.MaxLength = 6;
|
|
PassWordNew1.MaxLength = 6;
|
|
PassWordNew2.MaxLength = 6;
|
|
}
|
|
|
|
private void BReset_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (PassWordOld.Text.Length <= 0)
|
|
{
|
|
LabInfo.Text = "旧密码不能为空";
|
|
return;
|
|
}
|
|
if (PassWordNew1.Text.Length <= 0 || PassWordNew2.Text.Length <= 0)
|
|
{
|
|
LabInfo.Text = "新密码不能为空";
|
|
return;
|
|
}
|
|
if (PassWordNew1.Text != PassWordNew2.Text)
|
|
{
|
|
LabInfo.Text = "新密码不一致";
|
|
return;
|
|
}
|
|
LabInfo.Text = "";
|
|
string Sql = "update user_info set userpass ='" + PassWordNew1.Text + "' where userid='" + Login.nurseDeskInfo.NurseID + "'";
|
|
int count = DoDBMySql.ExecuteSql(Sql);
|
|
if (count <= 0)
|
|
AlertForm.ShowAlert("更新密码失败", AlertForm.AlertType.Error, 3000);
|
|
else
|
|
AlertForm.ShowAlert("更新密码成功", AlertForm.AlertType.Success, 3000);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void bShowPassword_Click(object sender, EventArgs e)
|
|
{
|
|
if(ShowPassWord)
|
|
{
|
|
ShowPassWord = false;
|
|
bShowPassword.BackgroundImage = global::JJMediSys.Properties.Resources.开关_关;
|
|
PassWordOld.PasswordChar = '*';
|
|
PassWordNew1.PasswordChar = '*';
|
|
PassWordNew2.PasswordChar = '*';
|
|
LabNote.Text = "隐藏密码";
|
|
}
|
|
else
|
|
{
|
|
ShowPassWord = true;
|
|
bShowPassword.BackgroundImage = global::JJMediSys.Properties.Resources.开关_开;
|
|
PassWordOld.PasswordChar = (char)0x00;
|
|
PassWordNew1.PasswordChar = (char)0x00;
|
|
PassWordNew2.PasswordChar = (char)0x00;
|
|
LabNote.Text = "显示密码";
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|