Esempio n. 1
0
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var relatedFieldID   = SqlUtils.EvalInt(e.Item.DataItem, "RelatedFieldID");
                var relatedFieldName = SqlUtils.EvalString(e.Item.DataItem, "RelatedFieldName");
                var totalLevel       = SqlUtils.EvalInt(e.Item.DataItem, "TotalLevel");

                var ltlRelatedFieldName = (Literal)e.Item.FindControl("ltlRelatedFieldName");
                var ltlTotalLevel       = (Literal)e.Item.FindControl("ltlTotalLevel");
                var ltlItemsUrl         = (Literal)e.Item.FindControl("ltlItemsUrl");
                var ltlEditUrl          = (Literal)e.Item.FindControl("ltlEditUrl");
                var ltlExportUrl        = (Literal)e.Item.FindControl("ltlExportUrl");
                var ltlDeleteUrl        = (Literal)e.Item.FindControl("ltlDeleteUrl");

                ltlRelatedFieldName.Text = relatedFieldName;
                ltlTotalLevel.Text       = totalLevel.ToString();
                var urlItems = PageRelatedFieldMain.GetRedirectUrl(PublishmentSystemId, relatedFieldID, totalLevel);
                ltlItemsUrl.Text = $@"<a href=""{urlItems}"">管理字段项</a>";

                ltlEditUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{ModalRelatedFieldAdd.GetOpenWindowString(
                        PublishmentSystemId, relatedFieldID)}"">编辑</a>";
                ltlExportUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{ModalExportMessage.GetOpenWindowStringToRelatedField(PublishmentSystemId, relatedFieldID)}"">导出</a>";
                ltlDeleteUrl.Text =
                    $@"<a href=""javascript:;"" onclick=""{PageUtils.GetRedirectStringWithConfirm(
                        PageUtils.GetCmsUrl(nameof(PageRelatedField), new NameValueCollection
                        {
                            {"PublishmentSystemID", PublishmentSystemId.ToString()},
                            {"RelatedFieldID", relatedFieldID.ToString()},
                            {"Delete", true.ToString()}
                        }), " 确认删除此联动字段吗? ")}" ">删除</a>";
            }
        }
Esempio n. 2
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var relatedFieldInfo = (RelatedFieldInfo)e.Item.DataItem;

            var ltlRelatedFieldName = (Literal)e.Item.FindControl("ltlRelatedFieldName");
            var ltlTotalLevel       = (Literal)e.Item.FindControl("ltlTotalLevel");
            var ltlItemsUrl         = (Literal)e.Item.FindControl("ltlItemsUrl");
            var ltlEditUrl          = (Literal)e.Item.FindControl("ltlEditUrl");
            var ltlExportUrl        = (Literal)e.Item.FindControl("ltlExportUrl");
            var ltlDeleteUrl        = (Literal)e.Item.FindControl("ltlDeleteUrl");

            ltlRelatedFieldName.Text = relatedFieldInfo.Title;
            ltlTotalLevel.Text       = relatedFieldInfo.TotalLevel.ToString();
            var urlItems = PageRelatedFieldMain.GetRedirectUrl(SiteId, relatedFieldInfo.Id, relatedFieldInfo.TotalLevel);

            ltlItemsUrl.Text = $@"<a href=""{urlItems}"">管理字段项</a>";

            ltlEditUrl.Text =
                $@"<a href=""javascript:;"" onclick=""{ModalRelatedFieldAdd.GetOpenWindowString(
                    SiteId, relatedFieldInfo.Id)}"">编辑</a>";
            ltlExportUrl.Text =
                $@"<a href=""javascript:;"" onclick=""{ModalExportMessage.GetOpenWindowStringToRelatedField(SiteId, relatedFieldInfo.Id)}"">导出</a>";
            ltlDeleteUrl.Text =
                $@"<a href=""javascript:;"" onclick=""{PageUtils.GetRedirectStringWithConfirm(
                    PageUtils.GetCmsUrl(SiteId, nameof(PageRelatedField), new NameValueCollection
                    {
                        {"RelatedFieldID", relatedFieldInfo.Id.ToString()},
                        {"Delete", true.ToString()}
                    }), " 确认删除此联动字段吗? ")}" ">删除</a>";
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedFieldId = AuthRequest.GetQueryInt("RelatedFieldID");
            _parentId       = AuthRequest.GetQueryInt("ParentID");
            _level          = AuthRequest.GetQueryInt("Level");
            _totalLevel     = DataProvider.RelatedFieldDao.GetRelatedFieldInfo(_relatedFieldId).TotalLevel;

            if (AuthRequest.IsQueryExists("Delete") && AuthRequest.IsQueryExists("ID"))
            {
                var id = AuthRequest.GetQueryInt("ID");
                DataProvider.RelatedFieldItemDao.Delete(id);
                if (_level != _totalLevel)
                {
                    AddScript($@"parent.location.href = '{PageRelatedFieldMain.GetRedirectUrl(SiteId, _relatedFieldId, _totalLevel)}';");
                }
            }
            else if ((AuthRequest.IsQueryExists("Up") || AuthRequest.IsQueryExists("Down")) && AuthRequest.IsQueryExists("ID"))
            {
                var id     = AuthRequest.GetQueryInt("ID");
                var isDown = AuthRequest.IsQueryExists("Down");
                if (isDown)
                {
                    DataProvider.RelatedFieldItemDao.UpdateTaxisToUp(id, _parentId);
                }
                else
                {
                    DataProvider.RelatedFieldItemDao.UpdateTaxisToDown(id, _parentId);
                }
            }
            else if (_level != _totalLevel)
            {
                InfoMessage("点击字段项名可以管理下级字段项");
            }

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.WebSitePermissions.Configration);

            //if (_totalLevel >= 5)
            //{
            //    RptContents.Columns[1].Visible = false;
            //}

            RptContents.DataSource     = DataProvider.RelatedFieldItemDao.GetRelatedFieldItemInfoList(_relatedFieldId, _parentId);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            BtnAdd.Attributes.Add("onclick", ModalRelatedFieldItemAdd.GetOpenWindowString(SiteId, _relatedFieldId, _parentId, _level));

            if (_level == 1)
            {
                var urlReturn = PageRelatedField.GetRedirectUrl(SiteId);
                BtnReturn.Attributes.Add("onclick", $"parent.location.href = '{urlReturn}';return false;");
            }
            else
            {
                BtnReturn.Visible = false;
            }
        }
Esempio n. 4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _relatedFieldId = Body.GetQueryInt("RelatedFieldID");
            _parentId       = Body.GetQueryInt("ParentID");
            _level          = Body.GetQueryInt("Level");
            _totalLevel     = DataProvider.RelatedFieldDao.GetRelatedFieldInfo(_relatedFieldId).TotalLevel;

            if (Body.IsQueryExists("Delete") && Body.IsQueryExists("ID"))
            {
                var id = Body.GetQueryInt("ID");
                try
                {
                    DataProvider.RelatedFieldItemDao.Delete(id);
                    if (_level != _totalLevel)
                    {
                        AddScript($@"parent.location.href = '{PageRelatedFieldMain.GetRedirectUrl(PublishmentSystemId, _relatedFieldId, _totalLevel)}';");
                    }
                }
                catch (Exception ex)
                {
                    FailMessage($"删除字段项失败,{ex.Message}");
                }
            }
            else if ((Body.IsQueryExists("Up") || Body.IsQueryExists("Down")) && Body.IsQueryExists("ID"))
            {
                var id     = Body.GetQueryInt("ID");
                var isDown = Body.IsQueryExists("Down");
                if (isDown)
                {
                    DataProvider.RelatedFieldItemDao.UpdateTaxisToUp(id, _parentId);
                }
                else
                {
                    DataProvider.RelatedFieldItemDao.UpdateTaxisToDown(id, _parentId);
                }
            }
            else if (_level != _totalLevel)
            {
                InfoMessage("点击字段项名可以管理下级字段项");
            }

            if (!IsPostBack)
            {
                string level;
                if (_level == 1)
                {
                    level = "一级";
                }
                else
                {
                    var itemInfo    = DataProvider.RelatedFieldItemDao.GetRelatedFieldItemInfo(_parentId);
                    var levelString = "二";
                    if (_level == 3)
                    {
                        levelString = "三";
                    }
                    else if (_level == 4)
                    {
                        levelString = "四";
                    }
                    else if (_level == 5)
                    {
                        levelString = "五";
                    }

                    level = $"{levelString}级({itemInfo.ItemName})";
                }

                BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdConfigration, AppManager.Cms.LeftMenu.Configuration.IdConfigurationContentModel, "联动字段管理", level, AppManager.Cms.Permission.WebSite.Configration);

                BindGrid();

                AddButton.Attributes.Add("onclick", ModalRelatedFieldItemAdd.GetOpenWindowString(PublishmentSystemId, _relatedFieldId, _parentId, _level));

                if (_level == 1)
                {
                    var urlReturn = PageRelatedField.GetRedirectUrl(PublishmentSystemId);
                    ReturnButton.Attributes.Add("onclick", $"parent.location.href = '{urlReturn}';return false;");
                }
                else
                {
                    ReturnButton.Visible = false;
                }
            }
        }