Compare commits
10 Commits
2b6e48c3ef
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d0373369b | |||
| 148f6aaabf | |||
| 6510913daa | |||
| a16137072b | |||
| a215b54d0d | |||
| 05dfd1f35b | |||
| ef14ce2aaa | |||
| 0c0533f9d5 | |||
| d7774c70ee | |||
| de6e196809 |
@ -5,8 +5,12 @@ namespace WinFormDiApp.BLI
|
|||||||
public interface IAccountRecordRepository
|
public interface IAccountRecordRepository
|
||||||
{
|
{
|
||||||
bool AddAccountRecord(AccountRecord record);
|
bool AddAccountRecord(AccountRecord record);
|
||||||
|
AccountRecord SaveAcountRecord(AccountRecord record);
|
||||||
bool DeleteAccountRecord(AccountRecord record);
|
bool DeleteAccountRecord(AccountRecord record);
|
||||||
|
bool DeleteAllAccountRecords();
|
||||||
IEnumerable<AccountRecord> GetAllAccBetweenDates(DateTime dateFrom, DateTime dateTo);
|
IEnumerable<AccountRecord> GetAllAccBetweenDates(DateTime dateFrom, DateTime dateTo);
|
||||||
IEnumerable<AccountRecord> GetAllAccounts();
|
IEnumerable<AccountRecord> GetAllAccounts();
|
||||||
|
AccountRecord GetAccount(int id);
|
||||||
|
AccountRecord GetAccountByDateBelKonto(DateTime _date, double _belopp, string _konto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,5 +6,6 @@ namespace WinFormDiApp.BLI
|
|||||||
{
|
{
|
||||||
bool ReadAndSaveInvoices(string fullFileName);
|
bool ReadAndSaveInvoices(string fullFileName);
|
||||||
IEnumerable<AccountRecord> readXLS(string FilePath);
|
IEnumerable<AccountRecord> readXLS(string FilePath);
|
||||||
|
void Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,6 +35,43 @@ public class AccountRecordRepository : IAccountRecordRepository
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AccountRecord SaveAcountRecord(AccountRecord record)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var entity = (from account in _dataContext.AccountRecords
|
||||||
|
where account.Id == record.Id
|
||||||
|
select account).FirstOrDefault();
|
||||||
|
if (entity == null)
|
||||||
|
{
|
||||||
|
entity = new AccountRecord();
|
||||||
|
_dataContext.AccountRecords.Add(entity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entity.Stored= record.Stored;
|
||||||
|
}
|
||||||
|
|
||||||
|
entity.Avisering = record.Avisering;
|
||||||
|
entity.BetalDatum = record.BetalDatum;
|
||||||
|
entity.Belopp = record.Belopp;
|
||||||
|
entity.Konto = record.Konto;
|
||||||
|
entity.Mottagare = record.Mottagare;
|
||||||
|
|
||||||
|
_dataContext.SaveChanges();
|
||||||
|
|
||||||
|
record.Id = entity.Id;
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.LogError("Error occured in SaveAccountRecord :-->{iMessage}", e.Message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteAccountRecord(AccountRecord record)
|
public bool DeleteAccountRecord(AccountRecord record)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -50,12 +87,25 @@ public class AccountRecordRepository : IAccountRecordRepository
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteAllAccountRecords()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var all = from c in _dataContext.AccountRecords select c;
|
||||||
|
_dataContext.AccountRecords.RemoveRange(all);
|
||||||
|
_dataContext.SaveChanges();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.LogError("Error occured in DeleteAllAccountRecord :-->{iMessage}", e.Message);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public IEnumerable<AccountRecord> GetAllAccBetweenDates(DateTime dateFrom, DateTime dateTo)
|
public IEnumerable<AccountRecord> GetAllAccBetweenDates(DateTime dateFrom, DateTime dateTo)
|
||||||
{
|
{
|
||||||
IEnumerable<AccountRecord> result = null;
|
IEnumerable<AccountRecord> result = null;
|
||||||
using (ApplicationDbContext dc = _dataContext)
|
result = (from acc in _dataContext.AccountRecords
|
||||||
{
|
|
||||||
result = (from acc in dc.AccountRecords
|
|
||||||
where acc.BetalDatum > dateFrom && acc.BetalDatum < dateTo
|
where acc.BetalDatum > dateFrom && acc.BetalDatum < dateTo
|
||||||
orderby acc.Mottagare, acc.BetalDatum descending
|
orderby acc.Mottagare, acc.BetalDatum descending
|
||||||
select new AccountRecord
|
select new AccountRecord
|
||||||
@ -68,7 +118,6 @@ public class AccountRecordRepository : IAccountRecordRepository
|
|||||||
Konto = acc.Konto,
|
Konto = acc.Konto,
|
||||||
Stored = acc.Stored
|
Stored = acc.Stored
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,4 +126,16 @@ public class AccountRecordRepository : IAccountRecordRepository
|
|||||||
return _dataContext.AccountRecords;
|
return _dataContext.AccountRecords;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AccountRecord GetAccount(int id)
|
||||||
|
{
|
||||||
|
var accountRec = _dataContext.AccountRecords.FirstOrDefault(a => a.Id == id);
|
||||||
|
return accountRec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccountRecord GetAccountByDateBelKonto(DateTime _date,double _belopp,string _konto)
|
||||||
|
{
|
||||||
|
var accountRec = _dataContext.AccountRecords.FirstOrDefault(a => a.BetalDatum == _date && a.Belopp==_belopp && a.Konto==_konto);
|
||||||
|
return accountRec;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
namespace WinFormDiApp.BLR;
|
namespace WinFormDiApp.BLR;
|
||||||
|
|
||||||
public class ReadingIn : IReadingIn
|
public class ReadingIn : IReadingIn, IDisposable
|
||||||
{
|
{
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly ILogger<ReadingIn> _logger;
|
private readonly ILogger<ReadingIn> _logger;
|
||||||
@ -46,9 +46,10 @@ public class ReadingIn : IReadingIn
|
|||||||
if (prt)
|
if (prt)
|
||||||
{
|
{
|
||||||
//Console.WriteLine();
|
//Console.WriteLine();
|
||||||
//// _logger.LogInformation("");
|
record.Id = row;
|
||||||
|
_logger.LogInformation(record.ToString());
|
||||||
|
record.Id = 0;
|
||||||
records.Add(record);
|
records.Add(record);
|
||||||
fieldNr = 0;
|
|
||||||
}
|
}
|
||||||
prt = false;
|
prt = false;
|
||||||
for (int col = 0; col <= colCount; col++)
|
for (int col = 0; col <= colCount; col++)
|
||||||
@ -65,6 +66,14 @@ public class ReadingIn : IReadingIn
|
|||||||
{
|
{
|
||||||
prt = true;
|
prt = true;
|
||||||
record = new AccountRecord();
|
record = new AccountRecord();
|
||||||
|
fieldNr = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (col == 0)
|
||||||
|
{
|
||||||
|
col = colCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Console.WriteLine(" Row:" + row + " column:" + col + " Value:" + worksheet.Cells[row, col].Value.ToString().Trim());
|
//Console.WriteLine(" Row:" + row + " column:" + col + " Value:" + worksheet.Cells[row, col].Value.ToString().Trim());
|
||||||
if (prt)
|
if (prt)
|
||||||
@ -90,6 +99,14 @@ public class ReadingIn : IReadingIn
|
|||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
record.Konto = _excellent.ReadCell(row, col).ToString().Trim();
|
record.Konto = _excellent.ReadCell(row, col).ToString().Trim();
|
||||||
|
if (record.Konto.ToLower().StartsWith("bg")
|
||||||
|
|| record.Konto.ToLower().StartsWith("pg")
|
||||||
|
|| record.Konto.ToLower().StartsWith("hs")){}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prt = false;
|
||||||
|
col = colCount;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
@ -117,12 +134,19 @@ public class ReadingIn : IReadingIn
|
|||||||
var restab = readXLS(fullFileName);
|
var restab = readXLS(fullFileName);
|
||||||
if (restab != null)
|
if (restab != null)
|
||||||
{
|
{
|
||||||
|
//restab.ToList().ForEach(x =>
|
||||||
|
//{
|
||||||
|
// _logger.LogInformation(x.ToString());
|
||||||
|
//});
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
restab.ToList().ForEach(x =>
|
restab.ToList().ForEach(x =>
|
||||||
{
|
{
|
||||||
|
if (_accountRecordRepository.GetAccountByDateBelKonto(x.BetalDatum, x.Belopp, x.Konto)==null)
|
||||||
_accountRecordRepository.AddAccountRecord(x);
|
_accountRecordRepository.AddAccountRecord(x);
|
||||||
|
else { };
|
||||||
});
|
});
|
||||||
|
|
||||||
// restab.ToList().ForEach(x => { _accountRecordRepository.AddAccountRecord(x); });
|
// restab.ToList().ForEach(x => { _accountRecordRepository.AddAccountRecord(x); });
|
||||||
@ -137,4 +161,8 @@ public class ReadingIn : IReadingIn
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_excellent.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ using WinFormDiApp.DAL;
|
|||||||
using WinFormDiApp.BL;
|
using WinFormDiApp.BL;
|
||||||
using WinFormDiApp.BLI;
|
using WinFormDiApp.BLI;
|
||||||
using WinFormDiApp.BLR;
|
using WinFormDiApp.BLR;
|
||||||
|
using WinFormDi;
|
||||||
|
|
||||||
namespace WinFormDiApp
|
namespace WinFormDiApp
|
||||||
{
|
{
|
||||||
@ -44,7 +45,8 @@ namespace WinFormDiApp
|
|||||||
.AddTransient<MainWindow>()
|
.AddTransient<MainWindow>()
|
||||||
.AddTransient<frmReadPayments>()
|
.AddTransient<frmReadPayments>()
|
||||||
.AddTransient<frmPayments>()
|
.AddTransient<frmPayments>()
|
||||||
.AddTransient<frmSearchData>();
|
.AddTransient<frmSearchData>()
|
||||||
|
.AddTransient<frmEditPayment>();
|
||||||
});
|
});
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|||||||
105
WinFormDi/ListViewColumnSorter.cs
Normal file
105
WinFormDi/ListViewColumnSorter.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This class is an implementation of the 'IComparer' interface.
|
||||||
|
/// </summary>
|
||||||
|
public class ListViewColumnSorter : IComparer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies the column to be sorted
|
||||||
|
/// </summary>
|
||||||
|
private int ColumnToSort;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies the order in which to sort (i.e. 'Ascending').
|
||||||
|
/// </summary>
|
||||||
|
private SortOrder OrderOfSort;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Case insensitive comparer object
|
||||||
|
/// </summary>
|
||||||
|
private CaseInsensitiveComparer ObjectCompare;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Class constructor. Initializes various elements
|
||||||
|
/// </summary>
|
||||||
|
public ListViewColumnSorter()
|
||||||
|
{
|
||||||
|
// Initialize the column to '0'
|
||||||
|
ColumnToSort = 0;
|
||||||
|
|
||||||
|
// Initialize the sort order to 'none'
|
||||||
|
OrderOfSort = SortOrder.None;
|
||||||
|
|
||||||
|
// Initialize the CaseInsensitiveComparer object
|
||||||
|
ObjectCompare = new CaseInsensitiveComparer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This method is inherited from the IComparer interface. It compares the two objects passed using a case insensitive comparison.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">First object to be compared</param>
|
||||||
|
/// <param name="y">Second object to be compared</param>
|
||||||
|
/// <returns>The result of the comparison. "0" if equal, negative if 'x' is less than 'y' and positive if 'x' is greater than 'y'</returns>
|
||||||
|
public int Compare(object x, object y)
|
||||||
|
{
|
||||||
|
int compareResult;
|
||||||
|
ListViewItem listviewX, listviewY;
|
||||||
|
|
||||||
|
// Cast the objects to be compared to ListViewItem objects
|
||||||
|
listviewX = (ListViewItem)x;
|
||||||
|
listviewY = (ListViewItem)y;
|
||||||
|
|
||||||
|
// Compare the two items
|
||||||
|
compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text, listviewY.SubItems[ColumnToSort].Text);
|
||||||
|
|
||||||
|
// Calculate correct return value based on object comparison
|
||||||
|
if (OrderOfSort == SortOrder.Ascending)
|
||||||
|
{
|
||||||
|
// Ascending sort is selected, return normal result of compare operation
|
||||||
|
return compareResult;
|
||||||
|
}
|
||||||
|
else if (OrderOfSort == SortOrder.Descending)
|
||||||
|
{
|
||||||
|
// Descending sort is selected, return negative result of compare operation
|
||||||
|
return (-compareResult);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Return '0' to indicate they are equal
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the number of the column to which to apply the sorting operation (Defaults to '0').
|
||||||
|
/// </summary>
|
||||||
|
public int SortColumn
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
ColumnToSort = value;
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ColumnToSort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the order of sorting to apply (for example, 'Ascending' or 'Descending').
|
||||||
|
/// </summary>
|
||||||
|
public SortOrder Order
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
OrderOfSort = value;
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return OrderOfSort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
60
WinFormDi/MainWindow.Designer.cs
generated
60
WinFormDi/MainWindow.Designer.cs
generated
@ -34,15 +34,17 @@
|
|||||||
btnLoadPayments = new Button();
|
btnLoadPayments = new Button();
|
||||||
btnSearchPayments = new Button();
|
btnSearchPayments = new Button();
|
||||||
btnClose = new Button();
|
btnClose = new Button();
|
||||||
|
btnEdit = new Button();
|
||||||
|
btnClearRecords = new Button();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// helloText
|
// helloText
|
||||||
//
|
//
|
||||||
helloText.AutoSize = true;
|
helloText.AutoSize = true;
|
||||||
helloText.Font = new Font("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point);
|
helloText.Font = new Font("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
helloText.Location = new Point(12, 9);
|
helloText.Location = new Point(14, 12);
|
||||||
helloText.Name = "helloText";
|
helloText.Name = "helloText";
|
||||||
helloText.Size = new Size(45, 19);
|
helloText.Size = new Size(52, 23);
|
||||||
helloText.TabIndex = 0;
|
helloText.TabIndex = 0;
|
||||||
helloText.Text = "------";
|
helloText.Text = "------";
|
||||||
//
|
//
|
||||||
@ -50,17 +52,18 @@
|
|||||||
//
|
//
|
||||||
goodbyeText.AutoSize = true;
|
goodbyeText.AutoSize = true;
|
||||||
goodbyeText.Font = new Font("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point);
|
goodbyeText.Font = new Font("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
goodbyeText.Location = new Point(12, 422);
|
goodbyeText.Location = new Point(14, 563);
|
||||||
goodbyeText.Name = "goodbyeText";
|
goodbyeText.Name = "goodbyeText";
|
||||||
goodbyeText.Size = new Size(45, 19);
|
goodbyeText.Size = new Size(52, 23);
|
||||||
goodbyeText.TabIndex = 1;
|
goodbyeText.TabIndex = 1;
|
||||||
goodbyeText.Text = "------";
|
goodbyeText.Text = "------";
|
||||||
//
|
//
|
||||||
// btnCheckPayments
|
// btnCheckPayments
|
||||||
//
|
//
|
||||||
btnCheckPayments.Location = new Point(75, 70);
|
btnCheckPayments.Location = new Point(86, 93);
|
||||||
|
btnCheckPayments.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnCheckPayments.Name = "btnCheckPayments";
|
btnCheckPayments.Name = "btnCheckPayments";
|
||||||
btnCheckPayments.Size = new Size(156, 23);
|
btnCheckPayments.Size = new Size(178, 31);
|
||||||
btnCheckPayments.TabIndex = 2;
|
btnCheckPayments.TabIndex = 2;
|
||||||
btnCheckPayments.Text = "Kontrollera Betalningar";
|
btnCheckPayments.Text = "Kontrollera Betalningar";
|
||||||
btnCheckPayments.UseVisualStyleBackColor = true;
|
btnCheckPayments.UseVisualStyleBackColor = true;
|
||||||
@ -68,9 +71,10 @@
|
|||||||
//
|
//
|
||||||
// btnLoadPayments
|
// btnLoadPayments
|
||||||
//
|
//
|
||||||
btnLoadPayments.Location = new Point(75, 41);
|
btnLoadPayments.Location = new Point(86, 55);
|
||||||
|
btnLoadPayments.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnLoadPayments.Name = "btnLoadPayments";
|
btnLoadPayments.Name = "btnLoadPayments";
|
||||||
btnLoadPayments.Size = new Size(156, 23);
|
btnLoadPayments.Size = new Size(178, 31);
|
||||||
btnLoadPayments.TabIndex = 3;
|
btnLoadPayments.TabIndex = 3;
|
||||||
btnLoadPayments.Text = "Ladda betalningar";
|
btnLoadPayments.Text = "Ladda betalningar";
|
||||||
btnLoadPayments.UseVisualStyleBackColor = true;
|
btnLoadPayments.UseVisualStyleBackColor = true;
|
||||||
@ -78,9 +82,10 @@
|
|||||||
//
|
//
|
||||||
// btnSearchPayments
|
// btnSearchPayments
|
||||||
//
|
//
|
||||||
btnSearchPayments.Location = new Point(75, 99);
|
btnSearchPayments.Location = new Point(86, 132);
|
||||||
|
btnSearchPayments.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnSearchPayments.Name = "btnSearchPayments";
|
btnSearchPayments.Name = "btnSearchPayments";
|
||||||
btnSearchPayments.Size = new Size(156, 23);
|
btnSearchPayments.Size = new Size(178, 31);
|
||||||
btnSearchPayments.TabIndex = 4;
|
btnSearchPayments.TabIndex = 4;
|
||||||
btnSearchPayments.Text = "Sök betalningar";
|
btnSearchPayments.Text = "Sök betalningar";
|
||||||
btnSearchPayments.UseVisualStyleBackColor = true;
|
btnSearchPayments.UseVisualStyleBackColor = true;
|
||||||
@ -88,25 +93,50 @@
|
|||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
//
|
//
|
||||||
btnClose.Location = new Point(713, 420);
|
btnClose.Location = new Point(815, 560);
|
||||||
|
btnClose.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnClose.Name = "btnClose";
|
btnClose.Name = "btnClose";
|
||||||
btnClose.Size = new Size(75, 23);
|
btnClose.Size = new Size(86, 31);
|
||||||
btnClose.TabIndex = 5;
|
btnClose.TabIndex = 5;
|
||||||
btnClose.Text = "Stäng";
|
btnClose.Text = "Stäng";
|
||||||
btnClose.UseVisualStyleBackColor = true;
|
btnClose.UseVisualStyleBackColor = true;
|
||||||
btnClose.Click += btnClose_Click;
|
btnClose.Click += btnClose_Click;
|
||||||
//
|
//
|
||||||
|
// btnEdit
|
||||||
|
//
|
||||||
|
btnEdit.Location = new Point(86, 171);
|
||||||
|
btnEdit.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
btnEdit.Name = "btnEdit";
|
||||||
|
btnEdit.Size = new Size(178, 31);
|
||||||
|
btnEdit.TabIndex = 6;
|
||||||
|
btnEdit.Text = "Justera/Addera betalning";
|
||||||
|
btnEdit.UseVisualStyleBackColor = true;
|
||||||
|
btnEdit.Click += btnEdit_Click;
|
||||||
|
//
|
||||||
|
// btnClearRecords
|
||||||
|
//
|
||||||
|
btnClearRecords.Location = new Point(91, 211);
|
||||||
|
btnClearRecords.Name = "btnClearRecords";
|
||||||
|
btnClearRecords.Size = new Size(173, 29);
|
||||||
|
btnClearRecords.TabIndex = 7;
|
||||||
|
btnClearRecords.Text = "Töm databasen";
|
||||||
|
btnClearRecords.UseVisualStyleBackColor = true;
|
||||||
|
btnClearRecords.Click += btnClearRecords_Click;
|
||||||
|
//
|
||||||
// MainWindow
|
// MainWindow
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(914, 600);
|
||||||
|
Controls.Add(btnClearRecords);
|
||||||
|
Controls.Add(btnEdit);
|
||||||
Controls.Add(btnClose);
|
Controls.Add(btnClose);
|
||||||
Controls.Add(btnSearchPayments);
|
Controls.Add(btnSearchPayments);
|
||||||
Controls.Add(btnLoadPayments);
|
Controls.Add(btnLoadPayments);
|
||||||
Controls.Add(btnCheckPayments);
|
Controls.Add(btnCheckPayments);
|
||||||
Controls.Add(goodbyeText);
|
Controls.Add(goodbyeText);
|
||||||
Controls.Add(helloText);
|
Controls.Add(helloText);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "MainWindow";
|
Name = "MainWindow";
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "MainWindow";
|
Text = "MainWindow";
|
||||||
@ -124,5 +154,7 @@
|
|||||||
private Button btnLoadPayments;
|
private Button btnLoadPayments;
|
||||||
private Button btnSearchPayments;
|
private Button btnSearchPayments;
|
||||||
private Button btnClose;
|
private Button btnClose;
|
||||||
|
private Button btnEdit;
|
||||||
|
private Button btnClearRecords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,6 +8,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using WinFormDi;
|
||||||
|
|
||||||
namespace WinFormDiApp
|
namespace WinFormDiApp
|
||||||
{
|
{
|
||||||
@ -17,12 +18,14 @@ namespace WinFormDiApp
|
|||||||
private readonly frmPayments _payments;
|
private readonly frmPayments _payments;
|
||||||
private readonly frmReadPayments _readPayments;
|
private readonly frmReadPayments _readPayments;
|
||||||
private readonly frmSearchData _searchData;
|
private readonly frmSearchData _searchData;
|
||||||
|
private readonly frmEditPayment _editPayment;
|
||||||
|
|
||||||
public MainWindow(
|
public MainWindow(
|
||||||
IMessages messages,
|
IMessages messages,
|
||||||
frmPayments payments,
|
frmPayments payments,
|
||||||
frmReadPayments readPayments,
|
frmReadPayments readPayments,
|
||||||
frmSearchData searchData
|
frmSearchData searchData,
|
||||||
|
frmEditPayment editPayment
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -30,6 +33,7 @@ namespace WinFormDiApp
|
|||||||
_payments = payments;
|
_payments = payments;
|
||||||
_readPayments = readPayments;
|
_readPayments = readPayments;
|
||||||
_searchData = searchData;
|
_searchData = searchData;
|
||||||
|
_editPayment = editPayment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindow_Load(object sender, EventArgs e)
|
private void MainWindow_Load(object sender, EventArgs e)
|
||||||
@ -62,5 +66,17 @@ namespace WinFormDiApp
|
|||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_editPayment.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClearRecords_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_payments.EnableClearing = true;
|
||||||
|
_payments.ShowDialog();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
100
WinFormDi/UserControls/ucCustomerValue.Designer.cs
generated
Normal file
100
WinFormDi/UserControls/ucCustomerValue.Designer.cs
generated
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
namespace WinFormDi.UserControls
|
||||||
|
{
|
||||||
|
partial class ucCustomerValue
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
lblCustName = new Label();
|
||||||
|
lblAmount = new Label();
|
||||||
|
btnShowMore = new Button();
|
||||||
|
lblNumberof = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblCustName
|
||||||
|
//
|
||||||
|
lblCustName.AutoSize = true;
|
||||||
|
lblCustName.Font = new Font("Verdana Pro", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
lblCustName.Location = new Point(3, 9);
|
||||||
|
lblCustName.Name = "lblCustName";
|
||||||
|
lblCustName.Size = new Size(123, 14);
|
||||||
|
lblCustName.TabIndex = 0;
|
||||||
|
lblCustName.Text = "Customer default";
|
||||||
|
//
|
||||||
|
// lblAmount
|
||||||
|
//
|
||||||
|
lblAmount.AutoSize = true;
|
||||||
|
lblAmount.Font = new Font("Segoe UI", 11F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
lblAmount.Location = new Point(317, 5);
|
||||||
|
lblAmount.Name = "lblAmount";
|
||||||
|
lblAmount.Size = new Size(36, 20);
|
||||||
|
lblAmount.TabIndex = 1;
|
||||||
|
lblAmount.Text = "0,00";
|
||||||
|
//
|
||||||
|
// btnShowMore
|
||||||
|
//
|
||||||
|
btnShowMore.BackColor = Color.FromArgb(192, 192, 255);
|
||||||
|
btnShowMore.ForeColor = Color.FromArgb(0, 0, 64);
|
||||||
|
btnShowMore.Location = new Point(563, 5);
|
||||||
|
btnShowMore.Name = "btnShowMore";
|
||||||
|
btnShowMore.Size = new Size(72, 23);
|
||||||
|
btnShowMore.TabIndex = 2;
|
||||||
|
btnShowMore.Text = "Visa mer";
|
||||||
|
btnShowMore.UseVisualStyleBackColor = false;
|
||||||
|
btnShowMore.Click += btnShowMore_Click;
|
||||||
|
//
|
||||||
|
// lblNumberof
|
||||||
|
//
|
||||||
|
lblNumberof.AutoSize = true;
|
||||||
|
lblNumberof.Location = new Point(505, 9);
|
||||||
|
lblNumberof.Name = "lblNumberof";
|
||||||
|
lblNumberof.Size = new Size(13, 15);
|
||||||
|
lblNumberof.TabIndex = 3;
|
||||||
|
lblNumberof.Text = "0";
|
||||||
|
//
|
||||||
|
// ucCustomerValue
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = Color.FromArgb(192, 255, 255);
|
||||||
|
Controls.Add(lblNumberof);
|
||||||
|
Controls.Add(btnShowMore);
|
||||||
|
Controls.Add(lblAmount);
|
||||||
|
Controls.Add(lblCustName);
|
||||||
|
Name = "ucCustomerValue";
|
||||||
|
Size = new Size(638, 28);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label lblCustName;
|
||||||
|
private Label lblAmount;
|
||||||
|
private Button btnShowMore;
|
||||||
|
private Label lblNumberof;
|
||||||
|
}
|
||||||
|
}
|
||||||
33
WinFormDi/UserControls/ucCustomerValue.cs
Normal file
33
WinFormDi/UserControls/ucCustomerValue.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using WinFormDiApp;
|
||||||
|
|
||||||
|
namespace WinFormDi.UserControls
|
||||||
|
{
|
||||||
|
public partial class ucCustomerValue : UserControl
|
||||||
|
{
|
||||||
|
private readonly frmSearchData _parentForm;
|
||||||
|
|
||||||
|
public ucCustomerValue(frmSearchData parentForm)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_parentForm = parentForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnShowMore_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_parentForm.ShowDetails(Convert.ToString(this.Tag));
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Receiver { get => lblCustName.Text; set => lblCustName.Text = value; }
|
||||||
|
public string Number { get => lblNumberof.Text; set => lblNumberof.Text = value; }
|
||||||
|
public string Amount { get => lblAmount.Text; set => lblAmount.Text = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
120
WinFormDi/UserControls/ucCustomerValue.resx
Normal file
120
WinFormDi/UserControls/ucCustomerValue.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
289
WinFormDi/frmEditPayment.Designer.cs
generated
Normal file
289
WinFormDi/frmEditPayment.Designer.cs
generated
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
namespace WinFormDiApp
|
||||||
|
{
|
||||||
|
partial class frmEditPayment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
lblHeader = new Label();
|
||||||
|
rbNew = new RadioButton();
|
||||||
|
rbEdit = new RadioButton();
|
||||||
|
lblIdHeader = new Label();
|
||||||
|
txtId = new TextBox();
|
||||||
|
txtAccount = new TextBox();
|
||||||
|
lblKonto = new Label();
|
||||||
|
txtReceiver = new TextBox();
|
||||||
|
lblReceiver = new Label();
|
||||||
|
txtAmount = new TextBox();
|
||||||
|
lblAmount = new Label();
|
||||||
|
lblPayDate = new Label();
|
||||||
|
txtPayInfo = new TextBox();
|
||||||
|
lblBetInfo = new Label();
|
||||||
|
tblChangeRegTime = new Label();
|
||||||
|
dtpPayDate = new DateTimePicker();
|
||||||
|
btnSave = new Button();
|
||||||
|
btnClose = new Button();
|
||||||
|
btnSearch = new Button();
|
||||||
|
txtSaved = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblHeader
|
||||||
|
//
|
||||||
|
lblHeader.AutoSize = true;
|
||||||
|
lblHeader.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
lblHeader.Location = new Point(30, 29);
|
||||||
|
lblHeader.Name = "lblHeader";
|
||||||
|
lblHeader.Size = new Size(216, 21);
|
||||||
|
lblHeader.TabIndex = 0;
|
||||||
|
lblHeader.Text = "Manuell inmatning / justering";
|
||||||
|
//
|
||||||
|
// rbNew
|
||||||
|
//
|
||||||
|
rbNew.AutoSize = true;
|
||||||
|
rbNew.Checked = true;
|
||||||
|
rbNew.Location = new Point(33, 75);
|
||||||
|
rbNew.Name = "rbNew";
|
||||||
|
rbNew.Size = new Size(103, 19);
|
||||||
|
rbNew.TabIndex = 2;
|
||||||
|
rbNew.TabStop = true;
|
||||||
|
rbNew.Text = "Ny registrering";
|
||||||
|
rbNew.UseVisualStyleBackColor = true;
|
||||||
|
rbNew.CheckedChanged += rbNew_CheckedChanged;
|
||||||
|
//
|
||||||
|
// rbEdit
|
||||||
|
//
|
||||||
|
rbEdit.AutoSize = true;
|
||||||
|
rbEdit.Location = new Point(33, 100);
|
||||||
|
rbEdit.Name = "rbEdit";
|
||||||
|
rbEdit.Size = new Size(68, 19);
|
||||||
|
rbEdit.TabIndex = 3;
|
||||||
|
rbEdit.Text = "Ändring";
|
||||||
|
rbEdit.UseVisualStyleBackColor = true;
|
||||||
|
rbEdit.CheckedChanged += rbEdit_CheckedChanged;
|
||||||
|
//
|
||||||
|
// lblIdHeader
|
||||||
|
//
|
||||||
|
lblIdHeader.AutoSize = true;
|
||||||
|
lblIdHeader.Location = new Point(33, 134);
|
||||||
|
lblIdHeader.Name = "lblIdHeader";
|
||||||
|
lblIdHeader.Size = new Size(51, 15);
|
||||||
|
lblIdHeader.TabIndex = 4;
|
||||||
|
lblIdHeader.Text = "Identitet";
|
||||||
|
//
|
||||||
|
// txtId
|
||||||
|
//
|
||||||
|
txtId.Enabled = false;
|
||||||
|
txtId.Location = new Point(133, 131);
|
||||||
|
txtId.Name = "txtId";
|
||||||
|
txtId.Size = new Size(139, 23);
|
||||||
|
txtId.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// txtAccount
|
||||||
|
//
|
||||||
|
txtAccount.Location = new Point(133, 163);
|
||||||
|
txtAccount.Name = "txtAccount";
|
||||||
|
txtAccount.Size = new Size(139, 23);
|
||||||
|
txtAccount.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// lblKonto
|
||||||
|
//
|
||||||
|
lblKonto.AutoSize = true;
|
||||||
|
lblKonto.Location = new Point(33, 166);
|
||||||
|
lblKonto.Name = "lblKonto";
|
||||||
|
lblKonto.Size = new Size(39, 15);
|
||||||
|
lblKonto.TabIndex = 6;
|
||||||
|
lblKonto.Text = "Konto";
|
||||||
|
//
|
||||||
|
// txtReceiver
|
||||||
|
//
|
||||||
|
txtReceiver.Location = new Point(133, 201);
|
||||||
|
txtReceiver.Name = "txtReceiver";
|
||||||
|
txtReceiver.Size = new Size(353, 23);
|
||||||
|
txtReceiver.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// lblReceiver
|
||||||
|
//
|
||||||
|
lblReceiver.AutoSize = true;
|
||||||
|
lblReceiver.Location = new Point(33, 204);
|
||||||
|
lblReceiver.Name = "lblReceiver";
|
||||||
|
lblReceiver.Size = new Size(62, 15);
|
||||||
|
lblReceiver.TabIndex = 8;
|
||||||
|
lblReceiver.Text = "Mottagare";
|
||||||
|
//
|
||||||
|
// txtAmount
|
||||||
|
//
|
||||||
|
txtAmount.Location = new Point(133, 239);
|
||||||
|
txtAmount.Name = "txtAmount";
|
||||||
|
txtAmount.Size = new Size(139, 23);
|
||||||
|
txtAmount.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// lblAmount
|
||||||
|
//
|
||||||
|
lblAmount.AutoSize = true;
|
||||||
|
lblAmount.Location = new Point(33, 242);
|
||||||
|
lblAmount.Name = "lblAmount";
|
||||||
|
lblAmount.Size = new Size(44, 15);
|
||||||
|
lblAmount.TabIndex = 10;
|
||||||
|
lblAmount.Text = "Belopp";
|
||||||
|
//
|
||||||
|
// lblPayDate
|
||||||
|
//
|
||||||
|
lblPayDate.AutoSize = true;
|
||||||
|
lblPayDate.Location = new Point(33, 280);
|
||||||
|
lblPayDate.Name = "lblPayDate";
|
||||||
|
lblPayDate.Size = new Size(67, 15);
|
||||||
|
lblPayDate.TabIndex = 12;
|
||||||
|
lblPayDate.Text = "Förfallodag";
|
||||||
|
//
|
||||||
|
// txtPayInfo
|
||||||
|
//
|
||||||
|
txtPayInfo.Location = new Point(133, 315);
|
||||||
|
txtPayInfo.Name = "txtPayInfo";
|
||||||
|
txtPayInfo.Size = new Size(139, 23);
|
||||||
|
txtPayInfo.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// lblBetInfo
|
||||||
|
//
|
||||||
|
lblBetInfo.AutoSize = true;
|
||||||
|
lblBetInfo.Location = new Point(30, 318);
|
||||||
|
lblBetInfo.Name = "lblBetInfo";
|
||||||
|
lblBetInfo.Size = new Size(56, 15);
|
||||||
|
lblBetInfo.TabIndex = 14;
|
||||||
|
lblBetInfo.Text = "Avisering";
|
||||||
|
//
|
||||||
|
// tblChangeRegTime
|
||||||
|
//
|
||||||
|
tblChangeRegTime.AutoSize = true;
|
||||||
|
tblChangeRegTime.Location = new Point(33, 356);
|
||||||
|
tblChangeRegTime.Name = "tblChangeRegTime";
|
||||||
|
tblChangeRegTime.Size = new Size(89, 15);
|
||||||
|
tblChangeRegTime.TabIndex = 16;
|
||||||
|
tblChangeRegTime.Text = "Ändring Sparad";
|
||||||
|
//
|
||||||
|
// dtpPayDate
|
||||||
|
//
|
||||||
|
dtpPayDate.Format = DateTimePickerFormat.Short;
|
||||||
|
dtpPayDate.Location = new Point(133, 274);
|
||||||
|
dtpPayDate.Name = "dtpPayDate";
|
||||||
|
dtpPayDate.Size = new Size(139, 23);
|
||||||
|
dtpPayDate.TabIndex = 18;
|
||||||
|
//
|
||||||
|
// btnSave
|
||||||
|
//
|
||||||
|
btnSave.Location = new Point(330, 464);
|
||||||
|
btnSave.Name = "btnSave";
|
||||||
|
btnSave.Size = new Size(75, 23);
|
||||||
|
btnSave.TabIndex = 19;
|
||||||
|
btnSave.Text = "Spara";
|
||||||
|
btnSave.UseVisualStyleBackColor = true;
|
||||||
|
btnSave.Click += btnSave_Click;
|
||||||
|
//
|
||||||
|
// btnClose
|
||||||
|
//
|
||||||
|
btnClose.Location = new Point(411, 464);
|
||||||
|
btnClose.Name = "btnClose";
|
||||||
|
btnClose.Size = new Size(75, 23);
|
||||||
|
btnClose.TabIndex = 20;
|
||||||
|
btnClose.Text = "Avbryt";
|
||||||
|
btnClose.UseVisualStyleBackColor = true;
|
||||||
|
btnClose.Click += btnClose_Click;
|
||||||
|
//
|
||||||
|
// btnSearch
|
||||||
|
//
|
||||||
|
btnSearch.Location = new Point(278, 130);
|
||||||
|
btnSearch.Name = "btnSearch";
|
||||||
|
btnSearch.Size = new Size(75, 23);
|
||||||
|
btnSearch.TabIndex = 21;
|
||||||
|
btnSearch.Text = "Sök post";
|
||||||
|
btnSearch.UseVisualStyleBackColor = true;
|
||||||
|
btnSearch.Visible = false;
|
||||||
|
btnSearch.Click += btnSearch_Click;
|
||||||
|
//
|
||||||
|
// txtSaved
|
||||||
|
//
|
||||||
|
txtSaved.Enabled = false;
|
||||||
|
txtSaved.Location = new Point(133, 353);
|
||||||
|
txtSaved.Name = "txtSaved";
|
||||||
|
txtSaved.Size = new Size(139, 23);
|
||||||
|
txtSaved.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// frmEditPayment
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(527, 509);
|
||||||
|
Controls.Add(btnSearch);
|
||||||
|
Controls.Add(btnClose);
|
||||||
|
Controls.Add(btnSave);
|
||||||
|
Controls.Add(dtpPayDate);
|
||||||
|
Controls.Add(txtSaved);
|
||||||
|
Controls.Add(tblChangeRegTime);
|
||||||
|
Controls.Add(txtPayInfo);
|
||||||
|
Controls.Add(lblBetInfo);
|
||||||
|
Controls.Add(lblPayDate);
|
||||||
|
Controls.Add(txtAmount);
|
||||||
|
Controls.Add(lblAmount);
|
||||||
|
Controls.Add(txtReceiver);
|
||||||
|
Controls.Add(lblReceiver);
|
||||||
|
Controls.Add(txtAccount);
|
||||||
|
Controls.Add(lblKonto);
|
||||||
|
Controls.Add(txtId);
|
||||||
|
Controls.Add(lblIdHeader);
|
||||||
|
Controls.Add(rbEdit);
|
||||||
|
Controls.Add(rbNew);
|
||||||
|
Controls.Add(lblHeader);
|
||||||
|
Name = "frmEditPayment";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "frmEditPayment";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label lblHeader;
|
||||||
|
private RadioButton rbNew;
|
||||||
|
private RadioButton rbEdit;
|
||||||
|
private Label lblIdHeader;
|
||||||
|
private TextBox txtId;
|
||||||
|
private TextBox txtAccount;
|
||||||
|
private Label lblKonto;
|
||||||
|
private TextBox txtReceiver;
|
||||||
|
private Label lblReceiver;
|
||||||
|
private TextBox txtAmount;
|
||||||
|
private Label lblAmount;
|
||||||
|
private TextBox txtLastPaydate;
|
||||||
|
private Label lblPayDate;
|
||||||
|
private TextBox txtPayInfo;
|
||||||
|
private Label lblBetInfo;
|
||||||
|
private Label tblChangeRegTime;
|
||||||
|
private DateTimePicker dtpPayDate;
|
||||||
|
private Button btnSave;
|
||||||
|
private Button btnClose;
|
||||||
|
private Button btnSearch;
|
||||||
|
private TextBox txtSaved;
|
||||||
|
}
|
||||||
|
}
|
||||||
100
WinFormDi/frmEditPayment.cs
Normal file
100
WinFormDi/frmEditPayment.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using WinFormDiApp.BL.Helpers;
|
||||||
|
using WinFormDiApp.BL.Models;
|
||||||
|
using WinFormDiApp.BLI;
|
||||||
|
|
||||||
|
namespace WinFormDiApp
|
||||||
|
{
|
||||||
|
public partial class frmEditPayment : Form
|
||||||
|
{
|
||||||
|
private readonly IAccountRecordRepository _recordRepository;
|
||||||
|
|
||||||
|
public frmEditPayment(IAccountRecordRepository recordRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_recordRepository = recordRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rbNew_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (rbNew.Checked)
|
||||||
|
{
|
||||||
|
txtId.Enabled = false;
|
||||||
|
btnSearch.Enabled = false;
|
||||||
|
btnSearch.Visible = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rbEdit_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (rbEdit.Checked)
|
||||||
|
{
|
||||||
|
txtId.Enabled = true;
|
||||||
|
btnSearch.Enabled = true;
|
||||||
|
btnSearch.Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClose_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSearch_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (txtId.Text.IsNumeric())
|
||||||
|
{
|
||||||
|
var editRecord = _recordRepository.GetAccount(int.Parse(txtId.Text));
|
||||||
|
if (editRecord != null)
|
||||||
|
{
|
||||||
|
txtAccount.Text = editRecord.Konto.ToString();
|
||||||
|
txtAmount.Text = editRecord.Belopp.ToString();
|
||||||
|
txtPayInfo.Text = editRecord.Avisering.ToString();
|
||||||
|
txtReceiver.Text = editRecord.Mottagare.ToString();
|
||||||
|
dtpPayDate.Value = editRecord.BetalDatum;
|
||||||
|
txtSaved.Text = editRecord.Stored.ToLongDateString();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AccountRecord saveRecord = new AccountRecord();
|
||||||
|
if(rbEdit.Checked)
|
||||||
|
{
|
||||||
|
saveRecord.Id = Convert.ToInt32( txtId.Text);
|
||||||
|
saveRecord.Stored = DateTime.Parse(txtSaved.Text);
|
||||||
|
}
|
||||||
|
saveRecord.Konto = txtAccount.Text;
|
||||||
|
saveRecord.Belopp = Convert.ToDouble(txtAmount.Text);
|
||||||
|
saveRecord.Avisering = txtPayInfo.Text;
|
||||||
|
saveRecord.Mottagare = txtReceiver.Text;
|
||||||
|
saveRecord.BetalDatum =dtpPayDate.Value;
|
||||||
|
;
|
||||||
|
|
||||||
|
_recordRepository.SaveAcountRecord(saveRecord);
|
||||||
|
|
||||||
|
if (saveRecord != null)
|
||||||
|
{
|
||||||
|
rbEdit.Checked = true;
|
||||||
|
txtId.Text = saveRecord.Id.ToString();
|
||||||
|
txtAccount.Text = saveRecord.Konto.ToString();
|
||||||
|
txtAmount.Text = saveRecord.Belopp.ToString();
|
||||||
|
txtPayInfo.Text = saveRecord.Avisering.ToString();
|
||||||
|
txtReceiver.Text = saveRecord.Mottagare.ToString();
|
||||||
|
dtpPayDate.Value = saveRecord.BetalDatum;
|
||||||
|
txtSaved.Text = saveRecord.Stored.ToLongDateString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
WinFormDi/frmEditPayment.resx
Normal file
120
WinFormDi/frmEditPayment.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
59
WinFormDi/frmPayments.Designer.cs
generated
59
WinFormDi/frmPayments.Designer.cs
generated
@ -36,6 +36,9 @@
|
|||||||
ch5_Förfallodag = new ColumnHeader();
|
ch5_Förfallodag = new ColumnHeader();
|
||||||
ch6_Avisering = new ColumnHeader();
|
ch6_Avisering = new ColumnHeader();
|
||||||
btnClose = new Button();
|
btnClose = new Button();
|
||||||
|
btnRensa = new Button();
|
||||||
|
txtSoekSumma = new TextBox();
|
||||||
|
lblTotal = new Label();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// lvPayments
|
// lvPayments
|
||||||
@ -43,12 +46,14 @@
|
|||||||
lvPayments.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
lvPayments.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
lvPayments.BackColor = Color.FromArgb(192, 255, 255);
|
lvPayments.BackColor = Color.FromArgb(192, 255, 255);
|
||||||
lvPayments.Columns.AddRange(new ColumnHeader[] { ch1_Id, ch2_Mottagare, ch3_Konto, ch4_Belopp, ch5_Förfallodag, ch6_Avisering });
|
lvPayments.Columns.AddRange(new ColumnHeader[] { ch1_Id, ch2_Mottagare, ch3_Konto, ch4_Belopp, ch5_Förfallodag, ch6_Avisering });
|
||||||
lvPayments.Location = new Point(28, 55);
|
lvPayments.Location = new Point(32, 73);
|
||||||
|
lvPayments.Margin = new Padding(3, 4, 3, 4);
|
||||||
lvPayments.Name = "lvPayments";
|
lvPayments.Name = "lvPayments";
|
||||||
lvPayments.Size = new Size(805, 286);
|
lvPayments.Size = new Size(919, 380);
|
||||||
lvPayments.TabIndex = 0;
|
lvPayments.TabIndex = 0;
|
||||||
lvPayments.UseCompatibleStateImageBehavior = false;
|
lvPayments.UseCompatibleStateImageBehavior = false;
|
||||||
lvPayments.View = View.Details;
|
lvPayments.View = View.Details;
|
||||||
|
lvPayments.ColumnClick += lvPayments_ColumnClick;
|
||||||
//
|
//
|
||||||
// ch1_Id
|
// ch1_Id
|
||||||
//
|
//
|
||||||
@ -81,26 +86,65 @@
|
|||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
//
|
//
|
||||||
btnClose.Location = new Point(758, 418);
|
btnClose.Location = new Point(866, 557);
|
||||||
|
btnClose.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnClose.Name = "btnClose";
|
btnClose.Name = "btnClose";
|
||||||
btnClose.Size = new Size(75, 23);
|
btnClose.Size = new Size(86, 31);
|
||||||
btnClose.TabIndex = 1;
|
btnClose.TabIndex = 1;
|
||||||
btnClose.Text = "Stäng";
|
btnClose.Text = "Stäng";
|
||||||
btnClose.UseVisualStyleBackColor = true;
|
btnClose.UseVisualStyleBackColor = true;
|
||||||
btnClose.Click += btnClose_Click;
|
btnClose.Click += btnClose_Click;
|
||||||
//
|
//
|
||||||
|
// btnRensa
|
||||||
|
//
|
||||||
|
btnRensa.Location = new Point(766, 559);
|
||||||
|
btnRensa.Name = "btnRensa";
|
||||||
|
btnRensa.Size = new Size(94, 29);
|
||||||
|
btnRensa.TabIndex = 2;
|
||||||
|
btnRensa.Text = "Rensa ";
|
||||||
|
btnRensa.UseVisualStyleBackColor = true;
|
||||||
|
btnRensa.Visible = false;
|
||||||
|
btnRensa.Click += btnRensa_Click;
|
||||||
|
//
|
||||||
|
// txtSoekSumma
|
||||||
|
//
|
||||||
|
txtSoekSumma.BackColor = SystemColors.ButtonHighlight;
|
||||||
|
txtSoekSumma.Font = new Font("Segoe UI", 14F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
txtSoekSumma.Location = new Point(493, 472);
|
||||||
|
txtSoekSumma.Name = "txtSoekSumma";
|
||||||
|
txtSoekSumma.ReadOnly = true;
|
||||||
|
txtSoekSumma.Size = new Size(210, 39);
|
||||||
|
txtSoekSumma.TabIndex = 12;
|
||||||
|
txtSoekSumma.Visible = false;
|
||||||
|
//
|
||||||
|
// lblTotal
|
||||||
|
//
|
||||||
|
lblTotal.AutoSize = true;
|
||||||
|
lblTotal.Location = new Point(325, 484);
|
||||||
|
lblTotal.Name = "lblTotal";
|
||||||
|
lblTotal.Size = new Size(165, 20);
|
||||||
|
lblTotal.TabIndex = 11;
|
||||||
|
lblTotal.Text = "Totalt för visade poster:";
|
||||||
|
lblTotal.Visible = false;
|
||||||
|
//
|
||||||
// frmPayments
|
// frmPayments
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(856, 453);
|
ClientSize = new Size(978, 604);
|
||||||
|
Controls.Add(txtSoekSumma);
|
||||||
|
Controls.Add(lblTotal);
|
||||||
|
Controls.Add(btnRensa);
|
||||||
Controls.Add(btnClose);
|
Controls.Add(btnClose);
|
||||||
Controls.Add(lvPayments);
|
Controls.Add(lvPayments);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "frmPayments";
|
Name = "frmPayments";
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "frmPayments";
|
Text = "frmPayments";
|
||||||
Load += frmPayments_Load;
|
Load += frmPayments_Load;
|
||||||
|
Shown += frmPayments_Shown;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -113,5 +157,8 @@
|
|||||||
private ColumnHeader ch6_Avisering;
|
private ColumnHeader ch6_Avisering;
|
||||||
private Button btnClose;
|
private Button btnClose;
|
||||||
private ColumnHeader ch5_Förfallodag;
|
private ColumnHeader ch5_Förfallodag;
|
||||||
|
private Button btnRensa;
|
||||||
|
private TextBox txtSoekSumma;
|
||||||
|
private Label lblTotal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,22 +7,91 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using WinFormDiApp.BL.Models;
|
||||||
using WinFormDiApp.BLI;
|
using WinFormDiApp.BLI;
|
||||||
|
|
||||||
namespace WinFormDiApp
|
namespace WinFormDiApp
|
||||||
{
|
{
|
||||||
public partial class frmPayments : Form
|
public partial class frmPayments : Form
|
||||||
{
|
{
|
||||||
|
private ListViewColumnSorter lvwColumnSorter;
|
||||||
|
|
||||||
|
private bool _enableClearing;
|
||||||
|
private bool _enableDetailShow;
|
||||||
private readonly IAccountRecordRepository _accountRecordRepository;
|
private readonly IAccountRecordRepository _accountRecordRepository;
|
||||||
|
|
||||||
|
public bool EnableClearing
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _enableClearing;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_enableClearing = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EnableDetailShow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _enableDetailShow;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_enableDetailShow = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public frmPayments(IAccountRecordRepository accountRecordRepository)
|
public frmPayments(IAccountRecordRepository accountRecordRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
//---------------------------------
|
||||||
|
// Create an instance of a ListView column sorter and assign it
|
||||||
|
// to the ListView control.
|
||||||
|
lvwColumnSorter = new ListViewColumnSorter();
|
||||||
|
lvPayments.ListViewItemSorter = lvwColumnSorter;
|
||||||
|
//---------------------------------
|
||||||
|
|
||||||
lvPayments.Items.Clear();
|
lvPayments.Items.Clear();
|
||||||
_accountRecordRepository = accountRecordRepository;
|
_accountRecordRepository = accountRecordRepository;
|
||||||
}
|
}
|
||||||
|
public IEnumerable<AccountRecord>? CustomPayments { get; set; } = null;
|
||||||
private void frmPayments_Load(object sender, EventArgs e)
|
private void frmPayments_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//MessageBox.Show("Load");
|
||||||
|
btnRensa.Visible = _enableClearing;
|
||||||
|
lblTotal.Visible = _enableDetailShow;
|
||||||
|
txtSoekSumma.Visible = _enableDetailShow;
|
||||||
|
double totalSum = 0;
|
||||||
|
lvPayments.Items.Clear();
|
||||||
|
|
||||||
|
if (CustomPayments != null)
|
||||||
|
{
|
||||||
|
foreach (var account in CustomPayments)
|
||||||
|
{
|
||||||
|
var lvitem = lvPayments.Items.Add(account.Id.ToString());
|
||||||
|
lvitem.SubItems.Add(account.Mottagare);
|
||||||
|
lvitem.SubItems.Add(account.Konto);
|
||||||
|
lvitem.SubItems.Add(account.Belopp.ToString());
|
||||||
|
totalSum += account.Belopp;
|
||||||
|
lvitem.SubItems.Add(account.BetalDatum.ToShortDateString());
|
||||||
|
lvitem.SubItems.Add(account.Avisering);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
txtSoekSumma.Text = totalSum.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClose_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frmPayments_Shown(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//MessageBox.Show("Shown");
|
||||||
|
if (CustomPayments == null)
|
||||||
{
|
{
|
||||||
lvPayments.Items.Clear();
|
lvPayments.Items.Clear();
|
||||||
var payments = _accountRecordRepository.GetAllAccounts();
|
var payments = _accountRecordRepository.GetAllAccounts();
|
||||||
@ -36,10 +105,57 @@ namespace WinFormDiApp
|
|||||||
lvitem.SubItems.Add(account.Avisering);
|
lvitem.SubItems.Add(account.Avisering);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else CustomPayments = null;
|
||||||
|
}
|
||||||
|
|
||||||
private void btnClose_Click(object sender, EventArgs e)
|
private void btnRensa_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
if (MessageBox.Show("Verkligen Säker på att rensa DB?", "Payments", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Nu rensar vi");
|
||||||
|
_accountRecordRepository.DeleteAllAccountRecords();
|
||||||
|
|
||||||
|
lvPayments.Items.Clear();
|
||||||
|
var payments = _accountRecordRepository.GetAllAccounts();
|
||||||
|
foreach (var account in payments)
|
||||||
|
{
|
||||||
|
var lvitem = lvPayments.Items.Add(account.Id.ToString());
|
||||||
|
lvitem.SubItems.Add(account.Mottagare);
|
||||||
|
lvitem.SubItems.Add(account.Konto);
|
||||||
|
lvitem.SubItems.Add(account.Belopp.ToString());
|
||||||
|
lvitem.SubItems.Add(account.BetalDatum.ToShortDateString());
|
||||||
|
lvitem.SubItems.Add(account.Avisering);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void lvPayments_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||||
|
{
|
||||||
|
// Determine if clicked column is already the column that is being sorted.
|
||||||
|
if (e.Column == lvwColumnSorter.SortColumn)
|
||||||
|
{
|
||||||
|
// Reverse the current sort direction for this column.
|
||||||
|
if (lvwColumnSorter.Order == SortOrder.Ascending)
|
||||||
|
{
|
||||||
|
lvwColumnSorter.Order = SortOrder.Descending;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lvwColumnSorter.Order = SortOrder.Ascending;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set the column number that is to be sorted; default to ascending.
|
||||||
|
lvwColumnSorter.SortColumn = e.Column;
|
||||||
|
lvwColumnSorter.Order = SortOrder.Ascending;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the sort with these new sort options.
|
||||||
|
lvPayments.Sort();
|
||||||
|
}
|
||||||
|
//------------------------------------------------- sorting ------------
|
||||||
|
|
||||||
|
//------------------------------------------------- sorting ------------
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
31
WinFormDi/frmReadPayments.Designer.cs
generated
31
WinFormDi/frmReadPayments.Designer.cs
generated
@ -92,9 +92,10 @@
|
|||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
//
|
//
|
||||||
btnClose.Location = new Point(758, 506);
|
btnClose.Location = new Point(866, 675);
|
||||||
|
btnClose.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnClose.Name = "btnClose";
|
btnClose.Name = "btnClose";
|
||||||
btnClose.Size = new Size(75, 23);
|
btnClose.Size = new Size(86, 31);
|
||||||
btnClose.TabIndex = 1;
|
btnClose.TabIndex = 1;
|
||||||
btnClose.Text = "Stäng";
|
btnClose.Text = "Stäng";
|
||||||
btnClose.UseVisualStyleBackColor = true;
|
btnClose.UseVisualStyleBackColor = true;
|
||||||
@ -105,9 +106,10 @@
|
|||||||
lvPayouts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
lvPayouts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
lvPayouts.BackColor = Color.FromArgb(192, 255, 255);
|
lvPayouts.BackColor = Color.FromArgb(192, 255, 255);
|
||||||
lvPayouts.Columns.AddRange(new ColumnHeader[] { columnHeader1, columnHeader2, columnHeader3, columnHeader4, columnHeader5, columnHeader6 });
|
lvPayouts.Columns.AddRange(new ColumnHeader[] { columnHeader1, columnHeader2, columnHeader3, columnHeader4, columnHeader5, columnHeader6 });
|
||||||
lvPayouts.Location = new Point(28, 107);
|
lvPayouts.Location = new Point(32, 143);
|
||||||
|
lvPayouts.Margin = new Padding(3, 4, 3, 4);
|
||||||
lvPayouts.Name = "lvPayouts";
|
lvPayouts.Name = "lvPayouts";
|
||||||
lvPayouts.Size = new Size(805, 393);
|
lvPayouts.Size = new Size(919, 523);
|
||||||
lvPayouts.TabIndex = 2;
|
lvPayouts.TabIndex = 2;
|
||||||
lvPayouts.UseCompatibleStateImageBehavior = false;
|
lvPayouts.UseCompatibleStateImageBehavior = false;
|
||||||
lvPayouts.View = View.Details;
|
lvPayouts.View = View.Details;
|
||||||
@ -143,9 +145,10 @@
|
|||||||
//
|
//
|
||||||
// btnChooseFile
|
// btnChooseFile
|
||||||
//
|
//
|
||||||
btnChooseFile.Location = new Point(30, 28);
|
btnChooseFile.Location = new Point(34, 37);
|
||||||
|
btnChooseFile.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnChooseFile.Name = "btnChooseFile";
|
btnChooseFile.Name = "btnChooseFile";
|
||||||
btnChooseFile.Size = new Size(75, 23);
|
btnChooseFile.Size = new Size(86, 31);
|
||||||
btnChooseFile.TabIndex = 3;
|
btnChooseFile.TabIndex = 3;
|
||||||
btnChooseFile.Text = "Välj infil";
|
btnChooseFile.Text = "Välj infil";
|
||||||
btnChooseFile.UseVisualStyleBackColor = true;
|
btnChooseFile.UseVisualStyleBackColor = true;
|
||||||
@ -159,20 +162,21 @@
|
|||||||
//
|
//
|
||||||
lblTransFileName.AutoSize = true;
|
lblTransFileName.AutoSize = true;
|
||||||
lblTransFileName.Font = new Font("Segoe UI", 12F, FontStyle.Bold, GraphicsUnit.Point);
|
lblTransFileName.Font = new Font("Segoe UI", 12F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
lblTransFileName.Location = new Point(125, 27);
|
lblTransFileName.Location = new Point(143, 36);
|
||||||
lblTransFileName.Name = "lblTransFileName";
|
lblTransFileName.Name = "lblTransFileName";
|
||||||
lblTransFileName.Size = new Size(57, 21);
|
lblTransFileName.Size = new Size(26, 28);
|
||||||
lblTransFileName.TabIndex = 4;
|
lblTransFileName.TabIndex = 4;
|
||||||
lblTransFileName.Text = "label1";
|
lblTransFileName.Text = "[]";
|
||||||
//
|
//
|
||||||
// btnStartRead
|
// btnStartRead
|
||||||
//
|
//
|
||||||
btnStartRead.BackColor = Color.Red;
|
btnStartRead.BackColor = Color.Red;
|
||||||
btnStartRead.Enabled = false;
|
btnStartRead.Enabled = false;
|
||||||
btnStartRead.ForeColor = Color.FromArgb(255, 255, 128);
|
btnStartRead.ForeColor = Color.FromArgb(255, 255, 128);
|
||||||
btnStartRead.Location = new Point(726, 21);
|
btnStartRead.Location = new Point(830, 28);
|
||||||
|
btnStartRead.Margin = new Padding(3, 4, 3, 4);
|
||||||
btnStartRead.Name = "btnStartRead";
|
btnStartRead.Name = "btnStartRead";
|
||||||
btnStartRead.Size = new Size(107, 36);
|
btnStartRead.Size = new Size(122, 48);
|
||||||
btnStartRead.TabIndex = 5;
|
btnStartRead.TabIndex = 5;
|
||||||
btnStartRead.Text = "Starta Inläsning";
|
btnStartRead.Text = "Starta Inläsning";
|
||||||
btnStartRead.UseVisualStyleBackColor = false;
|
btnStartRead.UseVisualStyleBackColor = false;
|
||||||
@ -181,14 +185,15 @@
|
|||||||
//
|
//
|
||||||
// frmReadPayments
|
// frmReadPayments
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(856, 541);
|
ClientSize = new Size(978, 721);
|
||||||
Controls.Add(btnStartRead);
|
Controls.Add(btnStartRead);
|
||||||
Controls.Add(lblTransFileName);
|
Controls.Add(lblTransFileName);
|
||||||
Controls.Add(btnChooseFile);
|
Controls.Add(btnChooseFile);
|
||||||
Controls.Add(lvPayouts);
|
Controls.Add(lvPayouts);
|
||||||
Controls.Add(btnClose);
|
Controls.Add(btnClose);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "frmReadPayments";
|
Name = "frmReadPayments";
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "frmReadPayments";
|
Text = "frmReadPayments";
|
||||||
|
|||||||
@ -40,9 +40,11 @@ namespace WinFormDiApp
|
|||||||
|
|
||||||
private void btnStartRead_Click(object sender, EventArgs e)
|
private void btnStartRead_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Cursor = Cursors.WaitCursor;
|
||||||
if (!_readingIn.ReadAndSaveInvoices(lblTransFileName.Text))
|
if (!_readingIn.ReadAndSaveInvoices(lblTransFileName.Text))
|
||||||
{
|
{
|
||||||
var resUlt = _readingIn.readXLS(lblTransFileName.Text);
|
var resUlt = _readingIn.readXLS(lblTransFileName.Text);
|
||||||
|
_readingIn.Dispose();
|
||||||
resUlt.ToList().ForEach(rec => _logger.LogInformation("Konto :{sKonto}, {dBelopp}", rec.Konto, rec.Belopp));
|
resUlt.ToList().ForEach(rec => _logger.LogInformation("Konto :{sKonto}, {dBelopp}", rec.Konto, rec.Belopp));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -62,6 +64,7 @@ namespace WinFormDiApp
|
|||||||
|
|
||||||
btnStartRead.Enabled = false;
|
btnStartRead.Enabled = false;
|
||||||
btnStartRead.Visible = false;
|
btnStartRead.Visible = false;
|
||||||
|
Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmReadPayments_Shown(object sender, EventArgs e)
|
private void frmReadPayments_Shown(object sender, EventArgs e)
|
||||||
|
|||||||
76
WinFormDi/frmSearchData.Designer.cs
generated
76
WinFormDi/frmSearchData.Designer.cs
generated
@ -35,13 +35,17 @@
|
|||||||
lblDateTo = new Label();
|
lblDateTo = new Label();
|
||||||
dtpTo = new DateTimePicker();
|
dtpTo = new DateTimePicker();
|
||||||
btnStartSearch = new Button();
|
btnStartSearch = new Button();
|
||||||
|
flpPanel1 = new FlowLayoutPanel();
|
||||||
|
label1 = new Label();
|
||||||
|
txtSoekSumma = new TextBox();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnClose
|
// 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.Name = "btnClose";
|
||||||
btnClose.Size = new Size(75, 23);
|
btnClose.Size = new Size(86, 31);
|
||||||
btnClose.TabIndex = 0;
|
btnClose.TabIndex = 0;
|
||||||
btnClose.Text = "Stäng";
|
btnClose.Text = "Stäng";
|
||||||
btnClose.UseVisualStyleBackColor = true;
|
btnClose.UseVisualStyleBackColor = true;
|
||||||
@ -51,60 +55,96 @@
|
|||||||
//
|
//
|
||||||
lblHeader.AutoSize = true;
|
lblHeader.AutoSize = true;
|
||||||
lblHeader.Font = new Font("Segoe UI", 13F, FontStyle.Bold, GraphicsUnit.Point);
|
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.Name = "lblHeader";
|
||||||
lblHeader.Size = new Size(223, 25);
|
lblHeader.Size = new Size(271, 30);
|
||||||
lblHeader.TabIndex = 2;
|
lblHeader.TabIndex = 2;
|
||||||
lblHeader.Text = "Sök data mellan 2 datum";
|
lblHeader.Text = "Sök data mellan 2 datum";
|
||||||
//
|
//
|
||||||
// lblDateFrom
|
// lblDateFrom
|
||||||
//
|
//
|
||||||
lblDateFrom.AutoSize = true;
|
lblDateFrom.AutoSize = true;
|
||||||
lblDateFrom.Location = new Point(21, 65);
|
lblDateFrom.Location = new Point(24, 87);
|
||||||
lblDateFrom.Name = "lblDateFrom";
|
lblDateFrom.Name = "lblDateFrom";
|
||||||
lblDateFrom.Size = new Size(68, 15);
|
lblDateFrom.Size = new Size(84, 20);
|
||||||
lblDateFrom.TabIndex = 3;
|
lblDateFrom.TabIndex = 3;
|
||||||
lblDateFrom.Text = "Från datum";
|
lblDateFrom.Text = "Från datum";
|
||||||
//
|
//
|
||||||
// dtpFrom
|
// dtpFrom
|
||||||
//
|
//
|
||||||
dtpFrom.Format = DateTimePickerFormat.Short;
|
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.Name = "dtpFrom";
|
||||||
dtpFrom.Size = new Size(112, 23);
|
dtpFrom.Size = new Size(127, 27);
|
||||||
dtpFrom.TabIndex = 4;
|
dtpFrom.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// lblDateTo
|
// lblDateTo
|
||||||
//
|
//
|
||||||
lblDateTo.AutoSize = true;
|
lblDateTo.AutoSize = true;
|
||||||
lblDateTo.Location = new Point(233, 65);
|
lblDateTo.Location = new Point(266, 87);
|
||||||
lblDateTo.Name = "lblDateTo";
|
lblDateTo.Name = "lblDateTo";
|
||||||
lblDateTo.Size = new Size(60, 15);
|
lblDateTo.Size = new Size(76, 20);
|
||||||
lblDateTo.TabIndex = 5;
|
lblDateTo.TabIndex = 5;
|
||||||
lblDateTo.Text = "Till datum";
|
lblDateTo.Text = "Till datum";
|
||||||
//
|
//
|
||||||
// dtpTo
|
// dtpTo
|
||||||
//
|
//
|
||||||
dtpTo.Format = DateTimePickerFormat.Short;
|
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.Name = "dtpTo";
|
||||||
dtpTo.Size = new Size(100, 23);
|
dtpTo.Size = new Size(114, 27);
|
||||||
dtpTo.TabIndex = 6;
|
dtpTo.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// btnStartSearch
|
// 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.Name = "btnStartSearch";
|
||||||
btnStartSearch.Size = new Size(96, 23);
|
btnStartSearch.Size = new Size(110, 31);
|
||||||
btnStartSearch.TabIndex = 7;
|
btnStartSearch.TabIndex = 7;
|
||||||
btnStartSearch.Text = "Starta sökning";
|
btnStartSearch.Text = "Starta sökning";
|
||||||
btnStartSearch.UseVisualStyleBackColor = true;
|
btnStartSearch.UseVisualStyleBackColor = true;
|
||||||
|
btnStartSearch.Click += btnStartSearch_Click;
|
||||||
|
//
|
||||||
|
// flpPanel1
|
||||||
|
//
|
||||||
|
flpPanel1.AutoScroll = true;
|
||||||
|
flpPanel1.BackColor = Color.Silver;
|
||||||
|
flpPanel1.Location = new Point(24, 136);
|
||||||
|
flpPanel1.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
flpPanel1.Name = "flpPanel1";
|
||||||
|
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
|
// frmSearchData
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
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(btnStartSearch);
|
||||||
Controls.Add(dtpTo);
|
Controls.Add(dtpTo);
|
||||||
Controls.Add(lblDateTo);
|
Controls.Add(lblDateTo);
|
||||||
@ -112,6 +152,7 @@
|
|||||||
Controls.Add(lblDateFrom);
|
Controls.Add(lblDateFrom);
|
||||||
Controls.Add(lblHeader);
|
Controls.Add(lblHeader);
|
||||||
Controls.Add(btnClose);
|
Controls.Add(btnClose);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "frmSearchData";
|
Name = "frmSearchData";
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "frmSearchData";
|
Text = "frmSearchData";
|
||||||
@ -128,5 +169,8 @@
|
|||||||
private Label lblDateTo;
|
private Label lblDateTo;
|
||||||
private DateTimePicker dtpTo;
|
private DateTimePicker dtpTo;
|
||||||
private Button btnStartSearch;
|
private Button btnStartSearch;
|
||||||
|
private FlowLayoutPanel flpPanel1;
|
||||||
|
private Label label1;
|
||||||
|
private TextBox txtSoekSumma;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,23 +7,115 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using WinFormDi.UserControls;
|
||||||
|
using WinFormDiApp.BL.Helpers;
|
||||||
|
using WinFormDiApp.BL.Models;
|
||||||
using WinFormDiApp.BLI;
|
using WinFormDiApp.BLI;
|
||||||
|
|
||||||
namespace WinFormDiApp
|
namespace WinFormDiApp
|
||||||
{
|
{
|
||||||
public partial class frmSearchData : Form
|
public partial class frmSearchData : Form
|
||||||
{
|
{
|
||||||
|
IEnumerable<AccountRecord>? foundRecs = null;
|
||||||
|
private class AccCount
|
||||||
|
{
|
||||||
|
public AccountRecord? AcRec { get; set; }
|
||||||
|
public int NoOfRecs { get; set; }
|
||||||
|
public double SearchedSum { get; set; }
|
||||||
|
}
|
||||||
private readonly IAccountRecordRepository _accountRecordRepository;
|
private readonly IAccountRecordRepository _accountRecordRepository;
|
||||||
|
private readonly frmPayments _showPayments;
|
||||||
|
|
||||||
public frmSearchData(IAccountRecordRepository accountRecordRepository)
|
public frmSearchData(IAccountRecordRepository accountRecordRepository, frmPayments showPayments)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_accountRecordRepository = accountRecordRepository;
|
_accountRecordRepository = accountRecordRepository;
|
||||||
|
_showPayments = showPayments;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnClose_Click(object sender, EventArgs e)
|
private void btnClose_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnStartSearch_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
double SearchedSum = 0;
|
||||||
|
flpPanel1.Controls.Clear();
|
||||||
|
foundRecs = _accountRecordRepository.GetAllAccBetweenDates(dtpFrom.Value, dtpTo.Value);
|
||||||
|
if (foundRecs.Any())
|
||||||
|
{
|
||||||
|
var aggregates = aggegateAccounts(foundRecs);
|
||||||
|
foreach (var account in aggregates)
|
||||||
|
{
|
||||||
|
var ucCustV = createAndFillUCcv(account);
|
||||||
|
SearchedSum += Convert.ToDouble(ucCustV.Amount);
|
||||||
|
flpPanel1.Controls.Add(ucCustV);
|
||||||
|
}
|
||||||
|
txtSoekSumma.Text=SearchedSum.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flpPanel1.Controls.Clear();
|
||||||
|
MessageBox.Show("Din sökning gav ingen träff");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ucCustomerValue createAndFillUCcv(AccCount account)
|
||||||
|
{
|
||||||
|
var result = new ucCustomerValue(this);
|
||||||
|
result.Amount = String.Format("{0:0.00}", account.SearchedSum).adjustRight();
|
||||||
|
result.Receiver = account.AcRec.Mottagare;
|
||||||
|
result.Number = Convert.ToString(account.NoOfRecs);
|
||||||
|
result.Tag = account.AcRec.Mottagare;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<AccCount> aggegateAccounts(IEnumerable<AccountRecord> result)
|
||||||
|
{
|
||||||
|
List<AccCount> Localresult = new List<AccCount>();
|
||||||
|
string oldMott = string.Empty;
|
||||||
|
AccCount wrkRec = null;
|
||||||
|
foreach (var accountRecord in result)
|
||||||
|
{
|
||||||
|
if (accountRecord.Mottagare == oldMott)
|
||||||
|
{
|
||||||
|
wrkRec.SearchedSum += accountRecord.Belopp;
|
||||||
|
wrkRec.NoOfRecs++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldMott = accountRecord.Mottagare;
|
||||||
|
if (wrkRec != null)
|
||||||
|
{
|
||||||
|
Localresult.Add(wrkRec);
|
||||||
|
wrkRec = AddAccountRecord(accountRecord);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wrkRec = AddAccountRecord(accountRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Localresult.Add(wrkRec);
|
||||||
|
return Localresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AccCount AddAccountRecord(AccountRecord accountRecord)
|
||||||
|
{
|
||||||
|
AccCount acc = new AccCount();
|
||||||
|
acc.NoOfRecs = 1;
|
||||||
|
acc.AcRec = accountRecord;
|
||||||
|
acc.SearchedSum = accountRecord.Belopp;
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowDetails(string mott)
|
||||||
|
{
|
||||||
|
IEnumerable<AccountRecord> detailRecs = foundRecs.Where(fr => fr.Mottagare == mott);
|
||||||
|
_showPayments.EnableDetailShow = true;
|
||||||
|
_showPayments.CustomPayments = detailRecs;
|
||||||
|
_showPayments.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,4 +23,12 @@ public static class Extensions
|
|||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string adjustRight(this string value) {
|
||||||
|
if (!string.IsNullOrEmpty(value) && value.Length < 20)
|
||||||
|
{
|
||||||
|
return " ".Substring(0, 20 - value.Length)+value;
|
||||||
|
}
|
||||||
|
else return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,10 @@ namespace WinFormDiApp.BL.Models
|
|||||||
public double Belopp { get; set; }
|
public double Belopp { get; set; }
|
||||||
public string Avisering { get; set; } = string.Empty;
|
public string Avisering { get; set; } = string.Empty;
|
||||||
public DateTime Stored { get; set;} = DateTime.Now.ToLocalTime();
|
public DateTime Stored { get; set;} = DateTime.Now.ToLocalTime();
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
//return base.ToString();
|
||||||
|
return $"\"Rad{Id}\": {{\"BetalDatum\": \"{BetalDatum}\", \"Mottagare\": \"{Mottagare}\", \"Konto\": \"{Konto}\", \"Belopp\": \"{Belopp}\", \"Avisering\": \"{Avisering}\"}},";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
cacsvedan@mercedes-benz.com.jpeg
Normal file
BIN
cacsvedan@mercedes-benz.com.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
Reference in New Issue
Block a user