示例#1
0
        private void PutAdress(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo)
        {
            //create table to add address of the customer
            Table adressTable = new Table();
            adressTable.IsFirstParagraph = true;
            adressTable.ColumnWidths = "60 180 60 180";
            adressTable.DefaultCellTextInfo.FontSize = 10;
            adressTable.DefaultCellTextInfo.LineSpacing = 3;
            adressTable.DefaultCellPadding.Bottom = 3;
            //add this table in the first section/page
            Section section = pdf.Sections[0];
            section.Paragraphs.Add(adressTable);
            //add a new row in the table
            Row row1AdressTable = new Row(adressTable);
            adressTable.Rows.Add(row1AdressTable);
            //add cells and text
            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.Color = new Aspose.Pdf.Generator.Color(111, 146, 188);
            tf1.FontName = "Helvetica-Bold";

            row1AdressTable.Cells.Add("Bill To:", tf1);
            row1AdressTable.Cells.Add(passengerInfo.Name + "#$NL" +
                passengerInfo.Address + "#$NL" + passengerInfo.Email + "#$NL" +
                passengerInfo.PhoneNumber);

        }
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,DateOfBirth,Passport,LoyalMemberId,UseLoyalMember")] PassengerInfo passengerInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(passengerInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(passengerInfo));
        }
        public ActionResult Create([Bind(Include = "PassengerId,PassengerName,Gender,CellNo,PermenantAddress")] PassengerInfo passengerInfo)
        {
            if (ModelState.IsValid)
            {
                db.PassengerInfoes.Add(passengerInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(passengerInfo));
        }
示例#4
0
        private void PutOrder(Aspose.Pdf.Generator.Pdf pdf, FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo)
        {
            //add customer address at the top
            PutAdress(pdf, passengerInfo);
            //add order summary
            PutSummary(pdf, passengerInfo, flightInfo);
            //create a table and add order details in row(s)
            Table table = AddTable(pdf);

            AddRow(pdf, table, flightInfo);
            PutAmount(pdf, flightInfo.Fare, 0);
        }
示例#5
0
        public Result Execute(Guid tripId, Guid userId)
        {
            var trip = _tripRepository.Get(tripId);
            var user = _userRepository.Get(userId);

            var passengerInfo = new PassengerInfo(trip, user);

            trip.AddPassenger(passengerInfo);

            _unitOfWork.Save();

            return(Result.Ok());
        }
示例#6
0
        private void PutOrder(Aspose.Pdf.Generator.Pdf pdf, FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo)
        {

            //add customer address at the top       
            PutAdress(pdf, passengerInfo);
            //add order summary
            PutSummary(pdf, passengerInfo, flightInfo);
            //create a table and add order details in row(s)
            Table table = AddTable(pdf);
            AddRow(pdf, table, flightInfo);
            PutAmount(pdf, flightInfo.Fare, 0);
           

        }
        // GET: PassengerInfoes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PassengerInfo passengerInfo = db.PassengerInfoes.Find(id);

            if (passengerInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(passengerInfo));
        }
        public ActionResult Create([Bind(Include = "PassengerID,FirstName,LastName,DateOfBirth,Age,PhoneNumber,Email,passportNo,ImageUrl")] PassengerInfo passengerInfo, HttpPostedFileBase ImageFileCreate)
        {
            if (ModelState.IsValid)
            {
                ImageFileCreate.SaveAs(Server.MapPath("~/Images/Passenger") + "/" + ImageFileCreate.FileName);
                string filePath = "~/Images/Passenger/" + ImageFileCreate.FileName;
                passengerInfo.ImageUrl = filePath;
                db.PassengerInfoes.Add(passengerInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(passengerInfo));
        }
        public ActionResult Edit([Bind(Include = "PassengerID,FirstName,LastName,DateOfBirth,Age,PhoneNumber,Email,passportNo,ImageUrl")] PassengerInfo passengerInfo, HttpPostedFileBase ImageFileCreate)
        {
            if (ImageFileCreate.ContentLength > 0 && ModelState.IsValid)
            {
                System.IO.File.Delete(Server.MapPath(passengerInfo.ImageUrl));

                ImageFileCreate.SaveAs(Server.MapPath("~/Images/Passenger") + "/" + ImageFileCreate.FileName);
                string filePath = "~/Images/Passenger/" + ImageFileCreate.FileName;
                passengerInfo.ImageUrl        = filePath;
                db.Entry(passengerInfo).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(passengerInfo));
        }
        private List<PassengerInfo> getPassengers(int iCount)
        {
            List<PassengerInfo> pList = new List<PassengerInfo>();

            PassengerInfo pInfo;
            for (int i = 0; i < iCount; i++)
            {
                pInfo = new PassengerInfo();
                pInfo.passengerName = "Test" + i;
                pInfo.passportNo = "XYZ" + i + new Random().Next();
                pInfo.expiryDate = DateTime.Now.AddDays(120);
                pList.Add(pInfo);
            }

            return pList;
        }
示例#11
0
    private void StartMove()
    {
        int rightDoor = Randomizer.GetInRange(0, 2);

        if (rightDoor == 0)
        {
            _target = GameObject.Find("door1").transform.position;
        }
        else
        {
            _target = GameObject.Find("door2").transform.position;
        }
        _info        = new PassengerInfo(name);
        _velocity    = _info.Velocity;
        _moveStarted = true;
    }
        private void button2_Click(object sender, EventArgs e)
        {
            string   name     = txtName.Text;
            string   passport = txtPassport.Text;
            DateTime expiry   = dtpExpiry.Value;

            PassengerInfo passengerInfo = new PassengerInfo();

            passengerInfo.passengerName = name;
            passengerInfo.passportNo    = passport;
            passengerInfo.expiryDate    = expiry;

            _dictPassengers.Add(name, passengerInfo);

            lbPassenger.Items.Add(name);
        }
 public IActionResult Create([Bind("PassengerID,FirstName,LastName,DateOfBirth,Age,PhoneNumber,Email,passportNo,ImageUrl")] PassengerInfo passengerInfo, IFormFile formFile)
 {
     if (ModelState.IsValid)
     {
         string imagePath = _env.WebRootPath + "\\images\\passenger\\" + formFile.FileName;
         using (var stream = new FileStream(imagePath, FileMode.Create))
         {
             formFile.CopyTo(stream);
         }
         passengerInfo.ImageUrl = "~/images/passenger/" + formFile.FileName;
         _context.passengerInfoes.Add(passengerInfo);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(passengerInfo));
 }
        private List <PassengerInfo> getPassengers(int iCount)
        {
            List <PassengerInfo> pList = new List <PassengerInfo>();

            PassengerInfo pInfo;

            for (int i = 0; i < iCount; i++)
            {
                pInfo = new PassengerInfo();
                pInfo.passengerName = "Test" + i;
                pInfo.passportNo    = "XYZ" + i + new Random().Next();
                pInfo.expiryDate    = DateTime.Now.AddDays(120);
                pList.Add(pInfo);
            }

            return(pList);
        }
示例#15
0
        //network need it to resore
        public void Import(byte[] data)
        {
            PETools.Serialize.Import(data, (r) =>
            {
                saveVersion = r.ReadInt32();

                int count = r.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Railway.Point point = Point.Deserialize(PETools.Serialize.ReadBytes(r));

                    mPointDic[point.id] = point;
                }

                count = r.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Railway.Route route = Railway.Route.Deserialize(PETools.Serialize.ReadBytes(r));

                    mRouteList.Add(route);
                }
                //-----------
                if (saveVersion >= Version4)
                {
                    StroyManager.m_Passengers.Clear();
                    int n = r.ReadInt32();
                    byte[] buff;
                    for (int i = 0; i < n; i++)
                    {
                        buff             = PETools.Serialize.ReadBytes(r);
                        PassengerInfo pi = new PassengerInfo();
                        pi.Import(buff);

                        StroyManager.m_Passengers.Add(pi.npcID, pi);
                    }
                }
            });

            foreach (Point point in mPointDic.Values)
            {
                point.UpdateLinkTarget();
            }
        }
示例#16
0
        public Aspose.Pdf.Generator.Pdf GetInvoice(FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo)
        {
            //create a Pdf object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            pdf.IsTruetypeFontMapCached = false;

            //bind XML file
            string xmlFile = path + "\\Invoice.xml";
            pdf.BindXML(xmlFile, null);

            //create header
            HeaderFooter headerFooter = pdf.Sections[0].OddHeader;
            Image logoImage = (Image)headerFooter.Paragraphs[0];
            logoImage.ImageInfo.File = path + "\\flynowairlinelogoandinvoice.jpg";
            logoImage.ImageScale = 0.74F;

            //call the method to create invoice
            PutOrder(pdf, flightInfo, passengerInfo, bookingInfo);

            return pdf;
        }
示例#17
0
        public ActionResult SearchTicket(PassengerInfo passenger)
        {
            string        conString  = ConfigurationManager.ConnectionStrings["dataConnection"].ConnectionString;
            SqlConnection connection = new SqlConnection(conString);

            try
            {
                connection.Open();
            }
            catch (Exception ex)
            {
                Response.Write("error" + ex.ToString());
                connection.Close();
                return(null);
            }

            if (passenger.TCKN != null)
            {
                string     cmdString1 = "TicketInfo";
                SqlCommand cmd1       = new SqlCommand(cmdString1, connection);
                cmd1.CommandType = System.Data.CommandType.StoredProcedure;
                cmd1.Parameters.AddWithValue("@TCKN", passenger.TCKN);
                SqlDataReader sqlDataReader = cmd1.ExecuteReader();

                while (sqlDataReader.Read())
                {
                    ViewBag.TCKN          = sqlDataReader["PassengerTCKN"];
                    ViewBag.gender        = (string)sqlDataReader["Gender"].ToString();
                    ViewBag.luggageWeight = (int)sqlDataReader["LuggageWeight"];
                    ViewBag.FlightID      = (string)sqlDataReader["PFlightID"];
                    ViewBag.TicketID      = (string)sqlDataReader["TicketID"];
                    ViewBag.Name          = (string)sqlDataReader["name"];
                    ViewBag.price         = sqlDataReader["price"];
                    ViewBag.type          = (string)sqlDataReader["TicketType"];
                }
            }


            return(View());
        }
        public async Task <IActionResult> Edit(int id, [Bind("PassengerID,FirstName,LastName,DateOfBirth,Age,PhoneNumber,Email,passportNo,ImageUrl")] PassengerInfo passengerInfo, IFormFile formFile)
        {
            if (id != passengerInfo.PassengerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    string imagePath = _env.WebRootPath + "\\images\\passenger\\" + formFile.FileName;
                    using (var stream = new FileStream(imagePath, FileMode.Create))
                    {
                        formFile.CopyTo(stream);
                    }
                    passengerInfo.ImageUrl = "~/images/passenger/" + formFile.FileName;
                    _context.passengerInfoes.Add(passengerInfo);



                    _context.Update(passengerInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PassengerInfoExists(passengerInfo.PassengerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(passengerInfo));
        }
示例#19
0
        public Aspose.Pdf.Generator.Pdf GetInvoice(FlightInfo flightInfo, PassengerInfo passengerInfo, BookingInfo bookingInfo)
        {
            //create a Pdf object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            pdf.IsTruetypeFontMapCached = false;

            //bind XML file
            string xmlFile = path + "\\Invoice.xml";

            pdf.BindXML(xmlFile, null);

            //create header
            HeaderFooter headerFooter = pdf.Sections[0].OddHeader;
            Image        logoImage    = (Image)headerFooter.Paragraphs[0];

            logoImage.ImageInfo.File = path + "\\flynowairlinelogoandinvoice.jpg";
            logoImage.ImageScale     = 0.74F;

            //call the method to create invoice
            PutOrder(pdf, flightInfo, passengerInfo, bookingInfo);

            return(pdf);
        }
示例#20
0
        private void PutSummary(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, FlightInfo flightInfo)
        {
            //create a  table to hold summary of the order
            Table summaryTable = new Table();

            Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188);
            summaryTable.Margin.Top   = 20;
            summaryTable.ColumnWidths = "60 80 80 80 80 80";
            summaryTable.DefaultCellTextInfo.FontSize = 10;
            summaryTable.DefaultCellBorder            = new BorderInfo((int)BorderSide.All, color);
            summaryTable.DefaultCellPadding.Bottom    = summaryTable.DefaultCellPadding.Top = 3;
            //add table to the first section/page
            Section section = pdf.Sections[0];

            section.Paragraphs.Add(summaryTable);
            //create row and add cells and contents
            Row row1SummaryTable = summaryTable.Rows.Add();

            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize  = 10;
            tf1.Color     = new Aspose.Pdf.Generator.Color("White");
            tf1.FontName  = "Helvetica-Bold";
            tf1.Alignment = AlignmentType.Center;
            Cell cell1Row1SummaryTable = row1SummaryTable.Cells.Add("Order ID", tf1);

            cell1Row1SummaryTable.BackgroundColor = color;

            Cell cell2Row1SummaryTable = row1SummaryTable.Cells.Add("Customer ID", tf1);

            cell2Row1SummaryTable.BackgroundColor = color;

            Cell cell3Row1SummaryTable = row1SummaryTable.Cells.Add("Agent ID", tf1);

            cell3Row1SummaryTable.BackgroundColor = color;

            Cell cell4Row1SummaryTable = row1SummaryTable.Cells.Add("Sales Person", tf1);

            cell4Row1SummaryTable.BackgroundColor = color;

            Cell cell5Row1SummaryTable = row1SummaryTable.Cells.Add("Required Date", tf1);

            cell5Row1SummaryTable.BackgroundColor = color;

            Cell cell6Row1SummaryTable = row1SummaryTable.Cells.Add("Shipped Date", tf1);

            cell6Row1SummaryTable.BackgroundColor = color;


            Row row2SummaryTable = summaryTable.Rows.Add();

            tf1           = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize  = 9;
            tf1.Color     = new Aspose.Pdf.Generator.Color("Black");
            tf1.FontName  = "Times-Roman";
            tf1.Alignment = AlignmentType.Center;

            row2SummaryTable.Cells.Add("90234", tf1);
            row2SummaryTable.Cells.Add("3762", tf1);
            row2SummaryTable.Cells.Add("AU89", tf1);
            row2SummaryTable.Cells.Add("James Smith", tf1);
            row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1);
            row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1);
        }
        private void button4_Click(object sender, EventArgs e)
        {
            if (_dictPassengers.Count > 0)
            {
                DateTime flightDepartureDate = (DateTime)dgvFlightInformation["DepartureTime", dgvFlightInformation.CurrentRow.Index].Value;

                string from = (string)cmbFrom.SelectedValue;
                string to   = (string)cmbTo.SelectedValue;

                PassengerInfo[] passengers = new PassengerInfo[_dictPassengers.Count];
                int             i          = 0;
                Dictionary <string, PassengerInfo> .Enumerator enumerator = _dictPassengers.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    passengers[i++] = enumerator.Current.Value;
                }

                PaymentInfo payment = new PaymentInfo();
                payment.cardholdername = txtHolderName.Text;
                payment.cardname       = txtCardName.Text;
                payment.cv2            = txtCardPin.Text;
                payment.expiryDate     = dtpCardExpiry.Value;

                FBooking.FlightBookingServiceClient flightBooking = new FlightBookingServiceClient();

                try
                {
                    if (flightBooking.checkAvailability(from, to, flightDepartureDate, passengers.Length))
                    {
                        MessageBox.Show("Seats Available...");

                        if (flightBooking.makeReservation(from, to, flightDepartureDate, passengers, payment))
                        {
                            MessageBox.Show("Successfully reserved...");
                        }
                        else
                        {
                            MessageBox.Show("Reservation unsuccessful...");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Seats Unavailable...");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    if (flightBooking.State == CommunicationState.Faulted)
                    {
                        flightBooking = new FlightBookingServiceClient();
                    }

                    flightBooking.Close();
                }
            }
            else
            {
                MessageBox.Show("Please atleast one passenger...");
            }
        }
示例#22
0
        private void PutSummary(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, FlightInfo flightInfo)
        {
            //create a  table to hold summary of the order
            Table summaryTable = new Table();
            Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188);
            summaryTable.Margin.Top = 20;
            summaryTable.ColumnWidths = "60 80 80 80 80 80";
            summaryTable.DefaultCellTextInfo.FontSize = 10;
            summaryTable.DefaultCellBorder = new BorderInfo((int)BorderSide.All, color);
            summaryTable.DefaultCellPadding.Bottom = summaryTable.DefaultCellPadding.Top = 3;
            //add table to the first section/page
            Section section = pdf.Sections[0];
            section.Paragraphs.Add(summaryTable);
            //create row and add cells and contents
            Row row1SummaryTable = summaryTable.Rows.Add();

            Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize = 10;
            tf1.Color = new Aspose.Pdf.Generator.Color("White");
            tf1.FontName = "Helvetica-Bold";
            tf1.Alignment = AlignmentType.Center;
            Cell cell1Row1SummaryTable = row1SummaryTable.Cells.Add("Order ID", tf1);
            cell1Row1SummaryTable.BackgroundColor = color;

            Cell cell2Row1SummaryTable = row1SummaryTable.Cells.Add("Customer ID", tf1);
            cell2Row1SummaryTable.BackgroundColor = color;

            Cell cell3Row1SummaryTable = row1SummaryTable.Cells.Add("Agent ID", tf1);
            cell3Row1SummaryTable.BackgroundColor = color;

            Cell cell4Row1SummaryTable = row1SummaryTable.Cells.Add("Sales Person", tf1);
            cell4Row1SummaryTable.BackgroundColor = color;

            Cell cell5Row1SummaryTable = row1SummaryTable.Cells.Add("Required Date", tf1);
            cell5Row1SummaryTable.BackgroundColor = color;

            Cell cell6Row1SummaryTable = row1SummaryTable.Cells.Add("Shipped Date", tf1);
            cell6Row1SummaryTable.BackgroundColor = color;


            Row row2SummaryTable = summaryTable.Rows.Add();
            tf1 = new Aspose.Pdf.Generator.TextInfo();
            tf1.FontSize = 9;
            tf1.Color = new Aspose.Pdf.Generator.Color("Black");
            tf1.FontName = "Times-Roman";
            tf1.Alignment = AlignmentType.Center;

            row2SummaryTable.Cells.Add("90234", tf1);
            row2SummaryTable.Cells.Add("3762", tf1);
            row2SummaryTable.Cells.Add("AU89", tf1);
            row2SummaryTable.Cells.Add("James Smith", tf1);
            row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1);
            row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1);

        }
示例#23
0
 public void AddPassenger(PassengerInfo passengerInfo)
 {
     Passengers.Add(passengerInfo);
 }
        private void button2_Click(object sender, EventArgs e)
        {
            string name = txtName.Text;
            string passport = txtPassport.Text;
            DateTime expiry = dtpExpiry.Value;

            PassengerInfo passengerInfo = new PassengerInfo();
            passengerInfo.passengerName = name;
            passengerInfo.passportNo = passport;
            passengerInfo.expiryDate = expiry;

            _dictPassengers.Add(name, passengerInfo);

            lbPassenger.Items.Add(name);
        }
        private void button4_Click(object sender, EventArgs e)
        {
            if (_dictPassengers.Count > 0)
            {
                DateTime flightDepartureDate = (DateTime)dgvFlightInformation["DepartureTime", dgvFlightInformation.CurrentRow.Index].Value;

                string from = (string)cmbFrom.SelectedValue;
                string to = (string)cmbTo.SelectedValue;

                PassengerInfo[] passengers = new PassengerInfo[_dictPassengers.Count];
                int i = 0;
                Dictionary<string, PassengerInfo>.Enumerator enumerator = _dictPassengers.GetEnumerator();
                while (enumerator.MoveNext())
                    passengers[i++] = enumerator.Current.Value;

                PaymentInfo payment = new PaymentInfo();
                payment.cardholdername = txtHolderName.Text;
                payment.cardname = txtCardName.Text;
                payment.cv2 = txtCardPin.Text;
                payment.expiryDate = dtpCardExpiry.Value;

                FBooking.FlightBookingServiceClient flightBooking = new FlightBookingServiceClient();

                try
                {
                    if (flightBooking.checkAvailability(from, to, flightDepartureDate, passengers.Length))
                    {
                        MessageBox.Show("Seats Available...");

                        if (flightBooking.makeReservation(from, to, flightDepartureDate, passengers, payment))
                            MessageBox.Show("Successfully reserved...");
                        else
                            MessageBox.Show("Reservation unsuccessful...");
                    }
                    else
                        MessageBox.Show("Seats Unavailable...");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    if (flightBooking.State == CommunicationState.Faulted)
                        flightBooking = new FlightBookingServiceClient();

                    flightBooking.Close();
                }
            }
            else
            {
                MessageBox.Show("Please atleast one passenger...");
            }
        }
        private void btnBookRoom_Click(object sender, EventArgs e)
        {
            if (_dictPassengers.Count > 0)
            {
                Package packageInfo = (Package)cmbPackage.SelectedItem;

                string from = packageInfo.From;
                string to = packageInfo.To;
                DateTime flightDepartureDate = (DateTime)dgvFlightInformation["DepartureTime", dgvFlightInformation.CurrentRow.Index].Value;
                DateTime end = flightDepartureDate.AddDays(packageInfo.Duration);

                PassengerInfo[] passengers = new PassengerInfo[_dictPassengers.Count];
                int i = 0;
                Dictionary<string, PassengerInfo>.Enumerator enumerator = _dictPassengers.GetEnumerator();
                while (enumerator.MoveNext())
                    passengers[i++] = enumerator.Current.Value;

                PaymentInfo payment = new PaymentInfo();
                payment.cardholdername = txtHolderName.Text;
                payment.cardname = txtCardName.Text;
                payment.cv2 = txtCardPin.Text;
                payment.expiryDate = dtpCardExpiry.Value;

                FBooking.FlightBookingServiceClient flightBooking = new FlightBookingServiceClient();

                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {
                        if (flightBooking.checkAvailability(from, to, flightDepartureDate, passengers.Length))
                        {
                            MessageBox.Show("Flight Seats Available...");

                            if (flightBooking.makeReservation(from, to, flightDepartureDate, passengers, payment))
                                MessageBox.Show("Flight Reservation Successful...");
                            else
                                throw new Exception("Flight Reservation unsuccessful...");
                        }
                        else
                            throw new Exception("Seats Unavailable...");

                        string cartType = txtCardType.Text;
                        string guestAccount = txtGuestAccount.Text;
                        string guestName = txtGuestName.Text;
                        string guestPassport = txtGuestPassport.Text;
                        int duration = packageInfo.Duration;
                        int numberOfGuest = _dictPassengers.Count;
                        string roomNo = (string)dgvRoomDetails["roomNo", dgvRoomDetails.CurrentRow.Index].Value;
                        if (_hotelBooking.checkRoomAvailability(roomNo, dtpStartDate.Value.ToString(), duration))
                        {
                            MessageBox.Show("Hotel Room Available...");

                            MessageBox.Show(_hotelBooking.makeRoomReservation(cartType, guestAccount, guestName, guestPassport, duration, numberOfGuest, roomNo, dtpStartDate.Value.ToString(), ""));
                        }
                        else
                            throw new Exception("Hotel Room Unavailable..");

                        ts.Complete();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }
        }
        private void btnBookRoom_Click(object sender, EventArgs e)
        {
            if (_dictPassengers.Count > 0)
            {
                Package packageInfo = (Package)cmbPackage.SelectedItem;

                string   from = packageInfo.From;
                string   to   = packageInfo.To;
                DateTime flightDepartureDate = (DateTime)dgvFlightInformation["DepartureTime", dgvFlightInformation.CurrentRow.Index].Value;
                DateTime end = flightDepartureDate.AddDays(packageInfo.Duration);

                PassengerInfo[] passengers = new PassengerInfo[_dictPassengers.Count];
                int             i          = 0;
                Dictionary <string, PassengerInfo> .Enumerator enumerator = _dictPassengers.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    passengers[i++] = enumerator.Current.Value;
                }


                PaymentInfo payment = new PaymentInfo();
                payment.cardholdername = txtHolderName.Text;
                payment.cardname       = txtCardName.Text;
                payment.cv2            = txtCardPin.Text;
                payment.expiryDate     = dtpCardExpiry.Value;

                FBooking.FlightBookingServiceClient flightBooking = new FlightBookingServiceClient();

                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {
                        if (flightBooking.checkAvailability(from, to, flightDepartureDate, passengers.Length))
                        {
                            MessageBox.Show("Flight Seats Available...");

                            if (flightBooking.makeReservation(from, to, flightDepartureDate, passengers, payment))
                            {
                                MessageBox.Show("Flight Reservation Successful...");
                            }
                            else
                            {
                                throw new Exception("Flight Reservation unsuccessful...");
                            }
                        }
                        else
                        {
                            throw new Exception("Seats Unavailable...");
                        }

                        string cartType      = txtCardType.Text;
                        string guestAccount  = txtGuestAccount.Text;
                        string guestName     = txtGuestName.Text;
                        string guestPassport = txtGuestPassport.Text;
                        int    duration      = packageInfo.Duration;
                        int    numberOfGuest = _dictPassengers.Count;
                        string roomNo        = (string)dgvRoomDetails["roomNo", dgvRoomDetails.CurrentRow.Index].Value;
                        if (_hotelBooking.checkRoomAvailability(roomNo, dtpStartDate.Value.ToString(), duration))
                        {
                            MessageBox.Show("Hotel Room Available...");

                            MessageBox.Show(_hotelBooking.makeRoomReservation(cartType, guestAccount, guestName, guestPassport, duration, numberOfGuest, roomNo, dtpStartDate.Value.ToString(), ""));
                        }
                        else
                        {
                            throw new Exception("Hotel Room Unavailable..");
                        }

                        ts.Complete();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }
        }