private void BtnLuuCH_Click(object sender, EventArgs e) { if (txtTenCH.Text == "" || txtDiaChiCH.Text == "") { MessageBox.Show("Tao ban may bay gio ak", "Thang vo van hoa"); } else { if (flat == true) { // day là lệnh thêm nhé CuaHangServices.AddCuaHang(new CuaHang { TenCuaHang = txtTenCH.Text, DiaChiCuaHang = txtDiaChiCH.Text }); setEnable(false); } else { //Sua CuaHangServices.SetCuaHang(new CuaHang { MaCuaHang = id_ch, TenCuaHang = txtTenCH.Text, DiaChiCuaHang = txtDiaChiCH.Text }); setEnable(false); } } Dgvcuahang.DataSource = CuaHangServices.GetAllCuaHang(); setNull(); }
private void BtnXoaCH_Click(object sender, EventArgs e) { CuaHangServices.DelCuaHang(new CuaHang { MaCuaHang = id_ch }); Dgvcuahang.DataSource = CuaHangServices.GetAllCuaHang(); setNull(); }
public List <CuaHang> GetAllCuaHang() { return(CuaHangServices.GetAllCuaHang()); }