Example #1
0
        private void Delete_Click(object sender, EventArgs args)
        {
            NHACUNGCAP entity = new NHACUNGCAP();

            entity.MANHACUNGCAP  = dataGridView1.SelectedCells[0].Value.ToString();
            entity.TENNHACUNGCAP = dataGridView1.SelectedCells[1].Value.ToString();
            entity.DIACHI        = dataGridView1.SelectedCells[2].Value.ToString();
            entity.DIENTHOAI     = dataGridView1.SelectedCells[3].Value.ToString();

            nhacungcapbus bus = new nhacungcapbus();

            if (bus.delete(entity))
            {
                MessageBox.Show("Xóa thành công");
            }
            else
            {
                MessageBox.Show("Lỗi");
            }
            dataGridView1.DataSource = bus.list();
        }
Example #2
0
        //xóa nhà cung cấp
        private void button11_Click(object sender, EventArgs e)
        {
            NHACUNGCAP entity = new NHACUNGCAP();

            entity.MANHACUNGCAP  = suamanhacungcaptxt.Text;
            entity.TENNHACUNGCAP = suatennhacungcaptxt.Text;
            entity.DIACHI        = suadiachinhacungcaptxt.Text;
            entity.DIENTHOAI     = suadienthoainhacungcaptxt.Text;

            nhacungcapbus bus = new nhacungcapbus();

            bool success = bus.delete(entity);

            common.successorerror(success);
            if (success)
            {
                common.ClearTextBoxes(tabPage9);
                nhacungcapdgv.DataSource = bus.findall(textBox1.Text);
                nhacungcapdgv.Columns["PHIEUNHAPHANGs"].Visible = false;
            }
        }