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);
            }
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public Object CrearFichero(TipoFichero tipoFichero, string nombre)
        {
            switch (tipoFichero)
            {
            case TipoFichero.Texto:
                return(new FicheroTxt(nombre, System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDoc‌​uments), "ListadoDeAlumnos.txt")));

            case TipoFichero.Json:
                return(new FicheroJson(nombre, System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDoc‌​uments), "ListadoDeAlumnos.json")));

            default:
                return(new FicheroTxt(nombre, System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDoc‌​uments), "ListadoDeAlumnos.txt")));
            }
        }
Exemple #4
0
        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;
            }
        }
Exemple #5
0
        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();
 }