Exemplo n.º 1
0
 private void butOK_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.txtUsername.Text == string.Empty)
         {
             XtraMessageBox.Show("Tên đăng nhập không được để trống!", "Bionet - Sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             this.txtUsername.Focus();
             return;
         }
         if (this.txtPassword.Text == string.Empty)
         {
             XtraMessageBox.Show("Mật khẩu không được để trống!", "Bionet - Sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             this.txtPassword.Focus();
             return;
         }
         if (txtUsername.Text != string.Empty && txtPassword.Text != string.Empty)
         {
             string pass        = BioBLL.GetMD5(txtPassword.Text);
             bool   bCheckLogin = BioBLL.CheckLogin(txtUsername.Text, pass);
             if (bCheckLogin)
             {
                 this._EmployeeCode = BioBLL.GetEmployeeCode(txtUsername.Text);
                 this.Close();
             }
             else
             {
                 XtraMessageBox.Show("Sai thông tin đăng nhập!", "Bionet - Sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 this.txtUsername.Focus();
                 this._username     = string.Empty;
                 this._fullname     = string.Empty;
                 this._EmployeeCode = string.Empty;
                 this.shiftCode     = string.Empty;
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show("Chưa kết nối với dữ liệu!\t\n-Liên hệ quản trị để kiểm tra chi tiết:\t\n" + ex.ToString(), "Bionet - Sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
 }