Beispiel #1
0
        public static string CreateSubscription(string reportPath, string routeClass, string driverName)
        {
            //Create a new subscription
            string subscriptionID = "";

            try {
                //Create reporting service web client proxy
                _Client             = new ReportingService2010();
                _Client.Credentials = System.Net.CredentialCache.DefaultCredentials;

                //
                ExtensionSettings extSettings = setExtSettings();
                string            description = "Send e-mail to [email protected]";
                string            eventType   = "TimedSubscription";
                string            matchData   = setMatchData(DateTime.Today);
                ParameterValue    pv1         = new ParameterValue(); pv1.Name = "RouteDate"; pv1.Value = null;
                ParameterValue    pv2         = new ParameterValue(); pv2.Name = "RouteClass"; pv2.Value = routeClass;
                ParameterValue    pv3         = new ParameterValue(); pv3.Name = "DriverName"; pv3.Value = driverName;
                ParameterValue[]  parameters  = new ParameterValue[] { pv1, pv2, pv3 };
                subscriptionID = _Client.CreateSubscription(reportPath, extSettings, description, eventType, matchData, parameters);
            }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { _Client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException(ce.Message); }
            return(subscriptionID);
        }
Beispiel #2
0
        public static void DeleteSubscription(string subscriptionID)
        {
            //Delete the specified subscription
            try {
                //Create reporting service web client proxy
                _Client             = new ReportingService2010();
                _Client.Credentials = System.Net.CredentialCache.DefaultCredentials;

                //Delete
                _Client.DeleteSubscription(subscriptionID);
            }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { _Client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException(ce.Message); }
        }
Beispiel #3
0
        public static string CreateSubscription(string agentNumber, string agentRepEmail)
        {
            //Create a new subscription
            string reportPath     = "/Customer Service/Internal Delivery Window By Store";
            string subscriptionID = "";

            try {
                //Create reporting service web client proxy
                _Client             = new ReportingService2010();
                _Client.Credentials = System.Net.CredentialCache.DefaultCredentials;

                //
                ExtensionSettings extSettings = setExtSettings(agentRepEmail);
                string            description = "Send e-mail to " + agentRepEmail;
                string            eventType   = "TimedSubscription";
                string            matchData   = setMatchData(DateTime.Today);
                ParameterValue    pv1         = new ParameterValue(); pv1.Name = "AgentNumber"; pv1.Value = agentNumber;
                ParameterValue    pv2         = new ParameterValue(); pv2.Name = "EndDate"; pv2.Value = null;
                ParameterValue    pv3         = new ParameterValue(); pv3.Name = "ClientNumber"; pv3.Value = null;
                ParameterValue    pv4         = new ParameterValue(); pv4.Name = "Division"; pv4.Value = null;
                ParameterValue    pv5         = new ParameterValue(); pv5.Name = "District"; pv5.Value = null;
                ParameterValue    pv6         = new ParameterValue(); pv6.Name = "Region"; pv6.Value = null;
                ParameterValue    pv7         = new ParameterValue(); pv7.Name = "StoreNumber"; pv7.Value = null;
                ParameterValue[]  parameters  = new ParameterValue[] { pv4, pv1, pv5, pv6, pv7, pv3 };
                subscriptionID = _Client.CreateSubscription(reportPath, extSettings, description, eventType, matchData, parameters);
            }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message); }
            return(subscriptionID);
        }
Beispiel #4
0
        public static SubscriptionDataset GetSubscriptions(string reportPath)
        {
            //Get subscriptions  for the specidied report
            SubscriptionDataset subscriptionDataset = new SubscriptionDataset();

            try {
                //Create reporting service web client proxy
                _Client             = new ReportingService2010();
                _Client.Credentials = System.Net.CredentialCache.DefaultCredentials;

                //Request all subscriptions for the specified report
                Subscription[] subscriptions = _Client.ListSubscriptions(reportPath);
                if (subscriptions != null)
                {
                    //Enumerate all subscriptions
                    for (int i = 0; i < subscriptions.Length; i++)
                    {
                        //Get subscription properties
                        Subscription      sub = subscriptions[i];
                        ExtensionSettings extSettings = null;
                        ActiveState       active = null;
                        string            desc = "", status = "", eventType = "", matchData = "";
                        ParameterValue[]  paramValues = null;
                        _Client.GetSubscriptionProperties(subscriptions[i].SubscriptionID, out extSettings, out desc, out active, out status, out eventType, out matchData, out paramValues);

                        string routeDate  = getParamValue(paramValues, "RouteDate");
                        string routeClass = getParamValue(paramValues, "RouteClass");
                        string driverName = getParamValue(paramValues, "DriverName");

                        subscriptionDataset.SubscriptionTable.AddSubscriptionTableRow(sub.Report, sub.SubscriptionID, desc, eventType, sub.LastExecuted, status, active.ToString(), getExtSettings(extSettings), matchData, getParamValues(paramValues), getSubjectLine(extSettings), routeDate, routeClass, driverName);
                    }
                }
            }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { _Client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException(ce.Message); }
            return(subscriptionDataset);
        }