Пример #1
0
        public ActionResult Index(FormCollection collection, int p = 0)
        {
            MenuModel.MeunOrderbyTypeEnum _MeunOrderbyTypeEnum = (MenuModel.MeunOrderbyTypeEnum)Enum.Parse(typeof(MenuModel.MeunOrderbyTypeEnum), collection["Sort"], true);
            List <PackageViewModel>       model = new List <PackageViewModel>();
            var _value = PackagesModel.GetPackageList(collection["PG_Name"], p + 1, take, _MeunOrderbyTypeEnum);

            //多取一,若有表示有下一頁
            if (_value.Count == (take + 1))
            {
                ViewBag.pn = p + 1;
                _value.RemoveAt(take);
            }
            else
            {
                ViewBag.pn = 0;
            }
            ViewBag.pi = p;
            for (int i = 0; i < _value.Count; i++)
            {
                model.Add(new PackageViewModel()
                {
                    Budget      = 0,
                    CreateDate  = _value[i].CreateDate,
                    EndDate     = _value[i].EndDate.HasValue ? _value[i].EndDate.Value : DateTime.Now.AddDays(-1),
                    PG_Name     = _value[i].PackagesName,
                    PG_No       = _value[i].PackagesNo.ToString(),
                    WorksAmount = _value[i].ItemAmount
                });
            }
            setSortDropDown(_MeunOrderbyTypeEnum);
            ViewBag.pt = take.ToString();
            return(View(model));
        }
Пример #2
0
        // GET: Package
        public ActionResult Index(int p = 0)
        {
            List <PackageViewModel> model = new List <PackageViewModel>();

            var _value = PackagesModel.GetPackageList("", p + 1, take, MenuModel.MeunOrderbyTypeEnum.預設排序);

            //多取一,若有表示有下一頁
            if (_value.Count == (take + 1))
            {
                ViewBag.pn = p + 1;
                _value.RemoveAt(take);
            }
            else
            {
                ViewBag.pn = 0;
            }
            ViewBag.pi = p;
            for (int i = 0; i < _value.Count; i++)
            {
                model.Add(new PackageViewModel()
                {
                    Budget      = 0,
                    CreateDate  = _value[i].CreateDate,
                    EndDate     = _value[i].EndDate.HasValue ? _value[i].EndDate.Value : DateTime.Now.AddDays(-1),
                    PG_Name     = _value[i].PackagesName,
                    PG_No       = _value[i].PackagesNo.ToString(),
                    WorksAmount = _value[i].ItemAmount,
                    CreateUser  = _value[i].CreateUser
                });
            }
            setSortDropDown();
            ViewBag.pt = take.ToString();
            return(View(model));
        }