public void Formater(TipoFichero tipoFichero) { try { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); _log.Info("Inicio AlumnoBl " + System.Reflection.MethodBase.GetCurrentMethod().Name); var value = (int)tipoFichero; config.AppSettings.Settings["tipoFichero"].Value = value.ToString(); config.Save(ConfigurationSaveMode.Modified); } catch (ConfigurationErrorsException ex) { _log.Fatal("Error en " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Error al Escribir en AppSettings--> " + ex.Message); throw; } catch (Exception ex) { _log.Fatal("Error en " + System.Reflection.MethodBase.GetCurrentMethod().Name + "--> " + ex.Message); throw; } finally { _log.Info("Fin de AlumnoBl " + System.Reflection.MethodBase.GetCurrentMethod().Name); } }
public void Formatear(TipoFichero tipoFichero) { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var value = (int)tipoFichero; config.AppSettings.Settings["tipoFichero"].Value = value.ToString(); config.Save(ConfigurationSaveMode.Modified); }
public Object CrearFichero(TipoFichero tipoFichero, string nombre) { switch (tipoFichero) { case TipoFichero.Texto: return(new FicheroTxt(nombre, System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ListadoDeAlumnos.txt"))); case TipoFichero.Json: return(new FicheroJson(nombre, System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ListadoDeAlumnos.json"))); default: return(new FicheroTxt(nombre, System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ListadoDeAlumnos.txt"))); } }
public void CrearFicheroTest(TipoFichero tipo, string nombre) { IFichero fichero = (IFichero)ficheroFactory.CrearFichero(tipo, nombre); switch (tipo) { case TipoFichero.Json: Assert.IsTrue(fichero.GetType() == typeof(FicheroJson)); break; case TipoFichero.Texto: Assert.IsTrue(fichero.GetType() == typeof(FicheroTxt)); break; } }
public static Idocument <T> getFormat(TipoFichero dataType) { switch (dataType) { case TipoFichero.TXT: return(new DocumentTxt <T>()); case TipoFichero.JSON: return(new DocumentJson <T>()); case TipoFichero.XML: return(new DocumentXml <T>()); default: return(null); } }
public DocumentManager(TipoFichero tipo) { this.tipo = tipo; LoadDocument(); }