Exemplo n.º 1
0
 public static bool GuardaCatastrofes(string nomeFicheiro)
 {
     try
     {
         return(Catastrofes.Save(nomeFicheiro));
     }
     catch (Exception e)
     {
         throw new Exception("Erro ao guardar dados no ficheiro de catastrofes " + e.Message);
     }
 }
Exemplo n.º 2
0
 public static bool ApagaCatastrofe(Catastrofe c)
 {
     try
     {
         return(Catastrofes.ApagaCatastrofe(c));
     }
     catch (Exception e)
     {
         throw new Exception("Erro ao apagar catástrofe " + e.Message);
     }
 }
Exemplo n.º 3
0
 public static bool ExisteCatastrofe(string nome)
 {
     try
     {
         return(Catastrofes.ExisteCatastrofe(nome));
     }
     catch (Exception e)
     {
         throw new Exception("Erro ao verificar se existe catástrofe " + e.Message);
     }
 }
Exemplo n.º 4
0
 public static Catastrofe ProcuraCatastrofe(int id)
 {
     try
     {
         return(Catastrofes.ProcuraCatastrofe(id));
     }
     catch (Exception e)
     {
         throw new Exception("Erro ao procurar catástrofe " + e.Message);
     }
 }
Exemplo n.º 5
0
 public static bool CarregaCatastrofes(string nomeFicheiro)
 {
     try
     {
         if (File.Exists(nomeFicheiro))
         {
             return(Catastrofes.Load(nomeFicheiro));
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         throw new Exception("Erro ao carregar dados do ficheiro de catastrofes " + e.Message);
     }
 }
Exemplo n.º 6
0
 public static int InsereCatastrofe(Catastrofe c)
 {
     try
     {
         if (!ExisteCatastrofe(c.Nome))
         {
             return(Catastrofes.InsereCatastrofe(c));
         }
         else
         {
             return(0);
         }
     }
     catch (Exception e)
     {
         throw new Exception("Erro ao inserir catástrofe " + e.Message);
     }
 }