private void button6_Click(object sender, EventArgs e)
        //search produs in DB
        {
            try
            {
                using (conn = new OracleConnection(CONNECTION_STRING))
                {
                    //deschiderea conexiunii
                    conn.Open();

                    string sqlCommand = Comenzi_SQL.Search_Database_product_name(Product_name_TextBox.Text);
                    if (Dirty_work.pass_string(Product_name_TextBox))
                    {
                        using (OracleDataAdapter oda = new OracleDataAdapter(sqlCommand, conn))
                        {
                            // Utilizare DataAdapter pentru a seta datele intr-un DataTable
                            DataTable dt = new DataTable();
                            oda.Fill(dt);
                            // setare dataSource pentru controld grid
                            dataGridView1.DataSource = dt;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                conn.Dispose();
            }
        }
Esempio n. 2
0
        private void motorToolStripMenuItem_Click(object sender, EventArgs e)
        //categoria MOTOR
        {
            try
            {
                using (conn = new OracleConnection(CONNECTION_STRING))
                {
                    //deschiderea conexiunii
                    conn.Open();

                    string sqlCommand = Comenzi_SQL.Search_Database_product_category("motor");
                    using (OracleDataAdapter oda = new OracleDataAdapter(sqlCommand, conn))
                    {
                        // Utilizare DataAdapter pentru a seta datele intr-un DataTable
                        DataTable dt = new DataTable();
                        oda.Fill(dt);
                        // setare dataSource pentru controld grid
                        dataGridView1.DataSource = dt;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                conn.Dispose();
            }
        }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     // Instantiate_all_tables();
     try
     {
         using (conn = new OracleConnection(CONNECTION_STRING))
         {
             //deschiderea conexiunii
             conn.Open();
             //Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropClientTable(), conn);
             //Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateClientTable(), conn);
             string sqlCommand1 = Comenzi_SQL.CreateClientiTable();
             string sqlCommand  = "SELECT * from client";
             using (OracleDataAdapter oda = new OracleDataAdapter(sqlCommand, conn))
             {
                 // Utilizare DataAdapter pentru a seta datele intr-un DataTable
                 DataTable dt = new DataTable();
                 oda.Fill(dt);
                 // setare dataSource pentru controld grid
                 dataGridView1.DataSource = dt;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         conn.Dispose();
     }
 }
Esempio n. 4
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();
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            if (Dirty_work.pass_string(R_email_value) && Dirty_work.pass_string(R_password_value))
            {
                try
                {
                    using (conn = new OracleConnection(CONNECTION_STRING))
                    {
                        //deschiderea conexiunii
                        conn.Open();
                        string sqlCommand = Comenzi_SQL.Search_Databse_client(R_email_value.Text, R_password_value.Text);

                        using (OracleDataAdapter oda = new OracleDataAdapter(sqlCommand, conn))
                        {
                            DataTable dt = new DataTable();
                            oda.Fill(dt);
                            dataGridView1.DataSource = dt;
                            //MessageBox.Show("String:" + dataGridView1.RowCount);
                            if (dataGridView1.RowCount > 1)
                            {
                                MessageBox.Show("Pass");
                                if (R_email_value.Text != "hr")
                                {
                                    this.Hide();
                                    Lista_produse l = new Lista_produse();
                                    l.Show();
                                }
                                else
                                {
                                    this.Hide();
                                    Client_form c = new Client_form();
                                    c.Show();
                                }
                            }

                            else
                            {
                                MessageBox.Show("No pass");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {
                    conn.Dispose();
                }
            }
        }
Esempio n. 6
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();
                }
            }
        }