private void Convert(SeqNode sParent, TreeNode tParent)
 {
     foreach (SeqNode sChild in sParent.getChildren())
     {
         TreeNode tChild = new TreeNode();
         tChild.Text = "" + sChild.dept + " " + sChild.courseNum;
         tParent.Nodes.Add(tChild);
         Convert(sChild, tChild);
     }
 }
 public void Convert(SeqNode start)
 {
     refresh();
     foreach (SeqNode sRoot in start.getChildren())
     {
         TreeNode tRoot = new TreeNode();
         tRoot.Text = "" + sRoot.dept + " " + sRoot.courseNum;
         seqView.Nodes.Add(tRoot);
         Convert(sRoot, tRoot);
     }
 }
 private void convertWithCompletes(SeqNode sParent, TreeNode tParent)
 {
     foreach (SeqNode sChild in sParent.getChildren())
     {
         TreeNode tChild = new TreeNode();
         tChild.Text = "" + sChild.dept + " " + sChild.courseNum;
         if (sChild.complete == true)
         {
             tChild.ForeColor = Color.DarkGreen;
             tChild.Text += " (Complete)";
         }
         else
         {
             tChild.ForeColor = Color.DarkRed;
             tChild.Text += " (Incomplete)";
         }
         tParent.Nodes.Add(tChild);
         convertWithCompletes(sChild, tChild);
     }
 }
 public void convertWithCompletes(SeqNode start)
 {
     refresh();
     foreach (SeqNode sRoot in start.getChildren())
     {
         TreeNode tRoot = new TreeNode();
         tRoot.Text = "" + sRoot.dept + " " + sRoot.courseNum;
         if (sRoot.complete == true)
         {
             tRoot.ForeColor = Color.DarkGreen;
             tRoot.Text += " (Complete)";
         }
         else
         {
             tRoot.ForeColor = Color.DarkRed;
             tRoot.Text += " (Incomplete)";
         }
         seqView.Nodes.Add(tRoot);
         convertWithCompletes(sRoot, tRoot);
     }
 }
 //Add the provided SeqNode to the SeqNode with the provided ParentValue.
 public void addChild(int parentValue, SeqNode newChild)
 {
     //We have found our parent value, add the new child.
     if (value == parentValue)
     {
         children.Add(newChild);
     }
     else
     {
         //Check each child to see if they are the parent value.
         foreach (SeqNode child in children)
         {
             child.addChild(parentValue, newChild);
         }
     }
 }
 public void addChild(SeqNode child)
 {
     children.Add(child);
 }
        private void read_list()
        {
            seqRoot = new SeqNode();
            data.Rows.Clear();
            for (int ix = 0; ix < requirements.Count; ix++)
            {
                data.Rows.Add(requirements[ix].DEPT,
                    requirements[ix].COURSE_NUM,
                    requirements[ix].CREDITS,
                    requirements[ix].REQ_OR_ELEC,
                    requirements[ix].VALUE,
                    requirements[ix].PAR_VALUE);

                if ((requirements[ix].VALUE != 0) || (requirements[ix].PAR_VALUE != 0))
                {
                    SeqNode temp = new SeqNode(requirements[ix].DEPT, requirements[ix].COURSE_NUM,
                        requirements[ix].CREDITS, requirements[ix].REQ_OR_ELEC, requirements[ix].VALUE);
                    //MessageBox.Show("Succesfully Added node with value: " + requirements[ix].VALUE);
                    seqRoot.addChild(requirements[ix].PAR_VALUE, temp);
                }

            }
        }
 //Creates new major evaluation. Previously opened filnames are disregarded.
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     requirements = new List<ReqCourses>();
     seqRoot = new SeqNode();
     data.Rows.Clear();
     seqPreview.refresh();
     open.FileName = "";
     save.FileName = "";
     seqCred.Clear();
     elecCred.Clear();
     uDivCred.Clear();
 }
        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;
        }