private void button1_Click(object sender, EventArgs e) { NHACUNGCAP entity = new NHACUNGCAP(); entity.MANHACUNGCAP = textBox1.Text; entity.TENNHACUNGCAP = textBox2.Text; entity.DIACHI = textBox3.Text; entity.DIENTHOAI = textBox4.Text; nhacungcapbus bus = new nhacungcapbus(); if (bus.add(entity)) { MessageBox.Show("Nhập thành công"); } else { MessageBox.Show("Lỗi"); } }
//nhập nhà cung cấp mới private void button3_Click(object sender, EventArgs e) { NHACUNGCAP entity = new NHACUNGCAP(); entity.MANHACUNGCAP = manhacungcaptxt.Text; entity.TENNHACUNGCAP = tennhacungcaptxt.Text; entity.DIACHI = diachinhacungcaptxt.Text; entity.DIENTHOAI = dienthoainhacungcaptxt.Text; nhacungcapbus bus = new nhacungcapbus(); bool success = bus.add(entity); common.successorerror(success); if (success) { errorProvider1.Clear(); } else { ViewErrors(bus.validatedictionary); } }