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();
        }
Example #2
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();
        }
Example #4
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);
            }
        }
Example #5
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);
            }
        }
Example #7
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();
            }
        }