Пример #1
0
        /// <summary>
        /// Handles the event when the user clicks the Register button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbwfRegisterRegisterButton_Click(object sender, EventArgs e)
        {
            string courseSelected   = ddlwfRegisterCourses.Text;
            Course courseToRegister = (from results
                                       in db.Courses
                                       where results.Title == courseSelected
                                       select results).SingleOrDefault();
            Student user     = (Student)Session["student"];
            int     userID   = user.StudentId;
            string  notes    = txtwfRegisterTextbox.Text;
            int     courseID = (int)courseToRegister.CourseId;

            ServiceReference.CollegeRegistrationClient localWS = new ServiceReference.CollegeRegistrationClient();
            int returnCode = localWS.registerCourse(userID, courseID, notes);

            if (returnCode == 0)
            {
                Response.Redirect("~/wfStudents.aspx");
            }

            else
            {
                lblwfRegisterErrorMsg.Visible = true;
                lblwfRegisterErrorMsg.Text    = registerError(returnCode);
            }
        }
Пример #2
0
 /// <summary>
 /// When the "Drop Course" link button is clicked, the registration is dropped from the database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void lbwfDropDropCourse_Click(object sender, EventArgs e)
 {
     ServiceReference.CollegeRegistrationClient localWS = new ServiceReference.CollegeRegistrationClient();
     localWS.dropCourse(int.Parse(this.dtvwfDrop.Rows[0].Cells[1].Text));
 }