コード例 #1
0
 private bool EliminarReligion()
 {
     try
     {
         if (SelectedItem != null || SelectedItem.ID_RELIGION >= 100)
         {
             cReligion religion = new cReligion();
             if (!religion.Eliminar(SelectedItem.ID_RELIGION))
             {
                 return(false);
             }
             Clave           = 0;
             Descripcion     = string.Empty;
             SelectedEstatus = null;
             Busqueda        = string.Empty;
             GetReligiones();
         }
         return(true);
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al eliminar.", ex);
         return(false);
     }
 }
コード例 #2
0
        private void GuardarReligion()
        {
            try
            {
                cReligion religion = new cReligion();
                if (Clave > 0)
                {
                    //Actualizar
                    SelectedItem.DESCR   = Descripcion;
                    SelectedItem.ESTATUS = SelectedEstatus.CLAVE;
                    //tatuaje.Actualizar(SelectedItem);

                    religion.Actualizar(new RELIGION {
                        ID_RELIGION = Clave, DESCR = SelectedItem.DESCR, ESTATUS = SelectedEstatus.CLAVE
                    });
                }
                else
                {   //Agregar
                    religion.Insertar(new RELIGION {
                        ID_RELIGION = Clave, DESCR = Descripcion, ESTATUS = SelectedEstatus.CLAVE
                    });
                }
                //Limpiamos las variables
                Clave           = 0;
                Descripcion     = string.Empty;
                Busqueda        = string.Empty;
                SelectedEstatus = null;
                //Mostrar Listado
                GetReligiones();
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al guardar.", ex);
            }
        }