コード例 #1
0
        public EarnedBadgeItemDTO GetEarnedBadge(int badgeAwardId)
        {
            using (var ctx = new Entities())
            {
                BadgeAward badgeAward = ctx.BadgeAwards.Include(b => b.Badge).SingleOrDefault(badges => badges.BadgeAwardId == badgeAwardId);
                if (badgeAward == null)
                {
                    throw new NotFoundException(string.Format("Badge award with id {0} was not found", badgeAwardId));
                }

                var earnedBadge = new EarnedBadgeItemDTO
                {
                    BadgeAwardId   = badgeAward.BadgeAwardId,
                    AwardDate      = badgeAward.AwardDate,
                    AwardPoints    = badgeAward.Badge.BadgeAwardValueAmount,
                    BadgePriority  = badgeAward.Badge.BadgePriority,
                    DisplayOnce    = badgeAward.Badge.DisplayOnce,
                    EmployeeADName = badgeAward.Employee.ADName,
                    Id             = badgeAward.BadgeAwardId,
                    ImagePath      = badgeAward.Badge.BadgePath,
                    Name           = badgeAward.Badge.BadgeName,
                    PaidOut        = badgeAward.PaidOut,
                    Tagline        = badgeAward.Badge.BadgeTagLine,
                    Type           = (Common.Enums.BadgeType)badgeAward.Badge.BadgeTypeId
                };

                return(earnedBadge);
            }
        }
コード例 #2
0
 private BadgeAward LoadData(int id, PointsReportItemDTO pointsReportItem)
 {
     var badgeAward = new BadgeAward
     {
         BadgeAwardId = id,
         PaidCompletedById = pointsReportItem.PayoutById,
         PaidDate = pointsReportItem.PayoutDate,
         PaidOut = true
     };
     return badgeAward;
 }
コード例 #3
0
        private BadgeAward LoadData(int id, PointsReportItemDTO pointsReportItem)
        {
            var badgeAward = new BadgeAward
            {
                BadgeAwardId      = id,
                PaidCompletedById = pointsReportItem.PayoutById,
                PaidDate          = pointsReportItem.PayoutDate,
                PaidOut           = true
            };

            return(badgeAward);
        }
コード例 #4
0
        private BadgeAward LoadData(BadgeAwardDTO badge)
        {
            var earnedBadge = new BadgeAward
            {
                BadgeAwardId = badge.BadgeAwardId,
                BadgeId      = badge.BadgeId,
                AwardAmount  = badge.AwardAmount,
                AwardDate    = badge.AwardDate,
                EmployeeId   = badge.EmployeeId,
                PaidOut      = false
            };

            return(earnedBadge);
        }
コード例 #5
0
 private BadgeAward LoadData(BadgeAwardDTO badge)
 {
     var earnedBadge = new BadgeAward
     {
         BadgeId = badge.BadgeId,
         AwardAmount = badge.AwardAmount,
         AwardDate = badge.AwardDate,
         EmployeeId = badge.EmployeeId,
         PaidOut = false
     };
     return earnedBadge;
 }