Example #1
0
        public ViewResultBase SearchDebounce(string query)
        {
            SearchContractorInput model = new SearchContractorInput();

            try
            {
                model.CompanyName      = _currentUser.CompanyName;
                model.Query            = query;
                model.Entities         = _contractorService.SearchContractor(model);
                model.Control          = "Contractor";
                model.Action           = "Search";
                model.ErrorCode        = ErrorCodeHelper.Ok;
                model.ErrorDescription = "";
            }
            catch (Exception e)
            {
                model.ErrorCode        = ErrorCodeHelper.Error;
                model.ErrorDescription = "Error al buscar los Transportistas";
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_contractorListPartial", model));
            }
            return(View("Index", model));
        }
Example #2
0
        public IPagedList <ContractorDto> SearchContractor(SearchContractorInput searchInput)
        {
            int currentPageIndex = searchInput.Page.HasValue ? searchInput.Page.Value - 1 : 0;

            if (searchInput.Query == null)
            {
                searchInput.Query = "";
            }
            else
            {
                searchInput.Query = searchInput.Query.ToLower();
            }

            var @entities = _contractorRepository.GetAll();

            @entities = @entities.Where(c => c.IsDeleted != null && c.CompanyName.Equals(searchInput.CompanyName) && c.IsDeleted.Value == false && (c.CompleteName.ToLower().Contains(searchInput.Query) || c.CompleteName.ToLower().Equals(searchInput.Query)));

            return(@entities.OrderByDescending(p => p.CompleteName).MapTo <List <ContractorDto> >().ToPagedList(currentPageIndex, searchInput.MaxResultCount));
        }
Example #3
0
        public ActionResult AjaxPage(string query, int?page)
        {
            SearchContractorInput model = new SearchContractorInput();

            model.Page  = page;
            model.Query = query;

            try
            {
                model.CompanyName      = _currentUser.CompanyName;
                model.Entities         = _contractorService.SearchContractor(model);
                model.ErrorCode        = ErrorCodeHelper.Ok;
                model.ErrorDescription = "";
            }
            catch (Exception)
            {
                model.ErrorCode        = ErrorCodeHelper.Error;
                model.ErrorDescription = "Error al buscar los Transportistas";
            }
            return(PartialView("_contractorListPartial", model));
        }
Example #4
0
        public ActionResult Index(int?page)
        {
            SearchContractorInput model = new SearchContractorInput();

            try
            {
                model.Query            = "";
                model.CompanyName      = _currentUser.CompanyName;
                model.Entities         = _contractorService.SearchContractor(model);
                model.Control          = "Contractor";
                model.Action           = "Search";
                model.ErrorCode        = ErrorCodeHelper.Ok;
                model.ErrorDescription = "";
            }
            catch (Exception e)
            {
                model.ErrorCode        = ErrorCodeHelper.Error;
                model.ErrorDescription = "Error al buscar los Transportistas";
            }
            return(View(model));
        }
Example #5
0
        public ViewResultBase Search(SearchContractorInput model)
        {
            try
            {
                model.CompanyName = _currentUser.CompanyName;
                var entities = _contractorService.SearchContractor(model);
                model.Entities         = entities;
                model.ErrorCode        = ErrorCodeHelper.Ok;
                model.ErrorDescription = "";
            }
            catch (Exception e)
            {
                model.ErrorCode        = ErrorCodeHelper.Error;
                model.ErrorDescription = "Error al buscar los Transportistas";
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_contractorListPartial", model));
            }

            return(View("Index", model));
        }