修改密码 固化锁线程 加oldplctrigger,避免重复调用
This commit is contained in:
1 parent
60cafc4f8c
commit
d20b935213
9 files changed
+303
-195
No files matched your search
@@ -35,7 +35,7 @@ namespace WindowsFormsApp1
|
||||
public ImageDisplayForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetCurrentName("test");
|
||||
SetCurrentName(Init.ImageName);
|
||||
|
||||
// 初始化自动更新定时器
|
||||
autoUpdateTimer = new Timer();
|
||||
@@ -110,7 +110,7 @@ namespace WindowsFormsApp1
|
||||
private void AutoUpdateTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// 这里应该从某处获取当前位置变量
|
||||
string newPosition = GetCurrentPosition();
|
||||
string newPosition = Init.ImageLocation.ToString();
|
||||
|
||||
if (newPosition != currentPosition || (string.IsNullOrEmpty(currentPosition) && !string.IsNullOrEmpty(newPosition)))
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
using WindowsFormsApp1.server;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
@@ -30,14 +31,28 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
|
||||
SQLiteHelper<t_user> sQLiteHelper = new db.SQLiteHelper<t_user>();
|
||||
var result = sQLiteHelper.QuerySingle(a=>a.username == textBox1.Text && a.password == textBox2.Text);
|
||||
if (textBox1.Text == "admin")
|
||||
{
|
||||
var result = sQLiteHelper.QuerySingle(a => a.username == textBox1.Text && a.password == textBox2.Text);
|
||||
if (!result.Success)
|
||||
{
|
||||
MessageBox.Show("管理员账户密码错误!");
|
||||
return;
|
||||
}
|
||||
Init.t_User = result.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
Init.t_User = new t_user();
|
||||
Init.t_User.username = textBox1.Text;
|
||||
}
|
||||
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
var result_combox = sQLiteHelper1.QuerySingle(a=>a.id == (int)comboBox1.SelectedValue);
|
||||
|
||||
if (!result.Success || !result_combox.Success)
|
||||
if (!result_combox.Success)
|
||||
{
|
||||
MessageBox.Show("账号/密码/产线错误!");
|
||||
MessageBox.Show("产线错误!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -51,7 +66,6 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
|
||||
Init.t_Lineplcs = lineplc_result.Data;
|
||||
Init.t_User = result.Data;
|
||||
Init.t_Line = result_combox.Data;
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
@@ -61,7 +75,7 @@ namespace WindowsFormsApp1
|
||||
private void LoginForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
SQLiteHelper<t_line> sQLiteHelper1 = new db.SQLiteHelper<t_line>();
|
||||
var result_combox = sQLiteHelper1.QueryAll();
|
||||
var result_combox = sQLiteHelper1.Query(x => x.lineremark7 == "1");
|
||||
if (!result_combox.Success)
|
||||
{
|
||||
MessageBox.Show("查询失败");
|
||||
|
||||
+73
-60
@@ -29,14 +29,14 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.textBox3 = 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.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -51,89 +51,102 @@
|
||||
this.groupBox1.Controls.Add(this.textBox2);
|
||||
this.groupBox1.Controls.Add(this.textBox1);
|
||||
this.groupBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.groupBox1.Location = new System.Drawing.Point(25, 28);
|
||||
this.groupBox1.Location = new System.Drawing.Point(50, 56);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(351, 268);
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.groupBox1.Size = new System.Drawing.Size(702, 536);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "修改密码";
|
||||
//
|
||||
// textBox1
|
||||
// label3
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(105, 45);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(201, 26);
|
||||
this.textBox1.TabIndex = 0;
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(34, 312);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(111, 33);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "新密码";
|
||||
//
|
||||
// textBox2
|
||||
// label2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(105, 94);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(201, 26);
|
||||
this.textBox2.TabIndex = 1;
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(34, 208);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(111, 33);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "新密码";
|
||||
//
|
||||
// textBox3
|
||||
// label1
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(105, 146);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(201, 26);
|
||||
this.textBox3.TabIndex = 2;
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(34, 90);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(111, 33);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "原密码";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(35, 213);
|
||||
this.button1.Location = new System.Drawing.Point(70, 426);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(100, 40);
|
||||
this.button1.Size = new System.Drawing.Size(200, 80);
|
||||
this.button1.TabIndex = 3;
|
||||
this.button1.Text = "修改密码";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(210, 292);
|
||||
this.textBox3.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.PasswordChar = '*';
|
||||
this.textBox3.Size = new System.Drawing.Size(398, 44);
|
||||
this.textBox3.TabIndex = 2;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(210, 188);
|
||||
this.textBox2.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.PasswordChar = '*';
|
||||
this.textBox2.Size = new System.Drawing.Size(398, 44);
|
||||
this.textBox2.TabIndex = 1;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(210, 90);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(398, 44);
|
||||
this.textBox1.TabIndex = 0;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(216, 213);
|
||||
this.button2.Location = new System.Drawing.Point(432, 426);
|
||||
this.button2.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(100, 40);
|
||||
this.button2.Size = new System.Drawing.Size(200, 80);
|
||||
this.button2.TabIndex = 4;
|
||||
this.button2.Text = "关闭";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// label1
|
||||
// UserChangeP
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(17, 45);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(55, 16);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "原密码";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(17, 104);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(55, 16);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "新密码";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(17, 156);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(55, 16);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "新密码";
|
||||
//
|
||||
// USER_ChangeP
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(404, 320);
|
||||
this.ClientSize = new System.Drawing.Size(808, 640);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "USER_ChangeP";
|
||||
this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
|
||||
this.Name = "UserChangeP";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "USER_ChangeP";
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
@@ -148,10 +161,10 @@
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1.db;
|
||||
using WindowsFormsApp1.mod;
|
||||
|
||||
namespace WindowsFormsApp1.form
|
||||
{
|
||||
@@ -24,7 +26,34 @@ namespace WindowsFormsApp1.form
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(string.IsNullOrEmpty(textBox1.Text)|| string.IsNullOrEmpty(textBox2.Text)|| string.IsNullOrEmpty(textBox3.Text))
|
||||
{
|
||||
MessageBox.Show("新旧密码不能为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (textBox1.Text != Init.t_User.password)
|
||||
{
|
||||
MessageBox.Show("原密码不正确!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (textBox2.Text != textBox3.Text)
|
||||
{
|
||||
MessageBox.Show("两次新密码不一致!");
|
||||
return;
|
||||
}
|
||||
Init.t_User.password = textBox2.Text;
|
||||
SQLiteHelper<t_user> userHelper = new SQLiteHelper<t_user>();
|
||||
var result = userHelper.Update(Init.t_User);
|
||||
if (!result.Success)
|
||||
{
|
||||
MessageBox.Show("密码修改失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
MessageBox.Show("密码修改成功");
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user