コード例 #1
0
ファイル: PageAlbum.cs プロジェクト: yankaics/cms-1
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var albumInfo = new AlbumInfo(e.Item.DataItem);

                var ltlItemIndex       = e.Item.FindControl("ltlItemIndex") as Literal;
                var ltlTitle           = e.Item.FindControl("ltlTitle") as Literal;
                var ltlKeywords        = e.Item.FindControl("ltlKeywords") as Literal;
                var ltlPVCount         = e.Item.FindControl("ltlPVCount") as Literal;
                var ltlIsEnabled       = e.Item.FindControl("ltlIsEnabled") as Literal;
                var ltlAlbumContentUrl = e.Item.FindControl("ltlAlbumContentUrl") as Literal;
                var ltlPreviewUrl      = e.Item.FindControl("ltlPreviewUrl") as Literal;
                var ltlEditUrl         = e.Item.FindControl("ltlEditUrl") as Literal;

                ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString();
                ltlTitle.Text     = albumInfo.Title;
                ltlKeywords.Text  = DataProviderWX.KeywordDAO.GetKeywords(albumInfo.KeywordID);
                ltlPVCount.Text   = albumInfo.PVCount.ToString();

                ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(!albumInfo.IsDisabled);

                var urlAlbumContent = PageAlbumContent.GetRedirectUrl(PublishmentSystemId, albumInfo.ID);

                ltlAlbumContentUrl.Text = $@"<a href=""{urlAlbumContent}"">微相册</a>";

                var urlPreview = AlbumManager.GetAlbumUrl(PublishmentSystemInfo, albumInfo, string.Empty);
                //urlPreview = BackgroundPreview.GetRedirectUrlToMobile(urlPreview);
                ltlPreviewUrl.Text = $@"<a href=""{urlPreview}"" target=""_blank"">预览</a>";

                var urlEdit = PageAlbumAdd.GetRedirectUrl(PublishmentSystemId, albumInfo.ID);
                ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>";
            }
        }