Ejemplo n.º 1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtMaPX.Text != "")
                {
                    phieuXuatDTO.MaPX = Convert.ToInt32(txtMaPX.Text);

                    if (pxBLL.CheckID(phieuXuatDTO.MaPX))
                    {
                        int check = pxBLL.DeletePX(phieuXuatDTO.MaPX);

                        if (check == 1)
                        {
                            dgvPX.DataSource = pxBLL.getAllPX();
                            dgvPX.Show();
                        }
                        else
                        {
                            MessageBox.Show("Xóa không thành công");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Mã phiếu xuất " + phieuXuatDTO.MaPX + " không tồn tại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập mã phiếu xuất !");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Xóa bị lỗi ! " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }