private void roundButton_Click(object sender, EventArgs e)
        {
            Database dataBase = new Database();
            // dataBase.connect();
            string     query   = "INSERT INTO  Traveler  ( PhoneNumber,Traveler_Name,Travler_PassWord,Traveler_EMail,city) VALUES(@PhoneNumber,@Traveler_Name,@Travler_PassWord,@Traveler_EMail,@city) ";
            SqlCommand command = new SqlCommand(query);

            // way to input into DataBase
            command.CommandType = CommandType.Text;
            // to connection DataBase in tabel Traveler
            command.Connection = dataBase.connect();
            // to input Text in TextBox to Save Sql Server
            command.Parameters.AddWithValue("@PhoneNumber", metroTextBox5.Text);
            command.Parameters.AddWithValue("@Traveler_Name", metroTextBox1.Text);
            command.Parameters.AddWithValue("@Travler_PassWord", metroTextBox2.Text);
            command.Parameters.AddWithValue("@Traveler_EMail", metroTextBox4.Text);
            command.Parameters.AddWithValue("@city", metroComboBox1.Text);
            // command.Parameters.AddWithValue("@date", metroDateTime1.Text);

            command.ExecuteNonQuery();



            Vaild v = new Vaild();

            if (metroTextBox2.Text != metroTextBox3.Text)
            {
                MetroFramework.MetroMessageBox.Show(this, " Your Password was not Identical  ", "Sorry " + metroTextBox1.Text, MessageBoxButtons.OK);
            }
            else if (!v.chechMails(metroTextBox4.Text.ToString()))
            {
                MetroFramework.MetroMessageBox.Show(this, " Your E-Mail not valid ", " Sorry", MessageBoxButtons.OK);
            }
            else if (!v.checkPhoneNum(metroTextBox5.Text.ToString()))
            {
                MetroFramework.MetroMessageBox.Show(this, " Your Phone not valid ", " Sorry", MessageBoxButtons.OK);
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, " Your Register was sucessful  ", "Welcome " + metroTextBox1.Text, MessageBoxButtons.OK);

                this.Hide();
                Form5 f5 = new Form5();
                f5.ShowDialog();
                this.Close();
            }
            // dataBase.disconnect();
        }
Example #2
0
        private void Submit_Click(object sender, EventArgs e)
        {
            Database dataBase = new Database();
            //dataBase.connect();
            string     query   = "INSERT INTO  Driver  ( driver_username,driver_password,phoneNum,driver_email,driver_adress) VALUES(@driver_username,@driver_password,@phoneNum,@driver_email,@driver_adress) ";
            SqlCommand command = new SqlCommand(query);

            // way to input into DataBase
            command.CommandType = CommandType.Text;
            // to connection DataBase in tabel Traveler
            command.Connection = dataBase.connect();
            // to input Text in TextBox to Save Sql Server
            command.Parameters.AddWithValue("@phoneNum", metroTextBox5.Text);
            command.Parameters.AddWithValue("@driver_username", metroTextBox1.Text);
            command.Parameters.AddWithValue("@driver_password", metroTextBox2.Text);
            command.Parameters.AddWithValue("@driver_email", metroTextBox4.Text);
            command.Parameters.AddWithValue("@driver_adress", metroTextBox7.Text);
            // command.Parameters.AddWithValue("@date", metroDateTime1.Text);

            command.ExecuteNonQuery();
            //dataBase.connection.Close();

            Vaild v = new Vaild();

            if (metroTextBox2.Text != metroTextBox3.Text)
            {
                MetroFramework.MetroMessageBox.Show(this, " Your Password was not Identical  ", "Sorry " + metroTextBox1.Text, MessageBoxButtons.OK);
            }
            else if (!v.chechMails(metroTextBox4.Text.ToString()))
            {
                MetroFramework.MetroMessageBox.Show(this, " Your E-Mail not valid ", " Sorry", MessageBoxButtons.OK);
            }
            else if (!v.checkPhoneNum(metroTextBox5.Text.ToString()))
            {
                MetroFramework.MetroMessageBox.Show(this, " Your Phone not valid ", " Sorry", MessageBoxButtons.OK);
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, " Your Register was sucessful  ", "Welcome " + metroTextBox1.Text, MessageBoxButtons.OK);
            }
        }