/// <summary>
        /// Calcula el Numero de la Poliza de la Unidad
        /// </summary>
        /// <returns></returns>
        private string CalcularNumeroPoliza()
        {
            var seguroBR = new SeguroBR();
            //SC_0051
            List <SeguroBO> seguros = seguroBR.Consultar(dataContext, new SeguroBO {
                Activo = true, Tramitable = new UnidadBO {
                    UnidadID = vista.UnidadID
                }
            }) ?? new List <SeguroBO>();

            SeguroBO seguro =
                seguros.FindLast(
                    seg => seg.Tramitable.TramitableID == vista.UnidadID && seg.Tramitable.TipoTramitable == ETipoTramitable.Unidad);

            return(seguro != null ? seguro.NumeroPoliza: string.Empty);
        }
Esempio n. 2
0
        private bool ValidarVigente()
        {
            TramitableProxyBO tramitable = new TramitableProxyBO();

            tramitable.TipoTramitable = this.vista.TipoTramitable.Value;
            tramitable.TramitableID   = this.vista.TramitableID.Value;
            SeguroBO seguro = new SeguroBO {
                Activo = true, Tramitable = tramitable
            };
            List <SeguroBO> seguros = controlador.Consultar(this.dctx, seguro);

            if (seguros == null)
            {
                return(false);
            }

            if (seguros.Count > 0)
            {
                if (seguros.Count > 1)
                {
                    throw new Exception("Inconcistencia en los seguros registrados, por favor revisa la informacion proporcionada");
                }
            }

            if (seguros.Count <= 0)
            {
                return(false);
            }

            seguro = seguros[0];

            if (seguro.VigenciaFinal.HasValue)
            {
                if (seguro.VigenciaFinal.Value.Date < DateTime.Now.Date)
                {
                    return(false);
                }
            }
            return(true);
        }