Beispiel #1
0
    private static int GetObjectID(CommentType type, string WebID)
    {
        if (type == CommentType.Wall)
        {
            Member m = Member.GetMemberViaWebMemberID(WebID);
            return(m.MemberID);
        }
        else if (type == CommentType.Photo)
        {
            Photo p = Photo.GetPhotoByWebPhotoIDWithJoin(WebID);
            return(p.PhotoID);
        }
        else if (type == CommentType.Video)
        {
            Video v = Video.GetVideoByWebVideoIDWithJoin(WebID);
            return(v.VideoID);
        }
        else if (type == CommentType.AskAFriend)
        {
            AskAFriend aaf = AskAFriend.GetAskAFriendByWebAskAFriendID(WebID);
            return(aaf.AskAFriendID);
        }
        else if (type == CommentType.Blog)
        {
            BlogEntry blog = BlogEntry.GetBlogEntryByWebBlogEntryID(WebID);
            return(blog.BlogEntryID);
        }

        return(-1);
    }
Beispiel #2
0
    public string CrossPost(string WebBlogID, string BlogService, string Username, string Password, string WPAddress)
    {
        string ErrorMessage = string.Empty;

        BlogDescriptor bDescr = new BlogDescriptor();

        bDescr.Username = Username;
        bDescr.Password = Password;

        BlogEntry blog = BlogEntry.GetBlogEntryByWebBlogEntryID(WebBlogID);

        if (blog == null)
        {
            throw new Exception("invalid blog entry");
        }

        try
        {
            switch (BlogService)
            {
            case "blogger":
                bDescr.BlogType = BlogType.Blogger;
                bDescr.Address  = "http://www.blogger.com";

                Service service = new Service("blogger", "");
                service.Credentials = new GDataCredentials(Username, Password);
                Uri       blogPostUri  = SelectUserBlog(service);
                AtomEntry createdEntry = PostNewEntry(service, blogPostUri, blog.Title, blog.Body);
                break;

            case "wordpress":
                bDescr.BlogType = BlogType.WordPress;
                bDescr.Address  = WPAddress;

                WordPressEngine wpe = new WordPressEngine();
                wpe.PublishNewEntry(bDescr, blog.Title, blog.Body);
                break;

            case "livejournal":
                bDescr.BlogType = BlogType.LiveJournal;
                bDescr.Address  = "http://www.livejournal.com";

                LiveJournalEngine lje = new LiveJournalEngine();
                lje.PublishNewEntry(bDescr, blog.Title, blog.Body);
                break;

            default:
                break;
            }
        }
        catch (Exception ex)
        {
            //ErrorMessage = ex.Message;
            ErrorMessage = "Could not login, please check your credentials";
        }

        return(ErrorMessage);
    }
Beispiel #3
0
 public static BlogEntry GetBlog(Page page, HttpContext context)
 {
     try
     {
         string    strBlogEntryID = (context.Items["webblogentryid"] != null) ? context.Items["webblogentryid"].ToString() : page.Request.Params["v"].ToString();
         BlogEntry blog           = BlogEntry.GetBlogEntryByWebBlogEntryID(strBlogEntryID);
         return(blog);
     }
     catch
     {
         return(null);
     }
 }
Beispiel #4
0
    public string UpdateBlog(string WebBlogId, string Title, string Body)
    {
        member = (Member)Session["Member"];
        blog   = BlogEntry.GetBlogEntryByWebBlogEntryID(WebBlogId);

        if (blog.MemberID != member.MemberID)
        {
            return(null);
        }

        blog.Title = Title;
        blog.Body  = HTMLUtility.FormatForHTML(Body);

        blog.Save();

        return(HTMLUtility.AutoLink(blog.Body));
    }