コード例 #1
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            char gender = GenderComboBox.SelectionBoxItem.ToString()[0];

            student.ID       = IDTextBox.Text;
            student.Fullname = FullnameTextBox.Text;
            student.Gender   = gender;
            student.Birthday = BirthdayTextBox.Text;
            student.SocialID = SocialIDTextBox.Text;
            student.Print();

            if (service.AddStudent(student) != null)
            {
                MessageBox.Show("Student added");
            }
            else
            {
                MessageBox.Show("Something wrong was happened, please check your input!");
            }

            var listSections = sectionService.GetListSections();

            foreach (var section in listSections)
            {
                if (section.ClassID == student.ClassID)
                {
                    reportService.RegisterSection(section.ID, student.ID);
                }
            }
        }
        private void submitButton_Click(object sender, RoutedEventArgs e)
        {
            GradeReportService service = new GradeReportService();

            if (service.RegisterSection(section.ID, IDTextBox.Text) == null)
            {
                MessageBox.Show("Does student exist?");
                return;
            }

            DialogResult = true;
        }