コード例 #1
0
        protected void TransType_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            PublishmentSystemIDCollection.Items.Clear();
            PublishmentSystemIDCollection.Enabled = true;

            PlaceHolder_IsAutomatic.Visible = false;

            var contributeType = ECrossSiteTransTypeUtils.GetEnumType(TransType.SelectedValue);

            if (contributeType == ECrossSiteTransType.None)
            {
                PlaceHolder_PublishmentSystem.Visible = PlaceHolder_NodeNames.Visible = false;
            }
            else if (contributeType == ECrossSiteTransType.SelfSite || contributeType == ECrossSiteTransType.SpecifiedSite)
            {
                PlaceHolder_PublishmentSystem.Visible = true;
                PlaceHolder_NodeNames.Visible         = false;

                PlaceHolder_IsAutomatic.Visible = true;
            }
            else if (contributeType == ECrossSiteTransType.ParentSite)
            {
                PlaceHolder_PublishmentSystem.Visible = true;
                PlaceHolder_NodeNames.Visible         = false;
                PublishmentSystemIDCollection.Enabled = false;

                PlaceHolder_IsAutomatic.Visible = true;
            }
            else if (contributeType == ECrossSiteTransType.AllParentSite || contributeType == ECrossSiteTransType.AllSite)
            {
                PlaceHolder_PublishmentSystem.Visible = false;
                PlaceHolder_NodeNames.Visible         = true;
            }

            if (PlaceHolder_PublishmentSystem.Visible)
            {
                var publishmentSystemIDArrayList = PublishmentSystemManager.GetPublishmentSystemIdList();

                var allParentPublishmentSystemIDArrayList = new List <int>();
                if (contributeType == ECrossSiteTransType.AllParentSite)
                {
                    PublishmentSystemManager.GetAllParentPublishmentSystemIdList(allParentPublishmentSystemIDArrayList, publishmentSystemIDArrayList, PublishmentSystemId);
                }
                else if (contributeType == ECrossSiteTransType.SelfSite)
                {
                    publishmentSystemIDArrayList = new List <int>();
                    publishmentSystemIDArrayList.Add(PublishmentSystemId);
                }

                foreach (int psID in publishmentSystemIDArrayList)
                {
                    var psInfo = PublishmentSystemManager.GetPublishmentSystemInfo(psID);
                    var show   = false;
                    if (contributeType == ECrossSiteTransType.SpecifiedSite)
                    {
                        show = true;
                    }
                    else if (contributeType == ECrossSiteTransType.SelfSite)
                    {
                        if (psID == PublishmentSystemId)
                        {
                            show = true;
                        }
                    }
                    else if (contributeType == ECrossSiteTransType.ParentSite)
                    {
                        if (psInfo.PublishmentSystemId == PublishmentSystemInfo.ParentPublishmentSystemId || (PublishmentSystemInfo.ParentPublishmentSystemId == 0 && psInfo.IsHeadquarters))
                        {
                            show = true;
                        }
                    }
                    if (show)
                    {
                        var listitem = new ListItem(psInfo.PublishmentSystemName, psID.ToString());
                        if (psInfo.IsHeadquarters)
                        {
                            listitem.Selected = true;
                        }
                        PublishmentSystemIDCollection.Items.Add(listitem);
                    }
                }
            }
            PublishmentSystemIDCollection_OnSelectedIndexChanged(sender, e);
        }