示例#1
0
        public static EBroDireccion BroGestionDireccion(EBroDireccion pdireccion)
        {
            EBroDireccion direccion = new EBroDireccion();

            try
            {
                Conectar();
                SqlCommand cmd = new SqlCommand("GestionDireccion", getCnn());
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@identificador", SqlDbType.Int, 1);

                cmd.Parameters.Add("@idDireccion", SqlDbType.Int);
                cmd.Parameters.Add("@datosDireccion", SqlDbType.NVarChar, -1);
                cmd.Parameters.Add("@idCotizacion", SqlDbType.Int);

                cmd.Parameters.Add("@valor", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output;

                cmd.Parameters["@identificador"].Value = pdireccion.Identificador;

                cmd.Parameters["@idDireccion"].Value    = pdireccion.IdDireccion;
                cmd.Parameters["@datosDireccion"].Value = pdireccion.DatosDireccion;
                cmd.Parameters["@idCotizacion"].Value   = pdireccion.Cotizacion.IdCotizacion;

                cmd.ExecuteNonQuery();

                direccion.IdDireccion = Convert.ToInt32(cmd.Parameters["@valor"].Value);

                return(direccion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
示例#2
0
 public static EBroDireccion BroGestionDireccion(EBroDireccion pdireccion)
 {
     return(DBroDireccion.BroGestionDireccion(pdireccion));
 }
示例#3
0
        public static List <EBroCotizacion> BroConsultarResumenGlobalCotizacionesUsuarios(EBroResumen pResumen)
        {
            List <EBroCotizacion> lstCotizacion = new List <EBroCotizacion>();

            EBroCotizacion rsCotizacion;
            EAdmBroker     rsBroker;
            EBroEmpresa    rsEmpresa;
            EBroContenido  rsContenido;
            EBroDireccion  rsDireccion;
            EBroVehiculo   rsVehiculos;
            EAdmUsuarios   rsUsuario;

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT IdCotizacion, Codigo, Fecha, IdUsuario, Usuario, IdPadre, Ciudad, IdEmpresa, RazonSocial,Telefono,Antiguedad, IdDireccion, IdVehiculos, IdContenido, Estado, PrimaTotal, IdBroker, EstadoGarantia, EstadoCondiciones FROM ConsultaCotizacionEmpresaComplementos WHERE IdBroker = @broker AND (" + pResumen.Cadena + ")", getCnn());
                cmd.Parameters.AddWithValue("@broker", pResumen.IdBroker);
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    rsCotizacion = new EBroCotizacion();
                    rsBroker     = new EAdmBroker();
                    rsEmpresa    = new EBroEmpresa();
                    rsContenido  = new EBroContenido();
                    rsDireccion  = new EBroDireccion();
                    rsVehiculos  = new EBroVehiculo();
                    rsUsuario    = new EAdmUsuarios();

                    rsCotizacion.IdCotizacion = rdr["IdCotizacion"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdCotizacion"]);
                    rsCotizacion.PrimaTotal   = rdr["PrimaTotal"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaTotal"]);
                    rsCotizacion.Codigo       = rdr["Codigo"].ToString();
                    rsCotizacion.Estado       = rdr["Estado"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["Estado"]);
                    rsCotizacion.IdUsuario    = rdr["IdUsuario"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdUsuario"]);
                    rsCotizacion.Fecha        = rdr["Fecha"].ToString();
                    rsCotizacion.Antiguedad   = rdr["Antiguedad"].ToString();

                    rsUsuario.Usuario = rdr["Usuario"].ToString();
                    rsUsuario.Ciudad  = rdr["Ciudad"].ToString();
                    rsUsuario.IdPadre = rdr["IdPadre"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdPadre"]);;

                    rsEmpresa.IdEmpresa   = rdr["IdEmpresa"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdEmpresa"]);
                    rsEmpresa.RazonSocial = rdr["RazonSocial"].ToString();
                    rsEmpresa.Telefono    = rdr["Telefono"].ToString();

                    rsBroker.IdBroker = rdr["IdBroker"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdBroker"]);

                    rsContenido.IdContenido       = rdr["IdContenido"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdContenido"]);
                    rsContenido.EstadoGarantias   = rdr["EstadoGarantia"].ToString();
                    rsContenido.EstadoCondiciones = rdr["EstadoCondiciones"].ToString();

                    rsDireccion.IdDireccion = rdr["IdDireccion"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdDireccion"]);

                    rsVehiculos.IdVehiculos = rdr["IdVehiculos"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdVehiculos"]);

                    rsCotizacion.Broker    = rsBroker;
                    rsCotizacion.Empresa   = rsEmpresa;
                    rsCotizacion.Contenido = rsContenido;
                    rsCotizacion.Vehiculo  = rsVehiculos;
                    rsCotizacion.Direccion = rsDireccion;
                    rsCotizacion.Usuario   = rsUsuario;

                    lstCotizacion.Add(rsCotizacion);
                }
                rdr.Close();
                return(lstCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
示例#4
0
        public static EBroCotizacion ConsultaCotizacionCompleta(int IdContenido, int IdCotizacion, int IdDireccion, int IdVehiculos, int IdEmpresa)
        {
            EBroCotizacion rsCotizacion = new EBroCotizacion();
            EAdmBroker     rsBroker     = new EAdmBroker();
            EBroEmpresa    rsEmpresa    = new EBroEmpresa();
            EBroContenido  rsContenido  = new EBroContenido();
            EBroDireccion  rsDireccion  = new EBroDireccion();
            EBroVehiculo   rsVehiculos  = new EBroVehiculo();

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT * FROM ConsultaCotizacionEmpresaComplementos WHERE IdContenido = @IdContenido AND IdCotizacion = @IdCotizacion AND IdDireccion = @IdDireccion AND IdVehiculos = @IdVehiculos AND IdEmpresa = @IdEmpresa", getCnn());
                cmd.Parameters.AddWithValue("@IdContenido", IdContenido);
                cmd.Parameters.AddWithValue("@IdCotizacion", IdCotizacion);
                cmd.Parameters.AddWithValue("@IdDireccion", IdDireccion);
                cmd.Parameters.AddWithValue("@IdVehiculos", IdVehiculos);
                cmd.Parameters.AddWithValue("@IdEmpresa", IdEmpresa);
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    rsCotizacion.IdCotizacion      = Convert.ToInt32(rdr["IdCotizacion"]);
                    rsCotizacion.PrimaNetaIva12    = rdr["PrimaNetaIva12"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaNetaIva12"]);
                    rsCotizacion.PrimaNetaIva0     = rdr["PrimaNetaIva0"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaNetaIva0"]);
                    rsCotizacion.PrimaNetaTotal    = rdr["PrimaNetaTotal"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaNetaTotal"]);
                    rsCotizacion.ImpuestoSBS       = rdr["ImpuestoSBS"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["ImpuestoSBS"]);
                    rsCotizacion.ImpuestoCampesino = rdr["ImpuestoCampesino"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["ImpuestoCampesino"]);
                    rsCotizacion.DerechosEmision   = rdr["DerechosEmision"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["DerechosEmision"]);
                    rsCotizacion.PrimaTotal        = rdr["PrimaTotal"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaTotal"]);
                    rsCotizacion.Iva       = rdr["Iva"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["Iva"]);
                    rsCotizacion.Codigo    = rdr["Codigo"].ToString();
                    rsCotizacion.Estado    = Convert.ToInt32(rdr["Estado"]);
                    rsCotizacion.Fecha     = rdr["Fecha"].ToString();
                    rsCotizacion.IdUsuario = Convert.ToInt32(rdr["IdUsuario"]);
                    rsCotizacion.Corredor  = rdr["Corredor"].ToString();

                    rsEmpresa.IdEmpresa       = Convert.ToInt32(rdr["IdEmpresa"]);
                    rsEmpresa.RazonSocial     = rdr["RazonSocial"].ToString();
                    rsEmpresa.Ruc             = rdr["Ruc"].ToString();
                    rsEmpresa.Telefono        = rdr["Telefono"].ToString();
                    rsEmpresa.Email           = rdr["Email"].ToString();
                    rsEmpresa.GiroNegocio     = rdr["GiroNegocio"].ToString();
                    rsEmpresa.SectorEconomico = rdr["SectorEconomico"].ToString();
                    rsEmpresa.Riesgo          = Convert.ToInt32(rdr["Riesgo"]);
                    rsEmpresa.Siniestralidad  = rdr["Siniestralidad"].ToString();

                    rsBroker.IdBroker    = Convert.ToInt32(rdr["IdBroker"]);
                    rsBroker.RazonSocial = rdr["RazonSocialBroker"].ToString();
                    rsBroker.Foto        = rdr["Foto"].ToString();

                    rsContenido.IdContenido      = Convert.ToInt32(rdr["IdContenido"]);
                    rsContenido.DatosCotizador   = rdr["DatosCotizador"].ToString();
                    rsContenido.DatosGarantias   = rdr["DatosGarantias"].ToString();
                    rsContenido.DatosCondiciones = rdr["DatosCondiciones"].ToString();
                    rsContenido.Lista            = rdr["Lista"].ToString();
                    rsContenido.VistaDiseno      = rdr["VistaDiseno"].ToString();
                    rsContenido.VistaEstado      = rdr["VistaEstado"].ToString();
                    rsContenido.VistaValores     = rdr["VistaValores"].ToString();

                    rsDireccion.IdDireccion    = Convert.ToInt32(rdr["IdDireccion"]);
                    rsDireccion.DatosDireccion = rdr["DatosDireccion"].ToString();

                    rsVehiculos.IdVehiculos   = Convert.ToInt32(rdr["IdVehiculos"]);
                    rsVehiculos.DatosVehiculo = rdr["DatosVehiculo"].ToString();

                    rsCotizacion.Broker    = rsBroker;
                    rsCotizacion.Empresa   = rsEmpresa;
                    rsCotizacion.Contenido = rsContenido;
                    rsCotizacion.Vehiculo  = rsVehiculos;
                    rsCotizacion.Direccion = rsDireccion;
                }
                rdr.Close();
                return(rsCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
示例#5
0
        public static EBroCotizacion ConsultaCotizacionEmpresaComplementos(int IdContenido, int IdCotizacion, int IdDireccion, int IdVehiculos, int IdEmpresa)
        {
            List <KeyValuePair <string, object> > lista = new List <KeyValuePair <string, object> >();

            EBroCotizacion          rsCotizacion          = new EBroCotizacion();
            EAdmBroker              rsBroker              = new EAdmBroker();
            EBroEmpresa             rsEmpresa             = new EBroEmpresa();
            EBroContenido           rsContenido           = new EBroContenido();
            EBroDireccion           rsDireccion           = new EBroDireccion();
            EBroVehiculo            rsVehiculos           = new EBroVehiculo();
            EBroPagador             rsPagador             = new EBroPagador();
            EBroContratante         rsContratante         = new EBroContratante();
            EBroFormaPago           rsFormaPago           = new EBroFormaPago();
            EBroCotizacionResultado rsCotizacionResultado = new EBroCotizacionResultado();

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT * FROM ConsultaCotizacionEmpresaComplementos WHERE IdContenido = @IdContenido AND IdCotizacion = @IdCotizacion AND IdDireccion = @IdDireccion AND IdVehiculos = @IdVehiculos AND IdEmpresa = @IdEmpresa", getCnn());
                cmd.Parameters.AddWithValue("@IdContenido", IdContenido);
                cmd.Parameters.AddWithValue("@IdCotizacion", IdCotizacion);
                cmd.Parameters.AddWithValue("@IdDireccion", IdDireccion);
                cmd.Parameters.AddWithValue("@IdVehiculos", IdVehiculos);
                cmd.Parameters.AddWithValue("@IdEmpresa", IdEmpresa);
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    rsCotizacion.IdCotizacion      = Convert.ToInt32(rdr["IdCotizacion"]);
                    rsCotizacion.PrimaNetaIva12    = rdr["PrimaNetaIva12"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaNetaIva12"]);
                    rsCotizacion.PrimaNetaIva0     = rdr["PrimaNetaIva0"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaNetaIva0"]);
                    rsCotizacion.PrimaNetaTotal    = rdr["PrimaNetaTotal"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaNetaTotal"]);
                    rsCotizacion.ImpuestoSBS       = rdr["ImpuestoSBS"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["ImpuestoSBS"]);
                    rsCotizacion.ImpuestoCampesino = rdr["ImpuestoCampesino"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["ImpuestoCampesino"]);
                    rsCotizacion.DerechosEmision   = rdr["DerechosEmision"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["DerechosEmision"]);
                    rsCotizacion.PrimaTotal        = rdr["PrimaTotal"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaTotal"]);
                    rsCotizacion.Iva       = rdr["Iva"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["Iva"]);
                    rsCotizacion.Codigo    = rdr["Codigo"].ToString();
                    rsCotizacion.Estado    = Convert.ToInt32(rdr["Estado"]);
                    rsCotizacion.Fecha     = rdr["Fecha"].ToString();
                    rsCotizacion.IdUsuario = Convert.ToInt32(rdr["IdUsuario"]);
                    rsCotizacion.IdPago    = rdr["IdPago"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdPago"]);
                    rsCotizacion.Corredor  = rdr["Corredor"].ToString();

                    rsEmpresa.IdEmpresa       = Convert.ToInt32(rdr["IdEmpresa"]);
                    rsEmpresa.RazonSocial     = rdr["RazonSocial"].ToString();
                    rsEmpresa.Nombre          = rdr["NombreEmpresa"].ToString();
                    rsEmpresa.PrimerApellido  = rdr["PrimerApellidoEmpresa"].ToString();
                    rsEmpresa.SegundoApellido = rdr["SegundoApellidoEmpresa"].ToString();
                    rsEmpresa.CodigoAsegurado = rdr["CodigoAsegurado"].ToString();

                    rsBroker.IdBroker = Convert.ToInt32(rdr["IdBroker"]);

                    rsContenido.IdContenido    = Convert.ToInt32(rdr["IdContenido"]);
                    rsContenido.DatosCotizador = rdr["DatosCotizador"].ToString();
                    rsContenido.Lista          = rdr["Lista"].ToString();
                    rsContenido.VistaDiseno    = rdr["VistaDiseno"].ToString();
                    rsContenido.VistaEstado    = rdr["VistaEstado"].ToString();
                    rsContenido.VistaValores   = rdr["VistaValores"].ToString();

                    rsDireccion.IdDireccion    = Convert.ToInt32(rdr["IdDireccion"]);
                    rsDireccion.DatosDireccion = rdr["DatosDireccion"].ToString();

                    rsVehiculos.IdVehiculos   = Convert.ToInt32(rdr["IdVehiculos"]);
                    rsVehiculos.DatosVehiculo = rdr["DatosVehiculo"].ToString();

                    rsPagador.IdPagador       = rdr["IdPagador"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdPagador"]);
                    rsPagador.Cedula          = rdr["CedulaPagador"].ToString();
                    rsPagador.Nombre          = rdr["NombrePagador"].ToString();
                    rsPagador.PrimerApellido  = rdr["PrimerApellidoPagador"].ToString();
                    rsPagador.SegundoApellido = rdr["SegundoApellidoPagador"].ToString();
                    rsPagador.Direccion       = rdr["DireccionPagador"].ToString();
                    rsPagador.Telefono        = rdr["TelefonoPagador"].ToString();
                    rsPagador.Email           = rdr["EmailPagador"].ToString();

                    rsContratante.IdContratante   = rdr["IdContratante"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdContratante"]);
                    rsContratante.Cedula          = rdr["CedulaContratante"].ToString();
                    rsContratante.Nombre          = rdr["NombreContratante"].ToString();
                    rsContratante.PrimerApellido  = rdr["PrimerApellidoContratante"].ToString();
                    rsContratante.SegundoApellido = rdr["SegundoApellidoContratante"].ToString();
                    rsContratante.Direccion       = rdr["DireccionContratante"].ToString();
                    rsContratante.Telefono        = rdr["TelefonoContratante"].ToString();
                    rsContratante.Email           = rdr["EmailContratante"].ToString();

                    rsFormaPago.IdFormaPago = rdr["FormaPagoIdFormaPago"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["FormaPagoIdFormaPago"]);
                    rsFormaPago.IdPago      = rdr["FormaPagoIdPago"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["FormaPagoIdPago"]);
                    rsFormaPago.Estado      = rdr["FormaPagoEstado"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["FormaPagoEstado"]);
                    rsFormaPago.Tipo        = rdr["FormaPagoTipo"].ToString();
                    rsFormaPago.Adjunto     = rdr["FormaPagoAdjunto"].ToString();
                    rsFormaPago.AdjuntoTipo = rdr["FormaPagoAdjuntoTipo"].ToString();

                    rsFormaPago.Plataforma          = rdr["Plataforma"].ToString();
                    rsFormaPago.CodigoAutenticacion = rdr["CodigoAutenticacion"].ToString();
                    rsFormaPago.Referencia          = rdr["Referencia"].ToString();
                    rsFormaPago.Lote      = rdr["Lote"].ToString();
                    rsFormaPago.Voucher   = rdr["Voucher"].ToString();
                    rsFormaPago.Diferidos = rdr["Diferidos"].ToString();
                    rsFormaPago.Intereses = rdr["Intereses"].ToString();
                    rsFormaPago.Trama     = rdr["Trama"].ToString();
                    rsFormaPago.Fecha     = rdr["FechaPago"].ToString();

                    rsCotizacionResultado.IdCotizacionResultado = rdr["IdCotizacionResultado"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdCotizacionResultado"]);

                    rsCotizacionResultado.IdPvMultiriesgo            = rdr["IdPvMultiriesgo"].ToString();
                    rsCotizacionResultado.EstadoMultiriesgo          = rdr["EstadoMultiriesgo"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoMultiriesgo"]);
                    rsCotizacionResultado.IdPvEquipoMaquinaria       = rdr["IdPvEquipoMaquinaria"].ToString();
                    rsCotizacionResultado.EstadoEquipoMaquinaria     = rdr["EstadoEquipoMaquinaria"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoEquipoMaquinaria"]);
                    rsCotizacionResultado.IdPvResponsabilidadCivil   = rdr["IdPvResponsabilidadCivil"].ToString();
                    rsCotizacionResultado.EstadoResponsabilidadCivil = rdr["EstadoResponsabilidadCivil"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoResponsabilidadCivil"]);
                    rsCotizacionResultado.IdPvFidelidad              = rdr["IdPvFidelidad"].ToString();
                    rsCotizacionResultado.EstadoFidelidad            = rdr["EstadoFidelidad"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoFidelidad"]);
                    rsCotizacionResultado.IdPvAccidentesPersonales   = rdr["IdPvAccidentesPersonales"].ToString();
                    rsCotizacionResultado.EstadoAccidentesPersonales = rdr["EstadoAccidentesPersonales"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoAccidentesPersonales"]);
                    rsCotizacionResultado.IdPvTransInterno           = rdr["IdPvTransInterno"].ToString();
                    rsCotizacionResultado.EstadoTransInterno         = rdr["EstadoTransInterno"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoTransInterno"]);
                    rsCotizacionResultado.IdPvTransImportaciones     = rdr["IdPvTransImportaciones"].ToString();
                    rsCotizacionResultado.EstadoTransImportaciones   = rdr["EstadoTransImportaciones"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoTransImportaciones"]);
                    rsCotizacionResultado.IdPvVehiculos              = rdr["IdPvVehiculos"].ToString();
                    rsCotizacionResultado.EstadoVehiculos            = rdr["EstadoVehiculos"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoVehiculos"]);
                    rsCotizacionResultado.EstadoGlobal     = rdr["EstadoGlobal"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoGlobal"]);
                    rsCotizacionResultado.EstadoPagoGlobal = rdr["EstadoPagoGlobal"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoPagoGlobal"]);
                    rsCotizacionResultado.FechaEmision     = rdr["FechaEmision"].ToString();

                    rsCotizacion.Broker              = rsBroker;
                    rsCotizacion.Empresa             = rsEmpresa;
                    rsCotizacion.Contenido           = rsContenido;
                    rsCotizacion.Vehiculo            = rsVehiculos;
                    rsCotizacion.Direccion           = rsDireccion;
                    rsCotizacion.Pagador             = rsPagador;
                    rsCotizacion.Contratante         = rsContratante;
                    rsCotizacion.FormaPago           = rsFormaPago;
                    rsCotizacion.CotizacionResultado = rsCotizacionResultado;
                }
                rdr.Close();
                return(rsCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
示例#6
0
        public static List <EBroCotizacion> BroConsultaCotizacionesUsuario(int broker, int usuario)
        {
            List <EBroCotizacion> lstCotizacion = new List <EBroCotizacion>();

            EBroCotizacion          rsCotizacion;
            EAdmBroker              rsBroker;
            EBroEmpresa             rsEmpresa;
            EBroContenido           rsContenido;
            EBroDireccion           rsDireccion;
            EBroVehiculo            rsVehiculos;
            EBroCotizacionResultado rsCotizacionResultado;
            EBroFormaPago           rsFormaPago;
            EBroContratante         rsContratante;
            EBroPagador             rsPagador;

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT * FROM ConsultaCotizacionEmpresaComplementos WHERE IdBroker = @broker AND IdUsuario = @usuario ORDER BY Fecha DESC", getCnn());
                cmd.Parameters.AddWithValue("@broker", broker);
                cmd.Parameters.AddWithValue("@usuario", usuario);
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    rsCotizacion          = new EBroCotizacion();
                    rsBroker              = new EAdmBroker();
                    rsEmpresa             = new EBroEmpresa();
                    rsContenido           = new EBroContenido();
                    rsDireccion           = new EBroDireccion();
                    rsVehiculos           = new EBroVehiculo();
                    rsCotizacionResultado = new EBroCotizacionResultado();
                    rsFormaPago           = new EBroFormaPago();
                    rsContratante         = new EBroContratante();
                    rsPagador             = new EBroPagador();

                    rsCotizacion.IdCotizacion = rdr["IdCotizacion"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdCotizacion"]);
                    rsCotizacion.PrimaTotal   = rdr["PrimaTotal"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["PrimaTotal"]);
                    rsCotizacion.Codigo       = rdr["Codigo"].ToString();
                    rsCotizacion.Estado       = rdr["Estado"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["Estado"]);
                    rsCotizacion.IdUsuario    = rdr["IdUsuario"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdUsuario"]);
                    rsCotizacion.Fecha        = rdr["Fecha"].ToString();
                    rsCotizacion.Antiguedad   = rdr["Antiguedad"].ToString();
                    rsCotizacion.Corredor     = rdr["Corredor"].ToString();

                    rsEmpresa.IdEmpresa   = rdr["IdEmpresa"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdEmpresa"]);
                    rsEmpresa.Ruc         = rdr["Ruc"].ToString();
                    rsEmpresa.RazonSocial = rdr["RazonSocial"].ToString();
                    rsEmpresa.Telefono    = rdr["Telefono"].ToString();

                    rsContratante.Cedula          = rdr["CedulaContratante"].ToString();
                    rsContratante.Nombre          = rdr["NombreContratante"].ToString();
                    rsContratante.PrimerApellido  = rdr["PrimerApellidoContratante"].ToString();
                    rsContratante.SegundoApellido = rdr["SegundoApellidoContratante"].ToString();

                    rsPagador.Cedula          = rdr["CedulaPagador"].ToString();
                    rsPagador.Nombre          = rdr["NombrePagador"].ToString();
                    rsPagador.PrimerApellido  = rdr["PrimerApellidoPagador"].ToString();
                    rsPagador.SegundoApellido = rdr["SegundoApellidoPagador"].ToString();

                    rsBroker.IdBroker = rdr["IdBroker"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdBroker"]);

                    rsContenido.IdContenido       = rdr["IdContenido"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdContenido"]);
                    rsContenido.VistaValores      = rdr["VistaValores"].ToString();
                    rsContenido.EstadoGarantias   = rdr["EstadoGarantia"].ToString();
                    rsContenido.EstadoCondiciones = rdr["EstadoCondiciones"].ToString();

                    rsFormaPago.Plataforma          = rdr["Plataforma"].ToString();
                    rsFormaPago.CodigoAutenticacion = rdr["CodigoAutenticacion"].ToString();
                    rsFormaPago.Referencia          = rdr["Referencia"].ToString();
                    rsFormaPago.Lote      = rdr["Lote"].ToString();
                    rsFormaPago.Voucher   = rdr["Voucher"].ToString();
                    rsFormaPago.Diferidos = rdr["Diferidos"].ToString();
                    rsFormaPago.Intereses = rdr["Intereses"].ToString();
                    rsFormaPago.Trama     = rdr["Trama"].ToString();
                    rsFormaPago.Fecha     = rdr["FechaPago"].ToString();
                    rsFormaPago.Tipo      = rdr["TipoPago"].ToString();

                    rsDireccion.IdDireccion = rdr["IdDireccion"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdDireccion"]);

                    rsVehiculos.IdVehiculos = rdr["IdVehiculos"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdVehiculos"]);

                    rsCotizacionResultado.IdCotizacionResultado = rdr["IdCotizacionResultado"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdCotizacionResultado"]);

                    rsCotizacionResultado.IdPvMultiriesgo            = rdr["IdPvMultiriesgo"].ToString();
                    rsCotizacionResultado.EstadoMultiriesgo          = rdr["EstadoMultiriesgo"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoMultiriesgo"]);
                    rsCotizacionResultado.IdPvEquipoMaquinaria       = rdr["IdPvEquipoMaquinaria"].ToString();
                    rsCotizacionResultado.EstadoEquipoMaquinaria     = rdr["EstadoEquipoMaquinaria"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoEquipoMaquinaria"]);
                    rsCotizacionResultado.IdPvResponsabilidadCivil   = rdr["IdPvResponsabilidadCivil"].ToString();
                    rsCotizacionResultado.EstadoResponsabilidadCivil = rdr["EstadoResponsabilidadCivil"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoResponsabilidadCivil"]);
                    rsCotizacionResultado.IdPvFidelidad              = rdr["IdPvFidelidad"].ToString();
                    rsCotizacionResultado.EstadoFidelidad            = rdr["EstadoFidelidad"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoFidelidad"]);
                    rsCotizacionResultado.IdPvAccidentesPersonales   = rdr["IdPvAccidentesPersonales"].ToString();
                    rsCotizacionResultado.EstadoAccidentesPersonales = rdr["EstadoAccidentesPersonales"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoAccidentesPersonales"]);
                    rsCotizacionResultado.IdPvTransInterno           = rdr["IdPvTransInterno"].ToString();
                    rsCotizacionResultado.EstadoTransInterno         = rdr["EstadoTransInterno"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoTransInterno"]);
                    rsCotizacionResultado.IdPvTransImportaciones     = rdr["IdPvTransImportaciones"].ToString();
                    rsCotizacionResultado.EstadoTransImportaciones   = rdr["EstadoTransImportaciones"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoTransImportaciones"]);
                    rsCotizacionResultado.IdPvVehiculos              = rdr["IdPvVehiculos"].ToString();
                    rsCotizacionResultado.EstadoVehiculos            = rdr["EstadoVehiculos"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoVehiculos"]);
                    rsCotizacionResultado.EstadoGlobal     = rdr["EstadoGlobal"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoGlobal"]);
                    rsCotizacionResultado.EstadoPagoGlobal = rdr["EstadoPagoGlobal"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["EstadoPagoGlobal"]);



                    rsCotizacion.Broker              = rsBroker;
                    rsCotizacion.Empresa             = rsEmpresa;
                    rsCotizacion.Contratante         = rsContratante;
                    rsCotizacion.Pagador             = rsPagador;
                    rsCotizacion.Contenido           = rsContenido;
                    rsCotizacion.Vehiculo            = rsVehiculos;
                    rsCotizacion.Direccion           = rsDireccion;
                    rsCotizacion.CotizacionResultado = rsCotizacionResultado;
                    rsCotizacion.FormaPago           = rsFormaPago;

                    lstCotizacion.Add(rsCotizacion);
                }
                rdr.Close();
                return(lstCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }