protected void btn_ThemSuat_Click(object sender, EventArgs e) { CinemaLINQDataContext dt = new CinemaLINQDataContext(); var query = from dmsc in dt.DanhMucSuatChieus where dmsc.ThoiGianBatDau.Hour == int.Parse(tb_Gio.Text) && dmsc.ThoiGianBatDau.Minute == int.Parse(tb_Phut.Text) select dmsc; if (query.Count<DanhMucSuatChieu>() == 0) { DanhMucSuatChieu dmsc = new DanhMucSuatChieu(); DateTime time = new DateTime(1990, 1, 1); time = time.AddHours(int.Parse(tb_Gio.Text)); time = time.AddMinutes(int.Parse(tb_Phut.Text)); dmsc.ThoiGianBatDau = time; dmsc.TinhTrang = true; dmsc.GiaDanhMuc = int.Parse(tb_GiaDanhMucSuatMoi.Text); dt.DanhMucSuatChieus.InsertOnSubmit(dmsc); dt.SubmitChanges(); } }
partial void UpdateDanhMucSuatChieu(DanhMucSuatChieu instance);
partial void DeleteDanhMucSuatChieu(DanhMucSuatChieu instance);
partial void InsertDanhMucSuatChieu(DanhMucSuatChieu instance);