private void checkBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { dataGridView4.DataSource = Phongcontrol.getdatap(); } }
private void Form1_Load(object sender, EventArgs e) { dataGridPHONG.DataSource = Phongcontrol.getdatap(); dataGridView2.DataSource = Khachhangcontrol.getdataK(); dataGridView3.DataSource = Dichvucontrol.getdatadv(); datDOAN.DataSource = Doancontrol.getdatadoan(); dataNCP.DataSource = NgCPcontrol.getdataNCP(); dataNV.DataSource = Nhanviencontrol.getdatanv(); datap_thue.DataSource = P_Thuecontrol.getdatap_thue(); datachitietp_thue.DataSource = Chitietp_Thuecontrol.getdatactThue(); dathoadon.DataSource = Hoadoncontrol.getdatahd(); }
//thêm phòng private void btnthem_Click(object sender, EventArgs e) { try { Phongbject pp = new Phongbject(); pp.Map = txtMAP.Text; pp.Loaip = cmbLOAIP.Text; pp.Hangp = cmbHANGP.Text; pp.Giap = Int32.Parse(txtGIAP.Text); pp.Ttp = cmbTTP.Text; pp.Sdtp = Int32.Parse(txtSDTP.Text); Phongcontrol.addphong(pp); dataGridPHONG.DataSource = Phongcontrol.getdatap(); } catch { } }
//xóa phòng private void btnnxoa_Click(object sender, EventArgs e) { try { DialogResult dg = new DialogResult(); dg = MessageBox.Show("Bạn có muốn xóa không", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dg == DialogResult.Yes) { Phongbject P = new Phongbject(); P.Map = txtMAP.Text; Phongcontrol.deletephong(P); dataGridPHONG.DataSource = Phongcontrol.getdatap(); } } catch { } }
//sửa phòng private void btnsua_Click(object sender, EventArgs e) { try { Phongbject P = new Phongbject(); P.Map = txtMAP.Text; P.Loaip = cmbLOAIP.Text; P.Hangp = cmbHANGP.Text; P.Giap = Int32.Parse(txtGIAP.Text); P.Ttp = cmbTTP.Text; P.Sdtp = Int32.Parse(txtSDTP.Text); Phongcontrol.updatephong(P); dataGridPHONG.DataSource = Phongcontrol.getdatap(); } catch { } }
private void button2_Click(object sender, EventArgs e) { dataGridPHONG.DataSource = Phongcontrol.getdatap(); }