Exemple #1
0
        // GET: Contacts
        public async Task <IActionResult> Index()
        {
            //Clear the sort/filter/paging URL Cookie
            CookieHelper.CookieSet(HttpContext, "ContactsURL", "", -1);
            IQueryable <Contact> query = _context.Contacts
                                         .Include(c => c.Company)
                                         .Include(c => c.ContactCategories).ThenInclude(c => c.Categories)
                                         .OrderBy(c => c.FirstName)
                                         .ThenBy(c => c.LastName);

            _gridFilter.ParseQuery(HttpContext);
            ViewBag.gridFilter       = _gridFilter;
            ViewData["CategoriesID"] = GetCategoriesSelectList();

            await _gridFilter.GetFilteredData(query);

            int countFilter = _gridFilter.OuterFields.Count;

            if (countFilter > 2)
            {
                ViewData["ChangeColor"] = 1;
            }
            else
            {
                ViewData["ChangeColor"] = 0;
            }

            return(View(await _gridFilter.GetFilteredData(query)));
        }
        // GET: Employees
        public async Task <IActionResult> Index()
        {
            //Clear the sort/filter/paging URL Cookie
            CookieHelper.CookieSet(HttpContext, "EmployeesURL", "", -1);

            var query = _context.Employees
                        .Include(e => e.EmployeeCountry)
                        .Include(e => e.EmployeeProvince)
                        .Include(e => e.EmploymentType)
                        .Include(e => e.JobPosition);

            _gridFilter.ParseQuery(HttpContext);
            ViewBag.gridFilter           = _gridFilter;
            ViewData["EmploymentTypeID"] = GetEmploymentTypesSelectList();
            ViewData["JobPositionID"]    = GetPositionsSelectList();

            await _gridFilter.GetFilteredData(query);

            int countFilter = _gridFilter.OuterFields.Count;

            if (countFilter > 2)
            {
                ViewData["ChangeColor"] = 1;
            }
            else
            {
                ViewData["ChangeColor"] = 0;
            }

            return(View(await _gridFilter.GetFilteredData(query)));
        }
Exemple #3
0
        // GET: Companies
        public async Task <IActionResult> Index()
        {
            //Clear the sort/filter/paging URL Cookie
            CookieHelper.CookieSet(HttpContext, "CompaniesURL", "", -1);

            IQueryable <Company> query = _context.Companies
                                         .Include(c => c.BillingCountry)
                                         .Include(c => c.BillingProvince)
                                         .Include(c => c.BillingTerm)
                                         .Include(c => c.ShippingCountry)
                                         .Include(c => c.ShippingProvince)
                                         //.Include(c => c.VendorType)
                                         .Include(c => c.CompanyCustomers).ThenInclude(c => c.CustomerType)
                                         .Include(c => c.CompanyContractors).ThenInclude(c => c.ContractorType)
                                         .Include(c => c.CompanyVendors).ThenInclude(c => c.VendorType)
                                         .OrderBy(c => c.Name);

            _gridFilter.ParseQuery(HttpContext);
            ViewBag.gridFilter             = _gridFilter;
            ViewData["CountryID"]          = GetCountriesSelectList();
            ViewData["ProvinceID"]         = GetProvincesSelectList();
            ViewData["DuplicationCompany"] = GetSimillarCompanies(await _context.Companies.OrderBy(c => c.CompanyID).Take(20).ToListAsync());
            //string urlcheck = _gridFilter.GetFilteredData(query).Ur
            await _gridFilter.GetFilteredData(query);

            int countFilter = _gridFilter.OuterFields.Count;

            if (countFilter > 2)
            {
                ViewData["ChangeColor"] = 1;
            }
            else
            {
                ViewData["ChangeColor"] = 0;
            }
            return(View(await _gridFilter.GetFilteredData(query)));
        }