예제 #1
0
        public String GetPhotoThumbnail(String nickname, String password, Int32 photoID)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            var member = data.Member.GetMemberViaNicknamePassword(nickname, password);
            var photo  = data.Photo.GetPhotoByPhotoIDWithJoin(photoID);

            return(ResourceProcessor.GetThumbnailBase64String(photo.ThumbnailResourceFile.SavePath));
        }
예제 #2
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);
        }