Beispiel #1
0
        public PageResult <LoginListResp> GetLoginPageList(PagedSearch request, Guid merchantId)
        {
            var strSql = $@"SELECT	
	L.LoginId,
	Login,
	L.Name,
	Tele,
	L.Editor,
	L.EditTime,
	L.Status,
	SR.Name AS RoleName
FROM 
	SysLogin L WITH (nolock)
LEFT JOIN
	dbo.SysLoginRole LR WITH (NOLOCK) ON L.LoginID = LR.LoginID
LEFT JOIN
	dbo.SysRole SR WITH (nolock) ON LR.RoleID = SR.RoleID"    ;


            var where = new SearchCondition();

            where.AddCondition("L.MerchantID", merchantId, SqlOperator.Equal, true);
            //where.AddSqlCondition("L.Login like '%' + @key + '%'",
            //    true,
            //    new SugarParameter("key", "a"));

            //where.AddCondition("L.status",1,SqlOperator.Equal,true);

            return(this.SelectListPage <LoginListResp>(strSql, where, request.Page, request.PageSize, "EditTime desc"));
        }
Beispiel #2
0
        public ActionResult GroupList(PagedSearch model)
        {
            PagedData <GroupModel> groups = null;

            if (this.Me.GroupSort != GroupSort.Super)
            {
                groups = this.permissionQuery.GetPageGroup(model, this.Me.DepartmentId);
            }
            else
            {
                groups = this.permissionQuery.GetPageGroup(model);
            }

            if (groups == null)
            {
                groups = new PagedData <GroupModel>();
            }

            var grid = new JsonGridModel()
            {
                TotalCount = groups.TotalCount,
                PageNow    = groups.PageNow,
                PageSize   = groups.PageSize,
                Records    = groups.Records
            };

            return(this.Json(ApiStatus.Success, grid));
        }
Beispiel #3
0
        public IActionResult Search([FromQuery] PagedSearch search)
        {
            ApiResult <PagedData <DivisionResp> > searchResult = _divisionService.Search(search);
            IEnumerable <CityResponse.City>       cities       = _cityService.Find(x => ((long)x.id).IsIn(searchResult.Result.Records.Select(o => o.CityId)));

            return(Ok(new
            {
                searchResult.Result.PageNow,
                searchResult.Result.PageSize,
                searchResult.Result.TotalCount,
                Records = searchResult.Result.Records.Select(x =>
                {
                    CityResponse.City city = cities.FirstOrDefault(c => c.id == x.CityId);
                    return new
                    {
                        x.Name,
                        x.CityId,
                        x.DivisionId,
                        x.CreateTime,
                        x.TotalMember,
                        City = city
                    };
                })
            }));
        }
        public IActionResult Search([FromQuery] PagedSearch search)
        {
            ApiResult <PagedData <WizardResp> > wizards = _wizardService.Search(new SearchWizardReqs()
            {
                PageSize = search.PageSize,
                PageNow  = search.PageNow,
                IsAdmin  = true
            });

            ApiResult <IEnumerable <DivisionResp> > divisions = _divisionService.GetByIds(wizards.Result.Records.Select(x => x.DivisionId).Distinct().ToArray());
            IEnumerable <CityResponse.City>         cities    = _cityService.Find(x => ((long)x.id).IsIn(divisions.Result.Select(o => o.CityId).Distinct()));

            return(Ok(new
            {
                wizards.Result.PageNow,
                wizards.Result.PageSize,
                wizards.Result.TotalCount,
                Records = wizards.Result.Records.Select(x =>
                {
                    DivisionResp division = divisions.Result.FirstOrDefault(o => o.DivisionId == x.DivisionId);
                    CityResponse.City city = cities.FirstOrDefault(c => c.id == division.CityId);
                    return new
                    {
                        x.WizardId,
                        x.DivisionId,
                        City = city?.nm,
                        x.Account,
                        x.Email,
                        x.CreateTime,
                    };
                })
            }));
        }
 public PagedResponse(IQueryable <T2> query, PagedSearch search, IMapper mapper)
 {
     TotalCount   = query.Count();
     CurrentPage  = search.Page;
     ItemsPerPage = search.PerPage;
     Items        = mapper.Map <IEnumerable <T1> >(
         query
         .Skip(search.Skip())
         .Take(search.PerPage)
         .ToList()
         );
 }
Beispiel #6
0
        public PageResult <RoleListResp> GetRolePageList(PagedSearch request, Guid merchantId)
        {
            var strSql = $@"SELECT 
	RoleId,
	Name, 
	Editor,
	EditTime,
	Status
FROM sysrole WITH (nolock)
WHERE merchantid = '{merchantId}'";

            return(this.SelectListPage <RoleListResp>(strSql, request.Page, request.PageSize, "EditTime", true));
        }
Beispiel #7
0
        public static PagedResponse <TDto> Paged <TDto, TSource>
            (this IQueryable <TSource> query, PagedSearch search, IMapper mapper) where TDto : class
        {
            var skip = (search.Page - 1) * search.PerPage;

            return(new PagedResponse <TDto>()
            {
                TotalCount = query.Count(),
                ItemsPerPage = search.PerPage,
                CurrentPage = search.Page,
                Items = mapper.Map <IEnumerable <TDto> >(query.Skip(skip).Take(search.PerPage).ToList())
            });
        }
Beispiel #8
0
        public static PagedResponse <TDto> Paged <TDto, TEntity>(
            this IQueryable <TEntity> query, PagedSearch search, IMapper mapper)
            where TDto : class
        {
            var skipCount = search.PerPage * (search.Page - 1);

            var skipped = query.Skip(skipCount).Take(search.PerPage);

            var response = new PagedResponse <TDto>
            {
                CurrentPage  = search.Page,
                ItemsPerPage = search.PerPage,
                TotalCount   = query.Count(),
                Items        = mapper.Map <IEnumerable <TDto> >(skipped)
            };

            return(response);
        }
Beispiel #9
0
        public ActionResult DepartmentList(PagedSearch model)
        {
            var departments = this.permissionQuery.GetPageDeparement(model);

            if (departments == null)
            {
                departments = new PagedData <DepartmentModel>();
            }

            var grid = new JsonGridModel()
            {
                TotalCount = departments.TotalCount,
                PageNow    = departments.PageNow,
                PageSize   = departments.PageSize,
                Records    = departments.Records
            };

            return(this.Json(ApiStatus.Success, grid));
        }
        public PagedData <GroupModel> GetPageGroup(PagedSearch scout)
        {
            var para = new
            {
                StartIndex = scout.StartIndex,
                EndIndex   = scout.EndIndex,
                PageSize   = scout.PageSize,
                PageNow    = scout.PageNow,
            };

            var totalCount = this.daoBuilder.Build().ToEasyXmlDao(para).QueryForObject <int>("qryGroupRootCount");

            if (totalCount <= 0)
            {
                return(new PagedData <GroupModel>(scout.PageNow, scout.PageSize, 0, new GroupModel[0]));
            }

            return(new PagedData <GroupModel>(scout.PageNow, scout.PageSize, totalCount, this.daoBuilder.Build().ToEasyXmlDao(para).QueryForEnumerable <GroupModel>("qry_GroupRoot")));
        }
        public PagedData <EmployeeModel> GetPageEmployee(PagedSearch scout, string departmentId)
        {
            var para = new
            {
                StartIndex   = scout.StartIndex,
                EndIndex     = scout.EndIndex,
                PageSize     = scout.PageSize,
                PageNow      = scout.PageNow,
                DepartmentId = departmentId.ToNullableParameter(),
            };

            var totalCount = this.daoBuilder.Build().ToEasyXmlDao(para).QueryForObject <int>("qryEmployeeRootCount");

            if (totalCount <= 0)
            {
                return(new PagedData <EmployeeModel>(scout.PageNow, scout.PageSize, 0, new EmployeeModel[0]));
            }

            return(new PagedData <EmployeeModel>(scout.PageNow, scout.PageSize, totalCount, this.daoBuilder.Build().ToEasyXmlDao(para).QueryForEnumerable <EmployeeModel>("qry_EmployeeRoot")));
        }
Beispiel #12
0
        public override void Execute()
        {
            var pageSearch = new PagedSearch();

            int pageIndex = 1;

            while (1 == 1)
            {
                var result = _jurisdictionService.GetLoginPageList(pageSearch, base.MerchantId);

                if (result == null || result.DataList == null || result.DataList.Count == 0)
                {
                    break;
                }

                base.List = result.DataList;

                base.Execute();

                pageSearch.Page = pageSearch.Page + 1;
            }
        }
Beispiel #13
0
        public ActionResult DepartmentList()
        {
            var model = new PagedSearch();

            return(this.View(model));
        }
Beispiel #14
0
        public ActionResult EmployeeList(PagedSearch model)
        {
            PagedData <EmployeeModel> employees = null;

            if (this.Me.GroupSort != GroupSort.Super)
            {
                employees = this.permissionQuery.GetPageEmployee(model, this.Me.DepartmentId);
            }
            else
            {
                employees = this.permissionQuery.GetPageEmployee(model);
            }

            if (employees == null)
            {
                employees = new PagedData <EmployeeModel>();
            }

            var alldepartments = this.permissionQuery.GetAllDepartment();

            if (alldepartments != null)
            {
                if (employees.Records != null)
                {
                    foreach (var i in employees.Records)
                    {
                        if (i.GroupSort == GroupSort.Super)
                        {
                            if (i.AggregateId != this.Me.AggregateId)
                            {
                                i.Id           = -1;
                                i.AggregateId  = "";
                                i.UserName     = "******";
                                i.NickName     = "地球很危险";
                                i.DepartmentId = "神秘部门";
                            }
                        }
                        else
                        {
                            i.DepartmentId = alldepartments.Any(t => t.AggregateId == i.DepartmentId) ? alldepartments.First(t => t.AggregateId == i.DepartmentId).Name : "未知部门";
                        }
                    }
                }
            }
            else if (employees.Records != null)
            {
                foreach (var i in employees.Records)
                {
                    if (i.GroupSort == GroupSort.Super)
                    {
                        if (i.AggregateId != this.Me.AggregateId)
                        {
                            i.Id           = -1;
                            i.AggregateId  = "";
                            i.UserName     = "******";
                            i.NickName     = "地球很危险";
                            i.DepartmentId = "神秘部门";
                        }
                    }
                    else
                    {
                        i.DepartmentId = alldepartments.Any(t => t.AggregateId == i.DepartmentId) ? alldepartments.First(t => t.AggregateId == i.DepartmentId).Name : "未知部门";
                    }
                }
            }

            var grid = new JsonGridModel()
            {
                TotalCount = employees.TotalCount,
                PageNow    = employees.PageNow,
                PageSize   = employees.PageSize,
                Records    = employees.Records
            };

            return(this.Json(ApiStatus.Success, grid));
        }
 public PageResult <RoleListResp> GetRolePageList(PagedSearch request)
 {
     return(_jurisdictionService.GetRolePageList(request, CurrentLogin.MerchantId));
 }
 /// <summary>
 /// 查询用户标识的所有任务
 /// </summary>
 /// <param name="commandType">命令类型</param>
 /// <param name="userSign">用户标识</param>
 /// <param name="statusArray">状态</param>
 /// <param name="paged">分页查询</param>
 /// <returns></returns>
 public virtual TaskschedNode[] GetList(PagedSearch paged, string userSign, string commandType, TaskschedStatus[] statusArray)
 {
     return(this.GetAll(userSign, commandType, statusArray));
 }
 /// <summary>
 /// 查询用户标识的所有任务
 /// </summary>
 /// <param name="commandType">命令类型</param>
 /// <param name="statusArray">状态</param>
 /// <param name="paged">分页查询</param>
 /// <returns></returns>
 public virtual TaskschedNode[] GetList(PagedSearch paged, TaskschedStatus[] statusArray, string commandType)
 {
     return(this.GetAll(statusArray, commandType));
 }
 public PageResult <DistrictManagerListResp> GetDistrictManagerPageList(PagedSearch <DistrictManagerSearchRequest> request)
 {
     return(_districtManagerService.GetDistrictManagerPageList(request, CurrentUser.MerchantID));
 }
Beispiel #19
0
 public static List <T> FormatForPagedResponse <T>(this IQueryable <T> query, PagedSearch search)
 {
     return(query.Skip(search.PerPage * (search.Page - 1)).Take(search.PerPage).ToList());
 }
Beispiel #20
0
        public ActionResult GroupList()
        {
            var model = new PagedSearch();

            return(this.View(model));
        }
Beispiel #21
0
        public static IQueryable <TDto> DefaultFilter <TDto>(this IQueryable <TDto> query, PagedSearch search) where TDto : BaseEntity
        {
            if (search.IsActive != null)
            {
                query = query.Where(x => x.IsActive == search.IsActive);
            }

            return(query);
        }
Beispiel #22
0
 public PageResult <RoleListResp> GetRolePageList(PagedSearch request, Guid merchantId)
 {
     return(_sysRoleRepository.GetRolePageList(request, merchantId));
 }
Beispiel #23
0
 public PageResult <LoginListResp> GetLoginPageList(PagedSearch request, Guid merchantId)
 {
     return(_sysLoginRepository.GetLoginPageList(request, merchantId));
 }
 public PageResult <DistrictManagerInResp> GetDistrictManagerInPageList(PagedSearch <DistrictManagerInDependOnIdSearchRequest> request)
 {
     return(_districtManagerService.GetDistrictManagerInPageList(request));
 }
Beispiel #25
0
        public ApiResult <PagedData <DivisionResp> > Search(PagedSearch search)
        {
            PagedData <DivisionInfo> result = _divisionQueryService.QueryPaged(search);

            return(new ApiResult <PagedData <DivisionResp> >(ResultStatus.SUCCESS, Mapper.Map <PagedData <DivisionInfo>, PagedData <DivisionResp> >(result)));
        }
 /// <summary>
 /// 查询用户标识的所有任务
 /// </summary>
 /// <param name="statusArray">状态</param>
 /// <param name="paged">分页查询</param>
 /// <returns></returns>
 public virtual TaskschedNode[] GetList(PagedSearch paged, TaskschedStatus[] statusArray)
 {
     return(this.GetAll(statusArray));
 }
Beispiel #27
0
        public static PagedResponse <T> GeneratePagedResponse <T>(this List <T> items, PagedSearch search, IQueryable <EntityBase> query) where T : class
        {
            var skipCount = search.PerPage * (search.Page - 1);

            return(new PagedResponse <T>
            {
                CurrentPage = search.Page,
                ItemsPerPage = search.PerPage,
                Total = query.Count(),
                Items = items
            });
        }
 public PageResult <DistrictManagerInResp> GetCustomersInDistrictManagerPageList(PagedSearch <Guid> request)
 {
     return(_districtManagerService.GetDistrictManagerInPageList(request, CurrentUser.CustomerID.Value));
 }