public AggregateReport(double?version, ReportMetadata reportMetadata, PolicyPublished policyPublished, Record[] records) { Version = version; ReportMetadata = reportMetadata; PolicyPublished = policyPublished; Records = records; }
public void MutlipleExtraContactInfosTakeFirst() { XElement xElement = XElement.Parse(ReportMetadataParserTestsResources.MultipleExtraContactInfo); ReportMetadata reportMetadata = _reportMetadataDeserialiser.Deserialise(xElement); Assert.That(reportMetadata.ExtraContactInfo, Is.EqualTo(TestConstants.ExpectedExtraContactInfo)); }
public AggregateReportInfo Deserialise(AttachmentInfo attachment, EmailMetadata emailMetadata) { using (Stream stream = attachment.GetStream()) { using (StreamReader streamReader = new StreamReader(stream)) { using (XmlReader reader = XmlReader.Create(streamReader)) { XDocument document = XDocument.Load(reader); XElement feedback = document.Root; if (document.Root.Name != "feedback") { throw new ArgumentException("Root of aggregate report must be feedback."); } ReportMetadata reportMetadata = _reportMetadataDeserialiser.Deserialise(feedback.Single("report_metadata")); PolicyPublished policyPublished = _policyPublishedDeserialiser.Deserialise(feedback.Single("policy_published")); IEnumerable <XElement> recordElements = feedback.Where("record").ToList(); if (!recordElements.Any()) { throw new ArgumentException("Aggregate report must contain at least 1 record."); } Record[] records = _recordDeserialiser.Deserialise(recordElements); Domain.Dmarc.AggregateReport aggregateReport = new Domain.Dmarc.AggregateReport(reportMetadata, policyPublished, records); return(new AggregateReportInfo(aggregateReport, emailMetadata, attachment.AttachmentMetadata)); } } } }
public void ExtraContactInfoIsOptional() { XElement xElement = XElement.Parse(ReportMetadataParserTestsResources.NoExtraContactInfo); ReportMetadata reportMetadata = _reportMetadataDeserialiser.Deserialise(xElement); Assert.That(reportMetadata.ExtraContactInfo, Is.Null); }
private void dgvAvailableMetadata_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { // This is the double-click on the available list // // Get selected row if (dgvAvailableMetadata.SelectedRows.Count <= 0) { return; } var selectedRow = dgvAvailableMetadata.SelectedRows; ReportMetadata rm = new ReportMetadata(); ConvertSelectedRow(rm, selectedRow[0]); // Insert into db with client id rm.ClientUID = Utils.ClientID; rm.UID = 0; rm.RecordType = "CL"; rm.Save(); // Reload lists // loadList(); }
public void ErrorsIsOptional() { XElement xElement = XElement.Parse(ReportMetadataParserTestsResources.NoError); ReportMetadata reportMetadata = _reportMetadataDeserialiser.Deserialise(xElement); Assert.That(reportMetadata.Error.Length, Is.EqualTo(0)); }
private void btnNew_Click(object sender, EventArgs e) { ClearFields(); // Generate new Unique ID txtUID.Text = (ReportMetadata.GetLastUID() + 1).ToString(); }
private void btnDelete_Click(object sender, EventArgs e) { var conf = MessageBox.Show("Are you sure?", "Delete Item", MessageBoxButtons.YesNo); if (conf != DialogResult.Yes) { return; } ReportMetadata rmd = new ReportMetadata(); rmd.UID = Convert.ToInt32(txtUID.Text); bool ret = rmd.Delete(); if (ret) { MessageBox.Show("Item Deleted Successfully."); } else { MessageBox.Show("Deletion was unsuccessful."); } if (uiReportMetadata != null) { uiReportMetadata.loadMetadataList(rmd.UID); } this.Visible = false; }
public async Task <CommandResult> CreateReport([FromBody] BlockTransactionsReportsRequest input) { if (!ModelState.IsValid) { return(CommandResultBuilder.Fail(ModelState.GetErrorsList().ToArray())); } if (!input.Blocks.Any()) { return(CommandResultBuilder.Fail("0 block count")); } if (input.Blocks.Length > _bcnReportsSettings.MaxBlockCountPerCommand) { return(CommandResultBuilder.Fail($"Maximum block count per request exceeded: {_bcnReportsSettings.MaxBlockCountPerCommand}")); } var blockExistence = (await input.Blocks.SelectAsync(IsBlock)).ToList(); if (blockExistence.Any(p => !p.exists)) { var notFoundBlocks = blockExistence.Where(p => !p.exists).Select(p => p.block); return(CommandResultBuilder.Fail($"Blocks {string.Join(", ", notFoundBlocks)} not found")); } await _commandProducer.CreateCommand(input.Blocks, input.Email); foreach (var block in input.Blocks) { await _reportMetadataRepository.InsertOrReplace(ReportMetadata.Create(block, queuedAt: DateTime.UtcNow)); } return(CommandResultBuilder.Ok()); }
// // GET: /ReportMetadata/ public ActionResult Index() { var cvl = new ReportMetadata(); cvl.ListDefault(); return(View(cvl)); }
private static TestCaseData GetTestCaseData( string cultureCode, string yamlPath, ReportMetadata <TestTerms> resolvedMetadata) { return(new TestCaseData(cultureCode, yamlPath, resolvedMetadata)); //TODO: add .SetName($"Metadata in culture \"{cultureCode}\" resolves."); once NUnit fixes https://github.com/nunit/nunit3-vs-adapter/issues/607 }
public void MultipleErrorsAllowed() { XElement xElement = XElement.Parse(ReportMetadataParserTestsResources.MultipleError); ReportMetadata reportMetadata = _reportMetadataDeserialiser.Deserialise(xElement); Assert.That(reportMetadata.Error[0], Is.EqualTo(TestConstants.ExpectedError)); Assert.That(reportMetadata.Error[1], Is.EqualTo(TestConstants.ExpectedError2)); }
protected void chkSelected_CheckedChanged(object sender, EventArgs e) { ReportMetadata selectedReport = this.ReportRegistry.Where(r => r.ReportKey == ddlReport.SelectedValue).First(); HiddenField hf = ((TableCell)((CheckBox)sender).Parent).FindControl("hfFieldName") as HiddenField; selectedReport.ExportableFields.Where( f => f.OriginalName == hf.Value).First().Export = ((CheckBox)sender).Checked; }
public ReportDto(ReportMetadata model) { this.Id = model.Id; this.Type = model.Type; this.SchoolYear = model.SchoolYear; this.Scope = model.Scope; this.Name = model.Name; this.Approved = model.Approved; this.Created = model.Created; }
public void NewEntry(int clientID) { ClearFields(); // Generate new Unique ID txtUID.Text = (ReportMetadata.GetLastUID() + 1).ToString(); txtClientUID.Text = clientID.ToString(); txtRecordType.Text = "DF"; }
private static void SetupReportMetadataServiceInternal <T>(string reportCodename, Mock <IReportMetadataService> mockReportMetadataService) where T : new() { var fakeMetadata = new ReportMetadata <T>() { Terms = new T() }; UpdatePropertiesOfObject(fakeMetadata.Terms); mockReportMetadataService.Setup(p => p.GetReportMetadata <T>(reportCodename)).Returns(fakeMetadata); }
protected void ddlReport_SelectedIndexChanged(object sender, EventArgs e) { try { ReportMetadata selectedReport = this.ReportRegistry.Where(r => r.ReportKey == ((DropDownList)sender).SelectedValue).First(); this.ShowReportMetadata(selectedReport); } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return; } }
private void OLDLogoDoubleClick(object sender, EventArgs e) { // Show file dialog var file = openFileDialog1.ShowDialog(); if (file == DialogResult.OK) { // Only File Name string fileName = openFileDialog1.SafeFileName; // Full Path including file name string fullPathFileName = openFileDialog1.FileName; // Extract File Path string pathOnly = fullPathFileName.Replace(fileName, ""); // Get Company Logo // ReportMetadata rmd = new ReportMetadata(); rmd.ClientUID = Utils.ClientID; rmd.RecordType = FCMConstant.MetadataRecordType.CLIENT; rmd.FieldCode = "COMPANYLOGO"; rmd.Read(clientUID: Utils.ClientID, fieldCode: "COMPANYLOGO"); rmd.InformationType = MackkadoITFramework.Helper.Utils.InformationType.IMAGE; rmd.ClientType = ""; rmd.CompareWith = ""; rmd.Description = "Company"; // rmd.Condition = fullPathFileName; var logoFolder = CodeValue.GetCodeValueExtended(FCMConstant.CodeTypeString.SYSTSET, FCMConstant.SYSFOLDER.LOGOFOLDER); // rmd.Condition = logoFolder + fileName; // The intention is to save the reference path %XXX% // rmd.Condition = FCMConstant.SYSFOLDER.LOGOFOLDER + fileName; txtLogo1Location.Text = rmd.Condition; rmd.Save(); Bitmap MyImage; pbxLogo.SizeMode = PictureBoxSizeMode.StretchImage; if (rmd.Condition != null) { // MyImage = new Bitmap(rmd.Condition); string logoLocation = logoFolder + fileName; MyImage = new Bitmap(logoLocation); pbxLogo.Image = (Image)MyImage; } } }
public void CorrectlyFormReportMetadataGeneratesReportMetadata() { XElement xElement = XElement.Parse(ReportMetadataParserTestsResources.StandardReportMetadata); ReportMetadata reportMetadata = _reportMetadataDeserialiser.Deserialise(xElement); Assert.That(reportMetadata.OrgName, Is.EqualTo(TestConstants.ExpectedOrgName)); Assert.That(reportMetadata.Email, Is.EqualTo(TestConstants.ExpectedEmail)); Assert.That(reportMetadata.ExtraContactInfo, Is.EqualTo(TestConstants.ExpectedExtraContactInfo)); Assert.That(reportMetadata.ReportId, Is.EqualTo(TestConstants.ExpectedReportId)); Assert.That(reportMetadata.Range.Begin, Is.EqualTo(TestConstants.ExpectedRangeBegin)); Assert.That(reportMetadata.Range.End, Is.EqualTo(TestConstants.ExpectedRangeEnd)); Assert.That(reportMetadata.Error[0], Is.EqualTo(TestConstants.ExpectedError)); }
public void SetValues(ReportMetadata input) { txtUID.Text = input.UID.ToString(); txtRecordType.Text = input.RecordType; txtFieldCode.Text = input.FieldCode; txtClientUID.Text = input.ClientUID.ToString(); txtDescription.Text = input.Description; txtInformationType.Text = input.InformationType; txtTableName.Text = input.TableName; txtFieldName.Text = input.FieldName; txtFilePath.Text = input.FilePath; txtFileName.Text = input.FileName; }
public void SetValues(ReportMetadata input) { txtUID.Text = input.UID.ToString(); txtRecordType.Text = input.RecordType; txtFieldCode.Text = input.FieldCode; txtClientUID.Text = input.ClientUID.ToString(); txtDescription.Text = input.Description; cbxType.Text = input.InformationType; txtCondition.Text = input.Condition; txtCompareWith.Text = input.CompareWith; checkEnabled.Checked = input.Enabled == 'Y' ? true : false; checkUseLabel.Checked = input.UseAsLabel == 'Y' ? true : false; }
public ReportMetadata <T> GetReportMetadata <T>(string reportCodename) where T : new() { var metadataDirectory = $"{DirectoryHelper.GetExecutingDirectory()}\\{reportCodename}\\Metadata\\"; var currentMetadata = DeserializeMetadataFromYamlFile <ReportMetadata <T> >( metadataDirectory, CurrentCultureName, false ); var currentCultureIsDefaultCulture = CurrentCultureName == DefaultCultureName; var mergedMetadata = new ReportMetadata <T>(); if (!currentCultureIsDefaultCulture) { var defaultMetadata = DeserializeMetadataFromYamlFile <ReportMetadata <T> >( metadataDirectory, DefaultCultureName, true ); mergedMetadata = GetMergedMetadata(defaultMetadata, currentMetadata); } var reportMetadata = currentCultureIsDefaultCulture ? currentMetadata : mergedMetadata; var instanceDetails = instanceService.GetInstanceDetails(instanceService.CurrentInstance); var commonData = new { instanceUrl = instanceService.CurrentInstance.Url, administrationVersion = instanceDetails.AdministrationVersion, databaseVersion = instanceDetails.DatabaseVersion }; Term name = reportMetadata.Details.Name; reportMetadata.Details.Name = name.With(commonData); Term shortDescription = reportMetadata.Details.ShortDescription; reportMetadata.Details.ShortDescription = shortDescription.With(commonData); Term longDescription = reportMetadata.Details.LongDescription; reportMetadata.Details.LongDescription = longDescription.With(commonData); return(reportMetadata); }
private void ConvertSelectedRow(ReportMetadata rm, DataGridViewRow selectedRow) { rm.UID = Convert.ToInt32(selectedRow.Cells["UID"].Value.ToString()); rm.RecordType = selectedRow.Cells["RecordType"].Value.ToString(); rm.FieldCode = selectedRow.Cells["FieldCode"].Value.ToString(); rm.Description = selectedRow.Cells["Description"].Value.ToString(); rm.ClientType = selectedRow.Cells["ClientType"].Value.ToString(); rm.ClientUID = Convert.ToInt32(selectedRow.Cells["ClientUID"].Value.ToString()); rm.InformationType = selectedRow.Cells["InformationType"].Value.ToString(); rm.Condition = selectedRow.Cells["Condition"].Value.ToString(); rm.CompareWith = selectedRow.Cells["CompareWith"].Value.ToString(); return; }
private void ShowReportMetadata(ReportMetadata report) { this.GrdFields.DataSource = report.ExportableFields; this.GrdFields.DataBind(); if (report.ExportableFields != null && report.ExportableFields.Length > 0) { this.pnlFieldsSelection.Visible = true; } else { this.pnlFieldsSelection.Visible = false; } }
/// <summary> /// Read logo display flag /// </summary> private static void ReadLogoStatus(Client.Client eventClient) { // Update Logo Display Status // ReportMetadata rmd = new ReportMetadata(); rmd.ClientUID = Utils.ClientID; rmd.RecordType = Utils.MetadataRecordType.CLIENT; rmd.FieldCode = Utils.FieldCode.COMPANYLOGO; if (rmd.Read(clientUID: Utils.ClientID, fieldCode: Utils.FieldCode.COMPANYLOGO)) { eventClient.DisplayLogo = rmd.Enabled; } }
// ----------------------------------------------------- // List clients // ----------------------------------------------------- internal static List <Client> List(HeaderInfo headerInfo) { var clientList = new List <Client>(); using (var connection = new SqlConnection(ConnString.ConnectionString)) { var commandString = string.Format( " SELECT " + ClientFieldString() + " FROM [Client] " + " WHERE IsVoid = 'N' " + " ORDER BY UID ASC " ); using (var command = new SqlCommand( commandString, connection)) { connection.Open(); try { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { var client = new Client(); Client.LoadClientObject(reader, client); // Retrieve status of the logo. Enabled or disabled // var rmd = new ReportMetadata(); rmd.Read(client.UID, ReportMetadata.MetadataFieldCode.COMPANYLOGO); client.DisplayLogo = rmd.Enabled; clientList.Add(client); } } } catch (Exception ex) { string error = ex.ToString(); LogFile.WriteToTodaysLogFile(ex.ToString(), headerInfo.UserID, "", "Client.cs"); } } } return(clientList); }
protected void chkSelected_CheckedChanged(object sender, EventArgs e) { try { ReportMetadata selectedReport = this.ReportRegistry.Where(r => r.ReportKey == DdlReportGenerator.SelectedValue).First(); HiddenField hf = ((TableCell)((CheckBox)sender).Parent).FindControl("hfFieldName") as HiddenField; selectedReport.ExportableFields.Where( f => f.OriginalName == hf.Value).First().Export = ((CheckBox)sender).Checked; } catch (System.Exception ex) { UIManager.AdministrationManager.DiagnosticError(ex); return; } }
public async Task <CommandResult> CreateRangeReport([FromQuery] int minBlock, [FromQuery] int maxBlock, [FromQuery] int batch = 1) { var list = Enumerable.Range(minBlock, maxBlock - minBlock + 1); foreach (var enumerable in list.Batch(batch)) { await _commandProducer.CreateCommand(enumerable.Select(p => p.ToString()), null); foreach (var block in enumerable) { await _reportMetadataRepository.InsertOrReplace(ReportMetadata.Create(block.ToString(), queuedAt: DateTime.UtcNow)); } } return(CommandResultBuilder.Ok()); }
// // this method shows the component to edit/ add // a new metadata record. // private void EditMetadata(bool RefreshOnly) { if (!RefreshOnly) { // Toggle edit component // if (ucReportMetadata1.Visible == true) { ucReportMetadata1.Visible = false; refreshList(); return; } ucReportMetadata1.Visible = true; } // if there are no records selected // if (dgvClientMetadata.SelectedRows.Count <= 0) { ucReportMetadata1.NewEntry(Utils.ClientID); return; } var selectedRow = dgvClientMetadata.SelectedRows; ReportMetadata rm = new ReportMetadata(); rm.UID = Convert.ToInt32(selectedRow[0].Cells["UID"].Value); rm.RecordType = selectedRow[0].Cells["RecordType"].Value.ToString(); rm.FieldCode = selectedRow[0].Cells["FieldCode"].Value.ToString(); rm.ClientType = selectedRow[0].Cells["ClientType"].Value.ToString(); rm.Description = selectedRow[0].Cells["Description"].Value.ToString(); rm.ClientUID = Convert.ToInt32(selectedRow[0].Cells["ClientUID"].Value); rm.InformationType = selectedRow[0].Cells["InformationType"].Value.ToString(); rm.Condition = selectedRow[0].Cells["Condition"].Value.ToString(); rm.CompareWith = selectedRow[0].Cells["CompareWith"].Value.ToString(); rm.Enabled = Convert.ToChar(selectedRow[0].Cells["Enabled"].Value); rm.UseAsLabel = Convert.ToChar(selectedRow[0].Cells["UseAsLabel"].Value); ucReportMetadata1.SetValues(rm); }
private void btnSave_Click(object sender, EventArgs e) { ReportMetadata rmd = new ReportMetadata(); rmd.UID = Convert.ToInt32(txtUID.Text); rmd.RecordType = txtRecordType.Text; if (string.IsNullOrEmpty(txtClientUID.Text)) { rmd.ClientUID = 0; } else { rmd.ClientUID = Convert.ToInt32(txtClientUID.Text); } rmd.ClientType = txtClientType.Text; rmd.Description = txtDescription.Text; rmd.InformationType = cbxType.Text; rmd.FieldCode = txtFieldCode.Text; rmd.Condition = txtCondition.Text; rmd.Condition = txtCondition.Text; rmd.CompareWith = txtCompareWith.Text; rmd.Enabled = checkEnabled.Checked ? 'Y' : 'N'; rmd.UseAsLabel = checkUseLabel.Checked ? 'Y' : 'N'; rmd.Save(); MessageBox.Show("Code Type Save Successfully."); if (uiReportMetadata != null) { uiReportMetadata.Show(); } this.Visible = false; if (_callingFrom != null && _callingFrom.GetType().Name == "UIReportMetadata") { UIReportMetadata uirmd = (UIReportMetadata)_callingFrom; uirmd.refreshList(); } }