Пример #1
0
 private void btLogout_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (XtraMessageBox.Show("Bạn có muốn đăng xuất?", "thông báo", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         formMain form = new formMain();
         this.Hide();
         form.Show();
     }
 }
Пример #2
0
 private void btlogin_Click_1(object sender, EventArgs e)
 {
     if (txtusername.Text == "" || txtpass.Text == "")
     {
         XtraMessageBox.Show("Nhập thiếu dữ liệu!", "Thông báo");
     }
     else
     {
         try
         {
             var result = account.CheckLogin(txtusername.Text, txtpass.Text);
             if (result == null)
             {
                 XtraMessageBox.Show("Sai thông tin", "Thông báo");
             }
             else
             {
                 var temp = emp.GetById(result.AccountID);
                 if (temp == null)
                 {
                     XtraMessageBox.Show("Chưa đăng ký người dùng cho tài khoản này!", "Thông báo");
                 }
                 else
                 {
                     Session.EmployeeID   = result.AccountID;
                     Session.Username     = result.UserName;
                     Session.Role         = result.Role;
                     Session.EmployeeName = temp.EmployeeName;
                     formMain form = new formMain(Session.Role);
                     this.Hide();
                     form.Show();
                 }
             }
         }
         catch
         {
             XtraMessageBox.Show("Please try again!", "Thông báo");
         }
     }
 }
Пример #3
0
        private void formLogin_FormClosed(object sender, FormClosedEventArgs e)
        {
            formMain form = new formMain();

            form.Show();
        }