Esempio n. 1
0
        protected void Xl_XemSoDoGhe_Click(object sender, EventArgs e)
        {
            int soHang = int.Parse(tb_SoHangGhe.Text);
            int soGheTrenHang = int.Parse(tb_SoGheTrenHang.Text);
            CinemaLINQDataContext dt = new CinemaLINQDataContext();
            PhongChieuPhim phong = new PhongChieuPhim();
            phong.MaRapChieuPhim = int.Parse(cbb_RapPhim.SelectedItem.Value);
            phong.TenPhongChieuPhim = tb_TenPhong.Text;
            phong.TongSoLuongGhe = soGheTrenHang * soHang;
            phong.TinhTrang = false;
            phong.SoHang = soHang;
            phong.SoGheTrenHang = soGheTrenHang;
            dt.PhongChieuPhims.InsertOnSubmit(phong);

            dt.SubmitChanges();

            for (int i = 0; i < soHang; ++i)
            {
                for (int j = 0; j < soGheTrenHang; ++j)
                {
                    Ghe ghe = new Ghe();
                    ghe.MaPhongChieuPhim = phong.MaPhongChieuPhim;
                    ghe.TenGhe = "Ghe";
                    ghe.MaDanhMucGhe = dt.DanhMucGhes.Where(dmg => dmg.TenDanhMucGhe.CompareTo("Thường") == 0).Select(dmg => dmg.MaDanhMucGhe).Single();
                    ghe.Hang = i;
                    ghe.SoThuTu = j;
                    ghe.TinhTrang = -1;
                    dt.Ghes.InsertOnSubmit(ghe);
                    dt.SubmitChanges();
                }
            }

            Session["Phong"] = (PhongChieuPhim)phong;
        }
 partial void DeletePhongChieuPhim(PhongChieuPhim instance);
 partial void InsertPhongChieuPhim(PhongChieuPhim instance);
 partial void UpdatePhongChieuPhim(PhongChieuPhim instance);
		private void detach_PhongChieuPhims(PhongChieuPhim entity)
		{
			this.SendPropertyChanging();
			entity.RapChieuPhim = null;
		}