Beispiel #1
0
        private UserVoteData GetVote(EventData eventData, UserVoteType voteType, Speaker speaker = null)
        {
            UserVoteData item   = null;
            string       userId = AppModel.Instance.CurrentUser == null ? string.Empty :
                                  AppModel.Instance.CurrentUser.User.Id;

            if (AppModel.Instance.CurrentUser != null)
            {
                if (speaker == null)
                {
                    item = AppModel.Instance.CurrentUser.VoteData.Items.Find(temp => temp.Event.Equals(eventData.Id) && temp.User.Equals(userId) && temp.UserVoteType == voteType);
                }
                else
                {
                    item = AppModel.Instance.CurrentUser.VoteData.Items.Find(temp => temp.Event.Equals(eventData.Id) &&
                                                                             temp.User.Equals(userId) && temp.UserVoteType == voteType &&
                                                                             temp.Subject.Equals(speaker.Id));
                }
            }
            if (item == null)
            {
                item = new UserVoteData(voteType, eventData.Id, userId, speaker);
            }

            return(item);
        }
Beispiel #2
0
        public UserVoteData(UserVoteType voteType, string eventId, string userId, Speaker speaker = null)
        {
            UserVoteType = voteType;
            if (voteType == UserVoteType.Conteudo)
            {
                Subject = AppResources.EventsActionConteudo;
            }
            else if (voteType == UserVoteType.Aplicabilidade)
            {
                Subject = AppResources.EventsActionAplicabilidade;
            }
            else if (voteType == UserVoteType.Speaker)
            {
                Subject = speaker.Id;
            }

            Event = eventId;
            User  = userId;
            Vote  = null;
        }