public void Constructs_ok(int threshold, bool expectedEnabled)
 {
     var settings = new ReportSettings("Html", threshold);
     Assert.AreEqual("Html", settings.ReportType);
     Assert.AreEqual(threshold, settings.AutoCondenseThreshold);
     Assert.AreEqual(expectedEnabled, settings.AutoCondenseEnabled);
 }
Beispiel #2
0
		public void TestReport()
		{
			ReportSettings settings = new ReportSettings();
			settings.ReportDir = Path.GetTempPath();
			settings.ReportName = "Test";

			Stream expected = ResourceManager.GetResource("SharpCover.Resources.ExpectedCoverageFile.xml", typeof(CoverageTests).Assembly);
			Stream actual = ResourceManager.GetResource("SharpCover.Resources.ActualCoverageFile.xml", typeof(CoverageTests).Assembly);
			Stream fixedfile = Coverage.FixActualFile(actual);

			Coverage result = Coverage.LoadCoverage(expected, fixedfile);


			ReportGenerator generator = new ReportGenerator();
			Report report = generator.GenerateReport(result);
			
			DeleteFiles(settings);
			CheckFilesNotExist(settings);

			SetGradient();

			try
			{
				HtmlReport.Generate(settings, report);
				CheckFilesExist(settings);			
			}
			finally
			{
				DeleteFiles(settings);
				Gradient.GetInstance().Points.Clear();
			}
		}
Beispiel #3
0
		public SqlDataAccessStrategy(ReportSettings reportSettings)
		{
			if (reportSettings == null) {
				throw new ArgumentNullException("reportSettings");
			}
			this.reportSettings = reportSettings;
		}
		public static ConnectionObject BuildConnectionObject (ReportSettings reportSettings)
		{
			if (reportSettings == null) {
				throw new ArgumentNullException("reportSettings");
			}
			return ConnectionObject.CreateInstance(reportSettings.ConnectionString,
			                                      DbProviderFactories.GetFactory("System.Data.OleDb"));
		}
		public void AddGroupColumn ()
		{
			GroupColumn gc = new GroupColumn("GroupItem",1,ListSortDirection.Ascending);
			ReportSettings rs = new ReportSettings();
			
			rs.GroupColumnsCollection.Add(gc);
			Assert.AreEqual(1,rs.GroupColumnsCollection.Count);
		}
Beispiel #6
0
		private void DeleteTempFiles(ReportSettings settings)
		{
			if(File.Exists(settings.ActualFilename))
				File.Delete(settings.ActualFilename);

			if(File.Exists(settings.ExpectedFilename))
				File.Delete(settings.ExpectedFilename);
		}
Beispiel #7
0
		public TableStrategy(DataTable table,ReportSettings reportSettings):base(reportSettings)
		{
			if (table == null) {
				throw new ArgumentNullException("table");
			}
			this.table = table;
			
		}
Beispiel #8
0
		public PreviewViewModel(ReportSettings reportSettings, PagesCollection pages)
		{
			this.Pages = pages;
			FixedDocumentRenderer renderer =  FixedDocumentRenderer.CreateInstance(reportSettings,Pages);
			renderer.Start();
			renderer.RenderOutput();
			renderer.End();
			this.Document = renderer.Document;
		}
		protected BaseListStrategy(ReportSettings reportSettings)
		{
			if (reportSettings == null) {
				throw new ArgumentNullException("reportSettings");
			}
			this.ReportSettings = reportSettings;
			this.IndexList = new IndexList("IndexList");
			ExpressionEvaluator = new ExpressionEvaluatorFacade (null);
		}
Beispiel #10
0
		private static ReportSettings GetSettings(NameValueCollection nvc)
		{
			ReportSettings settings = new ReportSettings();

			settings.ReportName = nvc[Constants.REPORT_NAME];
			settings.BaseDir = nvc[Constants.BASE_DIR];
			settings.ReportDir = nvc[Constants.REPORT_DIR];
			
			return settings;
		}
 private void Preset(ReportSettings settings)
 {
     var preset = types.Find(x => x.Name.Equals(settings.ReportType, StringComparison.OrdinalIgnoreCase));
     comboBoxOutputReportType.SelectedItem = preset;
     labelDetails.Text = preset.Description;
     checkBoxAutoCondense.Checked = settings.AutoCondenseEnabled;
     groupBoxAutoCondense.Enabled = settings.AutoCondenseEnabled;
     numericUpDownAutoCondenseThreshold.Value = settings.AutoCondenseThreshold;
     UpdateAutoCondenseGroup();
 }
Beispiel #12
0
		private void CheckFilesExist(ReportSettings settings)
		{
			Assert.IsTrue(File.Exists(settings.ReportFilename));
			Assert.IsTrue(File.Exists(settings.CssFilename));
			Assert.IsTrue(File.Exists(settings.GetFilename("SharpCover", ".gif")));

			Assert.IsTrue(new FileInfo(settings.ReportFilename).Length > 0);
			Assert.IsTrue(new FileInfo(settings.CssFilename).Length > 0);
			Assert.IsTrue(new FileInfo(settings.GetFilename("SharpCover", ".gif")).Length > 0);
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="SharpCoverReportAction"/> class.
        /// </summary>
		public SharpCoverReportAction()
		{
			settings = new ReportSettings();

			Gradient gradient = Gradient.GetInstance();
			gradient.Points.Clear();
			gradient.Add(new GradientPoint(0, 255, 0, 0));
			gradient.Add(new GradientPoint(75, 200, 200, 0));
			gradient.Add(new GradientPoint(100, 0, 200, 0));
		}
		public CollectionStrategy(IList list,ReportSettings reportSettings):base(reportSettings)
		{
			if (list.Count > 0) {
				firstItem = list[0];
				itemType =  firstItem.GetType();
				
				this.baseList = new DataCollection <object>(itemType);
				this.baseList.AddRange(list);
			}
			this.listProperties = this.baseList.GetItemProperties(null);
		}
Beispiel #15
0
		public SqlDataAccessStrategy(ReportSettings reportSettings,ConnectionObject connectionObject)
		{
			if (reportSettings == null) {
				throw new ArgumentNullException("reportSettings");
			}
			this.reportSettings = reportSettings;
			if (connectionObject == null) {
				this.connectionObject = ConnectionObjectFactory.BuildConnectionObject(reportSettings);
			} else {
				this.connectionObject = connectionObject;
			}
		}
		public void TestProperties()
		{
			Assert.IsNotNull(this.action.Filenames);
			Assert.IsNotNull(this.action.Settings);

			ReportSettings rs = new ReportSettings();
			this.action.Settings = rs;

			Instrumenter instrumenter = new FileCopyInstrumenter(null);
			this.action.Instrumenter = instrumenter;

			Assert.AreEqual(rs, this.action.Settings);
			Assert.AreEqual(instrumenter, this.action.Instrumenter);
		}
Beispiel #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Parser"/> class.
        /// </summary>
        /// <param name="Settings">The settings.</param>
		public Parser(ReportSettings Settings)
		{
			this.settings = Settings;
            this.coveragepoints = new List<CoveragePoint>();
			
			AddCoveragePointDelegate addpointdel = new AddCoveragePointDelegate(this.AddCoveragePoint);

            this.matchers = new List<Matcher>(6);
			this.matchers.Add(new StatementMatcher(addpointdel));
			this.matchers.Add(new ConditionalMatcher(addpointdel));
			this.matchers.Add(new CatchBlockMatcher(addpointdel));
			this.matchers.Add(new MethodMatcher(addpointdel));
			this.matchers.Add(new FlattenMatcher(addpointdel));
			this.matchers.Add(new UnflattenMatcher(addpointdel));
		}
Beispiel #18
0
		private static void AddFiles(StringCollection files, ReportSettings settings, string dirAndPattern)
		{
			string path = dirAndPattern;

			if(path == null)
				return;

			if(path[0] != '\\')
				path = Path.Combine(settings.BaseDir, dirAndPattern);

			DirectoryInfo dir = new DirectoryInfo(Path.GetFullPath(Path.GetDirectoryName(path)));
            string pattern = Path.GetFileName(dirAndPattern);

			AddFiles(files, settings, dir, pattern);
		}
		/// <summary>
		/// For internal use only
		/// </summary>
		/// <param name="reportSettings"></param>
		/// <param name="pages"></param>
		/// <param name="fileName"></param>
		/// <param name="showOutput"></param>
		/// <returns></returns>
		public static PdfRenderer CreateInstance (ReportSettings reportSettings,PagesCollection pages,string fileName,bool showOutput) {	
		                                          
			if ((pages == null) ||(pages.Count == 0)) {
				throw new ArgumentNullException("pages");
			}
			if (String.IsNullOrEmpty(fileName)) {
				throw new ArgumentNullException("fileName");
			}
			
			PdfRenderer instance = new PdfRenderer(pages);
			instance.fileName = fileName;
			instance.reportSettings = reportSettings;
			instance.showOutput = showOutput;
			return instance;
		}
Beispiel #20
0
		private static void AddFiles(StringCollection files, ReportSettings settings, DirectoryInfo dir, string pattern)
		{
			//Add matching files
			foreach (FileInfo file in dir.GetFiles(pattern))
			{
				Trace.WriteLineIf(Logger.OutputType.TraceInfo, file.FullName, "Adding file");
				files.Add(file.FullName);
			}

			//Recurse through sub-directories...
			foreach (DirectoryInfo subdir in dir.GetDirectories())
			{
				AddFiles(files, settings, subdir, pattern);
			}
		}
Beispiel #21
0
        /// <summary>
        /// Generates the specified settings.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="report">The report.</param>
		public static void Generate(ReportSettings settings, Report report)
		{			
			// Load the transform
			XslCompiledTransform transform = LoadTransform("SharpCover.Report.xslt");
			
			// Save the required stylesheet and images to the output folder
			WriteResource(settings.CssFilename, "SharpCover.SharpCover.css", ResourceType.Text);
			WriteResource(settings.GetFilename("SharpCover", ".gif"), "SharpCover.SharpCover.gif", ResourceType.Binary);

            // Write the xml report to disk
            WriteReport(report, settings.ReportXmlFilename);

			// Convert the report to a format we can transform
			XPathDocument doc = ConvertReportToXPathDocument(report);

			// Do the transform and write the results to disk
			WriteReport(transform, doc, settings.ReportFilename);
		}
Beispiel #22
0
		public SectionBounds (ReportSettings reportSettings,bool firstPage)
		{
			if (reportSettings == null) {
				throw new ArgumentNullException("reportSettings");
			}
			
			this.firstPage = firstPage;
			this.landscape = reportSettings.Landscape;
			this.PageSize = reportSettings.PageSize;
			
			this.printableArea = new Rectangle(reportSettings.LeftMargin,reportSettings.TopMargin,
			                                   reportSettings.PageSize.Width - reportSettings.RightMargin,
			                                   reportSettings.PageSize.Height - reportSettings.BottomMargin);
			
			this.marginBounds = new Rectangle(reportSettings.LeftMargin,
			                                  reportSettings.TopMargin,
			                                  reportSettings.PageSize.Width - reportSettings.LeftMargin - reportSettings.RightMargin,
			                                  reportSettings.PageSize.Height - reportSettings.TopMargin - reportSettings.BottomMargin);
		}
		public void TestProperties()
		{
            Assert.IsNotNull(this.action.Filenames, "action.Filenames should no be null");
            Assert.IsNotNull(this.action.Settings, "action.Settings should no be null");
            Assert.IsNull(this.action.Instrumenter, "action.Instrumenter will be initialized on execute");

			StringCollection sc = new StringCollection();
			this.action.Filenames = sc;

			ReportSettings rs = new ReportSettings();
			this.action.Settings = rs;

            List<IParse> parsers = new List<IParse>(1);
			parsers.Add(new Parser(rs));
			Instrumenter instrumenter = new FileCopyInstrumenter(parsers.ToArray());
			this.action.Instrumenter = instrumenter;

			Assert.AreEqual(sc, this.action.Filenames);
			Assert.AreEqual(rs, this.action.Settings);
			Assert.AreEqual(instrumenter, this.action.Instrumenter);
		}
Beispiel #24
0
        public void TestReportSettingsEquals()
        {
            TestUtils.InitializeInstallations();
            var testReportInfoNoScript   = new ReportInfo("Name", TestUtils.GetTestFilePath("UniqueReport.skyr"), new List <Tuple <string, string> >());
            var testReportInfoWithScript = TestUtils.GetTestReportInfo();

            Assert.IsTrue(Equals(testReportInfoNoScript,
                                 new ReportInfo("Name", TestUtils.GetTestFilePath("UniqueReport.skyr"), new List <Tuple <string, string> >())));
            Assert.IsFalse(Equals(testReportInfoNoScript, testReportInfoWithScript));
            //TestUtils.GetTestReportSettings();
            var emptyReportSettings      = new ReportSettings(new List <ReportInfo>());
            var reportSettingsWithScript = TestUtils.GetTestReportSettings();

            Assert.IsTrue(Equals(emptyReportSettings, new ReportSettings(new List <ReportInfo>())));

            var reportList = new List <ReportInfo>();

            reportList.Add(testReportInfoNoScript);
            var changedReportSettings = new ReportSettings(reportList);

            Assert.IsFalse(Equals(emptyReportSettings, changedReportSettings));
            Assert.IsFalse(Equals(changedReportSettings, reportSettingsWithScript));
        }
Beispiel #25
0
        private static void InitializeSummaryReport()
        {
            _frameworkParameters.RunConfiguration = ConfigurationManager.AppSettings["RunConfiguration"];
            _timeStamp = TimeStamp.getInstance();

            _reportSettings = InitializeReportSettings();
            string      theme       = ConfigurationManager.AppSettings["ReportTheme"];
            ReportTheme reportTheme =
                ReportThemeFactory.GetReportsTheme((Framework_Reporting.ReportThemeFactory.Theme)Enum.Parse(typeof(Framework_Reporting.ReportThemeFactory.Theme), theme));

            _report = new SeleniumReport(_reportSettings, reportTheme);

            _report.InitializeReportTypes();

            _report.InitializeResultSummary();
            _report.AddResultSummaryHeading(_reportSettings.ProjectName +
                                            " - " + " Automation Execution Result Summary");
            _report.AddResultSummarySubHeading("Date & Time",
                                               ": " + Util.GetCurrentFormattedTime(ConfigurationManager.AppSettings["DateFormatString"]),
                                               "OnError", ": " + ConfigurationManager.AppSettings["OnError"]);

            _report.AddResultSummaryTableHeadings();
        }
Beispiel #26
0
        IEnumerable <IEntity> GetListFromReport(IRunState context, IEntity reportRef)
        {
            var reportSettings = new ReportSettings
            {
                InitialRow      = 0,
                PageSize        = MaxResourcesInList,
                SupportPaging   = true,
                CpuLimitSeconds = EDC.ReadiNow.Configuration.EntityWebApiSettings.Current.ReportCpuLimitSeconds
            };


            var reportingInterface = new ReportingInterface();

            try
            {
                var result = reportingInterface.RunReport(reportRef.Id, reportSettings);
                return(result.GridData.Where(row => row.EntityId > 0).Select(row => Entity.Get(row.EntityId)).ToList());
            }
            catch (TenantResourceLimitException ex)
            {
                throw new WorkflowRunException(ex.CustomerMessage, ex);
            }
        }
Beispiel #27
0
        public DataTable GetReportTable(ReportSettings reportSettings)
        {
            string sql;

            switch (reportSettings.ReportType)
            {
            case ReportType.Labors:
                sql = GetLaborsReportSqlCommand(reportSettings);
                return(GetDataTableFromSql(sql));

            case ReportType.MatchEstimate:
                sql = GetMatchEstimateReportSqlCommand(reportSettings);
                return(GetDataTableFromSql(sql));

            case ReportType.NotMatchEstimate:
                sql = GetNotMatchEstimateReportSqlCommand(reportSettings);
                return(GetDataTableFromSql(sql));

            case ReportType.OverTime:
                sql = GetOverTimeReportSqlCommand(reportSettings);
                return(GetDataTableFromSql(sql));

            case ReportType.TaskTypes:
                sql = GetTaskTypesReportSqlCommand(reportSettings);
                return(GetDataTableFromSql(sql));

            case ReportType.TaskTimes:
                sql = GetTaskTimesReportSqlCommand(reportSettings);
                return(GetDataTableFromSql(sql));

            case ReportType.Bonus:
                return(GetBonusReportSqlCommand(reportSettings));

            default:
                return(GetDataTableFromSql("select * from labors"));
            }
        }
Beispiel #28
0
        private void InitializeReportSettings()
        {
            reportPath = _frameworkParameters.RelativePath +
                         Util.GetFileSeparator() + "Results" +
                         Util.GetFileSeparator() + _timeStamp;

            _reportSettings = new ReportSettings(reportPath,
                                                 testParameters.CurrentScenario +
                                                 "_" + testParameters.CurrentTestcase);

            _reportSettings.DateFormatString     = ConfigurationManager.AppSettings["DateFormatString"];
            _reportSettings.LogLevel             = Convert.ToInt32(ConfigurationManager.AppSettings["LogLevel"]);
            _reportSettings.ProjectName          = ConfigurationManager.AppSettings["ProjectName"];
            _reportSettings.GenerateExcelReports =
                Boolean.Parse(ConfigurationManager.AppSettings["ExcelReport"]);
            _reportSettings.GenerateHtmlReports =
                Boolean.Parse(ConfigurationManager.AppSettings["HtmlReport"]);
            _reportSettings.IncludeTestDataInReport =
                Boolean.Parse(ConfigurationManager.AppSettings["IncludeTestDataInReport"]);
            _reportSettings.TakeScreenshotFailedStep =
                Boolean.Parse(ConfigurationManager.AppSettings["TakeScreenshotFailedStep"]);
            _reportSettings.TakeScreenshotPassedStep =
                Boolean.Parse(ConfigurationManager.AppSettings["TakeScreenshotPassedStep"]);
        }
Beispiel #29
0
        private void Recurse(FileSystemEntry Entry, ReportIFSExplorer IFSExplorer)
        {
            if (Entry.Type.Equals(FileSystemEntry.Types.File))
            {
                ReportSettings settings = Session.ReportManager.GetReportSettings(Entry);
                if (settings.Columns != null)
                {
                    ReportResults.Add(new ReportResult()
                    {
                        Columns          = settings.Columns,
                        Name             = Entry.Name,
                        Path             = Entry.Path,
                        MatchingProperty = "Column"
                    });
                }


                if (settings.Filters != null)
                {
                    ReportResults.AddRange(settings.Filters.Select(x => new ReportResult()
                    {
                        Filters          = settings.Filters,
                        Name             = Entry.Name,
                        Path             = Entry.Path,
                        MatchingProperty = $"Filter [{x.FieldID}] {x.OperatorTypeAsString} {x.ValueFrom} {x.ValueTo}"
                    }));
                }
            }
            else
            {
                foreach (FileSystemEntry file in IFSExplorer.GetFileSystemEntries(Entry))
                {
                    Recurse(file, IFSExplorer);
                }
            }
        }
        public void SortAscendingByTwoColumns()
        {
            SortColumn sc  = new SortColumn("Last", System.ComponentModel.ListSortDirection.Ascending);
            SortColumn sc1 = new SortColumn("RandomInt", System.ComponentModel.ListSortDirection.Ascending);

            ReportSettings rs = new ReportSettings();

            rs.SortColumnsCollection.Add(sc);
            rs.SortColumnsCollection.Add(sc1);
            IDataManager  dm      = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.contributorCollection, rs);
            DataNavigator dataNav = dm.GetNavigator;
            string        v1      = String.Empty;

            while (dataNav.MoveNext())
            {
                Contributor view = dataNav.Current as Contributor;
                string      v2   = view.Last + "-" + view.RandomInt;
                //string ss = String.Format("< {0} > <{1}>",v1,v2);
                //Console.WriteLine(ss);
                //Console.WriteLine(v2);
                Assert.LessOrEqual(v1, v2);
                v1 = v2;
            }
        }
        internal ReportResultCacheKey(ReportSettings reportSettings, IQueryRunnerCacheKey reportQueryKey, IQueryRunnerCacheKey rollupQueryKey)
        {
            if (reportSettings == null)
            {
                throw new ArgumentNullException("reportSettings");
            }
            if (reportQueryKey == null)
            {
                throw new ArgumentNullException("reportQueryKey");
            }
            // rollupQueryKey may be null

            ReportQueryKey = reportQueryKey;
            RollupQueryKey = rollupQueryKey;
            Bools          = PackBools(reportSettings);
            ColumnCount    = reportSettings.ColumnCount;

            // The following reportSettings do not need to be covered in this key:
            // - SupportPaging, PageSize, InitialRow (denied)
            // - ReportParameters, Timezone, ReportOnType, QuickSearch, FilteredEntityIdentifiers, RelatedEntityFilters
            // - UseStructuredQueryCache, RefreshCachedResult, RefreshCachedSql, RefreshCachedStructuredQuery

            _hashCode = GenerateHashCode();
        }
        public void Expression_In_Text_Evaluate()
        {
            ReportSettings rs      = new ReportSettings();
            IDataManager   dm      = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.table, rs);
            DataNavigator  dataNav = dm.GetNavigator;
            BaseDataItem   bdi     = new BaseDataItem()
            {
                Name       = "MyDataItem",
                ColumnName = "last",
                Text       = "=Substring(Fields!last,0,3)",
                Expression = "=Substring(Fields!last,0,3)"
            };
            var ri = new ReportItemCollection();

            ri.Add(bdi);

            while (dataNav.MoveNext())
            {
                dataNav.Fill(ri);
                DataRow r      = dataNav.Current as DataRow;
                string  actual = r["last"].ToString();
                Assert.That(actual.Substring(0, 3), Is.EqualTo(bdi.DBValue));
            }
        }
 private void SetupViewer(ReportModel reportModel)
 {
     this.pages          = new PagesCollection();
     this.reportSettings = reportModel.ReportSettings;
     this.AdjustDrawArea();
 }
		public PdfUnitConverter (Rectangle pageSize,ReportSettings reportsettings)
		{
			if (pageSize == null) {
				throw new ArgumentNullException("pageSize");
			}
			if (reportsettings == null) {
				throw new ArgumentNullException("reportsettings");
			}
			this.pageSize = pageSize;
			this.reportsettings = reportsettings;
			this.lowerLeftX = UnitConverter.FromPixel(this.reportsettings.LeftMargin);
			
			this.lowerleftY = UnitConverter.FromPixel(this.reportsettings.BottomMargin);
			
			this.upperRightX = PageSize.A4.Width;
			this.upperRightY = PageSize.A4.Height;
		}
        /// <summary>
        /// Generates a report from a set of changes using the specified settings
        /// </summary>
        /// <param name="InReportSettings">Report generation settings</param>
        /// <param name="InChanges">Change data</param>
        /// <param name="OutReportString">Output report string</param>
        public static void GenerateReportFromChanges(ReportSettings InReportSettings, List <P4ParsedChangelist> InChanges, out String OutReportString)
        {
            // Sort everything into buckets based on category
            ProjectCategory MainCategory = new ProjectCategory();

            MainCategory.Name = "Main";

            // We'll only create an "uncategorized" category if we need to (later)
            ProjectCategory UncategorizedCategory = null;


            // Process changes
            foreach (var Changelist in InChanges)
            {
                foreach (var Subchange in Changelist.Subchanges)
                {
                    ChangeDesc NewChangeDesc = new ChangeDesc();


                    // Store changelist number
                    NewChangeDesc.ChangelistNumber = Changelist.BaseChangelist.Id;


                    // Classify this change
                    if (Subchange.StartTag.StartTagName.Equals("Fix", StringComparison.InvariantCultureIgnoreCase))
                    {
                        NewChangeDesc.Type = EChangeType.Fix;
                    }
                    else if (Subchange.StartTag.StartTagName.Equals("Change", StringComparison.InvariantCultureIgnoreCase))
                    {
                        NewChangeDesc.Type = EChangeType.Change;
                    }
                    else if (Subchange.StartTag.StartTagName.Equals("New", StringComparison.InvariantCultureIgnoreCase))
                    {
                        NewChangeDesc.Type = EChangeType.New;
                    }


                    // Store the change description
                    NewChangeDesc.BriefDescription = Subchange.StartTag.BriefDescription;

                    // Store the extra description
                    if (Subchange.AuxiliaryTags.ContainsKey("extra"))
                    {
                        List <P4AuxiliaryTag> AuxTags = Subchange.AuxiliaryTags["extra"];
                        foreach (P4AuxiliaryTag CurAuxTag in AuxTags)
                        {
                            P4ExtraTag CurExtraTag = CurAuxTag as P4ExtraTag;
                            NewChangeDesc.ExtraDescription.Add(CurExtraTag.Description);
                        }
                    }


                    // Iterate over the types of tags attached to this change
                    ProjectCategory BestCategory = null;
                    foreach (var CurAuxTag in Subchange.AuxiliaryTags.Keys)
                    {
                        // Now iterate over the ordered list of tags of a single type attached to this change
                        List <P4AuxiliaryTag> CurAuxList = Subchange.AuxiliaryTags[CurAuxTag];
                        foreach (P4AuxiliaryTag CurTag in CurAuxList)
                        {
                            // TTP number
                            if (CurTag is P4TTPTag)
                            {
                                P4TTPTag TTPTag = (P4TTPTag)CurTag;
                                NewChangeDesc.TTPNumbers.Add(TTPTag.TTPNumber);
                            }


                            // Project (aka. category)
                            else if (CurTag is P4ProjTag)
                            {
                                if (BestCategory == null)
                                {
                                    P4ProjTag ProjTag = (P4ProjTag)CurTag;

                                    // Parse the string
                                    String[] CategoryPath = ProjTag.Project.Split('.');

                                    ProjectCategory SearchCategory = MainCategory;
                                    foreach (var CurCategoryString in CategoryPath)
                                    {
                                        // Try to find an existing category at this level in the hierarchy
                                        bool bFoundExistingCategory = false;
                                        foreach (var CurCategory in SearchCategory.Subcategories)
                                        {
                                            if (CurCategory.Name.Equals(CurCategoryString, StringComparison.InvariantCultureIgnoreCase))
                                            {
                                                // Found an existing category at this level
                                                bFoundExistingCategory = true;

                                                // The subcategory we found now becomes the search path
                                                SearchCategory = CurCategory;
                                                break;
                                            }
                                        }

                                        // If we didn't find a category go ahead and create one now
                                        if (!bFoundExistingCategory)
                                        {
                                            var NewSubcategory = new ProjectCategory();
                                            NewSubcategory.Name = CurCategoryString;
                                            SearchCategory.Subcategories.Add(NewSubcategory);

                                            // The new subcategory now becomes the search path
                                            SearchCategory = NewSubcategory;
                                        }
                                    }

                                    // We now have a subcategory to put this change into
                                    BestCategory = SearchCategory;
                                }
                                else
                                {
                                    // We already have a category for this change.  Just ignore this entry.
                                }
                            }
                        }
                    }


                    // If the user didn't mention a category, then give it a default one
                    if (BestCategory == null)
                    {
                        if (UncategorizedCategory == null && InReportSettings.UncategorizedCategoryName.Length > 0)
                        {
                            var NewSubcategory = new ProjectCategory();
                            NewSubcategory.Name = InReportSettings.UncategorizedCategoryName;
                        }

                        // Place the item into the 'uncategorized' category
                        BestCategory = UncategorizedCategory;
                    }


                    if (BestCategory != null)
                    {
                        // Attach this change to the best category for it
                        BestCategory.Changes.Add(NewChangeDesc);
                    }
                }
            }



            // Sort the data
            SortCategoriesRecursively(InReportSettings, MainCategory);



            // Write output buffer according to the user's configuration
            using (StringWriter OutputWriter = new StringWriter())
            {
                // Omit the header name for the main category
                bool bIncludeCategoryHeader = false;
                int  IndentLevel            = 1;
                WriteCategoryChangesRecursively(OutputWriter, InReportSettings, MainCategory, bIncludeCategoryHeader, IndentLevel);


                // Store the report string
                OutReportString = OutputWriter.ToString();
            }
        }
        private bool ApplySettings(int selectedIndex)
        {
            bool applied = false;

            try
            {
                string taskName      = processUnits[selectedIndex].TaskName;
                string taskDirectory = processUnits[selectedIndex].TaskDirectory;
                string dateSuffix    = DateTime.Now.ToString("yyyy-MM-dd");

                if (!Directory.Exists(taskDirectory) || string.IsNullOrEmpty(taskName))
                {
                    return(applied);
                }


                //Reports
                ReportSettings rSetting   = settings.ReportSettings;
                string         rDirectory = (rSetting.SaveInPlace) ? taskDirectory : rSetting.OutputFolder;
                if (Directory.Exists(rDirectory))
                {
                    if (rSetting.IsCheckingSelected)
                    {
                        string checkingFileName = (rSetting.AppendDate) ? (taskName + "-checking-" + dateSuffix) : (taskName + "-checking");
                        processUnits[selectedIndex].CheckingReport.PdfFile = System.IO.Path.Combine(rDirectory, checkingFileName + ".pdf");
                        processUnits[selectedIndex].CheckingReport.RtfFile = System.IO.Path.Combine(rDirectory, checkingFileName + ".rtf");
                    }
                    if (rSetting.IsPresentationSelected)
                    {
                        string presentationFileName = (rSetting.AppendDate) ? (taskName + "-presentation-" + dateSuffix) : (taskName + "-presentation");
                        processUnits[selectedIndex].PresentationReport.PdfFile = System.IO.Path.Combine(rDirectory, presentationFileName + ".pdf");
                        processUnits[selectedIndex].PresentationReport.RtfFile = System.IO.Path.Combine(rDirectory, presentationFileName + ".rtf");
                    }
                    if (rSetting.IsBCFSelected)
                    {
                        string bcfFileName = (rSetting.AppendDate) ? (taskName + "-" + dateSuffix + ".bcfzip") : (taskName + ".bcfzip");
                        processUnits[selectedIndex].BCFReport.File = System.IO.Path.Combine(rDirectory, bcfFileName);
                    }
                    if (rSetting.IsCoordinationSelected)
                    {
                        string coordFileName = (rSetting.AppendDate) ? (taskName + "-" + dateSuffix + ".xls") : (taskName + ".xls");
                        processUnits[selectedIndex].CoordReport.File = System.IO.Path.Combine(rDirectory, coordFileName);

                        if (File.Exists(rSetting.CoordinationTemplate))
                        {
                            processUnits[selectedIndex].CoordReport.TemplateFile = rSetting.CoordinationTemplate;
                        }
                    }
                }


                //Saving Solibri
                SaveModelSettings sSetting   = settings.SaveSolibriSettings;
                string            sDirectory = (sSetting.SaveInPlace) ? taskDirectory : sSetting.OutputFolder;
                if (Directory.Exists(sDirectory))
                {
                    string saveFileName = (sSetting.AppendDate) ? (taskName + "-" + dateSuffix + ".smc") : (taskName + ".smc");
                    processUnits[selectedIndex].SaveSolibri.File = System.IO.Path.Combine(sDirectory, saveFileName);
                }

                applied = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to apply settings.\n" + ex.Message, "Apply Settings", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            return(applied);
        }
        /// <summary>
        /// Applies report settings to the structured query and also builds an appropriate query settings object.
        /// </summary>
        /// <param name="structuredQuery"></param>
        /// <param name="queryReportSettings"></param>
        /// <returns></returns>
        private static PreparedQuery PrepareReportRun(StructuredQuery structuredQuery, ReportSettings queryReportSettings)
        {
            QuerySettings querySettings;

            // Build the query engine settings
            bool secureReports;

            if (!_cachedSecureReports.HasValue)
            {
                DatabaseConfiguration dbConfiguration;
                dbConfiguration = ConfigurationSettings.GetDatabaseConfigurationSection( );
                if (dbConfiguration != null)
                {
                    _cachedSecureReports = dbConfiguration.ConnectionSettings.SecureReports;
                }
            }

            secureReports = _cachedSecureReports.Value;

            // Set the time zone for the report
            if (queryReportSettings.Timezone != null)
            {
                structuredQuery.TimeZoneName = queryReportSettings.Timezone.StandardName;
            }

            // Update the query engine settings
            querySettings = new QuerySettings
            {
                SecureQuery             = secureReports,
                SupportPaging           = queryReportSettings.SupportPaging,
                FirstRow                = queryReportSettings.InitialRow,
                PageSize                = queryReportSettings.PageSize,
                QuickSearchTerm         = queryReportSettings.QuickSearch,
                SupportQuickSearch      = !string.IsNullOrWhiteSpace(queryReportSettings.QuickSearch),
                FullAggregateClustering = true,
                RefreshCachedResult     = queryReportSettings.RefreshCachedResult,
                RefreshCachedSql        = queryReportSettings.RefreshCachedSql,
                CpuLimitSeconds         = queryReportSettings.CpuLimitSeconds
            };

            if (queryReportSettings.ReportOnType.HasValue)
            {
                Model.IEntity typeEntity = Model.Entity.Get <Model.EntityType>(queryReportSettings.ReportOnType);
                if (typeEntity == null)
                {
                    throw new WebArgumentException("Not a valid type");
                }

                (( ResourceEntity )structuredQuery.RootEntity).EntityTypeId = queryReportSettings.ReportOnType.Value;
            }

            if (queryReportSettings.ReportParameters != null)
            {
                // Apply any filters for analyser
                if (queryReportSettings.ReportParameters.AnalyserConditions != null &&
                    queryReportSettings.ReportParameters.AnalyserConditions.Count > 0)
                {
                    ApplyAnalyserConditions(structuredQuery, queryReportSettings.ReportParameters.AnalyserConditions);
                }
                // Apply any filters for sorting
                if (queryReportSettings.ReportParameters.SortColumns != null)
                {
                    ApplySortOrder(structuredQuery, queryReportSettings.ReportParameters.SortColumns);
                }
                // Determine if main row report is to be ignored
                querySettings.ResultSchemaOnly = queryReportSettings.ReportParameters.GroupAggregateRules != null && queryReportSettings.ReportParameters.GroupAggregateRules.IgnoreRows;
            }

            if (queryReportSettings.ReportRelationship != null)
            {
                ApplyRelatedResourceCondition(structuredQuery, queryReportSettings.ReportRelationship, querySettings);
            }

            if (queryReportSettings.RelatedEntityFilters != null)
            {
                ApplyRelatedEntityFilters(structuredQuery, queryReportSettings.RelatedEntityFilters);
            }

            if (queryReportSettings.FilteredEntityIdentifiers != null &&
                queryReportSettings.FilteredEntityIdentifiers.Count > 0)
            {
                ApplyFilteredEntityIdentifiers(structuredQuery, queryReportSettings.FilteredEntityIdentifiers);
            }

            PreparedQuery preparedQuery = new PreparedQuery
            {
                QuerySettings   = querySettings,
                StructuredQuery = structuredQuery
            };

            return(preparedQuery);
        }
        /// <summary>
        /// Runs the report.
        /// </summary>
        /// <param name="report">The report.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="suppressPreload">Pass true if the report has already been preloaded.</param>
        /// <returns>ReportResult.</returns>
        /// <exception cref="System.ArgumentException">@The report identifier resource is not a report.;reportId</exception>
        public ReportResult RunReport(Model.Report report, ReportSettings settings, bool suppressPreload = false)
        {
            ReportCompletionData completionData = PrepareReport(report, settings, suppressPreload);

            return(completionData.PerformRun( ));
        }
Beispiel #39
0
 public MockDataAccessStrategy(ReportSettings reportSettings)
 {
     this.reportSettings = reportSettings;
 }
Beispiel #40
0
 private FixedDocumentRenderer(ReportSettings reportSettings, PagesCollection pages) : base(pages)
 {
     this.pages          = pages;
     this.reportSettings = reportSettings;
     this.docCreator     = new FixedDocumentCreator();
 }
Beispiel #41
0
        public static FixedDocumentRenderer CreateInstance(ReportSettings reportSettings, PagesCollection pages)
        {
            var instance = new FixedDocumentRenderer(reportSettings, pages);

            return(instance);
        }
Beispiel #42
0
        public static ReportSettings Map(this ReportSettingsDto runDto)
        {
            var run = new ReportSettings(runDto.RunsToDisplay, runDto.TestsToDisplay);

            return(run);
        }
Beispiel #43
0
		public static void InitPage (ISinglePage singlePage,ReportSettings reportSettings)
		{
			singlePage.ReportFileName = reportSettings.FileName;
			singlePage.ReportName = reportSettings.ReportName;
			singlePage.ParameterHash = reportSettings.ParameterCollection.CreateHash();	
		}
Beispiel #44
0
    public async Task Report()
    {
        try
        {
            var socketContext = Context as SocketCommandContext;
            var guildsEmbed   = new EmbedBuilder();
            guildsEmbed.WithTitle("Reply with the number next to the guild you want to make the report in");
            var mutualGuilds = socketContext.User.MutualGuilds.ToArray();
            for (int i = 0; i < mutualGuilds.Length; i++)
            {
                guildsEmbed.AddField($"[{i + 1}] {mutualGuilds[i].Name} discord", mutualGuilds[i].Id);
            }
            await ReplyAsync(embed : guildsEmbed.Build());

            SocketGuild guild;
            while (true)
            {
                var result = await Interactivity.NextMessageAsync(timeout : TimeSpan.FromMinutes(1));

                var message = result.Value;
                if (message == null || message.Content == "cancel")
                {
                    await ReplyAsync("You have timed out or canceled");

                    return;
                }
                try
                {
                    guild = mutualGuilds[ushort.Parse(message.Content) - 1];
                    break;
                }
                catch
                {
                    await ReplyAsync("Invalid number, please reply again with a valid number or ``cancel``");
                }
            }

            ReportSettings settings = guild.LoadFromFile <ReportSettings>(false);
            if (settings?.channelID == null || guild.GetChannel(settings.channelID ?? 0) == null)
            {
                await ReplyAsync("This guild does not currently have reporting set up, command canceled");

                return;
            }
            SocketGuildUser gUser = guild.GetUser(Context.Message.Author.Id);
            if (settings.requiredRole != null && !(gUser.RoleIDs().Contains(settings.requiredRole.Value) || gUser.GuildPermissions.Administrator))
            {
                await ReplyAsync("You are missing required role for reporting");

                return;
            }

            if (settings.cooldown != null)
            {
                int messageAmount = 100;
                var messages      = await Context.Channel.GetMessagesAsync(messageAmount).Flatten().ToListAsync();

                messages.OrderBy(msg => msg.CreatedAt);
                while (messages.Last().CreatedAt.Offset > settings.cooldown.Value)
                {
                    _              = ReplyAsync("Downloading more messages");
                    messageAmount += 100;
                    messages       = await Context.Channel.GetMessagesAsync(messageAmount).Flatten().ToListAsync();

                    messages.OrderBy(msg => msg.Timestamp.Offset);
                }
                foreach (IMessage message in messages)
                {
                    TimeSpan timeAgo = message.GetTimeAgo();
                    if (message.Author.IsBot && message.Content == "Report has been sent")
                    {
                        if (timeAgo > settings.cooldown.Value)
                        {
                            break;
                        }
                        else
                        {
                            await ReplyAsync($"You need to wait the full {settings.cooldown.Value.Humanize()}, {timeAgo.Humanize()} have passed from {message.GetJumpUrl()}");

                            return;
                        }
                    }
                }
            }

            await ReplyAsync("Please reply with what you want to report");

            var reportMsg = await Interactivity.NextMessageAsync(timeout : TimeSpan.FromMinutes(5));

            if (!reportMsg.IsSuccess)
            {
                await ReplyAsync("Report aborted");

                return;
            }

            var embed = new EmbedBuilder();
            embed.WithAuthor(Context.Message.Author);
            embed.WithTitle("Report");
            embed.WithDescription(reportMsg.Value.Content);
            embed.WithFooter("User ID: " + Context.Message.Author.Id);
            embed.WithCurrentTimestamp();
            string links = "";
            if (reportMsg.Value.Attachments?.Count is not null or 0)
            {
                links = reportMsg.Value.Attachments.Select(attachment => attachment.ProxyUrl).ListItems(" ");
            }
            var channel = guild.GetTextChannel(settings.channelID.Value);
            await channel.SendMessageAsync(embed : embed.Build());

            if (!string.IsNullOrEmpty(links))
            {
                await channel.SendMessageAsync("The message above had these attachments: " + links);
            }

            await ReplyAsync("Report has been sent");
        }
        catch (Exception e)
        {
            ReplyAsync("Error: " + e);
        }
    }
Beispiel #45
0
        private ReportParameter[] GetReportParameters(ParameterValue[] values)
        {
            string serverUrl;
            string modelsFolder;
            string company;
            string languageCulture;

            ReportParameter[] parameters = null;
            string errMsg = null;
            try
            {
                ReportUtility.GetSessionInfo(out serverUrl, out modelsFolder, out company, out languageCulture);
                if (string.IsNullOrEmpty(serverUrl))
                {
                    throw new InvalidOperationException(Resources.GetString(Report.NoServerUrl));
                }

                ReportSettings settings = new ReportSettings();
                settings.ReportManagerUrl = serverUrl;
                settings.RootFolder = modelsFolder;
                settings.ReportPath = this.ReportPath;

                string fullPath = settings.ResolveFullPath();

                // Ask reporting services for a list of all reports and all the parameters for the currently selected report.
                using (ReportingService2005 rs = new ReportingService2005())
                {
                    // Provoke potential exceptions by validating the full path
                    settings.ValidateFullPath(fullPath);

                    rs.Url = settings.ResolvedServiceUrl;
                    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    parameters = rs.GetReportParameters(fullPath, null, values != null, values, null);
                }
            }
            catch (System.Net.WebException)
            {
                errMsg = Resources.GetString(Report.cant_read_from_server);
            }
            catch (InvalidOperationException reportException)
            {
                errMsg = Microsoft.SharePoint.Utilities.SPHttpUtility.HtmlEncode(reportException.Message);
            }
            catch (ReportException reportException)
            {
                errMsg = AxRSReportWebPart.FormatMissingReportExceptionMessage(
                    reportException,
                    this.WebPartToEdit.CultureInfo,
                    this.WebPartToEdit.Title,
                    this.ReportPath);
            }
            catch (Exception exception)
            {
                errMsg = Microsoft.SharePoint.Utilities.SPHttpUtility.HtmlEncode(exception.Message);
            }

            if (!string.IsNullOrEmpty(errMsg))
            {
                this.AddErrorMessage(errMsg);
            }

            return parameters;
        }
Beispiel #46
0
        public void StandartPrinter()
        {
            ReportSettings settings = this.mockReportModel.ReportSettings;

            Assert.AreEqual(true, settings.UseStandardPrinter, "Standarprinter has should be 'true");
        }
Beispiel #47
0
        public void PushPullModel()
        {
            ReportSettings settings = this.mockReportModel.ReportSettings;

            Assert.AreEqual(GlobalEnums.PushPullModel.FormSheet, settings.DataModel, "Wrong PusPullModel");
        }
Beispiel #48
0
 public ExpressionRunner(Collection <ExportPage> pages, ReportSettings reportSettings, CollectionDataSource dataSource)
 {
     this.pages      = pages;
     this.dataSource = dataSource;
     Visitor         = new ExpressionVisitor(reportSettings);
 }
        /// <summary>
        /// Runs the report specified by ID.
        /// </summary>
        /// <param name="reportId">The report unique identifier.</param>
        /// <param name="settings">The settings for the report to be run.</param>
        /// <returns>ReportResult.</returns>
        /// <exception cref="System.ArgumentException">
        /// The report identifier resource is not a report.
        /// </exception>
        /// <exception cref="PlatformSecurityException">
        /// The user lacks read access to <paramref name="reportId"/>.
        /// </exception>
        public ReportResult RunReport(long reportId, ReportSettings settings)
        {
            ReportCompletionData completionData = PrepareReport(reportId, settings);

            return(completionData.PerformRun( ));
        }
 public void Setup()
 {
     reportSettings = new ReportSettings();
 }
        /// <summary>
        /// Runs the report.
        /// </summary>
        /// <param name="report">The report.</param>
        /// <param name="reportSettings">The settings.</param>
        /// <param name="suppressPreload">Pass true if the report has already been preloaded.</param>
        /// <returns>ReportResult.</returns>
        /// <exception cref="System.ArgumentException">@The report identifier resource is not a report.;reportId</exception>
        public ReportCompletionData PrepareReport(Model.Report report, ReportSettings reportSettings, bool suppressPreload = false)
        {
            if (report == null)
            {
                throw new ArgumentNullException("report");
            }
            if (reportSettings == null)
            {
                reportSettings = new ReportSettings( );
            }

            StructuredQuery structuredQuery;
            PreparedQuery   preparedReport;
            PreparedQuery   preparedRollup;

            using (EDC.ReadiNow.Diagnostics.Profiler.Measure("Prepare report run"))
                using (MessageContext messageContext = new MessageContext("Reports"))
                    using (new SecurityBypassContext( ))
                    {
                        // Get the structured query
                        structuredQuery = GetStructuredQuery(report, reportSettings, suppressPreload);

                        // Handle metadata-only request
                        if (reportSettings.RequireSchemaMetadata)
                        {
                            ReportResult reportResult = new ReportResult(report, structuredQuery, null, null, null, reportSettings);
                            return(new ReportCompletionData(reportResult));
                        }

                        // Prepare query settings
                        preparedReport = PrepareReportRun(structuredQuery, reportSettings);
                        preparedReport.QuerySettings.Hint = "Rpt-" + report.Id.ToString( );

                        // Handle rollups
                        preparedRollup = PrepareReportRollupRun(report, preparedReport.StructuredQuery, reportSettings, preparedReport.QuerySettings);
                    }

            Func <ReportResult> resultCallback = () =>
            {
                ReportResult reportResult = null;
                QueryResult  queryResult  = null;
                QueryResult  rollupResult = null;

                using (new SecurityBypassContext( ))
                {
                    // Execute the query
                    queryResult = QueryRunner.ExecuteQuery(preparedReport.StructuredQuery, preparedReport.QuerySettings);

                    // Execute the rollup query
                    if (preparedRollup.StructuredQuery != null)
                    {
                        rollupResult = QueryRunner.ExecuteQuery(preparedRollup.StructuredQuery, preparedRollup.QuerySettings);
                    }

                    // Package up the result.
                    reportResult = new ReportResult(report,
                                                    preparedReport.StructuredQuery, queryResult,
                                                    preparedRollup.ClientAggregate, rollupResult,
                                                    reportSettings);
                }

                return(reportResult);
            };

            // Create cache key (null indicates report is not cacheable)
            IQueryRunnerCacheKey reportCacheKey       = null;
            IQueryRunnerCacheKey rollupCacheKey       = null;
            ReportResultCacheKey reportResultCacheKey = null;

            reportCacheKey = QueryRunnerCacheKeyProvider.CreateCacheKey(preparedReport.StructuredQuery, preparedReport.QuerySettings);
            if (reportCacheKey != null)
            {
                if (preparedRollup.StructuredQuery != null)
                {
                    rollupCacheKey = QueryRunnerCacheKeyProvider.CreateCacheKey(preparedRollup.StructuredQuery, preparedRollup.QuerySettings);
                }
                reportResultCacheKey = new ReportResultCacheKey(reportSettings, reportCacheKey, rollupCacheKey);
            }

            // Create completion result
            ReportCompletionData completionData = new ReportCompletionData( );

            completionData.ResultCallback = resultCallback;
            completionData.ResultCacheKey = reportResultCacheKey;
            completionData.CacheContextDuringPreparation = CacheContext.GetContext( );

            return(completionData);
        }
Beispiel #52
0
 public ReportController(IOptions <ReportSettings> reportSettings, IReportService reportService)
 {
     _reportSettings = reportSettings.Value;
     _reportService  = reportService;
 }
        private PreparedQuery PrepareReportRollupRun(Model.Report report, StructuredQuery structuredQuery, ReportSettings reportSettings, QuerySettings nonRollupQuerySettings)
        {
            StructuredQuery rollupQuery     = null;
            ClientAggregate clientAggregate = null;
            StructuredQuery optimisedQuery;
            QuerySettings   rollupSettings;
            bool            adhocRollup;
            bool            reportRollup;

            adhocRollup  = reportSettings.ReportParameters != null && reportSettings.ReportParameters.GroupAggregateRules != null;
            reportRollup = !adhocRollup && report.ReportColumns.Any(rc => rc.ColumnRollup.Count > 0 || rc.ColumnGrouping.Count > 0);

            if (adhocRollup)
            {
                clientAggregate = ApplyAdhocAggregates(reportSettings.ReportParameters.GroupAggregateRules, structuredQuery);
            }
            else if (reportRollup)
            {
                clientAggregate = new ClientAggregate(report, structuredQuery);
                clientAggregate.IncludeRollup = true;
            }
            else if (report.RollupGrandTotals != null || report.RollupSubTotals != null || report.RollupOptionLabels != null)
            {
                return(new PreparedQuery
                {
                    ClientAggregate = new ClientAggregate( )
                });
            }
            else
            {
                return(new PreparedQuery( ));
            }

            // Clone the query, so that runs and rollups won't intefere with each others caches if they mutate the structure
            // In particular, calculated columns get evaluated during execution and mutate the query .. but only if the result doesn't come from cache, but this interferes with the rollup cache key.
            // Ideally, both calculations and optimisations would be provided in layers, and both applied, and cached, before either normal or rollup executions are run.
            rollupQuery = structuredQuery.DeepCopy( );

            // A poor proxy for determining that this is not a pivot chart.
            bool isGroupedReport = !(reportSettings.ReportParameters != null &&
                                     reportSettings.ReportParameters.GroupAggregateRules != null &&
                                     reportSettings.ReportParameters.GroupAggregateRules.IgnoreRows);

            if (isGroupedReport)
            {
                ReportRollupHelper.EnsureShowTotalsHasCount(rollupQuery, clientAggregate);
            }

            // Remove unused columns
            bool supportQuickSearch = !string.IsNullOrWhiteSpace(reportSettings.QuickSearch);

            optimisedQuery = ReportRollupHelper.RemoveUnusedColumns(rollupQuery, clientAggregate, supportQuickSearch);

            rollupSettings = new QuerySettings
            {
                SecureQuery             = nonRollupQuerySettings.SecureQuery,
                SupportClientAggregate  = true,
                SupportPaging           = false,
                QuickSearchTerm         = reportSettings.QuickSearch,
                SupportQuickSearch      = supportQuickSearch, // rollups query support quick search.
                ClientAggregate         = clientAggregate,
                AdditionalOrderColumns  = BuildAdditionOrderColumnDictionary(optimisedQuery, clientAggregate),
                FullAggregateClustering = true,
                Hint             = "RptRollup-" + report.Id,
                TargetResource   = nonRollupQuerySettings.TargetResource,
                IncludeResources = nonRollupQuerySettings.IncludeResources,
                ExcludeResources = nonRollupQuerySettings.ExcludeResources
            };
            // Note : do not apply quick search filter to rollups (for scalability reasons)


            PreparedQuery preparedQuery = new PreparedQuery
            {
                ClientAggregate = clientAggregate,
                StructuredQuery = optimisedQuery,
                QuerySettings   = rollupSettings
            };

            return(preparedQuery);
        }
Beispiel #54
0
		private IDataNavigator PrepareDateTimeGrouping ()
		{
			Console.WriteLine("PrepareDateTimeGrouping ()");
			
			GroupColumn gc = new GroupColumn("RandomDate",1,ListSortDirection.Ascending);
			ReportSettings rs = new ReportSettings();
			rs.GroupColumnsCollection.Add(gc);
			IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.table,rs);
			return dm.GetNavigator;
		}
Beispiel #55
0
        public void SupportsAutoCondense_with_null_allReportTypes_should_throw_exception()
        {
            var settings = new ReportSettings("Html", 123);

            settings.SupportsAutoCondense(null);
        }
Beispiel #56
0
		public void SortChildrenDescending()
		{
			ReportSettings rs = new ReportSettings();
			GroupColumn gc = new GroupColumn("GroupItem",1,ListSortDirection.Ascending);
			rs.GroupColumnsCollection.Add(gc);
			
			SortColumn sc = new SortColumn("Last",ListSortDirection.Descending);
			rs.SortColumnsCollection.Add(sc);
			IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.table,rs);
			var dataNavigator = dm.GetNavigator;
			
			string compare = String.Empty;
			
			while (dataNavigator.MoveNext())
			{
				DataRow dr = dataNavigator.Current as DataRow;
				var result = dr[3].ToString();
				Assert.That(compare,Is.LessThan(result));
				if (dataNavigator.HasChildren)
				{
					string compareChild = String.Empty;
					var childNavigator = dataNavigator.GetChildNavigator;
					do
					{
						DataRow childRow = childNavigator.Current as DataRow;
						var childResult = childRow[1].ToString();
						if (!String.IsNullOrEmpty(compareChild)) {
							Assert.LessOrEqual(childResult,compareChild);
						}
//						Console.WriteLine("\t{0}",childResult);
						compareChild = childResult;
					}
					while (childNavigator.MoveNext());
				}
				compare = result;
			}
		}
        /// <summary>
        /// Recursively writes formatted project category to a string buffer
        /// </summary>
        /// <param name="OutputWriter">Output string writer (buffer is appended to)</param>
        /// <param name="InReportSettings">Settings</param>
        /// <param name="InCategory">Category data to write</param>
        /// <param name="bIncludeCategoryHeader">Include the category header></param>
        /// <param name="InIndentLevel">Indent level</param>
        static void WriteCategoryChangesRecursively(StringWriter OutputWriter, ReportSettings InReportSettings, ProjectCategory InCategory, bool bIncludeCategoryHeader, int InIndentLevel)
        {
            // Indent items beneath the header!
            int NextIndentLevel = InIndentLevel;

            if (bIncludeCategoryHeader)
            {
                NextIndentLevel += 1;
            }

            if (InReportSettings.Format == P4ParsedChangelist.EExportFormats.EF_PlainText)
            {
                if (bIncludeCategoryHeader)
                {
                    // Category name header
                    for (int IndentIndex = 0; IndentIndex < InIndentLevel; ++IndentIndex)
                    {
                        OutputWriter.Write(InReportSettings.IndentText);
                    }
                    OutputWriter.Write(InReportSettings.BulletText);
                    OutputWriter.WriteLine(InCategory.Name);
                }
            }


            // Recurse!
            foreach (var CurSubcategory in InCategory.Subcategories)
            {
                bool bIncludeSubcategoryHeader = true;
                WriteCategoryChangesRecursively(OutputWriter, InReportSettings, CurSubcategory, bIncludeSubcategoryHeader, NextIndentLevel);
            }



            if (InReportSettings.Format == P4ParsedChangelist.EExportFormats.EF_PlainText)
            {
                // Change description
                foreach (var CurChange in InCategory.Changes)
                {
                    String OneLineSummary = CurChange.BriefDescription;


                    // Prefix the summary with the "type" of change, if we need to
                    if (InReportSettings.bPrefixChangesWithType && CurChange.Type != EChangeType.Unknown)
                    {
                        String ChangeTypeName = String.Empty;
                        switch (CurChange.Type)
                        {
                        case EChangeType.Fix:
                            ChangeTypeName = "Fix";
                            break;

                        case EChangeType.Change:
                            ChangeTypeName = "Change";
                            break;

                        case EChangeType.New:
                            ChangeTypeName = "New";
                            break;
                        }

                        OneLineSummary = ChangeTypeName + ": " + OneLineSummary;
                    }


                    // Append the TTP numbers too if we need to
                    if (InReportSettings.bAppendTTPNumbersToOneLineSummary && CurChange.TTPNumbers.Count > 0)
                    {
                        OneLineSummary += " (";
                        bool bIsFirstTTPNumber = true;
                        foreach (var CurTTPNumber in CurChange.TTPNumbers)
                        {
                            if (!bIsFirstTTPNumber)
                            {
                                OneLineSummary += ", ";
                            }
                            OneLineSummary   += "TTP " + CurTTPNumber.ToString();
                            bIsFirstTTPNumber = false;
                        }
                        OneLineSummary += ")";
                    }


                    // Append the P4 changelist numbers too if we need to
                    if (InReportSettings.bAppendChangelistNumbersToOneLineSummary)
                    {
                        OneLineSummary += " [CL " + CurChange.ChangelistNumber + "]";
                    }


                    // One-line summary
                    for (int IndentIndex = 0; IndentIndex < NextIndentLevel; ++IndentIndex)
                    {
                        OutputWriter.Write(InReportSettings.IndentText);
                    }
                    OutputWriter.Write(InReportSettings.BulletText);
                    OutputWriter.WriteLine(OneLineSummary);


                    // Extra description lines
                    {
                        foreach (string CurLine in CurChange.ExtraDescription)
                        {
                            // Indent
                            int ExtraTextIndentLevel = NextIndentLevel + 1;
                            for (int IndentIndex = 0; IndentIndex < ExtraTextIndentLevel; ++IndentIndex)
                            {
                                OutputWriter.Write(InReportSettings.IndentText);
                            }

                            OutputWriter.Write(InReportSettings.BulletText);
                            OutputWriter.WriteLine(CurLine);
                        }
                    }
                }
            }
        }
        // Генерация карты наладки
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            ReportSettings settings = AdditionalToolParameters.gostReportSettings;

            GenerateFileReport(settings.DefaultReportPath, settings.DefaultReportName);
        }
		private IDataNavigator PrepareStringGrouping ()
		{
			GroupColumn gc = new GroupColumn("GroupItem",1,ListSortDirection.Ascending);
			ReportSettings rs = new ReportSettings();
			rs.GroupColumnsCollection.Add(gc);
			IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.contributorCollection,rs);
			return dm.GetNavigator;
		}
Beispiel #60
0
		private void SetupViewer (ReportModel reportModel)
		{
			this.pages = new PagesCollection();
			this.reportSettings = reportModel.ReportSettings;
			this.AdjustDrawArea();
		}