Ejemplo n.º 1
0
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var publishmentSystemID   = (int)e.Item.DataItem;
                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);
                if (publishmentSystemInfo != null)
                {
                    var ltlPublishmentSystemName = e.Item.FindControl("ltlPublishmentSystemName") as Literal;
                    var ltlPublishmentSystemType = e.Item.FindControl("ltlPublishmentSystemType") as Literal;
                    var ltlPublishmentSystemDir  = e.Item.FindControl("ltlPublishmentSystemDir") as Literal;
                    var ltlAddDate = e.Item.FindControl("ltlAddDate") as Literal;
                    var ltlManage  = e.Item.FindControl("ltlManage") as Literal;
                    var ltlBinding = e.Item.FindControl("ltlBinding") as Literal;
                    var ltlDelete  = e.Item.FindControl("ltlDelete") as Literal;

                    ltlPublishmentSystemName.Text = publishmentSystemInfo.PublishmentSystemName;

                    ltlPublishmentSystemType.Text = EPublishmentSystemTypeUtils.GetHtml(publishmentSystemInfo.PublishmentSystemType);
                    ltlPublishmentSystemDir.Text  = publishmentSystemInfo.PublishmentSystemDir;
                    ltlAddDate.Text = DateUtils.GetDateString(NodeManager.GetAddDate(publishmentSystemID, publishmentSystemID));

                    var manageUrl = PageUtils.GetLoadingUrl(PageUtils.GetAdminDirectoryUrl(
                                                                $"main.aspx?publishmentSystemID={publishmentSystemID}"));
                    ltlManage.Text = $@"<a href=""{manageUrl}"" target=""top"">管理</a>";

                    var bindingUrl = ConsoleAccountBinding.GetRedirectUrl(publishmentSystemID, PageUtils.GetWXUrl("console_account.aspx"));

                    var accountInfo = WeiXinManager.GetAccountInfo(publishmentSystemID);

                    var isBinding = WeiXinManager.IsBinding(accountInfo);
                    if (isBinding)
                    {
                        ltlBinding.Text = $@"<a href=""{bindingUrl}"" class=""btn btn-success"">已绑定微信</a>";
                    }
                    else
                    {
                        ltlBinding.Text = $@"<a href=""{bindingUrl}"" class=""btn btn-danger"">未绑定微信</a>";
                    }

                    var urlDelete = PageUtils.GetSTLUrl(
                        $"console_publishmentSystemDelete.aspx?NodeID={publishmentSystemID}");
                    ltlDelete.Text = $@"<a href=""{urlDelete}"">删除</a>";
                }
            }
        }
Ejemplo n.º 2
0
        public void Page_Load(object sender, System.EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.WeiXin.LeftMenu.ID_Accounts, AppManager.WeiXin.LeftMenu.Function.ID_Info, string.Empty, AppManager.WeiXin.Permission.WebSite.Info);
                ltlWelcome.Text = "欢迎使用 SiteServer WeiXin 微信平台";

                var bindingUrl = ConsoleAccountBinding.GetRedirectUrl(PublishmentSystemID, PageUtils.GetWXUrl(
                                                                          $"background_right.aspx?publishmentSystemID={PublishmentSystemID}"));

                var accountInfo = WeiXinManager.GetAccountInfo(PublishmentSystemID);

                var isBinding = WeiXinManager.IsBinding(accountInfo);
                if (isBinding)
                {
                    ltlBinding.Text = $@"<a href=""{bindingUrl}"" class=""btn btn-success"">已绑定微信</a>";
                }
                else
                {
                    ltlBinding.Text = $@"<a href=""{bindingUrl}"" class=""btn btn-danger"">未绑定微信</a>";
                }

                ltlURL.Text = PageUtilityWX.API.GetMPUrl(PublishmentSystemID);

                ltlToken.Text = accountInfo.Token;

                var deleteUrl = PageUtils.GetSTLUrl(
                    $"console_publishmentSystemDelete.aspx?nodeID={PublishmentSystemID}&isBackgroundDelete=true");
                ltlDelete.Text = $@"<a href=""{deleteUrl}"" class=""btn btn-danger"">删除当前站点</a>";
            }
        }