MES登录接口设置
This commit is contained in:
@@ -43,7 +43,6 @@ namespace JY.Inspection.Frm
|
||||
TimeSpan ts = _tempDt.Subtract(_dt);
|
||||
if (ts.Milliseconds > 100)
|
||||
{
|
||||
|
||||
txtPassword2.Text = "";//清空
|
||||
}
|
||||
else
|
||||
@@ -75,7 +74,6 @@ namespace JY.Inspection.Frm
|
||||
}
|
||||
private void btLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(txtUserID.Text) | string.IsNullOrEmpty(txtPassWord.Text))
|
||||
{
|
||||
txtUserID.Focus();
|
||||
@@ -84,12 +82,31 @@ namespace JY.Inspection.Frm
|
||||
}
|
||||
UserHelper helper = new UserHelper("");
|
||||
string strErr = "";
|
||||
var res = helper.CheckUserLogin("user.pt", txtUserID.Text.Trim(), txtPassWord.Text.Trim(), ref strErr);
|
||||
|
||||
User res = null;
|
||||
|
||||
if (check_isMesLogin.Checked)
|
||||
{
|
||||
res = helper.CheckMesUserLogin(txtUserID.Text.Trim(), txtPassWord.Text.Trim(), ref strErr);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = helper.CheckUserLogin("user.pt", txtUserID.Text.Trim(), txtPassWord.Text.Trim(), ref strErr);
|
||||
}
|
||||
|
||||
if (res == null)
|
||||
{
|
||||
txtPassWord.Focus();
|
||||
loginFailedCount++;
|
||||
MessageBox.Show($"用户名或密码不正确,登录失败({loginFailedCount})次!", "系统提示");
|
||||
if (check_isMesLogin.Checked)
|
||||
{
|
||||
MessageBox.Show($"使用MES账户登录失败,错误信息: {strErr}!", "系统提示");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"用户名或密码不正确,登录失败({loginFailedCount})次!", "系统提示");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Generated
+29
-13
@@ -42,6 +42,7 @@ namespace JY.Inspection.Frm
|
||||
this.pLogin_card = new System.Windows.Forms.Panel();
|
||||
this.lblICCard = new MetroFramework.Controls.MetroLabel();
|
||||
this.txtPassword2 = new MetroFramework.Controls.MetroTextBox();
|
||||
this.check_isMesLogin = new MetroFramework.Controls.MetroCheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.pLogin_pwd.SuspendLayout();
|
||||
this.pLogin_card.SuspendLayout();
|
||||
@@ -51,7 +52,7 @@ namespace JY.Inspection.Frm
|
||||
//
|
||||
this.chkIsSK.AutoSize = true;
|
||||
this.chkIsSK.Location = new System.Drawing.Point(237, 390);
|
||||
this.chkIsSK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.chkIsSK.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.chkIsSK.Name = "chkIsSK";
|
||||
this.chkIsSK.Size = new System.Drawing.Size(168, 17);
|
||||
this.chkIsSK.TabIndex = 20;
|
||||
@@ -61,7 +62,7 @@ namespace JY.Inspection.Frm
|
||||
// btExit
|
||||
//
|
||||
this.btExit.Location = new System.Drawing.Point(279, 428);
|
||||
this.btExit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.btExit.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btExit.Name = "btExit";
|
||||
this.btExit.Size = new System.Drawing.Size(127, 46);
|
||||
this.btExit.TabIndex = 22;
|
||||
@@ -72,7 +73,7 @@ namespace JY.Inspection.Frm
|
||||
// btLogin
|
||||
//
|
||||
this.btLogin.Location = new System.Drawing.Point(81, 428);
|
||||
this.btLogin.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.btLogin.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btLogin.Name = "btLogin";
|
||||
this.btLogin.Size = new System.Drawing.Size(127, 46);
|
||||
this.btLogin.TabIndex = 21;
|
||||
@@ -83,7 +84,7 @@ namespace JY.Inspection.Frm
|
||||
//
|
||||
this.pictureBox1.Image = global::JY.Inspection.Properties.Resources.登录;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(153, 55);
|
||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(168, 165);
|
||||
this.pictureBox1.TabIndex = 18;
|
||||
@@ -95,10 +96,10 @@ namespace JY.Inspection.Frm
|
||||
//
|
||||
//
|
||||
this.txtUserID.CustomButton.Image = null;
|
||||
this.txtUserID.CustomButton.Location = new System.Drawing.Point(236, 1);
|
||||
this.txtUserID.CustomButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.txtUserID.CustomButton.Location = new System.Drawing.Point(177, 1);
|
||||
this.txtUserID.CustomButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtUserID.CustomButton.Name = "";
|
||||
this.txtUserID.CustomButton.Size = new System.Drawing.Size(36, 34);
|
||||
this.txtUserID.CustomButton.Size = new System.Drawing.Size(27, 27);
|
||||
this.txtUserID.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
|
||||
this.txtUserID.CustomButton.TabIndex = 1;
|
||||
this.txtUserID.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
|
||||
@@ -107,7 +108,7 @@ namespace JY.Inspection.Frm
|
||||
this.txtUserID.Lines = new string[] {
|
||||
"Admin"};
|
||||
this.txtUserID.Location = new System.Drawing.Point(108, 16);
|
||||
this.txtUserID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.txtUserID.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtUserID.MaxLength = 32767;
|
||||
this.txtUserID.Name = "txtUserID";
|
||||
this.txtUserID.PasswordChar = '\0';
|
||||
@@ -131,10 +132,10 @@ namespace JY.Inspection.Frm
|
||||
//
|
||||
//
|
||||
this.txtPassWord.CustomButton.Image = null;
|
||||
this.txtPassWord.CustomButton.Location = new System.Drawing.Point(236, 1);
|
||||
this.txtPassWord.CustomButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.txtPassWord.CustomButton.Location = new System.Drawing.Point(177, 1);
|
||||
this.txtPassWord.CustomButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtPassWord.CustomButton.Name = "";
|
||||
this.txtPassWord.CustomButton.Size = new System.Drawing.Size(36, 34);
|
||||
this.txtPassWord.CustomButton.Size = new System.Drawing.Size(27, 27);
|
||||
this.txtPassWord.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
|
||||
this.txtPassWord.CustomButton.TabIndex = 1;
|
||||
this.txtPassWord.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
|
||||
@@ -143,7 +144,7 @@ namespace JY.Inspection.Frm
|
||||
this.txtPassWord.Lines = new string[] {
|
||||
"Admin"};
|
||||
this.txtPassWord.Location = new System.Drawing.Point(108, 60);
|
||||
this.txtPassWord.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.txtPassWord.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtPassWord.MaxLength = 32767;
|
||||
this.txtPassWord.Name = "txtPassWord";
|
||||
this.txtPassWord.PasswordChar = '*';
|
||||
@@ -246,11 +247,25 @@ namespace JY.Inspection.Frm
|
||||
this.txtPassword2.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
|
||||
this.txtPassword2.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
|
||||
//
|
||||
// check_isMesLogin
|
||||
//
|
||||
this.check_isMesLogin.AutoSize = true;
|
||||
this.check_isMesLogin.Checked = true;
|
||||
this.check_isMesLogin.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.check_isMesLogin.Location = new System.Drawing.Point(81, 390);
|
||||
this.check_isMesLogin.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.check_isMesLogin.Name = "check_isMesLogin";
|
||||
this.check_isMesLogin.Size = new System.Drawing.Size(114, 17);
|
||||
this.check_isMesLogin.TabIndex = 28;
|
||||
this.check_isMesLogin.Text = "MES员工登录";
|
||||
this.check_isMesLogin.UseSelectable = true;
|
||||
//
|
||||
// LoginForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(472, 529);
|
||||
this.Controls.Add(this.check_isMesLogin);
|
||||
this.Controls.Add(this.pLogin_pwd);
|
||||
this.Controls.Add(this.pLogin_card);
|
||||
this.Controls.Add(this.chkIsSK);
|
||||
@@ -258,7 +273,7 @@ namespace JY.Inspection.Frm
|
||||
this.Controls.Add(this.btLogin);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "LoginForm";
|
||||
@@ -290,5 +305,6 @@ namespace JY.Inspection.Frm
|
||||
private System.Windows.Forms.Panel pLogin_card;
|
||||
private MetroFramework.Controls.MetroLabel lblICCard;
|
||||
private MetroFramework.Controls.MetroTextBox txtPassword2;
|
||||
private MetroFramework.Controls.MetroCheckBox check_isMesLogin;
|
||||
}
|
||||
}
|
||||
@@ -137,8 +137,6 @@ namespace JY.Inspection.Frm
|
||||
/// <param name="e"></param>
|
||||
private void btAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
User user = GetUser(ListUser);
|
||||
var res = helper.AddUser("user.pt", ListUser, user);
|
||||
if (res)
|
||||
|
||||
Reference in New Issue
Block a user