Exemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string name        = textBox1.Text;
         string surname     = textBox3.Text;
         string salary      = textBox6.Text;
         string position    = textBox10.Text;
         string passport_id = textBox7.Text;
         bool   test1       = checkMeString(name);
         bool   test2       = checkMeString(surname);
         bool   test3       = checkMeInt(salary);
         bool   test4       = checkMeString(position);
         bool   test5       = checkMeInt(passport_id);
         bool   test6       = staffProf(position);
         if (test1 && test2 && test3 && test4 && test5 && test6)
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             else
             {
                 OdbcConnection con = new OdbcConnection("DSN=Connect");
                 con.Open();
                 using (OdbcCommand com = new OdbcCommand("insert into staff(name, surname, salary, position, passport_id) values('" + name + "', '" + surname + "', " + salary + ", '" + position + "', " + passport_id + ")", con))
                 {
                     com.ExecuteNonQuery();
                 }
                 con.Close();
                 More more = new More(this, elder);
                 more.Show();
             }
         }
         else
         {
             if (empty == true)
             {
                 MessageBox.Show("Все поля должны быть заполнены.");
                 empty = false;
             }
             MessageBox.Show(errorBool);
             if (!test6)
             {
                 MessageBox.Show("Таких профессий в аэропорту нет.");
             }
         }
     }
     catch (OdbcException rofl)
     {
         MessageBox.Show(errorBox + rofl);
         MessageBox.Show(error);
         button3.Visible = true;
     }
 }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string cardNum   = textBox11.Text;
         string date_tran = textBox12.Text;
         string flight_id = textBox9.Text;
         string person_id = textBox7.Text;
         string sum       = textBox3.Text;
         bool   isElite   = checkBox1.Checked;
         bool   test1     = checkMeString(cardNum);
         bool   test2     = checkMeString(date_tran);
         bool   test3     = checkMeInt(flight_id);
         bool   test4     = checkMeString(person_id);
         if (test1 && test2 && test3 && test4)
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             else
             {
                 OdbcConnection con = new OdbcConnection("DSN=Connect");
                 con.Open();
                 using (OdbcCommand com = new OdbcCommand("insert into transactions(card_number, date_tran, flight_id, person_id, elite, sum) values('" + cardNum + "', '" + date_tran + "', " + flight_id + ", " + person_id + ", " + isElite + ")", con))
                 {
                     com.ExecuteNonQuery();
                 }
                 con.Close();
                 More more = new More(this, elder);
                 more.Show();
             }
         }
         else
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             MessageBox.Show(errorBool);
         }
     }
     catch (OdbcException rofl)
     {
         MessageBox.Show(errorBox + rofl);
         MessageBox.Show(error);
         button3.Visible = true;
         button4.Visible = true;
     }
 }
Exemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string id_person = textBox1.Text;
         string id_flight = textBox7.Text;
         string weight    = textBox5.Text;
         string color     = textBox3.Text;
         bool   test1     = checkMeInt(id_person);
         bool   test2     = checkMeInt(id_flight);
         bool   test3     = checkMeInt(weight);
         bool   test4     = checkMeString(color);
         if (test1 && test2 && test3 && test4)
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             else
             {
                 OdbcConnection con = new OdbcConnection("DSN=Connect");
                 con.Open();
                 using (OdbcCommand com = new OdbcCommand("insert into luggage(id_person, id_flight, weight, color) values (" + id_person + ", " + id_flight + ", " + weight + ", '" + color + "')", con))
                 {
                     com.ExecuteNonQuery();
                 }
                 con.Close();
                 More more = new More(this, elder);
                 more.Show();
             }
         }
         else
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             MessageBox.Show(errorBool);
         }
     }
     catch (OdbcException rofl)
     {
         MessageBox.Show(errorBox + rofl);
         MessageBox.Show(error);
         button3.Visible = true;
         button4.Visible = true;
     }
 }
Exemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string model       = textBox12.Text;
         string capacity    = textBox9.Text;
         string birth_date  = textBox8.Text;
         string last_main   = textBox2.Text;
         string amount_pass = textBox1.Text;
         bool   test1       = checkMeString(model);
         bool   test2       = checkMeInt(capacity);
         bool   test3       = checkMeString(birth_date);
         bool   test4       = checkMeString(last_main);
         bool   test5       = checkMeInt(amount_pass);
         if (test1 && test2 && test3 && test4 && test5)
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             else
             {
                 OdbcConnection con = new OdbcConnection("DSN=Connect");
                 con.Open();
                 using (OdbcCommand com = new OdbcCommand("insert into planes1(model, capacity, birth_date, last_main, amount_pass) values('" + model + "', " + capacity + ", '" + birth_date + "', '" + last_main + "', " + amount_pass + ")", con))
                 {
                     com.ExecuteNonQuery();
                 }
                 con.Close();
                 More more = new More(this, elder);
                 more.Show();
             }
         }
         else
         {
             if (empty)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             MessageBox.Show(errorBool);
         }
     }
     catch (OdbcException rofl)
     {
         MessageBox.Show(errorBox + rofl);
         MessageBox.Show(error);
     }
 }
Exemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string pass_num   = textBox10.Text;
         string pass_date  = textBox8.Text;
         string alter_pass = textBox6.Text;
         string alter_date = textBox4.Text;
         string country    = textBox2.Text;
         bool   test1      = checkMeString(pass_num);
         bool   test2      = checkMeString(pass_date);
         bool   test3      = checkMeString(alter_pass);
         bool   test4      = checkMeString(alter_date);
         bool   test5      = checkMeString(country);
         if (test1 && test2 && test3 && test4 && test5)
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             else
             {
                 OdbcConnection con = new OdbcConnection("DSN=Connect");
                 con.Open();
                 using (OdbcCommand com = new OdbcCommand("insert into passport(pass_num, pass_date, alter_pass, alter_date, country) VALUES('" + pass_num + "', '" + pass_date + "', '" + alter_pass + "', '" + alter_date + "', '" + country + "')", con))
                 {
                     com.ExecuteNonQuery();
                 }
                 con.Close();
                 More more = new More(this, elder);
                 more.Show();
             }
         }
         else
         {
             if (empty == true)
             {
                 MessageBox.Show("Все поля должны быть заполнены.");
                 empty = false;
             }
             MessageBox.Show(errorBool);
         }
     }
     catch (OdbcException rofl)
     {
         MessageBox.Show(errorBox + rofl);
         MessageBox.Show(error);
     }
 }
Exemplo n.º 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string name        = textBox2.Text;
         string surname     = textBox4.Text;
         string birthday    = textBox6.Text;
         string passport_id = textBox8.Text;
         bool   test2       = checkMeString(name);
         bool   test3       = checkMeString(surname);
         bool   test4       = checkMeString(birthday);
         bool   test5       = checkMeInt(passport_id);
         if (test2 && test3 && test4 && test5)
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             else
             {
                 OdbcConnection con = new OdbcConnection("DSN=Connect");
                 con.Open();
                 using (OdbcCommand com = new OdbcCommand("insert into passengers(name, surname, birthday, passport_id) values('" + name + "', '" + surname + "', '" + birthday + "', " + passport_id + ")", con))
                 {
                     com.ExecuteNonQuery();
                 }
                 con.Close();
                 More more = new More(this, elder);
                 more.Show();
             }
         }
         else
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             MessageBox.Show(errorBool);
         }
     }
     catch (OdbcException rofl)
     {
         MessageBox.Show(errorBox + rofl);
         MessageBox.Show(error);
         button2.Visible = true;
     }
 }
Exemplo n.º 7
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string plane_id      = textBox20.Text;
         string cost_eco      = textBox18.Text;
         string cost_elite    = textBox15.Text;
         string time_start    = textBox13.Text;
         string time_end      = textBox22.Text;
         string first_country = textBox1.Text;
         string destination   = textBox3.Text;
         string captain_id    = textBox5.Text;
         string alt_cap_id    = textBox7.Text;
         string steward_id    = textBox9.Text;
         string steward_id_2  = textBox11.Text;
         bool   test1         = checkMeInt(plane_id);
         bool   test2         = checkMeInt(cost_eco);
         bool   test3         = checkMeInt(cost_elite);
         bool   test4         = checkMeString(time_start);
         bool   test5         = checkMeString(time_end);
         bool   test6         = checkMeString(first_country);
         bool   test7         = checkMeString(destination);
         bool   test8         = checkMeInt(captain_id);
         bool   test9         = checkMeInt(alt_cap_id);
         bool   test10        = checkMeInt(steward_id);
         bool   test11        = checkMeInt(steward_id_2);
         if (test1 && test2 && test3 && test4 && test5 && test6 && test7 && test8 && test9 && test10 && test11)
         {
             if (empty == true)
             {
                 empty = false;
                 MessageBox.Show("Все поля должны быть заполнены.");
             }
             else
             {
                 OdbcConnection con = new OdbcConnection("DSN=Connect");
                 con.Open();
                 using (OdbcCommand com = new OdbcCommand("insert into flights(plane_id, cost_economic, cost_elite, time_start, time_end, first_country , destination, captain_id, alter_captain_id, steward_1_id, steward_2_id) values(" + plane_id + ", " + cost_eco + ", " + cost_elite + ", '" + time_start + "', '" + time_end + "', '" + first_country + "', '" + destination + "', " + captain_id + ", " + alt_cap_id + ", " + steward_id + ", " + steward_id_2 + ")", con))
                 {
                     com.ExecuteNonQuery();
                 }
                 con.Close();
                 More more = new More(this, elder);
                 more.Show();
             }
         }
         else
         {
             if (empty == true)
             {
                 MessageBox.Show("Все поля должны быть заполнены.");
                 empty = false;
             }
             MessageBox.Show(errorBool);
             if (!test6)
             {
                 MessageBox.Show("Таких профессий в аэропорту нет.");
             }
         }
     }
     catch (OdbcException rofl)
     {
         MessageBox.Show(errorBox + rofl);
         MessageBox.Show(error);
         button3.Visible = true;
     }
 }