Esempio n. 1
0
        private void Form6_Load(object sender, EventArgs e)
        {
            DataTable dt = HANO.SqlQueryExec("SELECT * FROM TotalEmployeesView");


            //dg.AllowSorting = true;
            //dg.AlternatingRowsDefaultCellStyle = new DataGridViewCellStyle();
            //dg.AlternatingBackColor = Color.AliceBlue;
            //dg.BackColor = Color.Pink;
            //dg.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
            dg.Size       = Size;
            dg.Dock       = DockStyle.Fill;
            dg.DataSource = dt;

            dg.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None;
            dg.SelectionMode       = GridViewSelectionMode.FullRowSelect;
            dg.MultiSelect         = false;
            dg.AllowAddNewRow      = false;
            dg.AllowDeleteRow      = false;
            dg.AllowEditRow        = false;
            dg.Columns[2].BestFit();
            dg.Columns[5].BestFit();
            dg.Columns[9].BestFit();
            dg.Columns[10].BestFit();


            //dg.BorderStyle = BorderStyle.Fixed3D;
            //dg.CaptionVisible = false;
            //dg.Dock = DockStyle.Fill;
            //dg.MinimumSize = Size;


            Controls.Add(dg);
            dg.Show();
        }
Esempio n. 2
0
        private void Form15_Load(object sender, EventArgs e)
        {
            //MessageBox.Show(radTimePicker1.Value.Value.Hour.ToString()+":"+ radTimePicker1.Value.Value.Minute.ToString()+":"+ radTimePicker1.Value.Value.Second.ToString());
            DataTable dt = HANO.SqlQueryExecMod("SELECT name FROM train");

            dt.TableName            = "trains";
            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember   = "Name";
            comboBox1.DataSource    = dt;
        }
Esempio n. 3
0
        private void Form19_Load(object sender, EventArgs e)
        {
            radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            radGridView1.SelectionMode       = GridViewSelectionMode.FullRowSelect;
            radGridView1.MultiSelect         = false;
            radGridView1.AllowAddNewRow      = false;
            radGridView1.AllowDeleteRow      = false;
            radGridView1.AllowEditRow        = false;

            radGridView1.DataSource = HANO.SqlQueryExec("SELECT DISTINCT ticketID, price, seatNumber as 'Seat nb.',[Trip Number],[Departure Time],[Departure City],[Arrival Time],[Arrival City],[Train Name],[Staff Count] FROM TotalTicketsView WHERE userID = " + HANO.userID + " order by [Departure Time]");
        }
Esempio n. 4
0
        private void Form17_Load(object sender, EventArgs e)
        {
            //radGridView1.Size = Size;
            //radGridView1.Dock = DockStyle.Fill;
            radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            radGridView1.SelectionMode       = GridViewSelectionMode.FullRowSelect;
            radGridView1.MultiSelect         = false;
            radGridView1.AllowAddNewRow      = false;
            radGridView1.AllowDeleteRow      = false;
            radGridView1.AllowEditRow        = false;

            radGridView1.DataSource = HANO.SqlQueryExec("SELECT DISTINCT [Trip Number],[Departure City],[Departure Time],[Arrival City],[Arrival Time] FROM TotalTripsView order by [Departure Time]");
            //PLEASE COLOR THE ARRIVAL AND DEPARTURE COLOMNS
        }
Esempio n. 5
0
        private void Form21_Load(object sender, EventArgs e)
        {
            DataRow dr = HANO.SqlQueryExec("SELECT * from TotalPassengersViewWithPass where [Online User Number]=" + HANO.userID.ToString()).Rows[0];

            radTextBox1.Text = dr[2].ToString();
            radTextBox2.Text = dr[3].ToString();
            radTextBox3.Text = dr[7].ToString();
            radTextBox4.Text = dr[8].ToString();
            radTextBox5.Text = dr[9].ToString();
            radTextBox8.Text = dr[4].ToString();

            radDateTimePicker1.Value = Convert.ToDateTime(dr[6].ToString());
            radTextBox6.Text         = dr[11].ToString();
            radTextBox7.Text         = dr[12].ToString();
            radTextBox9.Text         = dr[13].ToString();
            radTextBox10.Text        = dr[14].ToString();
            radTextBox11.Text        = dr[15].ToString();
            //MessageBox.Show(radDateTimePicker1.Value.Month.ToString());
        }
Esempio n. 6
0
        private void Form16_Load(object sender, EventArgs e)
        {
            int    hour   = DateTime.Now.Hour;
            int    minute = DateTime.Now.Minute;
            string str;

            try {
                str            = HANO.SqlQueryExec("select top 1 [Departure City] from TotalTripsView where [Departure Time] > '" + hour + ":" + minute + "'").Rows[0][0].ToString();
                str           += " to ";
                str           += HANO.SqlQueryExec("select top 1 [Arrival City] from TotalTripsView where [Departure Time] > '" + hour + ":" + minute + "'").Rows[0][0].ToString();
                radLabel2.Text = str;
                radLabel3.Text = "at " + HANO.SqlQueryExec("select top 1 [Departure Time] from TotalTripsView where [Departure Time] > '" + hour + ":" + minute + "'").Rows[0][0].ToString();
            }
            catch (Exception)
            {
                radLabel2.Text = "Beirut To Jounieh";
                radLabel3.Text = "at 12:00 ";
            }
        }
Esempio n. 7
0
        private void radButton1_Click(object sender, EventArgs e)
        {
            string ok = RadMessageBox.Show("Edits were made.\n\nDo you want to save changes?", "WARNING!", MessageBoxButtons.YesNo).ToString();

            if (ok == "Yes")
            {
                // MessageBox.Show("startimg");
                HANO.SqlNonQueryExec("UPDATE TotalPassengersViewWithPass SET First_Name = '" + radTextBox1.Text + "', Last_Name = '" + radTextBox2.Text + "', [Preffered Name] = '" + radTextBox8.Text + "'" + ", [Birth Date] = '" + radDateTimePicker1.Value.Month + "/" + radDateTimePicker1.Value.Day + "/" + radDateTimePicker1.Value.Year + "' , [E-mail] = '" + radTextBox6.Text + "' , [Phone Number] = " + radTextBox7.Text + " where [Online User Number] = " + HANO.userID);
                // MessageBox.Show("done 1");
                HANO.SqlNonQueryExec("UPDATE TotalPassengersViewWithPass SET Country = '" + radTextBox3.Text + "', City = '" + radTextBox4.Text + "', Street = '" + radTextBox5.Text + "' where [Online User Number] = " + HANO.userID);

                HANO.SqlNonQueryExec("UPDATE TotalPassengersViewWithPass SET username = '******', password = '******' where [Online User Number] = " + HANO.userID);

                RadMessageBox.Show("Data Updated Successfully", "Saved!", MessageBoxButtons.OK);
            }
            else
            {
                RadMessageBox.Show("Changes have been discarded.", "Not saved!", MessageBoxButtons.OK);
            }
        }
Esempio n. 8
0
        private void Form18_Load(object sender, EventArgs e)
        {
            DataRow dr = HANO.SqlQueryExec("SELECT * from totaltripsview where [Trip Number]=" + tripId.ToString()).Rows[0];

            radLabel1.Text  = "Trip #" + dr[0].ToString();
            radLabel10.Text = dr[1].ToString();
            radLabel13.Text = dr[8].ToString();
            radLabel17.Text = dr[2].ToString();
            radLabel18.Text = dr[3].ToString();
            radLabel15.Text = dr[4].ToString();
            radLabel16.Text = dr[5].ToString();
            radLabel19.Text = dr[6].ToString();
            radLabel20.Text = dr[7].ToString();
            radLabel14.Text = dr[9].ToString();

            //calc price
            DataRow drt = HANO.SqlQueryExec("SELECT * FROM TripCoordinates WHERE tripIDNumber = " + tripId.ToString()).Rows[0];
            double  x = Convert.ToInt32(drt[1]), y = Convert.ToInt32(drt[2]), z = Convert.ToInt32(drt[3]), t = Convert.ToInt32(drt[4]);

            price           = Math.Sqrt(Math.Pow((x - z), 2) + Math.Pow((y - t), 2));
            price           = (float)System.Math.Round(price * unitPrice, 2);
            radLabel21.Text = (float)System.Math.Round(price * unitPrice, 2) + " $";
        }
Esempio n. 9
0
        private void radButton6_Click(object sender, EventArgs e)
        {
            int userId;

            bool validMail   = (radTextBox5.Text != null && new EmailAddressAttribute().IsValid(radTextBox5.Text));
            bool validNumber = true;

            foreach (char c in radTextBox5.Text)
            {
                validNumber = (c >= '0' && c <= '9');
                if (!validNumber)
                {
                    break;
                }
            }

            if (!validNumber && !validMail)
            {
                HANO.msg("Alert!", "Please enter a valid email address / mobile number");
                return;
            }
            SqlConnection conn = new SqlConnection(HANO.projConn);
            SqlCommand    cmd  = new SqlCommand("addUser", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter param;

            param       = cmd.Parameters.Add("@fname", SqlDbType.VarChar, 20);
            param.Value = radTextBox3.Text;


            param       = cmd.Parameters.Add("@lname", SqlDbType.VarChar, 20);
            param.Value = radTextBox4.Text;



            param       = cmd.Parameters.Add("@bdate", SqlDbType.Date);
            param.Value = radDateTimePicker1.Value;


            param       = cmd.Parameters.Add("@gender", SqlDbType.VarChar, 7);
            param.Value = (radCheckBox1.Checked ? "Male" : "Female");

            param       = cmd.Parameters.Add("@mail", SqlDbType.NVarChar, 50);
            param.Value = validMail ? radTextBox5.Text : "";

            param       = cmd.Parameters.Add("@number", SqlDbType.BigInt);
            param.Value = validMail ? 0 : (Convert.ToUInt32(radTextBox5.Text));

            param       = cmd.Parameters.Add("@username", SqlDbType.VarChar, 30);
            param.Value = radTextBox6.Text;

            param       = cmd.Parameters.Add("@pass", SqlDbType.VarChar, 30);
            param.Value = radTextBox7.Text;

            param       = cmd.Parameters.Add("@type", SqlDbType.VarChar, 10);
            param.Value = "employee";

            param       = cmd.Parameters.Add("@country", SqlDbType.VarChar, 50);
            param.Value = radTextBox8.Text;

            param       = cmd.Parameters.Add("@city", SqlDbType.VarChar, 50);
            param.Value = radTextBox9.Text;

            param       = cmd.Parameters.Add("@street", SqlDbType.VarChar, 50);
            param.Value = radTextBox10.Text;

            // Add the output parameter.

            param = cmd.Parameters.Add("@logID", SqlDbType.Int);

            param.Direction = ParameterDirection.Output;



            // Execute the command.

            conn.Open();
            try
            {
                //print("start");
                cmd.ExecuteScalar();
                //print("end");
            }
            catch (SqlException err)
            {
                HANO.msg("", err.Message);
            }


            userId = int.Parse(param.Value.ToString());

            if (userId > 0)
            {
                HANO.msg("New employee ID is" + param.Value, "");
            }
            else if (userId == -1)
            {
                MessageBox.Show("Username already exists.\nGo back and change it then try again", "Change the username.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            conn.Close();
        }
Esempio n. 10
0
        private void radButton6_Click(object sender, EventArgs e)
        {
            int duration = ((radTimePicker2.Value.Value - radTimePicker1.Value.Value).Hours * 60 + (radTimePicker2.Value.Value - radTimePicker1.Value.Value).Minutes);

            fromDayToDay = radCheckBox1.Checked;
            if (duration < 0)
            {
                if (!fromDayToDay)
                {
                    HANO.msg("Times are wrongly set", "The departure time is set before the arrival time.\nFix to proceed.");
                    return;
                }
            }
            if (radTextBox1.Text == "" || radTextBox2.Text == "" || radTextBox3.Text == "")
            {
                HANO.msg("Pick up destinations.", "Destinations weren't set properly.\nFix to proceed.");
                return;
            }


            SqlConnection conn = new SqlConnection(HANO.projConn);
            SqlCommand    cmd  = new SqlCommand("addTrip", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter param;

            param       = cmd.Parameters.Add("@duration", SqlDbType.Float);
            param.Value = duration;

            param = cmd.Parameters.Add("@trainId", SqlDbType.Int);
            DataTable dt = HANO.SqlQueryExec("SELECT trainID from train where name = '" + comboBox1.Text + "'");

            //MessageBox.Show(dt.Rows[0].ToString(),"");
            param.Value = int.Parse(dt.Rows[0][0].ToString());
            //MessageBox.Show(param.Value.ToString());

            param       = cmd.Parameters.Add("@depTime", SqlDbType.Time, 2);
            param.Value = "" + radTimePicker1.Value.Value.Hour.ToString() + ":" + radTimePicker1.Value.Value.Minute.ToString() + ":" + radTimePicker1.Value.Value.Second.ToString() + "";
            //param.Value = radTimePicker1.Time;

            param       = cmd.Parameters.Add("@arrTime", SqlDbType.Time, 2);
            param.Value = "" + radTimePicker2.Value.Value.Hour.ToString() + ":" + radTimePicker2.Value.Value.Minute.ToString() + ":" + radTimePicker2.Value.Value.Second.ToString() + "";
            //param.Value = radTimePicker2.Value.Value;

            param       = cmd.Parameters.Add("@depStationId", SqlDbType.Int);
            param.Value = stFromId;

            param       = cmd.Parameters.Add("@arrStationId", SqlDbType.Int);
            param.Value = stToId;

            param       = cmd.Parameters.Add("@staffnb", SqlDbType.Int);
            param.Value = radTextBox3.Text;

            // Add the output parameter.

            param = cmd.Parameters.Add("@tripId", SqlDbType.Int);

            param.Direction = ParameterDirection.Output;

            //mashi bass hek



            // Execute the command.

            conn.Open();
            try
            {
                cmd.ExecuteScalar();
            }
            catch (SqlException err)
            {
                HANO.msg("", err.Message);
            }
            catch (NullReferenceException erno)
            {
                HANO.msg("", erno.Message);
            }

            try
            {
                tripID = int.Parse(param.Value.ToString());
            }
            catch (Exception)
            {
                HANO.msg("Ooops!", "You must fill all the info!");
            }


            if (tripID > 0)
            {
                HANO.msg("Trip added successfully.", "Trip ID is: " + param.Value);
            }
            else if (tripID == -1)
            {
                HANO.msg("Already Exists!", "Newly added trip was already existing.\nNo changes were made.");
            }
            conn.Close();
        }
Esempio n. 11
0
        private void radButton1_Click(object sender, EventArgs e)
        {
            int adad = 0;

            if (radToggleSwitch1.Value)
            {
                adad++;
                where = "where ";
                cond1 = "[Departure City]= '" + radTextBox1.Text + "' and [Arrival City] = '" + radTextBox2.Text + "' ";
            }
            else
            {
                cond1 = "";
            }
            if (radToggleSwitch2.Value)
            {
                adad++;
                where = "where ";
                cond2 = "[Departure Time]= '" + radTextBox4.Text + "' ";
            }
            else
            {
                cond2 = "";
            }
            if (radToggleSwitch3.Value)
            {
                adad++;
                where = "where ";
                cond3 = "[Pricee] <= " + radTextBox5.Text + " ";
            }
            else
            {
                cond3 = "";
            }

            if (!radToggleSwitch1.Value && !radToggleSwitch2.Value && !radToggleSwitch3.Value)
            {
                where = "";
                and   = "";
                and1  = "";
                cond1 = "";
                cond2 = "";
                cond3 = "";
            }
            if (adad == 1)
            {
                and  = "";
                and1 = "";
            }
            if (adad == 2)
            {
                if (radToggleSwitch1.Value)
                {
                    and  = "and ";
                    and1 = "";
                }
                else
                {
                    and  = "";
                    and1 = "and ";
                }
            }
            try
            {
                query = "SELECT DISTINCT [Trip Number],[Trip Duration],[Departure City],[Departure Time],[Arrival City],[Arrival Time], Pricee FROM TotalPricedTripsView ";
                // MessageBox.Show(query + where + cond1 + and + cond2 + and1 + cond3);
                radGridView1.DataSource = HANO.SqlQueryExec(query + where + cond1 + and + cond2 + and1 + cond3);
            }
            catch (Exception er)
            {
                RadMessageBox.Show(er.Message);
            }
        }
Esempio n. 12
0
        private void radButton2_Click(object sender, EventArgs e)
        {
            if (point == null)
            {
                HANO.msg("Error", "Pick location first!");
                return;
            }
            SqlConnection conn = new SqlConnection(HANO.projConn);
            SqlCommand    cmd  = new SqlCommand("addStation", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter param;

            param       = cmd.Parameters.Add("@name", SqlDbType.VarChar, 25);
            param.Value = radTextBox8.Text;

            param       = cmd.Parameters.Add("@country", SqlDbType.VarChar, 50);
            param.Value = radTextBox9.Text;

            param       = cmd.Parameters.Add("@city", SqlDbType.VarChar, 50);
            param.Value = radTextBox10.Text;

            param       = cmd.Parameters.Add("@x", SqlDbType.Int);
            param.Value = point.X;

            param       = cmd.Parameters.Add("@y", SqlDbType.Int);
            param.Value = point.Y;
            // Add the output parameter.

            param = cmd.Parameters.Add("@stationId", SqlDbType.Int);

            param.Direction = ParameterDirection.Output;



            // Execute the command.

            conn.Open();
            try
            {
                //print("start");
                cmd.ExecuteScalar();
                //print("end");
            }
            catch (SqlException err)
            {
                HANO.msg("", err.Message);
            }
            catch (NullReferenceException erno)
            {
                HANO.msg("", erno.Message);
            }

            try {
                stationID = int.Parse(param.Value.ToString());
            }
            catch (Exception)
            {
                HANO.msg("Ooops!", "You must fill all the info!");
            }


            if (stationID > 0)
            {
                HANO.msg("Station added successfully.", "Station ID is: " + param.Value);
            }
            else if (stationID == -1)
            {
                HANO.msg("Already Exists!", "Newly created station was already existing.\nNo changes were made.");
            }
            conn.Close();
        }
Esempio n. 13
0
        private void radButton4_Click(object sender, EventArgs e)
        {
            if (stTo == 0 || stFrom == 0)
            {
                HANO.msg("Error", "Pick stations first!");
                return;
            }
            SqlConnection conn = new SqlConnection(HANO.projConn);
            SqlCommand    cmd  = new SqlCommand("addTrack", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter param;

            param       = cmd.Parameters.Add("@name", SqlDbType.VarChar, 25);
            param.Value = radTextBox1.Text;

            param       = cmd.Parameters.Add("@stFrom", SqlDbType.Int);
            param.Value = stFrom;

            param       = cmd.Parameters.Add("@stTo", SqlDbType.Int);
            param.Value = stTo;
            // Add the output parameter.

            param = cmd.Parameters.Add("@trId", SqlDbType.Int);

            param.Direction = ParameterDirection.Output;



            // Execute the command.

            conn.Open();
            try
            {
                cmd.ExecuteScalar();
            }
            catch (SqlException err)
            {
                HANO.msg("", err.Message);
            }
            catch (NullReferenceException erno)
            {
                HANO.msg("", erno.Message);
            }

            try
            {
                trackID = int.Parse(param.Value.ToString());
            }
            catch (Exception x)
            {
                HANO.msg("Ooops!", "Something went wrong!" + x.Message);
            }

            if (trackID > 0)
            {
                HANO.msg("Station added successfully.", "Track ID is: " + param.Value);
            }

            else if (trackID == -1)
            {
                HANO.msg("Already Exists!", "Newly created station was already existing.\nNo changes were made.");
            }
            conn.Close();
        }
Esempio n. 14
0
        private void radButton4_Click(object sender, EventArgs e)
        {
            Form4 f4 = new Form4();

            HANO.userType = HANO.SqlQueryScalarLogIn("SELECT type FROM login WHERE username='******' and password='******'");
            if (HANO.userType == "")
            {
                return;
            }
            HANO.userID = int.Parse(HANO.SqlQueryExec("SELECT userID FROM login WHERE username='******'").Rows[0][0].ToString());
            DataTable dt = HANO.SqlQueryExec("SELECT First_Name,Last_Name,locationID,email,Phone_Number FROM person WHERE loginID = '" + HANO.userID + "'");

            try
            {
                HANO.userFName = dt.Rows[0][0].ToString();
                HANO.userLName = dt.Rows[0][1].ToString();

                HANO.mail   = dt.Rows[0][3].ToString();
                HANO.number = dt.Rows[0][4].ToString();

                loc = dt.Rows[0][2].ToString();
            }
            catch (Exception err)
            {
                print(err.Message);
            }

            dt = HANO.SqlQueryExec("SELECT country,city,street FROM location WHERE locationID = " + loc + "");
            try
            {
                HANO.country = dt.Rows[0][0].ToString();
                HANO.city    = dt.Rows[0][1].ToString();
                HANO.street  = dt.Rows[0][2].ToString();
            }
            catch (Exception err)
            {
                print(err.Message);
            }
            switch (HANO.userType)
            {
            case "admin":
                HANO.msg("Welcome Back, " + HANO.userFName + "!", "You are logged in as an ADMIN");
                //(new Form2()).Show();
                break;

            case "passenger":
                HANO.msg("Welcome Back, " + HANO.userFName + "!", "You are logged in as a Passenger");
                //(new Form6()).Show();
                break;

            case "employee":
                HANO.msg("Welcome Back, " + HANO.userFName + "!", "You are logged in as an Employee");
                //(new Form5()).Show();
                break;

            default:
            {
                HANO.msg("Error logging in!", "Wrong Username or Password.\nTry again.\nIf you are a new user, you can create a new account now for free!");
                return;
            }
            }
            this.Close();
            f4.StartPosition = FormStartPosition.CenterScreen;
            f4.Show();
        }
Esempio n. 15
0
        private void radButton1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(HANO.projConn);
            SqlCommand    cmd  = new SqlCommand("addTicket", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter param;

            param       = cmd.Parameters.Add("@priceCoef", SqlDbType.Money);
            param.Value = price;

            param = cmd.Parameters.Add("@stnb", SqlDbType.Int);
            Random r = new Random();

            param.Value = r.Next(1, 100);
            //MessageBox.Show(param.Value.ToString());

            param       = cmd.Parameters.Add("@tripid", SqlDbType.Int);
            param.Value = tripId;
            //param.Value = radTimePicker1.Time;

            param       = cmd.Parameters.Add("@clientid", SqlDbType.Int);
            param.Value = HANO.userID;

            // Add the output parameter.

            param = cmd.Parameters.Add("@ticketnb", SqlDbType.Int);

            param.Direction = ParameterDirection.Output;



            // Execute the command.

            conn.Open();
            try
            {
                cmd.ExecuteScalar();
            }
            catch (SqlException err)
            {
                HANO.msg("", err.Message);
            }
            catch (NullReferenceException erno)
            {
                HANO.msg("", erno.Message);
            }

            try
            {
                ticket = int.Parse(param.Value.ToString());
            }
            catch (Exception)
            {
                HANO.msg("You already bought this ticket...BAS ", "Try to buy another ticket.");
            }


            if (ticket > 0)
            {
                HANO.msg("Ticket bought successfully.", "Your ticket number is: " + param.Value);
                if (HANO.mail != "")
                {
                    try
                    {
                        MailMessage mail       = new MailMessage();
                        SmtpClient  SmtpServer = new SmtpClient("smtp.office365.com");

                        mail.From = new MailAddress("*****@*****.**");
                        mail.To.Add(HANO.mail);
                        mail.Subject = "Lebanon Fast Trains";
                        mail.Body    = "Your ticket reservation from " + radLabel16.Text + " to " + radLabel20.Text + " has been done successfully.\n\nThe ticket price is : " + (float)System.Math.Round(price * unitPrice, 2) + " $\nThe ticket number is : " + param.Value + ".";

                        SmtpServer.Port        = 587;
                        SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Sq2$w!F1");
                        SmtpServer.EnableSsl   = true;

                        SmtpServer.Send(mail);
                        //MessageBox.Show("mail Send");
                    }
                    catch (Exception)
                    {
                        RadMessageBox.Show("invalid mail address found...");
                    }



                    HANO.msg("Reminder mail sent.", "A mail containing your ticket's details has been sent to your registered e-mail.");
                }
                else
                {
                    HANO.msg("Reminder mail not sent.", "We tried to contact you via e-mail to give you the trip details.\nPlease enter a mail address by managing your profile.");
                }
            }
            else if (ticket == -1)
            {
                HANO.msg("You already bought this ticket...", "Try to buy a ticket for another trip.");
            }
            conn.Close();
        }
Esempio n. 16
0
        private void radButton1_Click(object sender, EventArgs e)
        {
            int affected = 0, rowsAffected = -1;

            if (radCheckBox1.Checked)
            {
                bool validNumber = true;
                foreach (char c in radTextBox1.Text)
                {
                    validNumber = (c >= '0' && c <= '9');
                    if (!validNumber)
                    {
                        break;
                    }
                }
                if (validNumber)
                {
                    affected = HANO.SqlNonQueryExec("DELETE FROM passenger WHERE passengerID = " + radTextBox1.Text);
                    if (affected > 0)
                    {
                        MessageBox.Show("Deleted passenger from " + affected + " places successfully.");
                    }
                    if (affected == 0)
                    {
                        MessageBox.Show("Passenger not found");
                    }
                }
                else
                {
                    MessageBox.Show("This is not a number...", "Error!");
                }
            }
            else if (radCheckBox2.Checked)
            {
                DataTable dt = HANO.SqlQueryExec("SELECT personID FROM person WHERE First_Name='" + radTextBox2.Text + "' and Last_Name='" + radTextBox3.Text + "'");
                rowsAffected = dt.Rows.Count;
                switch (rowsAffected)
                {
                case 0:
                    MessageBox.Show("No matching passengers found!");
                    break;

                case 1:
                    HANO.SqlNonQueryExec("DELETE FROM passenger WHERE passenger.personID '" + dt.Rows[0][0].ToString() + "'");
                    MessageBox.Show("Removed the passenger successfully.", "Success");
                    break;

                default:
                    RadDesktopAlert ra = new RadDesktopAlert();
                    ra.CaptionText = "Error Executing!";
                    ra.ContentText = "More than one passenger were found with the given first and last names!";
                    ra.Show();
                    break;
                }
            }
            else
            {
                RadDesktopAlert ra = new RadDesktopAlert();
                ra.CaptionText = "Select at least one method!";
                ra.ContentText = "You must select between the ID method or the First/Last Name method.";
                ra.Show();
            }
        }
Esempio n. 17
0
 private void radButton5_Click(object sender, EventArgs e)
 {
     HANO.SqlNonQueryExec("INSERT INTO train(name) VALUES('" + radTextBox3.Text + "')");
     HANO.msg("Train Added", "Id is hidden for security reasons.");
 }