コード例 #1
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            BL_DangNhap dangNhap = new BL_DangNhap();
            string      MaNV     = "";

            BL_DangNhap.AccountType accountType = BL_DangNhap.AccountType.Employee;
            bool result = dangNhap.Select(txtUserName.Text.Trim(), txtPassword.Text.Trim(), ref MaNV, ref accountType, ref error);

            if (result)
            {
                this.Hide();
                FrmMain main = new FrmMain(MaNV, accountType);
                main.ShowDialog();
                if (exit == false)
                {
                    this.Show();
                    txtUserName.Clear();
                    txtPassword.Clear();
                    txtUserName.Focus();
                }
            }
            else
            {
                MessageBox.Show("Thông tin đăng nhập không chính xác. Mời nhập lại!", "Lỗi đăng nhập", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserName.Clear();
                txtPassword.Clear();
                txtUserName.Focus();
            }
        }
コード例 #2
0
        public FrmMain(string strMaNV, BL_DangNhap.AccountType accountType)
        {
            MaNV = strMaNV.Trim();
            this._accountType = accountType;
            InitializeComponent();
            Init();
            lbNgay.Text = "Ngày hiện tại: " + DateTime.Today.ToString("dddd, dd MMMM yyyy");

            if (accountType == BL_DangNhap.AccountType.Employee)
            {
                ctrlDS_NhanVien.Enabled = false;
                ctrlBaoCao.Enabled      = false;
            }
        }