// GET: Cobertura
        public JsonResult GetCoberturasAseguradoras(int idCotizacion)
        {
            try
            {
                int tipoCobertura = 1;
                //Verificar Cobertura Tipo de la Cotizacion
                ENCotizacion oCotizacion   = null;
                LNCotizacion olnCotizacion = new LNCotizacion();
                oCotizacion = olnCotizacion.GetCotizacionCabecera(idCotizacion);

                if (oCotizacion.UsoVehiculo == "PARTICULAR")
                {
                    tipoCobertura = 1;
                }

                if (oCotizacion.UsoVehiculo == "CHINOS")
                {
                    tipoCobertura = 2;
                }

                LNCobertura        olnCoberturas = new LNCobertura();
                List <ENCobertura> lbeCobertura  = olnCoberturas.GetCoberturaTipoAseguradora(tipoCobertura, 0);
                return(Json(lbeCobertura, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                throw;
            }
        }
 public JsonResult GetCotizacionClienteCabecera(int idCotizacion)
 {
     try
     {
         ENCotizacion oCotizacion   = null;
         LNCotizacion olnCotizacion = new LNCotizacion();
         oCotizacion = olnCotizacion.GetCotizacionCabecera(idCotizacion);
         return(Json(oCotizacion, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
        public ENCotizacion GetCotizacionCabecera(int idCotizacion)
        {
            ENCotizacion beCotizacion = null;

            using (SqlConnection con = new SqlConnection(CadenaConexion))
            {
                try
                {
                    con.Open();
                    DACotizacion odaCotizacion = new DACotizacion();
                    beCotizacion = odaCotizacion.GetCotizacionCabecera(con, idCotizacion);
                }
                catch (Exception ex)
                {
                    GrabarLog(ex);
                }

                return(beCotizacion);
            }
        }
Example #4
0
        //PROCESO DE GENERACION DE COTIZACIÓN EN SERVIDOR. ARCHIVO PDF
        public void GenerarCotizacionPDF(int intCodigo)
        {
            try
            {
                //OBTENER DATOS DE COTIZACION
                string       strCaracter        = "0";
                ENCotizacion oCotizacion        = GetCotizacionCabecera(intCodigo);
                string       strCliente         = oCotizacion.Mail_Cliente.ToString().Trim();
                string       strOrdenCotizacion = oCotizacion.idCotizacion.ToString().PadLeft(10, strCaracter[0]);
                string       strCelular         = oCotizacion.TelefonoCliente.ToString();
                string       strVehiculo        = oCotizacion.Descripcion_Modelo.ToString();
                string       strAno             = oCotizacion.Anio.ToString();
                string       strValor           = "USD$" + oCotizacion.ValorReferencial.ToString();



                //Desarrollo
                //string strRutaCotizacion = @"F:\DigitalBrokers\PDF\COT-" + oCotizacion.idCotizacion + ".pdf";

                //Produccion
                //string strRutaCotizacion = @"G:/PleskVhosts/digitalbrokers.pe/app.digitalbrokers.pe/Cotizaciones/PDF/COT-" + oCotizacion.idCotizacion + ".pdf";
                //cambio fabian
                string strRutaCotizacion = @"D:/trabajo/ROBERTO/2_Web.DigitalBrokers/Web.DigitalBrokers/Web.DigitalBrokers/Cotizaciones/PDF/COT-" + oCotizacion.idCotizacion + ".pdf";

                //if (!Directory.Exists(RutaCotizacion + strFechaArchivo))
                //    Directory.CreateDirectory(RutaCotizacion + strFechaArchivo);

                //Obtener Detalle de Cotizacion y Articulos
                LNCotizacionDetalle olnCotizacionDetalle = new LNCotizacionDetalle();
                ENCotizacionDetalle obeCotizacionDetalle = olnCotizacionDetalle.GetCotizacionDetalle(intCodigo);

                //OBTENER DATOS DE DETALLE DE COTIZACION
                string strRimacPrecio    = "USD$" + obeCotizacionDetalle.Prima_Rimac.ToString().Trim();
                string strMapfrePrecio   = "USD$" + obeCotizacionDetalle.Prima_Mafre.ToString().Trim();
                string strPositivaPrecio = "USD$" + obeCotizacionDetalle.Prima_LaPositiva.ToString().Trim();
                string strPacificoPrecio = "USD$" + obeCotizacionDetalle.Prima_Pacifico.ToString().Trim();

                string strHDIPrecio = "USD$" + obeCotizacionDetalle.Prima_HDI.ToString().Trim();
                if (obeCotizacionDetalle.Prima_HDI == 0)
                {
                    strHDIPrecio = "CONSULTAR";
                }

                //REQUIERE USO DE GPS
                string strGPSRimac    = obeCotizacionDetalle.GPS_Rimac.ToString().Trim();
                string strGPSMapfre   = obeCotizacionDetalle.GPS_Mafre.ToString().Trim();
                string strGPSPositiva = obeCotizacionDetalle.GPS_LaPositiva.ToString().Trim();
                string strGPSPacifico = obeCotizacionDetalle.GPS_Pacifico.ToString().Trim();
                string strGPSHDI      = obeCotizacionDetalle.GPS_HDI.ToString().Trim();


                //ARMAR PDF DE COTIZACION
                //iTextSharp.text.Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
                Document doc = new Document(PageSize.A4);
                //PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(strRutaCotizacion, FileMode.Create));
                PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(strRutaCotizacion, FileMode.OpenOrCreate));
                doc.Open();

                //string fontpath = ConfigurationManager.AppSettings["RUTA_FONTS"];
                //FontFactory.RegisterDirectory(fontpath);

                doc.NewPage();

                //IMAGEN DESARROLLO
                //System.Drawing.Bitmap logo = new System.Drawing.Bitmap(@"F:\DigitalBrokers\logo\logodb.jpg");

                //IMAGEN PRODUCCION
                //System.Drawing.Bitmap logo = new System.Drawing.Bitmap(@"G:/PleskVhosts/digitalbrokers.pe/Documentos/logodb.jpg");
                System.Drawing.Bitmap logo = new System.Drawing.Bitmap(@"D:/trabajo/ROBERTO/2_Web.DigitalBrokers/Web.DigitalBrokers/Web.DigitalBrokers/documentos/logodb.jpg");


                System.Drawing.ImageConverter imgcon = new System.Drawing.ImageConverter();
                byte[] bytelogo = (byte[])imgcon.ConvertTo(logo, typeof(byte[]));
                iImage(doc, writer, 10, 7, 56, 20, 0, bytelogo);

                iTexto(doc, writer, 10, 28, 123, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", "DIGITAL BROKERS S.A.C. - CORREDORES DE SEGUROS");
                iTexto(doc, writer, 10, 33, 123, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "DOM.FISCAL: " + "AV. AREQUIPA 2450 - OFICINA 1205, LINCE. LIMA-PE");
                iTexto(doc, writer, 10, 37, 103, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "RUC: " + "20601943493 ");
                iTexto(doc, writer, 10, 41, 103, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "TELEFONO: " + " PERÚ(01) 759-7746");

                //RECTANGULO DERECHO
                iRectangle(doc, writer, 145, 15, 50, 29, 0, 0, 1);
                //iRectangle(doc, writer, 115, 15, 82, 29, 0, 0, 2); 82 es el ancho del cuadrado   29= alto del cuadrado
                iTexto(doc, writer, 145, 18, 50, 6, 0, (int)TextAlignment.Center, "ARIAL", 15, "Bold", "Normal", "#000000", "COTIZACIÓN");
                //if (oCotizacion.decMontoRecargo > 0)
                //    iTexto(doc, writer, 115, 26, 82, 6, 0, (int)TextAlignment.Center, "ARIAL", 15, "Bold", "Normal", "#000000", "URGENTE (24 HORAS)");
                //else
                //    iTexto(doc, writer, 115, 26, 82, 6, 0, (int)TextAlignment.Center, "ARIAL", 15, "Bold", "Normal", "#000000", "NORMAL (48 HORAS)");
                iTexto(doc, writer, 145, 35, 50, 6, 0, (int)TextAlignment.Center, "ARIAL", 15, "Bold", "Normal", "#000000", strOrdenCotizacion);

                //RECTANGULO IZQUIERDA
                iRectangle(doc, writer, 10, 50, 104, 26, 0, 4, 1);
                iTexto(doc, writer, 11, 51, 16, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "SEÑOR(ES)");
                iTexto(doc, writer, 28, 51, 75, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", ": " + strCliente);
                iTexto(doc, writer, 11, 58, 16, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "N° CEL");
                iTexto(doc, writer, 28, 58, 75, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", ": " + strCelular);
                iTexto(doc, writer, 11, 65, 16, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "VEHICULO");
                iTexto(doc, writer, 28, 65, 75, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", ": " + strVehiculo);
                //iTexto(doc, writer, 11, 72, 16, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "LOCALIDAD");
                //iTexto(doc, writer, 28, 72, 75, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", ": " + strLocalidad);

                //RECTANGULO DERECHA
                iRectangle(doc, writer, 115, 50, 82, 26, 0, 4, 1);
                iTexto(doc, writer, 116, 51, 20, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "USO");
                iTexto(doc, writer, 137, 51, 20, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", ": PARTICULAR");
                iTexto(doc, writer, 116, 58, 20, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "AÑO");
                iTexto(doc, writer, 137, 58, 18, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", ": " + strAno);
                iTexto(doc, writer, 116, 65, 20, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", "SUMA ASE");
                iTexto(doc, writer, 137, 65, 40, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Bold", "Normal", "#000000", ": " + strValor.Trim());

                //iTexto(doc, writer, 150, 51, 24, 3, 0, (int)TextAlignment.Right, "ARIAL", 8, "Normal", "Normal", "#000000", "FECHA:");
                //iTexto(doc, writer, 175, 51, 21, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", strFecha);
                //iTexto(doc, writer, 150, 58, 24, 3, 0, (int)TextAlignment.Right, "ARIAL", 8, "Normal", "Normal", "#000000", "PTO. VENTA:");
                //iTexto(doc, writer, 175, 58, 21, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", strPuntoVenta);
                //iTexto(doc, writer, 150, 65, 24, 3, 0, (int)TextAlignment.Right, "ARIAL", 8, "Normal", "Normal", "#000000", "OP:");
                //iTexto(doc, writer, 175, 65, 21, 3, 0, (int)TextAlignment.Left, "ARIAL", 8, "Normal", "Normal", "#000000", strIdOrden);

                //RECTANGULO DETALLE
                //iRectangle(doc, writer, 10, 79, 187, 165, 0, 4, 1); EL ORIGINAL
                iRectangle(doc, writer, 10, 79, 187, 40, 0, 4, 1);
                iRectangle(doc, writer, 10, 84, 187, 0, 0, 0, 0.5);

                iTexto(doc, writer, 11, 80, 05, 3, 0, (int)TextAlignment.Right, "ARIAL", 7, "Bold", "Normal", "#000000", "#");
                iTexto(doc, writer, 17, 80, 92, 3, 0, (int)TextAlignment.Left, "ARIAL", 7, "Bold", "Normal", "#000000", "RIMAC");
                iTexto(doc, writer, 69, 80, 30, 3, 0, (int)TextAlignment.Left, "ARIAL", 7, "Bold", "Normal", "#000000", "MAPFRE");
                iTexto(doc, writer, 110, 80, 39, 3, 0, (int)TextAlignment.Left, "ARIAL", 7, "Bold", "Normal", "#000000", "LA POSITIVA");
                iTexto(doc, writer, 147, 80, 17, 3, 0, (int)TextAlignment.Right, "ARIAL", 7, "Bold", "Normal", "#000000", "PACIFICO");
                iTexto(doc, writer, 174, 80, 17, 3, 0, (int)TextAlignment.Right, "ARIAL", 7, "Bold", "Normal", "#000000", "HDI");

                int    intItem = 1;
                double y       = 89; // inicio desde la ultima posicion
                double gps     = 95; // linea debajo de los precios

                //AGREGANDO EL DETALLE DE LOS PRECIO A CADA UNA DE LAS COMPANIAS
                iTexto(doc, writer, 17, y, 92, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", strRimacPrecio);
                iTexto(doc, writer, 69, y, 120, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", strMapfrePrecio);
                iTexto(doc, writer, 110, y, 135, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", strPositivaPrecio);
                iTexto(doc, writer, 147, y, 17, 3, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", strPacificoPrecio);
                iTexto(doc, writer, 174, y, 17, 3, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", strHDIPrecio);

                //AGREGANDO EL USO DE GPS POR COMPAÑIA
                iTexto(doc, writer, 17, gps, 92, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", "GPS: " + strGPSRimac);
                iTexto(doc, writer, 69, gps, 120, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", "GPS: " + strGPSMapfre);
                iTexto(doc, writer, 110, gps, 135, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", "GPS: " + strGPSPositiva);
                iTexto(doc, writer, 147, gps, 17, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", "GPS: " + strGPSPacifico);
                iTexto(doc, writer, 174, gps, 17, 3, 0, (int)TextAlignment.Left, "ARIAL", 9, "Bold", "Normal", "#000000", "GPS: " + strGPSHDI);



                //foreach (var Articulo in lbeCotizacionDetalleCliente)
                //{
                //    iTexto(doc, writer, 11, y, 05, 3, 0, (int)TextAlignment.Right, "ARIAL", 7, "Normal", "Normal", "#000000", intItem.ToString());
                //    iTexto(doc, writer, 17, y, 92, 3, 0, (int)TextAlignment.Left, "ARIAL", 7, "Normal", "Normal", "#000000", Articulo.vchDescripcionArticulo.Trim());
                //    iTexto(doc, writer, 81, y, 30, 3, 0, (int)TextAlignment.Left, "ARIAL", 7, "Normal", "Normal", "#000000", Articulo.intAlto.ToString("#0") + "CM * " + Articulo.intAncho.ToString("#0") + "COL");
                //    iTexto(doc, writer, 120, y, 39, 3, 0, (int)TextAlignment.Left, "ARIAL", 7, "Normal", "Normal", "#000000", Articulo.vchFechaPublicacion);
                //    iTexto(doc, writer, 147, y, 17, 3, 0, (int)TextAlignment.Right, "ARIAL", 7, "Normal", "Normal", "#000000", Articulo.decPrecioUnitario.ToString("#,##0.00###"));
                //    iTexto(doc, writer, 179, y, 17, 3, 0, (int)TextAlignment.Right, "ARIAL", 7, "Normal", "Normal", "#000000", Articulo.decMontoNeto.ToString("#,##0.00"));
                //    y = y + (3.5);
                //    if (oCotizacion.decMontoRecargo > 0)
                //    {
                //        iTexto(doc, writer, 17, y, 50, 3, 0, (int)TextAlignment.Left, "ARIAL", 7, "Normal", "Normal", "#000000", "Recargo");
                //        iTexto(doc, writer, 179, y, 17, 3, 0, (int)TextAlignment.Right, "ARIAL", 7, "Normal", "Normal", "#000000", Articulo.decMontoRecargo.ToString("#,##0.00###"));
                //        y = y + 3.5;
                //    }
                //    intItem++;
                //}


                //AGREGAR LOS BENEFICIOS Y COBERTURAS EN UNA IMAGEN
                //IMAGEN SLIP DESARROLLO
                //System.Drawing.Bitmap imagenCoberturas = new System.Drawing.Bitmap(@"F:\DigitalBrokers\Beneficios\Particular.jpg");

                //INICIO IMAGEN SLIP PRODUCCION DE ACUERDO AL TIPO
                //System.Drawing.Bitmap imagenCoberturas = null;
                //if (oCotizacion.UsoVehiculo == "PARTICULAR") {imagenCoberturas = new System.Drawing.Bitmap(@"G:/PleskVhosts/digitalbrokers.pe/Documentos/Beneficios/Particular.jpg"); }
                //if (oCotizacion.UsoVehiculo == "CHINOS") { imagenCoberturas = new System.Drawing.Bitmap(@"G:/PleskVhosts/digitalbrokers.pe/Documentos/Beneficios/Chinos.jpg"); }
                //if (oCotizacion.UsoVehiculo == "PICK UP") { imagenCoberturas = new System.Drawing.Bitmap(@"G:/PleskVhosts/digitalbrokers.pe/Documentos/Beneficios/PickUp.jpg"); }
                //if (oCotizacion.UsoVehiculo == "CHINOS PICK UP") { imagenCoberturas = new System.Drawing.Bitmap(@"G:/PleskVhosts/digitalbrokers.pe/Documentos/Beneficios/chinos.jpg"); }
                //cambio fabian
                System.Drawing.Bitmap imagenCoberturas = null;
                if (oCotizacion.UsoVehiculo == "PARTICULAR")
                {
                    imagenCoberturas = new System.Drawing.Bitmap(@"D:/trabajo/ROBERTO/2_Web.DigitalBrokers/Web.DigitalBrokers/Web.DigitalBrokers/documentos/Beneficios/Particular.jpg");
                }
                if (oCotizacion.UsoVehiculo == "CHINOS")
                {
                    imagenCoberturas = new System.Drawing.Bitmap(@"D:/trabajo/ROBERTO/2_Web.DigitalBrokers/Web.DigitalBrokers/Web.DigitalBrokers/documentos/Beneficios/Chinos.jpg");
                }
                if (oCotizacion.UsoVehiculo == "PICK UP")
                {
                    imagenCoberturas = new System.Drawing.Bitmap(@"D:/trabajo/ROBERTO/2_Web.DigitalBrokers/Web.DigitalBrokers/Web.DigitalBrokers/documentos/Beneficios/PickUp.jpg");
                }
                if (oCotizacion.UsoVehiculo == "CHINOS PICK UP")
                {
                    imagenCoberturas = new System.Drawing.Bitmap(@"D:/trabajo/ROBERTO/2_Web.DigitalBrokers/Web.DigitalBrokers/Web.DigitalBrokers/documentos/Beneficios/chinos.jpg");
                }


                System.Drawing.ImageConverter img2con = new System.Drawing.ImageConverter();
                byte[] byteImagen = (byte[])img2con.ConvertTo(imagenCoberturas, typeof(byte[]));
                iImage(doc, writer, 10, 120, 189, 100, 0, byteImagen);

                //FIN IMAGEN SLIP PRODUCCION DE ACUERDO AL TIPO

                //INICIO IMAGEN PROMOCIONAL DIGITAL BROKERS
                System.Drawing.Bitmap imgPublicidad = null;
                imgPublicidad = new System.Drawing.Bitmap(@"D:/trabajo/ROBERTO/2_Web.DigitalBrokers/Web.DigitalBrokers/Web.DigitalBrokers/documentos/Beneficios/Publicidad_GEN.jpg");

                System.Drawing.ImageConverter imgPublicidadAdd = new System.Drawing.ImageConverter();
                byte[] byteImagenPub = (byte[])imgPublicidadAdd.ConvertTo(imgPublicidad, typeof(byte[]));
                iImage(doc, writer, 10, 222, 189, 20, 0, byteImagenPub);
                //FIN IMAGEN PROMOCIONAL DIGITAL BROKERS



                //RECTANGULO ABAJO CONSOLIDADO
                iRectangle(doc, writer, 10, 245, 187, 30, 0, 4, 1);
                //Linea vertical
                iRectangle(doc, writer, 145, 245, 0, 30, 0, 0, 0.5);
                //Lineas horizontales
                iRectangle(doc, writer, 145, 255, 52, 0, 0, 0, 0.5);
                iRectangle(doc, writer, 145, 265, 52, 0, 0, 0, 0.5);

                //iTexto(doc, writer, 149, 248, 27, 4, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", "SUBTOTAL S/");
                //iTexto(doc, writer, 180, 248, 16, 4, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", strSubTotal);
                //iTexto(doc, writer, 149, 258, 27, 4, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", "I.G.V. (18% ) S/");
                //iTexto(doc, writer, 180, 258, 16, 4, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", strIgv);
                //iTexto(doc, writer, 149, 268, 27, 4, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", "TOTAL S/");
                //iTexto(doc, writer, 180, 268, 16, 4, 0, (int)TextAlignment.Right, "ARIAL", 9, "Bold", "Normal", "#000000", strTotal);

                //TEXTO DE COTIZACION
                iTexto(doc, writer, 13, 251, 180, 3, 0, (int)TextAlignment.Left, "ARIAL", 12, "Bold", "Normal", "#000000", "Esta cotización tiene una vigencia de 7 días calendario");

                doc.Close();
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Example #5
0
        public List <ENCotizacion> GetCotizacionesDashboardFiltro(SqlConnection con, string FechaInicio, string FechaFin)
        {
            List <ENCotizacion> lbeCotizaciones = null;
            SqlCommand          cmd             = new SqlCommand("DBPESPS_Admin_GETCotizacionesFiltro", con);

            cmd.CommandType = CommandType.StoredProcedure;

            //ARGUMENTOS DE PROCEDURE
            DbParameter param = cmd.CreateParameter();

            param.DbType        = DbType.String;
            param.ParameterName = "@FechaInicio";
            param.Value         = FechaInicio;
            cmd.Parameters.Add(param);

            DbParameter param2 = cmd.CreateParameter();

            param2.DbType        = DbType.String;
            param2.ParameterName = "@FechaFin";
            param2.Value         = FechaInicio;
            cmd.Parameters.Add(param2);

            SqlDataReader drd = cmd.ExecuteReader(CommandBehavior.SingleResult);

            if (drd != null)
            {
                lbeCotizaciones = new List <ENCotizacion>();
                ENCotizacion obeCotizacion;
                while (drd.Read())
                {
                    obeCotizacion = new ENCotizacion();
                    if (!drd.IsDBNull(0))
                    {
                        obeCotizacion.idCotizacion = drd.GetInt32(0);
                    }
                    ;
                    if (!drd.IsDBNull(1))
                    {
                        obeCotizacion.idMarca = drd.GetInt32(1);
                    }
                    ;
                    if (!drd.IsDBNull(2))
                    {
                        obeCotizacion.idModelo = drd.GetInt32(2);
                    }
                    ;
                    if (!drd.IsDBNull(3))
                    {
                        obeCotizacion.Anio = drd.GetString(3);
                    }
                    ;
                    if (!drd.IsDBNull(4))
                    {
                        obeCotizacion.ValorReferencial = drd.GetDecimal(4);
                    }
                    ;
                    if (!drd.IsDBNull(5))
                    {
                        obeCotizacion.UsoVehiculo = drd.GetString(5);
                    }
                    ;
                    if (!drd.IsDBNull(6))
                    {
                        obeCotizacion.Descripcion_Modelo = drd.GetString(6);
                    }
                    ;
                    if (!drd.IsDBNull(7))
                    {
                        obeCotizacion.Mail_Cliente = drd.GetString(7);
                    }
                    ;
                    if (!drd.IsDBNull(8))
                    {
                        obeCotizacion.TelefonoCliente = drd.GetString(8);
                    }
                    ;
                    if (!drd.IsDBNull(9))
                    {
                        obeCotizacion.RIMAC_Categoria = drd.GetString(9);
                    }
                    ;
                    if (!drd.IsDBNull(10))
                    {
                        obeCotizacion.POSITIVA_Categoria = drd.GetString(10);
                    }
                    ;
                    if (!drd.IsDBNull(11))
                    {
                        obeCotizacion.PACIFICO_Categoria = drd.GetString(11);
                    }
                    ;
                    if (!drd.IsDBNull(12))
                    {
                        obeCotizacion.MAPFRE_Categoria = drd.GetString(12);
                    }
                    ;
                    if (!drd.IsDBNull(13))
                    {
                        obeCotizacion.HDI_Categoria = drd.GetString(13);
                    }
                    ;
                    if (!drd.IsDBNull(14))
                    {
                        obeCotizacion.FechaCreacion = drd.GetDateTime(14);
                    }
                    ;
                    lbeCotizaciones.Add(obeCotizacion);
                }
                drd.Close();
            }
            return(lbeCotizaciones);
        }
Example #6
0
        public ENCotizacion GetCotizacionCabecera(SqlConnection con, int idCotizacion)
        {
            ENCotizacion obeCotizacion = new ENCotizacion();
            SqlCommand   cmd           = new SqlCommand("DBPESPS_GetCotizacioncabecera", con);

            cmd.CommandType = CommandType.StoredProcedure;

            //ARGUMENTOS DE PROCEDURE
            DbParameter param = cmd.CreateParameter();

            param.DbType        = DbType.Int32;
            param.ParameterName = "@idCotizacion";
            param.Value         = idCotizacion;
            cmd.Parameters.Add(param);



            SqlDataReader drd = cmd.ExecuteReader(CommandBehavior.SingleResult);

            if (drd != null)
            {
                while (drd.Read())
                {
                    if (!drd.IsDBNull(0))
                    {
                        obeCotizacion.idCotizacion = drd.GetInt32(0);
                    }
                    ;
                    if (!drd.IsDBNull(1))
                    {
                        obeCotizacion.idMarca = drd.GetInt32(1);
                    }
                    ;
                    if (!drd.IsDBNull(2))
                    {
                        obeCotizacion.idModelo = drd.GetInt32(2);
                    }
                    ;
                    if (!drd.IsDBNull(3))
                    {
                        obeCotizacion.Anio = drd.GetString(3);
                    }
                    ;
                    if (!drd.IsDBNull(4))
                    {
                        obeCotizacion.ValorReferencial = drd.GetDecimal(4);
                    }
                    ;
                    if (!drd.IsDBNull(5))
                    {
                        obeCotizacion.UsoVehiculo = drd.GetString(5);
                    }
                    ;
                    if (!drd.IsDBNull(6))
                    {
                        obeCotizacion.Descripcion_Modelo = drd.GetString(6);
                    }
                    ;
                    if (!drd.IsDBNull(7))
                    {
                        obeCotizacion.Mail_Cliente = drd.GetString(7);
                    }
                    ;
                    if (!drd.IsDBNull(8))
                    {
                        obeCotizacion.TelefonoCliente = drd.GetString(8);
                    }
                    ;
                    if (!drd.IsDBNull(9))
                    {
                        obeCotizacion.RIMAC_Categoria = drd.GetString(9);
                    }
                    ;
                    if (!drd.IsDBNull(10))
                    {
                        obeCotizacion.POSITIVA_Categoria = drd.GetString(10);
                    }
                    ;
                    if (!drd.IsDBNull(11))
                    {
                        obeCotizacion.PACIFICO_Categoria = drd.GetString(11);
                    }
                    ;
                    if (!drd.IsDBNull(12))
                    {
                        obeCotizacion.MAPFRE_Categoria = drd.GetString(12);
                    }
                    ;
                    if (!drd.IsDBNull(13))
                    {
                        obeCotizacion.HDI_Categoria = drd.GetString(13);
                    }
                    ;
                }
                drd.Close();
            }
            return(obeCotizacion);
        }
Example #7
0
        //Admin
        public List <ENCotizacion> GetCotizacionesDashboard(SqlConnection con)
        {
            List <ENCotizacion> lbeCotizaciones = null;
            SqlCommand          cmd             = new SqlCommand("DBPESPS_GetCotizacionesAll", con);

            cmd.CommandType = CommandType.StoredProcedure;



            SqlDataReader drd = cmd.ExecuteReader(CommandBehavior.SingleResult);

            if (drd != null)
            {
                lbeCotizaciones = new List <ENCotizacion>();
                ENCotizacion obeCotizacion;
                while (drd.Read())
                {
                    obeCotizacion = new ENCotizacion();
                    if (!drd.IsDBNull(0))
                    {
                        obeCotizacion.idCotizacion = drd.GetInt32(0);
                    }
                    ;
                    if (!drd.IsDBNull(1))
                    {
                        obeCotizacion.idMarca = drd.GetInt32(1);
                    }
                    ;
                    if (!drd.IsDBNull(2))
                    {
                        obeCotizacion.idModelo = drd.GetInt32(2);
                    }
                    ;
                    if (!drd.IsDBNull(3))
                    {
                        obeCotizacion.Anio = drd.GetString(3);
                    }
                    ;
                    if (!drd.IsDBNull(4))
                    {
                        obeCotizacion.ValorReferencial = drd.GetDecimal(4);
                    }
                    ;
                    if (!drd.IsDBNull(5))
                    {
                        obeCotizacion.UsoVehiculo = drd.GetString(5);
                    }
                    ;
                    if (!drd.IsDBNull(6))
                    {
                        obeCotizacion.Descripcion_Modelo = drd.GetString(6);
                    }
                    ;
                    if (!drd.IsDBNull(7))
                    {
                        obeCotizacion.Mail_Cliente = drd.GetString(7);
                    }
                    ;
                    if (!drd.IsDBNull(8))
                    {
                        obeCotizacion.TelefonoCliente = drd.GetString(8);
                    }
                    ;
                    if (!drd.IsDBNull(9))
                    {
                        obeCotizacion.RIMAC_Categoria = drd.GetString(9);
                    }
                    ;
                    if (!drd.IsDBNull(10))
                    {
                        obeCotizacion.POSITIVA_Categoria = drd.GetString(10);
                    }
                    ;
                    if (!drd.IsDBNull(11))
                    {
                        obeCotizacion.PACIFICO_Categoria = drd.GetString(11);
                    }
                    ;
                    if (!drd.IsDBNull(12))
                    {
                        obeCotizacion.MAPFRE_Categoria = drd.GetString(12);
                    }
                    ;
                    if (!drd.IsDBNull(13))
                    {
                        obeCotizacion.HDI_Categoria = drd.GetString(13);
                    }
                    ;
                    if (!drd.IsDBNull(14))
                    {
                        obeCotizacion.FechaCreacion = drd.GetDateTime(14);
                    }
                    ;
                    lbeCotizaciones.Add(obeCotizacion);
                }
                drd.Close();
            }
            return(lbeCotizaciones);
        }