示例#1
0
        //editar insumo
        private void btnEditInsu_Click(object sender, EventArgs e)
        {
            Insumos ins = new Insumos();

            ins.btnGuardar.Visible       = false;
            ins.txtCanAdqInsumos.Enabled = false;
            ins.ins.Visible = false;

            if (dataGridView2.SelectedRows.Count > 0)
            {
                ins.txtUniMedInsu.Text = string.Empty;

                ins.IDinputs.Text = dataGridView2.CurrentRow.Cells["Id"].Value.ToString();

                ins.dateTimePicker1.Value    = Convert.ToDateTime(dataGridView2.CurrentRow.Cells["date"].Value.ToString());
                ins.txtUniMedInsu.Text       = dataGridView2.CurrentRow.Cells["unitOfMeasure"].Value.ToString();
                ins.txtCanAdqInsumos.Text    = dataGridView2.CurrentRow.Cells["amountPurchased"].Value.ToString();
                ins.txtDesInsumo.Text        = dataGridView2.CurrentRow.Cells["description"].Value.ToString();
                ins.txtNombreInsumo.Text     = dataGridView2.CurrentRow.Cells["name"].Value.ToString();
                ins.txtPrecioInsumo.Text     = dataGridView2.CurrentRow.Cells["unitPrice"].Value.ToString();
                ins.txtCostoTotalInsumo.Text = dataGridView2.CurrentRow.Cells["total"].Value.ToString();

                byte[]       img = (byte[])dataGridView2.CurrentRow.Cells["photo"].Value;
                MemoryStream ms  = new MemoryStream(img);

                ins.FotoProduc.Image = Image.FromStream(ms, true, true);
                ins.IDinputs.Visible = false;
                ins.ShowDialog();
            }
            else
            {
                MessageBox.Show("Seleccione una fila por favor");
            }
        }
示例#2
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();
     }
 }
示例#3
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();
                    }
                }
            }
        }