Exemple #1
0
        private void Button9_Click(object sender, EventArgs e)
        {
            Raw_material raw = new Raw_material();

            raw.ShowDialog();
        }
Exemple #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection("Data Source=DESKTOP-H03A9OV;Initial Catalog=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(textBox1.Text);
            if (comboBox1.Text == "Resin")
            {
                edb.get(1);
                x = edb.quantity + y;
                cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox2.Text + "', purchased_from='" + textBox3.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                comboBox1.Text = "";
                textBox1.Text  = "";
                textBox2.Text  = "";
                textBox3.Text  = "";
                this.Close();
                Raw_material f13 = new Raw_material();
                f13.ShowDialog();
            }
            else if (comboBox1.Text == "UVtax")
            {
                edb.get(2);
                x = edb.quantity + y;
                cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox2.Text + "', purchased_from='" + textBox3.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                comboBox1.Text = "";
                textBox2.Text  = "";
                textBox3.Text  = "";
                textBox1.Text  = "";
                this.Close();
                Raw_material f13 = new Raw_material();
                f13.ShowDialog();
            }
            else if (comboBox1.Text == "One pack")
            {
                edb.get(4);
                x = edb.quantity + y;
                cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox2.Text + "', purchased_from='" + textBox3.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                comboBox1.Text = "";
                textBox2.Text  = "";
                textBox3.Text  = "";
                textBox1.Text  = "";
                this.Close();
                Raw_material f13 = new Raw_material();
                f13.ShowDialog();
            }
            else if (comboBox1.Text == "Titanium")
            {
                edb.get(5);
                x = edb.quantity + y;
                cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox2.Text + "', purchased_from='" + textBox3.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                comboBox1.Text = "";
                textBox2.Text  = "";
                textBox3.Text  = "";
                textBox1.Text  = "";
                this.Close();
                Raw_material f13 = new Raw_material();
                f13.ShowDialog();
            }
            else if (comboBox1.Text == "DOP")
            {
                edb.get(6);
                x = edb.quantity + y;
                cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox2.Text + "', purchased_from='" + textBox3.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                comboBox1.Text = "";
                textBox2.Text  = "";
                textBox3.Text  = "";
                textBox1.Text  = "";
                this.Close();
                Raw_material f13 = new Raw_material();
                f13.ShowDialog();
            }
            else if (comboBox1.Text == "Chowk powder")
            {
                edb.get(7);
                x = edb.quantity + y;
                cmd.CommandText = "update raw_material set quantity='" + x + "', cost='" + textBox2.Text + "', purchased_from='" + textBox3.Text + "', purchase_date='" + dateTimePicker1.Text + "' where name='" + comboBox1.Text + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                comboBox1.Text = "";
                textBox2.Text  = "";
                textBox3.Text  = "";
                textBox1.Text  = "";
                this.Close();
                Raw_material f13 = new Raw_material();
                f13.ShowDialog();
            }
        }