예제 #1
0
        /// <summary>
        /// allows a user to sign up for or cancel being signed up for an activity
        /// </summary>
        /// <param name="signUp"></param>
        /// <param name="activityID"></param>
        /// <param name="personID"></param>
        /// <returns></returns>
        public ActionResult ActivitySignUpCancel(bool signUp, int activityID, string email)
        {
            string errorMessage     = "";
            bool   isPersonActivity = false;

            if (signUp)
            {
                try
                {
                    _activityManager.AddPersonActivity(_userManager.RetrieveUserIDFromEmail(email), activityID);
                    isPersonActivity = false;
                }
                catch (Exception)
                {
                    errorMessage = "Unable to add activity";
                }
            }
            else
            {
                try
                {
                    _activityManager.DeletePersonActivity(_userManager.RetrieveUserIDFromEmail(email), activityID);
                    isPersonActivity = true;
                }
                catch (Exception)
                {
                    errorMessage = "Unable to delete activity";
                }
            }
            return(RedirectToAction("PersonActivities", new { email = email, isPersonActivities = isPersonActivity, errorMessage = errorMessage }));
        }
예제 #2
0
 // This event handler is fired off when the cancel button is clicked. it cancels an activity that a person is set to attend.
 private void BtnCancel_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dgUserActivityList.SelectedItems.Count == 0)
         {
             MessageBox.Show("You must make a selection \nfrom My Upcoming Activities.");
             return;
         }
         if (_addMode)
         {
             return;
         }
         if (MessageBox.Show("Are you sure?", "Cancel Activity", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
         {
             //chkActive.IsChecked = !(bool)chkActive.IsChecked;
             return;
         }
         try
         {
             ActivityVM activity = (ActivityVM)dgUserActivityList.SelectedItem;
             if (_activityManager.DeletePersonActivity(_user.PersonID, activity.ActivityID))
             {
                 populatePeopleAttendingList();
                 populateUserActivityList();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message);
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show("BAD");
     }
 }