예제 #1
0
 public static void SaveGradebook(GradebookModel gradebook)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(GradebookModel));
     using (StreamWriter writer = new StreamWriter(PATH))
     {
         serializer.Serialize(writer, gradebook);
     }
 }
예제 #2
0
        public static GradebookModel getGradebook()
        {
            GradebookModel gradebook = new GradebookModel();
            XmlSerializer deserializer = new XmlSerializer(typeof(GradebookModel));

            try
            {
                using (StreamReader reader = new StreamReader(PATH))
                {
                    gradebook = (GradebookModel)deserializer.Deserialize(reader);
                }
            }
            catch (FileNotFoundException)
            {
                //TODO: Do Something
            }

            return gradebook;
        }
예제 #3
0
        public void Save()
        {
            GradebookModel _gradebook = new GradebookModel(this);
            GradebookDao.SaveGradebook(_gradebook);

            StateManager.Clean();
        }