Ejemplo n.º 1
0
 private void Drop_all_tables()
 {
     try
     {
         using (conn = new OracleConnection(CONNECTION_STRING))
         {
             //deschiderea conexiunii
             conn.Open();
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropCategorieTable(), conn);
             MessageBox.Show("CreateCategorieTable a fost stearsa");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropClientiTable(), conn);
             MessageBox.Show("CreateClientiTable a fost stearsa");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropClientTable(), conn);
             MessageBox.Show("CreateClientTable a fost stearsa");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropComenziTable(), conn);
             MessageBox.Show("CreateComenziTable a fost stearsa");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropDetalii_ComandaTable(), conn);
             MessageBox.Show("CreateDetalii_ComandaTable a fost stearsa");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropLista_ProduseTable(), conn);
             MessageBox.Show("CreateLista_ProduseTable a fost stearsa");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropProdusTable(), conn);
             MessageBox.Show("CreateProdusTable a fost stearsa");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         conn.Dispose();
     }
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool   cond          = false;
            string birthday_date = Timepicker_birthday.Value.ToShortDateString();

            if (Timepicker_birthday.Value > DateTime.Now)
            {
                MessageBox.Show("Nu sti introdus data de nastere corecta");
            }

            int val = 0;

            cond = Int32.TryParse(id_value.Text, out val);
            if (pass_string(password_value) && pass_string(city_value) && pass_string(firstName_value) && pass_string(lastName_value) && pass_string(adress_value) &&
                pass_string(email_value) && pass_string(phoneNumber_value) && pass_number(id_value) && Timepicker_birthday.Value < DateTime.Now)
            {
                reset_colors();
                try
                {
                    using (conn = new OracleConnection(CONNECTION_STRING))
                    {
                        //deschiderea conexiunii
                        conn.Open();
                        string command = Comenzi_SQL.UpdateClient(val, city_value.Text, firstName_value.Text,
                                                                  lastName_value.Text, birthday_date, adress_value.Text, phoneNumber_value.Text,
                                                                  password_value.Text, email_value.Text);

                        if (Comenzi_SQL.ExecuteOracleCommand(command, conn))
                        {
                            MessageBox.Show("Datele au fost introduse cu succes");
                            this.Hide();
                            Main_form f = new Main_form();
                            f.Show();
                        }

                        else
                        {
                            MessageBox.Show("ID-ul acesta este deja luat de catre o persoana");
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    conn.Dispose();
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            bool cond1, cond2, cond3, cond4;
            int  val, val2, val3, val4;

            cond1 = Int32.TryParse(id_value.Text, out val);
            cond2 = Int32.TryParse(order_id.Text, out val2);
            cond3 = Int32.TryParse(price.Text, out val3);
            cond4 = Int32.TryParse(quality.Text, out val4);
            if (Dirty_work.pass_string(product_name) && Dirty_work.pass_string(description) && Dirty_work.pass_string(category) &&
                Dirty_work.pass_number(order_id) && Dirty_work.pass_number(price) && Dirty_work.pass_number(id_value) && Dirty_work.pass_number(quality) &&
                cond1 && cond2 && cond3 && cond4)
            {
                try
                {
                    using (conn = new OracleConnection(CONNECTION_STRING))
                    {
                        //deschiderea conexiunii
                        conn.Open();
                        string command = Comenzi_SQL.UpdateProdus(val, val2, product_name.Text, val3, description.Text, val4, category.Text);

                        if (Comenzi_SQL.ExecuteOracleCommand(command, conn))
                        {
                            MessageBox.Show("Datele au fost introduse cu succes");
                            this.Hide();
                            Lista_produse f = new Lista_produse();
                            f.Show();
                        }

                        else
                        {
                            MessageBox.Show("ID-ul acesta este deja atribuit altui produs");
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    conn.Dispose();
                }
            }
        }