public List <int> ListGheTrong(SuatChieuDTO sc, string day)
        {
            String     SQL          = "SELECT Ghe FROM Ve WHERE MaSuatCHieu = {0} AND Ghe LIKE '{1}%' ";
            String     query        = string.Format(SQL, sc.MaSuatChieu, day);
            DataTable  dt           = DataProvider.ExecuteQuery(query);
            List <int> listGheTrong = new List <int>();
            List <int> listGheDat   = new List <int>();
            string     tmp;

            foreach (DataRow dr in dt.Rows)
            {
                tmp = dr["Ghe"].ToString();
                tmp = tmp.Substring(1);
                listGheDat.Add(Convert.ToInt32(tmp));
            }
            bool isSelected;

            for (int i = 1; i <= 10; i++)
            {
                isSelected = false;
                for (int j = 0; j < listGheDat.Count; j++)
                {
                    if (listGheDat[j] == i)
                    {
                        isSelected = true;
                        break;
                    }
                }
                if (!isSelected)
                {
                    listGheTrong.Add(i);
                }
            }
            return(listGheTrong);
        }
示例#2
0
        private void lvDSPhim_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvDSPhim.SelectedItems.Count == 1)
            {
                suatchieuchon = lsPhim.Find(o => o.TenPhim == lvDSPhim.SelectedItems[0].SubItems[1].Text);

                GiaCB = (int)(50000 * (new LoaiPhongBUS()).LoadLoaiPhong().Find(o => o.MaLoai == suatchieuchon.Maloai).HeSo);

                lbNDPhim.Text    = suatchieuchon.NDPhim;
                lbNamSX.Text     = suatchieuchon.NamXS;
                lbNhaSX.Text     = suatchieuchon.NhaXS;
                lbDaoDien.Text   = suatchieuchon.DaoDien;
                lbThoiLuong.Text = suatchieuchon.ThoiLuong + " phút";
                lbTheLoai.Text   = (new TheLoaiBUS()).LoadTheLoai().Find(o => o.MaTheLoai == suatchieuchon.TheLoai).TenTheLoai;

                lvDSGhe.Items.Clear();
                lbTongThanhToan.Text = "0đ";

                lvDSGhe.Groups.Add(new ListViewGroup("Màn Hình", HorizontalAlignment.Center));

                lsGhe = (new GheBUS()).LoadGhe(suatchieuchon.MaPhong);

                foreach (GheDTO ghe in lsGhe)
                {
                    ListViewItem ghemoi = lvDSGhe.Items.Add(ghe.MaGhe);
                    ghemoi.ImageIndex = 0;
                    ghemoi.Group      = lvDSGhe.Groups[0];
                }

                lvDSGhe.Visible = true;
            }
        }
        //public List<SuatChieuDTO> LaySuatChieuTheoTen(string tenphim)
        //{
        //    List<SuatChieuDTO> listSuatChieuDTO = new List<SuatChieuDTO>();

        //    String query = "select * from SuatChieu S, Phim P where P.Ten = N'" + tenphim + "' and P.MaPhim = S.MaPhim";
        //    DataTable dt = DataProvider.ExecuteQuery(query);
        //    foreach (DataRow dr in dt.Rows)
        //    {
        //        SuatChieuDTO suatchieuDTO = new SuatChieuDTO();
        //        PhimDTO phimDTO = new PhimDTO();
        //        suatchieuDTO.MaPhongChieu = (int) dr["MaPhongChieu"];
        //        suatchieuDTO.NgayChieu = dr["NgayChieu"].ToString();
        //        suatchieuDTO.GioChieu = dr["GioChieu"].ToString();
        //        listSuatChieuDTO.Add(suatchieuDTO);
        //    }
        //    return listSuatChieuDTO;
        //}

        public bool ThemSuatChieu(SuatChieuDTO sc)
        {
            //String SQL = "SELECT * FROM SuatChieu WHERE MaPhongChieu = {0} AND NgayChieu = '{1}' AND GioChieu = '{2}' AND MaPhim = {3}";
            //String query = string.Format(SQL, sc.MaPhongChieu, sc.NgayChieu, sc.GioChieu, sc.MaPhim);
            //DataTable dt = DataProvider.ExecuteQuery(SQL);
            //if (dt.Rows.Count > 0)
            //    return false;
            //SQL = @"INSERT INTO SuatChieu VALUES ({0}, '{1}', '{2}', {3})";
            //query = string.Format(SQL, sc.MaPhongChieu, sc.NgayChieu, sc.GioChieu, sc.MaPhim);
            //DataProvider.ExecuteQuery(query);
            //return true;


            DataTable dt = DataProvider.ExecuteQuery("SELECT * FROM SuatChieu");

            foreach (DataRow dr in dt.Rows)
            {
                if (sc.MaPhongChieu == Convert.ToInt32(dr["MaPhongChieu"]) &&
                    sc.NgayChieu == dr["NgayChieu"].ToString() &&
                    sc.GioChieu == dr["GioChieu"].ToString() &&
                    sc.MaPhim == Convert.ToInt32(dr["MaPhim"]))
                {
                    return(false);
                }
            }
            String SQL   = @"INSERT INTO SuatChieu VALUES ({0}, '{1}', '{2}', {3})";
            String query = string.Format(SQL, sc.MaPhongChieu, sc.NgayChieu, sc.GioChieu, sc.MaPhim);

            DataProvider.ExecuteQuery(query);
            return(true);
        }
示例#4
0
        protected void ddl_day_SelectedIndexChanged(object sender, EventArgs e)
        {
            dayNgoi = ddl_day.SelectedItem.Text;
            SuatChieuBUS suatChieuBUS = new SuatChieuBUS();
            SuatChieuDTO suatChieuDTO = new SuatChieuDTO();

            suatChieuDTO.MaPhim    = maPhim;
            suatChieuDTO.NgayChieu = ngayChieu;
            suatChieuDTO.GioChieu  = gioChieu;
            ddl_soghe.DataSource   = suatChieuBUS.ListGheTrong(suatChieuDTO, dayNgoi);
            ddl_soghe.DataBind();
        }
        public SuatChieuDTO LayThongTin(int id)
        {
            SuatChieuDTO suatchieuDTO = null;
            String       query        = string.Format("SELECT * FROM SuatChieu WHERE MaSuatChieu = {0}", id);
            DataTable    dt           = DataProvider.ExecuteQuery(query);

            if (dt.Rows.Count > 0)
            {
                suatchieuDTO              = new SuatChieuDTO();
                suatchieuDTO.MaSuatChieu  = Convert.ToInt32(dt.Rows[0]["MaSuatChieu"]);
                suatchieuDTO.MaPhongChieu = Convert.ToInt32(dt.Rows[0]["MaPhongChieu"]);
                suatchieuDTO.NgayChieu    = dt.Rows[0]["NgayChieu"].ToString();
                suatchieuDTO.GioChieu     = dt.Rows[0]["GioChieu"].ToString();
                suatchieuDTO.MaPhim       = Convert.ToInt32(dt.Rows[0]["MaPhim"]);
            }
            return(suatchieuDTO);
        }
        public List <SuatChieuDTO> LayDanhSach()
        {
            List <SuatChieuDTO> listSuatChieuDTO = new List <SuatChieuDTO>();

            String    query = "SELECT * FROM SuatChieu";
            DataTable dt    = DataProvider.ExecuteQuery(query);

            foreach (DataRow dr in dt.Rows)
            {
                SuatChieuDTO suatchieuDTO = new SuatChieuDTO();
                suatchieuDTO.MaSuatChieu  = Convert.ToInt32(dr["MaSuatChieu"]);
                suatchieuDTO.MaPhongChieu = Convert.ToInt32(dr["MaPhongChieu"]);
                suatchieuDTO.NgayChieu    = dr["NgayChieu"].ToString();
                suatchieuDTO.GioChieu     = dr["GioChieu"].ToString();
                suatchieuDTO.MaPhim       = Convert.ToInt32(dr["MaPhim"]);

                listSuatChieuDTO.Add(suatchieuDTO);
            }
            return(listSuatChieuDTO);
        }
示例#7
0
        public List <SuatChieuDTO> LoadSuatChieu(int MaLich)
        {
            SqlConnection conn       = DataProvider.TaoKetNoi();
            string        strTruyVan = "Select * From Movie, ChiTietLichChieu, PhongChieu, CTLoaiPhong where Movie.MaPhim = ChiTietLichChieu.MaPhim AND ChiTietLichChieu.MaPhong = PhongChieu.MaPhong AND PhongChieu.LoaiPhong = CTLoaiPhong.MaLoai AND ChiTietLichChieu.MaLich = @MaLich AND Movie.TrangThai=1";

            SqlParameter[] par = new SqlParameter[1];
            par[0] = new SqlParameter("@MaLich", MaLich);
            SqlDataReader       sdr = DataProvider.TruyVanDuLieu(strTruyVan, par, conn);
            List <SuatChieuDTO> ls  = new List <SuatChieuDTO>();

            while (sdr.Read())
            {
                SuatChieuDTO ketqua = new SuatChieuDTO();
                ketqua.MaPhim       = int.Parse(sdr["MaPhim"].ToString());
                ketqua.TenPhim      = sdr["TenPhim"].ToString();
                ketqua.TheLoai      = sdr["TheLoai"].ToString();
                ketqua.ThoiLuong    = int.Parse(sdr["ThoiLuong"].ToString());
                ketqua.HinhAnh      = sdr["HinhAnh"].ToString();
                ketqua.DaoDien      = sdr["DaoDien"].ToString();
                ketqua.NamXS        = sdr["NamXS"].ToString();
                ketqua.NhaXS        = sdr["NhaXS"].ToString();
                ketqua.NDPhim       = sdr["NDPhim"].ToString();
                ketqua.MaPhong      = int.Parse(sdr["MaPhong"].ToString());
                ketqua.TenPhong     = sdr["TenPhong"].ToString();
                ketqua.Maloai       = int.Parse(sdr["Maloai"].ToString());
                ketqua.TenLoaiPhong = sdr["LoaiPhong"].ToString();
                ketqua.SLCho        = int.Parse(sdr["SLCho"].ToString());
                ketqua.MaCa         = int.Parse(sdr["MaCa"].ToString());
                ketqua.ThoiGianBD   = sdr["ThoiGianBD"].ToString();
                ketqua.ThoiGianKT   = sdr["ThoiGianKT"].ToString();
                ketqua.Mac          = sdr["Mac"].ToString();
                ketqua.MaCa         = int.Parse(sdr["MaCa"].ToString());
                ketqua.TrangThai    = int.Parse(sdr["TrangThai"].ToString());
                ls.Add(ketqua);
            }
            sdr.Close();
            conn.Close();
            return(ls);
        }
        protected void btn_Them_Click(object sender, EventArgs e)
        {
            SuatChieuDTO scDTO = new SuatChieuDTO();

            scDTO.MaPhim       = Convert.ToInt32(ddl_maphim.SelectedItem.Text);
            scDTO.MaPhongChieu = Convert.ToInt32(ddl_maphongchieu.SelectedItem.Text);
            DateTime dt = new DateTime();

            DateTime.TryParseExact(tbNgayChieu.Text, "yyyy-mm-dd", null, DateTimeStyles.None, out dt);
            scDTO.NgayChieu = dt.ToString("dd/mm/yyyy");
            scDTO.GioChieu  = tbGioChieu.Text;

            SuatChieuBUS scBUS = new SuatChieuBUS();

            scBUS.ThemSuatChieu(scDTO);
            string strBuilder = "<script language='javascript'>alert('" + "Thêm thành công" + "')</script>";

            Response.Write(strBuilder);
            tbNgayChieu.Text = "";
            tbGioChieu.Text  = "";
            FilGVDanhSachLichChieu();
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String        MaVe          = Request.QueryString["id"];
            VeBUS         veBUS         = new VeBUS();
            SuatChieuBUS  suatChieuBUS  = new SuatChieuBUS();
            PhimBUS       phimBUS       = new PhimBUS();
            PhongChieuBUS phongChieuBUS = new PhongChieuBUS();

            VeDTO         veDTO         = veBUS.LayThongTin(Convert.ToInt32(MaVe));
            SuatChieuDTO  suatChieuDTO  = suatChieuBUS.LayThongTin(veDTO.MaSuatChieu);
            PhimDTO       phimDTO       = phimBUS.LayThongTin(suatChieuDTO.MaPhim);
            PhongChieuDTO phongChieuDTO = phongChieuBUS.LayThongTin(suatChieuDTO.MaPhongChieu);

            VeID.Text       += veDTO.MaVe.ToString();
            Phim.Text       += phimDTO.Ten;
            PhongChieu.Text += phongChieuDTO.TenPhongChieu;
            NgayChieu.Text  += suatChieuDTO.NgayChieu;
            SuatCHieu.Text  += suatChieuDTO.GioChieu;
            SoGhe.Text      += veDTO.Ghe;
            LoaiVe.Text     += (veDTO.LoaiVe) ? "VIP" : "Thường";
            GiaVe.Text      += veDTO.GiaVe.ToString() + " VNĐ";
        }
示例#10
0
 public List <int> ListGheTrong(SuatChieuDTO sc, string day)
 {
     return(suatChieuDAO.ListGheTrong(sc, day));
 }
示例#11
0
 public bool ThemSuatChieu(SuatChieuDTO sc)
 {
     return(suatChieuDAO.ThemSuatChieu(sc));
 }