Example #1
0
 private bool EliminarTipoLunar()
 {
     try
     {
         if (SelectedItem != null || SelectedItem.ID_LUNAR >= 100)
         {
             cTipoLunar tipoLunar = new cTipoLunar();
             if (!tipoLunar.Eliminar(SelectedItem.ID_LUNAR))
             {
                 return(false);
             }
             Clave           = 0;
             Descripcion     = string.Empty;
             SelectedEstatus = null;
             Busqueda        = string.Empty;
             //this.GuardarTipoLunar();
             this.GetTipoLunares();
         }
         return(true);
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al eliminar.", ex);
         return(false);
     }
 }
Example #2
0
 private void GetTipoLunares()
 {
     try
     {
         cTipoLunar tipoLunar = new cTipoLunar();
         ListItems.Clear();
         ListItems = tipoLunar.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 void GuardarTipoLunar()
 {
     try
     {
         cTipoLunar tipoLunar = new cTipoLunar();
         if (Clave > 0)
         {  //Actualizar
             SelectedItem.DESCR   = Descripcion;
             SelectedItem.ESTATUS = SelectedEstatus.CLAVE;
             tipoLunar.Actualizar(new TIPO_LUNAR
             {
                 ID_LUNAR = Clave,
                 DESCR    = Descripcion,
                 ESTATUS  = SelectedEstatus.CLAVE,
                 PM       = 0
             });
         }
         else
         {   //Agregar
             tipoLunar.Insertar(new TIPO_LUNAR
             {
                 ID_LUNAR = Clave,
                 DESCR    = Descripcion,
                 ESTATUS  = SelectedEstatus.CLAVE,
                 PM       = 0
             });
         }
         //Limpiamos las variables
         Clave           = 0;
         Descripcion     = string.Empty;
         SelectedEstatus = null;
         Busqueda        = string.Empty;
         //Mostrar Listado
         this.GetTipoLunares();
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al guardar.", ex);
     }
 }