コード例 #1
0
        private void BtnEnviar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DataTable UpdateIngredientes = ingredientesDT.GetChanges();
                foreach (DataRow row in UpdateIngredientes.Rows)
                {
                    ingredienteBLL ingBLL   = new ingredienteBLL();
                    int            id       = int.Parse(row[0].ToString());
                    double         cantidad = double.Parse(row[2].ToString());
                    ingBLL.UpdateStockIngrediente(id, cantidad);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: {0}", ex.ToString());
            }

            try
            {
                DataTable UpdatePlato = PlatosACocina;
                foreach (DataRow row in UpdatePlato.Rows)
                {
                    PlatoBLL plaBLL   = new PlatoBLL();
                    int      id       = int.Parse(row[0].ToString());
                    int      cantidad = int.Parse(row[2].ToString());
                    plaBLL.SetStockPlato(id, cantidad);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: {0}", ex.ToString());
            }

            MessageBox.Show("Se han enviado correctamente el registro a cocina");
            ReloadPage();
        }