Пример #1
0
        private void BtnEditar_Click(object sender, EventArgs e)
        {
            List <Ingrediente> ingredientes = new List <Ingrediente>();

            foreach (DataGridViewRow r in dgvIngredientes.Rows)
            {
                Ingrediente ing = new Ingrediente
                {
                    IdIngrediente = int.Parse(r.Cells["IdIngrediente"].Value.ToString())
                };
                int cantidad = int.Parse(r.Cells["Cantidad"].Value.ToString());
                ing.NombreProducto = r.Cells["NombreProducto"].Value.ToString();
                ing.CostoxKg       = double.Parse(r.Cells["CostoxKg"].Value.ToString());
                ing.IdCategoria    = int.Parse(r.Cells["IdCategoria"].Value.ToString());
                ing.Unidad         = r.Cells["Unidad"].Value.ToString();
                string unidad = ing.Unidad.Trim() == "g" ? "gramos" : ing.Unidad.Trim() == "u" ? "unidades" : "milimetros";
                ing.Plato = new PanelPlato(ing.NombreProducto, unidad)
                {
                    Tag = ing.IdIngrediente
                };
                ing.Plato.NudGramos.Value = cantidad;
                ingredientes.Add(ing);
            }
            DataGridViewRow plato = dgvPlatos.SelectedRows[0];

            Plato p = new Plato()
            {
                Nombre    = plato.Cells["Nombre"].Value.ToString()
                , IdPlato = int.Parse(plato.Cells["IdPlato"].Value.ToString())
                , Precio  = decimal.Parse(plato.Cells["Precio"].Value.ToString())
                , TACC    = bool.Parse(plato.Cells["TACC"].Value.ToString())
                , Costo   = decimal.Parse(plato.Cells["Costo"].Value.ToString())

                , IdCategoria = int.Parse(plato.Cells["IdCategoria"].Value.ToString())
            };
            frmCrearPlatoSeleccionIng ofrmSelIng = new frmCrearPlatoSeleccionIng(ingredientes, p);

            ofrmSelIng.ShowDialog();
            Setear();
        }
Пример #2
0
 private void BtnPlato_Click(object sender, EventArgs e)
 {
     ofrmPlato = new frmCrearPlatoSeleccionIng();
     ofrmPlato.ShowDialog();
 }