private void button12_Click(object sender, EventArgs e) { Rawmaterial f13 = new Rawmaterial(); f13.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=DESKTOP-GB0LHG2\\MSSQLSERVER01;Database=daudFactoryDB;Integrated Security=True"); con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; raw_materialdb edb = new raw_materialdb(); double x, y; y = float.Parse(textBox2.Text); if (comboBox1.Text == "Resin") { edb.get(1); x = edb.quantity + y; cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox3.Text + "', purchased_from='" + textBox4.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); comboBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; this.Close(); Rawmaterial f13 = new Rawmaterial(); f13.ShowDialog(); } else if (comboBox1.Text == "UVtax") { edb.get(2); x = edb.quantity + y; cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox3.Text + "', purchased_from='" + textBox4.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); comboBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; this.Close(); Rawmaterial f13 = new Rawmaterial(); f13.ShowDialog(); } else if (comboBox1.Text == "One pack") { edb.get(4); x = edb.quantity + y; cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox3.Text + "', purchased_from='" + textBox4.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); comboBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; this.Close(); Rawmaterial f13 = new Rawmaterial(); f13.ShowDialog(); } else if (comboBox1.Text == "Titanium") { edb.get(5); x = edb.quantity + y; cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox3.Text + "', purchased_from='" + textBox4.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); comboBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; this.Close(); Rawmaterial f13 = new Rawmaterial(); f13.ShowDialog(); } else if (comboBox1.Text == "DOP") { edb.get(6); x = edb.quantity + y; cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox3.Text + "', purchased_from='" + textBox4.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); comboBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; this.Close(); Rawmaterial f13 = new Rawmaterial(); f13.ShowDialog(); } else if (comboBox1.Text == "Chowk powder") { edb.get(7); x = edb.quantity + y; cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox3.Text + "', purchased_from='" + textBox4.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); comboBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; this.Close(); Rawmaterial f13 = new Rawmaterial(); f13.ShowDialog(); } }