AIMS/AIMS/FormLogin.cs
2022-08-23 21:12:59 +08:00

102 lines
3.4 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.Windows.Forms;
using DevComponents.DotNetBar;
namespace AIMS
{
public partial class FormLogin : Office2007Form
{
public FormLogin()
{
this.FormBorderStyle = FormBorderStyle.None;
this.EnableGlass = false;
InitializeComponent();
}
private void frmLogin_Load(object sender, EventArgs e)
{
//label1.Text = AIMSExtension.PublicMethod.GetSystemName();
//label2.Text = "@山西瑞禾康医疗科技有限公司 V" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
txtNo.Select();
txtNo.Focus();
//#if DEBUG
// txtNo.Text = "admin";
// txtPassWord.Text = "1";
// btnOk_Click(null, null);
//#endif
}
private void btnOk_Click(object sender, EventArgs e)
{
if (AIMS.PublicUI.BLL.Person.Login(txtNo.Text, txtPassWord.Text))
{
AIMS.PublicUI.Model.Person PersonObj = AIMS.PublicUI.BLL.Person.GetModelByNo(txtNo.Text);
AIMSExtension.PublicMethod.OperatorId = PersonObj.Id;
AIMSExtension.PublicMethod.OperatorNo = PersonObj.No;
AIMSExtension.PublicMethod.OperatorName = PersonObj.Name;
AIMSExtension.PublicMethod.RoleId = PersonObj.RoleId;
AIMSExtension.PublicMethod.DepId = PersonObj.DepId;
AIMSExtension.PublicMethod.DeptName = AIMS.PublicUI.BLL.Department.GetModel(PersonObj.DepId).Name;
AIMS.PublicUI.Model.Role role = AIMS.PublicUI.BLL.Role.GetModel(PersonObj.RoleId);
AIMSExtension.PublicMethod.PermissionLevel = role.PermissionLevel;
Hide();
//在这里为编辑器注册
new System.Threading.Thread(Reg).Start();
//DevComponents.DotNetBar.StyleManager.MetroColorGeneratorParameters = DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters.Office2016Blue;
new FormMainManage().ShowDialog();
}
else
{
MessageBox.Show("用户名或密码有错误,请重新输入!", "提示", MessageBoxButtons.OK);
txtPassWord.Text = "";
txtPassWord.Focus();
}
}
/// <summary>
/// 注册全局编辑器
/// </summary>
static void Reg()
{
DCSoft.Writer.Controls.WriterControl.StaticSetRegisterCode(AIMSExtension.PublicMethod.Decrypt(Properties.Resources.C));
}
private void btnExit_Click(object sender, EventArgs e)
{
Close();
}
private void txtNo_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
txtPassWord.Select();
txtPassWord.Focus();
}
}
private void txtPassWord_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
btnOk_Click(null, null);
}
}
private void btnOk_VisibleChanged(object sender, EventArgs e)
{
txtPassWord.Text = "";
}
}
}