示例#1
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            string    sql = string.Format("select TaiKhoan from Account where TaiKhoan='{0}' and MatKhau='{1}'", txtUseName.Text, txtPassWord.Text);
            DataTable dt  = sqlHelper.Query(sql);

            if (dt.Rows.Count == 1)
            {
                SingletonData.Getlates().nguoidung = new Account()
                {
                    TaiKhoan = txtUseName.Text
                };
                MessageBox.Show("Đăng nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ///////////////////////

                if (ckLuu.Checked)
                {
                    file.ghifileLG(padFile, txtUseName.Text.Trim(),
                                   txtPassWord.Text.Trim());
                    lblsuccess.Text     = "✓ success";
                    ckLuu.Enabled       = false;
                    btnDangNhap.Enabled = true;
                }
                else
                {
                    lblsuccess.Text = "X error";
                }
                this.Close();
            }
            else
            {
                SingletonData.Getlates().nguoidung = null;
                MessageBox.Show("Đăng nhập thất bại. Xem lại tài khoản hoặc mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void btnLogin_ItemClick(object sender, ItemClickEventArgs e)
        {
            nd = new TaiKhoan();
            frmLogin login = new frmLogin();

            login.ShowDialog();
            nd = SingletonData.Getlates().nguoidung;
            if (nd != null)
            {
                btnLogin.Enabled   = false;
                menuQuanLy.Visible = true;
            }
        }
示例#3
0
        private void mnHT_Login_Click(object sender, EventArgs e)
        {
            frmLogin login = new frmLogin();

            login.ShowDialog();
            nd = SingletonData.Getlates().nguoidung;
            if (nd != null)
            {
                mnHT_Login.Enabled = false;
                mnuKB.Enabled      = true;
                lblNguoidung.Text  = nd.TaiKhoan;
            }
        }
示例#4
0
文件: frmMain.cs 项目: seakBz/CShap
        private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
        {
            nd = new Account();
            frmLogin login = new frmLogin();

            login.ShowDialog();
            nd = SingletonData.Getlates().nguoidung;
            if (nd != null)
            {
                btnLogin.Enabled          = false;
                lblNguoiDung.Caption      = nd.TaiKhoan;
                btnQuanLyGiaoVien.Enabled = true;
                btnQuanLyHoc.Enabled      = true;
                btnQuanLyHS.Enabled       = true;
                btnQuanLyLopHoc.Enabled   = true;
                btnQuanLyMonHoc.Enabled   = true;
            }
        }
示例#5
0
文件: frmLogin.cs 项目: seakBz/CShap
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            string    sql = string.Format("select TaiKhoan from Account where TaiKhoan='{0}' and MatKhau='{1}'", txtUseName.Text, txtPassWord.Text);
            DataTable dt  = sqlHelper.Query(sql);

            if (dt.Rows.Count == 1)
            {
                SingletonData.Getlates().nguoidung = new Account()
                {
                    TaiKhoan = txtUseName.Text
                };
                MessageBox.Show("Đăng nhập thành công!");
                this.Close();
            }
            else
            {
                SingletonData.Getlates().nguoidung = null;
                MessageBox.Show("Đăng nhập thất bại. Xem lại tài khoản hoặc mật khẩu!");
            }
        }
示例#6
0
文件: frmLogin.cs 项目: seakBz/CNPM
 private void btnDangNhap_Click(object sender, EventArgs e)
 {
     lstTK = TaiKhoanController.getAllDataTaiKhoan();
     try
     {
         foreach (TaiKhoan tk in lstTK)
         {
             if (tk.TenTaiKhoan == txtUserName.Text.Trim() && tk.MatKhau == txtPassWord.Text.Trim())
             {
                 SingletonData.Getlates().nguoidung = new TaiKhoan()
                 {
                     TenTaiKhoan = txtUserName.Text
                 };
                 MessageBox.Show("Đăng nhập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 if (ckLuu.Checked)
                 {
                     file.ghifileLG(pathFile, txtUserName.Text.Trim(),
                                    txtPassWord.Text.Trim());
                     lblLuu.Text         = "✓ success";
                     ckLuu.Enabled       = false;
                     btnDangNhap.Enabled = true;
                 }
                 else
                 {
                     lblLuu.Text = "X error";
                 }
                 this.Close();
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     SingletonData.Getlates().nguoidung = null;
     MessageBox.Show("Đăng nhập thất bại. Xem lại tài khoản hoặc mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }