Exemplo n.º 1
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Documents/Index/OnGetAsync{currentFilter},{searchString},{pageIndex})");

            CurrentSort      = sortOrder;
            NameSort         = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            DocumentDataSort = sortOrder == "DocumentData" ? "documentdata_desc" : "DocumentData";
            LastUpdateSort   = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Document> documentIQ = from d in _context.Document
                                               select d;

            if (!String.IsNullOrEmpty(searchString))
            {
                documentIQ = documentIQ.Where(doc => doc.Name.Contains(searchString, StringComparison.CurrentCulture));
            }
            switch (sortOrder)
            {
            case "name_desc":
                documentIQ = documentIQ.OrderByDescending(d => d.Name);
                break;

            case "DocumentData":
                documentIQ = documentIQ.OrderBy(d => d.DocumentData);
                break;

            case "documentdata_desc":
                documentIQ = documentIQ.OrderByDescending(d => d.DocumentData);
                break;

            case "LastUpdate":
                documentIQ = documentIQ.OrderBy(d => d.LastUpdate);
                break;

            case "lastupdate_desc":
                documentIQ = documentIQ.OrderByDescending(d => d.LastUpdate);
                break;

            default:
                documentIQ = documentIQ.OrderBy(d => d.Name);
                break;
            }

            int pageSize = 10;

            Document = await PaginatedCollection <Document> .CreateAsync(
                documentIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 2
0
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Functions/Index/OnGetAsync({sortOrder}, {currentFilter}, {searchString}, {pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            PrioritySort   = sortOrder == "Priority" ? "priority_desc" : "Priority";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <WorkFunction> functionIQ = from f in _context.WorkFunction
                                                   select f;

            if (!String.IsNullOrEmpty(searchString))
            {
                functionIQ = functionIQ.Where(fun => fun.Name.Contains(searchString, StringComparison.CurrentCulture));
            }
            switch (sortOrder)
            {
            case "name_desc":
                functionIQ = functionIQ.OrderByDescending(f => f.Name);
                break;

            case "Priority":
                functionIQ = functionIQ.OrderBy(f => f.Priority);
                break;

            case "priority_desc":
                functionIQ = functionIQ.OrderByDescending(f => f.Priority);
                break;

            case "LastUpdate":
                functionIQ = functionIQ.OrderBy(f => f.LastUpdate);
                break;

            case "lastupdate_desc":
                functionIQ = functionIQ.OrderByDescending(f => f.LastUpdate);
                break;

            default:
                functionIQ = functionIQ.OrderBy(f => f.Name);
                break;
            }

            int pageSize = 10;

            WorkFunction = await PaginatedCollection <WorkFunction> .CreateAsync(
                functionIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <returns>The get async.</returns>
        /// <param name="sortOrder">Sort order.</param>
        /// <param name="currentFilter">Current filter.</param>
        /// <param name="searchString">Search string.</param>
        /// <param name="pageIndex">Page index.</param>
        public async Task OnGetAsync(string sortOrder, string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"ChipCardProfile/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort   = sortOrder;
            NumberSort    = String.IsNullOrEmpty(sortOrder) ? "number_desc" : "";
            DateSort      = sortOrder == "Date" ? "date_desc" : "Date";
            CurrentFilter = searchString;

            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <ChipCardProfile> chipCardProfileIQ = from c in _context.ChipCardProfile
                                                             select c;

            if (!String.IsNullOrEmpty(searchString))
            {
                chipCardProfileIQ = chipCardProfileIQ.Where(cp => cp.Number.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "number_desc":
                chipCardProfileIQ = chipCardProfileIQ.OrderByDescending(cp => cp.Number);
                break;

            case "Date":
                chipCardProfileIQ = chipCardProfileIQ.OrderBy(cp => cp.LastUpdate);
                break;

            case "date_desc":
                chipCardProfileIQ = chipCardProfileIQ.OrderByDescending(cp => cp.LastUpdate);
                break;

            default:
                chipCardProfileIQ = chipCardProfileIQ.OrderBy(cp => cp.Number);
                break;
            }

            int pageSize = 10;

            ChipCardProfile = await PaginatedCollection <ChipCardProfile> .CreateAsync(
                chipCardProfileIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"SystemData/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <SystemData> systemdataIQ = from s in _context.SystemData
                                                   select s;

            if (!String.IsNullOrEmpty(searchString))
            {
                systemdataIQ = systemdataIQ.Where(sys => sys.Name.Contains(searchString, StringComparison.CurrentCulture));
            }
            switch (sortOrder)
            {
            case "name_desc":
                systemdataIQ = systemdataIQ.OrderByDescending(p => p.Name);
                break;

            case "LastUpdate":
                systemdataIQ = systemdataIQ.OrderBy(p => p.LastUpdate);
                break;

            case "lastupdate_desc":
                systemdataIQ = systemdataIQ.OrderByDescending(p => p.LastUpdate);
                break;

            default:
                systemdataIQ = systemdataIQ.OrderBy(p => p.Name);
                break;
            }

            int pageSize = 10;

            SystemData = await PaginatedCollection <SystemData> .CreateAsync(
                systemdataIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);

            ;
        }
Exemplo n.º 5
0
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"ZipCodes/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            CodeSort       = String.IsNullOrEmpty(sortOrder) ? "code_desc" : "";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <ZipCode> zipcodeIQ = from z in _context.ZipCode
                                             select z;

            if (!String.IsNullOrEmpty(searchString))
            {
                zipcodeIQ = zipcodeIQ.Where(zip => zip.Code.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "code_desc":
                zipcodeIQ = zipcodeIQ.OrderByDescending(z => z.Code);
                break;

            case "LastUpdate":
                zipcodeIQ = zipcodeIQ.OrderBy(z => z.LastUpdate);
                break;

            case "lastupdate_desc":
                zipcodeIQ = zipcodeIQ.OrderByDescending(z => z.LastUpdate);
                break;

            default:
                zipcodeIQ = zipcodeIQ.OrderBy(z => z.Code);
                break;
            }

            int pageSize = 10;

            ZipCode = await PaginatedCollection <ZipCode> .CreateAsync(
                zipcodeIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Computers/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ActiveSort     = sortOrder == "Active" ? "active_desc" : "Active";
            ReplaceSort    = sortOrder == "Replace" ? "replace_desc" : "Replace";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_sort" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Computer> computerIQ = from c in _context.Computer
                                               select c;

            if (!String.IsNullOrEmpty(searchString))
            {
                computerIQ = computerIQ.Where(comp => comp.ComputerID.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "name_desc":
                computerIQ = computerIQ.OrderByDescending(c => c.ComputerID);
                break;

            case "Active":
                computerIQ = computerIQ.OrderBy(c => c.IsActive);
                break;

            case "active_desc":
                computerIQ = computerIQ.OrderByDescending(c => c.IsActive);
                break;

            case "Replace":
                computerIQ = computerIQ.OrderBy(c => c.ShouldReplace);
                break;

            case "replace_desc":
                computerIQ = computerIQ.OrderByDescending(c => c.ShouldReplace);
                break;

            case "LastUpdate":
                computerIQ = computerIQ.OrderBy(c => c.LastUpdate);
                break;

            case "lastupdate_desc":
                computerIQ = computerIQ.OrderByDescending(c => c.LastUpdate);
                break;

            default:
                computerIQ = computerIQ.OrderBy(c => c.ComputerID);
                break;
            }

            int pageSize = 10;

            Computer = await PaginatedCollection <Computer> .CreateAsync(
                computerIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Processors/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ClockRateSort  = sortOrder == "ClockRate" ? "clockrate_desc" : "ClockRate";
            CoresSort      = sortOrder == "Core" ? "core_desc" : "Core";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Processor> processorIQ = from p in _context.Processor
                                                 select p;

            if (!String.IsNullOrEmpty(searchString))
            {
                processorIQ = processorIQ.Where(p => p.Name.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "name_desc":
                processorIQ = processorIQ.OrderByDescending(p => p.Name);
                break;

            case "ClockRate":
                processorIQ = processorIQ.OrderBy(p => p.ClockRate);
                break;

            case "clockrate_desc":
                processorIQ = processorIQ.OrderByDescending(p => p.ClockRate);
                break;

            case "Core":
                processorIQ = processorIQ.OrderBy(p => p.Cores);
                break;

            case "core_desc":
                processorIQ = processorIQ.OrderByDescending(p => p.Cores);
                break;

            case "LastUpdate":
                processorIQ = processorIQ.OrderBy(p => p.LastUpdate);
                break;

            case "lastupdate_desc":
                processorIQ = processorIQ.OrderByDescending(p => p.LastUpdate);
                break;

            default:
                processorIQ = processorIQ.OrderBy(p => p.Name);
                break;
            }

            int pageSize = 10;

            Processor = await PaginatedCollection <Processor> .CreateAsync(
                processorIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 8
0
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Fax/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NumberSort     = String.IsNullOrEmpty(sortOrder) ? "number_desc" : "";
            ActiveSort     = sortOrder == "Active" ? "active_desc" : "Active";
            ReplaceSort    = sortOrder == "Replace" ? "replace_desc" : "Replace";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Fax> faxIQ = from f in _context.Fax
                                     select f;

            if (!String.IsNullOrEmpty(searchString))
            {
                faxIQ = faxIQ.Where(fax => fax.Number.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "number_desc":
                faxIQ = faxIQ.OrderByDescending(f => f.Number);
                break;

            case "Active":
                faxIQ = faxIQ.OrderBy(f => f.Active);
                break;

            case "active_desc":
                faxIQ = faxIQ.OrderByDescending(f => f.Active);
                break;

            case "Replace":
                faxIQ = faxIQ.OrderBy(f => f.Replace);
                break;

            case "replace_desc":
                faxIQ = faxIQ.OrderByDescending(f => f.Replace);
                break;

            case "LastUpdate":
                faxIQ = faxIQ.OrderBy(f => f.LastUpdate);
                break;

            case "lastupdate_desc":
                faxIQ = faxIQ.OrderByDescending(f => f.LastUpdate);
                break;

            default:
                faxIQ = faxIQ.OrderBy(d => d.Number);
                break;
            }

            int pageSize = 10;

            Fax = await PaginatedCollection <Fax> .CreateAsync(
                faxIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"JobTitles/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            FromDateSort   = sortOrder == "FromDate" ? "fromdate_desc" : "FromDate";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <JobTitle> jobTitleIQ = from j in _context.JobTitle
                                               select j;

            if (!String.IsNullOrEmpty(searchString))
            {
                jobTitleIQ = jobTitleIQ.Where(job => job.Name.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "name_desc":
                jobTitleIQ = jobTitleIQ.OrderByDescending(j => j.Name);
                break;

            case "FromDate":
                jobTitleIQ = jobTitleIQ.OrderBy(j => j.FromDate);
                break;

            case "fromdate_desc":
                jobTitleIQ = jobTitleIQ.OrderByDescending(j => j.FromDate);
                break;

            case "LastUpdate":
                jobTitleIQ = jobTitleIQ.OrderBy(d => d.LastUpdate);
                break;

            case "lastupdate_desc":
                jobTitleIQ = jobTitleIQ.OrderByDescending(d => d.LastUpdate);
                break;

            default:
                jobTitleIQ = jobTitleIQ.OrderBy(d => d.Name);
                break;
            }

            int pageSize = 10;

            JobTitle = await PaginatedCollection <JobTitle> .CreateAsync(
                jobTitleIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Inventories/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort     = sortOrder;
            IdentifierSort  = String.IsNullOrEmpty(sortOrder) ? "identifier_desc" : "";
            DescriptionSort = sortOrder == "Description" ? "description_desc" : "Description";
            ActiveSort      = sortOrder == "Active" ? "active_desc" : "Active";
            LastUpdateSort  = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Inventory> inventoryIQ = from i in _context.Inventory
                                                 select i;

            if (!String.IsNullOrEmpty(searchString))
            {
                inventoryIQ = inventoryIQ.Where(inv => inv.Identifier.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "identifier_desc":
                inventoryIQ = inventoryIQ.OrderByDescending(i => i.Identifier);
                break;

            case "Description":
                inventoryIQ = inventoryIQ.OrderBy(i => i.Description);
                break;

            case "description_desc":
                inventoryIQ = inventoryIQ.OrderByDescending(i => i.Description);
                break;

            case "Active":
                inventoryIQ = inventoryIQ.OrderBy(i => i.Active);
                break;

            case "active_desc":
                inventoryIQ = inventoryIQ.OrderByDescending(i => i.Active);
                break;

            case "LastUpdate":
                inventoryIQ = inventoryIQ.OrderBy(i => i.LastUpdate);
                break;

            case "lastupdate_desc":
                inventoryIQ = inventoryIQ.OrderByDescending(i => i.LastUpdate);
                break;

            default:
                inventoryIQ = inventoryIQ.OrderBy(i => i.Identifier);
                break;
            }

            int pageSize = 10;

            Inventory = await PaginatedCollection <Inventory> .CreateAsync(
                inventoryIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Employees/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort       = sortOrder;
            NameSort          = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            EmployeeIdentSort = sortOrder == "EmployeeIdent" ? "employeeident_desc" : "EmployeeIdent";
            GenderSort        = sortOrder == "Gender" ? "gender_desc" : "Gender";
            BirthDaySort      = sortOrder == "BirthDay" ? "birthday_desc" : "BirthDay";
            DataCareSort      = sortOrder == "DataCare" ? "datacare_desc" : "DataCare";
            ActiveSort        = sortOrder == "Active" ? "active_desc" : "Active";
            HireDateSort      = sortOrder == "HireDate" ? "hiredate_desc" : "HireDate";
            EndDateSort       = sortOrder == "EndDate" ? "enddate_desc" : "EndDate";
            LastUpdateSort    = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Employee> employeeIQ = from e in _context.Employee
                                               .Include(e => e.Department)
                                               select e;

            if (!String.IsNullOrEmpty(searchString))
            {
                employeeIQ = employeeIQ.Where(e => e.LastName.Contains(searchString, StringComparison.CurrentCulture));
            }
            switch (sortOrder)
            {
            case "name_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.LastName);
                break;

            case "EmployeeIdent":
                employeeIQ = employeeIQ.OrderBy(e => e.EmployeeIdent);
                break;

            case "employeeident_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.EmployeeIdent);
                break;

            case "Gender":
                employeeIQ = employeeIQ.OrderBy(e => e.Gender);
                break;

            case "gender_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.Gender);
                break;

            case "BirthDay":
                employeeIQ = employeeIQ.OrderBy(e => e.BirthDay);
                break;

            case "birthday_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.BirthDay);
                break;

            case "DataCare":
                employeeIQ = employeeIQ.OrderBy(e => e.DataCare);
                break;

            case "datacare_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.DataCare);
                break;

            case "Active":
                employeeIQ = employeeIQ.OrderBy(e => e.IsActive);
                break;

            case "active_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.IsActive);
                break;

            case "HireDate":
                employeeIQ = employeeIQ.OrderBy(e => e.HireDate);
                break;

            case "hiredate_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.HireDate);
                break;

            case "EndDate":
                employeeIQ = employeeIQ.OrderBy(e => e.EndDate);
                break;

            case "enddate_desc":
                employeeIQ = employeeIQ.OrderByDescending(e => e.EndDate);
                break;

            case "LastUpdate":
                employeeIQ = employeeIQ.OrderBy(d => d.LastUpdate);
                break;

            case "lastupdate_desc":
                employeeIQ = employeeIQ.OrderByDescending(d => d.LastUpdate);
                break;

            default:
                employeeIQ = employeeIQ.OrderBy(d => d.LastName);
                break;
            }

            int pageSize = 10;

            Employee = await PaginatedCollection <Employee> .CreateAsync(
                employeeIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Manufacturers/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            SupportSort    = sortOrder == "Supporter" ? "supporter_desc" : "Supporter";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Manufacturer> manufacturerIQ = from m in _context.Manufacturer
                                                       select m;

            if (!String.IsNullOrEmpty(searchString))
            {
                manufacturerIQ = manufacturerIQ.Where(man => man.Name.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "name_desc":
                manufacturerIQ = manufacturerIQ.OrderByDescending(d => d.Name);
                break;

            case "Supporter":
                manufacturerIQ = manufacturerIQ.OrderBy(m => m.Supporter);
                break;

            case "supporter_desc":
                manufacturerIQ = manufacturerIQ.OrderByDescending(m => m.Supporter);
                break;

            case "LastUpdate":
                manufacturerIQ = manufacturerIQ.OrderBy(d => d.LastUpdate);
                break;

            case "lastupdate_desc":
                manufacturerIQ = manufacturerIQ.OrderByDescending(d => d.LastUpdate);
                break;

            default:
                manufacturerIQ = manufacturerIQ.OrderBy(d => d.Name);
                break;
            }

            int pageSize = 10;

            Manufacturer = await PaginatedCollection <Manufacturer> .CreateAsync(
                manufacturerIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"Places/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            RoomSort       = sortOrder == "Room" ? "room_desc" : "Room";
            DeskSort       = sortOrder == "Desk" ? "desk_desc" : "Desk";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <Place> placeIQ = from p in _context.Place
                                         select p;

            if (!String.IsNullOrEmpty(searchString))
            {
                placeIQ = placeIQ.Where(pl => pl.Name.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "name_desc":
                placeIQ = placeIQ.OrderByDescending(p => p.Name);
                break;

            case "Room":
                placeIQ = placeIQ.OrderBy(p => p.Room);
                break;

            case "room_desc":
                placeIQ = placeIQ.OrderByDescending(p => p.Room);
                break;

            case "Desk":
                placeIQ = placeIQ.OrderBy(p => p.Desk);
                break;

            case "desk_desc":
                break;

            case "LastUpdate":
                placeIQ = placeIQ.OrderBy(p => p.LastUpdate);
                break;

            case "lastupdate_desc":
                placeIQ = placeIQ.OrderByDescending(p => p.LastUpdate);
                break;

            default:
                placeIQ = placeIQ.OrderBy(p => p.Name);
                break;
            }

            int pageSize = 10;

            Place = await PaginatedCollection <Place> .CreateAsync(
                placeIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }