protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                WeekendActivity activity = db.WeekendActivities.Where(act => act.id == ActivityId).Single();
                String          students = "";
                foreach (TableRow row in AttendanceTabel.Rows)
                {
                    if (!(row is ActivityAttendanceTableRow))
                    {
                        continue;
                    }

                    ActivityAttendanceTableRow arow = ((ActivityAttendanceTableRow)row);

                    WebhostMySQLConnection.StudentSignup signup = activity.StudentSignups.Where(s => s.StudentId == arow.StudentId).Single();
                    signup.Attended = arow.IsAttending;
                    students       += arow.Cells[0].Text + Environment.NewLine;
                }
                List <int> studentIds = AdditionalStudentsSelector.GroupIds;
                foreach (int id in studentIds)
                {
                    if (activity.StudentSignups.Where(s => s.StudentId == id).Count() > 0)
                    {
                        WebhostMySQLConnection.StudentSignup signup = activity.StudentSignups.Where(s => s.StudentId == id).Single();
                        signup.Attended = true;
                    }

                    else
                    {
                        WebhostMySQLConnection.StudentSignup newSignup = new WebhostMySQLConnection.StudentSignup()
                        {
                            StudentId   = id,
                            ActivityId  = activity.id,
                            IsBanned    = false,
                            Attended    = true,
                            IsRescended = false,
                            TimeStamp   = DateTime.Now
                        };

                        Student student = db.Students.Find(id);
                        students += String.Format("{0} {1}{2}", student.FirstName, student.LastName, Environment.NewLine);

                        db.StudentSignups.Add(newSignup);
                    }
                }

                LogInformation("Submitted Student Trip {2} Attendance:{1}{0}", students, Environment.NewLine, activity.Name);
                db.SaveChanges();
            }
        }
        protected void UnBanBtn_Click(object sender, EventArgs e)
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                int studentId = -1;
                try
                {
                    studentId = Convert.ToInt32(StudentsSignedUpDDL.SelectedValue.Split(',')[1]);
                }
                catch
                {
                    LogError("Invalid Student Id in {0}", StudentsSignedUpDDL.SelectedValue);
                    return;
                }

                WebhostMySQLConnection.StudentSignup signup = db.StudentSignups.Where(s => s.ActivityId == ActivityId && s.StudentId == studentId).Single();
                signup.IsBanned = false;
                LogWarning("{0} {1} has been un-banned from {2}", signup.Student.FirstName, signup.Student.LastName, signup.WeekendActivity.Name);
                db.SaveChanges();
            }
        }
        protected void Signup_Click(object sender, EventArgs e)
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                WeekendActivity activity   = db.WeekendActivities.Where(act => act.id == ActivityId).Single();
                int             studentId  = ((BasePage)Page).user.ID;
                String          calendarId = db.GoogleCalendars.Where(c => c.CalendarName.Equals("Weekend Activities")).Single().CalendarId;
                Student         student    = db.Students.Where(s => s.ID == studentId).Single();
                LogInformation("Processing {0} click for {1}.", Signup.Text, activity.Name);

                /*
                 * // Check Campused
                 * if(activity.Weekend.CampusedStudents.Contains(student))
                 * {
                 *  State.log.WriteLine("Signup was blocked.  Campused!");
                 *  MailControler.MailToUser("Signup was blocked.", String.Format("You are not allowed to sign up for {0} because you have been campused this weekend.", activity.Name), ((BasePage)Page).user);
                 *  return;
                 * }
                 *
                 * // Check Detention
                 * DateRange activityTimes = activity.DateAndTime.Hour == 0 ? new DateRange(activity.DateAndTime, activity.DateAndTime.AddDays(1)) :
                 *                              activity.Duration == 0 ? new DateRange(activity.DateAndTime, activity.DateAndTime.AddHours(3)) :
                 *                                                       new DateRange(activity.DateAndTime, activity.DateAndTime.AddMinutes(activity.Duration));
                 *
                 * if(activityTimes.Intersects(DateRange.Detention) && activity.Weekend.DetentionList.Contains(student))
                 * {
                 *  State.log.WriteLine("Signup was blocked.  Detention!");
                 *  MailControler.MailToUser("Signup was blocked.", String.Format("You are not allowed to sign up for {0} because you are in Detention this weekend.", activity.Name), ((BasePage)Page).user);
                 *  return;
                 * }
                 */
                if (Signup.Text.Contains("Remove"))
                {
                    State.log.WriteLine("Removing {0} {1} from {2}", student.FirstName, student.LastName, activity.Name);
                    LogInformation("Removing {0} {1} from {2}", student.FirstName, student.LastName, activity.Name);
                    try
                    {
                        WebhostMySQLConnection.StudentSignup signup = student.StudentSignups.Where(sig => sig.ActivityId == ActivityId).Single();
                        signup.IsRescended = true;
                        db.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        State.log.WriteLine("Failed to remove...\r\n{0}", ex.Message);
                        LogError("Failed to remove {0} {1} from {2}\r\n{3}", student.FirstName, student.LastName, activity.Name, ex.Message);
                        MailControler.MailToWebmaster("Webhost Error:  Removing Signup", String.Format(
                                                          "Could not remove {0} {1} from signup {2}\r\n{3}", student.FirstName, student.LastName, activity.Name, ex.Message
                                                          ));

                        return;
                    }

                    if (!activity.GoogleCalendarEventId.Equals(""))
                    {
                        using (GoogleCalendarCall gcal = new GoogleCalendarCall())
                        {
                            gcal.RemoveParticipant(calendarId, activity.GoogleCalendarEventId, student.UserName);
                            State.log.WriteLine("Removed {0} {1} from Calendar Event.");
                        }
                    }
                }
                else
                {
                    State.log.WriteLine("Atempting to sign up {0} {1} for {2}", student.FirstName, student.LastName, activity.Name);
                    if (student.StudentSignups.Where(sig => sig.ActivityId == ActivityId).Count() > 0)
                    {
                        WebhostMySQLConnection.StudentSignup signup = student.StudentSignups.Where(sig => sig.ActivityId == ActivityId).Single();
                        if (signup.IsBanned)
                        {
                            State.log.WriteLine("Signup was blocked.");
                            LogWarning("{0} {1} was blocked from signing up for {2} because they have been banned.", student.FirstName, student.LastName, activity.Name);
                            MailControler.MailToUser("Signup was blocked.", String.Format("You are not allowed to sign up for {0}", activity.Name), ((BasePage)Page).user);
                            return;
                        }

                        signup.IsRescended = false;
                        signup.TimeStamp   = DateTime.Now;
                        Signup.Text        = "Sign me up!";
                        State.log.WriteLine("Re-signed up!");
                        LogInformation("{0} {1} has resigned up for {2}.", student.FirstName, student.LastName, activity.Name);
                    }
                    else
                    {
                        WebhostMySQLConnection.StudentSignup newSig = new WebhostMySQLConnection.StudentSignup()
                        {
                            StudentId   = studentId,
                            ActivityId  = ActivityId,
                            IsBanned    = false,
                            IsRescended = false,
                            TimeStamp   = DateTime.Now
                        };

                        db.StudentSignups.Add(newSig);
                        State.log.WriteLine("New Signup created.");
                        LogInformation("{0} {1} has signed up for {2}.", student.FirstName, student.LastName, activity.Name);
                    }

                    if (!activity.GoogleCalendarEventId.Equals(""))
                    {
                        using (GoogleCalendarCall call = new GoogleCalendarCall())
                        {
                            call.AddEventParticipant(calendarId, activity.GoogleCalendarEventId, student.UserName);
                            State.log.WriteLine("Updated calendar Event to include {0}", student.UserName);
                        }
                    }
                    db.SaveChanges();
                }

                State.log.WriteLine("Signup Changes Saved to Database.");
                reload();
            }
        }