Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            // Number + Description
            try
            {
                teacherController.SetMarkNumber(decimal.Parse(AddMark));
                if (teacherController.MarkValue(decimal.Parse(AddMark)) != "Incorrect")
                {
                    teacherController.SetMarkDescription();
                }
                else
                {
                    MessageBox.Show("Mark value is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            catch (Exception)
            {
                MessageBox.Show("Mark value is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Date
            teacherController.SetMarkDate(MarkDateTime);

            // Subject ID
            teacherController.SetMarkSubjectId(egnPass);

            // Student ID
            {
                string selectedStudent = SelectStudentComboBox.SelectedItem.ToString();
                teacherController.SetStudentId(selectedStudent);
            }
            //Mark teacher
            {
                teacherController.SetMarkTeacherID(egnPass);
            }
            teacherController.CommitChangedMark();
            MessageBox.Show("Success!", "Operation Completed", MessageBoxButtons.OK);
            selectStudentComboBox.Text = String.Empty;
        }