private void btnLuu_Click(object sender, EventArgs e) { if (txtMKCu.Text.Trim().Equals(DAL.NguoiDung_Controller.matkhau)) { if (txtMKMoi.Text.Trim().Equals(txtXacNhan.Text.Trim())) { string query = "update NGUOIDUNG set MatKhau = '" + txtMKMoi.Text.Trim() + "' where MaNV = '" + DAL.NguoiDung_Controller.MaNV + "'"; DAL.Connect conn = new DAL.Connect(); conn.openConnection(); SqlCommand cmd = new SqlCommand(query, conn.Conn); cmd.ExecuteNonQuery(); DAL.NguoiDung_Controller.matkhau = txtMKMoi.Text.Trim(); this.Close(); } else { MessageBox.Show("Mật khẩu không khớp", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtXacNhan.Focus(); } } else { MessageBox.Show("Mật khẩu không chính xác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMKCu.Focus(); } }
private void frmMain_Load(object sender, EventArgs e) { string query = "select Them, Sua, Xoa, CreateLogin from NGUOIDUNG where MaNV = '" + DAL.NguoiDung_Controller.MaNV + "' and MatKhau = '" + DAL.NguoiDung_Controller.matkhau + "'"; DAL.Connect sqlConn = new DAL.Connect(); sqlConn.openConnection(); SqlDataReader dr = sqlConn.execCommand(query); while (dr.Read()) { if (dr["CreateLogin"].ToString().Equals("True")) { mnuHT_QLND.Enabled = true; } else { mnuHT_QLND.Enabled = false; } if (dr["Them"].ToString().Equals("False") && dr["Sua"].ToString().Equals("False") && dr["Xoa"].ToString().Equals("False")) { mnuDM.Enabled = false; } else { mnuDM.Enabled = true; } } this.KeyPreview = true; }
private void btnXoa_Click(object sender, EventArgs e) { string query = "delete from LUONG where BacLuong = '" + txtBacLuong.Text.Trim() + "'"; DAL.Connect conn = new DAL.Connect(); conn.execNonQuery(query); loadList(); }
private void btnXoa_Click(object sender, EventArgs e) { string query = "delete from KHENTHUONG_KYLUAT where MaNV = '" + txtMaNV.Text.Trim() + "'and SoQD = '" + txtSoQDKhenThuongKyLuat.Text.Trim() + "'"; DAL.Connect conn = new DAL.Connect(); conn.execNonQuery(query); loadList(); }
private void btnXoa_Click(object sender, EventArgs e) { string query = "delete from TRINHDOHOCVAN where MaTDHV = '" + txtMaTDHV.Text.Trim() + "'"; DAL.Connect conn = new DAL.Connect(); conn.execNonQuery(query); loadList(); }
private void btnXoa_Click(object sender, EventArgs e) { string query = "delete from HOPDONGLAODONG where MaHD = '" + txtMaHopDong.Text.Trim() + "'"; DAL.Connect conn = new DAL.Connect(); conn.execNonQuery(query); loadList(); }
private void showList() { //combobox.item.add(); //combobox.selectedindex = 1 string query = "select * from NGUOIDUNG"; DAL.Connect conn = new DAL.Connect(); conn.openConnection(); SqlDataReader dr = conn.execCommand(query); while (dr.Read()) { ListViewItem item = new ListViewItem(); item.Text = dr["MaNV"].ToString().Trim(); item.SubItems.Add(dr["MatKhau"].ToString().Trim()); item.SubItems.Add(dr["Them"].ToString().Trim()); item.SubItems.Add(dr["Sua"].ToString().Trim()); item.SubItems.Add(dr["Xoa"].ToString().Trim()); item.SubItems.Add(dr["CreateLogin"].ToString().Trim()); lsvNguoiDung.Items.Add(item); } }