Ejemplo n.º 1
0
        /// <summary>
        /// 杂志版块
        /// </summary> 
        public ActionResult MagazineIndex(string Category, string Year, string Month, string PagerIndex = "1", string PagerSize = "30")
        {
            Year = string.IsNullOrWhiteSpace(Year) ? DateTime.Now.Year.ToString() : Year;
            Month = string.IsNullOrWhiteSpace(Month) ? DateTime.Now.Month.ToString() : Month;
            var idx = 0;
            var iYear = 0;
            var iMonth = 0;
            int.TryParse(Year, out iYear);
            int.TryParse(Month, out iMonth);
            int.TryParse(Category, out idx);
            var resultMsg = string.Empty;
            var logic = new LogicCategory();
            var model = new ModelPagerArticle();
            var monthDays = DateTime.DaysInMonth(iYear, iMonth);
            var startDate = new DateTime(iYear, iMonth, 1, 0, 0, 0);
            var endDate = new DateTime(iYear, iMonth, monthDays, 23, 59, 59);
            var cateModel = logic.CategoryDetailByPid(out resultMsg, idx, startDate, endDate);

            if (cateModel != null)
            {
                ViewBag.CategoryName = cateModel.Name;
                ViewBag.Thumbnails = cateModel.Thumbnails;
                model = GetData(Category: cateModel.Id.ToString(), PagerIndex: PagerIndex, PagerSize: PagerSize);
                model.Year = Year;
                model.Month = Month;
                model.Category = Category;
            }

            return View(model);
        }
Ejemplo n.º 2
0
        private ModelPagerArticle GetData(string Category = null, string CategoryTwo = null, string KeyWord = null, string PagerIndex = "1", string PagerSize = "30")
        {
            var model = new ModelPagerArticle();
            model.PagerCount = 0;
            model.PagerIndex = 1;

            //if (!string.IsNullOrWhiteSpace(Category) || !string.IsNullOrWhiteSpace(CategoryTwo))
            //{
                var pageIndex = 0;
                var pageSize = 0;
                int.TryParse(PagerIndex, out pageIndex);
                int.TryParse(PagerSize, out pageSize);

                var rowCount = decimal.Zero;
                var resultMsg = string.Empty;
                LogicArticle artDal = new LogicArticle();

                CriteriaArticle.Pager criteria = new CriteriaArticle.Pager();
                criteria.CategoryId = string.IsNullOrWhiteSpace(Category) ? null : Category;
                criteria.CategoryTwo = string.IsNullOrWhiteSpace(CategoryTwo) ? null : CategoryTwo;
                criteria.KeyWord = string.IsNullOrWhiteSpace(KeyWord) ? null : KeyWord;
                var list = artDal.QueryArticleListPager(out resultMsg, out rowCount, criteria, pageSize: pageSize, pageIndex: pageIndex);

                model.ArtcleList = list;
                model.PagerCount = pageSize == 0 ? 0 : Math.Ceiling(rowCount / pageSize);
                model.PagerIndex = pageIndex;
                model.Category = Category;
                model.CategoryTwo = CategoryTwo;
                if (list.Count > 0)
                    model.KeyWord = list.First().CategoryName;
            //}

            return model;
        }
Ejemplo n.º 3
0
        public ActionResult Index(string Category, string CategoryTwo, string KeyWord, string PagerIndex, string PagerSize)
        {
            var pageIndex = 0;
            var pageSize = 0;
            int.TryParse(PagerIndex, out pageIndex);
            int.TryParse(PagerSize, out pageSize);

            var rowCount = decimal.Zero;
            var resultMsg = string.Empty;
            var model = new ModelPagerArticle();
            ViewBag.Categorys = base.QueryCategoryAll();
            ViewBag.CategorysTwo = base.QueryCategoryAll();
            LogicArticle artDal = new LogicArticle();

            CriteriaArticle.Pager criteria = new CriteriaArticle.Pager();
            criteria.CategoryId = string.IsNullOrWhiteSpace(Category) ? null : Category;
            criteria.CategoryTwo = string.IsNullOrWhiteSpace(CategoryTwo) ? null : CategoryTwo;
            criteria.KeyWord = string.IsNullOrWhiteSpace(KeyWord) ? null : KeyWord;
            var list = artDal.QueryArticleListPager(out resultMsg, out rowCount, criteria, pageSize: pageSize, pageIndex: pageIndex);

            model.ArtcleList = list;
            model.PagerCount = pageSize == 0 ? 0 : Math.Ceiling(rowCount / pageSize);
            model.PagerIndex = pageIndex;

            return View(model);
        }
Ejemplo n.º 4
0
 public ActionResult Index()
 {
     ViewBag.Categorys = base.QueryCategoryAll();
     ModelPagerArticle model = new ModelPagerArticle();
     model.PagerCount = 0;
     model.PagerIndex = 1;
     return View(model);
 }
        public ActionResult Index(string Category, string CategoryTwo, string KeyWord, string PagerIndex, string PagerSize)
        {
            var pageIndex = 0;
            var pageSize = 0;
            int.TryParse(PagerIndex, out pageIndex);
            int.TryParse(PagerSize, out pageSize);
            var customScript = string.Empty;
            IList<SelectListItem> categorys = new List<SelectListItem>();
            IList<SelectListItem> categorysTwo = new List<SelectListItem>();

            var rowCount = decimal.Zero;
            var resultMsg = string.Empty;
            var model = new ModelPagerArticle();

            try
            {
                categorys = base.QueryCategoryAll(model.Category);
                categorysTwo = base.QueryCategoryAll(model.CategoryTwo);
                LogicArticle artDal = new LogicArticle();

                CriteriaArticle.Pager criteria = new CriteriaArticle.Pager();
                criteria.CategoryId = string.IsNullOrWhiteSpace(Category) ? null : Category;
                criteria.CategoryTwo = string.IsNullOrWhiteSpace(CategoryTwo) ? null : CategoryTwo;
                criteria.KeyWord = string.IsNullOrWhiteSpace(KeyWord) ? null : KeyWord;
                criteria.AuthorizeInfo = base.AuthorizeInfo;
                var list = artDal.QueryArticleListPager(out resultMsg, out rowCount, criteria, pageSize: pageSize, pageIndex: pageIndex);

                model.ArtcleList = list;
                model.PagerCount = pageSize == 0 ? 0 : Math.Ceiling(rowCount / pageSize);
                model.PagerIndex = pageIndex;
            }
            catch (AuthorizeException ex)
            {
                customScript = Library.Common.UtilityScript.ShowMessage("系统出错,错误信息:" + ex.Message, title: "警告", isSuccess: false, funName: "GotoLogin");
            }
            catch (Exception ex)
            {
                customScript = Library.Common.UtilityScript.ShowMessage("系统出错,错误信息:" + ex.Message, title: "警告");
            }

            ViewBag.CustomScript = customScript;
            ViewBag.Categorys = categorys;
            ViewBag.CategorysTwo = categorysTwo;
            return View(model);
        }
        public ActionResult Index()
        {
            var model = new ModelPagerArticle();
            model.PagerCount = 0;
            model.PagerIndex = 1;

            var customScript = string.Empty;
            IList<SelectListItem> categorys = new List<SelectListItem>();
            IList<SelectListItem> categorysTwo = new List<SelectListItem>();

            try
            {
                categorys = base.QueryCategoryAll();
                categorysTwo = base.QueryCategoryAll();
            }
            catch (AuthorizeException ex)
            {
                customScript = Library.Common.UtilityScript.ShowMessage("系统出错,错误信息:" + ex.Message, title: "警告", isSuccess: false, funName: "GotoLogin");
            }
            catch (Exception ex)
            {
                customScript = Library.Common.UtilityScript.ShowMessage("系统出错,错误信息:" + ex.Message, title: "警告");
            }

            ViewBag.CustomScript = customScript;
            ViewBag.Categorys = categorys;
            ViewBag.CategorysTwo = categorysTwo;
            return View(model);
        }