private void ModuleSaveButton_Click(object sender, EventArgs e) { String Code = ModuleCodeText.Text.Trim(); String Name = ModuleTitleText.Text.Trim(); if (Name.Equals("") || Code.Equals("")) { MessageBox.Show("Module Name/Code is empty.", "Error?", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int cred; if (Credit15.Checked) { cred = 15; } else { cred = 30; } if (cred > maxcredit) { MessageBox.Show("Credit limit exceeded.", "Error?", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (module == null) { module = course.addModule(level, Code, Name, cred); } else { module.setCode(Code); module.setName(Name); module.setCredit(cred); } ListAssessments form = new ListAssessments(updateOnCloseHandler, module); this.Close(); form.Show(); }
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 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; }