Exemplo n.º 1
0
        public async Task <PagingOutput <Polyclinic> > GetAllAsync(int page, int pageSize,
                                                                   SortOprions sortOrder, string search)
        {
            var query = from _ in Context.Set <Polyclinic>()
                        orderby _.Id
                        select _;

            if (search != "")
            {
                query = from _ in Context.Set <Polyclinic>()
                        where _.Name.ToLower().Contains(search.ToLower())
                        orderby _.Id
                        select _;
            }

            switch (sortOrder)
            {
            case SortOprions.Name:
                query = query.OrderBy(x => x.Name);
                break;

            case SortOprions.Name_desc:
                query = query.OrderByDescending(x => x.Name);
                break;

            default:
                break;
            }

            return(await CommonRepositoryAsync.GetAllWithPageAsync(query, page, pageSize, _includeInfo));
        }
Exemplo n.º 2
0
        /// <summary>
        /// постраничное получение данных
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <param name="sort"></param>
        /// <param name="search"></param>
        /// <returns></returns>
        public async Task <PagingOutput <UserInfo> > GetAllAsync(int page, int pageSize, SortOprions sort, string search = "")
        {
            var query = from _ in Context.Set <UserInfo>()
                        where _.RoleInfoId == 1
                        orderby _.Id
                        select _;

            if (search != "")
            {
                query = from _ in Context.Set <UserInfo>()
                        where _.SurName.ToLower().Contains(search.ToLower()) ||
                        _.LastName.ToLower().Contains(search.ToLower()) ||
                        _.FirstName.ToLower().Contains(search.ToLower()) ||
                        _.PhoneNumber.ToLower().Contains(search.ToLower()) ||
                        _.Email.ToLower().Contains(search.ToLower())
                        orderby _.Id
                        select _;
            }

            switch (sort)
            {
            case SortOprions.Email:
                query = query.OrderBy(x => x.Email);
                break;

            case SortOprions.Email_desc:
                query = query.OrderByDescending(x => x.Email);
                break;

            case SortOprions.Name:
                query = query.OrderBy(x => x.FirstName);
                break;

            case SortOprions.Name_desc:
                query = query.OrderByDescending(x => x.FirstName);
                break;

            case SortOprions.Number:
                query = query.OrderBy(x => x.Id);
                break;

            case SortOprions.Number_desc:
                query = query.OrderByDescending(x => x.Id);
                break;

            case SortOprions.PhoneNumber:
                query = query.OrderBy(x => x.PhoneNumber);
                break;

            case SortOprions.PhoneNumber_desc:
                query = query.OrderByDescending(x => x.PhoneNumber);
                break;

            default:
                break;
            }

            return(await CommonRepositoryAsync.GetAllWithPageAsync(query, page, pageSize, _includeUserInfo));
        }
Exemplo n.º 3
0
        private async Task <PagingOutput <Schedule> > GetAllFilterAsync(IOrderedQueryable <Schedule> query, int page, int pageSize,
                                                                        SortOprions sort, string search = "")
        {
            if (search != "")
            {
                query = from _ in Context.Set <Schedule>()
                        where _.Personal.UserInfo.SurName.ToLower().Contains(search.ToLower()) ||
                        _.Personal.UserInfo.LastName.ToLower().Contains(search.ToLower()) ||
                        _.Personal.UserInfo.FirstName.ToLower().Contains(search.ToLower()) ||
                        _.Personal.UserInfo.PhoneNumber.ToLower().Contains(search.ToLower()) ||
                        _.Personal.UserInfo.Email.ToLower().Contains(search.ToLower()) ||
                        _.Personal.Polyclinic.Name.ToLower().Contains(search.ToLower()) ||
                        _.Personal.Position.Name.ToLower().Contains(search.ToLower()) ||
                        _.Personal.Polyclinic.Address.ToLower().Contains(search.ToLower())
                        orderby _.Id
                        select _;
            }

            switch (sort)
            {
            case SortOprions.Email:
                query = query.OrderBy(x => x.Personal.UserInfo.Email);
                break;

            case SortOprions.Email_desc:
                query = query.OrderByDescending(x => x.Personal.UserInfo.Email);
                break;

            case SortOprions.Name:
                query = query.OrderBy(x => x.Personal.UserInfo.FirstName);
                break;

            case SortOprions.Name_desc:
                query = query.OrderByDescending(x => x.Personal.UserInfo.FirstName);
                break;

            case SortOprions.Number:
                query = query.OrderBy(x => x.Id);
                break;

            case SortOprions.Number_desc:
                query = query.OrderByDescending(x => x.Id);
                break;

            case SortOprions.Position:
                query = query.OrderBy(x => x.Personal.Position.Name);
                break;

            case SortOprions.Position_desc:
                query = query.OrderByDescending(x => x.Personal.Position.Name);
                break;

            default:
                break;
            }

            return(await CommonRepositoryAsync.GetAllWithPageAsync(query, page, pageSize, _include));
        }
Exemplo n.º 4
0
        public async Task <PagingOutput <Schedule> > GetAllForPersonalAsync(int id)
        {
            var query = from _ in Context.Set <Schedule>()
                        where _.PersonalId == id
                        orderby _.Id
                        select _;

            return(await CommonRepositoryAsync.GetAllWithPageAsync(query, 1, 10, _include));
        }
Exemplo n.º 5
0
 /// <summary>
 /// получение данных по страницам
 /// </summary>
 /// <param name="page"></param>
 /// <param name="pageSize"></param>
 /// <returns></returns>
 public async Task <PagingOutput <T> > GetAllAsync(int page, int pageSize)
 {
     return(await CommonRepositoryAsync.GetAllWithPageAsync(_entities.OrderBy(s => s), page, pageSize));
 }