private void Btn_ThemSC_Click(object sender, EventArgs e)
        {
            string      MaPhim = (sender as Button).Name;
            List <Phim> listP  = MyResources.MyRapPhim.ListPhim;
            bool        ck     = false;

            for (int i = 0; i < listP.Count; i++)
            {
                if (listP[i].MaPhim.Equals(MaPhim))
                {
                    ck = true;
                    SuatChieu sc = GetTTSCForSave(MyResources.MyRapPhim.ListPhim[i]);
                    if (sc == null)
                    {
                        return;
                    }
                    if (MyResources.MyRapPhim.CheckSameSC(listP[i], sc))
                    {
                        MessageBox.Show("Trùng giờ chiếu (có thể với phim khác)!!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    MyResources.MyRapPhim.ListPhim[i].ListSC.Add(sc);
                    MyResources.MyRapPhim.ListPhim[i].Sort_SuatChieu();
                    ClearTTSC();
                    MyResources.AutoLoadDV = true;
                    LoadTTSuatChieu(MyResources.MyRapPhim.ListPhim[i]);
                    break;
                }
            }
            if (!ck)
            {
                MessageBox.Show("Can't Save !!!!\nError in list<Phim>", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#2
0
        protected void bt_CapNhat_Click(object sender, EventArgs e)
        {
            if (Session["NguoiDung"] == null)
            {
                Response.Redirect("/thanhvien/DangNhap.aspx");
                return;
            }

            CinemaLINQDataContext dt = new CinemaLINQDataContext();

            Button _sender      = (Button)sender;
            int    _maSuatChieu = int.Parse(_sender.CommandArgument);

            SuatChieu _suatChieuCapNhat = (from _sc in dt.SuatChieus
                                           where _sc.MaSuatChieu == _maSuatChieu
                                           select _sc).Single();

            TimeSpan _toQuery = TimeSpan.Parse(Session["CNLC-SuatChieuMoi"].ToString());

            DanhMucSuatChieu _scToUpdate = (from _dmsc in dt.DanhMucSuatChieus
                                            where _dmsc.ThoiGianBatDau.TimeOfDay == _toQuery
                                            select _dmsc).Single();

            _suatChieuCapNhat.MaDanhMucSuatChieu = _scToUpdate.MaDanhMucSuatChieu;
            dt.SubmitChanges();
            MyDataBind();
        }
示例#3
0
        private void CreateDatGheLayout(Phim t, SuatChieu s)
        {
            Button btn_huy = new Button();
            Label  lb_tp   = new Label();
            Button btn_dv  = new Button();
            Panel  pn_dg   = CreateDatGhePanel(t, s);

            //
            // Btn_Huy
            //
            btn_huy.BackColor = System.Drawing.Color.IndianRed;
            btn_huy.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            btn_huy.Font      = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            btn_huy.ForeColor = System.Drawing.Color.White;
            btn_huy.Location  = new System.Drawing.Point(3, 3);
            btn_huy.Name      = "Btn_Huy";
            btn_huy.Size      = new System.Drawing.Size(60, 46);
            btn_huy.TabIndex  = 11;
            btn_huy.Text      = "Hủy";
            btn_huy.UseVisualStyleBackColor = false;
            btn_huy.Click += this.Btn_HuyClick;
            //
            // LabelTenPhim
            //
            lb_tp.BackColor  = System.Drawing.Color.DarkCyan;
            lb_tp.Font       = new System.Drawing.Font("Segoe UI", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lb_tp.ForeColor  = System.Drawing.Color.White;
            lb_tp.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
            lb_tp.Location   = new System.Drawing.Point(69, 0);
            lb_tp.Name       = t.MaPhim;
            lb_tp.Size       = new System.Drawing.Size(754, 52);
            lb_tp.TabIndex   = 0;
            lb_tp.Text       = t.TenPhim;
            lb_tp.TextAlign  = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // Btn_DatVe
            //
            btn_dv.BackColor = System.Drawing.Color.MediumSeaGreen;
            btn_dv.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            btn_dv.Font      = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            btn_dv.ForeColor = System.Drawing.Color.White;
            btn_dv.Location  = new System.Drawing.Point(829, 3);
            btn_dv.Name      = "Btn_DatVe";
            btn_dv.Size      = new System.Drawing.Size(81, 46);
            btn_dv.TabIndex  = 12;
            btn_dv.Text      = "Đặt vé";
            btn_dv.UseVisualStyleBackColor = false;
            btn_dv.Click += this.Btn_DatVeClick;
            //
            //add to frame
            //
            PnFlow_DatVe.Controls.Clear();
            PnFlow_DatVe.Controls.Add(btn_huy);
            PnFlow_DatVe.Controls.Add(lb_tp);
            PnFlow_DatVe.Controls.Add(btn_dv);
            PnFlow_DatVe.Controls.Add(pn_dg);
        }
示例#4
0
 private void HienThiThongTinVe(Phim t, SuatChieu s)
 {
     Grbox_TTVePhim.Show();
     Label_TenPhim.Text    = t.TenPhim.Substring(0, (t.TenPhim.Length > 14) ? 14 : t.TenPhim.Length);
     Label_TenPhim.Name    = t.MaPhim;
     Label_PhongChieu.Text = s.MaPhong;
     Label_NgayChieu.Text  = s.Ngay + "/" + s.Thang + "/" + s.Nam;
     Label_GioChieu.Text   = s.Gio + ":" + s.Phut;
     Label_ThoiLuong.Text  = t.ThoiLuong.ToString() + " phút";
     Label_TongTien.Text   = "0";
     PnFlow_GheDaDat.Name  = s.MaSuatChieu;
     PnFlow_GheDaDat.Controls.Clear();
 }
示例#5
0
        // GET: Admin/SuatChieux/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SuatChieu suatChieu = db.Database.SqlQuery <SuatChieu>("exec sp_loadChiTietSuatChieu {0}", id).First <SuatChieu>();

            if (suatChieu == null)
            {
                return(HttpNotFound());
            }
            return(View(suatChieu));
        }
示例#6
0
        // GET: Admin/SuatChieux/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SuatChieu suatChieu = db.Database.SqlQuery <SuatChieu>("exec sp_loadChiTietSuatChieu {0}", id).First <SuatChieu>();

            if (suatChieu == null)
            {
                return(HttpNotFound());
            }
            ViewBag.maphim  = new SelectList(db.Phim, "maphim", "tenphim", suatChieu.maphim);
            ViewBag.maphong = new SelectList(db.PhongChieu, "maphong", "tenphong", suatChieu.maphong);
            return(View(suatChieu));
        }
        protected void btn_PhatSinh_Click(object sender, EventArgs e)
        {
            CinemaLINQDataContext dt = new CinemaLINQDataContext();

            for (int i = 0; i < int.Parse(cbb_ChonNgay.SelectedItem.Value); ++i)
            {
                var query = from _lichchieu in dt.LichChieuPhims
                            where _lichchieu.NgayChieu.CompareTo(DateTime.Today.AddDays(i + 1)) == 0
                            select _lichchieu;
                LichChieuPhim lichchieu = null;
                if (query.Count <LichChieuPhim>() == 0)
                {
                    lichchieu           = new LichChieuPhim();
                    lichchieu.NgayChieu = DateTime.Today.AddDays(i + 1);
                    lichchieu.TinhTrang = true;
                    dt.LichChieuPhims.InsertOnSubmit(lichchieu);
                    dt.SubmitChanges();
                }
                else
                {
                    lichchieu = query.Single();
                }

                var dmSuatChieu = from _dmsc in dt.DanhMucSuatChieus
                                  where _dmsc.TinhTrang == true
                                  select _dmsc;
                foreach (DanhMucSuatChieu dmsc in dmSuatChieu)
                {
                    var suatchieu = from _suatchieu in dt.SuatChieus
                                    where _suatchieu.MaLichChieu == lichchieu.MaLichChieuPhim && _suatchieu.MaPhim == int.Parse(cbb_ChonPhim.SelectedItem.Value) && _suatchieu.MaPhong == int.Parse(cbb_Phong.SelectedItem.Value) && _suatchieu.MaDanhMucSuatChieu == dmsc.MaDanhMucSuatChieu
                                    select _suatchieu;
                    if (suatchieu.Count <SuatChieu>() == 0)
                    {
                        SuatChieu sc = new SuatChieu();
                        sc.MaLichChieu        = lichchieu.MaLichChieuPhim;
                        sc.MaPhim             = int.Parse(cbb_ChonPhim.SelectedItem.Value);
                        sc.MaPhong            = int.Parse(cbb_Phong.SelectedItem.Value);
                        sc.MaDanhMucSuatChieu = dmsc.MaDanhMucSuatChieu;
                        sc.TinhTrang          = false;
                        dt.SuatChieus.InsertOnSubmit(sc);
                        dt.SubmitChanges();
                    }
                }
            }
        }
示例#8
0
        private void Btn_Hour_Click_orderDatVe(object sender, EventArgs e)
        {
            Control   c      = (sender as Button);
            string    MaPhim = c.Parent.Name;
            string    MaSC   = c.Name;
            Phim      t      = MyResources.MyRapPhim.FindPhim(MaPhim);
            SuatChieu s      = t.FindSuatChieu(MaSC);

            if (t == null || s == null)
            {
                MessageBox.Show("Error in find SC or find flim", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Btn_HienTatCa.Enabled = false;
            Btn_Filter.Enabled    = false;
            CreateDatGheLayout(t, s);
            HienThiThongTinVe(t, s);
        }
示例#9
0
 public ActionResult Edit([Bind(Include = "masuatchieu,maphim,maphong,giochieu,gioketthuc,ngaychieu,soghecontrong")] SuatChieu suatChieu)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Database.SqlQuery <SuatChieu>("exec sp_editSuatChieu {0}, {1}, {2}, {3}, {4}, {5}", suatChieu.masuatchieu, suatChieu.maphim, suatChieu.maphong, suatChieu.giochieu, suatChieu.gioketthuc, suatChieu.ngaychieu).ToList();
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (EntityCommandExecutionException ex)
     {
         return(RedirectToAction("Index"));
     }
     ViewBag.maphim  = new SelectList(db.Phim, "maphim", "tenphim", suatChieu.maphim);
     ViewBag.maphong = new SelectList(db.PhongChieu, "maphong", "tenphong", suatChieu.maphong);
     return(View(suatChieu));
 }
示例#10
0
        private SuatChieu GetTTSCForSave(Phim t)
        {
            SuatChieu temp = new SuatChieu()
            {
                MaSuatChieu = t.CreateMaSuatChieu(),
                Ngay        = (int)DateTime_Ngay.Value.Day,
                Thang       = (int)DateTime_Ngay.Value.Month,
                Nam         = (int)DateTime_Ngay.Value.Year,
                Gio         = (int)Num_Gio.Value,
                Phut        = (int)Num_Phut.Value,
                MaPhong     = Cbox_PhongChieu.SelectedItem.ToString()
            };
            int ck = DangDienRa(temp.Ngay, temp.Thang, temp.Nam, temp.Gio, temp.Phut, t.ThoiLuong);

            /*if(ck >= 0)
             * {
             *  MessageBox.Show("Vui lòng chọn ngày giờ sớm hơn", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  return null;
             * }*/
            return(temp);
        }
示例#11
0
        public ActionResult Create([Bind(Include = "masuatchieu,maphim,maphong,giochieu,gioketthuc,ngaychieu,soghecontrong")] SuatChieu suatChieu)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //db.SuatChieux.Add(suatChieu);sp_addSuatChieu
                    //var maphim = db.Phims.Where(s => s.tenphim.Equals(suatChieu.maphim)).Single();
                    //var maphong = db.PhongChieux.Where(s => s.tenphong.Equals(suatChieu.maphong)).Single();
                    db.Database.SqlQuery <SuatChieu>("exec sp_addSuatChieu {0}, {1}, {2}, {3}", suatChieu.maphim, suatChieu.maphong, suatChieu.giochieu, suatChieu.ngaychieu).ToList();
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (EntityCommandExecutionException ex)
            {
                return(RedirectToAction("Index"));
            }

            return(View(suatChieu));
        }
示例#12
0
        private Panel CreateDatGhePanel(Phim t, SuatChieu s)
        {
            Panel pn    = new Panel();
            Label lb_LV = new Label();
            Label lb_MH = new Label();

            pn.BackColor   = System.Drawing.Color.PeachPuff;
            pn.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            pn.Controls.Add(lb_LV);
            pn.Controls.Add(lb_MH);
            pn.Location = new System.Drawing.Point(3, 55);
            pn.Name     = "PnFLow_DatGhe";
            pn.Size     = new System.Drawing.Size(907, 432);
            //
            // Buttons Ghe
            //
            List <Ghe> li    = MyResources.MyRapPhim.GetListGheFollowSC(t, s);
            int        soGhe = MyResources.MyRapPhim.FindPhong(s.MaPhong).SoGhe;

            for (int i = 0; i < soGhe - 7; i++)
            {
                Ghe    _tmp    = li[i];
                Button btn_ghe = new Button
                {
                    BackColor = System.Drawing.Color.White,
                    FlatStyle = System.Windows.Forms.FlatStyle.Flat,
                    Font      = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))),
                    ForeColor = System.Drawing.Color.Black,
                    Size      = new System.Drawing.Size(41, 26),
                    Text      = _tmp.MaGhe,
                    UseVisualStyleBackColor = false
                };
                btn_ghe.FlatAppearance.BorderSize = 0;
                btn_ghe.Click += this.Btn_GheClick;
                if (_tmp.TrangThai != "Trống")
                {
                    btn_ghe.Enabled   = false;
                    btn_ghe.BackColor = Color.LightGray;
                }
                string ma  = _tmp.MaGhe.Substring(0, 1);
                int    stt = Convert.ToInt32(_tmp.MaGhe.Substring(1, 2));
                int    day = Convert.ToInt32(ma.ToCharArray()[0]);
                btn_ghe.Location = new System.Drawing.Point(768, 70);
                int[] arrX     = { 768, 721, 623, 576, 529, 482, 435, 388, 341, 294, 197, 150, 103, 56 };
                int[] arrXForI = { 721, 576, 482, 388, 294, 150, 56 };
                if (ma == "I")
                {
                    btn_ghe.Location = new System.Drawing.Point(arrXForI[stt - 1], 70 + (day - 65) * 40);
                    btn_ghe.Size     = new System.Drawing.Size(88, 26);
                }
                else
                {
                    btn_ghe.Location = new System.Drawing.Point(arrX[stt - 1], 70 + (day - 65) * 40);
                }
                pn.Controls.Add(btn_ghe);
            }
            //
            // Labels Alplabet
            //
            for (int i = 0; i < 9; i++)
            {
                Label tmp = new Label
                {
                    AutoSize = true,
                    Font     = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))),
                    Location = new System.Drawing.Point(14, 75 + i * 40),
                    Size     = new System.Drawing.Size(17, 17),
                    TabIndex = 1,
                    Text     = ((char)(i + 65)).ToString()
                };
                pn.Controls.Add(tmp);
            }
            //
            // Label_ManHinh
            //
            lb_MH.BackColor = System.Drawing.Color.SkyBlue;
            lb_MH.Font      = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lb_MH.Location  = new System.Drawing.Point(102, 13);
            lb_MH.Name      = "Label_ManHinh";
            lb_MH.Size      = new System.Drawing.Size(659, 34);
            lb_MH.TabIndex  = 15;
            lb_MH.Text      = "Màn hình";
            lb_MH.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // Label_LoiVao
            //
            lb_LV.BackColor = System.Drawing.Color.DarkSlateGray;
            lb_LV.Font      = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lb_LV.ForeColor = System.Drawing.Color.White;
            lb_LV.Location  = new System.Drawing.Point(825, 390);
            lb_LV.Name      = "Label_LoiVao";
            lb_LV.Size      = new System.Drawing.Size(70, 26);
            lb_LV.TabIndex  = 16;
            lb_LV.Text      = "Lối vào";
            lb_LV.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            return(pn);
        }