Example #1
0
        private DTOnextBus notificacionProximidad2(EParada Eparada, int viaje, TimeSpan hora)
        {
            int     Parada = Eparada.IdParada;
            ESalida salida = iSalida.getSalidas(iViaje.getViaje(viaje).IdSalida);

            string matric = iVehiculo.getVehiculos(salida.IdVehiculo).Matricula;


            DTOnextBus nextBus = new DTOnextBus();

            if (isFinalParada(Parada, viaje))
            {
                nextBus.matricula = "N/A";
                nextBus.parada    = "N/A";
                nextBus.hora      = "N/A";
                return(nextBus);
            }
            int idNextP = nextParadaNot(Parada, viaje);

            int      tiempo  = iTramo.getTramos(salida.IdLinea, idNextP).TiempoEstimado;
            TimeSpan minutes = TimeSpan.FromMinutes(tiempo);

            string horastr = hora.Add(minutes).ToString();

            nextBus.parada    = iParada.getParada(idNextP).Nombre;
            nextBus.matricula = matric;
            nextBus.hora      = horastr;

            return(nextBus);
        }
Example #2
0
        public EVehiculo getVehiculo(string matricula)
        {
            EVehiculo ev = iVehiculo.getVehiculos(matricula);

            ev.Salida = new List <ESalida>();
            return(ev);
        }
Example #3
0
        public List <DTOubicacion> ubicarVehiculo()
        {
            List <DTOubicacion> lstDto = new List <DTOubicacion>();

            List <ELlegada> lstLL = iLlegada.getAllLlegadas();

            foreach (var l in lstLL)
            {
                DTOubicacion dtou = new DTOubicacion();

                dtou.matricula = iVehiculo.getVehiculos(iSalida.getSalidas(iViaje.getViaje(l.idViaje).IdSalida).IdVehiculo).Matricula;
                dtou.lat       = iParada.getParada(l.idParada).Lat;
                dtou.lon       = iParada.getParada(l.idParada).Long;
                dtou.hora      = l.hora;
                dtou.fecha     = l.fecha;
                lstDto.Add(dtou);
            }

            List <string> matriculas = new List <string>();

            foreach (var dtoo in lstDto)
            {
                matriculas.Add(dtoo.matricula);
            }
            List <string> matriculasUncas = matriculas.Distinct().ToList();

            List <DTOubicacion> lstdtoFinal = new List <DTOubicacion>();

            foreach (var matU in matriculasUncas)
            {
                DTOubicacion ultimaFechaYHoras = ultimaFechaYHora(matU, lstDto);
                lstdtoFinal.Add(ultimaFechaYHoras);
            }

            return(lstdtoFinal);
        }
Example #4
0
        private MemoryStream getPdfconQR(string IDPasaje, EPersona epersona, EPasaje epasaje, int costo)
        {
            string orign       = iParada.getParada(epasaje.IdParadaOrigen).Nombre;
            string destino     = iParada.getParada(epasaje.IdParadaDestino).Nombre;
            string linea       = iLinea.getLinea(iSalida.getSalidas(iViaje.getViaje(epasaje.IdViaje).IdSalida).IdLinea).Nombre;
            string matricula   = iVehiculo.getVehiculos(iSalida.getSalidas(iViaje.getViaje(epasaje.IdViaje).IdSalida).IdVehiculo).Matricula;
            string fechaViajeL = iViaje.getViaje(epasaje.IdViaje).Fecha.ToString();

            string fechaViaje = fechaViajeL;
            int    index      = fechaViaje.IndexOf(" ");

            if (index > 0)
            {
                fechaViaje = fechaViaje.Substring(0, index);
            }



            string hora = iSalida.getSalidas(iViaje.getViaje(epasaje.IdViaje).IdSalida).HoraInicio.ToString();

            Document doc = new Document(PageSize.A5, 18, 18, 16, 0);

            MemoryStream ms  = new MemoryStream();
            PdfWriter    pdf = PdfWriter.GetInstance(doc, ms);

            //PdfWriter.GetInstance(doc, new FileStream(outputFile, FileMode.Create));

            doc.Open();
            BarcodeQRCode barcodeWrcode = new BarcodeQRCode(IDPasaje, 1000, 1000, null);
            Image         codeQRImga    = barcodeWrcode.GetImage();

            codeQRImga.ScaleAbsolute(200, 200);


            ////string outputFile2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), @"pdf", "uybus.png");
            //string outputFile2 = Path.Combine(Environment.CurrentDirectory, @"..\..\..\BuisnessLayer\pdf\uybus.png");

            //Image image = Image.GetInstance(outputFile2);
            //image.ScaleAbsoluteHeight(42.0f * 1.88f);
            //image.ScaleAbsoluteWidth(185.2f * 2.07f);
            //image.Alignment = Element.ALIGN_CENTER;
            //doc.Add(image);


            BaseFont bf = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.WINANSI, BaseFont.EMBEDDED);

            Font      fontText = new Font(bf, 20, 0, BaseColor.BLACK);
            Paragraph par1     = new Paragraph("Estimado pasajero, ha recibido su pasaje.", fontText);

            par1.Alignment = Element.ALIGN_CENTER;
            doc.Add(par1);

            Font fontText2 = new Font(bf, 15, 0, BaseColor.BLACK);

            Paragraph par0 = new Paragraph("UruguayBus 2020 le desea buen viaje.", fontText2);

            par0.Alignment = Element.ALIGN_CENTER;
            doc.Add(par0);

            Paragraph p = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLACK, Element.ALIGN_LEFT, 1)));

            doc.Add(p);

            DateTime ahora = DateTime.Now;

            ahora = ahora.Subtract(new TimeSpan(03, 0, 0)); // seteo tiempo a estedos unidos

            Paragraph paragraphs = new Paragraph(new Phrase("Enviado: " + ahora));

            paragraphs.Alignment = Element.ALIGN_RIGHT;
            doc.Add(paragraphs);

            doc.Add(new Paragraph("Pasajero: " + epersona.pNombre + " " + epersona.pApellido));
            doc.Add(new Paragraph("Documento: " + epersona.Documento));
            if (epasaje.Asientos != null)
            {
                if (epasaje.Asientos != -1)
                {
                    doc.Add(new Paragraph("Asiento: " + epasaje.Asientos));
                }
            }

            doc.Add(new Paragraph("Linea: " + linea));
            doc.Add(new Paragraph("Origen: " + orign));
            doc.Add(new Paragraph("Destino: " + destino));
            doc.Add(new Paragraph("Salida: " + fechaViaje + " " + hora));
            doc.Add(new Paragraph("Matricula: " + matricula));



            doc.Add(new Paragraph("Costo: " + costo + " UYU"));

            //doc.Add(new Chunk("\n"));

            Paragraph p3 = new Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLACK, Element.ALIGN_LEFT, 1)));

            doc.Add(p3);

            Font fontText4 = new Font(bf, 10, 0, BaseColor.BLACK);

            doc.Add(new Paragraph("Presente el siguiente código QR al chofer.", fontText4));


            codeQRImga.Alignment = Element.ALIGN_CENTER;
            doc.Add(codeQRImga);

            pdf.CloseStream = false;
            doc.Close();
            ms.Position = 0;

            return(ms);
        }