Example #1
0
        // Display a list of grades
        private void DisplayGrades(IEnumerable <Grade> gradeResults)
        {
            try
            {
                // Convert the list of grades from the format provided by the dataservice to the format displayed by the application
                List <LocalGrade> grades = new List <LocalGrade>();

                foreach (Grade g in gradeResults)
                {
                    LocalGrade grade = new LocalGrade();
                    grade.Record         = g;
                    grade.Record.Subject = ServiceUtils.GetSubject(g.SubjectId);
                    grades.Add(grade);
                }

                // Display the grades
                SessionContext.CurrentGrades = grades;
                ResetGrades();
            }
            catch (DataServiceQueryException ex)
            {
                MessageBox.Show(String.Format("Error: {0} - {1}",
                                              ex.Response.StatusCode.ToString(), ex.Response.Error.Message));
            }
        }
Example #2
0
        private async void Update_Click(object sender, RoutedEventArgs e)
        {
            LocalGrade grade = (sender as GrungeButton).Tag as LocalGrade;

            Grid     parentGrid = (sender as GrungeButton).Parent as Grid;
            DateTime dt         = (parentGrid.Children[0] as DatePicker).SelectedDate.Value;

            ServiceUtils utils = new ServiceUtils();
            await utils.UpdateGrade(grade.Record);
        }
        public AddGradeDialog()
        {
            InitializeComponent();

            _grade                = new LocalGrade();
            _grade.Record         = new Grade();
            _grade.CurrentSubject = ServiceUtils.Subjects[0];
            _grade.CurrentStudent = SessionContext.CurrentStudent.Record;
            _grade.AssessmentDate = DateTime.Now;
            _grade.Assessment     = "A";
            this.DataContext      = _grade;
        }