private void add_class_Click(object sender, EventArgs e) { ReqCourses input = new ReqCourses(subject_box.Text, Convert.ToInt32(course_num_box.Text), Convert.ToInt32(credits_box.Text), req_or_elec.Text,1,1); // Check to see if the class has already been added bool already = false; for (int ix = 0; ix < requirements.Count; ix++) if (requirements[ix].COURSE_NUM.Equals(input.COURSE_NUM) && requirements[ix].DEPT.Equals(input.DEPT)) already = true; if (!already) requirements.Add(input); else MessageBox.Show("Class has already been added!"); // Update the GUI list update_req_list(); }
private void make_list() { requirements.Clear(); ReqCourses input; int numrows; MessageBox.Show(data.RowCount.ToString()); if (data.RowCount == 1) numrows = 1; else numrows = data.RowCount-1; for (int ix = 0; ix < data.RowCount-1; ix++) { if (check_row(ix)) { input = new ReqCourses(data[0, ix].Value.ToString(), Convert.ToInt32(data[1, ix].Value), Convert.ToInt32(data[2, ix].Value), data[3, ix].Value.ToString(), Convert.ToInt32(data[4, ix].Value), Convert.ToInt32(data[5, ix].Value)); // Check to see if the class has already been added bool already = false; for (int ij = 0; ij < requirements.Count; ij++) if (requirements[ij].COURSE_NUM.Equals(input.COURSE_NUM) && requirements[ij].DEPT.Equals(input.DEPT)) already = true; if (!already) requirements.Add(input); else MessageBox.Show("There are duplicate classes!"); } } MessageBox.Show(JsonConvert.SerializeObject(requirements).ToString()); }
// Be able to set the list of required classes in Creator outside Creator public List<MajorEvaluation.ReqCourses> Set_List(ReqCourses incoming) { requirements.Add(incoming); return requirements; }
private bool make_list() { requirements.Clear(); ReqCourses input; seqRoot = new SeqNode(); int numrows; //MessageBox.Show(data.RowCount.ToString()); if (data.RowCount == 1) numrows = 1; else numrows = data.RowCount-1; for (int ix = 0; ix < data.RowCount-1; ix++) { if (check_row(ix)) { List<int> tmp = new List<int>(); /*for (int ij = 6; ij < data.Columns.Count; ij++) { tmp.Add(Convert.ToInt32(data[ij, ix].Value)); MessageBox.Show("Testing: " + Convert.ToInt32(data[ij, ix].Value)); //MessageBox.Show(tmp[ij-6].ToString()); }*/ input = new ReqCourses(data[0, ix].Value.ToString(), Convert.ToInt32(data[1, ix].Value), Convert.ToInt32(data[2, ix].Value), data[3, ix].Value.ToString(), Convert.ToInt32(data[4, ix].Value), Convert.ToInt32(data[5, ix].Value)); // Check to see if the class has already been added bool already = false; for (int ij = 0; ij < requirements.Count; ij++) { if (requirements[ij].COURSE_NUM.Equals(input.COURSE_NUM) && requirements[ij].DEPT.Equals(input.DEPT)) { already = true; } } if (!already) { if ((input.VALUE != 0) || (input.PAR_VALUE != 0)) { SeqNode temp = new SeqNode(input.DEPT, input.COURSE_NUM, input.CREDITS, input.REQ_OR_ELEC, input.VALUE); //MessageBox.Show("Succesfully Added node with value: " + input.VALUE); seqRoot.addChild(input.PAR_VALUE, temp); } requirements.Add(input); } else { MessageBox.Show("There are duplicate classes!"); } } else { return false; } } return true; }