Example #1
0
        public List <AwardItem> GetRevokedAwardsForUserProfile(Guid userProfileId)
        {
            if (!UserProfiles.Any(up => up.Id == userProfileId))
            {
                return(new List <AwardItem>());
            }

            var profile = UserProfiles.Single(up => up.Id == userProfileId);

            return(profile.GetRevokedAwards());
        }
Example #2
0
        public AwardItem CreateAwardForUserProfile(Guid userProfileId, string awardName, decimal earnedValue)
        {
            if (!UserProfiles.Any(up => up.Id == userProfileId))
            {
                return(null);
            }

            var profile = UserProfiles.Single(up => up.Id == userProfileId);
            var awardId = Guid.NewGuid();

            profile.CreateAward(awardId, awardName, earnedValue);

            return(profile.GetAwardById(awardId));
        }
Example #3
0
        public UserProfile UpdateUserProfile(Guid profileId, Guid clientId, string emailAddress, List <AwardItem> awards = null)
        {
            if (!ClientAccounts.ContainsKey(clientId) || !UserProfiles.Any(up => up.Id == profileId))
            {
                return(null);
            }

            var clientAccount      = ClientAccounts[clientId];
            var updatedUserProfile = new UserProfile().CreateUserProfile(profileId, emailAddress, clientAccount, awards);
            var currentProfile     = UserProfiles.Single(up => up.Id == profileId);

            currentProfile.UpdateUserProfile(updatedUserProfile);

            return(currentProfile);
        }
Example #4
0
        protected bool Equals(ContextHolder other)
        {
            var baseEqual = string.Equals(OrgId, other.OrgId) &&
                            string.Equals(SiteId, other.SiteId) &&
                            string.Equals(Mode, other.Mode) && string.Equals(Platform, other.Platform) &&
                            string.Equals(Environment, other.Environment) &&
                            string.Equals(User, other.User) &&
                            string.Equals(Module, other.Module);

            if (!baseEqual)
            {
                return(false);
            }
            var profileEqual    = (UserProfiles == null || !UserProfiles.Any()) ? (other.UserProfiles == null || !other.UserProfiles.Any()) : (other.UserProfiles != null && UserProfiles.SequenceEqual(other.UserProfiles));
            var appContextEqual = ApplicationLookupContext == null ? other.ApplicationLookupContext == null :
                                  ApplicationLookupContext.Equals(other.ApplicationLookupContext);

            return(profileEqual && appContextEqual);
        }