Exemple #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            checkXoa        = true;
            checkThem       = false;
            checkSua        = false;
            btnThem.Enabled = false;
            btnSua.Enabled  = false;
            if (gvSanPham.SelectedRows.Count == 0)
            {
                MessageBox.Show("Chưa chọn sản phẩm để sửa");
                return;
            }
            DialogResult rs = MessageBox.Show("Bạn có chắc muốn xóa sản phẩm (" + txtTen.Text + ")", "Xác nhận", MessageBoxButtons.YesNo);

            if (rs == DialogResult.Yes)
            {
                bool check = sp_bll.xoaSP(txtMa.Text);
                if (check)
                {
                    MessageBox.Show("Xóa thành công");
                }
                else
                {
                    MessageBox.Show("Xóa thất bại");
                }
                gvSanPham.DataSource = sp_bll.getALLSP();
                thietlapcontrol();
            }
            frmSanPham_Load(sender, e);
        }
Exemple #2
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            checkXoa        = true;
            checkThem       = false;
            checkSua        = false;
            btnThem.Enabled = false;
            btnSua.Enabled  = false;
            if (gvSanPham.SelectedRows.Count == 0)
            {
                MessageBox.Show("Chưa chọn sản phẩm để sửa");
                return;
            }
            DialogResult rs = MessageBox.Show("Bạn có chắc muốn xóa sản phẩm (" + txtTen + ")", "Xác nhận", MessageBoxButtons.YesNo);

            if (rs == DialogResult.Yes)
            {
                sp_bll.xoaSP(txtMa.Text);
            }
        }