示例#1
0
        private void ToGradeable_Click(object sender, RoutedEventArgs e)
        {
            var problems = new ProblemMapping(ProblemsText.Text);
            var students = problems.GetFillers(StudentsText.Text);

            StudentsText.Text = ProblemMapping.ToCsv(students, "\t");
        }
示例#2
0
        private void UpdateDefaultStudents_Click(object sender, RoutedEventArgs e)
        {
            var problems        = new ProblemMapping(ProblemsText.Text);
            var students        = problems.GetFillers(StudentsText.Text);
            var defaultStudents =
                from grade in Grade.FetchAll(problems, students, _allGrades, _relative)
                select grade.PopulateDefaultGrades();

            StudentsText.Text = ProblemMapping.ToCsv(defaultStudents.ToArray(), "\t");
        }
示例#3
0
        private void SaveToCsv(ProblemMapping problems, ICollection <IDictionary <string, string> > students)
        {
            var gradedStudents = Grade.FetchAll(problems, students, _allGrades, _relative).Select(grade => grade.Student).ToArray();
            var csv            = ProblemMapping.ToCsv(gradedStudents);
            var dialog         = new SaveFileDialog {
                DefaultExt = "csv", Filter = "Comma Separated Values|*.csv|All files|*.*"
            };

            if (dialog.ShowDialog() == true)
            {
                using (var stream = dialog.OpenFile())
                    using (var sw = new StreamWriter(stream))
                    {
                        sw.Write(csv);
                    }
                System.Diagnostics.Process.Start(dialog.FileName);
            }
        }