Пример #1
0
        //
        // GET: /Home/
        public ActionResult Index(IEnumerable <FilmD> film)
        {
            //ViewBag.inherit = "visibility-hidden";
            //Session["USRID"] = "";
            Session["SEATBUSY"]      = false;
            Session["TICKETSUCCESS"] = true;

            using (DataVw dMan = new DataVw())
            {
                dsFilm     = dMan.ExecuteView_S("FILM WHERE VISIONDATE <= GETDATE() AND DAY(VISIONDATE) <= 30 AND MONTH(VISIONDATE) = MONTH(GETDATE())", "*", "", "", "");
                dsFilmSoon = dMan.ExecuteView_S("FILM WHERE VISIONDATE >= GETDATE() AND DAY(VISIONDATE) <= 30", "*", "", "", "");
            }

            FilmD        s         = new FilmD();
            List <FilmD> datatable = new List <FilmD>();

            foreach (DataRow dr in dsFilm.Tables[0].Rows)
            {
                datatable.Add(new FilmD {
                    ID          = (Guid)dr["ID"],
                    FILMNM      = dr["FILMNM"].ToString(),
                    FILMTYPID   = (Guid)dr["FILMTYPID"],
                    FILMIMG     = dr["FILMIMG"].ToString(),
                    VISIONDATE  = (DateTime)dr["VISIONDATE"],
                    TIME        = dr["TIME"].ToString(),
                    EXPLANATION = dr["EXPLANATION"].ToString().Substring(0, 230)
                });
            }

            List <FilmD> filmSoon = new List <FilmD>();

            foreach (DataRow dr in dsFilmSoon.Tables[0].Rows)
            {
                filmSoon.Add(new FilmD
                {
                    ID          = (Guid)dr["ID"],
                    FILMNM      = dr["FILMNM"].ToString(),
                    FILMTYPID   = (Guid)dr["FILMTYPID"],
                    FILMIMG     = dr["FILMIMG"].ToString(),
                    VISIONDATE  = (DateTime)dr["VISIONDATE"],
                    TIME        = dr["TIME"].ToString(),
                    EXPLANATION = dr["EXPLANATION"].ToString().Substring(0, 230)
                });
            }

            ViewBag.FilmListD = datatable;
            ViewBag.FilmSoon  = filmSoon;

            if (HttpContext.Application["counter"] == null)
            {
                HttpContext.Application["counter"] = 0;
            }

            HttpContext.Application["counter"] = Convert.ToInt16(HttpContext.Application["counter"]) + 1;

            ViewBag.counter = HttpContext.Application["counter"];

            return(View(datatable));
        }
Пример #2
0
        public ActionResult Filminfo()
        {
            string  IdValue    = Session["FILMID"].ToString();
            DataSet dsFilmD    = new DataSet();
            DataSet dsFilmInfo = new DataSet();

            using (DataVw dMan = new DataVw())
            {
                dsFilmD    = dMan.ExecuteView_S("FILM", "*", IdValue, "", "ID = ");
                dsFilmInfo = dMan.ExecuteView_S("FILMINFO", "*", IdValue, "", "FILMID = ");
            }

            FilmD        s      = new FilmD();
            List <FilmD> filmDe = new List <FilmD>();

            foreach (DataRow dr in dsFilmD.Tables[0].Rows)
            {
                filmDe.Add(new FilmD
                {
                    ID          = (Guid)dr["ID"],
                    FILMNM      = dr["FILMNM"].ToString(),
                    FILMTYPID   = (Guid)dr["FILMTYPID"],
                    FILMIMG     = dr["FILMIMG"].ToString(),
                    VISIONDATE  = (DateTime)dr["VISIONDATE"],
                    TIME        = dr["TIME"].ToString(),
                    EXPLANATION = dr["EXPLANATION"].ToString().Substring(0, 230)
                });
            }

            List <FilmInfo> filmInfo = new List <FilmInfo>();

            foreach (DataRow dr in dsFilmInfo.Tables[0].Rows)
            {
                filmInfo.Add(new FilmInfo
                {
                    FID      = (Guid)dr["ID"],
                    FFILMID  = (Guid)dr["FILMID"],
                    FHALLID  = (Guid)dr["HALLID"],
                    FFID     = (Guid)dr["FID"],
                    HID      = (Guid)dr["HID"],
                    HALLNM   = dr["HALLNM"].ToString(),
                    H2ID     = (Guid)dr["H2ID"],
                    HALLTIME = dr["HALLTIME"].ToString()
                });
            }

            //var filmHallGroup = from flm in filmInfo
            //                    group flm by flm.HALLNM;

            //var filmHallGroup = filmInfo.GroupBy(flm => flm.HALLNM[0]);

            var filmHallGroup = filmInfo.GroupBy(flm => flm.HALLNM).Select(g => new FilmGroup
            {
                Key = g.Key
                      //Tag = g
            });

            ViewBag.FilmListDe    = filmDe;
            ViewBag.FilmListInfo  = filmInfo;
            ViewBag.FilmHallGroup = filmHallGroup;


            return(View(filmDe));
        }