public void CombineDictionariesTest() { // Create a new TerminatedLeasesReportDictionary and fill it with data from the SampleTerminatedLeasesReport. var excelDictionaryTerminatedLeases = new TerminatedLeaseReportDictionary().InitializeDictionary(new FileInfo("SampleTerminatedLeasesReport.xlsx"), 8); // Create a new TerminatedLeasesReportDictionary and fill it with data from the SampleNewLeasesReport. var excelDictionaryNewLeases = new NewLeaseReportDictionary().InitializeDictionary(new FileInfo("SampleNewLeasesReport.xlsx"), 8); // Create a new FinalReportDictionary from the previous two. var excelDictionaryFinalReport = new FinalReportDictionary().CombineDictionaries(excelDictionaryTerminatedLeases, excelDictionaryNewLeases); // Print to the console. foreach (var entry in excelDictionaryFinalReport) { Console.WriteLine(string.Format("BuildingAbbriviation: {0} | OldRentAmount: {1} | NewRentAmount: {2} | ChangeInRent: {3}", entry.Value.BuildingAbbreviation, entry.Value.OldRentAmount, entry.Value.NewRentAmount, entry.Value.DifferenceAmount)); } }
/// <summary> /// This method activates when the user presses the go button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void goButton_Click(object sender, EventArgs e) { terminatedLeasesPanel.BackColor = Color.LightGray; newLeasesPanel.BackColor = Color.LightGray; goButton.Enabled = false; goButton.Visible = false; // Create a dictionary object which relates to the first report. var terminatedLeaseExcelDictionary = new TerminatedLeaseReportDictionary().InitializeDictionary(new FileInfo(terminatedLeasesLabel.Text), 8); // Create a dictionary object which relates to the second report. var newLeaseExcelDictionary = new NewLeaseReportDictionary().InitializeDictionary(new FileInfo(newLeasesLabel.Text), 8); // Combine both of the reports. var finalReportDictionary = new FinalReportDictionary().CombineDictionaries(terminatedLeaseExcelDictionary, newLeaseExcelDictionary); new CreateFile().createFinalReportFile(finalReportDictionary); MessageBox.Show("You will find the report on your desktop"); }