コード例 #1
0
        public List <Alumno> Select(Campo campo, string value)
        {
            Filtro fl;

            switch ((TypeFormat)Enum.Parse(typeof(TypeFormat), UtilsConfiguration.GetFormatConfig()))
            {
            case TypeFormat.txt:
                var txt = new StudentTxt <Alumno>();
                fl = new Filtro(txt.ReadAll());
                return(fl.Select(campo, value));

            case TypeFormat.json:
                fl = new Filtro(SingletonJson <Alumno> .Instance.GetList());
                return(fl.Select(campo, value));

            case TypeFormat.xml:
                fl = new Filtro(SingletonXml <Alumno> .Instance.GetList());
                return(fl.Select(campo, value));

            case TypeFormat.sql:
                var sql = new StudentSql <Alumno>();
                fl = new Filtro(sql.ReadAll());
                return(fl.Select(campo, value));

            default:
                var df = new StudentTxt <Alumno>();
                fl = new Filtro(df.ReadAll());
                return(fl.Select(campo, value));
            }
        }
コード例 #2
0
        public List <Alumno> GetSelect(TypeFormat type, string value, Campo campo)
        {
            try
            {
                switch (type)
                {
                case TypeFormat.Txt:
                    Log.Debug("select hecho en Txt");
                    Filtro = new Filtro(SingletonTxt.Instance);
                    return(Filtro.Select(campo, value));

                case TypeFormat.Json:
                    Log.Debug("select hecho en  Json");
                    Filtro = new Filtro(SingletonJson.Instance);
                    return(Filtro.Select(campo, value));

                case TypeFormat.Xml:
                    Log.Debug("select hecho en  Xml");
                    Filtro = new Filtro(SingletonXml.Instance);
                    return(Filtro.Select(campo, value));

                case TypeFormat.Spl:
                    Log.Debug("select hecho en  Xml");
                    Filtro = new Filtro(SingletonSql.Instance);
                    return(Filtro.Select(campo, value));

                default:
                    Filtro = new Filtro(SingletonTxt.Instance);
                    return(Filtro.Select(campo, value));
                }
            }
            catch (FormatException e)
            {
                Log.Error("el Enum no es correcto " + e);
                throw;
            }
        }