Example #1
0
        protected void btnAddCourse_Click(object sender, EventArgs e)
        {
            string semester = SemesterRadioButton.SelectedItem.Value;

            if (semester == "Spring 2016")
            {
                localhost.WebService1 ws = new localhost.WebService1();
                string userid            = ws.getuserid(Session["email"].ToString());
                bool   flag = false;
                if (txtCourseSelection.Text != null)
                {
                    localhost.Course[] cllist = ws.getCourseList(semester);

                    foreach (localhost.Course c in cllist)
                    {
                        if (c.courseID == txtCourseSelection.Text)
                        {
                            flag = true;
                            break;
                        }
                    }

                    if (flag)
                    {
                        Session["courseid"]      = txtCourseSelection.Text;
                        Session["returnmessage"] = ws.addcourse(userid, txtCourseSelection.Text.ToString(), semester);
                    }
                    else
                    {
                        Session["returnmessage"] = "You have entered an incorrect courseid. Please try again.";
                    }
                }
            }
            else
            {
                Session["returnmessage"] = "You are not allowed to register for Fall 2015 at this time.";
            }
            Response.Redirect("~/CourseWizard/CourseEnrollmentMessage");
        }
        protected void btnAddCourse_Click(object sender, EventArgs e)
        {
            string semester = SemesterRadioButton.SelectedItem.Value;
            if (semester == "Spring 2016")
            {
                localhost.WebService1 ws = new localhost.WebService1();
                string userid = ws.getuserid(Session["email"].ToString());
                bool flag = false;
                if (txtCourseSelection.Text != null)
                {
                    localhost.Course[] cllist = ws.getCourseList(semester);

                    foreach (localhost.Course c in cllist)
                    {
                        if (c.courseID == txtCourseSelection.Text)
                        {
                            flag = true;
                            break;
                        }
                    }

                    if (flag)
                    {
                        Session["courseid"] = txtCourseSelection.Text;
                        Session["returnmessage"] = ws.addcourse(userid, txtCourseSelection.Text.ToString(), semester);

                    }
                    else
                    {
                        Session["returnmessage"] = "You have entered an incorrect courseid. Please try again.";
                    }
                }
            }
            else
            {
                Session["returnmessage"] = "You are not allowed to register for Fall 2015 at this time.";
            }
            Response.Redirect("~/CourseWizard/CourseEnrollmentMessage");
        }