Beispiel #1
0
 private void btnAgregarIns_Click(object sender, EventArgs e)
 {
     if (insumos == null)
     {
         insumos                        = new Insumos();
         insumos.Owner                  = this;
         insumos.FormClosed            += materia_FormClosed;
         insumos.SaveEditinputs.Visible = false;
         insumos.IDinputs.Visible       = false;
         insumos.ins.Visible            = false;
         insumos.dateTimePicker1.Value  = DateTime.Today;
         insumos.Show();
     }
     else
     {
         insumos.Activate();
     }
 }
Beispiel #2
0
        private void txtUniMedida_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (txtTipo.Enabled == true)
            {
                txtName.Items.Clear();
                const string message = "¿El producto de compra ya está dado de alta en el inventario?";
                const string captiom = "Advertencia";
                if (txtTipo.Text.Equals("Materia Prima"))
                {
                    var result = MessageBox.Show(message, captiom, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result == DialogResult.Yes)
                    {
                        MessageBox.Show("Favor de seleccionar el producto existente", captiom, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        SqlCommand j = new SqlCommand("select name from rawMaterials", connection);
                        connection.Open();
                        SqlDataReader r = j.ExecuteReader();
                        while (r.Read())
                        {
                            txtName.Items.Add(r["name"].ToString());
                        }
                        connection.Close();
                    }
                    else
                    {
                        MateriaPrima m = new MateriaPrima();
                        this.Close();
                        m.Show();
                    }
                }

                else if (txtTipo.Text.Equals("Producto Terminado"))
                {
                    var result2 = MessageBox.Show(message, captiom, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result2 == DialogResult.Yes)
                    {
                        MessageBox.Show("Favor de seleccionar el producto existente", captiom, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        SqlCommand g = new SqlCommand("select name from FinishedProducts", connection);
                        connection.Open();
                        SqlDataReader y = g.ExecuteReader();
                        while (y.Read())
                        {
                            txtName.Items.Add(y["name"].ToString());
                        }
                        connection.Close();
                    }
                    else
                    {
                        ProductoExistente prod = new ProductoExistente();
                        this.Close();
                        prod.Show();
                    }
                }
                else if (txtTipo.Text.Equals("Insumo"))
                {
                    var result3 = MessageBox.Show(message, captiom, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result3 == DialogResult.Yes)
                    {
                        MessageBox.Show("Favor de seleccionar el producto existente", captiom, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        SqlCommand k = new SqlCommand("select name from inputs", connection);
                        connection.Open();
                        SqlDataReader z = k.ExecuteReader();
                        while (z.Read())
                        {
                            txtName.Items.Add(z["name"].ToString());
                        }
                        connection.Close();
                    }
                    else
                    {
                        Insumos ins = new Insumos();
                        this.Close();
                        ins.Show();
                    }
                }
            }
        }