protected void Button1_Click(object sender, EventArgs e)
        {
            List <StudentCPS> cpsList = new List <StudentCPS>();

            foreach (GridViewRow row in GridView1.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRow = (row.Cells[0].FindControl("CheckBox1") as CheckBox);
                    if (chkRow.Checked)
                    {
                        StudentCPS cps = new StudentCPS();
                        cps.CourseRubric = row.Cells[2].Text;
                        cps.CourseNumber = int.Parse(row.Cells[1].Text);
                        cps.CourseName   = row.Cells[3].Text;
                        studentId        = int.Parse(Request.QueryString["sid"].ToString());
                        stu = business.getStudent(studentId);
                        cps.facultyAdvisorId = stu[0].FacultyAdvisorId;
                        cps.Grades           = "NA";
                        cps.Semester         = "NA";
                        cps.StudentId        = stu[0].StudentId;
                        cps.StudentName      = stu[0].StudentName;
                        cps.Units            = int.Parse(row.Cells[4].Text);
                        cps.Year             = int.Parse(stu[0].StartYear.ToString());
                        cps.CourseType       = "FOUN";
                        cpsList.Add(cps);
                    }
                }
            }


            foreach (GridViewRow row in GridView2.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRow = (row.Cells[0].FindControl("CheckBox2") as CheckBox);
                    if (chkRow.Checked)
                    {
                        StudentCPS cps = new StudentCPS();
                        cps.CourseRubric = row.Cells[2].Text;
                        cps.CourseNumber = int.Parse(row.Cells[1].Text);
                        cps.CourseName   = row.Cells[3].Text;
                        studentId        = int.Parse(Request.QueryString["sid"].ToString());
                        stu = business.getStudent(studentId);
                        cps.facultyAdvisorId = stu[0].FacultyAdvisorId;
                        cps.Grades           = "NA";
                        cps.Semester         = "NA";
                        cps.StudentId        = stu[0].StudentId;
                        cps.StudentName      = stu[0].StudentName;
                        cps.Units            = int.Parse(row.Cells[4].Text);
                        cps.Year             = int.Parse(stu[0].StartYear.ToString());
                        cps.CourseType       = "CORE";
                        cpsList.Add(cps);
                    }
                }
            }


            foreach (GridViewRow row in GridView3.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRow = (row.Cells[0].FindControl("CheckBox3") as CheckBox);
                    if (chkRow.Checked)
                    {
                        StudentCPS cps = new StudentCPS();
                        cps.CourseRubric = row.Cells[2].Text;
                        cps.CourseNumber = int.Parse(row.Cells[1].Text);
                        cps.CourseName   = row.Cells[3].Text;
                        studentId        = int.Parse(Request.QueryString["sid"].ToString());
                        stu = business.getStudent(studentId);
                        cps.facultyAdvisorId = stu[0].FacultyAdvisorId;
                        cps.Grades           = "NA";
                        cps.Semester         = "NA";
                        cps.StudentId        = stu[0].StudentId;
                        cps.StudentName      = stu[0].StudentName;
                        cps.Units            = int.Parse(row.Cells[4].Text);
                        cps.Year             = int.Parse(stu[0].StartYear.ToString());
                        cps.CourseType       = "ELEC";
                        cpsList.Add(cps);
                    }
                }
            }

            int count = business.GenerateInitialCPS(cpsList);

            if (count == cpsList.Count)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script> alert('Form Generated Successfully!!')</script>");
                Response.Redirect("~/AcadAdvisor.aspx");
            }
        }