private List <string> courseObjs = new List <string>(); //list of course objectives specified by an XML file read on startup //objective node constructor public objNode() { objective = null; totalStudents = 0; weightedAverage = 0.0; nextObjNode = null; }
//sets the next node in the linked list public void setNextObjNode(objNode nextObjNode) { this.nextObjNode = nextObjNode; }
//load in the objective map xml private void objectiveXMLLoad() { char objChar; //subobjective name character variable string objName; //full objective name XElement xmlDoc = null; //xelement to load the objective map in //integers that record the number subobjectives per super objective int psctFieldsInt = 0; int cisFieldsInt = 0; int eprFieldsInt = 0; int dpwcFieldsInt = 0; bool firstObjectiveSet = true; //a flag to verify the head of the linked list is set try { xmlDoc = XElement.Load("..\\objectives.xml"); //load the objective map xml file in //read in the fields attribute for the superobjectives to record how many subobjectives there are var psctFields = (from elem in xmlDoc.Elements("PSCT").Attributes("fields") select elem.Value); var cisFields = (from elem in xmlDoc.Elements("CIS").Attributes("fields") select elem.Value); var eprFields = (from elem in xmlDoc.Elements("EPR").Attributes("fields") select elem.Value); var dpwcFields = (from elem in xmlDoc.Elements("DPWC").Attributes("fields") select elem.Value); //parse the number of subobjectives to an int Int32.TryParse(psctFields.ElementAt(0).ToString(), out psctFieldsInt); Int32.TryParse(cisFields.ElementAt(0).ToString(), out cisFieldsInt); Int32.TryParse(eprFields.ElementAt(0).ToString(), out eprFieldsInt); Int32.TryParse(dpwcFields.ElementAt(0).ToString(), out dpwcFieldsInt); //create a node for each subobjective of PSCT for (int i = 1; i <= psctFieldsInt; i++) { objNode newObjNode = new objNode(); //the node with all the info being added objChar = (char)(i + 96); //the subobjective name based on a char objName = "PSCT" + objChar.ToString(); //create the subobjective name used in the xml file newObjNode.setObjective("Problem Solving and Critical Thinking " + objChar.ToString()); //set the objective name for the node and output //variable the houses the course objectives mapped to the subobjective var psctCourseObjs = (from elem in xmlDoc.Elements("PSCT").Elements(objName).Elements("courseObj") select elem.Value); foreach (var parse in psctCourseObjs) { newObjNode.addCourseObj(parse); //add the course objectives to the node } if (firstObjectiveSet) //if this is the first objective overall { objectiveList.setHead(newObjNode); objectiveList.setTail(newObjNode); firstObjectiveSet = false; //make sure the head is not set again } else { objectiveList.getTail().setNextObjNode(newObjNode); //set the current tail's next node to the current one objectiveList.setTail(newObjNode); //set the tail of the list to the current node } } //create a node for each subobjective of CIS for (int i = 1; i <= cisFieldsInt; i++) { objNode newObjNode = new objNode(); //the node with all the info being added objChar = (char)(i + 96); //the subobjective name based on a char objName = "CIS" + objChar.ToString(); //create the subobjective name used in the xml file newObjNode.setObjective("Communication and Interpersonal Skills " + objChar.ToString()); //variable the houses the course objectives mapped to the subobjective var cisCourseObjs = (from elem in xmlDoc.Elements("CIS").Elements(objName).Elements("courseObj") select elem.Value); foreach (var parse in cisCourseObjs) { newObjNode.addCourseObj(parse); //add the course objectives to the node } if (firstObjectiveSet) //if this is the first objective overall { objectiveList.setHead(newObjNode); objectiveList.setTail(newObjNode); firstObjectiveSet = false; //make sure the head is not set again } else { objectiveList.getTail().setNextObjNode(newObjNode); //set the current tail's next node to the current one objectiveList.setTail(newObjNode); //set the tail of the list to the current node } } //create a node for each subobjective of EPR for (int i = 1; i <= eprFieldsInt; i++) { objNode newObjNode = new objNode(); //the node with all the info being added objChar = (char)(i + 96); //the subobjective name based on a char objName = "EPR" + objChar.ToString(); //create the subobjective name used in the xml file newObjNode.setObjective("Ethical and Professional Responsibilities " + objChar.ToString()); //variable the houses the course objectives mapped to the subobjective var eprCourseObjs = (from elem in xmlDoc.Elements("EPR").Elements(objName).Elements("courseObj") select elem.Value); foreach (var parse in eprCourseObjs) { newObjNode.addCourseObj(parse); //add the course objectives to the node } if (firstObjectiveSet) //if this is the first objective overall { objectiveList.setHead(newObjNode); objectiveList.setTail(newObjNode); firstObjectiveSet = false; //make sure the head is not set again } else { objectiveList.getTail().setNextObjNode(newObjNode); //set the current tail's next node to the current one objectiveList.setTail(newObjNode); //set the tail of the list to the current node } } //create a node for each subobjective of DPWC for (int i = 1; i <= dpwcFieldsInt; i++) { objNode newObjNode = new objNode(); //the node with all the info being added objChar = (char)(i + 96); //the subobjective name based on a char objName = "DPWC" + objChar.ToString(); //create the subobjective name used in the xml file newObjNode.setObjective("Degree Program Writing Competency " + objChar.ToString()); //variable the houses the course objectives mapped to the subobjective var dpwcCourseObjs = (from elem in xmlDoc.Elements("DPWC").Elements(objName).Elements("courseObj") select elem.Value); foreach (var parse in dpwcCourseObjs) { newObjNode.addCourseObj(parse); //add the course objectives to the node } if (firstObjectiveSet) //if this is the first objective overall { objectiveList.setHead(newObjNode); objectiveList.setTail(newObjNode); firstObjectiveSet = false; //make sure the head is not set again } else { objectiveList.getTail().setNextObjNode(newObjNode); //set the current tail's next node to the current one objectiveList.setTail(newObjNode); //set the tail of the list to the current node } } } catch (FileNotFoundException ex) { consoleOutputTxB.Visible = true; consoleBxLB.Visible = true; consoleOutputTxB.AppendText("ERROR: XML FILE NOT READ, Exception: " + ex.GetType() + "\n"); } }