private void changePayment(int num)
        {
            string ticket = ReserveP.getTicketID();
            int    total  = Price.getReserveAmount(ticket);
            int    fareID = Price.getReserveFareID(ticket);
            string seatclass;

            SQLConnection.Instance.OpenConnection();

            MySqlCommand sclass = new MySqlCommand("Select Class from Passenger where PassengerID = '" + num + "';", SQLConnection.Instance.GetConnection());

            seatclass = (string)sclass.ExecuteScalar();

            seatclass = getClassName(seatclass);

            int          flight;
            MySqlCommand findflight = new MySqlCommand("Select FlightID from Fare where FareID = '" + fareID + "';", SQLConnection.Instance.GetConnection());

            flight = Convert.ToInt32(findflight.ExecuteScalar());

            int          subtotal;
            MySqlCommand findClass = new MySqlCommand("Select " + seatclass + " from Flight where FlightID = '" + flight + "';", SQLConnection.Instance.GetConnection());

            subtotal = Convert.ToInt32(findClass.ExecuteScalar());

            total = total - subtotal;

            MySqlCommand updateFare = new MySqlCommand("UPDATE Fare set Amount = '" + total + "' where FareID = '" + fareID + "';", SQLConnection.Instance.GetConnection());

            updateFare.ExecuteNonQuery();

            SQLConnection.Instance.CloseConnection();
        }
Exemplo n.º 2
0
        private void fillText()
        {
            int numofpassengers = 0;
            int maxofpassengers = PassengerContainer.getNumPassenger();

            richTextBox1.ReadOnly = true;
            richTextBox1.Text     = "Showing " + maxofpassengers + " Passenger(s) information: \n";

            while (numofpassengers < maxofpassengers)
            {
                richTextBox1.Text += "\nPassenger: " + ReserveP.getPassenger();

                richTextBox1.Text += "\nSeat Information: " + ReserveP.getSeatInfo() + "\n";

                numofpassengers++;
            }

            SQLConnection.Instance.OpenConnection();

            insertReserve();
            insertTicket();

            SQLConnection.Instance.CloseConnection();

            fillEmail();

            MessageBox.Show("Email Confirmation of Reservation send shortly.");
        }
Exemplo n.º 3
0
 private void setReserveStatus()
 {
     //checks if user has reservations made
     if (!ReserveP.isEmptyReseve())
     {
         reserve_button.Enabled = true;
     }
 }
        private void submit_button_Click(object sender, EventArgs e)
        {
            //string ticket = reservations_comboBox1.Text;
            //MessageBox.Show(ticket);
            ReserveP.setTicketID(reservations_comboBox1.Text);
            Reserve_Changes alter = new Reserve_Changes();

            this.Close();
        }
Exemplo n.º 5
0
        private static void clearSeats()
        {
            PassengerInfo.loadPassengersReserve(ReserveP.getTicketID());

            SQLConnection.Instance.OpenConnection();

            fillPassengers();

            SQLConnection.Instance.CloseConnection();
            //MessageBox.Show("Reservation Succesfully Removed.");
        }
        private void RefreshForm()
        {
            adult  = 0;
            child  = 0;
            infant = 0;

            remove_comboBox1.SelectedIndex = -1;
            remove_comboBox1.Items.Clear();
            PassengerInfo.loadPassengersReserve(ReserveP.getTicketID());
            fillComboBox();
            //remove_comboBox1.Refresh();
        }
Exemplo n.º 7
0
        private void SendEmail(string emailTo)
        {
            string smtpAddress = "smtp.gmail.com";
            int    portNumber  = 587;
            bool   enableSSL   = true;

            string emailFrom = "*****@*****.**";
            string password  = "******";

            string subject = "Reservation Flight Change";
            string body    = "Hi,\nThis email to confirm that reservation" + ReserveP.getTicketID() + "has had the flight change to Airline "
                             + FlightContainer.flightObject[0].getAirline() +
                             " from " + FlightContainer.flightObject[0].getDepart() +
                             " to " + FlightContainer.flightObject[0].getArrive() +
                             "\nPrice: $" + Price.getReserveAmount(ReserveP.getTicketID());

            try
            {
                using (MailMessage mail = new MailMessage())
                {
                    mail.From = new MailAddress(emailFrom);
                    mail.To.Add(emailTo);
                    mail.Subject    = subject;
                    mail.Body       = body;
                    mail.IsBodyHtml = true;
                    // Can set to false, if you are sending pure text.

                    //mail.Attachments.Add(new Attachment("C:\\SomeFile.txt"));
                    //mail.Attachments.Add(new Attachment("C:\\SomeZip.zip"));

                    using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                    {
                        smtp.Credentials = new NetworkCredential(emailFrom, password);
                        smtp.EnableSsl   = enableSSL;
                        smtp.Send(mail);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 8
0
        private void fillLabels()
        {
            setTicketID(ReserveP.getTicketID());

            //MessageBox.Show(ticketID);

            SQLConnection.Instance.OpenConnection();

            int          flight;
            MySqlCommand findFlight = new MySqlCommand("Select FlightID from Reserve where ticketNo = '" + ticketID + "';", SQLConnection.Instance.GetConnection());

            flight = Convert.ToInt32(findFlight.ExecuteScalar());

            SQLConnection.Instance.CloseConnection();

            FlightContainer.loadFlight(flight);

            flight_label1.Text += " #" + FlightContainer.flightObject[0].getFlightNo() + " " + FlightContainer.flightObject[0].getDepart() +
                                  " to " + FlightContainer.flightObject[0].getArrive() + " Price: $" + Price.getReserveAmount(ticketID);
        }
        private static void SendEmail(string emailTo)
        {
            string smtpAddress = "smtp.gmail.com";
            int    portNumber  = 587;
            bool   enableSSL   = true;

            string emailFrom = "*****@*****.**";
            string password  = "******";

            string subject = "Reservation Changes";
            string body    = "Hi,\nThis email is to confirm that reservation " + ReserveP.getTicketID() +
                             " has had Passengers Removed or Passenger information updated from account " + AccountP.getAccountName();

            try
            {
                using (MailMessage mail = new MailMessage())
                {
                    mail.From = new MailAddress(emailFrom);
                    mail.To.Add(emailTo);
                    mail.Subject    = subject;
                    mail.Body       = body;
                    mail.IsBodyHtml = true;
                    // Can set to false, if you are sending pure text.

                    //mail.Attachments.Add(new Attachment("C:\\SomeFile.txt"));
                    //mail.Attachments.Add(new Attachment("C:\\SomeZip.zip"));

                    using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                    {
                        smtp.Credentials = new NetworkCredential(emailFrom, password);
                        smtp.EnableSsl   = enableSSL;
                        smtp.Send(mail);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 10
0
        private void SFlight_Click(object sender, EventArgs e)
        {
            if (FlightP.getFlightNumber() == 0)
            {
                getFirst();
            }

            int newflight = FlightP.getFlightNumber();

            ReserveP.setFlightNumber(ReserveP.getTicketID());
            int oldflight = ReserveP.getFlightNumber();

            //MessageBox.Show("Selected: 3:" + newflight.ToString() + " Reservation: 1:" + oldflight.ToString());

            //keep user from entering same flight again
            if (newflight == oldflight)
            {
                MessageBox.Show("Please select a different flight.");
                Arrival_combobox.SelectedIndex = -1;
                Depart_Date.Value = System.DateTime.Now;
                int zero = 0;
                FlightP.setFlightNumber(zero);
            }
            else
            {
                // clear reservation seats from previous flight
                // load passengers to pick new seat on this flight

                clearSeats();
                PassengerInfo.loadPassengersReserve(ReserveP.getTicketID());
                Price.loadPrices(FlightP.getFlightNumber());
                Price.resetDiscount();
                Seating_Update newseats = new Seating_Update();
                this.Close();
            }
        }
Exemplo n.º 11
0
        private void fillText()
        {
            int numofpassengers = 0;
            int maxofpassengers = PassengerInfo.getNumPassengers();

            reservations_richTextBox1.Text += "Ticket: " + tnumber + " Date Reserved: " + ReserveP.getReserveDate(tnumber) + "\nFlignt number is: " + fnumber + " Airline is " + FlightContainer.flightObject[0].getAirline() +
                                              " from " + FlightContainer.flightObject[0].getDepart() +
                                              " to " + FlightContainer.flightObject[0].getArrive() + "\nPrice: $" + Price.getReserveAmount(tnumber);
            reservations_richTextBox1.Text += " Showing " + maxofpassengers + " Passenger(s) information: \n";

            while (numofpassengers < maxofpassengers)
            {
                reservations_richTextBox1.Text += "\nPassenger: " + PassengerInfo.getPassenger();
                reservations_richTextBox1.Text += "\nSeat Information: " + PassengerInfo.getSeatInfo() + "\n";

                numofpassengers++;
            }

            removeFlight();

            if (!emptyFlight())
            {
                fillGrid();
            }
        }