Exemplo n.º 1
0
        // Uncomment the method below to handle the event raised before a feature is deactivated.

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SalesOrderDiagnosticService.LogMessage(CategoryID.Deactivation,
                                                   String.Format("Deactivating feature: {0}", properties.Definition.DisplayName));

            try
            {
                SPWeb spWeb = (SPWeb)properties.Feature.Parent;

                Reporting reporting = new Reporting();
                reporting.Deactivate(spWeb);

                ListCustomizations listCustomizations = new ListCustomizations(externalListTitles);
                listCustomizations.Deactivate(spWeb);

                base.FeatureDeactivating(properties);

                SalesOrderDiagnosticService.LogMessage(CategoryID.Activation,
                                                       String.Format("Feature deactivation succeeded for {0}", properties.Definition.DisplayName));
            }
            catch (Exception exception)
            {
                SalesOrderDiagnosticService.LogError(CategoryID.Deactivation,
                                                     String.Format("Failed to deactivate {0}: {1}", properties.Definition.DisplayName, exception.Message));
            }
        }
Exemplo n.º 2
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            base.FeatureActivated(properties);

            SalesOrderDiagnosticService.LogMessage(CategoryID.Activation,
                                                   String.Format("Activating feature: {0}", properties.Definition.DisplayName));

            try
            {
                SPWeb spWeb = (SPWeb)properties.Feature.Parent;

                // Create currency list for custom lookup.
                CurrencyList currencyList = new CurrencyList();
                currencyList.Activate(spWeb);

                //Enable list customizations.
                ListCustomizations listCustomizations = new ListCustomizations(externalListTitles);
                listCustomizations.Activate(spWeb);

                // Enable reporting.
                Reporting reporting = new Reporting();
                reporting.Activate(spWeb);

                SalesOrderDiagnosticService.LogMessage(CategoryID.Activation,
                                                       String.Format("Feature activation succeeded for {0}", properties.Definition.DisplayName));
            }
            catch (Exception exception)
            {
                SalesOrderDiagnosticService.LogError(CategoryID.Activation,
                                                     String.Format("Failed to activate {0}: {1}", properties.Definition.DisplayName, exception.Message));
            }
        }