Пример #1
0
        private void SyncTreeNodes(string destPath, IEnumerable nodes)
        {
            foreach (var node in nodes.Cast<TreeNode>().Where(node => (bool) node.Tag))
            {
                if (node.Nodes.Count > 0)
                {
                    var childPath = destPath;
                    if (node.Checked)
                    {
                        if (destPath.Equals(RootFolder))
                            childPath = RootFolder + node.Text;
                        else
                            childPath = destPath + PathSeperator + node.Text;
                    }
                    SyncTreeNodes(childPath, node.Nodes);
                }
                else
                {
                    if (!_existingPaths.Contains(destPath))
                    {
                        EnsureDestDir(destPath);
                        _existingPaths.Add(destPath);
                    }
                    var itemPath = RootFolder + node.FullPath.Replace("\\", PathSeperator);
                    var itemType = _sourceServicesMgmt.ReportingService.GetItemType(itemPath);
                    if (itemType == ItemTypeEnum.Resource)
                    {
                        //Download the resource
                        string resourceType;
                        var contents = _sourceServicesMgmt.ReportingService.GetResourceContents(itemPath, out resourceType);
                        UploadResource(destPath, node.Text, resourceType, contents);
                        _processedNodeCount++;
                        continue;
                    }
                    var reportDef = _sourceServicesMgmt.ReportingService.GetReportDefinition(itemPath);
                    UploadReport(destPath, node.Text, reportDef);

                    //Sync subscriptions

                    var destReportPath = destPath;
                    if (destReportPath.EndsWith("/"))
                        destReportPath += node.Text;
                    else
                        destReportPath += "/" + node.Text;

                    var subscriptions = _sourceServicesMgmt.ReportingService.ListSubscriptions(itemPath, tbSourceUser.Text);
                    foreach (var subscription in subscriptions)
                    {
                        ExtensionSettings extSettings;
                        string desc;
                        ActiveState active;
                        string status;
                        string eventType;
                        string matchData;
                        ParameterValue[] values;
                        _sourceServicesMgmt.ReportingService.GetSubscriptionProperties(subscription.SubscriptionID, out extSettings, out desc, out active, out status, out eventType, out matchData, out values);
                        if (extSettings.Extension == "Report Server FileShare")
                        {
                            var para = new ParameterValue {Name = "PASSWORD", Value = tbDestPassword.Text};
                            var exParams = new ParameterValueOrFieldReference[extSettings.ParameterValues.Length + 1];
                            Array.Copy(extSettings.ParameterValues, exParams, extSettings.ParameterValues.Length);
                            exParams[extSettings.ParameterValues.Length] = para;
                            extSettings.ParameterValues = exParams;
                        }
                        _destServicesMgmt.ReportingService.CreateSubscription(destReportPath, extSettings, desc, eventType, matchData, values);
                    }

                    _processedNodeCount++;
                    bwSync.ReportProgress(_processedNodeCount * 100 / _selectedNodeCount);
                }
            }
        }
Пример #2
0
 /// <remarks/>
 public void SetSubscriptionPropertiesAsync(string SubscriptionID, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters, object userState) {
     if ((this.SetSubscriptionPropertiesOperationCompleted == null)) {
         this.SetSubscriptionPropertiesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetSubscriptionPropertiesOperationCompleted);
     }
     this.InvokeAsync("SetSubscriptionProperties", new object[] {
                 SubscriptionID,
                 ExtensionSettings,
                 Description,
                 EventType,
                 MatchData,
                 Parameters}, this.SetSubscriptionPropertiesOperationCompleted, userState);
 }
Пример #3
0
 public string GetSubscriptionProperties(string SubscriptionID, out ExtensionSettings ExtensionSettings, out string Description, out ActiveState Active, out string Status, out string EventType, out string MatchData, out ParameterValue[] Parameters) {
     object[] results = this.Invoke("GetSubscriptionProperties", new object[] {
                 SubscriptionID});
     ExtensionSettings = ((ExtensionSettings)(results[1]));
     Description = ((string)(results[2]));
     Active = ((ActiveState)(results[3]));
     Status = ((string)(results[4]));
     EventType = ((string)(results[5]));
     MatchData = ((string)(results[6]));
     Parameters = ((ParameterValue[])(results[7]));
     return ((string)(results[0]));
 }
Пример #4
0
 public void SetSubscriptionProperties(string SubscriptionID, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) {
     this.Invoke("SetSubscriptionProperties", new object[] {
                 SubscriptionID,
                 ExtensionSettings,
                 Description,
                 EventType,
                 MatchData,
                 Parameters});
 }
Пример #5
0
 /// <remarks/>
 public void SetSubscriptionPropertiesAsync(string SubscriptionID, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) {
     this.SetSubscriptionPropertiesAsync(SubscriptionID, ExtensionSettings, Description, EventType, MatchData, Parameters, null);
 }
Пример #6
0
 /// <remarks/>
 public void CreateSubscriptionAsync(string Report, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) {
     this.CreateSubscriptionAsync(Report, ExtensionSettings, Description, EventType, MatchData, Parameters, null);
 }
Пример #7
0
 /// <remarks/>
 public void CreateSubscriptionAsync(string Report, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters, object userState) {
     if ((this.CreateSubscriptionOperationCompleted == null)) {
         this.CreateSubscriptionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateSubscriptionOperationCompleted);
     }
     this.InvokeAsync("CreateSubscription", new object[] {
                 Report,
                 ExtensionSettings,
                 Description,
                 EventType,
                 MatchData,
                 Parameters}, this.CreateSubscriptionOperationCompleted, userState);
 }
Пример #8
0
 public string CreateSubscription(string Report, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) {
     object[] results = this.Invoke("CreateSubscription", new object[] {
                 Report,
                 ExtensionSettings,
                 Description,
                 EventType,
                 MatchData,
                 Parameters});
     return ((string)(results[0]));
 }
Пример #9
0
 /// <remarks/>
 public void GetReportParametersAsync(string Report, string HistoryID, bool ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials, object userState) {
     if ((this.GetReportParametersOperationCompleted == null)) {
         this.GetReportParametersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetReportParametersOperationCompleted);
     }
     this.InvokeAsync("GetReportParameters", new object[] {
                 Report,
                 HistoryID,
                 ForRendering,
                 Values,
                 Credentials}, this.GetReportParametersOperationCompleted, userState);
 }
Пример #10
0
 /// <remarks/>
 public void GetReportParametersAsync(string Report, string HistoryID, bool ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials) {
     this.GetReportParametersAsync(Report, HistoryID, ForRendering, Values, Credentials, null);
 }
Пример #11
0
 public ReportParameter[] GetReportParameters(string Report, string HistoryID, bool ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials) {
     object[] results = this.Invoke("GetReportParameters", new object[] {
                 Report,
                 HistoryID,
                 ForRendering,
                 Values,
                 Credentials});
     return ((ReportParameter[])(results[0]));
 }
Пример #12
0
        private void syncTreeNodes(string destPath, TreeNodeCollection nodes)
        {
            foreach (TreeNode node in nodes)
            {
                if ((bool)node.Tag)
                {
                    if (node.Nodes.Count > 0)
                    {
                        var childPath = destPath;
                        if (node.Checked)
                        {
                            if (destPath.Equals(ROOT_FOLDER))
                                childPath = ROOT_FOLDER + node.Text;
                            else
                                childPath = destPath + PATH_SEPERATOR + node.Text;
                        }
                        syncTreeNodes(childPath, node.Nodes);
                    }
                    else
                    {
                        if (!existingPaths.Contains(destPath))
                        {
                            EnsureDestDir(destPath);
                            existingPaths.Add(destPath);
                        }
                        var itemPath = ROOT_FOLDER + node.FullPath.Replace("\\", PATH_SEPERATOR);
                        var itemType = sourceRS.GetItemType(itemPath);
                        if (itemType == ItemTypeEnum.Resource)
                        {
                            //Download the resource
                            string resourceType;
                            var contents = sourceRS.GetResourceContents(itemPath, out resourceType);
                            uploadResource(destPath, node.Text, resourceType, contents);
                            processedNodeCount++;
                            continue;
                        }
                        var reportDef = sourceRS.GetReportDefinition(itemPath);
                        uploadReport(destPath, node.Text, reportDef);

                        //Sync subscriptions
                        ExtensionSettings extSettings;
                        string desc;
                        ActiveState active;
                        string status;
                        string eventType;
                        string matchData;
                        ParameterValue[] values = null;
                        Subscription[] subscriptions = null;
                        ParameterValueOrFieldReference[] extensionParams = null;

                        var destReportPath = destPath;
                        if (destReportPath.EndsWith("/"))
                            destReportPath += node.Text;
                        else
                            destReportPath += "/" + node.Text;

                        subscriptions = sourceRS.ListSubscriptions(itemPath, txtSourceUser.Text);
                        foreach (var subscription in subscriptions)
                        {
                            sourceRS.GetSubscriptionProperties(subscription.SubscriptionID, out extSettings, out desc, out active, out status, out eventType, out matchData, out values);
                            if (extSettings.Extension == "Report Server FileShare")
                            {
                                ParameterValue para = new ParameterValue();
                                para.Name = "PASSWORD";
                                para.Value = txtDestPassword.Text;
                                ParameterValueOrFieldReference[] exParams = new ParameterValueOrFieldReference[extSettings.ParameterValues.Length + 1];
                                Array.Copy(extSettings.ParameterValues, exParams, extSettings.ParameterValues.Length);
                                exParams[extSettings.ParameterValues.Length] = para;
                                extSettings.ParameterValues = exParams;
                            }
                            destRS.CreateSubscription(destReportPath, extSettings, desc, eventType, matchData, values);
                        }

                        processedNodeCount++;
                        bwSync.ReportProgress(processedNodeCount * 100 / selectedNodeCount);
                    }                    
                }
            }
        }