private void CheckModelForCompatibility(Controller controller, string existingModelPath, string newModelSMDL) { Show(); DialogResult = DialogResult.Yes; var isCompatibleModel = true; var dependantItems = controller.ListDependantItems(existingModelPath); var validator = new ReportModelValidator(newModelSMDL); var tmpResults = new List <ReportTestResult>(); foreach (var reportItem in dependantItems) { // Load report var bytes = controller.GetReport(reportItem.Path); var reportRDL = Encoding.UTF8.GetString(bytes); if (reportRDL[0] == 65279) { reportRDL = reportRDL.Substring(1); // Step by Byte-order mark which confuses the xml-parser } // Check it against the model: var result = new ReportTestResult { ReportName = reportItem.Path + "/" + reportItem.Name, PassedTest = validator.ValidateModelForReport(reportRDL) }; if (result.PassedTest == false) { isCompatibleModel = false; } tmpResults.Add(result); TestResults = tmpResults; Application.DoEvents(); } if (isCompatibleModel == false) { MessageBox.Show("This model seem to have some compatibility issues with existing reports.", "Compatibility warning", MessageBoxButtons.OK); } else { MessageBox.Show("The new model seems to be compatible with existing reports. ", "", MessageBoxButtons.OK); } }
private void CheckModelForCompatibility(Controller rs, string existingModelPath, string newModelSMDL) { this.Show(); this.DialogResult = DialogResult.Yes; bool flag = true; List <ReportItemDTO> reportItemDtoList = rs.ListDependantItems(existingModelPath); ReportModelValidator reportModelValidator = new ReportModelValidator(newModelSMDL); List <ReportTestResult> reportTestResultList = new List <ReportTestResult>(); foreach (ReportItemDTO reportItemDto in reportItemDtoList) { string reportRDL = Encoding.UTF8.GetString(rs.GetReport(reportItemDto.Path)); if (reportRDL[0] == '\xFEFF') { reportRDL = reportRDL.Substring(1); } ReportTestResult reportTestResult = new ReportTestResult(); reportTestResult.ReportName = reportItemDto.Path + "/" + reportItemDto.Name; reportTestResult.PassedTest = reportModelValidator.ValidateModelForReport(reportRDL); if (!reportTestResult.PassedTest) { flag = false; } reportTestResultList.Add(reportTestResult); this.TestResults = (IList <ReportTestResult>)reportTestResultList; Application.DoEvents(); } if (!flag) { int num1 = (int)MessageBox.Show("This model seem to have some compatibility issues with existing reports.", "Compatibility warning", MessageBoxButtons.OK); } else { int num2 = (int)MessageBox.Show("The new model seems to be compatible with existing reports. ", "", MessageBoxButtons.OK); } }