コード例 #1
0
        public GetOfertasResponse GetOfertas(DataTableRequest request)
        {
            var response = new GetOfertasResponse();

            try
            {
                var query    = FilterString(request.CustomFilters);
                var filtered = query.ApplyColumnSettings(request, OfertaMapper.GetPropertiePath);

                var ofertaIds       = filtered.Select(x => x.OfertaId).ToList();
                var totalCandidatos = new Dictionary <int, int>();
                foreach (var ofertaId in ofertaIds)
                {
                    var count = _candidaturaRepository.CountByCriteria(x => x.OfertaId == ofertaId);
                    totalCandidatos.Add(ofertaId, count);
                }



                response.OfertaViewModel = filtered.ConvertToOfertaRowViewModel(totalCandidatos);
                response.TotalElementos  = query.Count();

                response.IsValid = true;
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
コード例 #2
0
        public GetOfertasResponse GetOfertas(DataTableRequest request)
        {
            var ofertas  = new List <OfertaRowViewModel>();
            var response = new GetOfertasResponse()
            {
                IsValid         = true,
                OfertaViewModel = ofertas
            };

            for (var i = request.PageSize * request.PageNumber; (i < (request.PageSize * request.PageNumber + request.PageSize)) && (i <= TOTAL_ELEMENTS); i++)
            {
                ofertas.Add(new OfertaRowViewModel()
                {
                    OfertaId         = (int)i,
                    Nombre           = string.Format("Nombre {0}", i),
                    Candidatos       = (int)i,
                    Estado           = string.Format("Estado {0}", i),
                    FechaPublicacion = DateTime.Now.AddDays((double)i)
                });
            }

            response.TotalElementos = TOTAL_ELEMENTS;

            return(response);
        }
コード例 #3
0
        public GetOfertasResponse GetOfertas(DataTableRequest request)
        {
            var response = new GetOfertasResponse();

            try
            {
                //establecer los filtros
                var query    = FilterString(request.CustomFilters);
                var filtered = query.ApplyColumnSettings(request, CandidaturaOfertaMapper.GetPropertiePath);

                response.OfertaRowViewModel = filtered.ConvertToOfertaViewModel();
                response.TotalElementos     = query.Count();

                response.IsValid = true;
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }
            return(response);
        }