Exemplo n.º 1
0
        public void EditEntry(String nickname, String password, blogger.BlogEntry editedEntry)
        {
            if (nickname == null)
            {
                throw new ArgumentNullException("nickname");
            }
            if (password == null)
            {
                throw new ArgumentNullException("password");
            }
            if (editedEntry == null)
            {
                throw new ArgumentNullException("editedEntry");
            }

            var member    = data.Member.GetMemberViaNicknamePassword(nickname, password);
            var blogEntry = CreateBlogEntry(editedEntry);

            if (blogEntry.MemberID != member.MemberID)
            {
                throw new ArgumentException(Resources.Argument_InvalidBlogEntryEditor);
            }

            blogEntry.Save();
        }
Exemplo n.º 2
0
        public blogger.BlogEntry[] GetEntries(String nickname, String password)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            var member    = data.Member.GetMemberViaNicknamePassword(nickname, password);
            var ids       = data.BlogEntry.GetBlogEntryIDs(member.MemberID);
            var idsLength = ids.Length;
            var result    = new blogger.BlogEntry[idsLength];

            for (var i = 0; i < idsLength; i++)
            {
                var entry = data.BlogEntry.GetBlogEntry(ids[i]);
                if (entry == null)
                {
                    throw new ArgumentException(String.Format(Resources.Argument_InvalidBlogEntryIdentifier, ids[i]));
                }
                result[i] = CreateBlogEntry(entry);
            }

            return(result);
        }
Exemplo n.º 3
0
        private static blogger.BlogEntry CreateBlogEntry(data.BlogEntry descriptor)
        {
            blogger.BlogEntry blogEntry = new blogger.BlogEntry();

            blogEntry.Body      = Text2Mobile.Filter(descriptor.Body);
            blogEntry.DTCreated = descriptor.DTCreated.Ticks.ToString();
            blogEntry.ID        = descriptor.BlogEntryID;
            blogEntry.Title     = Text2Mobile.Filter(descriptor.Title);

            return(blogEntry);
        }
Exemplo n.º 4
0
        public Int32 AddEntry(String nickname, String password, blogger.BlogEntry newEntry)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }
            if (newEntry == null)
            {
                throw new ArgumentNullException("newEntry");
            }

            var member    = data.Member.GetMemberViaNicknamePassword(nickname, password);
            var blogEntry = CreateBlogEntry(newEntry);

            blogEntry.MemberID = member.MemberID;
            blogEntry.Save();

            return(blogEntry.BlogEntryID);
        }
Exemplo n.º 5
0
        private static data.BlogEntry CreateBlogEntry(blogger.BlogEntry descriptor)
        {
            data.BlogEntry blogEntry = null;

            if (descriptor.ID == 0)
            {
                blogEntry = new data.BlogEntry();
            }
            else
            {
                blogEntry = new data.BlogEntry(descriptor.ID);
            }

            blogEntry.Body = HttpUtility.HtmlEncode(descriptor.Body ?? "");
            String dtCreatedRaw = descriptor.DTCreated;

            if (!String.IsNullOrEmpty(dtCreatedRaw))
            {
                blogEntry.DTCreated = new DateTime(Convert.ToInt64(dtCreatedRaw));
            }
            blogEntry.Title = HttpUtility.HtmlEncode(descriptor.Title ?? "");

            return(blogEntry);
        }
Exemplo n.º 6
0
        private static blogger.BlogEntry CreateBlogEntry(data.BlogEntry descriptor)
        {
            blogger.BlogEntry blogEntry = new blogger.BlogEntry();

            blogEntry.Body = Text2Mobile.Filter(descriptor.Body);
            blogEntry.DTCreated = descriptor.DTCreated.Ticks.ToString();
            blogEntry.ID = descriptor.BlogEntryID;
            blogEntry.Title = Text2Mobile.Filter(descriptor.Title);

            return blogEntry;
        }
Exemplo n.º 7
0
        public blogger.BlogEntry[] GetEntries(String nickname, String password)
        {
            if (String.IsNullOrEmpty(nickname))
                throw new ArgumentNullException("nickname");
            if (String.IsNullOrEmpty(password))
                throw new ArgumentNullException("password");

            var member = data.Member.GetMemberViaNicknamePassword(nickname, password);
            var ids = data.BlogEntry.GetBlogEntryIDs(member.MemberID);
            var idsLength = ids.Length;
            var result = new blogger.BlogEntry[idsLength];

            for (var i = 0; i < idsLength; i++)
            {
                var entry = data.BlogEntry.GetBlogEntry(ids[i]);
                if (entry == null)
                    throw new ArgumentException(String.Format(Resources.Argument_InvalidBlogEntryIdentifier, ids[i]));
                result[i] = CreateBlogEntry(entry);
            }

            return result;
        }