Exemplo n.º 1
0
		public WebPartConnectionsEventArgs (WebPart providerPart, ProviderConnectionPoint providerPoint, 
						WebPart consumerPart, ConsumerConnectionPoint consumerPoint, WebPartConnection connection)
		{
			this.providerPart = providerPart;
			this.providerPoint = providerPoint;
			this.consumerPart = consumerPart;
			this.consumerPoint = consumerPoint;
			this.connection = connection;
		}
Exemplo n.º 2
0
 public WebPartConnectionsEventArgs(WebPart providerPart, ProviderConnectionPoint providerPoint,
                                    WebPart consumerPart, ConsumerConnectionPoint consumerPoint, WebPartConnection connection)
 {
     this.providerPart  = providerPart;
     this.providerPoint = providerPoint;
     this.consumerPart  = consumerPart;
     this.consumerPoint = consumerPoint;
     this.connection    = connection;
 }
        public static void ConnectWebPartConsumersToReportFilter(SPLimitedWebPartManager webPartManager)
        {
            // Get the report filter provider.
            var providerWebPart = webPartManager
                                  .WebParts
                                  .Cast <WebPart>()
                                  .FirstOrDefault(e => e.GetType().ToString() == "EPMLiveWebParts.ReportingFilter");

            if (providerWebPart == null)
            {
                return;
            }

            ProviderConnectionPoint providerConnection = null;

            foreach (ProviderConnectionPoint point in webPartManager.GetProviderConnectionPoints(providerWebPart))
            {
                if (point.InterfaceType == typeof(IReportID))
                {
                    providerConnection = point;
                    break;
                }
            }

            // Run through each consumer and connect them to the report filter.
            foreach (Microsoft.SharePoint.WebPartPages.WebPart webPart in webPartManager.WebParts)
            {
                if (webPart == providerWebPart)
                {
                    continue;
                }

                foreach (ConsumerConnectionPoint point in webPartManager.GetConsumerConnectionPoints(webPart))
                {
                    if (point.InterfaceType == typeof(IReportID))
                    {
                        webPartManager.SPConnectWebParts(providerWebPart, providerConnection, webPart, point);

                        break;
                    }
                }
            }
        }
        public static void AddWebPartConnectionAspNet(
            SPWeb web,
            string pageUrl,
            string providerWebPartID,
            string consumerWebPartID,
            string providerConnectionPointName,
            string consumerConnectionPointName)
        {
            using (SPLimitedWebPartManager manager = web.GetLimitedWebPartManager(pageUrl, PersonalizationScope.Shared)) {
                WebPart provider = manager.WebParts [providerWebPartID];
                WebPart consumer = manager.WebParts [consumerWebPartID];

                ProviderConnectionPointCollection providerPoints = manager.GetProviderConnectionPoints(provider);
                ConsumerConnectionPointCollection consumerPoints = manager.GetConsumerConnectionPoints(consumer);

                ProviderConnectionPoint providerPoint = null;

                foreach (ProviderConnectionPoint point in providerPoints)
                {
                    if (String.Equals(providerConnectionPointName, point.DisplayName, StringComparison.OrdinalIgnoreCase))
                    {
                        providerPoint = point;
                        break;
                    }
                }

                ConsumerConnectionPoint consumerPoint = null;

                foreach (ConsumerConnectionPoint point in consumerPoints)
                {
                    if (String.Equals(consumerConnectionPointName, point.DisplayName, StringComparison.OrdinalIgnoreCase))
                    {
                        consumerPoint = point;
                        break;
                    }
                }

                manager.SPConnectWebParts(provider, providerPoint, consumer, consumerPoint);
            }
        }
        private static void ConnectWebParts(SPFeatureReceiverProperties properties, string url, System.Web.UI.WebControls.WebParts.WebPart provider,
                                            System.Web.UI.WebControls.WebParts.WebPart[] consumer)
        {
            SPWeb  web  = (SPWeb)properties.Feature.Parent;
            SPFile file = web.GetFile(url);
            SPLimitedWebPartManager manager       = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
            ProviderConnectionPoint providerPoint = null;
            ConsumerConnectionPoint consumerPoint = null;
            int index = 6;

            while (manager.WebParts.Count > 0)
            {
                manager.DeleteWebPart(manager.WebParts[0]);
            }

            manager.AddWebPart(consumer[0], "MiddleColumn", 2);
            manager.AddWebPart(provider, "MiddleColumn", 4);

            for (int i = 1; i < consumer.Length; i++)
            {
                System.Web.UI.WebControls.WebParts.WebPart webpart = consumer[i];

                manager.AddWebPart(webpart, "MiddleColumn", index);
                index += 2;
            }

            providerPoint = manager.GetProviderConnectionPoints(provider)[0];
            consumerPoint = manager.GetConsumerConnectionPoints(consumer[0])[0];
            manager.SPConnectWebParts(provider, providerPoint, consumer[0], consumerPoint);
            file.Update();

            if (manager.Web != null)
            {
                manager.Web.Dispose();
            }

            manager.Dispose();
        }
Exemplo n.º 6
0
 // Constructors
 public WebPartTracker(WebPart webPart, ProviderConnectionPoint providerConnectionPoint)
 {
 }
 public WebPartConnectionsCancelEventArgs(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartConnection connection)
 {
 }
Exemplo n.º 8
0
 public WebPartConnection ConnectWebParts(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint)
 {
 }
Exemplo n.º 9
0
 public WebPartConnectionsEventArgs(WebPart providerPart, ProviderConnectionPoint providerPoint,
                                    WebPart consumerPart, ConsumerConnectionPoint consumerPoint) : this(providerPart,
                                                                                                        providerPoint, consumerPart, consumerPoint, null)
 {
 }
Exemplo n.º 10
0
 public virtual WebPartConnection ConnectWebParts(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartTransformer transformer)
 {
 }
Exemplo n.º 11
0
		public WebPartConnectionsEventArgs (WebPart providerPart, ProviderConnectionPoint providerPoint, 
						WebPart consumerPart, ConsumerConnectionPoint consumerPoint) : this (providerPart, 
						providerPoint, consumerPart, consumerPoint, null)
		{}
 public virtual WebPartConnection ConnectWebParts(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartTransformer transformer)
 {
 }
 public int IndexOf(ProviderConnectionPoint connectionPoint)
 {
 }
 // Methods
 public bool Contains(ProviderConnectionPoint connectionPoint)
 {
 }
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPWeb web = properties.Feature.Parent as SPWeb;

            if (web != null)
            {
                SPFile file = web.GetFile("Category.aspx");
                if (file.Exists)
                {
                    SPLimitedWebPartManager manager = file.GetLimitedWebPartManager(PersonalizationScope.Shared);

                    System.Web.UI.WebControls.WebParts.WebPart bdcItemBuilder         = null;
                    System.Web.UI.WebControls.WebParts.WebPart categoryDetails        = null;
                    System.Web.UI.WebControls.WebParts.WebPart childCategoriesWebPart = null;
                    System.Web.UI.WebControls.WebParts.WebPart productsWebPart        = null;

                    foreach (System.Web.UI.WebControls.WebParts.WebPart webPart in manager.WebParts)
                    {
                        switch (webPart.Title)
                        {
                        case "Business Data Item Builder":
                            bdcItemBuilder = webPart;
                            break;

                        case "Category Details":
                            categoryDetails = webPart;
                            break;

                        case "Category List":
                            childCategoriesWebPart = webPart;
                            break;

                        case "Product List":
                            productsWebPart = webPart;
                            break;
                        }
                    }

                    ProviderConnectionPoint providerConnection = manager.GetProviderConnectionPoints(bdcItemBuilder)[0];
                    ConsumerConnectionPoint consumerConnection = manager.GetConsumerConnectionPoints(childCategoriesWebPart)[0];
                    SPWebPartConnection     connection         = manager.SPConnectWebParts(bdcItemBuilder, providerConnection, childCategoriesWebPart, consumerConnection);
                    manager.SPWebPartConnections.Add(connection);

                    consumerConnection = manager.GetConsumerConnectionPoints(productsWebPart)[0];
                    connection         = manager.SPConnectWebParts(bdcItemBuilder, providerConnection, productsWebPart, consumerConnection);
                    manager.SPWebPartConnections.Add(connection);

                    consumerConnection = manager.GetConsumerConnectionPoints(categoryDetails)[0];
                    connection         = manager.SPConnectWebParts(bdcItemBuilder, providerConnection, categoryDetails, consumerConnection);
                    manager.SPWebPartConnections.Add(connection);

                    manager.Web.Dispose();
                }

                web.Site.WebApplication.WebConfigModifications.Add(sPWebConfigModification);

                //Call Update and ApplyWebConfigModifications to save changes
                web.Site.WebApplication.Update();
                web.Site.WebApplication.WebService.ApplyWebConfigModifications();
            }
        }
 public WebPartConnectionsEventArgs(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartConnection connection)
 {
 }
 // Constructors
 public WebPartTracker(WebPart webPart, ProviderConnectionPoint providerConnectionPoint)
 {
 }
 public void CopyTo(ProviderConnectionPoint[] array, int index)
 {
 }
Exemplo n.º 19
0
 // Methods
 public bool Contains(ProviderConnectionPoint connectionPoint)
 {
 }
Exemplo n.º 20
0
 public int IndexOf(ProviderConnectionPoint connectionPoint)
 {
 }
 public WebPartConnection ConnectWebParts(WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint)
 {
 }