123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using DevExpress.XtraEditors;
- using ProjectBase.Data.Encrypt;
- using ProjectBase.Data.BaseDAL;
- using SIMDP.BLL;
- using ProjectBase.Data.Logs;
- namespace SIMDP.View
- {
- public partial class FormUserVerification : DevExpress.XtraEditors.XtraForm
- {
- public FormUserVerification()
- {
- InitializeComponent();
- }
- private void btn_Ok_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_Account.Text))
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("请输入账号。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (string.IsNullOrEmpty(this.txt_Password.Text))
- {
- DevExpress.XtraEditors.XtraMessageBox.Show("请输入密码。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- try
- {
- string userid = this.txt_Account.Text.Trim();
- string passwordMD5 = EncodeHelper.EncryptString(this.txt_Password.Text);
- string message = null;
- //权限认证
- bool flag = BLLFactory<BlAuthoryUser>.Instance.VerifyAuthorization(userid, passwordMD5, out message);
- if (flag)
- {
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
- else
- {
- DevExpress.XtraEditors.XtraMessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- }
- catch (Exception ex)
- {
- LogHelper.log.Error(string.Format("用户验证出现错误:{0}", ex.ToString()));
- }
- }
- private void txt_Account_Enter(object sender, EventArgs e)
- {
- txt_Account.SelectAll();
- }
- private void txt_Password_Enter(object sender, EventArgs e)
- {
- txt_Password.SelectAll();
- }
- protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
- {
- int WM_KEYDOWN = 256;
- int WM_SYSKEYDOWN = 260;
- if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN)
- {
- switch (keyData)
- {
- case Keys.Escape:
- //Application.Exit();
- this.Close();
- break;
- }
- }
- return false;
- }
- }
- }
|