You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
4.1 KiB
C#
129 lines
4.1 KiB
C#
using Rs.Framework;
|
|
using Rs.MotionPlat.Commom;
|
|
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 Rs.MotionPlat
|
|
{
|
|
public partial class UserForm : BaseFormHeader
|
|
{
|
|
|
|
public event Action<string> OnloginSuccessEvent;
|
|
public UserForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnCancle_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void UserForm_Load(object sender, EventArgs e)
|
|
{
|
|
cboxUsers.SelectedIndex = 0;
|
|
}
|
|
|
|
private void btnLogin_Click(object sender, EventArgs e)
|
|
{
|
|
/*
|
|
OP
|
|
AUDIT
|
|
PM
|
|
ENGINEER
|
|
ADMIN
|
|
|
|
*/
|
|
string username = cboxUsers.SelectedItem.ToString();
|
|
string userpwd = txtPassword.Text.Trim();
|
|
if(username==EUserLevel.OP.ToString())
|
|
{
|
|
if(userpwd == "1")
|
|
{
|
|
OnloginSuccessEvent?.Invoke(username);
|
|
GlobalUser.UserLevel = EUserLevel.OP;
|
|
GlobalUser.UserName = username;
|
|
DevLog.EventTracker(username, -1, "", "LOGIN");
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
Msgbox.ShowTipDialog( EButtonType.Ok, "userpwd error,please input again");
|
|
txtPassword.Text = "";
|
|
}
|
|
}
|
|
else if(username== EUserLevel.AUDIT.ToString())
|
|
{
|
|
if (userpwd == "1")
|
|
{
|
|
OnloginSuccessEvent?.Invoke(username);
|
|
GlobalUser.UserLevel = EUserLevel.AUDIT;
|
|
GlobalUser.UserName = username;
|
|
DevLog.EventTracker(username, -1, "", "LOGIN");
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
Msgbox.ShowTipDialog(EButtonType.Ok, "userpwd error,please input again");
|
|
txtPassword.Text = "";
|
|
}
|
|
}
|
|
else if (username == EUserLevel.PM.ToString())
|
|
{
|
|
if (userpwd == "1")
|
|
{
|
|
OnloginSuccessEvent?.Invoke(username);
|
|
GlobalUser.UserLevel = EUserLevel.PM;
|
|
GlobalUser.UserName = username;
|
|
DevLog.EventTracker(username, -1, "", "LOGIN");
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
Msgbox.ShowTipDialog(EButtonType.Ok, "userpwd error,please input again");
|
|
txtPassword.Text = "";
|
|
}
|
|
}
|
|
else if (username == EUserLevel.ENGINEER.ToString())
|
|
{
|
|
if (userpwd == "dxd")
|
|
{
|
|
OnloginSuccessEvent?.Invoke(username);
|
|
GlobalUser.UserLevel = EUserLevel.ENGINEER;
|
|
GlobalUser.UserName = username;
|
|
DevLog.EventTracker(username, -1, "", "LOGIN");
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
Msgbox.ShowTipDialog(EButtonType.Ok, "userpwd error,please input again");
|
|
txtPassword.Text = "";
|
|
}
|
|
}
|
|
else if (username == EUserLevel.ADMIN.ToString())
|
|
{
|
|
if (userpwd == "lhiven")
|
|
{
|
|
OnloginSuccessEvent?.Invoke(username);
|
|
GlobalUser.UserLevel = EUserLevel.ADMIN;
|
|
GlobalUser.UserName = username;
|
|
DevLog.EventTracker(username, -1, "", "LOGIN");
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
Msgbox.ShowTipDialog(EButtonType.Ok, "userpwd error,please input again");
|
|
txtPassword.Text = "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|