//Agregar materia prima private void BtnPDF_Click(object sender, EventArgs e) { if (materia == null) { materia = new MateriaPrima(); materia.Owner = this; materia.FormClosed += materia_FormClosed; materia.SaveEdit.Visible = false; materia.ID.Visible = false; materia.mat.Visible = false; materia.dateTimePicker1.Value = DateTime.Today; materia.Show(); } else { materia.Activate(); } }
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(); } } } }