Beispiel #1
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var siteId   = (int)e.Item.DataItem;
            var siteInfo = SiteManager.GetSiteInfo(siteId);

            if (siteInfo == null)
            {
                return;
            }

            var ltlSiteName   = (Literal)e.Item.FindControl("ltlSiteName");
            var ltlSiteDir    = (Literal)e.Item.FindControl("ltlSiteDir");
            var ltlAddDate    = (Literal)e.Item.FindControl("ltlAddDate");
            var ltlSave       = (Literal)e.Item.FindControl("ltlSave");
            var ltlEdit       = (Literal)e.Item.FindControl("ltlEdit");
            var ltlChangeType = (Literal)e.Item.FindControl("ltlChangeType");
            var ltlDelete     = (Literal)e.Item.FindControl("ltlDelete");
            var ltlUpLink     = (Literal)e.Item.FindControl("ltlUpLink");
            var ltlDownLink   = (Literal)e.Item.FindControl("ltlDownLink");

            ltlSiteName.Text = GetSiteNameHtml(siteInfo);
            ltlSiteDir.Text  = siteInfo.SiteDir;
            ltlAddDate.Text  = DateUtils.GetDateString(ChannelManager.GetAddDate(siteId, siteId));

            ltlSave.Text = $@"<a href=""{PageSiteSave.GetRedirectUrl(siteId)}"">保存</a>";

            ltlEdit.Text = $@"<a href=""{PageSiteEdit.GetRedirectUrl(siteId)}"">修改</a>";

            var upUrl = PageUtils.GetSettingsUrl(nameof(PageSite), new NameValueCollection
            {
                { "Up", "True" },
                { "SiteId", siteId.ToString() }
            });

            ltlUpLink.Text = $@"<a href=""{upUrl}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升""/></a>";

            var downUrl = PageUtils.GetSettingsUrl(nameof(PageSite), new NameValueCollection
            {
                { "Down", "True" },
                { "SiteId", siteId.ToString() }
            });

            ltlDownLink.Text = $@"<a href=""{downUrl}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降""/></a>";

            if (siteInfo.ParentId == 0 && (_hqSiteId == 0 || siteId == _hqSiteId))
            {
                ltlChangeType.Text = GetChangeHtml(siteId, siteInfo.IsRoot);
            }

            if (siteInfo.IsRoot == false)
            {
                ltlDelete.Text = $@"<a href=""{PageSiteDelete.GetRedirectUrl(siteId)}"">删除</a>";
            }
        }
Beispiel #2
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var siteId   = (int)e.Item.DataItem;
            var siteInfo = SiteManager.GetSiteInfo(siteId);

            if (siteInfo == null)
            {
                return;
            }

            var ltlSiteName  = (Literal)e.Item.FindControl("ltlSiteName");
            var ltlSiteDir   = (Literal)e.Item.FindControl("ltlSiteDir");
            var ltlTableName = (Literal)e.Item.FindControl("ltlTableName");
            var ltlTaxis     = (Literal)e.Item.FindControl("ltlTaxis");
            var ltlActions   = (Literal)e.Item.FindControl("ltlActions");

            ltlSiteName.Text  = GetSiteNameHtml(siteInfo);
            ltlSiteDir.Text   = siteInfo.SiteDir;
            ltlTableName.Text = siteInfo.TableName;
            ltlTaxis.Text     = siteInfo.Taxis == 0 ? string.Empty : siteInfo.Taxis.ToString();

            var builder = new StringBuilder();

            builder.Append($@"<a href=""{PageSiteSave.GetRedirectUrl(siteId)}"" class=""m-r-5"">保存</a>");
            builder.Append($@"<a href=""{PageSiteEdit.GetRedirectUrl(siteId)}"" class=""m-r-5"">修改</a>");
            if (siteInfo.ParentId == 0 && (_hqSiteId == 0 || siteId == _hqSiteId))
            {
                builder.Append($@"<a href=""javascript:;"" onClick=""{ModalChangeSiteType.GetOpenWindowString(siteId)}"" class=""m-r-5"">{(siteInfo.IsRoot ? "转移到子目录" : "转移到根目录")}</a>");
            }

            if (siteInfo.IsRoot == false)
            {
                builder.Append($@"<a href=""{PageSiteDelete.GetRedirectUrl(siteId)}"" class=""m-r-5"">删除</a>");
            }

            ltlActions.Text = builder.ToString();
        }