예제 #1
0
 public void FilterTest_ListSpecialChars()
 {
     foreach (var input in _specialCharsList.Keys)
     {
         Assert.AreEqual(_specialCharsList[input], Text2Mobile.Filter(input));
     }
 }
예제 #2
0
        private static blogger.BlogVideo GetVideo(Int32 memberID, Int32 videoID)
        {
            var db        = DatabaseFactory.CreateDatabase();
            var dbCommand = db.GetStoredProcCommand("HG_GetBlogPhotos");

            db.AddInParameter(dbCommand, "memberID", DbType.Int32, memberID);
            db.AddInParameter(dbCommand, "videoID", DbType.Int32, videoID);

            using (var dr = db.ExecuteReader(dbCommand))
            {
                while (dr.Read())
                {
                    return(new blogger.BlogVideo()
                    {
                        Base64ThumbnailString = data.Photo.ImageToBase64String(new Bitmap(GetThumbnailPath(Convert.ToString(dr["Path"]), Convert.ToString(dr["FileName"])))),
                        CreatedDT = Convert.ToDateTime(dr["DTCreated"]).Ticks.ToString(),
                        Description = Text2Mobile.Filter(Convert.ToString(dr["Description"]) ?? ""),
                        ID = Convert.ToInt32(dr["VideoID"]),
                        Title = Text2Mobile.Filter(Convert.ToString(dr["Title"]) ?? "")
                    });
                }
            }

            throw new ArgumentException(String.Format(Resources.Argument_InvalidBlogVideoIdentifier, videoID));
        }
예제 #3
0
        public DashboardPhoto[] GetPhotos(String nickname, String password)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            return(data.FeedItem.GetFeed(
                       GetMemberID(nickname, password))
                   .Where(f => f.FeedItemType == data.FeedItemType.Photo)
                   .Select(f => new DashboardPhoto()
            {
                DateTime = f.DateTime.Ticks.ToString(),
                Nickname = f.FriendNickname1,
                Text = Text2Mobile.Filter(f.Text),
                Title = Text2Mobile.Filter(f.Title),
                ThumbnailUrl = f.Thumbnail
            })
                   .OrderBy(f => f.DateTime)
                   .ToArray());
        }
예제 #4
0
 public void FilterTest_ListTagA()
 {
     foreach (var input in _aTagList.Keys)
     {
         Assert.AreEqual(_aTagList[input], Text2Mobile.Filter(input));
     }
 }
예제 #5
0
 private static AskQuestion CreateQuestion(AskAFriend askAFriend)
 {
     return(new AskQuestion()
     {
         ID = askAFriend.AskAFriendID,
         Question = Text2Mobile.Filter(askAFriend.Question),
         DTCreated = askAFriend.SubmittedDT.ToTicksString()
     });
 }
예제 #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);
        }
예제 #7
0
 private static WebComment CreateComment(data.Comment comment)
 {
     return(new WebComment()
     {
         CommentType = comment.CommentType,
         DTCreated = comment.DTCreated.ToTicksString(),
         ID = comment.CommentID,
         Nickname = new Member(comment.MemberIDFrom).NickName,
         Text = Text2Mobile.Filter(comment.Text ?? ""),
         InReplyToCommentID = comment.InReplyToCommentID,
         ObjectID = comment.ObjectID,
         ParentCommentID = ExtractParentCommentID(comment.Path)
     });
 }
예제 #8
0
        private static WebPhoto[] ConvertToWebPhotoArray(IList <data.Photo> photos)
        {
            var result = new List <WebPhoto>();

            foreach (var photo in photos)
            {
                result.Add(
                    new WebPhoto()
                {
                    ID          = photo.PhotoID,
                    CreatedDT   = photo.CreatedDT.Ticks.ToString(),
                    Description = Text2Mobile.Filter(photo.Caption ?? ""),
                    Title       = Text2Mobile.Filter(photo.Title ?? "")
                });
            }

            return(result.ToArray());
        }
예제 #9
0
        public AskResponse GetResponse(String nickname, String password, Int32 questionID)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            var member   = Member.GetMemberViaNicknamePassword(nickname, password);
            var question = AskAFriend.GetAskAFriendByAskAFriendIDWithJoin(questionID);

            var response = new AskResponse()
            {
                AskQuestionID     = question.AskAFriendID,
                Question          = Text2Mobile.Filter(question.Question),
                PhotoBase64Binary = ResourceProcessor.GetThumbnailBase64String(question.DefaultPhotoResourceFile.SavePath),
                ResponseValues    = AskAFriend.GetAskAFriendResult(question).ToArray(),
                ResponseType      = question.ResponseType,
                Average           = 0,
                CustomResponses   = new String[2]
            };

            /* Set the average value (only applicable if the ResponseType is Rate1To10). */

            for (var i = 0; i < response.ResponseValues.Length; i++)
            {
                response.Average += response.ResponseValues[i];
            }

            response.Average = response.Average / Convert.ToDouble(response.ResponseValues.Length);

            /* Custom responses will be blank strings if not applicable. */

            response.CustomResponses[0] = Text2Mobile.Filter(question.ResponseA);
            response.CustomResponses[1] = Text2Mobile.Filter(question.ResponseB);

            return(response);
        }
예제 #10
0
        public DashboardItem[] GetItems(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 feedItems   = data.FeedItem.GetFeed(member.MemberID);
            var sortedItems = from f in feedItems
                              where f.DateTime > DateTime.Now.AddDays(-4)
                              orderby f.DateTime descending
                              select new DashboardItem()
            {
                AskQuestion        = Text2Mobile.Filter(f.AskAFriendQuestion ?? ""),
                DateTime           = f.DateTime.Ticks.ToString(),
                FeedItemType       = (Int32)f.FeedItemType,
                Friend1FullName    = f.Friend1FullName ?? "",
                Friend2FullName    = f.Friend2FullName ?? "",
                FriendNickname1    = f.FriendNickname1 ?? "",
                FriendNickname2    = f.FriendNickname2 ?? "",
                FriendWebMemberID1 = f.FriendWebMemberID1 ?? "",
                FriendWebMemberID2 = f.FriendWebMemberID2 ?? "",
                Text                 = Text2Mobile.Filter(f.Text ?? ""),
                ThumbnailUrl         = f.Thumbnail ?? "",
                Title                = Text2Mobile.Filter(f.Title ?? ""),
                ObjectID             = GetObjectID(f.Url ?? "", f.FeedItemType),
                WebPhotoCollectionID = f.WebPhotoCollectionID ?? "",
                WebPhotoID           = f.WebPhotoID ?? ""
            };

            return(sortedItems.ToArray());
        }
예제 #11
0
        public DashboardWallComment[] GetWallComments(String nickname, String password)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            return(data.FeedItem.GetFeed(
                       GetMemberID(nickname, password))
                   .Where(f => f.FeedItemType == data.FeedItemType.WallComment)
                   .Select(f => new DashboardWallComment()
            {
                DateTime = f.DateTime.Ticks.ToString(),
                Nickname1 = f.FriendNickname1,
                Nickname2 = f.FriendNickname2,
                Text = Text2Mobile.Filter(f.Text)
            })
                   .OrderBy(f => f.DateTime)
                   .ToArray());
        }
예제 #12
0
 public void FilterTest_SimpleTagA()
 {
     Assert.AreEqual("link", Text2Mobile.Filter("<a href=\"http://null.com\">link</a>"));
 }
예제 #13
0
 public void FilterTest_SimpleTagBr()
 {
     Assert.AreEqual(" ", Text2Mobile.Filter("<br />"));
 }
예제 #14
0
 public void FilterTest_SimpleText()
 {
     Assert.AreEqual("Some text", Text2Mobile.Filter("Some text"));
 }
예제 #15
0
 public void FilterTest_EmptyString()
 {
     Assert.AreEqual("", Text2Mobile.Filter(""));
 }
예제 #16
0
 public void FilterTest_NullText()
 {
     Assert.IsNull(Text2Mobile.Filter(null));
 }