Esempio n. 1
0
        public ActionResult DataSource(int pageIndex, int pageSize, string titleKeywords, string category)
        {
            var table = _postService.GetList(titleKeywords, category);

            var pageParameter = new PageParameter(pageIndex, pageSize);
            table = pageParameter.Paged(table);
            var model = table.Select(i => new PostListViewModel
            {
                Id = i.Id,
                CommentCount = i.Comments.Count(),
                CreateTime = i.CreateTime,
                ReadingCount = i.ReadingCount,
                Status = i.Status,
                Title = i.Title
            }).ToArray();

            return Json(new { pageParameter.PageCount, list = model });
        }
        public ActionResult DataSource(int pageIndex, int pageSize, string titleKeywords)
        {
            var table = _categoryService.GetList(titleKeywords);

            var pageParameter = new PageParameter(pageIndex, pageSize);
            table = pageParameter.Paged(table);
            var model = table.Select(i => new CategoryListViewModel
            {
                Id = i.Id,
                PostCount = i.Posts.Count(),
                Title = i.Title,
                Visible = i.Visible,
                Seo = i.Seo,
                RoutePath = i.Route.Path
            }).ToArray();

            return Json(new { pageParameter.PageCount, list = model });
        }
Esempio n. 3
0
        public async Task<HttpResponseMessage> Get(string postId, int pageIndex, int pageSize)
        {
            if (!await _postService.Exist(postId))
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, "文章不存在!");

            var comments = _commentService.GetListByPost(postId);

            var pageParameter = new PageParameter(pageIndex - 1, pageSize);
            comments = pageParameter.Paged(comments);

            return Request.CreateResponse(HttpStatusCode.OK,
                new
                {
                    pageParameter.PageCount,
                    PageIndex = pageIndex,
                    pageParameter.PageSize,
                    Data = comments.ToArray().Select(i => new { i.Id, i.Content, i.NickName, i.CreateTime })
                });
        }
Esempio n. 4
0
 public JsonResult GetList()
 {
     var pageindx = Request.QueryString["pageindex"];
     var sort = Request.QueryString["sort"];
     var desc = Request.QueryString["desc"];
     var p = new PageParameter
     {
         IsAsc = desc == "0",
         OrderBy = sort,
         PageSize = int.Parse(Request.QueryString["pagesize"]),
         PageIndex = int.Parse(pageindx)
     };
     var list = Users.GetPageList(p);
     return Json(new
     {
         count = p.RecordCount,
         list
     }, JsonRequestBehavior.AllowGet);
 }
Esempio n. 5
0
 public static IList <User> SearchTeam(String name, PageParameter param)
 {
     return(FindAll(_.IsTeam == true & _.Name.Contains(name), param));
 }
Esempio n. 6
0
        /// <summary>查询</summary>
        /// <param name="category"></param>
        /// <param name="action"></param>
        /// <param name="linkId"></param>
        /// <param name="success"></param>
        /// <param name="userid"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="key"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static IList <Log> Search(String category, String action, Int32 linkId, Boolean?success, Int32 userid, DateTime start, DateTime end, String key, PageParameter p)
        {
            var exp = new WhereExpression();

            if (!category.IsNullOrEmpty() && category != "全部")
            {
                exp &= _.Category == category;
            }
            if (!action.IsNullOrEmpty() && action != "全部")
            {
                exp &= _.Action == action;
            }
            if (linkId >= 0)
            {
                exp &= _.LinkID == linkId;
            }
            if (success != null)
            {
                exp &= _.Success == success;
            }
            if (userid >= 0)
            {
                exp &= _.CreateUserID == userid;
            }

            // 主键带有时间戳
            var snow = Meta.Factory.Snow;

            if (snow != null)
            {
                exp &= _.ID.Between(start, end, snow);
            }
            else
            {
                exp &= _.CreateTime.Between(start, end);
            }

            if (!key.IsNullOrEmpty())
            {
                exp &= _.Remark.Contains(key);
            }

            return(FindAll(exp, p));
        }
Esempio n. 7
0
        /// <summary>高级查询</summary>
        /// <param name="appid"></param>
        /// <param name="jobid"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="key"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static IEnumerable <AppMessage> Search(Int32 appid, Int32 jobid, DateTime start, DateTime end, String key, PageParameter p)
        {
            var exp = new WhereExpression();

            if (appid > 0)
            {
                exp &= _.AppID == appid;
            }
            if (jobid > 0)
            {
                exp &= _.JobID == jobid;
            }
            if (!key.IsNullOrEmpty())
            {
                exp &= _.Topic.Contains(key) | _.Data.Contains(key);
            }
            exp &= _.UpdateTime.Between(start, end);

            return(FindAll(exp, p));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = HRUser.USER_PERSONAL;
 }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = AppInformation.FunctionID;
 }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = PayStructure.FunctionID;
 }
Esempio n. 11
0
        private ActionResult List(int pageIndex, IQueryable<PostRecord> queryable, SeoModelFull seo, bool allowNotData = false)
        {
            if (pageIndex <= 0)
                return HttpNotFound();

            var posts = queryable;
            if (posts == null)
                return HttpNotFound();

            dynamic model = new ExpandoObject();
            model.Seo = seo;
            model.PostPage = null;

            if (!posts.Any() && allowNotData)
                return View("List", model);

            var pageParameter = new PageParameter(pageIndex - 1, 10);
            posts = pageParameter.Paged(posts);

            model.PostPage = new ExpandoObject();
            model.PostPage.PageCount = pageParameter.PageCount;
            model.PostPage.PageIndex = pageParameter.PageIndex;
            model.PostPage.PageSize = pageParameter.PageSize;
            model.PostPage.Posts = posts;

            if (pageIndex > pageParameter.PageCount || !posts.Any())
                return HttpNotFound();

            return View("List", model);
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = Fn.ToInt(ScrFunction.AccountofEmployeeMenuID);
 }
Esempio n. 13
0
        /// <summary>高级查询</summary>
        /// <param name="name">名称。登录用户名</param>
        /// <param name="mail">邮件</param>
        /// <param name="mobile">手机</param>
        /// <param name="code">代码。身份证、员工编号等</param>
        /// <param name="roleId">角色。主要角色</param>
        /// <param name="start">更新时间开始</param>
        /// <param name="end">更新时间结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <User> Search(String name, String mail, String mobile, String code, Int32 roleId, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (!name.IsNullOrEmpty())
            {
                exp &= _.Name == name;
            }
            if (!mail.IsNullOrEmpty())
            {
                exp &= _.Mail == mail;
            }
            if (!mobile.IsNullOrEmpty())
            {
                exp &= _.Mobile == mobile;
            }
            if (!code.IsNullOrEmpty())
            {
                exp &= _.Code == code;
            }
            if (roleId >= 0)
            {
                exp &= _.RoleID == roleId;
            }
            exp &= _.UpdateTime.Between(start, end);
            if (!key.IsNullOrEmpty())
            {
                exp &= _.Name.Contains(key) | _.Password.Contains(key) | _.DisplayName.Contains(key) | _.Mail.Contains(key) | _.Mobile.Contains(key) | _.Code.Contains(key) | _.Avatar.Contains(key) | _.RoleIds.Contains(key) | _.LastLoginIP.Contains(key) | _.RegisterIP.Contains(key) | _.Ex4.Contains(key) | _.Ex5.Contains(key) | _.Ex6.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
            }

            return(FindAll(exp, page));
        }
        /// <summary>高级查询</summary>
        /// <param name="appId">应用</param>
        /// <param name="name">操作名。接口名或埋点名</param>
        /// <param name="start">统计日期开始</param>
        /// <param name="end">统计日期结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <TraceDayStat> Search(Int32 appId, String name, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (appId >= 0)
            {
                exp &= _.AppId == appId;
            }
            if (!name.IsNullOrEmpty())
            {
                exp &= _.Name == name;
            }
            exp &= _.StatDate.Between(start, end);

            return(FindAll(exp, page));
        }
Esempio n. 15
0
        public static IList <Log> Search(String key, Int32 userid, String category, DateTime start, DateTime end, PageParameter p)
        {
            var exp = new WhereExpression();

            //if (!key.IsNullOrEmpty()) exp &= (_.Action == key | _.Remark.Contains(key));
            if (!category.IsNullOrEmpty() && category != "全部")
            {
                exp &= _.Category == category;
            }
            if (userid >= 0)
            {
                exp &= _.CreateUserID == userid;
            }

            // 主键带有时间戳
            var flow = Meta.Factory.FlowId;

            if (flow != null)
            {
                exp &= _.ID.Between(start, end, flow);
            }
            else
            {
                exp &= _.CreateTime.Between(start, end);
            }

            // 先精确查询,再模糊
            if (!key.IsNullOrEmpty())
            {
                var list = FindAll(exp & _.Action == key, p);
                if (list.Count > 0)
                {
                    return(list);
                }

                exp &= _.Action.Contains(key) | _.Remark.Contains(key);
            }

            return(FindAll(exp, p));
        }
Esempio n. 16
0
        public static IEnumerable <JobTask> Search(Int32 id, Int32 appid, Int32 jobid, JobStatus status, DateTime start, DateTime end, String client, String key, PageParameter p)
        {
            var exp = new WhereExpression();

            if (id > 0)
            {
                exp &= _.ID == id;
            }
            if (appid > 0)
            {
                exp &= _.AppID == appid;
            }
            if (jobid > 0)
            {
                exp &= _.JobID == jobid;
            }
            if (status >= JobStatus.就绪)
            {
                exp &= _.Status == status;
            }
            if (!client.IsNullOrEmpty())
            {
                exp &= _.Client == client;
            }
            if (!key.IsNullOrEmpty())
            {
                exp &= _.Data.Contains(key) | _.Message.Contains(key) | _.Key == key;
            }
            exp &= _.Start.Between(start, end);

            return(FindAll(exp, p));
        }
Esempio n. 17
0
 /// <summary>搜索用户,不包含团队</summary>
 /// <param name="key"></param>
 /// <param name="param"></param>
 /// <returns></returns>
 public static IList <User> SearchUser(String key, PageParameter param)
 {
     return(FindAll(_.IsTeam.IsTrue(false) & (_.Name.Contains(key) | _.Email.Contains(key)), param));
 }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = CostCenter.FunctionID;
 }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = Geography.FunctionID;
 }
Esempio n. 20
0
        /// <summary>高级查询</summary>
        /// <param name="provider"></param>
        /// <param name="userid"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="key"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static IList <UserConnect> Search(String provider, Int32 userid, DateTime start, DateTime end, String key, PageParameter p)
        {
            var exp = new WhereExpression();

            if (!provider.IsNullOrEmpty())
            {
                exp &= _.Provider == provider;
            }
            if (userid > 0)
            {
                exp &= _.UserID == userid;
            }
            exp &= _.UpdateTime.Between(start, end);
            if (!key.IsNullOrEmpty())
            {
                exp &= _.NickName.Contains(key) | _.OpenID.Contains(key);
            }

            return(FindAll(exp, p));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = UserMemberType.FUNCTIONID;
 }
Esempio n. 22
0
        /// <summary>高级查询</summary>
        /// <param name="server">地址。含端口</param>
        /// <param name="category">分类</param>
        /// <param name="enable">启用</param>
        /// <param name="start">更新时间开始</param>
        /// <param name="end">更新时间结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <RedisNode> Search(String server, String category, Boolean?enable, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (!server.IsNullOrEmpty())
            {
                exp &= _.Server == server;
            }
            if (!category.IsNullOrEmpty())
            {
                exp &= _.Category == category;
            }
            if (enable != null)
            {
                exp &= _.Enable == enable;
            }

            exp &= _.UpdateTime.Between(start, end);
            if (!key.IsNullOrEmpty())
            {
                exp &= _.Name.Contains(key) | _.Category.Contains(key) | _.Password.Contains(key) | _.Version.Contains(key) | _.Mode.Contains(key) | _.MemoryPolicy.Contains(key) | _.MemoryAllocator.Contains(key) | _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
            }

            return(FindAll(exp, page));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = Team.FUNCTIONID;
 }
Esempio n. 24
0
        /// <summary>高级查询</summary>
        /// <param name="teamId">团队</param>
        /// <param name="memberId">成员</param>
        /// <param name="enable">启用</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <TeamMember> Search(Int32 teamId, Int32 memberId, Boolean?enable, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (teamId >= 0)
            {
                exp &= _.TeamId == teamId;
            }
            if (memberId >= 0)
            {
                exp &= _.MemberId == memberId;
            }
            if (enable != null)
            {
                exp &= _.Enable == enable;
            }
            exp &= _.UpdateTime.Between(start, end);
            if (!key.IsNullOrEmpty())
            {
                exp &= _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
            }

            return(FindAll(exp, page));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = Fn.ToInt(ScrFunction.ChangePasswordMenuID);
 }
Esempio n. 26
0
        public ActionResult GetPageList(PageParameter param)
        {
            var result = service.GetList(param);

            return(PartialView("_PageList", result));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = JobStructure.FUNCTIONID;
 }
Esempio n. 28
0
        /// <summary>高级查询</summary>
        /// <param name="provinceId">省份</param>
        /// <param name="cityId">城市</param>
        /// <param name="category">类别</param>
        /// <param name="version">版本</param>
        /// <param name="enable"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="key"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static IList <Node> Search(Int32 provinceId, Int32 cityId, String category, String version, Boolean?enable, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (provinceId >= 0)
            {
                exp &= _.ProvinceID == provinceId;
            }
            if (cityId >= 0)
            {
                exp &= _.CityID == cityId;
            }
            if (!category.IsNullOrEmpty())
            {
                exp &= _.Category == category;
            }
            if (!version.IsNullOrEmpty())
            {
                exp &= _.Version == version;
            }
            if (enable != null)
            {
                exp &= _.Enable == enable.Value;
            }

            //exp &= _.CreateTime.Between(start, end);
            exp &= _.LastLogin.Between(start, end);

            if (!key.IsNullOrEmpty())
            {
                exp &= SearchWhereByKeys(key);
            }

            return(FindAll(exp, page));
        }
        // 以下为自定义高级查询的例子
        /// <summary>查询满足条件的记录集,分页、排序</summary>
        /// <param name="userid">用户编号</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="key">关键字</param>
        /// <param name="param">分页排序参数,同时返回满足条件的总记录数</param>
        /// <returns>实体集</returns>
        public static EntityList <DeviceRunningStatistics> Search(Int32 userid, DateTime start, DateTime end, String key, PageParameter param)
        {
            // WhereExpression重载&和|运算符,作为And和Or的替代
            // SearchWhereByKeys系列方法用于构建针对字符串字段的模糊搜索,第二个参数可指定要搜索的字段
            var exp = SearchWhereByKeys(key, null, null);

            // 以下仅为演示,Field(继承自FieldItem)重载了==、!=、>、<、>=、<=等运算符
            //if (userid > 0) exp &= _.OperatorID == userid;
            //if (isSign != null) exp &= _.IsSign == isSign.Value;
            //exp &= _.OccurTime.Between(start, end); // 大于等于start,小于end,当start/end大于MinValue时有效

            return(FindAll(exp, param));
        }
Esempio n. 30
0
        /// <summary>高级查询</summary>
        /// <param name="nodeId">节点</param>
        /// <param name="start">创建时间开始</param>
        /// <param name="end">创建时间结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <NodeData> Search(Int32 nodeId, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (nodeId >= 0)
            {
                exp &= _.NodeID == nodeId;
            }

            // 主键带有时间戳
            var flow = Meta.Factory.Snow;

            if (flow != null)
            {
                exp &= _.ID.Between(start, end, flow);
            }
            else
            {
                exp &= _.CreateTime.Between(start, end);
            }

            if (!key.IsNullOrEmpty())
            {
                exp &= _.Name.Contains(key) | _.Data.Contains(key) | _.Creator.Contains(key) | _.CreateIP.Contains(key);
            }

            return(FindAll(exp, page));
        }
Esempio n. 31
0
        /// <summary>根据类别搜索</summary>
        /// <param name="category"></param>
        /// <param name="enable"></param>
        /// <param name="key"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static IList <Node> SearchByCategory(String category, Boolean?enable, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (!category.IsNullOrEmpty())
            {
                exp &= _.Category == category | _.Category.IsNullOrEmpty();
            }

            if (enable != null)
            {
                exp &= _.Enable == enable.Value;
            }

            if (!key.IsNullOrEmpty())
            {
                exp &= SearchWhereByKeys(key);
            }

            return(FindAll(exp, page));
        }
Esempio n. 32
0
 public static IList <User> SearchByName(String name, PageParameter param)
 {
     return(FindAll(_.IsTeam.IsTrue(false) & _.Name.Contains(name), param));
 }
    //public override void InitializeEvents()
    //{
    //    PageBase page = (PageBase)this.Page;
    //    page.Load += new EventHandler(Page_Load);
    //}

    //protected void Page_Load(object sender, EventArgs e)
    //{
    //    if (!Page.IsPostBack)
    //    {
    //        //string redirectFunctionID = "2900000"; // home page
    //        //if (Fn.ToString(Session["redirect_func_id"]) != string.Empty)
    //        //{
    //        //    redirectFunctionID = Fn.ToString(Session["redirect_func_id"]);
    //        //}

    //        //string s = String.Format("sync(getTreeView().getChildren()[0],{0});", redirectFunctionID);
    //        //AttachClientEvent("syncTree", "window", "onload", s);
    //        //Session["redirect_func_id"] = null;

           

    //        TrvMenu.NodeBinding += new EventHandler<TreeNodeBindingEventArgs>(TrvMenu_NodeBinding);
    //        TrvMenu.BindData(GetMenuDatasource(), "FUNCTION_ID", "FUNCTION_PID", "SHOW_ORDER ASC", ScrFunction.RootID.ToString());
    //        TrvMenu.Target = "MainWindow";

           
    //    }
    //}

    //private void RenderMenuScript()
    //{
    //    ClientPopupMenu menu = new ClientPopupMenu("mLeft", "createMenu");

    //    if (CurrentUser.UseLanguage == Language.English)
    //    {
    //        menu.AddMenuItem("mAddToFav", "Add To Favorate", "addtoFavMenu", ResourceHelper.GetImageUrl(this.Page, "add.png"));
    //    }
    //    else
    //    {
    //        menu.AddMenuItem("mAddToFav", "¼ÓÈëÊÕ²Ø", "addtoFavMenu", ResourceHelper.GetImageUrl(this.Page, "add.png"));
    //    }

    //    menu.RenderScript(Page);
    //}

    //private void RenderFavorateMenuScript()
    //{
    //    ClientPopupMenu menu = new ClientPopupMenu("mFavorate", "createFavMenu");

    //    if (CurrentUser.UseLanguage == Language.English)
    //    {
    //        menu.AddMenuItem("mMoveFromFav", "Move From Favorate", "movefromFavMenu", ResourceHelper.GetImageUrl(this.Page, "delete.small.png"));
    //    }
    //    else
    //    {
    //        menu.AddMenuItem("mMoveFromFav", "ÒƳýÊÕ²Ø", "movefromFavMenu", ResourceHelper.GetImageUrl(this.Page, "delete.small.png"));
    //    }

    //    menu.RenderScript(Page);
    //}

    //void TrvMenu_NodeBinding(object sender, TreeNodeBindingEventArgs e)
    //{
    //    e.Node.Text = Fn.ToString(e.Row["function_name_" + _MultiLanguageSuffix]);
    //    string pageUrl = Fn.ToString(e.Row["page_url"]);
    //    if (pageUrl != string.Empty)
    //    {
    //        e.Node.NavigateUrl = "Navigate.aspx?FuncID=" + Fn.ToString(e.Row["function_id"]);
    //    }

    //    string target = Fn.ToString(e.Row["target"]);
    //    if (target != string.Empty) e.Node.Target = target;
    //}

    //private DataTable GetMenuDatasource()
    //{
    //    DataSet ds = RightHelper.GetUserMenuTree(CurrentUser.UserID, ScrFunction.GetRootMenuLineage());
    //    return ds.Tables[0];
    //}

    public override void SetPageInfo(ref PageParameter pageSetting)
    {
        pageSetting.FunctionID = 0;
    }
Esempio n. 34
0
        /// <summary>高级搜索</summary>
        /// <param name="userId"></param>
        /// <param name="category"></param>
        /// <param name="enable"></param>
        /// <param name="key"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static IList <Parameter> Search(Int32 userId, String category, Boolean?enable, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (userId >= 0)
            {
                exp &= _.UserID == userId;
            }
            if (!category.IsNullOrEmpty())
            {
                exp &= _.Category == category;
            }
            if (enable != null)
            {
                exp &= _.Enable == enable.Value;
            }
            if (!key.IsNullOrEmpty())
            {
                exp &= _.Name == key | _.Value.Contains(key);
            }

            return(FindAll(exp, page));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = JobStructure.ResponsibilityFuncID;
 }
Esempio n. 36
0
        /// <summary>高级查询</summary>
        /// <param name="tableId">模型表</param>
        /// <param name="name">名称</param>
        /// <param name="start">更新时间开始</param>
        /// <param name="end">更新时间结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <ModelColumn> Search(Int32 tableId, String name, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (tableId >= 0)
            {
                exp &= _.TableId == tableId;
            }
            if (!name.IsNullOrEmpty())
            {
                exp &= _.Name == name;
            }
            exp &= _.UpdateTime.Between(start, end);
            if (!key.IsNullOrEmpty())
            {
                exp &= _.DisplayName.Contains(key) | _.DataType.Contains(key) | _.ItemType.Contains(key) | _.Description.Contains(key) | _.Width.Contains(key) | _.CellText.Contains(key) | _.CellTitle.Contains(key) | _.CellUrl.Contains(key) | _.HeaderText.Contains(key) | _.HeaderTitle.Contains(key) | _.HeaderUrl.Contains(key) | _.DataAction.Contains(key) | _.DataSource.Contains(key) | _.CreateIP.Contains(key) | _.UpdateIP.Contains(key);
            }

            return(FindAll(exp, page));
        }
Esempio n. 37
0
        /// <summary>获取参数</summary>
        public void Init()
        {
            GetParam();

            if (Factory != null && Factory.Unique != null) Default = new PageParameter { Sort = Factory.Unique.Name };
        }
Esempio n. 38
0
        /// <summary>查询满足条件的记录集,分页、排序</summary>
        /// <param name="type">类型</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="key">关键字</param>
        /// <param name="param">分页排序参数,同时返回满足条件的总记录数</param>
        /// <returns>实体集</returns>
        public static IList <UserOnline> Search(String type, DateTime start, DateTime end, String key, PageParameter param)
        {
            var exp = new WhereExpression();

            //if (!type.IsNullOrEmpty()) exp &= _.Type == type;

            exp &= _.CreateTime.Between(start, end);

            if (!key.IsNullOrEmpty())
            {
                exp &= (_.Name.Contains(key) | _.InternalUri.Contains(key) | _.ExternalUri.Contains(key));
            }

            return(FindAll(exp, param));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = 20014450;
     return;
 }
Esempio n. 40
0
        /// <summary>高级搜索</summary>
        /// <param name="nodeId"></param>
        /// <param name="command"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="key"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static IList <NodeCommand> Search(Int32 nodeId, String command, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (nodeId > 0)
            {
                exp &= _.NodeID == nodeId;
            }
            if (!command.IsNullOrEmpty())
            {
                exp &= _.Command == command;
            }

            exp &= _.UpdateTime.Between(start, end);

            if (!key.IsNullOrEmpty())
            {
                exp &= _.Command == key;
            }

            return(FindAll(exp, page));
        }
Esempio n. 41
0
        /// <summary>查询指定产品的统计数据</summary>
        /// <param name="productId"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="key"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static IList <DeviceStat> Search(Int32 productId, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            exp &= _.StatDate.Between(start, end);
            if (productId >= 0)
            {
                exp &= _.ProductId == productId;
            }

            if (!key.IsNullOrEmpty())
            {
                exp &= _.Remark.Contains(key);
            }

            return(FindAll(exp, page));
        }
Esempio n. 42
0
        /// <summary>高级查询</summary>
        /// <param name="appId">应用</param>
        /// <param name="name">操作名。接口名或埋点名</param>
        /// <param name="kind">时间种类。day/hour/minute</param>
        /// <param name="minError">最小错误数。指定后,只返回错误数大于等于该值的数据</param>
        /// <param name="start">创建时间开始</param>
        /// <param name="end">创建时间结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <TraceData> Search(Int32 appId, String name, String kind, Int32 minError, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (appId >= 0)
            {
                exp &= _.AppId == appId;
            }
            if (!name.IsNullOrEmpty())
            {
                exp &= _.Name == name;
            }
            if (!key.IsNullOrEmpty())
            {
                exp &= _.ClientId == key | _.Name == key;
            }
            if (minError > 0)
            {
                exp &= _.Errors >= minError;
            }

            if (appId > 0 && start.Year > 2000)
            {
                var fi = kind switch
                {
                    "day" => _.StatDate,
                    "hour" => _.StatHour,
                    "minute" => _.StatMinute,
                    _ => _.StatDate,
                };

                if (start == end)
                {
                    exp &= fi == start;
                }
                else
                {
                    exp &= fi.Between(start, end);
                }
            }
            else
            {
                exp &= _.Id.Between(start, end, Meta.Factory.Snow);
            }

            using var split = Meta.CreateShard(start);

            return(FindAll(exp, page));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = RoleFunctionOperation.FunctionID;
 }
Esempio n. 44
0
        /// <summary>高级查询</summary>
        /// <param name="groupId">告警组</param>
        /// <param name="start">更新时间开始</param>
        /// <param name="end">更新时间结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <AlarmHistory> Search(Int32 groupId, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (groupId >= 0)
            {
                exp &= _.GroupId == groupId;
            }
            exp &= _.Id.Between(start, end, Meta.Factory.Snow);
            if (!key.IsNullOrEmpty())
            {
                exp &= _.Name.Contains(key) | _.Category.Contains(key) | _.Action.Contains(key) | _.Content.Contains(key) | _.Creator.Contains(key);
            }

            return(FindAll(exp, page));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
    // p.FunctionID = 5010370;
 }
Esempio n. 46
0
 /// <summary>高级查询</summary>
 /// <param name="key"></param>
 /// <param name="roleId"></param>
 /// <param name="isEnable"></param>
 /// <param name="p"></param>
 /// <returns></returns>
 public static IList <TEntity> Search(String key, Int32 roleId, Boolean?isEnable, PageParameter p) => Search(key, roleId, isEnable, DateTime.MinValue, DateTime.MinValue, p);
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = 2000000;
 }
Esempio n. 48
0
        /// <summary>高级查询</summary>
        /// <param name="key"></param>
        /// <param name="roleId"></param>
        /// <param name="isEnable"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static IList <TEntity> Search(String key, Int32 roleId, Boolean?isEnable, DateTime start, DateTime end, PageParameter p)
        {
            var exp = _.LastLogin.Between(start, end);

            if (roleId > 0)
            {
                exp &= _.RoleID == roleId | _.RoleIDs.Contains("," + roleId + ",");
            }
            if (isEnable != null)
            {
                exp &= _.Enable == isEnable;
            }

            // 先精确查询,再模糊
            if (!key.IsNullOrEmpty())
            {
                var list = FindAll(exp & (_.Code == key | _.Name == key | _.DisplayName == key | _.Mail == key | _.Mobile == key), p);
                if (list.Count > 0)
                {
                    return(list);
                }

                exp &= (_.Code.Contains(key) | _.Name.Contains(key) | _.DisplayName.Contains(key) | _.Mail.Contains(key) | _.Mobile.Contains(key));
            }

            return(FindAll(exp, p));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = FileFolder.FunctionID;
 }
Esempio n. 50
0
        /// <summary>高级查询</summary>
        /// <param name="category">分类</param>
        /// <param name="enable"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <AppTracer> Search(String category, Boolean?enable, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (!category.IsNullOrEmpty())
            {
                exp &= _.Category == category;
            }
            if (enable != null)
            {
                exp &= _.Enable == enable.Value;
            }

            exp &= _.UpdateTime.Between(start, end);

            if (!key.IsNullOrEmpty())
            {
                exp &= _.Name.Contains(key) | _.DisplayName.Contains(key) | _.Category.Contains(key) | _.CreateUser.Contains(key) | _.CreateIP.Contains(key) | _.UpdateUser.Contains(key) | _.UpdateIP.Contains(key);
            }

            return(FindAll(exp, page));
        }
 public override void SetPageInfo(ref PageParameter pageSetting)
 {
     return;
 }
Esempio n. 52
0
        /// <summary>查询满足条件的记录集,分页、排序</summary>
        /// <param name="nodeId">节点</param>
        /// <param name="provinceId">省份</param>
        /// <param name="cityId">城市</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页排序参数,同时返回满足条件的总记录数</param>
        /// <returns>实体集</returns>
        public static IList <NodeOnline> Search(Int32 nodeId, Int32 provinceId, Int32 cityId, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (nodeId >= 0)
            {
                exp &= _.NodeID == nodeId;
            }
            if (provinceId >= 0)
            {
                exp &= _.ProvinceID == provinceId;
            }
            if (cityId >= 0)
            {
                exp &= _.CityID == cityId;
            }

            exp &= _.CreateTime.Between(start, end);

            if (!key.IsNullOrEmpty())
            {
                exp &= (_.Name.Contains(key) | _.SessionID.Contains(key));
            }

            return(FindAll(exp, page));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
     p.FunctionID = RoleUser.FunctionID;
 }
Esempio n. 54
0
        public static EntityList <Repository> Search(Boolean showAll, IEnumerable <Int32> excludes = null, PageParameter param = null)
        {
            if (param == null)
            {
                param = new PageParameter {
                    PageSize = 20
                }
            }
            ;

            var exp = _.Enable == true;

            // 只显示共有
            if (!showAll)
            {
                exp &= _.IsPrivate == false;
            }
            if (excludes != null)
            {
                exp &= _.ID.NotIn(excludes);
            }

            return(FindAll(exp, param));
        }
 public override void SetPageInfo(ref PageParameter p)
 {
 }
Esempio n. 56
0
        /// <summary>高级查询</summary>
        /// <param name="appId">应用</param>
        /// <param name="name">名称</param>
        /// <param name="scope">作用域</param>
        /// <param name="start">更新时间开始</param>
        /// <param name="end">更新时间结束</param>
        /// <param name="key">关键字</param>
        /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
        /// <returns>实体列表</returns>
        public static IList <ConfigData> Search(Int32 appId, String name, String scope, DateTime start, DateTime end, String key, PageParameter page)
        {
            var exp = new WhereExpression();

            if (appId >= 0)
            {
                exp &= _.AppId == appId;
            }
            if (!name.IsNullOrEmpty())
            {
                exp &= _.Key == name;
            }
            if (!scope.IsNullOrEmpty())
            {
                exp &= _.Scope == scope;
            }
            exp &= _.UpdateTime.Between(start, end);
            if (!key.IsNullOrEmpty())
            {
                exp &= _.Value.Contains(key) | _.CreateIP.Contains(key) | _.UpdateIP.Contains(key) | _.Remark.Contains(key);
            }

            return(FindAll(exp, page));
        }