Готовая работа
This commit is contained in:
parent
d7aee1d5c6
commit
9d4e552a0c
@ -10,15 +10,15 @@ public class PeopleExpense
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int PeopleId { get; private set; }
|
||||
public DateTime DataReceipt { get; private set; }
|
||||
public DateTime DataReciept { get; private set; }
|
||||
public IEnumerable<ExpensePeopleExpense> ExpensePeopleExpenses { get; private set; } = [];
|
||||
public static PeopleExpense CreateOperation(int id, int peopleId, DateTime dataReceipt,IEnumerable<ExpensePeopleExpense> expensePeopleExpenses)
|
||||
public static PeopleExpense CreateOperation(int id, int peopleId, DateTime dataReciept,IEnumerable<ExpensePeopleExpense> expensePeopleExpenses)
|
||||
{
|
||||
return new PeopleExpense
|
||||
{
|
||||
Id = id,
|
||||
PeopleId = peopleId,
|
||||
DataReceipt = dataReceipt,
|
||||
DataReciept = dataReciept,
|
||||
ExpensePeopleExpenses = expensePeopleExpenses
|
||||
};
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class PeopleIncome
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int PeopleId { get; private set; }
|
||||
public DateTime DataReceipt { get; private set; }
|
||||
public DateTime DataReciept { get; private set; }
|
||||
public IEnumerable<IncomePeopleIncome> IncomePeopleIncomes { get; private set; } = [];
|
||||
public static PeopleIncome CreateOperation(int id, int peopleId,DateTime dataReciept,IEnumerable<IncomePeopleIncome> incomePeopleIncomes)
|
||||
{
|
||||
@ -19,7 +19,7 @@ public class PeopleIncome
|
||||
{
|
||||
Id = id,
|
||||
PeopleId = peopleId,
|
||||
DataReceipt = dataReciept,
|
||||
DataReciept = dataReciept,
|
||||
IncomePeopleIncomes = incomePeopleIncomes
|
||||
};
|
||||
}
|
||||
|
@ -30,14 +30,14 @@
|
||||
{
|
||||
label1 = new Label();
|
||||
comboBoxPeople = new ComboBox();
|
||||
label3 = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
groupBox = new GroupBox();
|
||||
dataGridView = new DataGridView();
|
||||
ColumnExpense = new DataGridViewComboBoxColumn();
|
||||
ColumnSum = new DataGridViewTextBoxColumn();
|
||||
buttonSave = new Button();
|
||||
buttonCansel = new Button();
|
||||
label3 = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
groupBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -60,23 +60,6 @@
|
||||
comboBoxPeople.Size = new Size(212, 23);
|
||||
comboBoxPeople.TabIndex = 3;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(57, 70);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(32, 15);
|
||||
label3.TabIndex = 8;
|
||||
label3.Text = "Дата";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Enabled = false;
|
||||
dateTimePicker.Location = new Point(140, 64);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(212, 23);
|
||||
dateTimePicker.TabIndex = 9;
|
||||
//
|
||||
// groupBox
|
||||
//
|
||||
groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
@ -135,6 +118,22 @@
|
||||
buttonCansel.UseVisualStyleBackColor = true;
|
||||
buttonCansel.Click += buttonCansel_Click;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(57, 70);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(32, 15);
|
||||
label3.TabIndex = 8;
|
||||
label3.Text = "Дата";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(140, 64);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(212, 23);
|
||||
dateTimePicker.TabIndex = 9;
|
||||
//
|
||||
// FormPeopleExpense
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
@ -160,13 +159,13 @@
|
||||
|
||||
private Label label1;
|
||||
private ComboBox comboBoxPeople;
|
||||
private Label label3;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private GroupBox groupBox;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewComboBoxColumn ColumnExpense;
|
||||
private DataGridViewTextBoxColumn ColumnSum;
|
||||
private Button buttonSave;
|
||||
private Button buttonCansel;
|
||||
private Label label3;
|
||||
private DateTimePicker dateTimePicker;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
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
|
||||
@ -123,10 +123,4 @@
|
||||
<metadata name="ColumnSum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnExpense.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnSum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
@ -37,8 +37,8 @@
|
||||
ColumnSum = new DataGridViewTextBoxColumn();
|
||||
buttonSave = new Button();
|
||||
buttonCansel = new Button();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
label3 = new Label();
|
||||
dateTimePicker = new DateTimePicker();
|
||||
groupBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -129,13 +129,6 @@
|
||||
buttonCansel.UseVisualStyleBackColor = true;
|
||||
buttonCansel.Click += buttonCansel_Click;
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(127, 62);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(216, 23);
|
||||
dateTimePicker.TabIndex = 6;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
@ -145,6 +138,13 @@
|
||||
label3.TabIndex = 7;
|
||||
label3.Text = "Дата";
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(127, 62);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(216, 23);
|
||||
dateTimePicker.TabIndex = 6;
|
||||
//
|
||||
// FormPeopleIncome
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
@ -178,7 +178,7 @@
|
||||
private Button buttonCansel;
|
||||
private DataGridViewComboBoxColumn ColumnIncome;
|
||||
private DataGridViewTextBoxColumn ColumnSum;
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Label label3;
|
||||
private DateTimePicker dateTimePicker;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
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
|
||||
|
@ -8,5 +8,5 @@ namespace ProjectFamilyBudget.Repositories.Implementations;
|
||||
|
||||
public class ConnectionString : IConnectionString
|
||||
{
|
||||
string IConnectionString.ConnectionString => "Host=localhost;Port=5432;Username=postgres;Password=postgres;Database=otp2";
|
||||
string IConnectionString.ConnectionString => "Host=localhost;Port=5432;Username=postgres;Password=postgres;Database=postgres";
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ public class PeopleExpenseRepository : IPeopleExpense
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
var queryInsert = @"
|
||||
INSERT INTO PeopleExpense (Date,PeopleId)
|
||||
VALUES (@Date, @PeopleId);
|
||||
INSERT INTO PeopleExpense (PeopleId, DataReciept)
|
||||
VALUES (@PeopleId, @DataReciept);
|
||||
SELECT MAX(Id) FROM PeopleExpense";
|
||||
var peopleExpenseId =
|
||||
connection.QueryFirst<int>(queryInsert, peopleExpense, transaction);
|
||||
|
@ -36,8 +36,8 @@ public class PeopleIncomeRepository : IPeopleIncome
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
var queryInsert = @"
|
||||
INSERT INTO PeopleIncome (DateReciept,PeopleId)
|
||||
VALUES (@DateReciept, @PeopleId);
|
||||
INSERT INTO PeopleIncome (PeopleId, DataReciept)
|
||||
VALUES (@PeopleId, @DataReciept);
|
||||
SELECT MAX(Id) FROM PeopleIncome";
|
||||
var peopleIncomeId =
|
||||
connection.QueryFirst<int>(queryInsert, peopleIncome, transaction);
|
||||
|
Loading…
x
Reference in New Issue
Block a user