示例#1
0
        async void changer(DateTimeOffset dat, string subj, string grp, string name, int val)
        {
            StorageFolder folder = ApplicationData.Current.LocalFolder;

            StorageFile file = await folder.CreateFileAsync("db_TeacherRecords.xml", CreationCollisionOption.ReplaceExisting);

            XmlSerializer serializerSubjects = new XmlSerializer(typeof(List <TeacherRecord>));

            TeacherRecord record = new TeacherRecord()
            {
                data    = dat.Date.ToString(),
                subject = subj,
                group   = grp,
                student = name,
            };

            if (val == 0)
            {
                record.value = "nb";
            }
            else
            {
                record.value = val.ToString();
            }

            listrecords.Add(record);

            Stream stream = await file.OpenStreamForWriteAsync();

            serializerSubjects.Serialize(stream, listrecords);

            stream.Close();

            ListOfRecords.Items.Add(dat.Date.ToString() + ':' + subj + ':' + grp + ':' + name + ':' + record.value);
        }
示例#2
0
        async void getter()
        {
            TeacherRecord record = new TeacherRecord();

            StorageFolder folder = ApplicationData.Current.LocalFolder;

            StorageFile file = await folder.CreateFileAsync("db_TeacherRecords.xml", CreationCollisionOption.OpenIfExists);

            XmlSerializer serializerRecords = new XmlSerializer(typeof(List <TeacherRecord>));

            try
            {
                using (Stream stream = await file.OpenStreamForReadAsync())
                {
                    listrecords = (List <TeacherRecord>)serializerRecords.Deserialize(stream);
                }
            }
            catch
            {
            }

            ListOfRecords.Items.Clear();

            for (int count = 0; count < listrecords.Count; count++)
            {
                ListOfRecords.Items.Add(listrecords[count].data + ':' + listrecords[count].subject + ':' + listrecords[count].group + ':' + listrecords[count].student + ':' + listrecords[count].value);
            }
        }
示例#3
0
        async void getter_reconds()
        {
            TeacherRecord record = new TeacherRecord();

            StorageFolder folder = ApplicationData.Current.LocalFolder;

            StorageFile file = await folder.CreateFileAsync("db_TeacherRecords.xml", CreationCollisionOption.OpenIfExists);

            XmlSerializer serializerRecords = new XmlSerializer(typeof(List <TeacherRecord>));

            try
            {
                using (Stream stream = await file.OpenStreamForReadAsync())
                {
                    listrecords = (List <TeacherRecord>)serializerRecords.Deserialize(stream);
                }
            }
            catch
            {
            }

            for (int count = 0; count < listrecords.Count; count++)
            {
                if (listrecords[count].student == login)
                {
                    records.Add(listrecords[count]);
                }
            }
        }