コード例 #1
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(maPhieuNhap))
     {
         if (MessageBox.Show(string.Format("Có chắc chắn muốn xóa phiếu nhập {0} hay không\n Chọn Ok để đồng ý xóa, Ngược lại chọn Cancel ", maPhieuNhap), "Cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
         {
             //gọi hàm xóa
             if (bd.DeletePhieuNhap(ref err, ref rows, maPhieuNhap))
             {
                 HienThiDanhSach();
             }
         }
         maPhieuNhap = string.Empty;
     }
     else
     {
         MessageBox.Show("Chưa chọn mã phiếu nhập", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 private void Frm_NhapSanPham_Modifies_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!statusPhieuNhap)
     {
         if (MessageBox.Show(string.Format("Việc tắt của sổ nhập hàng khi trạng thái nhập chưa hoàn thành sẽ gây thiếu tính nhất quán trong dữ liệu\n Do đó, Phiếu nhập {0} sẽ bị xóa khỏi dữ liệu.\n Nếu không muốn xóa phiếu nhập và quay lại hoàn thành phiếu nhập này hãy chọn Cacel, Ngược lại chọn OK", maPhieuNhap), "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
         {
             //Xóa
             if (bd.DeletePhieuNhap(ref err, ref rows, maPhieuNhap))
             {
                 e.Cancel = false;
             }
             else
             {
                 e.Cancel = true;
             }
         }
         else
         {
             e.Cancel = true;
         }
     }
 }