Exemplo n.º 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                DAL.Plato plato = new DAL.Plato();

                plato.Nombre = txtNonmrePlato.Text;
                plato.Costo = Convert.ToDecimal(txtCostoPlato.Text);

                plato.Clasificacion.Codigo = Convert.ToInt32(cmBoxClasificacion.SelectedValue);

                foreach (DataGridViewRow row in dataGridViewRegistroPlato.Rows)
                {

                    if (row.Cells[0].Value != null && row.Cells[2].Value != null && row.Cells[3].Value != null)
                    {
                        DAL.Ingrediente ing = new DAL.Ingrediente();

                        ing.IdProducto = Convert.ToInt32(row.Cells["Codigo"].Value);
                        ing.Cantidad = (float)Convert.ToDouble(row.Cells["Cantidad"].Value);
                        ing.Unidad.Id = Convert.ToInt32(row.Cells["Unidad"].Value);

                        plato.setIngredientes(ing);
                    }

                }
                BRL.PlatoBRL.RegistraPlato(plato);
                MessageBox.Show("Datos Agregados");
                dataGridViewRegistroPlato.Rows.Clear();
                txtNonmrePlato.Clear();
                txtCostoPlato.Clear();

            }

            catch (SqlException ex)
            {
                MessageBox.Show("Error " + ex, "Error SQL", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("llene todos los campos", "Errror", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                DAL.Plato plato = new DAL.Plato();

                plato.Nombre = txtNonmrePlato.Text;
                plato.Costo  = Convert.ToDecimal(txtCostoPlato.Text);


                plato.Clasificacion.Codigo = Convert.ToInt32(cmBoxClasificacion.SelectedValue);

                foreach (DataGridViewRow row in dataGridViewRegistroPlato.Rows)
                {
                    if (row.Cells[0].Value != null && row.Cells[2].Value != null && row.Cells[3].Value != null)
                    {
                        DAL.Ingrediente ing = new DAL.Ingrediente();

                        ing.IdProducto = Convert.ToInt32(row.Cells["Codigo"].Value);
                        ing.Cantidad   = (float)Convert.ToDouble(row.Cells["Cantidad"].Value);
                        ing.Unidad.Id  = Convert.ToInt32(row.Cells["Unidad"].Value);

                        plato.setIngredientes(ing);
                    }
                }
                BRL.PlatoBRL.RegistraPlato(plato);
                MessageBox.Show("Datos Agregados");
                dataGridViewRegistroPlato.Rows.Clear();
                txtNonmrePlato.Clear();
                txtCostoPlato.Clear();
            }

            catch (SqlException ex)
            {
                MessageBox.Show("Error " + ex, "Error SQL", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("llene todos los campos", "Errror", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
 public static void ActualizaPlato(DAL.Plato ing)
 {
     DAL.Plato.actualizarIngredientes(ing);
 }
Exemplo n.º 4
0
 public static void RegistraPlato(DAL.Plato plato)
 {
     DAL.Plato.registraPlato(plato);
 }