public static int sumModuleCredit(Module[] modules)
        {
            int acc = 0;
            foreach (Module m in modules)
            {
                acc += m.getCredit();
            }

            return acc;
        }
        public ListAssessments(FormClosedEventHandler onClose, Module module)
        {
            this.module = module;
            acglist = new List<AssessmentControlGroup>();
            InitializeComponent();

            update_panel();
            this.FormClosed += onClose;
            this.Focus();
        }
        public SummaryModuleGroup(Level level, Module module, Panel root)
        {
            this.root = root;
            this.level = level;
            this.module = module;

            modCode = new Label();
            modName = new Label();
            modCerdits = new Label();
            modAvg = new Label();
            modStatus = new Label();
        }
        public AssessmentControlGroup(FormClosedEventHandler updateFCEH, EventHandler updateEH, Module module, int maxweight, Assessment assessment, Panel root)
        {
            this.root = root;
            this.module = module;
            this.assessment = assessment;
            this.maxweight = maxweight;

            this.updateFCEH = updateFCEH;
            this.updateEH = updateEH;

            assessName = new Label();
            assessMark = new Label();
            assessWeight = new Label();
            assessStatus = new Label();
            assessEdit = new Button();
            assessDelete = new Button();
        }
        public AddAssessment(FormClosedEventHandler onClose, Module module, int maxweight, Assessment assessment = null)
        {
            this.module = module;
            this.assessment = assessment;
            this.maxweight = maxweight;

            InitializeComponent();

            if (this.assessment != null)
            {
                this.AssessmentNameText.Text = assessment.getName();
                this.AssessmentMarkNUD.Value = (decimal)assessment.getMark();
                this.AssessmentWeightNUD.Value = (decimal)assessment.getWeight();
                this.maxweight += this.assessment.getWeight();
            }

            this.FormClosed += onClose;
            this.Focus();
        }
        public ModuleControlGroup(FormClosedEventHandler updateTabFCEH, EventHandler updateTabEH, Course course, Level level, int maxcredit, Module module, Panel root)
        {
            this.root = root;
            this.course = course;
            this.level = level;
            this.module = module;
            this.maxcredit = maxcredit;

            this.updateTabFCEH = updateTabFCEH;
            this.updateTabEH = updateTabEH;

            modCodeLabel = new Label();
            modName = new Label();
            modCerdits = new Label();

            modAssessments = new Button();
            modEdit = new Button();
            modDelete = new Button();

            modAvg = new Label();
            modStatus = new Label();
        }
        public Module addModule(Level l, string code, string name, int cred)
        {
            Module module;
            XmlNode level = getLevel(l);
            XmlElement modnode;

            modnode = root.CreateElement("module");
            modnode.Attributes.Append(root.CreateAttribute("code"));
            modnode.Attributes.Append(root.CreateAttribute("name"));
            modnode.Attributes.Append(root.CreateAttribute("credit"));
            level.AppendChild (modnode);

            module = new Module(root, modnode);
            module.setCode(code);
            module.setName(name);
            module.setCredit(cred);

            return module;
        }
        public Module[] getModules(Level l)
        {
            int modcount;
            Module[] modlist;
            XmlNode level = getLevel(l);

            modcount = level.ChildNodes.Count;
            modlist = new Module[modcount];

            for(int i = 0; i < modcount; i++)
            {
                modlist[i] = new Module(root, level.ChildNodes[i]);
            }

            return modlist;
        }
 public void delModule(Level l, Module module)
 {
     XmlNode level = getLevel(l);
     level.RemoveChild(module.getNode());
 }