private void detach_ChamDiems(ChamDiem entity)
		{
			this.SendPropertyChanging();
			entity.Phim = null;
		}
		private void attach_ChamDiems(ChamDiem entity)
		{
			this.SendPropertyChanging();
			entity.Phim = this;
		}
 partial void DeleteChamDiem(ChamDiem instance);
 partial void UpdateChamDiem(ChamDiem instance);
 partial void InsertChamDiem(ChamDiem instance);
        protected void Xl_ChoDiem_Click(object sender, EventArgs e)
        {
            CinemaLINQDataContext dt = new CinemaLINQDataContext();

            ChamDiem cd = new ChamDiem();
            cd.MaPhim = ((Phim)Session["CurrentPhim"]).MaPhim;
            cd.SoDiem = int.Parse(Th_DiemCuaBan.SelectedItem.Value);
            cd.MaNguoiDung = ((NguoiDung)Session["NguoiDung"]).MaNguoiDung;

            dt.ChamDiems.InsertOnSubmit(cd);

            dt.SubmitChanges();

            var query = (from phim in dt.Phims
                         where phim.MaPhim == ((Phim)Session["CurrentPhim"]).MaPhim
                         select phim).Single();
            var query1 = from cd_ in dt.ChamDiems
                         where cd_.MaPhim == ((Phim)Session["CurrentPhim"]).MaPhim
                         select cd_.SoDiem;

            query.DiemDanhGia = (float)query1.Sum() / (float)query1.Count();

            dt.SubmitChanges();

            KiemTraQuyenBinhLuan(dt);
            LoadThongTinPhim(dt, ((Phim)Session["CurrentPhim"]));
        }