Ejemplo n.º 1
0
 private void frmDangNhap_Load(object sender, EventArgs e)
 {
     cmbKhoa.DataSource    = DangNhapBUL.LoadPhanManh();
     cmbKhoa.DisplayMember = "TENKHOA";   //tên field chứa dữ liệu ta chọn
     cmbKhoa.ValueMember   = "TENSERVER"; //tên field chứa dữ liệu tương ứng với item ta chọn
     cmbKhoa.SelectedIndex = 1;           //số thứ tự item (-1 --> count -1)
     cmbKhoa.SelectedIndex = 0;
 }
Ejemplo n.º 2
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            if (txtTaiKhoan.Text == "")
            {
                MessageBox.Show("Tên tài khoản không được để trống!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (txtMatKhau.Text == "")
            {
                MessageBox.Show("Mật khẩu không được để trống!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string user = txtTaiKhoan.Text;
            string pass = txtMatKhau.Text;

            if (DangNhapBUL.KiemTraTaiKhoan(user, pass) == 0)
            {
                MessageBox.Show("Tài khoản hoặc mật khẩu không chính xác.", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Common.Data.m_nKhoa = cmbKhoa.SelectedIndex;
            if (DangNhapBUL.KiemTraTaiKhoan(user, pass) == 1)
            {
                MessageBox.Show("Tài khoản không có quyền truy cập.", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            PrintInfoLoginEvent(Data.m_strMaGV, Data.m_strHoten, Data.m_strGroup);

            MessageBox.Show("Đăng nhập thành công", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
            if (cmbKhoa.SelectedValue.ToString().Equals(Common.Constant.PUBLICATION_NAME_KT) == false)
            {
                Common.Data.bds_CNTT_VT.DataSource = Load_2_PhanManh();
            }
            this.Close();
            Common.Data.m_objConnection.Close();
        }