예제 #1
0
        public static EBroCotizacion BroValidarEmpresaCotizacion(string ruc)
        {
            EBroEmpresa    rsEmpresa    = new EBroEmpresa();
            EAdmBroker     rsBroker     = new EAdmBroker();
            EBroCotizacion rsCotizacion = new EBroCotizacion();

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT * FROM ConsultaValidarEmpresaCotizacion WHERE Ruc = @ruc", getCnn());
                cmd.Parameters.AddWithValue("@ruc", ruc);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.Read())
                {
                    rsEmpresa.Ruc        = rdr["Ruc"].ToString();
                    rsBroker.IdBroker    = Convert.ToInt32(rdr["IdBroker"]);
                    rsCotizacion.Broker  = rsBroker;
                    rsCotizacion.Empresa = rsEmpresa;
                }
                rdr.Close();
                return(rsCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
예제 #2
0
        public static List <EBroCotizacion> BroconsultarParametrosTotalCotizacionesOperador(EBroResumen pResumen)
        {
            List <EBroCotizacion> lstCotizacion = new List <EBroCotizacion>();

            EBroCotizacion rsCotizacion;

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT Cotizacion.IdUsuario, IIF(Cotizacion.Estado = 5, Sum(Cotizacion.PrimaTotal), 0) AS Total  FROM Cotizacion WHERE Fecha BETWEEN @fechaInicio AND @fechaFin AND (" + pResumen.Cadena + ") GROUP BY Cotizacion.IdUsuario, Cotizacion.Estado", getCnn());
                cmd.Parameters.AddWithValue("@fechaInicio", pResumen.FechaInicio);
                cmd.Parameters.AddWithValue("@fechaFin", pResumen.FechaFin);
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    rsCotizacion = new EBroCotizacion();

                    rsCotizacion.IdUsuario  = rdr["IdUsuario"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["IdUsuario"]);
                    rsCotizacion.PrimaTotal = rdr["Total"] == DBNull.Value ? 0 : Convert.ToDouble(rdr["Total"]);

                    lstCotizacion.Add(rsCotizacion);
                }
                rdr.Close();
                return(lstCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
예제 #3
0
        public static EBroCotizacion BroConsultaEstadoCotizacion(int IdCotizacion)
        {
            EBroCotizacion rsCotizacion = new EBroCotizacion();

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT Estado FROM Cotizacion WHERE IdCotizacion = @IdCotizacion", getCnn());
                cmd.Parameters.AddWithValue("@IdCotizacion", IdCotizacion);
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    rsCotizacion.Estado = Convert.ToInt32(rdr["Estado"]);
                }
                rdr.Close();
                return(rsCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
예제 #4
0
        //COVIERTE EL JSON STRING A UN JSON Y SE LE ASIGNA A UNA CLASE OBJETO
        public string GetDataUsingDataContract(string composite)
        {
            JavaScriptSerializer js2        = new JavaScriptSerializer();
            EBroCotizacion       cotizacion = js2.Deserialize <EBroCotizacion>(composite);
            int id = cotizacion.IdCotizacion;

            return(id + "");
        }
예제 #5
0
        public static EBroPagador BroConsultarPagador(string cedula, int idCotizacion)
        {
            EBroPagador    rsPagador    = new EBroPagador();
            EBroCotizacion rsCotizacion = new EBroCotizacion();

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT * FROM Pagador WHERE Pagador.Cedula = @cedula AND Pagador.IdCotizacion = @idCotizacion", getCnn());
                cmd.Parameters.AddWithValue("@cedula", cedula);
                cmd.Parameters.AddWithValue("@idCotizacion", idCotizacion);
                SqlDataReader rdr = cmd.ExecuteReader();
                if (rdr.Read())
                {
                    rsPagador.IdPagador       = Convert.ToInt32(rdr["IdPagador"]);
                    rsPagador.Cedula          = rdr["Cedula"].ToString();
                    rsPagador.Nombre          = rdr["Nombre"].ToString();
                    rsPagador.PrimerApellido  = rdr["PrimerApellido"].ToString();
                    rsPagador.SegundoApellido = rdr["SegundoApellido"].ToString();

                    rsPagador.Direccion = rdr["Direccion"].ToString();
                    rsPagador.Telefono  = rdr["Telefono"].ToString();
                    rsPagador.Email     = rdr["Email"].ToString();

                    rsCotizacion.IdCotizacion = Convert.ToInt32(rdr["IdCotizacion"]);
                    rsPagador.Cotizacion      = rsCotizacion;
                }
                rdr.Close();
                return(rsPagador);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
예제 #6
0
        public static EBroCotizacion BroGestionCotizacionCorredor(EBroCotizacion pCotizacion)
        {
            EBroCotizacion cotizacion = new EBroCotizacion();

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

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

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

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

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

                cmd.Parameters["@idCotizacion"].Value = pCotizacion.IdCotizacion;
                cmd.Parameters["@corredor"].Value     = pCotizacion.Corredor;

                cmd.ExecuteNonQuery();

                cotizacion.IdCotizacion = Convert.ToInt32(cmd.Parameters["@valor"].Value);

                return(cotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
예제 #7
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();
            }
        }
예제 #8
0
 public EBroCotizacion BroGestionCotizacionCorredor(EBroCotizacion pCotizacion)
 {
     return(CBroCotizacion.BroGestionCotizacionCorredor(pCotizacion));
 }
예제 #9
0
 public static EBroCotizacion BroGestionCotizacion(EBroCotizacion pCotizacion)
 {
     return(DBroCotizacion.BroGestionCotizacion(pCotizacion));
 }
예제 #10
0
        public static List <EBroCotizacion> BroConsultaEmpresa(int cotizacion, int broker, int empresa)
        {
            List <EBroCotizacion> lstCotizacion = new List <EBroCotizacion>();

            EBroCotizacion rsCotizacion;
            EAdmBroker     rsBroker;
            EBroEmpresa    rsEmpresa;

            try
            {
                Conectar();

                SqlCommand cmd = new SqlCommand("SELECT * FROM ConsultaEmpresa WHERE IdCotizacion = @cotizacion AND IdBroker = @broker AND IdEmpresa = @empresa", getCnn());
                cmd.Parameters.AddWithValue("@cotizacion", cotizacion);
                cmd.Parameters.AddWithValue("@broker", broker);
                cmd.Parameters.AddWithValue("@empresa", empresa);
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    rsCotizacion = new EBroCotizacion();
                    rsBroker     = new EAdmBroker();
                    rsEmpresa    = new EBroEmpresa();

                    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.Codigo          = rdr["Codigo"] == DBNull.Value ? 0 : Convert.ToInt32(rdr["Codigo"]);
                    rsEmpresa.Riesgo          = Convert.ToInt32(rdr["Riesgo"]);
                    rsEmpresa.SectorEconomico = rdr["SectorEconomico"].ToString();
                    rsEmpresa.Siniestralidad  = rdr["Siniestralidad"].ToString();
                    rsEmpresa.CodigoAsegurado = rdr["CodigoAsegurado"].ToString();
                    rsEmpresa.Direccion       = rdr["Direccion"].ToString();
                    rsEmpresa.Nombre          = rdr["Nombre"].ToString();
                    rsEmpresa.PrimerApellido  = rdr["PrimerApellido"].ToString();
                    rsEmpresa.SegundoApellido = rdr["SegundoApellido"].ToString();

                    rsBroker.IdBroker         = Convert.ToInt32(rdr["IdBroker"]);
                    rsCotizacion.IdCotizacion = Convert.ToInt32(rdr["IdCotizacion"]);
                    rsCotizacion.Corredor     = rdr["Corredor"].ToString();
                    rsCotizacion.Codigo       = rdr["CodigoCotizacion"].ToString();
                    rsCotizacion.Fecha        = rdr["Fecha"].ToString();

                    rsCotizacion.Broker  = rsBroker;
                    rsCotizacion.Empresa = rsEmpresa;

                    lstCotizacion.Add(rsCotizacion);
                }
                rdr.Close();
                return(lstCotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
예제 #11
0
        public static EBroCotizacion BroGestionCotizacion(EBroCotizacion pCotizacion)
        {
            EBroCotizacion cotizacion = new EBroCotizacion();

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

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

                cmd.Parameters.Add("@idCotizacion", SqlDbType.Int);
                cmd.Parameters.Add("@primaNetaIva12", SqlDbType.Float);
                cmd.Parameters.Add("@primaNetaIva0", SqlDbType.Float);
                cmd.Parameters.Add("@primaNetaTotal", SqlDbType.Float);
                cmd.Parameters.Add("@impuestoSBS", SqlDbType.Float);
                cmd.Parameters.Add("@impuestoCampesino", SqlDbType.Float);
                cmd.Parameters.Add("@derechosEmision", SqlDbType.Float);
                cmd.Parameters.Add("@iva", SqlDbType.Float);
                cmd.Parameters.Add("@primaTotal", SqlDbType.Float);
                cmd.Parameters.Add("@idBroker", SqlDbType.Int);
                cmd.Parameters.Add("@codigo", SqlDbType.NVarChar, -1);
                cmd.Parameters.Add("@estado", SqlDbType.Int);
                cmd.Parameters.Add("@idUsuario", SqlDbType.Int);
                cmd.Parameters.Add("@idEmpresa", SqlDbType.Int);
                cmd.Parameters.Add("@corredor", SqlDbType.NVarChar, -1);

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

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

                cmd.Parameters["@idCotizacion"].Value      = pCotizacion.IdCotizacion;
                cmd.Parameters["@primaNetaIva12"].Value    = pCotizacion.PrimaNetaIva12;
                cmd.Parameters["@primaNetaIva0"].Value     = pCotizacion.PrimaNetaIva0;
                cmd.Parameters["@primaNetaTotal"].Value    = pCotizacion.PrimaNetaTotal;
                cmd.Parameters["@impuestoSBS"].Value       = pCotizacion.ImpuestoSBS;
                cmd.Parameters["@impuestoCampesino"].Value = pCotizacion.ImpuestoCampesino;
                cmd.Parameters["@derechosEmision"].Value   = pCotizacion.DerechosEmision;
                cmd.Parameters["@iva"].Value        = pCotizacion.Iva;
                cmd.Parameters["@primaTotal"].Value = pCotizacion.PrimaTotal;
                cmd.Parameters["@idBroker"].Value   = pCotizacion.Broker.IdBroker;
                cmd.Parameters["@codigo"].Value     = pCotizacion.Codigo;
                cmd.Parameters["@estado"].Value     = pCotizacion.Estado;
                cmd.Parameters["@idUsuario"].Value  = pCotizacion.IdUsuario;
                cmd.Parameters["@idEmpresa"].Value  = pCotizacion.Empresa.IdEmpresa;
                cmd.Parameters["@corredor"].Value   = pCotizacion.Corredor;

                cmd.ExecuteNonQuery();

                cotizacion.IdCotizacion = Convert.ToInt32(cmd.Parameters["@valor"].Value);

                return(cotizacion);
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                Cerrar();
            }
        }
예제 #12
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();
            }
        }
예제 #13
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();
            }
        }
예제 #14
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();
            }
        }