Exemplo n.º 1
0
        public virtual Basket GetBasketBySessionId(string externalSessionId)
        {
            var basket =
                _repository.GetSingle(
                    x =>
                    x.ExternalCookieValue != null &&
                    x.ExternalCookieValue.Trim().Equals(externalSessionId.Trim(), StringComparison.CurrentCultureIgnoreCase));

            if (basket != null && (basket.BasketLines == null || basket.BasketLines.Count == 0))
            {
                basket.BasketLines = _lineRepository.GetList(x => x.BasketId == basket.Id);
            }

            return(basket);
        }
        public ApiResponse <IList <DTOReporteEstatico> > GetReporteEstatico(DTOReporteEstatico reporteEstatico)
        {
            ApiResponse <IList <DTOReporteEstatico> > apiResponse = new ApiResponse <IList <DTOReporteEstatico> >();

            try
            {
                IList <Derechohabiente> derechohabientes = _derechohabienteRepository.GetList(x => (reporteEstatico.IdEstado != null ? x.IdEstado == reporteEstatico.IdEstado : x.IdEstado == x.IdEstado) &&
                                                                                              (reporteEstatico.IdGenero != null ? x.IdGenero == reporteEstatico.IdGenero : x.IdGenero == x.IdGenero) &&
                                                                                              (reporteEstatico.RangoInferior != null ? (reporteEstatico.RangoInferior <= (DateTime.Now.Year - x.FechaNacimiento.Year)) : x.FechaNacimiento == x.FechaNacimiento) &&
                                                                                              (reporteEstatico.RangoInferior != null ? (reporteEstatico.RangoSuperior >= (DateTime.Now.Year - x.FechaNacimiento.Year)) : x.FechaNacimiento == x.FechaNacimiento));

                apiResponse.Data = (from encuesta in _encuestaRepository.GetList(x => x.FechaAplicacion >= reporteEstatico.FechaInicio.Date && x.FechaAplicacion.Date <= reporteEstatico.FechaFin.Date)
                                    join derechohabiente in derechohabientes on encuesta.IdDerechohabiente equals derechohabiente.IdDerechohabiente
                                    from tipoDestino in _tiposDestinoRepository.GetList(x => x.IdTipoDestino == encuesta.IdTipoDestino).Take(1).DefaultIfEmpty()
                                    from temporada in _temporadasRepository.GetList(x => x.IdTemporada == encuesta.IdTemporada).Take(1).DefaultIfEmpty()
                                    from viaje in _tiposViajeRepository.GetList(x => x.IdTipoViaje == encuesta.IdTipoViaje).Take(1).DefaultIfEmpty()
                                    from genero in _generoRepository.GetList(x => x.IdGenero == derechohabiente.IdGenero).Take(1).DefaultIfEmpty()
                                    from estado in _estadoRepository.GetList(x => x.IdEstado == derechohabiente.IdEstado).Take(1).DefaultIfEmpty()
                                    select new DTOReporteEstatico
                {
                    Destino = tipoDestino.Nombre,
                    TemporadaVacacional = temporada.Nombre,
                    Viaje = viaje.Nombre,
                    Genero = genero.Genero,
                    Edad = DateTime.Now.Year - derechohabiente.FechaNacimiento.Year,
                    Estado = estado.Nombre
                }).ToList();

                if (apiResponse.Data != null)
                {
                    apiResponse.Result  = (int)ApiResult.Success;
                    apiResponse.Message = Resources.ConsultaExitosa;
                }

                else
                {
                    apiResponse.Result  = (int)ApiResult.Failure;
                    apiResponse.Message = Resources.ConsultaFallida;
                }
            }
            catch (Exception ex)
            {
                apiResponse.Result  = (int)ApiResult.Exception;
                apiResponse.Message = ex.Message;
            }

            return(apiResponse);
        }
Exemplo n.º 3
0
        public virtual Basket GetLatestBasket()
        {
            var all       = _repository.GetList(x => !string.IsNullOrEmpty(x.ExternalCookieValue));
            var topBasket = all.OrderByDescending(x => x.DateCreated);

            return(topBasket.FirstOrDefault());
        }
 /// <summary>
 ///     Loads all categories from the database to the data collection
 /// </summary>
 public void Load()
 {
     Data.Clear();
     foreach (var category in dataAccess.GetList())
     {
         Data.Add(category);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        ///     Loads all accounts from the database to the data collection
        /// </summary>
        public void Load()
        {
            Data.Clear();

            foreach (var account in dataAccess.GetList())
            {
                Data.Add(account);
            }
        }
Exemplo n.º 6
0
        private void DeleteRecurringPaymentIfLastAssociated(PaymentViewModel item)
        {
            if (Data.All(x => x.RecurringPayment != item.RecurringPayment))
            {
                var recurringList = recurringDataAccess.GetList(x => x.Id == item.RecurringPayment.Id).ToList();

                foreach (var recTrans in recurringList)
                {
                    recurringDataAccess.Delete(recTrans);
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        ///     Loads all payments from the database to the data collection
        /// </summary>
        public void Load()
        {
            Data.Clear();
            var payments = dataAccess.GetList(null, payment => payment.ChargedAccount,
                                              payment => payment.Category,
                                              payment => payment.RecurringPayment);

            foreach (var payment in payments)
            {
                Data.Add(new PaymentViewModel(payment));
            }
        }
 public IList<ClientAsset> GetClientAssetsByClientID(int ClientID)
 {
     IList<ClientAsset> list = new List<ClientAsset>();
     try
     {
         list = _clientAssetRepository.GetList(p => p.ClientID == ClientID);
     }
     catch (Exception ex)
     {
         //bool false = BusinessLogicExceptionHandler.HandleException(ref ex);
         if (false)
         {
             throw ex;
         }
     }
     return list;
 }
        public ApiResponse <CatPaquetesTuristicos> GetPaqueteTuristicoPromocionado()
        {
            ApiResponse <CatPaquetesTuristicos> apiResponse = new ApiResponse <CatPaquetesTuristicos>();

            try
            {
                Random random = new Random();

                apiResponse.Data = _repository.GetList(x => x.Promocionado == true)
                                   .OrderBy(x => random.Next())
                                   .Take(1)
                                   .FirstOrDefault();

                if (apiResponse.Data != null)
                {
                    apiResponse.Result  = (int)ApiResult.Success;
                    apiResponse.Message = Resources.ConsultaExitosa;
                }

                else if (apiResponse.Data == null)
                {
                    apiResponse.Result  = (int)ApiResult.Initial;
                    apiResponse.Message = Resources.ConsultaSinResultados;
                }

                else
                {
                    apiResponse.Result  = (int)ApiResult.Failure;
                    apiResponse.Message = Resources.ConsultaFallida;
                }
            }
            catch (Exception ex)
            {
                apiResponse.Result  = (int)ApiResult.Exception;
                apiResponse.Message = ex.Message;
            }

            return(apiResponse);
        }
Exemplo n.º 10
0
 public List <MileStoneTaskType> GetMileStoneTaskTypeByMileStoneID(int MileStoneId)
 {
     return(_mileStoneTaskTypeRepository.GetList(c => c.MileStoneID == MileStoneId).ToList <MileStoneTaskType>());
 }
Exemplo n.º 11
0
 public override List <Book> Filter(Func <Book, bool> filter)
 {
     return((List <Book>)repository.GetList(filter));
 }
 public UserComment GetCommentListByCommentID_UserID(Int32 CommentID, Int32 UserID)
 {
     return(_usercommentRepository.GetList(p => p.CommentID == CommentID && p.UserID == UserID).FirstOrDefault());
 }
 public IList <Comment> GetCommentRecordsOnly(Int32 ID)
 {
     return(_commentRepository.GetList(p => p.ID == ID));
 }
 public List <ProjectWB> getProjectWBSListByProjectID(int projectID)
 {
     return(_projectWBS.GetList(d => d.ProjectID == projectID).ToList <ProjectWB>());
 }
 public IList <EcrOrderLineBarcode> GetOrderEcrBarcodes(int orderNumber)
 {
     return(_ecrBarcodeRepository.GetList(x => x.OrderNumber == orderNumber));
 }