public ActionResult AjaxPage(string query, int?page, Guid?cellarId, Guid?projectId)
        {
            SearchAdjustmentInput model = new SearchAdjustmentInput();

            model.Page      = page;
            model.Query     = query;
            model.UserId    = _currentUser.CurrentUserId;
            model.CellarId  = cellarId;
            model.ProjectId = projectId;
            model.User      = _adjustmentsService.GetUser(_currentUser.CurrentUserId);
            try
            {
                model.CompanyName      = _currentUser.CompanyName;
                model.Entities         = _adjustmentsService.SearchAdjustment(model);
                model.ErrorCode        = ErrorCodeHelper.Ok;
                model.ErrorDescription = "";
                model.Query            = "";
                model.Users            = _adjustmentsService.GetAllUsers(_currentUser.CompanyName);
                model.Cellars          = _adjustmentsService.GetAllCellars(_currentUser.CompanyName);
            }
            catch (Exception)
            {
                model.ErrorCode        = ErrorCodeHelper.Error;
                model.ErrorDescription = "Error al buscar las solicitudes";
            }
            return(PartialView("_adjustmentListPartial", model));
        }
        public ActionResult Index(int?page)
        {
            SearchAdjustmentInput model = new SearchAdjustmentInput();

            try
            {
                model.Query            = "";
                model.UserId           = _currentUser.CurrentUserId;
                model.CompanyName      = _currentUser.CompanyName;
                model.Entities         = _adjustmentsService.SearchAdjustment(model);
                model.Users            = _adjustmentsService.GetAllUsers(_currentUser.CompanyName);
                model.Cellars          = _adjustmentsService.GetAllCellars(_currentUser.CompanyName);
                model.User             = _adjustmentsService.GetUser(_currentUser.CurrentUserId);
                model.Control          = "Adjustments";
                model.Action           = "Search";
                model.ErrorCode        = ErrorCodeHelper.Ok;
                model.ErrorDescription = "";
            }
            catch (Exception e)
            {
                model.ErrorCode        = ErrorCodeHelper.Error;
                model.ErrorDescription = "Error al buscar los Artículos";
            }
            return(View(model));
        }
 public ViewResultBase Search(SearchAdjustmentInput model)
 {
     try
     {
         model.UserId      = _currentUser.CurrentUserId;
         model.CompanyName = _currentUser.CompanyName;
         var entities = _adjustmentsService.SearchAdjustment(model);
         model.Entities         = entities;
         model.Users            = _adjustmentsService.GetAllUsers(_currentUser.CompanyName);
         model.Cellars          = _adjustmentsService.GetAllCellars(_currentUser.CompanyName);
         model.User             = _adjustmentsService.GetUser(_currentUser.CurrentUserId);
         model.ErrorCode        = ErrorCodeHelper.Ok;
         model.ErrorDescription = "";
     }
     catch (Exception e)
     {
         model.ErrorCode        = ErrorCodeHelper.Error;
         model.ErrorDescription = "Error al buscar las Solicitudes";
     }
     if (Request.IsAjaxRequest())
     {
         return(PartialView("_adjustmentListPartial", model));
     }
     return(View("Index", model));
 }
예제 #4
0
        public IPagedList <AdjustmentDto> SearchAdjustment(SearchAdjustmentInput searchInput)
        {
            int currentPageIndex = searchInput.Page.HasValue ? searchInput.Page.Value - 1 : 0;
            var @entities        = _adjustmentManager.SearchRequests(searchInput.Query, searchInput.CellarId, searchInput.ProjectId, searchInput.UserId.Value, searchInput.CompanyName).ToList();

            return(@entities.MapTo <List <AdjustmentDto> >().ToPagedList(currentPageIndex, searchInput.MaxResultCount));
        }