private void txtUsername_TextChanged(object sender, EventArgs e) { try { lblWarningUsername.Visible = true; if (txtUsername.Text.IndexOf(' ') > -1) { this.lblWarningUsername.ForeColor = System.Drawing.Color.Red; this.lblWarningUsername.Text = "không cho phép ký tự trắng"; ThoaMan = false; } else { if (ChucNang == 1) { string query = " select Username from tblUsers where Username ='******' "; if (cls.GetList(query, "Username") != null && cls.GetList(query, "Username").Length > 0) { this.lblWarningUsername.ForeColor = System.Drawing.Color.Red; this.lblWarningUsername.Text = "Username đã tồn tại!"; ThoaMan = false; return; } } this.lblWarningUsername.ForeColor = System.Drawing.Color.Green; this.lblWarningUsername.Text = "ok!"; ThoaMan = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void KiemTraDangNhap(string Username, string Password) { if (Username == "" || Password == "") { MessageBox.Show("Điền thiếu thông tin"); return; } string query = " select * from tblUsers where Username ='******' and Password ='******' "; if (cls.GetList(query, "Username").Length > 0) { clsStatic.Username = cls.GetList(query, "Username")[0]; clsStatic.GiamSatNhapLieu_save("", "Đăng nhập", "DangNhap", "Đăng nhập thành công!"); Main main = new Main(); this.Hide(); main.ShowDialog(); this.Show(); //HoSo hoso = new HoSo(); //this.Hide(); //hoso.ShowDialog(); //this.Show(); } else { MessageBox.Show("Đăng nhập không thành công!"); } }
private void LoadCmbMaQuyenCha() { string query = " select distinct MaQuyen from tblTuDienQuyenHan "; string[] items = cls.GetList(query, "MaQuyen"); cmbMaQuyenCha.Items.Clear(); foreach (string item in items) { cmbMaQuyenCha.Items.Add(item); } }
private string[] GetMaBienDong(int _MaHoSo) { string query = " select MaBienDong from tblBienDong where MaHoSo = " + _MaHoSo.ToString(); return(cls.GetList(query, "MaBienDong")); }