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(); } }
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(); } } }
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(); } } }