Example #1
0
 private void GuardarTipoIngreso()
 {
     try
     {
         cTipoIngreso tipoIngreso = new cTipoIngreso();
         if (Clave > 0)
         {  //Actualizar
             SelectedItem.DESCR = Descripcion;
             tipoIngreso.Actualizar(SelectedItem);
         }
         else
         {   //Agregar
             tipoIngreso.Insertar(new TIPO_INGRESO
             {
                 ID_TIPO_INGRESO = Clave,
                 DESCR           = Descripcion
             });
         }
         //Limpiamos las variables
         Clave       = 0;
         Descripcion = string.Empty;
         Busqueda    = string.Empty;
         //Mostrar Listado
         this.GetTiposIngresos();
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al guardar.", ex);
     }
 }
Example #2
0
 private void GetTiposIngresos()
 {
     try
     {
         cTipoIngreso tipoIngreso = new cTipoIngreso();
         ListItems.Clear();
         ListItems = new List <TIPO_INGRESO>(tipoIngreso.ObtenerTodos(Busqueda));
         if (ListItems.Count > 0)
         {
             EmptyVisible = false;
         }
         else
         {
             EmptyVisible = true;
         }
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al obtener datos.", ex);
     }
 }
Example #3
0
 private bool EliminarTipoIngreso()
 {
     try
     {
         if (SelectedItem != null || SelectedItem.ID_TIPO_INGRESO >= 100)
         {
             cTipoIngreso tipoIngreso = new cTipoIngreso();
             if (!tipoIngreso.Eliminar(SelectedItem.ID_TIPO_INGRESO))
             {
                 return(false);
             }
             Clave       = 0;
             Descripcion = string.Empty;
             Busqueda    = string.Empty;
             this.GetTiposIngresos();
         }
         return(true);
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al eliminar.", ex);
         return(false);
     }
 }