Example #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            luu = 0;
            int res = sp.Delete(int.Parse(txtSPID.Text));

            if (txtSPID.Text == "")
            {
                MessageBox.Show("Chọn một sản phẩm để xóa.", "Lỗi");
            }
            else if (res == 1 || res == 2)
            {
                MessageBox.Show("Sản phẩm đã tồn tại trong Phiếu nhập hoặc Phiếu xuất.", "Lỗi");
            }
            else
            {
                DialogResult dr;
                dr = MessageBox.Show("Xóa dữ liệu sản phẩm", "Cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (dr == DialogResult.OK)
                {
                    sp.Delete(int.Parse(txtSPID.Text));
                    MessageBox.Show("Xóa thành công");
                    sp.ViewAll();
                }
            }
        }
Example #2
0
 //public Sanpham(string data)
 //{
 //    dulieu = data;
 //}
 private void Sanpham_Load(object sender, EventArgs e)
 {
     sp.ViewAll();
 }