/// <summary> /// Gets localized message describing post state. /// </summary> /// <param name="postId">Post id.</param> private object GetPostState(int postId) { switch (Control.ObjectType) { // Facebook post case FacebookPostInfo.OBJECT_TYPE: FacebookPostInfo facebookPost = FacebookPostInfoProvider.GetFacebookPostInfo(postId); return(FacebookPostInfoProvider.GetPostPublishStateMessage(facebookPost, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, true)); // Twitter post case TwitterPostInfo.OBJECT_TYPE: TwitterPostInfo twitterPost = TwitterPostInfoProvider.GetTwitterPostInfo(postId); return(TwitterPostInfoProvider.GetPostPublishStateMessage(twitterPost, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, true)); } return(String.Empty); }
/// <summary> /// OnAction for Twitter post object type. /// </summary> /// <param name="actionName"></param> /// <param name="actionArgument">Integer ID as a string.</param> private void OnAction_Twitter(string actionName, object actionArgument) { switch (actionName) { case "delete": try { int postId = ValidationHelper.GetInteger(actionArgument, 0); var postInfo = TwitterPostInfoProvider.GetTwitterPostInfo(postId); if (VerifyPermissionsAndObjectAvailability(postInfo)) { TwitterPostInfoProvider.DeleteTwitterPostInfo(postInfo); } } catch (Exception ex) { EventLogProvider.LogWarning("Social marketing - Twitter post", "DELETEPOST", ex, SiteContext.CurrentSiteID, "Twitter post could not be deleted."); Control.ShowError(Control.GetString("sm.twitter.posts.msg.deleteerror")); } break; } }