示例#1
0
        private void buttonSignIn_Click(object sender, EventArgs e)
        {
            //Presence check
            if(textBoxStudentID.Text.Length>0 & textBoxStudentName.Text.Length>0)
            {
                Student student = Student.Get(int.Parse(textBoxStudentID.Text));
                if (student == null)
                {
                    //Creates a new student
                    student = new Student();
                    student.StudentID = int.Parse(textBoxStudentID.Text);
                    student.StudentName = textBoxStudentName.Text;
                    //Pass the student
                }else
                {
                    student.StudentName = textBoxStudentName.Text;

                }
                Console.WriteLine("CName: "+student.CourseName);

                MainForm mainForm = new MainForm(student);
                mainForm.LoadModules(LevelType.Level4);
                mainForm.LoadModules(LevelType.Level5);
                mainForm.LoadModules(LevelType.Level6);
                mainForm.Show();

                this.Hide();
            }
        }
示例#2
0
        /// <summary>
        /// To create a new module
        /// </summary>
        /// <param name="student"></param>
        /// <param name="level"></param>
        /// <param name="mainform"></param>
        public ModuleForm(Student student, LevelType level, MainForm mainform)
        {
            InitializeComponent();

            this.student = student;
            this.level = level;
            this.mainform = mainform;
        }
示例#3
0
        /// <summary>
        /// Edit existing details of a module
        /// </summary>
        /// <param name="module"></param>
        /// <param name="level"></param>
        /// <param name="mainform"></param>
        public ModuleForm(Module module, LevelType level, MainForm mainform)
        {
            InitializeComponent();

            this.module = module;
            this.level = level;
            this.mainform = mainform;

            //Set the values of the existing module
            textBoxMCode.Text = module.Code;
            textBoxMName.Text = module.Name;
            comboBoxCredit.SelectedValue = module.Credits;

            //Add assessment details
            foreach (Assessment asm in module.Assessments)
            {
                int index = dataGridView1.Rows.Add(1);
                dataGridView1.Rows[index].Cells[0].Value = asm.Type;
                dataGridView1.Rows[index].Cells[1].Value = asm.Weight;
            }
            //Flag variable to update or add a new module
            updateModule = true;
        }