New vue for reading in + some new repositories
This commit is contained in:
@ -40,6 +40,7 @@ namespace WinFormDiApp
|
||||
.AddTransient<IAccountRecordRepository,AccountRecordRepository>()
|
||||
.AddTransient<IMemberRepository,MemberRepository>()
|
||||
.AddTransient<MainWindow>()
|
||||
.AddTransient<frmReadPayments>()
|
||||
.AddTransient<frmPayments>();
|
||||
|
||||
});
|
||||
|
||||
13
WinFormDi/MainWindow.Designer.cs
generated
13
WinFormDi/MainWindow.Designer.cs
generated
@ -31,6 +31,7 @@
|
||||
helloText = new Label();
|
||||
goodbyeText = new Label();
|
||||
btnCheckPayments = new Button();
|
||||
btnLoadPayments = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// helloText
|
||||
@ -63,11 +64,22 @@
|
||||
btnCheckPayments.UseVisualStyleBackColor = true;
|
||||
btnCheckPayments.Click += btnCheckPayments_Click;
|
||||
//
|
||||
// btnLoadPayments
|
||||
//
|
||||
btnLoadPayments.Location = new Point(73, 75);
|
||||
btnLoadPayments.Name = "btnLoadPayments";
|
||||
btnLoadPayments.Size = new Size(156, 23);
|
||||
btnLoadPayments.TabIndex = 3;
|
||||
btnLoadPayments.Text = "Ladda betalningar";
|
||||
btnLoadPayments.UseVisualStyleBackColor = true;
|
||||
btnLoadPayments.Click += btnLoadPayments_Click;
|
||||
//
|
||||
// MainWindow
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(btnLoadPayments);
|
||||
Controls.Add(btnCheckPayments);
|
||||
Controls.Add(goodbyeText);
|
||||
Controls.Add(helloText);
|
||||
@ -84,5 +96,6 @@
|
||||
private Label helloText;
|
||||
private Label goodbyeText;
|
||||
private Button btnCheckPayments;
|
||||
private Button btnLoadPayments;
|
||||
}
|
||||
}
|
||||
@ -15,12 +15,18 @@ namespace WinFormDiApp
|
||||
{
|
||||
private readonly IMessages _messages;
|
||||
private readonly frmPayments _payments;
|
||||
private readonly frmReadPayments _readPayments;
|
||||
|
||||
public MainWindow(IMessages messages, frmPayments payments)
|
||||
public MainWindow(
|
||||
IMessages messages,
|
||||
frmPayments payments,
|
||||
frmReadPayments readPayments
|
||||
)
|
||||
{
|
||||
InitializeComponent();
|
||||
_messages = messages;
|
||||
_payments = payments;
|
||||
_readPayments = readPayments;
|
||||
}
|
||||
|
||||
private void MainWindow_Load(object sender, EventArgs e)
|
||||
@ -38,5 +44,10 @@ namespace WinFormDiApp
|
||||
{
|
||||
_payments.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnLoadPayments_Click(object sender, EventArgs e)
|
||||
{
|
||||
_readPayments.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,12 @@
|
||||
<ProjectReference Include="..\WinFormDiApp.DAL\WinFormDiApp.DAL.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="frmReadPayments.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
|
||||
219
WinFormDi/frmReadPayments.Designer.cs
generated
Normal file
219
WinFormDi/frmReadPayments.Designer.cs
generated
Normal file
@ -0,0 +1,219 @@
|
||||
namespace WinFormDiApp
|
||||
{
|
||||
partial class frmReadPayments
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
lvPayments = new ListView();
|
||||
ch1_Id = new ColumnHeader();
|
||||
ch2_Mottagare = new ColumnHeader();
|
||||
ch3_Konto = new ColumnHeader();
|
||||
ch4_Belopp = new ColumnHeader();
|
||||
ch5_Förfallodag = new ColumnHeader();
|
||||
ch6_Avisering = new ColumnHeader();
|
||||
btnClose = new Button();
|
||||
listView1 = new ListView();
|
||||
columnHeader1 = new ColumnHeader();
|
||||
columnHeader2 = new ColumnHeader();
|
||||
columnHeader3 = new ColumnHeader();
|
||||
columnHeader4 = new ColumnHeader();
|
||||
columnHeader5 = new ColumnHeader();
|
||||
columnHeader6 = new ColumnHeader();
|
||||
btnChooseFile = new Button();
|
||||
ofChooseFile = new OpenFileDialog();
|
||||
lblTransFileName = new Label();
|
||||
btnStartRead = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lvPayments
|
||||
//
|
||||
lvPayments.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
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.Location = new Point(28, 55);
|
||||
lvPayments.Name = "lvPayments";
|
||||
lvPayments.Size = new Size(805, 286);
|
||||
lvPayments.TabIndex = 0;
|
||||
lvPayments.UseCompatibleStateImageBehavior = false;
|
||||
lvPayments.View = View.Details;
|
||||
//
|
||||
// ch1_Id
|
||||
//
|
||||
ch1_Id.Text = "Id";
|
||||
//
|
||||
// ch2_Mottagare
|
||||
//
|
||||
ch2_Mottagare.Text = "Mottagare";
|
||||
ch2_Mottagare.Width = 120;
|
||||
//
|
||||
// ch3_Konto
|
||||
//
|
||||
ch3_Konto.Text = "Konto";
|
||||
ch3_Konto.Width = 100;
|
||||
//
|
||||
// ch4_Belopp
|
||||
//
|
||||
ch4_Belopp.Text = "Belopp";
|
||||
ch4_Belopp.Width = 100;
|
||||
//
|
||||
// ch5_Förfallodag
|
||||
//
|
||||
ch5_Förfallodag.Text = "Förfallodag";
|
||||
ch5_Förfallodag.Width = 100;
|
||||
//
|
||||
// ch6_Avisering
|
||||
//
|
||||
ch6_Avisering.Text = "Avisering";
|
||||
ch6_Avisering.Width = 100;
|
||||
//
|
||||
// btnClose
|
||||
//
|
||||
btnClose.Location = new Point(758, 418);
|
||||
btnClose.Name = "btnClose";
|
||||
btnClose.Size = new Size(75, 23);
|
||||
btnClose.TabIndex = 1;
|
||||
btnClose.Text = "Stäng";
|
||||
btnClose.UseVisualStyleBackColor = true;
|
||||
btnClose.Click += btnClose_Click;
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
listView1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
listView1.BackColor = Color.FromArgb(192, 255, 255);
|
||||
listView1.Columns.AddRange(new ColumnHeader[] { columnHeader1, columnHeader2, columnHeader3, columnHeader4, columnHeader5, columnHeader6 });
|
||||
listView1.Location = new Point(28, 107);
|
||||
listView1.Name = "listView1";
|
||||
listView1.Size = new Size(805, 286);
|
||||
listView1.TabIndex = 2;
|
||||
listView1.UseCompatibleStateImageBehavior = false;
|
||||
listView1.View = View.Details;
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
columnHeader1.Text = "Id";
|
||||
//
|
||||
// columnHeader2
|
||||
//
|
||||
columnHeader2.Text = "Mottagare";
|
||||
columnHeader2.Width = 120;
|
||||
//
|
||||
// columnHeader3
|
||||
//
|
||||
columnHeader3.Text = "Konto";
|
||||
columnHeader3.Width = 100;
|
||||
//
|
||||
// columnHeader4
|
||||
//
|
||||
columnHeader4.Text = "Belopp";
|
||||
columnHeader4.Width = 100;
|
||||
//
|
||||
// columnHeader5
|
||||
//
|
||||
columnHeader5.Text = "Förfallodag";
|
||||
columnHeader5.Width = 100;
|
||||
//
|
||||
// columnHeader6
|
||||
//
|
||||
columnHeader6.Text = "Avisering";
|
||||
columnHeader6.Width = 100;
|
||||
//
|
||||
// btnChooseFile
|
||||
//
|
||||
btnChooseFile.Location = new Point(30, 28);
|
||||
btnChooseFile.Name = "btnChooseFile";
|
||||
btnChooseFile.Size = new Size(75, 23);
|
||||
btnChooseFile.TabIndex = 3;
|
||||
btnChooseFile.Text = "Välj infil";
|
||||
btnChooseFile.UseVisualStyleBackColor = true;
|
||||
btnChooseFile.Click += btnChooseFile_Click;
|
||||
//
|
||||
// ofChooseFile
|
||||
//
|
||||
ofChooseFile.InitialDirectory = "DownLoads";
|
||||
//
|
||||
// lblTransFileName
|
||||
//
|
||||
lblTransFileName.AutoSize = true;
|
||||
lblTransFileName.Font = new Font("Segoe UI", 12F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
lblTransFileName.Location = new Point(125, 27);
|
||||
lblTransFileName.Name = "lblTransFileName";
|
||||
lblTransFileName.Size = new Size(57, 21);
|
||||
lblTransFileName.TabIndex = 4;
|
||||
lblTransFileName.Text = "label1";
|
||||
//
|
||||
// btnStartRead
|
||||
//
|
||||
btnStartRead.BackColor = Color.Red;
|
||||
btnStartRead.Enabled = false;
|
||||
btnStartRead.ForeColor = Color.FromArgb(255, 255, 128);
|
||||
btnStartRead.Location = new Point(726, 21);
|
||||
btnStartRead.Name = "btnStartRead";
|
||||
btnStartRead.Size = new Size(107, 36);
|
||||
btnStartRead.TabIndex = 5;
|
||||
btnStartRead.Text = "Starta Inläsning";
|
||||
btnStartRead.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// frmReadPayments
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(856, 453);
|
||||
Controls.Add(btnStartRead);
|
||||
Controls.Add(lblTransFileName);
|
||||
Controls.Add(btnChooseFile);
|
||||
Controls.Add(listView1);
|
||||
Controls.Add(btnClose);
|
||||
Name = "frmReadPayments";
|
||||
Text = "frmReadPayments";
|
||||
Load += frmReadPayments_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ListView lvPayments;
|
||||
private ColumnHeader ch1_Id;
|
||||
private ColumnHeader ch2_Mottagare;
|
||||
private ColumnHeader ch3_Konto;
|
||||
private ColumnHeader ch4_Belopp;
|
||||
private ColumnHeader ch6_Avisering;
|
||||
private Button btnClose;
|
||||
private ColumnHeader ch5_Förfallodag;
|
||||
private ListView listView1;
|
||||
private ColumnHeader columnHeader1;
|
||||
private ColumnHeader columnHeader2;
|
||||
private ColumnHeader columnHeader3;
|
||||
private ColumnHeader columnHeader4;
|
||||
private ColumnHeader columnHeader5;
|
||||
private ColumnHeader columnHeader6;
|
||||
private Button btnChooseFile;
|
||||
private OpenFileDialog ofChooseFile;
|
||||
private Label lblTransFileName;
|
||||
private Button btnStartRead;
|
||||
}
|
||||
}
|
||||
46
WinFormDi/frmReadPayments.cs
Normal file
46
WinFormDi/frmReadPayments.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using WinFormDiApp.BLI;
|
||||
|
||||
namespace WinFormDiApp
|
||||
{
|
||||
public partial class frmReadPayments : Form
|
||||
{
|
||||
private readonly IAccountRecordRepository _accountRecordRepository;
|
||||
|
||||
public frmReadPayments(IAccountRecordRepository accountRecordRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_accountRecordRepository = accountRecordRepository;
|
||||
}
|
||||
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void frmReadPayments_Load(object sender, EventArgs e)
|
||||
{
|
||||
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 btnChooseFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
ofChooseFile.Title = "Välj nerladdad excel-fil (Transaktioner)";
|
||||
ofChooseFile.InitialDirectory = "C:\\";
|
||||
if (ofChooseFile.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
lblTransFileName.Text = ofChooseFile.FileName;
|
||||
btnStartRead.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
123
WinFormDi/frmReadPayments.resx
Normal file
123
WinFormDi/frmReadPayments.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?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>
|
||||
<metadata name="ofChooseFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user