コード例 #1
0
        public static LocalChallengeTypeModel ItemToLocalItem(ChallengeTypeModel item, IPlatformAssetService assetService, bool isSelected = false)
        {
            LocalChallengeTypeModel localItem = new LocalChallengeTypeModel()
            {
                Color         = item.Color,
                DisplayName   = item.DisplayName,
                Group         = item.Group,
                ImageUrl      = item.ImageUrl,
                Total         = item.Total,
                TotalComplete = item.TotalComplete,
                TypeCode      = item.TypeCode
            };

            localItem.ItemState         = isSelected ? Enums.ChallengesCollectionItemState.Selected : Enums.ChallengesCollectionItemState.Default;
            localItem.TotalCompleteText = item.TotalComplete + " of " + item.Total;
            localItem.Progress          = (int)Math.Round(((double)item.TotalComplete / (double)item.Total) * 100);
            localItem.Color             = "#" + ChallengeModel.GetTypeCodeColor(item.TypeCode, item.DisplayName);
            //localItem.Icon = LoadImages(item.TypeCode, item.DisplayName, assetService);
            localItem.Icon = new ChallengeIcon {
                Icon = ChallengesIconHelper.LoadImages(item.TypeCode, item.DisplayName, assetService), IconUrl = localItem.ImageUrl
            };
            return(localItem);
        }
コード例 #2
0
        public static LocalChallengeModel ItemToLocalItem(ChallengeModel item, string sectionName, bool sectionHidden, IPlatformAssetService assetService)
        {
            LocalChallengeModel localItem = new LocalChallengeModel()
            {
                AllowUserCompletion = item.AllowUserCompletion,
                AnswerList          = item.AnswerList,
                AutoUnlockDate      = item.AutoUnlockDate,
                AvailabilityDate    = item.AvailabilityDate,
                ChallengeDetailsURL = item.ChallengeDetailsURL,
                CollateralReview    = item.CollateralReview,
                CompletedCount      = item.CompletedCount,
                CompPointValue      = item.CompPointValue,
                Desc               = item.Desc,
                DisallowSharing    = item.DisallowSharing,
                EffectiveEndDate   = item.EffectiveEndDate,
                EffectiveStartDate = item.EffectiveStartDate,
                FBShareType        = item.FBShareType,
                Group              = item.Group,
                IconImageURL       = item.IconImageURL,
                ID           = item.ID,
                Image        = item.Image,
                ImageLowRes  = item.ImageLowRes,
                InstaCaption = item.InstaCaption,
                InstaURL     = item.InstaURL,
                InviteToChallengeTemplateURL = item.InviteToChallengeTemplateURL,
                IsCommentReq          = item.IsCommentReq,
                IsEventAttendReq      = item.IsEventAttendReq,
                IsFixedContent        = item.IsFixedContent,
                IsGuestList           = item.IsGuestList,
                IsLikeReq             = item.IsLikeReq,
                IsReshareReq          = item.IsReshareReq,
                IsReviewReq           = item.IsReviewReq,
                IsSurvey              = item.IsSurvey,
                LeaderBoardList       = item.LeaderBoardList,
                LocationLat           = item.LocationLat,
                LocationLong          = item.LocationLong,
                LockIndicatorImageURL = item.LockIndicatorImageURL,
                LockReason            = item.LockReason,
                LockStatus            = item.LockStatus,
                MinStars              = item.MinStars,
                MinTags                = item.MinTags,
                MulipleShops           = item.MulipleShops,
                Name                   = item.Name,
                PointIconURL           = item.PointIconURL,
                PointsPerDollar        = item.PointsPerDollar,
                PointsPerInstance      = item.PointsPerInstance,
                PointValue             = item.PointValue,
                Question               = item.Question,
                RadiusMeters           = item.RadiusMeters,
                SecondsUntilExpire     = item.SecondsUntilExpire,
                SecondsUntilUnlock     = item.SecondsUntilUnlock,
                SelectAnswerID         = item.SelectAnswerID,
                Sequence               = item.Sequence,
                ShareImage             = item.ShareImage,
                ShareTemplateURL       = item.ShareTemplateURL,
                SmallImageURL          = item.SmallImageURL,
                Status                 = item.Status,
                Subtitle               = item.Subtitle,
                TargetCount            = item.TargetCount,
                TargetObjectId         = item.TargetObjectId,
                TargetObjectURL        = item.TargetObjectURL,
                templateDiscountAmount = item.templateDiscountAmount,
                templateDiscountNum    = item.templateDiscountNum,
                templateDiscountType   = item.templateDiscountType,
                templateDiscountUse    = item.templateDiscountUse,
                templateEndOffset      = item.templateEndOffset,
                templateName           = item.templateName,
                templateStartOffset    = item.templateStartOffset,
                TypeCode               = item.TypeCode,
                TypeCodeDisplayName    = item.TypeCodeDisplayName,
                UpdateAll              = item.UpdateAll,
                UseDefaultCodes        = item.UseDefaultCodes,
                UsePointsPerDollar     = item.UsePointsPerDollar,
                UseTeamCodes           = item.UseTeamCodes
            };

            localItem.Color         = "#" + ChallengeModel.GetTypeCodeColor(item.TypeCode, item.TypeCodeDisplayName);
            localItem.PointsText    = "+" + item.PointValue.ToString() + " pts";
            localItem.SectionHidden = sectionHidden;
            localItem.SectionName   = sectionName;
            localItem.Icon          = new ChallengeIcon {
                Icon = ChallengesIconHelper.LoadImages(item.TypeCode, item.TypeCodeDisplayName, assetService), IconUrl = localItem.IconImageURL
            };
            return(localItem);
        }