Exemplo n.º 1
0
 //2-Cargo la lista con los detalle de ingrediente
 private void setDetalleIngredienteList(tbIngredientes ingrediente)
 {
     try
     {
         tbDetalleMovimiento detalle = new tbDetalleMovimiento();
         detalle.idIngrediente  = ingrediente.idIngrediente;//convierto el ingrediente como un detalle
         detalle.tbIngredientes = ingrediente;
         listaDetalleIngre.Add(detalle);
         cargarDataGridDetalle(detalle);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
        //CARGAR EL  DataGrid...CON LO QUE DESEO MOSTRAR EN ESTE CASO (ID-NOMBRE INGREDIENTE-TIPO MEDIDA)

        private void cargarDataGridDetalle(tbDetalleMovimiento detalle)
        {
            try
            {
                grvDetalleIngrediente.AllowUserToAddRows = true;
                DataGridViewRow row = (DataGridViewRow)grvDetalleIngrediente.Rows[0].Clone();

                row.Cells[0].Value = detalle.idIngrediente.ToString();
                row.Cells[1].Value = detalle.tbIngredientes.nombre.ToString();
                //row.Cells[2].Value = detalle.tbIngredientes.tbTipoMedidas.nomenclatura.ToString();

                listaDataGridValues.Add(row);
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se logro capturar el detalle");
            }
        }
Exemplo n.º 3
0
        //Guardar Formulario
        public bool guardar()
        {
            bool isok = false;

            tbMovimientos movimiento = new tbMovimientos();

            if (validarForm())
            {
                try
                {
                    tbDetalleMovimiento detalle = new tbDetalleMovimiento();

                    movimiento.idTipoMov = tipoMovimiento;
                    movimiento.motivo    = txtMotivo.Text;
                    movimiento.total     = Convert.ToDecimal(txtMontoTotal.Text);
                    movimiento.fecha     = Utility.getDate();
                    //AUDITORIA
                    movimiento.fecha_crea      = Utility.getDate();
                    movimiento.fecha_ult_mod   = Utility.getDate();
                    movimiento.usuario_crea    = Global.Usuario.nombreUsuario;
                    movimiento.usuario_ult_mod = Global.Usuario.nombreUsuario;
                    movimiento.estado          = true;

                    refrescarListaDetalle();

                    movimiento.tbDetalleMovimiento = listaDetalleIngre;

                    tbMovimientos mov = BmoviIns.Guardar(movimiento);
                    isok = true;

                    txtID.Text = mov.idMovimiento.ToString();

                    MessageBox.Show("Los datos se guardaron correctamente");
                } //TRY

                catch (EntityExistException ex)
                {
                    MessageBox.Show(ex.Message);
                    isok = false;
                }

                catch (EntityDisableStateException ex)

                {
                    DialogResult result = MessageBox.Show(ex.Message, "Existe el movimiento", MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        chkEstado.Checked = true;
                        moviGloval        = movimiento;
                        isok = modificar();
                    }
                    else
                    {
                        isok = false;
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    isok = false;
                }
            }// IF VALIDAR
            else
            {
                isok = false;
            }

            return(isok);
        }