예제 #1
0
 private void sua()
 {
     try
     {
         if (cmbMaPB.Text == "")
         {
             MessageBox.Show("Vui lòng điều mã nhân viên", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             XuLyPhongBan xl = new XuLyPhongBan();
             if (xl.UpdatePB(cmbMaPB.Text, txtTenPB.Text, DateTime.Parse(dtNgayThanhLap.Text)))
             {
                 MessageBox.Show("Sửa thành công", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Sửa không thành công", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             dgvPhongBan.DataSource = xl.LoadPB();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Vui lòng điều đúng thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
 private void xoa()
 {
     try
     {
         if (cmbMaPB.Text == "")
         {
             MessageBox.Show("Vui lòng điều mã nhân viên cần xóa", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             XuLyPhongBan xl = new XuLyPhongBan();
             if (xl.DELETEPB(cmbMaPB.Text))
             {
                 MessageBox.Show("Xóa thành công", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("Xóa không thành công", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             dgvPhongBan.DataSource = xl.LoadPB();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Vui lòng điều đúng thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
        private void FrmPhongBan_Load(object sender, EventArgs e)
        {
            XuLyPhongBan xl = new XuLyPhongBan();

            dgvPhongBan.DataSource = xl.LoadPB();
            btnLuu.Enabled         = false;
            btnHuy.Enabled         = false;
            //load comboBox
            cmbMaPB.DataSource    = xl.LoadCmb();
            cmbMaPB.DisplayMember = "MaPB";
        }