/// <summary> /// Funcao para carregar infecao de ficheiro binario /// </summary> /// @param name="filename"> nome do ficheiro a carregar </param> /// @param name="perfil"></param> /// <returns></returns> public static bool ListaInfecaoLoadBinFile(string filename, int perfil) { // Auxiliary variables bool resultado = false; // Apply rule if (perfil > 0) { // Get access to the file try { resultado = ListaDoentes.LoadBinFile(filename); } // Error Handling - Exceptions catch (FileNotFoundException f) { throw new FileNotFoundException("Error! " + f.Message); } catch (SerializationException f) { throw new SerializationException("Error! " + f.Message); } catch (IOException f) { throw new IOException("Error! " + f.Message); } catch (Exception f) { throw new Exception("Error! " + f.Message); } } return(resultado); }
/// <summary> /// Funcao para salvar infecao em ficheiro binario /// </summary> /// @param name="filename"> nome do ficheiro a guardar </param> /// @param name="perfil"></param> /// <returns></returns> public static bool ListaInfecaoSaveBinFile(string filename, int perfil) { // Varialvel aux bool resultado = false; if (perfil > 0) { try { resultado = ListaDoentes.SaveBinFile(filename); } catch (FileNotFoundException f) { throw new FileNotFoundException("Error! " + f.Message); } catch (SerializationException f) { throw new SerializationException("Error! " + f.Message); } catch (IOException f) { throw new IOException("Error! " + f.Message); } catch (Exception f) { throw new Exception("Error! " + f.Message); } } return(resultado); }
/// <summary> /// Funcao para inserir um doente /// </summary> /// @param name="doente"> Doente a inserir </param> /// @param name="perfil"> Perfil a atribuir ao doente </param> /// <returns></returns> public static bool InserirDoente(Doentes doente, int perfil) { // Varialvel aux bool resultado = false; if (perfil > 0) { try { resultado = ListaDoentes.AddDoente(doente); } catch (Exception e) { throw new Exception("Error! " + e.Message); } } return(resultado); }
/// <summary> /// Funcao para procurar doente por nome /// </summary> /// @param name="nome"> nome do doente a procurar </param> /// @param name="perfil"></param> /// <returns></returns> public static Doentes ProcurarDoenteNome(string nome, int perfil) { // Get access to the class if (perfil > 0) { try { return(ListaDoentes.ProcurarDoenteNome(nome)); } catch (ArgumentException e) { throw new ArgumentException("Error! " + e.Message); } catch (Exception e) { throw new Exception("Error! " + e.Message); } } return(null); }