//lấy danh sách nhà cung cấp private void button5_Click(object sender, EventArgs e) { nhacungcapbus bus = new nhacungcapbus(); nhacungcapdgv.DataSource = bus.list(); nhacungcapdgv.Columns["MANHACUNGCAP"].HeaderText = "Mã nhà cung cấp"; nhacungcapdgv.Columns["TENNHACUNGCAP"].HeaderText = "Tên nhà cung cấp"; nhacungcapdgv.Columns["DIACHI"].HeaderText = "Địa chỉ"; nhacungcapdgv.Columns["DIENTHOAI"].HeaderText = "Điện thoại"; nhacungcapdgv.Columns["PHIEUNHAPHANGs"].Visible = false; }
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(); }
private void button3_Click(object sender, EventArgs e) { NHACUNGCAP entity = new NHACUNGCAP(); entity.MANHACUNGCAP = textBox5.Text; entity.TENNHACUNGCAP = textBox6.Text; entity.DIACHI = textBox7.Text; entity.DIENTHOAI = textBox8.Text; nhacungcapbus bus = new nhacungcapbus(); if (bus.update(entity)) { MessageBox.Show("Cập nhật thành công"); } else { MessageBox.Show("Lỗi"); } dataGridView1.DataSource = bus.list(); }
private void button2_Click(object sender, EventArgs e) { nhacungcapbus bus = new nhacungcapbus(); dataGridView1.DataSource = bus.list(); }