Ejemplo n.º 1
0
        public string BookFlight(FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo)
        {
            //create barcodes for departure and arrival
            BarCode barcode           = new BarCode(path);
            string  barcodeFileLeave  = barcode.CreateBarCode(flightInfo.FlightNumberLeave + passengerInfo.SeatNumber, false);
            string  barcodeFileReturn = barcode.CreateBarCode(flightInfo.FlightNumberReturn + passengerInfo.SeatNumber, true);


            //based on flightinfo and passengerinfo create PDF ticket
            Aspose.Pdf.Generator.Pdf pdf;
            Ticket ticket = new Ticket(path);

            pdf = ticket.GetTicket(passengerInfo, flightInfo, bookingInfo);
            string fileName = "Ticket_" + flightInfo.DepartureLocation + "_" + flightInfo.Destination + ".pdf";

            pdf.Save(path + "\\" + fileName);


            //send email to passenger at his/her email address
            Email  email       = new Email(path);
            string messageBody = "Hi " + passengerInfo.Name + ",<br/>";

            messageBody += "Please find attached your ticket for " + flightInfo.DepartureLocation + " to " + flightInfo.Destination + "<br/><br/>";
            messageBody += "Thank you for traveling with FlyNow Airline.<br/>";
            email.SendEmail(passengerInfo.Name, passengerInfo.Email, "Ticket " + flightInfo.DepartureLocation + " to " + flightInfo.Destination, messageBody, path + "\\" + fileName);


            //if everything successful send a success message else sorry message and try again message.
            return("Booking successful. Ticket is sent via email");
        }
Ejemplo n.º 2
0
        public string BookFlight(FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo)
        {

            //create barcodes for departure and arrival
            BarCode barcode = new BarCode(path);
            string barcodeFileLeave = barcode.CreateBarCode(flightInfo.FlightNumberLeave + passengerInfo.SeatNumber, false);
            string barcodeFileReturn = barcode.CreateBarCode(flightInfo.FlightNumberReturn + passengerInfo.SeatNumber, true);


            //based on flightinfo and passengerinfo create PDF ticket
            Aspose.Pdf.Generator.Pdf pdf;
            Ticket ticket = new Ticket(path);
            pdf = ticket.GetTicket(passengerInfo,flightInfo, bookingInfo);
            string fileName = "Ticket_" + flightInfo.DepartureLocation + "_" + flightInfo.Destination + ".pdf";
            pdf.Save(path + "\\" + fileName);
           
                      
            //send email to passenger at his/her email address
            Email email = new Email(path);
            string messageBody = "Hi " + passengerInfo.Name  + ",<br/>";
            messageBody += "Please find attached your ticket for " + flightInfo.DepartureLocation + " to " + flightInfo.Destination + "<br/><br/>";
            messageBody += "Thank you for traveling with FlyNow Airline.<br/>";
            email.SendEmail(passengerInfo.Name, passengerInfo.Email, "Ticket " + flightInfo.DepartureLocation + " to " + flightInfo.Destination, messageBody, path + "\\" + fileName);


            //if everything successful send a success message else sorry message and try again message. 
            return "Booking successful. Ticket is sent via email";
        }