/// <summary> /// On action event handling. /// </summary> /// <param name="actionName">Name of the action.</param> /// <param name="actionArgument">Parameter for the action.</param> protected void boardSubscriptions_OnAction(string actionName, object actionArgument) { int boardSubscriptionId = ValidationHelper.GetInteger(actionArgument, 0); switch (actionName.ToLowerCSafe()) { case "delete": if (RaiseOnCheckPermissions(PERMISSION_MANAGE, this)) { if (StopProcessing) { return; } } try { BoardSubscriptionInfoProvider.DeleteBoardSubscriptionInfo(boardSubscriptionId); } catch (Exception ex) { ShowError(ex.Message); } break; case "approve": if (RaiseOnCheckPermissions(PERMISSION_MANAGE, this)) { if (StopProcessing) { return; } } // Approve BoardSubscriptionInfo object BoardSubscriptionInfo bsi = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(boardSubscriptionId); if ((bsi != null) && !bsi.SubscriptionApproved) { bsi.SubscriptionApproved = true; BoardSubscriptionInfoProvider.SetBoardSubscriptionInfo(bsi); // Send confirmation mail BoardInfo bi = BoardInfoProvider.GetBoardInfo(bsi.SubscriptionBoardID); if ((bi != null) && bi.BoardSendOptInConfirmation) { BoardSubscriptionInfoProvider.SendConfirmationEmail(bsi, true); } // Log activity if (MembershipContext.AuthenticatedUser.UserID == UserID) { Service <ICurrentContactMergeService> .Entry().UpdateCurrentContactEmail(bsi.SubscriptionEmail, MembershipContext.AuthenticatedUser); BoardSubscriptionInfoProvider.LogSubscriptionActivity(bsi, bi, PredefinedActivityType.SUBSCRIPTION_MESSAGE_BOARD, false); } } break; } }
protected void btnOk_Click(object sender, EventArgs e) { if (!CheckPermissions("cms.messageboards", PERMISSION_MODIFY)) { return; } string errMsg = ValidateForm(); // If entered form was validated successfully if (string.IsNullOrEmpty(errMsg)) { BoardSubscriptionInfo bsi = null; // If existing subscription is edited if (SubscriptionID > 0) { bsi = CurrentSubscription; } else { bsi = new BoardSubscriptionInfo(); } // Get data according the selected type if (radAnonymousSubscription.Checked) { bsi.SubscriptionEmail = txtEmailAnonymous.Text; bsi.SubscriptionUserID = 0; } else { bsi.SubscriptionEmail = txtEmailRegistered.Text; bsi.SubscriptionUserID = ValidationHelper.GetInteger(userSelector.Value, 0); } bsi.SubscriptionBoardID = BoardID; // Save information on user BoardSubscriptionInfoProvider.SetBoardSubscriptionInfo(bsi); if (chkSendConfirmationEmail.Checked) { BoardSubscriptionInfoProvider.SendConfirmationEmail(bsi, true); } SubscriptionID = bsi.SubscriptionID; RaiseOnSaved(); // Display info on success if subscription is edited ShowChangesSaved(); } else { // Inform user on error ShowError(errMsg); } }
protected void boardSubscriptions_OnAction(string actionName, object actionArgument) { BoardSubscriptionInfo bsi = null; // Get currently processed subscription ID int subscriptionId = ValidationHelper.GetInteger(actionArgument, 0); if (subscriptionId > 0) { switch (actionName.ToLowerCSafe()) { case "delete": if (!CheckPermissions("cms.messageboards", PERMISSION_MODIFY)) { return; } // Get subscription according current ID bsi = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(subscriptionId); if (bsi != null) { if (chkSendConfirmationEmail.Checked && bsi.SubscriptionApproved) { BoardSubscriptionInfoProvider.SendConfirmationEmail(bsi, false); } BoardSubscriptionInfoProvider.DeleteBoardSubscriptionInfo(bsi); } break; case "approve": if (!CheckPermissions("cms.messageboards", PERMISSION_MODIFY)) { return; } // Approve ForumSubscriptionInfo object bsi = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(subscriptionId); if ((bsi != null) && !bsi.SubscriptionApproved) { bsi.SubscriptionApproved = true; BoardSubscriptionInfoProvider.SetBoardSubscriptionInfo(bsi); if (chkSendConfirmationEmail.Checked) { BoardSubscriptionInfoProvider.SendConfirmationEmail(bsi, true); } } break; default: break; } RaiseOnAction(actionName, actionArgument); } }