コード例 #1
0
        // GET: Admin/DriverManage
        public ActionResult Index(int page = 1, int pageSize = 4)
        {
            MultipleAdmin modelMulti = new MultipleAdmin();

            DriverManageModel model = new DriverManageModel();
            DriverDAO         dao   = new DriverDAO();

            if (Request.Form["txtSearch"] != null)
            {
                Session["lastSearch"]  = Request.Form["txtSearch"];
                ViewData["lastSearch"] = Session["lastSearch"];
                if (Session["lastSearch"].ToString().Equals(""))
                {
                    model.ListDriver = dao.getListDriver(page, pageSize);
                    //after call another page
                    Session["lastSearch"] = null;
                }
                else
                {
                    model.ListDriver = dao.SearchByNameOrId(Session["lastSearch"].ToString(), page, pageSize);
                }
            }
            else if (Session["lastSearch"] != null)
            {
                ViewData["lastSearch"] = Session["lastSearch"];
                model.ListDriver       = dao.SearchByNameOrId(Session["lastSearch"].ToString(), page, pageSize);
            }
            else
            {
                model.ListDriver = dao.getListDriver(page, pageSize);
            }
            modelMulti.Divermanager     = model;
            modelMulti.CountHostRequest = new HostRequestDAO().CountHostRequest();

            return(View(modelMulti));
        }
コード例 #2
0
        public ActionResult ViewDetail(String username, int page = 1, int pageSize = 4)
        {
            // B/c pagelistPager can't pass parameters
            if (username != null)
            {
                Session["DriverViewing"] = username;
            }
            DriverHistoryDAO  dao       = new DriverHistoryDAO();
            DriverManageModel model     = new DriverManageModel();
            DriverDAO         driverDAO = new DriverDAO();

            model.History       = dao.loadHistory(Session["DriverViewing"].ToString(), page, pageSize);
            model.ListDriver    = driverDAO.getListDriver(1, 4);
            model.DriverViewing = driverDAO.getDriverById(Session["DriverViewing"].ToString());
            ViewBag.TotalPrice  = dao.totalPrice;

            //after view detail
            Session["lastSearch"] = null;

            MultipleAdmin modelMulti = new MultipleAdmin();

            modelMulti.Divermanager = model;
            return(View("Index", modelMulti));
        }