Ejemplo n.º 1
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         int count = 0;
         for (int i = 0; i < dgvPhieuMuon.Rows.Count; i++)
         {
             if (dgvPhieuMuon.Rows[i].Selected == true)
             {
                 count++;
                 BUS_OBJ.xoaPhieuMuon(Convert.ToInt32(dgvPhieuMuon.Rows[i].Cells[0].Value));
             }
         }
         if (count == 0)
         {
             MetroFramework.MetroMessageBox.Show(this, "Hãy chọn ít nhất 1 phiếu mượn.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(this, "Đã xóa.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             btnCancel_Click(sender, e);
             this.dgvPhieuMuon.DataSource = null;
             this.dgvPhieuMuon.DataSource = BUS_OBJ.loadDSPhieuMuonDaTra();
             hieuChinhDGV();
         }
     }
     catch (Exception ex)
     {
         MetroFramework.MetroMessageBox.Show(this, ex.Message);
     }
 }
Ejemplo n.º 2
0
        private void btXoaToanBo_Click(object sender, EventArgs e)
        {
            DialogResult thongbao;

            thongbao = (MetroFramework.MetroMessageBox.Show(this, "Xóa toàn bộ phiếu mượn trong bảng.\nBạn chắc chắn muốn tiếp tục? ", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question));
            if (thongbao == DialogResult.Yes)
            {
                try
                {
                    for (int i = 0; i < dgvPhieuMuon.Rows.Count; i++)
                    {
                        BUS_OBJ.xoaPhieuMuon(Convert.ToInt32(dgvPhieuMuon.Rows[i].Cells[0].Value));
                    }
                    MetroFramework.MetroMessageBox.Show(this, "Đã xóa.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    btnCancel_Click(sender, e);
                    this.dgvPhieuMuon.DataSource = null;
                    this.dgvPhieuMuon.DataSource = BUS_OBJ.loadDSPhieuMuonDaTra();
                    hieuChinhDGV();
                }
                catch (Exception ex)
                {
                    MetroFramework.MetroMessageBox.Show(this, ex.Message);
                }
            }
        }
Ejemplo n.º 3
0
 private void frmXoaPhieuMuon_Load(object sender, EventArgs e)
 {
     cboLuaChonTim.SelectedItem = "Mã thẻ";
     cboTinhTrang.SelectedItem  = "Chờ phê duyệt";
     rtbGhiChu.BackColor        = SystemColors.Control;
     btnCancel_Click(sender, e);
     btnCancel.Hide();
     this.dgvPhieuMuon.DataSource = null;
     this.dgvPhieuMuon.DataSource = BUS_OBJ.loadDSPhieuMuonDaTra();
     hieuChinhDGV();
 }