Ejemplo n.º 1
0
        /// <summary>
        /// 实现对用户角色的绑定
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAllUserRoleInfo()
        {
            //首先获取从前台传递过来的参数
            int pageIndex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int pageSize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);

            //获取从前台传递过来的需要多条件模糊查询的数据
            string roleName = Request["RoleName"];
            string roleType = Request["RoleType"];

            //定义对象,得到所有的参数
            GetModelQuery roleInfo = new GetModelQuery();

            roleInfo.pageIndex = pageIndex;
            roleInfo.pageSize  = pageSize;
            roleInfo.total     = 0;
            roleInfo.RoleName  = roleName;
            roleInfo.RoleType  = roleType;

            //获取所有的总数输入
            var data = from n in _roleService.LoadRoleInfo(roleInfo)
                       select new { n.ID, n.DelFlag, n.RoleName, n.RoleType, n.SubTime };
            //var data = _roleService.List(pageSize, pageIndex, out total, c => true, true, d => d.id);
            var value      = data.ToList();
            var jsonResult = new { total = roleInfo.total, rows = value };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到用户的所有信息
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAllUserInfos()
        {
            //json数据:{total:"",row:""}
            //
            //分页的数据
            //

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


            ////SearchName,SearchMail
            string searchName = Request["SearchName"];
            string searchMail = Request["SearchMail"];

            //封装一个业务逻辑层,来处理分页过滤的事件
            GetModelQuery userInfoQuery = new GetModelQuery();

            userInfoQuery.pageIndex = pageIndex;
            userInfoQuery.pageSize  = pageSize;
            userInfoQuery.Name      = searchName;
            userInfoQuery.Mail      = searchMail;
            userInfoQuery.total     = 0;

            //放置依赖刷新
            var data = from u in _userInfoService.LoadSearchData(userInfoQuery)
                       select new { u.ID, u.UName, u.Phone, u.Pwd, u.Mail, u.LastModifiedOn, u.SubTime };

            //var data = _userInfoService.LoadPagerEntities(pageSize, pageIndex, out total, u => true, true, u => u.ID);

            var result = new { total = userInfoQuery.total, rows = data };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public IActionResult Model(Guid id)
        {
            var query = new GetModelQuery(id);
            var model = _queryProcessor.Process(query);

            return(View(model));
        }
Ejemplo n.º 4
0
 /// <summary>Enumerates execute in this collection.</summary>
 /// <param name="query">The query.</param>
 /// <returns>An enumerator that allows foreach to be used to process execute in this collection.</returns>
 public IQueryable <ModelPerformanceModel> Execute(GetModelQuery query)
 {
     return(this.PerformanceDbContext
            .ModelPerformanceEntitySet
            .Join(this.PerformanceDbContext.ModelPerformanceReturnEntitySet
                  .Where(
                      a => a.PerformanceImportID.Equals(
                          this.PerformanceDbContext.ModelPerformanceReturnEntitySet
                          .Where(j => j.ModelPerformanceID == a.ModelPerformanceID)
                          .OrderByDescending(c => c.PerformanceImportID)
                          .Select(x => x.PerformanceImportID).FirstOrDefault()
                          )
                      ),
                  a => a.ModelPerformanceID,
                  b => b.ModelPerformanceID,
                  (a, b) => new { a, b })
            .Join(this.PerformanceDbContext.PerformanceImportEntitySet.Where(pi => pi.StatusTypeEv.Equals(2)),
                  pr => pr.b.PerformanceImportID,
                  i => i.PerformanceImportID, (pr, i)
                  => new ModelPerformanceModel
     {
         ModelPerformanceID = pr.a.ModelPerformanceID,
         Code = pr.a.Code,
         Name = pr.a.Name,
         HistoricalInceptionDate = pr.a.HistoricalInceptionDate,
         AssetMarkInceptionDate = pr.a.AssetMarkInceptionDate,
         InitialCompositeDate = pr.a.InitialCompositeDate,
         ModifiedBy = pr.a.ModifiedBy,
         ModifiedDate = pr.a.ModifiedDate,
         CreatedBy = pr.a.CreatedBy,
         CreatedDate = pr.a.CreatedDate,
     }
                  ).Distinct().AsQueryable());
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取权限的所有的信息
        /// </summary>
        /// <returns></returns>
        public ActionResult GetActionUserInfoShow()
        {
            //首先获取前台传递过来的参数
            int pageIndex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int pageSize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);

            //获取前台传递过来的数据实现进行模糊查询
            string SearchActionName      = Request["SearchActionName"];
            string SearchRequestHttpType = Request["SearchRequestHttpType"];

            //定义对象,得到所有的参数值
            GetModelQuery actionInfo = new GetModelQuery();

            actionInfo.ActionName      = SearchActionName;
            actionInfo.pageIndex       = pageIndex;
            actionInfo.pageSize        = pageSize;
            actionInfo.RequestHttpType = SearchRequestHttpType;
            actionInfo.total           = 0;

            //调用方法,实现绑定所有的数据
            var data = from c in _actioninfoService.LoadDataActionInfo(actionInfo)
                       select new { c.ID, c.ActionName, c.ActionType, c.RequestUrl, c.RequestHttpType, c.SubTime };
            //var data = _actioninfoService.LoadPagerEntities(pageSize, pageIndex, out total, c => true, true, e => e.ID);
            //获取前台需要的数据
            var jsonResult = new { total = actionInfo.total, rows = data };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        public async Task <ActionResult <GetModelDto> > GetMake([FromRoute] GetModelQuery query)
        {
            var model = await this.Mediator.Send(query);

            this.logger.LogInformation("Getting item {ID}", query.Id);

            if (model == null)
            {
                this.logger.LogWarning("Cannot find Make object with corresponding id: {0}", query.Id);
                return(NotFound(query));
            }

            return(Ok(model));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 加载用户模糊查询的数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public IQueryable <AdminInfo> LoadSearchData(GetModelQuery query)
        {
            //拿到所有的数据
            var temp = DbSession.AdminInfoRepository.Get(u => true);

            //进行过滤姓名
            if (!string.IsNullOrEmpty(query.Name))
            {
                temp = temp.Where <AdminInfo>(u => u.UName.Contains(query.Name));
            }
            //进行邮箱的过滤
            if (!string.IsNullOrEmpty(query.Mail))
            {
                temp = temp.Where <AdminInfo>(u => u.Mail.Contains(query.Mail));
            }
            //返回总数
            query.total = temp.Count();

            //做分页查询
            return(temp.Skip(query.pageSize * (query.pageIndex - 1)).Take(query.pageSize).AsQueryable());
        }
Ejemplo n.º 8
0
        public IQueryable <ActionGroup> LoadEntityActionGroup(GetModelQuery actionGroup)
        {
            //首先读取到所有的数据
            var temp = DbSession.ActionGroupRepository.Get(c => true);

            //根据菜单组名称进行过滤
            if (!string.IsNullOrEmpty(actionGroup.GroupName))
            {
                temp = temp.Where <ActionGroup>(c => c.GroupName.Contains(actionGroup.GroupName));
            }
            //根据菜单组类型进行过滤
            if (actionGroup.GroupType != "-1" && !string.IsNullOrEmpty(actionGroup.GroupType))
            {
                temp = temp.Where <ActionGroup>(c => c.GroupType.Equals(Convert.ToInt16(actionGroup.GroupType)));
            }
            //得到菜单组的总数
            actionGroup.total = temp.Count();

            //进行分页查询信息
            return(temp.Skip <ActionGroup>(actionGroup.pageSize * (actionGroup.pageIndex - 1)).Take(actionGroup.pageSize));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 读取用户所有的权限组的信息显示在前台
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAllActionGroupInfo()
        {
            int    pageIndex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pageSize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            string GroupName = Request["SearchActionName"];
            string GroupType = Request["SearchActionType"];

            GetModelQuery actionGroupInfo = new GetModelQuery();

            actionGroupInfo.pageIndex = pageIndex;
            actionGroupInfo.pageSize  = pageSize;
            actionGroupInfo.total     = 0;
            actionGroupInfo.GroupName = GroupName;
            actionGroupInfo.GroupType = GroupType;

            // var data = _actiongroupService.LoadPagerEntities(pageSize, pageIndex, out total, c => true, true, c => c.ID);
            var data = from x in _actiongroupService.LoadEntityActionGroup(actionGroupInfo)
                       select new { x.ID, x.DelFlag, x.GroupName, x.GroupType };
            var postJson = new { total = actionGroupInfo.total, rows = data };

            return(Json(postJson, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 实现对数据的模糊查询
        /// </summary>
        /// <param name="actionInfo"></param>
        /// <returns></returns>
        public IQueryable <ActionInfo> LoadDataActionInfo(GetModelQuery actionInfo)
        {
            //首先拿到所有的数据
            var temp = _dbSession.ActionInfoRepository.LoadEntities(u => true);

            //然后进行权限名称过滤
            if (!string.IsNullOrEmpty(actionInfo.ActionName))
            {
                temp = temp.Where <ActionInfo>(c => c.ActionName.Contains(actionInfo.ActionName));
            }

            //然后进行请求方式的过滤
            if (!string.IsNullOrEmpty(actionInfo.RequestHttpType))
            {
                temp = temp.Where <ActionInfo>(c => c.RequestHttpType.Contains(actionInfo.RequestHttpType));
            }

            //返回总数
            actionInfo.total = temp.Count();

            //最后实现分页
            return(temp.Skip <ActionInfo>(actionInfo.pageSize * (actionInfo.pageIndex - 1)).Take <ActionInfo>(actionInfo.pageSize).AsQueryable());
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 实现对查询的数据进行分组
        /// </summary>
        /// <param name="roleInfo"></param>
        /// <returns></returns>
        public IQueryable <Role> LoadRoleInfo(GetModelQuery roleInfo)
        {
            //首先查询出所有的数据
            var temp = _dbSession.RoleRepository.LoadEntities(c => true);

            //判断角色名称
            if (!string.IsNullOrEmpty(roleInfo.RoleName))
            {
                temp = temp.Where <Role>(c => c.RoleName.Contains(roleInfo.RoleName));
            }

            //判断角色名称是否赋值
            if (roleInfo.RoleType != "-1" && !string.IsNullOrEmpty(roleInfo.RoleType))
            {
                temp = temp.Where <Role>(c => c.RoleType.Equals(Convert.ToInt16(roleInfo.RoleType)));
            }

            //获取总数total
            roleInfo.total = temp.Count();

            //获取总数返回
            return(temp.Skip <Role>(roleInfo.pageSize * (roleInfo.pageIndex - 1)).Take(roleInfo.pageSize));
        }
Ejemplo n.º 12
0
 public Model Handle(GetModelQuery query)
 {
     return(_modelRepository.GetById(query.ModelId));
 }