示例#1
0
        //获取分页数据
        public ActionResult GetPageList()
        {
            long     searchId;
            bool     isId = long.TryParse(Request["searchId"], out searchId);
            string   searchName = string.IsNullOrEmpty(Request["searchName"]) ? string.Empty : Request["searchName"];
            DateTime from, to;
            bool     fromIsDate = DateTime.TryParse(Request["from"], out from);
            bool     toIsDate   = DateTime.TryParse(Request["to"], out to);
            bool     showAll    = !string.IsNullOrEmpty(Request["show"]);

            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5;

            int totalCount;
            WhereHelper <WFInstance> wh = new WhereHelper <WFInstance>();

            //wh.Equal("IsDeleted", (byte)0);
            if (!showAll)
            {
                wh.Equal("SubBy", UserLogin.UserId);
            }
            if (isId)
            {
                wh.Equal("InstanceId", searchId);
            }
            if (searchName != string.Empty)
            {
                wh.Contains("InstanceTitle", searchName);
            }
            if (fromIsDate)
            {
                wh.StrGreater("SubTime", from.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (toIsDate)
            {
                wh.StrLess("SubTime", to.ToString("yyyy-MM-dd") + " 23:59:59");
            }
            var InstanceList = WFInstanceBll.GetPageList <long>(wh.GetExpression(), i => i.InstanceId, false, pageIndex, pageSize, out totalCount);
            var uList        = UserInfoBll.GetList <int>(us => true);
            var result       = from i in InstanceList
                               from uu in uList
                               where i.SubBy == uu.UserId
                               select new
            {
                UserId        = UserLogin.UserId,
                SubId         = i.SubBy,
                InstanceId    = i.InstanceId,
                InstanceTitle = i.InstanceTitle,
                InstanceState = i.InstanceState,
                Details       = i.Details,
                Remark        = i.Remark,
                SubTime       = i.SubTime,
                SubBy         = uu.RealName != null && uu.RealName != "" ? uu.RealName : uu.Username,
                RejectMsg     = i.RejectMsg
            };

            return(Json(new { total = totalCount, rows = result }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        //获取分页数据
        public ActionResult GetPageList()
        {
            //预处理搜索条件
            long     searchId;
            bool     isId = long.TryParse(Request["searchId"], out searchId);
            string   searchName = string.IsNullOrEmpty(Request["searchName"]) ? string.Empty : Request["searchName"];
            DateTime from, to;
            bool     fromIsDate = DateTime.TryParse(Request["from"], out from);
            bool     toIsDate   = DateTime.TryParse(Request["to"], out to);

            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5;

            //进行分页查询
            int totalCount;
            WhereHelper <ActionInfo> wh = new WhereHelper <ActionInfo>();

            wh.Equal("IsDeleted", (byte)0);
            if (isId)
            {
                wh.Equal("ActionId", searchId);
            }
            if (searchName != string.Empty)
            {
                wh.Contains("ActionTitle", searchName);
            }
            if (fromIsDate)
            {
                wh.StrGreater("AddTime", from.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (toIsDate)
            {
                wh.StrLess("AddTime", to.ToString("yyyy-MM-dd") + " 23:59:59");
            }
            var actionList = ActionInfoBll.GetPageList <long>(wh.GetExpression(), a => a.ActionId, false, pageIndex, pageSize, out totalCount);
            var uList      = UserInfoBll.GetList <int>(us => true);
            //构造新匿名对象防止导航属性循环引用
            var result = from a in actionList
                         from uu in uList
                         where a.SubBy == uu.UserId
                         select new
            {
                ActionId       = a.ActionId,
                ActionTitle    = a.ActionTitle,
                IsMenu         = a.IsMenu,
                ControllerName = a.ControllerName,
                ActionName     = a.ActionName,
                Remark         = a.Remark,
                AddTime        = a.AddTime,
                ModifiedTime   = a.ModifiedTime,
                SubBy          = uu.RealName != null && uu.RealName != "" ? uu.RealName : uu.Username
            };

            return(Json(new { total = totalCount, rows = result }, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        //获取分页数据
        public ActionResult GetPageList()
        {
            long     searchId;
            bool     isId = long.TryParse(Request["searchId"], out searchId);
            string   searchName = string.IsNullOrEmpty(Request["searchName"]) ? string.Empty : Request["searchName"];
            DateTime from, to;
            bool     fromIsDate = DateTime.TryParse(Request["from"], out from);
            bool     toIsDate   = DateTime.TryParse(Request["to"], out to);

            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5;

            int totalCount;

            WhereHelper <RoleInfo> wh = new WhereHelper <RoleInfo>();

            wh.Equal("IsDeleted", (byte)0);
            if (isId)
            {
                wh.Equal("RoleId", searchId);
            }
            if (searchName != string.Empty)
            {
                wh.Contains("RoleName", searchName);
            }
            if (fromIsDate)
            {
                wh.StrGreater("AddTime", from.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (toIsDate)
            {
                wh.StrLess("AddTime", to.ToString("yyyy-MM-dd") + " 23:59:59");
            }
            var roleList = RoleInfoBll.GetPageList <long>(wh.GetExpression(), u => u.RoleId, false, pageIndex, pageSize, out totalCount);
            //var roleList = RoleInfoBll.GetPageList<long>(r => (r.IsDeleted == 0) && (isId ? r.RoleId == searchId : true) && (searchName != string.Empty ? r.RoleName.Contains(searchName) : true) && (formIsDate ? from.CompareTo(r.AddTime) < 0 : true) && (toIsDate ? to.CompareTo(r.AddTime) > 0 : true), r => r.RoleId, false, pageIndex, pageSize, out totalCount);
            var uList  = UserInfoBll.GetList <int>(us => true);
            var result = from r in roleList
                         from uu in uList
                         where r.SubBy == uu.UserId
                         select new RoleViewModel
            {
                RoleId       = r.RoleId,
                RoleName     = r.RoleName,
                Remark       = r.Remark,
                AddTime      = r.AddTime,
                ModifiedTime = r.ModifiedTime,
                SubBy        = uu.RealName != null && uu.RealName != "" ? uu.RealName : uu.Username
            };

            return(Json(new { total = totalCount, rows = result }));
        }
示例#4
0
        //获取分页数据
        public ActionResult GetPageList()
        {
            long     searchId;
            bool     isId = long.TryParse(Request["searchId"], out searchId);
            string   searchName = string.IsNullOrEmpty(Request["searchName"]) ? string.Empty : Request["searchName"];
            DateTime from, to;
            bool     fromIsDate = DateTime.TryParse(Request["from"], out from);
            bool     toIsDate   = DateTime.TryParse(Request["to"], out to);

            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 5;

            int totalCount;
            WhereHelper <WFModel> wh = new WhereHelper <WFModel>();

            wh.Equal("IsDeleted", (byte)0);
            if (isId)
            {
                wh.Equal("ModelId", searchId);
            }
            if (searchName != string.Empty)
            {
                wh.Contains("ModelTitle", searchName);
            }
            if (fromIsDate)
            {
                wh.StrGreater("AddTime", from.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (toIsDate)
            {
                wh.StrLess("AddTime", to.ToString("yyyy-MM-dd") + " 23:59:59");
            }
            var modelList = WFModelBll.GetPageList <long>(wh.GetExpression(), m => m.ModelId, false, pageIndex, pageSize, out totalCount);
            var uList     = UserInfoBll.GetList <int>(us => true);
            var result    = from m in modelList
                            from uu in uList
                            where m.SubBy == uu.UserId
                            select new WFViewModel
            {
                ModelId        = m.ModelId,
                ModelTitle     = m.ModelTitle,
                ControllerName = m.ControllerName,
                ActionName     = m.ActionName,
                Remark         = m.Remark,
                AddTime        = m.AddTime,
                ModifiedTime   = m.ModifiedTime,
                SubBy          = uu.RealName != null && uu.RealName != "" ? uu.RealName : uu.Username
            };

            return(Json(new { total = totalCount, rows = result }, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="page">PageIndex</param>
        /// <param name="rows">PageSize</param>
        /// <returns></returns>
        public ActionResult GetPageList(int page, int rows)
        {
            //接收查询数据
            int    id1   = string.IsNullOrEmpty(Request["sid"]) ? 0 : int.Parse(Request["sid"]);
            string name1 = string.IsNullOrEmpty(Request["sname"]) ? "" : Request["sname"];

            //调用Service来完成查询,获取数据
            int total;

            //var result=UserInfoService.GetPageList<int>(
            //    u => (u.IsDelete == false)
            //        &&
            //        (id1==0?true:u.UserId==id1)
            //        &&
            //        (name1==""?true:u.UserName.Contains(name1)),
            //    u => u.UserId,
            //    rows, page,out total);


            WhereHelper <UserInfo> where = new WhereHelper <UserInfo>();
            where.Equal("IsDelete", false);
            if (id1 != 0)
            {
                where.Equal("UserId", id1);
            }
            if (name1 != "")
            {
                where.Contains("UserName", name1);
            }

            var result = UserInfoService.GetPageList <int>(where.GetExpression(), u => u.UserId, page, rows, out total).Select(u => new
            {
                u.UserId,
                u.UserName
            });


            return(Json(new { total, rows = result }, JsonRequestBehavior.AllowGet));
        }