Beispiel #1
0
        /// <summary>
        /// Obtiene el responde Bien de una entidad Bien
        /// </summary>
        /// <param name="objEnt">Objeti entidad</param>
        /// <returns>Entidad Response de objeto Bien</returns>
        public static BienResponse ObtenerBienResponseDeEntity(BienEntity objEnt)
        {
            BienResponse rpta = new BienResponse();

            rpta.CodigoBien           = objEnt.CodigoBien.ToString();
            rpta.CodigoTipoBien       = objEnt.CodigoTipoBien;
            rpta.CodigoIdentificacion = objEnt.CodigoIdentificacion;
            rpta.NumeroSerie          = objEnt.NumeroSerie;
            rpta.Descripcion          = objEnt.Descripcion;
            rpta.Marca                 = objEnt.Marca;
            rpta.Modelo                = objEnt.Modelo;
            rpta.FechaAdquisicion      = objEnt.FechaAdquisicion.ToString(DatosConstantes.Formato.FormatoFecha);
            rpta.TiempoVida            = objEnt.TiempoVida;
            rpta.TiempoVidaString      = objEnt.TiempoVida.ToString(DatosConstantes.Formato.FormatoNumeroDecimal);
            rpta.ValorResidual         = objEnt.ValorResidual;
            rpta.ValorResidualString   = objEnt.ValorResidual.ToString(DatosConstantes.Formato.FormatoNumeroDecimal);
            rpta.CodigoTipoTarifa      = objEnt.CodigoTipoTarifa;
            rpta.CodigoPeriodoAlquiler = objEnt.CodigoPeriodoAlquiler;
            rpta.ValorAlquiler         = objEnt.ValorAlquiler;
            rpta.ValorAlquilerString   = objEnt.ValorAlquiler.HasValue ? objEnt.ValorAlquiler.Value.ToString(DatosConstantes.Formato.FormatoNumeroDecimal) : null;
            rpta.CodigoMoneda          = objEnt.CodigoMoneda;
            rpta.MesInicioAlquiler     = objEnt.MesInicioAlquiler;
            rpta.AnioInicioAlquiler    = objEnt.AnioInicioAlquiler;
            return(rpta);
        }
Beispiel #2
0
        /// <summary>
        /// Realiza la adaptación de campos para la búsqueda
        /// </summary>
        /// <param name="bienLogic">Entidad Lógica Bien</param>
        /// <returns>Clase Bien Response con los datos de búsqueda</returns>
        public static BienResponse ObtenerDescripcionCompletaBien(BienLogic bienLogic, List <BienAlquilerResponse> listaAlquiler, List <CodigoValorResponse> listaPeriodoAlquilerBien)
        {
            var bienResponse = new BienResponse();

            bienResponse.CodigoBien           = bienLogic.CodigoBien.ToString();
            bienResponse.CodigoIdentificacion = bienLogic.CodigoIdentificacion;
            bienResponse.NumeroSerie          = bienLogic.NumeroSerie;
            bienResponse.Descripcion          = bienLogic.Descripcion;
            bienResponse.Marca        = bienLogic.Marca;
            bienResponse.Modelo       = bienLogic.Modelo;
            bienResponse.CodigoMoneda = bienLogic.CodigoMoneda;
            if (bienLogic.FechaAdquisicion != null)
            {
                bienResponse.FechaAdquisicion = Convert.ToDateTime(bienLogic.FechaAdquisicion).ToString(DatosConstantes.Formato.FormatoFecha);
            }
            bienResponse.MesInicioAlquiler            = bienLogic.MesInicioAlquiler;
            bienResponse.AnioInicioAlquiler           = bienLogic.AnioInicioAlquiler;
            bienResponse.DescripcionMesInicioAlquiler = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(int.Parse(bienResponse.MesInicioAlquiler.ToString())));

            if (listaAlquiler != null && listaAlquiler.Count > 0)
            {
                bienResponse.ValorAlquilerString = string.Empty;
                decimal limiteInferiorActual = 0.01M;

                var alquilerSinLimite = listaAlquiler.Where(item => item.IndicadorSinLimite).FirstOrDefault();

                var periodoAlquilerBien = listaPeriodoAlquilerBien.Where(itemWhere => itemWhere.Codigo.ToString() == bienLogic.CodigoPeriodoAlquiler).FirstOrDefault().Valor;

                foreach (var item in listaAlquiler.Where(item => !item.IndicadorSinLimite).ToList())
                {
                    bienResponse.ValorAlquilerString += limiteInferiorActual + " - " + item.CantidadLimiteString + " " + periodoAlquilerBien + " " + bienLogic.CodigoMoneda + " " + item.MontoString + "<br></br>";
                    limiteInferiorActual              = Convert.ToDecimal(item.CantidadLimite) + 0.01M;
                }
            }
            else
            {
                bienResponse.ValorAlquilerString = bienLogic.ValorAlquiler.HasValue ? bienLogic.ValorAlquiler.Value.ToString(DatosConstantes.Formato.FormatoNumeroDecimal) : null;
            }
            bienResponse.DescripcionCompleta = bienLogic.CodigoIdentificacion + " - " + bienLogic.NumeroSerie + " - " + bienLogic.Descripcion + " - " + bienLogic.Marca + " - " + bienLogic.Modelo + " - " + bienResponse.FechaAdquisicion + " - " + bienResponse.DescripcionMesInicioAlquiler + " " + bienResponse.AnioInicioAlquiler;

            return(bienResponse);
        }
Beispiel #3
0
        /// <summary>
        /// Método que retorna la Lista de Bienes
        /// </summary>
        /// <param name="filtro">objeto request del tipo Bien</param>
        /// <returns>Lista de Bienes</returns>
        public ProcessResult <List <BienResponse> > ListarBienes(BienRequest filtro, List <CodigoValorResponse> plstTipoBien = null,
                                                                 List <CodigoValorResponse> plstTipoTarifa = null,
                                                                 List <CodigoValorResponse> plstMoneda     = null,
                                                                 List <CodigoValorResponse> plstPeriodoAlq = null)
        {
            ProcessResult <List <BienResponse> > rpta = new ProcessResult <List <BienResponse> >();
            List <CodigoValorResponse>           listaTipoBien;
            List <CodigoValorResponse>           listaTipoTarifa;
            List <CodigoValorResponse>           listaPeriodoAlq;
            List <CodigoValorResponse>           listaMoneda;
            BienResponse itemrpta;

            try
            {
                if (plstTipoBien != null)
                {
                    listaTipoBien = plstTipoBien;
                }
                else
                {
                    listaTipoBien = politicaService.ListaTipoBien().Result;
                }
                if (plstTipoTarifa != null)
                {
                    listaTipoTarifa = plstTipoTarifa;
                }
                else
                {
                    listaTipoTarifa = politicaService.ListaTipoTarifaBien().Result;
                }
                if (plstPeriodoAlq != null)
                {
                    listaPeriodoAlq = plstPeriodoAlq;
                }
                else
                {
                    listaPeriodoAlq = politicaService.ListaPeriodoAlquilerBien().Result;
                }
                if (plstMoneda != null)
                {
                    listaMoneda = plstMoneda;
                }
                else
                {
                    listaMoneda = politicaService.ListarMoneda().Result;
                }

                var listaBien = bienLogicRepository.ListaBandejaBien(filtro.CodigoIdentificacion, filtro.CodigoTipoBien, filtro.NumeroSerie, filtro.Descripcion,
                                                                     filtro.Marca, filtro.Modelo, filtro.FechaInicio, filtro.FechaFin, filtro.CodigoTipoTarifa);

                rpta.Result = new List <BienResponse>();
                foreach (BienLogic itemLogic in listaBien)
                {
                    itemrpta = new BienResponse();
                    itemrpta = BienAdapter.ObtenerBienResponseDeLogic(itemLogic, listaTipoBien, listaTipoTarifa, listaMoneda, listaPeriodoAlq);
                    rpta.Result.Add(itemrpta);
                }
            }
            catch (Exception ex)
            {
                rpta.IsSuccess = false;
                rpta.Exception = new ApplicationLayerException <BienService>(ex);
            }

            return(rpta);
        }
Beispiel #4
0
        /// <summary>
        /// Obtiene la entidad response de una entidad Logic
        /// </summary>
        /// <param name="objLogic">objeto logic</param>
        /// <param name="lstTipoBien">lista con los tipos de bien</param>
        /// <param name="lstTipoTarifa">lista tipos de tarifa</param>
        /// <param name="lstMoneda">listas de moneda</param>
        /// <returns>Entidad Response de entidad Logic</returns>
        public static BienResponse ObtenerBienResponseDeLogic(BienLogic objLogic, List <CodigoValorResponse> lstTipoBien = null,
                                                              List <CodigoValorResponse> lstTipoTarifa = null,
                                                              List <CodigoValorResponse> lstMoneda     = null,
                                                              List <CodigoValorResponse> lstPeriodoAl  = null)
        {
            int          li_index = -1;
            BienResponse objRpta  = new BienResponse();

            objRpta.CodigoBien           = objLogic.CodigoBien.ToString();
            objRpta.CodigoTipoBien       = objLogic.CodigoTipoBien;
            objRpta.CodigoIdentificacion = objLogic.CodigoIdentificacion;
            objRpta.NumeroSerie          = objLogic.NumeroSerie;
            objRpta.Descripcion          = objLogic.Descripcion;
            objRpta.Marca                 = objLogic.Marca;
            objRpta.Modelo                = objLogic.Modelo;
            objRpta.FechaAdquisicion      = objLogic.FechaAdquisicion.Value.ToString(DatosConstantes.Formato.FormatoFecha);
            objRpta.TiempoVidaString      = objLogic.TiempoVida.ToString(DatosConstantes.Formato.FormatoNumeroDecimal);
            objRpta.ValorResidualString   = objLogic.ValorResidual.ToString(DatosConstantes.Formato.FormatoNumeroDecimal);
            objRpta.CodigoTipoTarifa      = objLogic.CodigoTipoTarifa;
            objRpta.CodigoPeriodoAlquiler = objLogic.CodigoPeriodoAlquiler;
            objRpta.ValorAlquilerString   = objLogic.ValorAlquiler.HasValue ? objLogic.ValorAlquiler.Value.ToString(DatosConstantes.Formato.FormatoNumeroDecimal) : null;
            objRpta.CodigoMoneda          = objLogic.CodigoMoneda;
            objRpta.MesInicioAlquiler     = objLogic.MesInicioAlquiler;

            if (objRpta.MesInicioAlquiler > 0)
            {
                objRpta.DescripcionMesInicioAlquiler = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(int.Parse(objRpta.MesInicioAlquiler.ToString())));
            }

            objRpta.AnioInicioAlquiler = objLogic.AnioInicioAlquiler;

            if (objRpta.AnioInicioAlquiler > 0)
            {
                objRpta.MesAnioInicioAlquiler = objRpta.DescripcionMesInicioAlquiler + " - " + objRpta.AnioInicioAlquiler;
            }

            if (lstTipoBien != null && lstTipoBien.Count > 0)
            {
                li_index = lstTipoBien.FindIndex(x => x.Codigo.ToString() == objLogic.CodigoTipoBien);
                if (li_index > -1)
                {
                    objRpta.NombreTipoBien = lstTipoBien[li_index].Valor.ToString();
                }
            }
            li_index = -1;
            if (lstTipoTarifa != null && lstTipoTarifa.Count > 0)
            {
                li_index = lstTipoTarifa.FindIndex(x => x.Codigo.ToString() == objLogic.CodigoTipoTarifa);
                if (li_index > -1)
                {
                    objRpta.NombreTipoTarifa = lstTipoTarifa[li_index].Valor.ToString();
                }
            }
            li_index = -1;
            if (lstMoneda != null && lstMoneda.Count > 0)
            {
                li_index = lstMoneda.FindIndex(x => x.Codigo.ToString() == objLogic.CodigoMoneda);
                if (li_index > -1)
                {
                    objRpta.NombreMoneda = lstMoneda[li_index].Valor.ToString();
                }
            }
            li_index = -1;
            if (lstPeriodoAl != null && lstPeriodoAl.Count > 0)
            {
                li_index = lstPeriodoAl.FindIndex(x => x.Codigo.ToString() == objLogic.CodigoPeriodoAlquiler);
                if (li_index > -1)
                {
                    objRpta.NombrePeriodoAlquiler = lstPeriodoAl[li_index].Valor.ToString();
                }
            }
            return(objRpta);
        }