Exemple #1
0
        //Hien thi chi tiet viec dat ve
        public ActionResult BookingDetail()
        {
            //Kiem tra neu nguoi dung chua dang nhap thi hien thi thong bao yeu cau dang nhap
            if (Session["UserID"] == null)
            {
                Response.Write("You can only find book ticket detail if you login!<br />");
                Response.Write("Please <a href='/Home/SearchDetail'>back</a> home page to login or <a href='/Home/Register/'>register</a> is member of us");
                return(null);
            }
            //Ket thuc kiem tra

            try
            {
                int             beginID   = Convert.ToInt32(Request.Params["BeginID"]);
                int             endID     = Convert.ToInt32(Request.Params["EndID"]);
                int             bustypeID = Convert.ToInt32(Request.Params["BusTypeID"]);
                int             startTime = Convert.ToInt32(Request.Params["StartTime"]);
                RepositoryOBTRS db        = new RepositoryOBTRS();
                List <String>   list      = db.GetRouteDetail(beginID, endID, bustypeID, startTime);
                ViewData["RouteDetail"] = list;
                //Setup Session RouteDetail - danh sach chi tiet tuyen xe ma khach hang chon
                Session["RouteDetail"] = list;

                if (list[1].ToString() == "12")
                {
                    ViewData["BusDiagram"] = db.GetBusDiagram(1);
                }
                else if (list[1].ToString() == "24")
                {
                    ViewData["BusDiagram"] = db.GetBusDiagram(2);
                }
                else
                {
                    ViewData["BusDiagram"] = db.GetBusDiagram(3);
                }

                //Lay tong so ghe da dc dat
                db_OBTRSDataContext tbl  = new db_OBTRSDataContext();
                DateTime            date = DateTime.Parse(Request.Params["Date"]);
                var sumSeat = tbl.sp_GetSelectedSeat(beginID, endID, bustypeID, startTime, date);

                //Luu tru danh sach ghe ngoi
                ArrayList BookedSeatList = new ArrayList();
                foreach (sp_GetSelectedSeatResult name in sumSeat)
                {
                    BookedSeatList.Add(name.Seat);
                }

                //Lay danh sach cac ghe da dat cho
                //Session["BookedSeatList"] = BookedSeatList;
                //Tam thoi ko su dung--------

                ViewData["BookedSeat"] = BookedSeatList;
            }
            catch (Exception e)
            {
                Response.Write("<strong style='font-size:12pt'>Have a error in during request to server!</strong>");
                Response.Write("<br>Sorry for this inconvenience! Please<a href='/Home'> click here</a> to HOME PAGE.");
                //throw;
                return(null);
            }

            return(View());
        }