//Build an evaluation structure. private void buildMajorEvaluation() { updateActualCredits(0, 0, 0); evalView.Items.Clear(); majEval = new EvalList(); seqRoot = new MajorEvaluation.SeqNode(); bool found; //Parse through each requirement from the JSON file for (int i = 0; i < requirements.Count; i++) { found = false; //Parse through each course taken by student foreach (Course c in studentCourseList) { //If the student has taken the current requirement, record as complete. if ((requirements[i].DEPT == c.getSubject()) && (requirements[i].COURSE_NUM.ToString() == c.getNumber())) { //If the class taken is an elective, add to elective count. if (requirements[i].REQ_OR_ELEC == "E") { actualElecCreds += requirements[i].CREDITS; } if ((requirements[i].DEPT == "M/CS") || (requirements[i].DEPT == "MATH")) { actualSeqCreds += requirements[i].CREDITS; } if ((requirements[i].DEPT == "GEOL") || (requirements[i].DEPT == "BIOL") || (requirements[i].DEPT == "CHEM") || (requirements[i].DEPT == "PHYS")) { actualSeqCreds += requirements[i].CREDITS; } //IF the class is upper division, add to uDivision count. if (requirements[i].COURSE_NUM >= 300) { actualUDivCreds += requirements[i].CREDITS; } //For sequences: if ((requirements[i].VALUE != 0) || (requirements[i].PAR_VALUE != 0)) { MajorEvaluation.SeqNode temp = new MajorEvaluation.SeqNode(requirements[i].DEPT, requirements[i].COURSE_NUM, requirements[i].CREDITS, requirements[i].REQ_OR_ELEC, requirements[i].VALUE); temp.complete = true; //MessageBox.Show("Succesfully Added node with value: " + requirements[i].VALUE); seqRoot.addChild(requirements[i].PAR_VALUE, temp); Eval newEval = new Eval(); newEval.setComplete(true); newEval.setSequence("Yes"); newEval.setCredits(requirements[i].CREDITS); newEval.setCreditType(requirements[i].REQ_OR_ELEC); newEval.setGpa(c.getGpa()); newEval.setSubject(requirements[i].DEPT); newEval.setNumber(requirements[i].COURSE_NUM.ToString()); majEval.addEval(newEval); } //For Individual Classes: else { Eval newEval = new Eval(); newEval.setComplete(true); newEval.setCredits(requirements[i].CREDITS); newEval.setCreditType(requirements[i].REQ_OR_ELEC); newEval.setGpa(c.getGpa()); newEval.setSubject(requirements[i].DEPT); newEval.setNumber(requirements[i].COURSE_NUM.ToString()); majEval.addEval(newEval); } found = true; /*Later, setup conditional to test for sequences. If the class is in a sequence, * record for the sequence here.*/ } } //If the student has not taken the required class, record as incomplete. if (!found) { //For sequences: if ((requirements[i].VALUE != 0) || (requirements[i].PAR_VALUE != 0)) { MajorEvaluation.SeqNode temp = new MajorEvaluation.SeqNode(requirements[i].DEPT, requirements[i].COURSE_NUM, requirements[i].CREDITS, requirements[i].REQ_OR_ELEC, requirements[i].VALUE); //MessageBox.Show("Succesfully Added node with value: " + requirements[i].VALUE); seqRoot.addChild(requirements[i].PAR_VALUE, temp); Eval newEval = new Eval(); newEval.setSequence("Yes"); newEval.setComplete(false); newEval.setCredits(requirements[i].CREDITS); newEval.setCreditType(requirements[i].REQ_OR_ELEC); newEval.setSubject(requirements[i].DEPT); newEval.setNumber(requirements[i].COURSE_NUM.ToString()); majEval.addEval(newEval); } //For individual classes: else { Eval newEval = new Eval(); newEval.setComplete(false); newEval.setCredits(requirements[i].CREDITS); newEval.setCreditType(requirements[i].REQ_OR_ELEC); newEval.setSubject(requirements[i].DEPT); newEval.setNumber(requirements[i].COURSE_NUM.ToString()); majEval.addEval(newEval); } } found = false; } updateListView(); updateCreditInfo(); }
public void addEval(Eval eval) { evals.Add(eval); }