diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/ExpensePeopleExpense.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/ExpensePeopleExpense.cs index bf2126b..2f5facf 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/ExpensePeopleExpense.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/ExpensePeopleExpense.cs @@ -8,14 +8,14 @@ namespace ProjectFamilyBudget.Entities; public class ExpensePeopleExpense { - public int Id { get; private set; } + public int PeopleExpenseId { get; private set; } public int ExpenseId { get; private set; } public int Sum { get; private set; } - public static ExpensePeopleExpense CreateElement(int id, int expenseId, int sum) + public static ExpensePeopleExpense CreateElement(int peopleExpenseId, int expenseId, int sum) { return new ExpensePeopleExpense { - Id = id, + PeopleExpenseId = peopleExpenseId, ExpenseId = expenseId, Sum = sum }; diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/IncomePeopleIncome.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/IncomePeopleIncome.cs index df519df..45e8273 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/IncomePeopleIncome.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/IncomePeopleIncome.cs @@ -8,16 +8,16 @@ namespace ProjectFamilyBudget.Entities; public class IncomePeopleIncome { - public int Id { get; private set; } + public int PeopleIncomeId { get; private set; } public int IncomeId { get; private set; } public int Sum { get; private set; } - public static IncomePeopleIncome CreateElement(int id, int incomeId, int sum) + public static IncomePeopleIncome CreateElement(int peopleIncomeId,int incomeId, int sum) { return new IncomePeopleIncome { - Id = id, + PeopleIncomeId = peopleIncomeId, IncomeId = incomeId, - Sum = sum + Sum = sum }; } } diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleExpense.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleExpense.cs index 2c33bee..e045b7c 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleExpense.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleExpense.cs @@ -10,17 +10,16 @@ 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 ExpensePeopleExpenses { get; private set; } = []; - public static PeopleExpense CreateOperation(int id, int peopleId, IEnumerable expensePeopleExpenses) + public static PeopleExpense CreateOperation(int id, int peopleId, DateTime dataReciept,IEnumerable expensePeopleExpenses) { return new PeopleExpense { Id = id, PeopleId = peopleId, - DataReceipt = DateTime.Now, + DataReciept = dataReciept, ExpensePeopleExpenses = expensePeopleExpenses }; } } - diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleIncome.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleIncome.cs index 561ec46..d10f68c 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleIncome.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Entities/PeopleIncome.cs @@ -1,4 +1,5 @@ -using System; +using ProjectFamilyBudget.Entities.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,17 +11,16 @@ 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 IncomePeopleIncomes { get; private set; } = []; - public static PeopleIncome CreateOperation(int id, int peopleId, IEnumerable incomePeopleIncomes) + public static PeopleIncome CreateOperation(int id, int peopleId,DateTime dataReciept,IEnumerable incomePeopleIncomes) { return new PeopleIncome { Id = id, PeopleId = peopleId, - DataReceipt = DateTime.Now, + DataReciept = dataReciept, IncomePeopleIncomes = incomePeopleIncomes }; } } - diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormExpenses.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormExpenses.cs index a178101..d8aaa58 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormExpenses.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormExpenses.cs @@ -1,4 +1,6 @@ -using System; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Repositories; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,7 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectFamilyBudget.Repositories; using Unity; namespace ProjectFamilyBudget.Forms @@ -92,8 +93,7 @@ namespace ProjectFamilyBudget.Forms MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void LoadList() => dataGridViewData.DataSource = _expense.ReadExpense; - + private void LoadList() => dataGridViewData.DataSource = _expense.ReadExpense(); private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; @@ -106,6 +106,6 @@ namespace ProjectFamilyBudget.Forms id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value); return true; - } + } } } diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormIncomes.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormIncomes.cs index 4c31acb..09f1ae8 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormIncomes.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormIncomes.cs @@ -1,4 +1,6 @@ -using System; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Repositories; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,7 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectFamilyBudget.Repositories; using Unity; namespace ProjectFamilyBudget.Forms @@ -93,7 +94,7 @@ namespace ProjectFamilyBudget.Forms MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void LoadList() => dataGridViewData.DataSource = _income.ReadIncome; + private void LoadList() => dataGridViewData.DataSource = _income.ReadIncome(); private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.Designer.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.Designer.cs index 3a5a77c..efe8851 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.Designer.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.cs index 3b01490..01d3f3c 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.cs @@ -1,4 +1,6 @@ -using System; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Repositories; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,8 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectFamilyBudget.Entities; -using ProjectFamilyBudget.Repositories; namespace ProjectFamilyBudget.Forms { @@ -39,7 +39,7 @@ namespace ProjectFamilyBudget.Forms { throw new Exception("Имеются незаполненные поля"); } - _peopleEpxense.CreatePeopleExpense(PeopleExpense.CreateOperation(0, (int)comboBoxPeople.SelectedValue!, + _peopleEpxense.CreatePeopleExpense(PeopleExpense.CreateOperation(0, (int)comboBoxPeople.SelectedValue!, dateTimePicker.Value, CreateListPeopleExpenseFromDataGrid())); Close(); } diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.resx b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.resx index 1af7de1..27ecb05 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.resx +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpense.resx @@ -1,17 +1,17 @@  - @@ -117,4 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + True + \ No newline at end of file diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpenses.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpenses.cs index 1d16078..6d7f84c 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpenses.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleExpenses.cs @@ -1,4 +1,6 @@ -using System; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Repositories; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,7 +9,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectFamilyBudget.Repositories; +using System.Xml.Linq; using Unity; namespace ProjectFamilyBudget.Forms @@ -74,7 +76,7 @@ namespace ProjectFamilyBudget.Forms MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void LoadList() => dataGridViewData.DataSource = _peopleExpense.ReadPeopleExpense; + private void LoadList() => dataGridViewData.DataSource = _peopleExpense.ReadPeopleExpense(); private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.Designer.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.Designer.cs index f383518..580e1e5 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.Designer.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.Designer.cs @@ -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,14 +129,6 @@ buttonCansel.UseVisualStyleBackColor = true; buttonCansel.Click += buttonCansel_Click; // - // dateTimePicker - // - dateTimePicker.Enabled = false; - dateTimePicker.Location = new Point(127, 62); - dateTimePicker.Name = "dateTimePicker"; - dateTimePicker.Size = new Size(216, 23); - dateTimePicker.TabIndex = 6; - // // label3 // label3.AutoSize = true; @@ -146,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); @@ -179,7 +178,7 @@ private Button buttonCansel; private DataGridViewComboBoxColumn ColumnIncome; private DataGridViewTextBoxColumn ColumnSum; - private DateTimePicker dateTimePicker; private Label label3; + private DateTimePicker dateTimePicker; } } \ No newline at end of file diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.cs index 984c239..d9c210c 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncome.cs @@ -1,4 +1,6 @@ -using System; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Repositories; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,8 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectFamilyBudget.Entities; -using ProjectFamilyBudget.Repositories; namespace ProjectFamilyBudget.Forms { @@ -39,7 +39,7 @@ namespace ProjectFamilyBudget.Forms { throw new Exception("Имеются незаполненные поля"); } - _peopleIncome.CreatePeopleIncome(PeopleIncome.CreateOperation(0, (int)comboBoxPeople.SelectedValue!, + _peopleIncome.CreatePeopleIncome(PeopleIncome.CreateOperation(0, (int)comboBoxPeople.SelectedValue!, dateTimePicker.Value, CreateListPeopleIncomeFromDataGrid())); Close(); } diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncomes.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncomes.cs index 7873d70..b1f19f1 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncomes.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeopleIncomes.cs @@ -1,4 +1,6 @@ -using System; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Repositories; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,7 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectFamilyBudget.Repositories; using Unity; namespace ProjectFamilyBudget.Forms @@ -73,7 +74,7 @@ namespace ProjectFamilyBudget.Forms MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void LoadList() => dataGridViewData.DataSource = _peopleIncome.ReadPeopleIncome; + private void LoadList() => dataGridViewData.DataSource = _peopleIncome.ReadPeopleIncome(); private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.Designer.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.Designer.cs index 3276cac..04f52e7 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.Designer.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.Designer.cs @@ -43,20 +43,18 @@ panel1.Controls.Add(buttonEdit); panel1.Controls.Add(buttonAdd); panel1.Dock = DockStyle.Right; - panel1.Location = new Point(696, 0); - panel1.Margin = new Padding(3, 4, 3, 4); + panel1.Location = new Point(609, 0); panel1.Name = "panel1"; - panel1.Size = new Size(218, 600); + panel1.Size = new Size(191, 450); panel1.TabIndex = 0; // // buttonCansel // buttonCansel.BackgroundImage = Properties.Resources.minus; buttonCansel.BackgroundImageLayout = ImageLayout.Zoom; - buttonCansel.Location = new Point(47, 333); - buttonCansel.Margin = new Padding(3, 4, 3, 4); + buttonCansel.Location = new Point(41, 250); buttonCansel.Name = "buttonCansel"; - buttonCansel.Size = new Size(126, 85); + buttonCansel.Size = new Size(110, 64); buttonCansel.TabIndex = 2; buttonCansel.UseVisualStyleBackColor = true; buttonCansel.Click += buttonCansel_Click; @@ -65,10 +63,9 @@ // buttonEdit.BackgroundImage = Properties.Resources.pen; buttonEdit.BackgroundImageLayout = ImageLayout.Zoom; - buttonEdit.Location = new Point(47, 181); - buttonEdit.Margin = new Padding(3, 4, 3, 4); + buttonEdit.Location = new Point(41, 136); buttonEdit.Name = "buttonEdit"; - buttonEdit.Size = new Size(126, 85); + buttonEdit.Size = new Size(110, 64); buttonEdit.TabIndex = 1; buttonEdit.UseVisualStyleBackColor = true; buttonEdit.Click += buttonEdit_Click; @@ -77,10 +74,9 @@ // buttonAdd.BackgroundImage = Properties.Resources.plus; buttonAdd.BackgroundImageLayout = ImageLayout.Zoom; - buttonAdd.Location = new Point(47, 40); - buttonAdd.Margin = new Padding(3, 4, 3, 4); + buttonAdd.Location = new Point(41, 30); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(126, 85); + buttonAdd.Size = new Size(110, 64); buttonAdd.TabIndex = 0; buttonAdd.UseVisualStyleBackColor = true; buttonAdd.Click += buttonAdd_Click; @@ -95,23 +91,21 @@ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewData.Dock = DockStyle.Fill; dataGridViewData.Location = new Point(0, 0); - dataGridViewData.Margin = new Padding(3, 4, 3, 4); dataGridViewData.MultiSelect = false; dataGridViewData.Name = "dataGridViewData"; dataGridViewData.ReadOnly = true; dataGridViewData.RowHeadersVisible = false; - dataGridViewData.RowHeadersWidth = 51; - dataGridViewData.Size = new Size(696, 600); + dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewData.Size = new Size(609, 450); dataGridViewData.TabIndex = 1; // // FormPeoples // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(914, 600); + ClientSize = new Size(800, 450); Controls.Add(dataGridViewData); Controls.Add(panel1); - Margin = new Padding(3, 4, 3, 4); Name = "FormPeoples"; StartPosition = FormStartPosition.CenterParent; Text = "Люди"; diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.cs index cfd4a22..ed6c174 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Forms/FormPeoples.cs @@ -1,4 +1,6 @@ -using System; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Repositories; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,7 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectFamilyBudget.Repositories; using Unity; namespace ProjectFamilyBudget.Forms @@ -91,7 +92,7 @@ namespace ProjectFamilyBudget.Forms MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void LoadList() => dataGridViewData.DataSource = _people.ReadPeople; + private void LoadList() => dataGridViewData.DataSource = _people.ReadPeople(); private bool TryGetIdentifierFromSelectedRow(out int id) { id = 0; @@ -106,4 +107,4 @@ namespace ProjectFamilyBudget.Forms return true; } } -} \ No newline at end of file +} diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Program.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Program.cs index 37c17bb..9838c68 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Program.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Program.cs @@ -1,34 +1,54 @@ -using Unity; -using Unity.Lifetime; // -using ProjectFamilyBudget.Repositories; // +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using ProjectFamilyBudget.Repositories; using ProjectFamilyBudget.Repositories.Implementations; -using ProjectFamilyBudget; // +using Serilog; +using Unity; +using Unity.Microsoft.Logging; -internal static class Program +namespace ProjectFamilyBudget { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() + internal static class Program { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(CreateContainer().Resolve()); + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(CreateContainer().Resolve()); + } + + private static IUnityContainer CreateContainer() + { + var container = new UnityContainer(); + container.AddExtension(new LoggingExtension(CreateLoggerFactory())); + + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + + container.RegisterType(); + + + return container; + } + private static LoggerFactory CreateLoggerFactory() + { + var loggerFactory = new LoggerFactory(); + loggerFactory.AddSerilog(new LoggerConfiguration() + .ReadFrom.Configuration(new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json") + .Build()) + .CreateLogger()); + return loggerFactory; + } } - - private static IUnityContainer CreateContainer() - { - var container = new UnityContainer(); - - container.RegisterType(new TransientLifetimeManager()); - container.RegisterType(new TransientLifetimeManager()); - container.RegisterType(new TransientLifetimeManager()); - container.RegisterType(new TransientLifetimeManager()); - container.RegisterType(new TransientLifetimeManager()); - - return container; - } -} +} \ No newline at end of file diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/ProjectFamilyBudget.csproj b/ProjectFamilyBudget/ProjectFamilyBudget/ProjectFamilyBudget.csproj index accbdf0..e3c2e4e 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/ProjectFamilyBudget.csproj +++ b/ProjectFamilyBudget/ProjectFamilyBudget/ProjectFamilyBudget.csproj @@ -9,7 +9,18 @@ + + + + + + + + + + + @@ -27,4 +38,10 @@ + + + PreserveNewest + + + \ No newline at end of file diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/IConnectionString.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/IConnectionString.cs new file mode 100644 index 0000000..467dbe1 --- /dev/null +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/IConnectionString.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectFamilyBudget.Repositories; + +public interface IConnectionString +{ + public string ConnectionString { get; } +} \ No newline at end of file diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/ConnectionString.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/ConnectionString.cs new file mode 100644 index 0000000..439d25e --- /dev/null +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/ConnectionString.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectFamilyBudget.Repositories.Implementations; + +public class ConnectionString : IConnectionString +{ + string IConnectionString.ConnectionString => "Host=localhost;Port=5432;Username=postgres;Password=postgres;Database=postgres"; +} diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/ExpenseRepository.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/ExpenseRepository.cs index 4f7a7d4..bd0a14f 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/ExpenseRepository.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/ExpenseRepository.cs @@ -1,37 +1,123 @@ -using System; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Entities.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using ProjectFamilyBudget.Entities.Enums; -using ProjectFamilyBudget.Entities; +using Unity; namespace ProjectFamilyBudget.Repositories.Implementations; public class ExpenseRepository : IExpense { + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + public ExpenseRepository(IConnectionString connectionString, ILogger logger) + { + _connectionString = connectionString; + _logger = logger; + } public void CreateExpense(Expense expense) { + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(expense)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryInsert = @" + INSERT INTO Expense (ExpenseType, Name, ExpenseCategory) + VALUES (@ExpenseType, @Name, @ExpenseCategory)"; + connection.Execute(queryInsert, expense); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; + } + } + public void UpdateExpense(Expense expense) + { + _logger.LogInformation("Редактирование объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(expense)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryUpdate = @" + UPDATE Expense + SET + ExpenseType=@ExpenseType, + Name=@Name, + ExpenseCategory=@ExpenseCategory + WHERE Id=@Id"; + connection.Execute(queryUpdate, expense); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании объекта"); + throw; + } } public void DeleteExpense(int id) { - + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryDelete = @" + DELETE FROM Expense + WHERE Id=@id"; + connection.Execute(queryDelete, new { id }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } + } + public Expense ReadExpenseById(int id) + { + _logger.LogInformation("Получение объекта по идентификатору"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = @" + SELECT * FROM Expense + WHERE Id=@id"; + var expense = connection.QueryFirst(querySelect, new { id }); + _logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(expense)); + return expense; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при поиске объекта"); + throw; + } } public IEnumerable ReadExpense() { - return []; - } - - public Expense ReadExpenseById(int id) - { - return Expense.CreateEntity(0, IncomeExpenseType.None, string.Empty, string.Empty); - } - - public void UpdateExpense(Expense expense) - { - + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM Expense"; + var expenses = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(expenses)); + return expenses; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } } } diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/IncomeRepository.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/IncomeRepository.cs index 72dd9e3..3a41b6c 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/IncomeRepository.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/IncomeRepository.cs @@ -1,37 +1,122 @@ -using System; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Entities.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using ProjectFamilyBudget.Entities.Enums; -using ProjectFamilyBudget.Entities; namespace ProjectFamilyBudget.Repositories.Implementations; public class IncomeRepository : IIncome { + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + public IncomeRepository(IConnectionString connectionString, ILogger logger) + { + _connectionString = connectionString; + _logger = logger; + } public void CreateIncome(Income income) { + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(income)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryInsert = @" + INSERT INTO Income (IncomeType, Name, IncomeCategory) + VALUES (@IncomeType, @Name, @IncomeCategory)"; + connection.Execute(queryInsert, income); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; + } + } + public void UpdateIncome(Income income) + { + _logger.LogInformation("Редактирование объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(income)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryUpdate = @" + UPDATE Income + SET + IncomeType=@IncomeType, + Name=@Name, + IncomeCategory=@IncomeCategory + WHERE Id=@Id"; + connection.Execute(queryUpdate, income); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании объекта"); + throw; + } } public void DeleteIncome(int id) { - + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryDelete = @" + DELETE FROM Income + WHERE Id=@id"; + connection.Execute(queryDelete, new { id }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } + } + public Income ReadIncomeById(int id) + { + _logger.LogInformation("Получение объекта по идентификатору"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = @" + SELECT * FROM Income + WHERE Id=@id"; + var income = connection.QueryFirst(querySelect, new { id }); + _logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(income)); + return income; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при поиске объекта"); + throw; + } } public IEnumerable ReadIncome() { - return []; + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM Income"; + var incomes = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", JsonConvert.SerializeObject(incomes)); + return incomes; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } } - - public Income ReadIncomeById(int id) - { - return Income.CreateEntity(0, IncomeExpenseType.None, string.Empty, string.Empty); - } - - public void UpdateIncome(Income income) - { - throw new NotImplementedException(); - } -} \ No newline at end of file +} diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleExpenseRepository.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleExpenseRepository.cs index f847402..176cb6d 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleExpenseRepository.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleExpenseRepository.cs @@ -1,26 +1,106 @@ -using System; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using ProjectFamilyBudget.Entities; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using ProjectFamilyBudget.Entities; namespace ProjectFamilyBudget.Repositories.Implementations; public class PeopleExpenseRepository : IPeopleExpense { - public IEnumerable ReadPeopleExpense(DateTime? dateForm = null, DateTime? dateTo = null, int? peopleId = null, int? expenseId = null) + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + public PeopleExpenseRepository(IConnectionString connectionString, ILogger logger) { - return []; + _connectionString = connectionString; + _logger = logger; } - public void CreatePeopleExpense(PeopleExpense peopleExpense) { + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", + JsonConvert.SerializeObject(peopleExpense)); + try + { + using var connection = new + NpgsqlConnection(_connectionString.ConnectionString); + connection.Open(); + using var transaction = connection.BeginTransaction(); + var queryInsert = @" + INSERT INTO PeopleExpense (PeopleId, DataReciept) + VALUES (@PeopleId, @DataReciept); + SELECT MAX(Id) FROM PeopleExpense"; + var peopleExpenseId = + connection.QueryFirst(queryInsert, peopleExpense, transaction); + var querySubInsert = @" + INSERT INTO ExpensePeopleExpense (ExpenseId, PeopleExpenseId, Sum) + VALUES (@ExpenseId, @PeopleExpenseId, @Sum)"; + foreach (var elem in peopleExpense.ExpensePeopleExpenses) + { + connection.Execute(querySubInsert, new + { + peopleExpenseId, + elem.ExpenseId, + elem.Sum + }, transaction); + } + transaction.Commit(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; + } } - public void DeletPeopleExpense(int id) { + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + connection.Open(); + using var transaction = connection.BeginTransaction(); + var queryDeleteSub = @" + DELETE FROM ExpensePeopleExpense + WHERE PeopleExpenseId = @id"; + connection.Execute(queryDeleteSub, new { id }, transaction); + var queryDelete = @" + DELETE FROM PeopleExpense + WHERE Id = @id"; + connection.Execute(queryDelete, new { id }, transaction); + + transaction.Commit(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } + } + public IEnumerable ReadPeopleExpense(DateTime? dateForm = null, DateTime? dateTo = null, int? peopleId = null, int? expenseId = null) + { + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM PeopleExpense"; + var peopleExpenses = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", + JsonConvert.SerializeObject(peopleExpenses)); + return peopleExpenses; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } } } diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleIncomeRepository.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleIncomeRepository.cs index 92c68e8..7175a74 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleIncomeRepository.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleIncomeRepository.cs @@ -1,29 +1,109 @@ -using System; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using ProjectFamilyBudget.Entities; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using ProjectFamilyBudget.Entities; +using static System.Runtime.InteropServices.JavaScript.JSType; +using System.Windows.Forms; +using Unity; namespace ProjectFamilyBudget.Repositories.Implementations; public class PeopleIncomeRepository : IPeopleIncome { - public IEnumerable ReadPeopleIncome(DateTime? dateForm = null, DateTime? dateTo = null, int? peopleId = null, int? incomeId = null) + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + + public PeopleIncomeRepository(IConnectionString connectionString, ILogger logger) { - return []; + _connectionString = connectionString; + _logger = logger; } public void CreatePeopleIncome(PeopleIncome peopleIncome) { - + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", + JsonConvert.SerializeObject(peopleIncome)); + try + { + using var connection = new + NpgsqlConnection(_connectionString.ConnectionString); + connection.Open(); + using var transaction = connection.BeginTransaction(); + var queryInsert = @" + INSERT INTO PeopleIncome (PeopleId, DataReciept) + VALUES (@PeopleId, @DataReciept); + SELECT MAX(Id) FROM PeopleIncome"; + var peopleIncomeId = + connection.QueryFirst(queryInsert, peopleIncome, transaction); + var querySubInsert = @" + INSERT INTO IncomePeopleIncome (IncomeId, PeopleIncomeId, Sum) + VALUES (@IncomeId, @PeopleIncomeId, @Sum)"; + foreach (var elem in peopleIncome.IncomePeopleIncomes) + { + connection.Execute(querySubInsert, new + { + peopleIncomeId, + elem.IncomeId, + elem.Sum + }, transaction); + } + transaction.Commit(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; + } } - - public void DeletPeopleIncome(int id) { + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + connection.Open(); + using var transaction = connection.BeginTransaction(); + var queryDeleteSub = @" + DELETE FROM IncomePeopleIncome + WHERE PeopleIncomeId = @id"; + connection.Execute(queryDeleteSub, new { id }, transaction); + var queryDelete = @" + DELETE FROM PeopleIncome + WHERE Id = @id"; + connection.Execute(queryDelete, new { id }, transaction); + + transaction.Commit(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } } - - + public IEnumerable ReadPeopleIncome(DateTime? dateForm = null, DateTime? dateTo = null, int? peopleId = null, int? incomeId = null) + { + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM PeopleIncome"; + var peopleIncomes = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}", + JsonConvert.SerializeObject(peopleIncomes)); + return peopleIncomes; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } + } } - diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs index 31105a6..c52979a 100644 --- a/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs +++ b/ProjectFamilyBudget/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs @@ -1,38 +1,125 @@ -using System; +using Dapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npgsql; +using ProjectFamilyBudget.Entities; +using ProjectFamilyBudget.Entities.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using ProjectFamilyBudget.Entities.Enums; -using ProjectFamilyBudget.Entities; namespace ProjectFamilyBudget.Repositories.Implementations; public class PeopleRepository : IPeople { + private readonly IConnectionString _connectionString; + private readonly ILogger _logger; + public PeopleRepository(IConnectionString connectionString, ILogger logger) + { + _connectionString = connectionString; + _logger = logger; + } public void CreatePeople(People people) { + _logger.LogInformation("Добавление объекта"); + _logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(people)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryInsert = @" + INSERT INTO People (Name, LastName, Age, MemberType) + VALUES (@Name, @LastName, @Age, @MemberType)"; + connection.Execute(queryInsert, people); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при добавлении объекта"); + throw; + } + } + public void UpdatePeople(People people) + { + _logger.LogInformation("Редактирование объекта"); + _logger.LogDebug("Объект: {json}",JsonConvert.SerializeObject(people)); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryUpdate = @" + UPDATE People + SET + Name=@Name, + LastName=@LastName, + Age=@Age, + MemberType=@MemberType + WHERE Id=@Id"; + connection.Execute(queryUpdate, people); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при редактировании объекта"); + throw; + } } public void DeletePeople(int id) { - + _logger.LogInformation("Удаление объекта"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var queryDelete = @" + DELETE FROM People + WHERE Id=@id"; + connection.Execute(queryDelete, new { id }); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при удалении объекта"); + throw; + } } public People ReadPeopleById(int id) { - return People.CreateEntity(0, string.Empty, string.Empty, 0, FamilyMemberType.None); + _logger.LogInformation("Получение объекта по идентификатору"); + _logger.LogDebug("Объект: {id}", id); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = @" + SELECT * FROM People + WHERE Id=@id"; + var people = connection.QueryFirst(querySelect, new { id }); + _logger.LogDebug("Найденный объект: {json}", + JsonConvert.SerializeObject(people)); + return people; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при поиске объекта"); + throw; + } } public IEnumerable ReadPeople() { - return []; - } - - public void UpdatePeople(People people) - { - + _logger.LogInformation("Получение всех объектов"); + try + { + using var connection = new NpgsqlConnection(_connectionString.ConnectionString); + var querySelect = "SELECT * FROM People"; + var peoples = connection.Query(querySelect); + _logger.LogDebug("Полученные объекты: {json}",JsonConvert.SerializeObject(peoples)); + return peoples; + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка при чтении объектов"); + throw; + } } } - diff --git a/ProjectFamilyBudget/ProjectFamilyBudget/appsettings.json b/ProjectFamilyBudget/ProjectFamilyBudget/appsettings.json new file mode 100644 index 0000000..1618be4 --- /dev/null +++ b/ProjectFamilyBudget/ProjectFamilyBudget/appsettings.json @@ -0,0 +1,15 @@ +{ + "Serilog": { + "Using": [ "Serilog.Sinks.File" ], + "MinimumLevel": "Debug", + "WriteTo": [ + { + "Name": "File", + "Args": { + "path": "Logs/budget_log.txt", + "rollingInterval": "Day" + } + } + ] + } +} \ No newline at end of file