12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Data;
- using System.Windows.Forms;
- using UAS_AutoPass.ToolClass;
- namespace UAS_AutoPass
- {
- public partial class Login : Form
- {
- DataHelper dh = new DataHelper();
- public Login()
- {
- StartPosition = FormStartPosition.CenterScreen;
- InitializeComponent();
- }
- private void CheckLogin_Click(object sender, EventArgs e)
- {
- string ErrMessage = "";
- if (LogicHandler.CheckUserLogin(UserName.Text, PassWord.Text, out ErrMessage))
- {
- if (LogicHandler.CheckUserAndResourcePassed(UserName.Text, Source.Text, out ErrMessage))
- {
- BaseUtil.SetCacheData("UserName", UserName.Text);
- BaseUtil.SetCacheData("Source", Source.Text);
- AutoAnalysisXml xml = new AutoAnalysisXml(UserName.Text, Source.Text);
- Hide();
- xml.ShowDialog();
- Close();
- }
- else MessageBox.Show(ErrMessage);
- }
- else MessageBox.Show(ErrMessage);
- }
- private void Login_Load(object sender, EventArgs e)
- {
- DataTable DB = (DataTable)dh.ExecuteSql("select ms_pwd,ma_user,ma_address,ma_inneraddress from master where ma_user='MES'", "select");
- Master.DataSource = DB;
- Master.DisplayMember = "ma_user";
- Master.ValueMember = "ma_user";
- UserName.Text = BaseUtil.GetCacheData("UserName").ToString();
- Source.Text = BaseUtil.GetCacheData("Source").ToString();
- if (UserName.Text != "")
- {
- PassWord.Focus();
- }
- }
- }
- }
|