Example #1
0
        public void LoadFrom(byte type, string fileName)
        {
            IO file = null;

            switch (type)
            {
            case 1:
                file = new CSV();
                break;

            case 2:
                file = new Bin();
                break;

            case 3:
                file = new XMLSax();
                break;

            case 4:
                file = new XMLDOM();
                break;

            case 5:
                file = new SerializeXML();
                break;

            case 6:
                file = new LinqXML();
                break;

            case 7:
                file = new SerializeJsonDC();
                break;

            case 8:
                file = new SerializeJsonJSS();
                break;
            }

            try
            {
                Student[] std = file.load(fileName);
                students.Clear();
                foreach (Student stud in std)
                {
                    students.Add(stud);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #2
0
        public void SaveTo(byte type, string fileName)
        {
            IO file = null;

            switch (type)
            {
            case 1:
                file = new CSV();
                break;

            case 2:
                file = new Bin();
                break;

            case 3:
                file = new XMLSax();
                break;

            case 4:
                file = new XMLDOM();
                break;

            case 5:
                file = new SerializeXML();
                break;

            case 6:
                file = new LinqXML();
                break;

            case 7:
                file = new SerializeJsonDC();
                break;

            case 8:
                file = new SerializeJsonJSS();
                break;
            }
            try
            {
                file.save(fileName, students.ToArray());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }