public CanSetBadgeType(Csla.Rules.AuthorizationActions action, IMemberInfo element, Common.Enums.BadgeType badgeType, string allowedRole)
            : base(action, element)
        {
            if (element == null || !(element is IPropertyInfo))
            {
                throw new ArgumentException("Parameter element must be of type IPropertyInfo.");
            }

            AllowedRole = allowedRole;
            BadgeType = badgeType;
        }
Exemple #2
0
        public CanSetBadgeType(Csla.Rules.AuthorizationActions action, IMemberInfo element, Common.Enums.BadgeType badgeType, string allowedRole)
            : base(action, element)
        {
            if (element == null || !(element is IPropertyInfo))
            {
                throw new ArgumentException("Parameter element must be of type IPropertyInfo.");
            }

            AllowedRole = allowedRole;
            BadgeType   = badgeType;
        }
Exemple #3
0
        public async Task <IEnumerable <BadgeItemDTO> > GetBadgesByBadgeTypeAsync(Common.Enums.BadgeType badgeType)
        {
            using (var ctx = new Entities())
            {
                ctx.Database.Connection.Open();
                var badgeList = await(from t in ctx.CurrentActiveBadges
                                      where t.BadgeTypeId == (badgeType == Common.Enums.BadgeType.Unset ? t.BadgeTypeId : (int)badgeType)
                                      select new BadgeItemDTO
                {
                    Id                 = t.BadgeId,
                    Name               = t.BadgeName,
                    Type               = (Common.Enums.BadgeType)t.BadgeTypeId,
                    ImagePath          = t.BadgePath,
                    BadgePriority      = t.BadgePriority,
                    BadgeAwardValue    = t.BadgeAwardValueAmount,
                    BadgeAwardValueMax = t.BadgeAwardValueAmountMax
                }).ToArrayAsync();

                return(badgeList);
            }
        }
 public async Task <IEnumerable <EarnedBadgeItemDTO> > GetBadgesForUserByBadgeTypeAsync(int employeeId, Common.Enums.BadgeType badgeType)
 {
     using (var ctx = new Entities())
     {
         ctx.Database.Connection.Open();
         var badgeList = await(from eb in ctx.EarnedBadges
                               where eb.EmployeeId == employeeId
                               where eb.BadgeTypeId == (badgeType == Common.Enums.BadgeType.Unset ? eb.BadgeTypeId : (int)badgeType)
                               select new EarnedBadgeItemDTO
         {
             Id            = eb.BadgeId,
             Name          = eb.BadgeName,
             Type          = (Common.Enums.BadgeType)eb.BadgeTypeId,
             ImagePath     = eb.BadgePath,
             Tagline       = eb.BadgeTagLine,
             AwardDate     = eb.AwardDate,
             AwardPoints   = eb.AwardAmount,
             PaidOut       = eb.PaidOut,
             BadgePriority = eb.BadgePriority,
             DisplayOnce   = eb.DisplayOnce
         }).ToArrayAsync();
         return(badgeList);
     }
 }