Esempio n. 1
0
        /// <summary>
        /// 截图列表
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult Index(int?page)
        {
            PageIndex = page ?? 1;
            PageSize  = 10;

            var predicate = PredicateBuilder.True <ScreenShot>().And(i => i.IsValid == true);

            var BLL  = new ScreenShotBLL();
            var list = BLL.GetPagedList(PageIndex, PageSize, predicate, i => i.ID, false);

            var rowCount  = BLL.GetCount(predicate);;
            var pageCount = Convert.ToInt32(Math.Ceiling(rowCount * 1.0 / PageSize));
            var pagedHtml = HtmlCommon.GetPagedHtml(PageIndex, pageCount, "",
                                                    string.Format("&keyword={0}", ""));

            ViewBag.Data = new
            {
                PageIndex = PageIndex,
                PageSize  = PageSize,
                PageCount = pageCount,
                PagedHtml = pagedHtml,
                RowCount  = rowCount
            }.ToExpando();

            return(View(list));
        }
Esempio n. 2
0
        /// <summary>
        /// 用户管理视图
        /// </summary>
        /// <returns></returns>
        public ActionResult User(int?page, string keyword, bool?isAdmin, int?roleId)
        {
            PageIndex = page ?? 1;

            var predicate = PredicateBuilder.True <V_User_Info>().And(i => i.IsValid == true);

            #region 查询
            if (!string.IsNullOrEmpty(keyword))
            {
                predicate = predicate.And(i => i.Username.Contains(keyword) || i.Realname.Contains(keyword) || i.Mobile.Contains(keyword));
            }
            if (isAdmin != null)
            {
                predicate = predicate.And(i => i.IsAdmin == isAdmin);
            }
            if (roleId != null)
            {
                predicate = predicate.And(i => i.RoleID == roleId);
            }

            #endregion


            var userBLL   = new V_User_InfoBLL();
            var list      = userBLL.GetPagedList(PageIndex, PageSize, predicate, i => i.ID, false);
            var rowCount  = userBLL.GetCount(predicate);
            var pageCount = Convert.ToInt32(Math.Ceiling(rowCount * 1.0 / PageSize));
            var pagedHtml = HtmlCommon.GetPagedHtml(PageIndex, pageCount, "",
                                                    string.Format("&keyword={0}&isAdmin={1}&roleId={2}", keyword, isAdmin, roleId));

            ViewBag.Data = new
            {
                PageIndex = PageIndex,
                PageSize  = PageSize,
                PageCount = pageCount,
                PagedHtml = pagedHtml,
                RowCount  = rowCount,
                keyword   = keyword,
                IsAdmin   = isAdmin.ToString().ToLower(),
                RoleId    = roleId,

                RoleList = new RoleBLL().GetList(i => i.ID, true)
            }.ToExpando();

            return(View(list));
        }