diff --git a/WinFormDi.BLR/ReadingIn.cs b/WinFormDi.BLR/ReadingIn.cs index 9a8ada4..0c50dc7 100644 --- a/WinFormDi.BLR/ReadingIn.cs +++ b/WinFormDi.BLR/ReadingIn.cs @@ -46,7 +46,9 @@ public class ReadingIn : IReadingIn, IDisposable if (prt) { //Console.WriteLine(); + record.Id = row; _logger.LogInformation(record.ToString()); + record.Id = 0; records.Add(record); } prt = false; @@ -132,10 +134,10 @@ public class ReadingIn : IReadingIn, IDisposable var restab = readXLS(fullFileName); if (restab != null) { - restab.ToList().ForEach(x => - { - _logger.LogInformation(x.ToString()); - }); + //restab.ToList().ForEach(x => + //{ + // _logger.LogInformation(x.ToString()); + //}); try { diff --git a/WinFormDi/appsettings.json b/WinFormDi/appsettings.json index c51e44b..fcd71cc 100644 --- a/WinFormDi/appsettings.json +++ b/WinFormDi/appsettings.json @@ -11,7 +11,7 @@ }, "Debug": { "LogLevel": { - "Default": "Information", + "Default": "Warning", "Microsoft*": "Warning" } }, diff --git a/WinFormDi/frmSearchData.Designer.cs b/WinFormDi/frmSearchData.Designer.cs index d19b929..4801fa5 100644 --- a/WinFormDi/frmSearchData.Designer.cs +++ b/WinFormDi/frmSearchData.Designer.cs @@ -36,13 +36,16 @@ dtpTo = new DateTimePicker(); btnStartSearch = new Button(); flpPanel1 = new FlowLayoutPanel(); + label1 = new Label(); + txtSoekSumma = new TextBox(); SuspendLayout(); // // btnClose // - btnClose.Location = new Point(713, 415); + btnClose.Location = new Point(816, 577); + btnClose.Margin = new Padding(3, 4, 3, 4); btnClose.Name = "btnClose"; - btnClose.Size = new Size(75, 23); + btnClose.Size = new Size(86, 31); btnClose.TabIndex = 0; btnClose.Text = "Stäng"; btnClose.UseVisualStyleBackColor = true; @@ -52,51 +55,54 @@ // lblHeader.AutoSize = true; lblHeader.Font = new Font("Segoe UI", 13F, FontStyle.Bold, GraphicsUnit.Point); - lblHeader.Location = new Point(21, 17); + lblHeader.Location = new Point(24, 23); lblHeader.Name = "lblHeader"; - lblHeader.Size = new Size(223, 25); + lblHeader.Size = new Size(271, 30); lblHeader.TabIndex = 2; lblHeader.Text = "Sök data mellan 2 datum"; // // lblDateFrom // lblDateFrom.AutoSize = true; - lblDateFrom.Location = new Point(21, 65); + lblDateFrom.Location = new Point(24, 87); lblDateFrom.Name = "lblDateFrom"; - lblDateFrom.Size = new Size(68, 15); + lblDateFrom.Size = new Size(84, 20); lblDateFrom.TabIndex = 3; lblDateFrom.Text = "Från datum"; // // dtpFrom // dtpFrom.Format = DateTimePickerFormat.Short; - dtpFrom.Location = new Point(95, 59); + dtpFrom.Location = new Point(109, 79); + dtpFrom.Margin = new Padding(3, 4, 3, 4); dtpFrom.Name = "dtpFrom"; - dtpFrom.Size = new Size(112, 23); + dtpFrom.Size = new Size(127, 27); dtpFrom.TabIndex = 4; // // lblDateTo // lblDateTo.AutoSize = true; - lblDateTo.Location = new Point(233, 65); + lblDateTo.Location = new Point(266, 87); lblDateTo.Name = "lblDateTo"; - lblDateTo.Size = new Size(60, 15); + lblDateTo.Size = new Size(76, 20); lblDateTo.TabIndex = 5; lblDateTo.Text = "Till datum"; // // dtpTo // dtpTo.Format = DateTimePickerFormat.Short; - dtpTo.Location = new Point(310, 59); + dtpTo.Location = new Point(354, 79); + dtpTo.Margin = new Padding(3, 4, 3, 4); dtpTo.Name = "dtpTo"; - dtpTo.Size = new Size(100, 23); + dtpTo.Size = new Size(114, 27); dtpTo.TabIndex = 6; // // btnStartSearch // - btnStartSearch.Location = new Point(443, 61); + btnStartSearch.Location = new Point(506, 81); + btnStartSearch.Margin = new Padding(3, 4, 3, 4); btnStartSearch.Name = "btnStartSearch"; - btnStartSearch.Size = new Size(96, 23); + btnStartSearch.Size = new Size(110, 31); btnStartSearch.TabIndex = 7; btnStartSearch.Text = "Starta sökning"; btnStartSearch.UseVisualStyleBackColor = true; @@ -106,16 +112,38 @@ // flpPanel1.AutoScroll = true; flpPanel1.BackColor = Color.Silver; - flpPanel1.Location = new Point(21, 102); + flpPanel1.Location = new Point(24, 136); + flpPanel1.Margin = new Padding(3, 4, 3, 4); flpPanel1.Name = "flpPanel1"; - flpPanel1.Size = new Size(668, 314); + flpPanel1.Size = new Size(763, 419); flpPanel1.TabIndex = 8; // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(287, 582); + label1.Name = "label1"; + label1.Size = new Size(149, 20); + label1.TabIndex = 9; + label1.Text = "Totalt för sökt period"; + // + // txtSoekSumma + // + txtSoekSumma.BackColor = SystemColors.ButtonHighlight; + txtSoekSumma.Font = new Font("Segoe UI", 14F, FontStyle.Bold, GraphicsUnit.Point); + txtSoekSumma.Location = new Point(453, 570); + txtSoekSumma.Name = "txtSoekSumma"; + txtSoekSumma.ReadOnly = true; + txtSoekSumma.Size = new Size(210, 39); + txtSoekSumma.TabIndex = 10; + // // frmSearchData // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(914, 621); + Controls.Add(txtSoekSumma); + Controls.Add(label1); Controls.Add(flpPanel1); Controls.Add(btnStartSearch); Controls.Add(dtpTo); @@ -124,6 +152,7 @@ Controls.Add(lblDateFrom); Controls.Add(lblHeader); Controls.Add(btnClose); + Margin = new Padding(3, 4, 3, 4); Name = "frmSearchData"; StartPosition = FormStartPosition.CenterScreen; Text = "frmSearchData"; @@ -141,5 +170,7 @@ private DateTimePicker dtpTo; private Button btnStartSearch; private FlowLayoutPanel flpPanel1; + private Label label1; + private TextBox txtSoekSumma; } } \ No newline at end of file diff --git a/WinFormDi/frmSearchData.cs b/WinFormDi/frmSearchData.cs index 384de0b..57e3165 100644 --- a/WinFormDi/frmSearchData.cs +++ b/WinFormDi/frmSearchData.cs @@ -40,6 +40,7 @@ namespace WinFormDiApp private void btnStartSearch_Click(object sender, EventArgs e) { + double SearchedSum = 0; flpPanel1.Controls.Clear(); foundRecs = _accountRecordRepository.GetAllAccBetweenDates(dtpFrom.Value, dtpTo.Value); if (foundRecs.Any()) @@ -48,8 +49,10 @@ namespace WinFormDiApp foreach (var account in aggregates) { var ucCustV = createAndFillUCcv(account); + SearchedSum += Convert.ToDouble(ucCustV.Amount); flpPanel1.Controls.Add(ucCustV); } + txtSoekSumma.Text=SearchedSum.ToString(); } else { diff --git a/WinFormDiApp.BL/Models/AccountRecord.cs b/WinFormDiApp.BL/Models/AccountRecord.cs index 478a40c..5dea421 100644 --- a/WinFormDiApp.BL/Models/AccountRecord.cs +++ b/WinFormDiApp.BL/Models/AccountRecord.cs @@ -18,7 +18,7 @@ namespace WinFormDiApp.BL.Models public override string ToString() { //return base.ToString(); - return $"BetalDatum:{BetalDatum}, Mottagare:{Mottagare}, Konto:{Konto}, Belopp:{Belopp}, Avisering:{Avisering}"; + return $"\"Rad{Id}\": {{\"BetalDatum\": \"{BetalDatum}\", \"Mottagare\": \"{Mottagare}\", \"Konto\": \"{Konto}\", \"Belopp\": \"{Belopp}\", \"Avisering\": \"{Avisering}\"}},"; } } }