public MotivoEgreso Buscar(int id)
        {
            MotivoEgreso motivoEgreso_nueva = new MotivoEgreso();

            motivoEgreso.Buscar(id);
            return(motivoEgreso_nueva);
        }
Exemple #2
0
        public FrmAMEgreso(FrmABMBase form, int id)
        {
            InitializeComponent();
            //Seteo el panel contenedor como atributo
            form_contenedor = form;
            btn_crear.Text  = "Modificar";

            //Se obtiene el objeto a modificar
            motivoEgreso = negocio.Buscar(id);
            //Se actualizan los campos del formulario con los atributos
            txt_nombre.Text = motivoEgreso.Nombre;
        }
Exemple #3
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                if (TextBoxDescripcion.Text != string.Empty && comboBoxDesde.SelectedIndex > 0)
                {
                    MotivoEgreso _newitemMotivo = new MotivoEgreso();
                    _newitemMotivo.Descripcion = TextBoxDescripcion.Text;
                    _newitemMotivo.tipo_id     = Convert.ToInt32(comboBoxDesde.SelectedValue);

                    _Mod.Configuration.AutoDetectChangesEnabled = false;
                    _Mod.Configuration.ValidateOnSaveEnabled    = false;


                    if (_motivoID == 0)
                    {
                        _Mod.MotivoEgreso.Add(_newitemMotivo);
                    }
                    else
                    {
                        //_newitemMotivo.motivoEgreso_id = _motivoID;
                        //_Mod.MotivoEgreso.Attach(_newitemMotivo);

                        //_Mod.Entry(_newitemMotivo).Property(m => m.Descripcion).IsModified = true;


                        //LLAMO AL STORED QUE ACTUALIZA
                        // _Mod.Entry(_newitemMotivo).State = System.Data.Entity.EntityState.Modified;

                        _Mod.MED_ActualizaMotivoEgreso(_motivoID, TextBoxDescripcion.Text, _newitemMotivo.tipo_id);
                    }

                    _Mod.SaveChanges();
                    TraerMotivos();
                    comboBoxDesde.SelectedIndex = 0;
                    TextBoxDescripcion.Text     = string.Empty;
                    MessageBox.Show("Motivo creado o Modificado correctemente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else
                {
                    MessageBox.Show("Debe ingresar Descripción y Tipo de Egreso", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public override void ActualizarVisualizacion()
 {
     if (Grilla.Rows.Count == 0)
     {
         // Si la grilla esta vacia borra el texto
         lbl_visualizacion.Text = "";
     }
     else
     {
         //Busca la herramienta seleccionada en la bd por id
         MotivoEgreso motivoEgreso = new MotivoEgreso();
         //Carga un objeto con los datos de la tabal seleccionada
         motivoEgreso.Cargar_datos(TablaCompleta.Rows[this.Grilla.CurrentRow.Index]);
         //Rellena los campos con los datos
         lbl_visualizacion.Text  = "Id: " + motivoEgreso.Id;
         lbl_visualizacion.Text += "\nNombre: " + motivoEgreso.Nombre;
     }
 }
        public void Alta(string nombre)
        {
            MotivoEgreso motivoEgreso_nueva = new MotivoEgreso(nombre);

            motivoEgreso_nueva.Crear();
        }