Ejemplo n.º 1
0
 private bool EliminarPandilla()
 {
     try
     {
         if (SelectedItem != null)
         {
             cPandilla pandilla = new cPandilla();
             if (!pandilla.Eliminar(SelectedItem.ID_PANDILLA))
             {
                 return(false);
             }
             Pandilla        = null;
             Clave           = 0;
             Pandilla        = new PANDILLA();
             Busqueda        = string.Empty;
             Nombre          = Ubicacion = string.Empty;
             SelectedEstatus = null;
             this.GetPandilla();
         }
         return(true);
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al eliminar.", ex);
         return(false);
     }
 }
Ejemplo n.º 2
0
 private void GuardarPandilla()
 {
     try
     {
         cPandilla pandilla = new cPandilla();
         if (SelectedItem != null)
         {  //Actualizar
             SelectedItem.ID_PANDILLA = Clave;
             SelectedItem.NOMBRE      = Nombre;
             SelectedItem.UBICACION   = Ubicacion;
             SelectedItem.OBSERV      = Observaciones;
             SelectedItem.ESTATUS     = SelectedEstatus.DESCRIPCION == "ACTIVO" ? "S" : "N";
             pandilla.Actualizar(new PANDILLA
             {
                 ID_PANDILLA = Clave,
                 NOMBRE      = Nombre,
                 UBICACION   = Ubicacion,
                 OBSERV      = Observaciones,
                 ESTATUS     = SelectedEstatus.CLAVE
             });
         }
         else
         {   //Agregar
             pandilla.Insertar(new PANDILLA
             {
                 ID_PANDILLA = Clave,
                 NOMBRE      = Nombre,
                 UBICACION   = Ubicacion,
                 OBSERV      = Observaciones,
                 ESTATUS     = SelectedEstatus.CLAVE
             });
         }
         //Limpiamos las variables
         //Clave = 0;
         Nombre          = string.Empty;
         Clave           = 0;
         Ubicacion       = string.Empty;
         Observaciones   = string.Empty;
         SelectedEstatus = null;
         Busqueda        = string.Empty;
         //Mostrar Listado
         this.GetPandilla();
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al guardar.", ex);
     }
 }