public void UpdateReportTypeCategory(ReportType reportType, ReportCategory category) { dbLock.Wait(); try { updateReportType.ExecuteNonQuery(new Dictionary <string, object>() { ["id"] = reportType.id, ["category"] = category.ToString(), }); reportType.category = category; } finally { dbLock.Release(); } TriggerCallbacks(); }
public static string GetMrtPath(ReportCategory category) { var path = ConfigurationManager.AppSettings.AllKeys.FirstOrDefault(x => x == category.ToString()); if (path == null) { throw new ArgumentOutOfRangeException(nameof(category), category, null); } return(HttpContext.Current.Server.MapPath("~/" + ConfigurationManager.AppSettings[path])); }
void DrawCategoryHeader(ReportCategory category) { GUILayout.Space(16f); EditorGUILayout.LabelField(PascalSplit(category.ToString()), headerStyle, GUILayout.Height(24f)); GUILayout.Space(6f); }
public void GetReportMetadata_GivenSpecificationIdWithBlobs_ReturnsReportMetadata(JobType jobType, ReportCategory expectedReportCategory, string targetFundingPeriodId) { string fundingLineBlobName = NewRandomString(); string fundingLineFileExtension = "csv"; string fundingLineFileName = "Funding Lines"; string calcResultsBlobName = NewRandomString(); string calcResultsFileExtension = "xlsx"; string fundingLineCode = NewRandomString(); string fundingPeriodId = targetFundingPeriodId ?? NewRandomString(); string fundingStreamId = NewRandomString(); string specificationId = NewRandomString(); IDictionary <string, string> fundingLineFileMetadata = new Dictionary <string, string> { { "job_type", jobType.ToString() }, { "file_name", fundingLineFileName }, { "funding_line_code", fundingLineCode }, { "funding_period_id", fundingPeriodId }, { "funding_stream_id", fundingStreamId }, { "specification_id", specificationId } }; SpecificationReportIdentifier id = new SpecificationReportIdentifier { JobType = jobType, FundingLineCode = fundingLineCode, FundingPeriodId = fundingPeriodId, FundingStreamId = fundingStreamId, SpecificationId = specificationId }; BlobProperties blobProperties = new BlobProperties(); ICloudBlob fundingLineCloudBlob = Substitute.For <ICloudBlob>(); fundingLineCloudBlob .Uri .Returns(BuildUri(fundingLineBlobName, fundingLineFileExtension)); fundingLineCloudBlob .Metadata .Returns(fundingLineFileMetadata); fundingLineCloudBlob .Properties .Returns(blobProperties); IEnumerable <IListBlobItem> fundingLineListBlobItems = new List <IListBlobItem> { fundingLineCloudBlob }; ICloudBlob calcResultsCloudBlob = Substitute.For <ICloudBlob>(); calcResultsCloudBlob .Uri .Returns(BuildUri(calcResultsBlobName, calcResultsFileExtension)); calcResultsCloudBlob .Properties .Returns(blobProperties); IEnumerable <IListBlobItem> calcResultsListBlobItems = new List <IListBlobItem> { calcResultsCloudBlob }; _blobClient .ListBlobs( $"funding-lines-{specificationId}", PublishedProviderVersionsContainerName, true, BlobListingDetails.Metadata) .Returns(fundingLineListBlobItems); _blobClient .ListBlobs( $"calculation-results-{specificationId}", "calcresults", true, BlobListingDetails.Metadata) .Returns(calcResultsListBlobItems); IActionResult result = _service.GetReportMetadata(specificationId, targetFundingPeriodId); result .Should() .BeOfType <OkObjectResult>(); IEnumerable <SpecificationReport> reportMetadata = ((OkObjectResult)result).Value as IEnumerable <SpecificationReport>; reportMetadata .Should() .NotBeNull(); reportMetadata .Count() .Should() .Be(2); SpecificationReport metadata = reportMetadata .ElementAt(0); metadata .Should() .BeEquivalentTo(new SpecificationReport { Name = fundingLineFileName, Category = expectedReportCategory.ToString(), Format = "CSV", Size = "-1 B", SpecificationReportIdentifier = EncodeSpecificationReportIdentifier(id) }); }