コード例 #1
0
        /// <summary>
        ///     系统功能分页查询
        /// </summary>
        /// <param name="model">输入查询参数对象</param>
        /// <returns></returns>
        /// <remarks>added by jimmy,2015-7-1</remarks>
        public ResultModel Select(SearchAC_FunctionModel model)
        {
            var     aC_Function = _database.Db.AC_Function;
            var     aC_Module   = _database.Db.AC_Module;
            dynamic am;
            var     whereParam = new SimpleExpression(1, 1, SimpleExpressionType.Equal);

            if (!string.IsNullOrEmpty(model.FunctionName))
            {
                whereParam = new SimpleExpression(whereParam, aC_Function.FunctionName.Like("%" + model.FunctionName + "%"), SimpleExpressionType.And);
            }
            if (model.ParentID != 0)
            {
                whereParam = new SimpleExpression(whereParam, aC_Function.ModuleID == model.ParentID || aC_Module.ParentID == model.ParentID, SimpleExpressionType.And);
            }

            var query = aC_Function.All().LeftJoin(aC_Module, out am).On(am.ModuleID == aC_Function.ModuleID).Select(
                aC_Function.FunctionID, aC_Function.FunctionName, aC_Function.Controller, aC_Function.Action, am.ModuleName)
                        .Where(whereParam).OrderBy(aC_Function.ModuleID);

            var result = new ResultModel
            {
                Data =
                    new SimpleDataPagedList <AC_FunctionModel>(query,
                                                               model.PagedIndex, model.PagedSize)
            };

            return(result);
        }
コード例 #2
0
        /// <summary>
        ///     查询系统功能
        /// </summary>
        /// <param name="model">搜索实体对象</param>
        /// <returns></returns>
        /// <remarks>added by jimmy,2015-7-3</remarks>
        public JsonResult List(SearchAC_FunctionModel model)
        {
            model.PagedSize = model.PagedSize == 0 ? 10 : model.PagedSize;
            var paramList =
                _aC_FunctionService.Select(new SearchAC_FunctionModel
            {
                PagedIndex   = model.PagedIndex,
                PagedSize    = model.PagedSize,
                FunctionName = model.FunctionName,
                ParentID     = model.ParentID
            });
            var data = new { rows = paramList.Data, total = paramList.Data.TotalCount };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }