diff --git a/ProjectFamilyBudget/Entities/Enums/ExpenseCategoryType.cs b/ProjectFamilyBudget/Entities/Enums/FamilyMemberType.cs
similarity index 56%
rename from ProjectFamilyBudget/Entities/Enums/ExpenseCategoryType.cs
rename to ProjectFamilyBudget/Entities/Enums/FamilyMemberType.cs
index 7fb36be..b6fe580 100644
--- a/ProjectFamilyBudget/Entities/Enums/ExpenseCategoryType.cs
+++ b/ProjectFamilyBudget/Entities/Enums/FamilyMemberType.cs
@@ -6,14 +6,13 @@ using System.Threading.Tasks;
namespace ProjectFamilyBudget.Entities.Enums;
-[Flags]
-public enum ExpenseCategoryType
+public enum FamilyMemberType
{
None = 0,
- Cafe = 1,
- Products = 2,
- Internet = 4,
- Items = 8,
- Sport = 16,
- Relaxation = 32
-}
\ No newline at end of file
+ Father = 1,
+ Mother = 2,
+ Son = 3,
+ Daugther = 4,
+ Grandfather = 5,
+ Grandmother =6,
+}
diff --git a/ProjectFamilyBudget/Entities/Enums/IncomeCategoryType.cs b/ProjectFamilyBudget/Entities/Enums/FamilyType.cs
similarity index 64%
rename from ProjectFamilyBudget/Entities/Enums/IncomeCategoryType.cs
rename to ProjectFamilyBudget/Entities/Enums/FamilyType.cs
index ca7d3d0..dc290d0 100644
--- a/ProjectFamilyBudget/Entities/Enums/IncomeCategoryType.cs
+++ b/ProjectFamilyBudget/Entities/Enums/FamilyType.cs
@@ -6,11 +6,10 @@ using System.Threading.Tasks;
namespace ProjectFamilyBudget.Entities.Enums;
-public enum IncomeCategoryType
+public enum FamilyType
{
None = 0,
- Salary = 1,
- Underworking = 2,
- Investment = 3,
- Gift = 4,
+ Large = 1,
+ Small = 2,
+ Childress = 3,
}
diff --git a/ProjectFamilyBudget/Entities/ExpenseCategory.cs b/ProjectFamilyBudget/Entities/ExpenseCategory.cs
index 1ac1c6e..3b2419f 100644
--- a/ProjectFamilyBudget/Entities/ExpenseCategory.cs
+++ b/ProjectFamilyBudget/Entities/ExpenseCategory.cs
@@ -9,9 +9,9 @@ namespace ProjectFamilyBudget.Entities;
public class ExpenseCategory
{
public int Id { get; private set; }
- public ExpenseCategoryType Category { get; private set; }
+ public string Category { get; private set; } = string.Empty;
- public static ExpenseCategory CreateExpnseCategory(int id, ExpenseCategoryType category)
+ public static ExpenseCategory CreateExpenseCategory(int id,string category)
{
return new ExpenseCategory
{
diff --git a/ProjectFamilyBudget/Entities/Family.cs b/ProjectFamilyBudget/Entities/Family.cs
index 5eb5e34..177bd33 100644
--- a/ProjectFamilyBudget/Entities/Family.cs
+++ b/ProjectFamilyBudget/Entities/Family.cs
@@ -1,4 +1,5 @@
-using System;
+using ProjectFamilyBudget.Entities.Enums;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,12 +13,15 @@ public class Family
public string Name { get; private set; } = string.Empty;
- public static Family CreateFamily(int id, string name)
+ public FamilyType FamilyType { get; private set; }
+
+ public static Family CreateFamily(int id, string name, FamilyType familyType)
{
return new Family
{
Id = id,
- Name = name
+ Name = name,
+ FamilyType = familyType
};
}
diff --git a/ProjectFamilyBudget/Entities/IncomeCategory.cs b/ProjectFamilyBudget/Entities/IncomeCategory.cs
index ceb83fa..392b5e2 100644
--- a/ProjectFamilyBudget/Entities/IncomeCategory.cs
+++ b/ProjectFamilyBudget/Entities/IncomeCategory.cs
@@ -10,9 +10,9 @@ namespace ProjectFamilyBudget.Entities;
public class IncomeCategory
{
public int Id { get; private set; }
- public IncomeCategoryType Category { get; private set; }
+ public string Category { get; private set; } = string.Empty;
- public static IncomeCategory CreateIncomeCategory(int id, IncomeCategoryType category)
+ public static IncomeCategory CreateIncomeCategory(int id, string category)
{
return new IncomeCategory
{
diff --git a/ProjectFamilyBudget/Entities/People.cs b/ProjectFamilyBudget/Entities/People.cs
index 89eb8db..96cfcf2 100644
--- a/ProjectFamilyBudget/Entities/People.cs
+++ b/ProjectFamilyBudget/Entities/People.cs
@@ -1,4 +1,5 @@
using Microsoft.VisualBasic.FileIO;
+using ProjectFamilyBudget.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,15 +11,19 @@ namespace ProjectFamilyBudget.Entities;
public class People
{
public int Id { get; private set; }
- public string FullName { get; private set; } = string.Empty;
+ public string Name { get; private set; } = string.Empty;
+ public int Age { get; private set; }
public int FamilyId { get; private set; }
- public static People CreatePeople(int id, string fullName, int familyId)
+ public FamilyMemberType MemberType { get; private set; }
+ public static People CreatePeople(int id, string name, int age, int familyId, FamilyMemberType memberType)
{
return new People
{
Id = id,
- FullName = fullName,
- FamilyId = familyId
+ Name = name,
+ Age = age,
+ FamilyId = familyId,
+ MemberType = memberType
};
}
diff --git a/ProjectFamilyBudget/Forms/FormFamilies.Designer.cs b/ProjectFamilyBudget/Forms/FormFamilies.Designer.cs
new file mode 100644
index 0000000..7bd8a0f
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormFamilies.Designer.cs
@@ -0,0 +1,126 @@
+namespace ProjectFamilyBudget.Forms
+{
+ partial class FormFamilies
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1 = new Panel();
+ buttonCansel = new Button();
+ buttonEdit = new Button();
+ buttonAdd = new Button();
+ dataGridViewData = new DataGridView();
+ panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.Controls.Add(buttonCansel);
+ panel1.Controls.Add(buttonEdit);
+ panel1.Controls.Add(buttonAdd);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(639, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(161, 450);
+ panel1.TabIndex = 0;
+ //
+ // buttonCansel
+ //
+ buttonCansel.BackgroundImage = Properties.Resources.minus;
+ buttonCansel.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonCansel.Location = new Point(30, 245);
+ buttonCansel.Name = "buttonCansel";
+ buttonCansel.Size = new Size(103, 56);
+ buttonCansel.TabIndex = 2;
+ buttonCansel.UseVisualStyleBackColor = true;
+ buttonCansel.Click += buttonCansel_Click;
+ //
+ // buttonEdit
+ //
+ buttonEdit.BackgroundImage = Properties.Resources.pen;
+ buttonEdit.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonEdit.Location = new Point(30, 138);
+ buttonEdit.Name = "buttonEdit";
+ buttonEdit.Size = new Size(103, 56);
+ buttonEdit.TabIndex = 1;
+ buttonEdit.UseVisualStyleBackColor = true;
+ buttonEdit.Click += buttonEdit_Click;
+ //
+ // buttonAdd
+ //
+ buttonAdd.BackgroundImage = Properties.Resources.plus;
+ buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonAdd.Location = new Point(30, 23);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(103, 56);
+ buttonAdd.TabIndex = 0;
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += buttonAdd_Click;
+ //
+ // dataGridView
+ //
+ dataGridViewData.AllowUserToAddRows = false;
+ dataGridViewData.AllowUserToDeleteRows = false;
+ dataGridViewData.AllowUserToResizeColumns = false;
+ dataGridViewData.AllowUserToResizeRows = false;
+ dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewData.Dock = DockStyle.Fill;
+ dataGridViewData.Location = new Point(0, 0);
+ dataGridViewData.MultiSelect = false;
+ dataGridViewData.Name = "dataGridView";
+ dataGridViewData.ReadOnly = true;
+ dataGridViewData.RowHeadersVisible = false;
+ dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridViewData.Size = new Size(639, 450);
+ dataGridViewData.TabIndex = 1;
+ //
+ // FormFamilies
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormFamilies";
+ StartPosition = FormStartPosition.CenterParent;
+ Text = "Семьи";
+ Load += FormFamilies_Load;
+ panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private Button buttonCansel;
+ private Button buttonEdit;
+ private Button buttonAdd;
+ private DataGridView dataGridViewData;
+ }
+}
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormFamilies.cs b/ProjectFamilyBudget/Forms/FormFamilies.cs
new file mode 100644
index 0000000..6552a58
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormFamilies.cs
@@ -0,0 +1,114 @@
+using ProjectFamilyBudget.Repositories;
+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 Unity;
+
+namespace ProjectFamilyBudget.Forms
+{
+ public partial class FormFamilies : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IFamily _family;
+
+ public FormFamilies(IUnityContainer container, IFamily family)
+ {
+ InitializeComponent();
+ _container = container ??
+ throw new ArgumentNullException(nameof(container));
+ _family = family ??
+ throw new ArgumentNullException(nameof(family));
+ }
+ private void FormFamilies_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message,"Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void buttonAdd_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при добавлении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void buttonEdit_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ try
+ {
+ var form = _container.Resolve();
+ form.Id = findId;
+ form.ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при изменении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ }
+
+ private void buttonCansel_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить запись?", "Удаление",
+ MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+ try
+ {
+ _family.DeleteFamily(findId);
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при удалении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ }
+ private void LoadList() => dataGridViewData.DataSource = _family.ReadFamily;
+ private bool TryGetIdentifierFromSelectedRow(out int id)
+ {
+ id = 0;
+ if (dataGridViewData.SelectedRows.Count < 1)
+ {
+ MessageBox.Show("Нет выбранной записи", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+ id =
+ Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
+ return true;
+ }
+
+ }
+}
diff --git a/ProjectFamilyBudget/Forms/FormFamilies.resx b/ProjectFamilyBudget/Forms/FormFamilies.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormFamilies.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormFamily.Designer.cs b/ProjectFamilyBudget/Forms/FormFamily.Designer.cs
new file mode 100644
index 0000000..70a6601
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormFamily.Designer.cs
@@ -0,0 +1,120 @@
+namespace ProjectFamilyBudget.Forms
+{
+ partial class FormFamily
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ label1 = new Label();
+ label2 = new Label();
+ textBoxFamilyName = new TextBox();
+ comboBoxFamilyType = new ComboBox();
+ buttonSave = new Button();
+ buttonCansel = new Button();
+ SuspendLayout();
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(12, 17);
+ label1.Name = "label1";
+ label1.Size = new Size(96, 15);
+ label1.TabIndex = 0;
+ label1.Text = "Название семьи";
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(12, 55);
+ label2.Name = "label2";
+ label2.Size = new Size(64, 15);
+ label2.TabIndex = 1;
+ label2.Text = "Тип семьи";
+ //
+ // textBoxFamilyName
+ //
+ textBoxFamilyName.Location = new Point(114, 14);
+ textBoxFamilyName.Name = "textBoxFamilyName";
+ textBoxFamilyName.Size = new Size(190, 23);
+ textBoxFamilyName.TabIndex = 2;
+ //
+ // comboBoxFamilyType
+ //
+ comboBoxFamilyType.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxFamilyType.FormattingEnabled = true;
+ comboBoxFamilyType.Location = new Point(114, 55);
+ comboBoxFamilyType.Name = "comboBoxFamilyType";
+ comboBoxFamilyType.Size = new Size(190, 23);
+ comboBoxFamilyType.TabIndex = 3;
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(12, 102);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(122, 30);
+ buttonSave.TabIndex = 4;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += buttonSave_Click;
+ //
+ // buttonCansel
+ //
+ buttonCansel.Location = new Point(187, 102);
+ buttonCansel.Name = "buttonCansel";
+ buttonCansel.Size = new Size(117, 30);
+ buttonCansel.TabIndex = 5;
+ buttonCansel.Text = "Отмена";
+ buttonCansel.UseVisualStyleBackColor = true;
+ buttonCansel.Click += buttonCansel_Click;
+ //
+ // FormFamily
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(338, 144);
+ Controls.Add(buttonCansel);
+ Controls.Add(buttonSave);
+ Controls.Add(comboBoxFamilyType);
+ Controls.Add(textBoxFamilyName);
+ Controls.Add(label2);
+ Controls.Add(label1);
+ Name = "FormFamily";
+ StartPosition = FormStartPosition.CenterParent;
+ Text = "Семья";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label label1;
+ private Label label2;
+ private TextBox textBoxFamilyName;
+ private ComboBox comboBoxFamilyType;
+ private Button buttonSave;
+ private Button buttonCansel;
+ }
+}
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormFamily.cs b/ProjectFamilyBudget/Forms/FormFamily.cs
new file mode 100644
index 0000000..598d62a
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormFamily.cs
@@ -0,0 +1,83 @@
+using ProjectFamilyBudget.Entities;
+using ProjectFamilyBudget.Entities.Enums;
+using ProjectFamilyBudget.Repositories;
+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;
+
+namespace ProjectFamilyBudget.Forms
+{
+ public partial class FormFamily : Form
+ {
+ private readonly IFamily _family;
+ private int? _familyId;
+ public int Id
+ {
+ set
+ {
+ try
+ {
+ var family = _family.ReadFamilyById(value);
+ if (family == null)
+ {
+ throw new InvalidDataException(nameof(family));
+ }
+ textBoxFamilyName.Text = family.Name;
+ comboBoxFamilyType.SelectedItem = family.FamilyType;
+ _familyId = value;
+
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при получени данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+ }
+ public FormFamily(IFamily family)
+ {
+ InitializeComponent();
+ _family = family ??
+ throw new ArgumentNullException(nameof(family));
+ comboBoxFamilyType.DataSource = Enum.GetValues(typeof(FamilyType));
+ }
+
+ private void buttonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(textBoxFamilyName.Text)
+ ||
+ string.IsNullOrWhiteSpace(comboBoxFamilyType.Text))
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (_familyId.HasValue)
+ {
+ _family.UpdateFamily(CreateFamily(_familyId.Value));
+ }
+ else
+ {
+ _family.CreateFamily(CreateFamily(0));
+ }
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ }
+
+
+ private void buttonCansel_Click(object sender, EventArgs e) => Close();
+ private Family CreateFamily(int id) => Family.CreateFamily(id, textBoxFamilyName.Text, (FamilyType)comboBoxFamilyType.SelectedItem!);
+ }
+}
diff --git a/ProjectFamilyBudget/Forms/FormFamily.resx b/ProjectFamilyBudget/Forms/FormFamily.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormFamily.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormIncome.Designer.cs b/ProjectFamilyBudget/Forms/FormIncome.Designer.cs
new file mode 100644
index 0000000..5053d1c
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormIncome.Designer.cs
@@ -0,0 +1,39 @@
+namespace ProjectFamilyBudget.Forms
+{
+ partial class FormIncome
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "FormIncome";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormIncome.cs b/ProjectFamilyBudget/Forms/FormIncome.cs
new file mode 100644
index 0000000..1a62f76
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormIncome.cs
@@ -0,0 +1,20 @@
+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;
+
+namespace ProjectFamilyBudget.Forms
+{
+ public partial class FormIncome : Form
+ {
+ public FormIncome()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ProjectFamilyBudget/Forms/FormIncome.resx b/ProjectFamilyBudget/Forms/FormIncome.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormIncome.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormPeople.Designer.cs b/ProjectFamilyBudget/Forms/FormPeople.Designer.cs
new file mode 100644
index 0000000..0233865
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormPeople.Designer.cs
@@ -0,0 +1,169 @@
+namespace ProjectFamilyBudget.Forms
+{
+ partial class FormPeople
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ label1 = new Label();
+ textBoxPeopleName = new TextBox();
+ label2 = new Label();
+ comboBoxFamily = new ComboBox();
+ label3 = new Label();
+ numericUpDownAge = new NumericUpDown();
+ buttonSave = new Button();
+ buttonCansel = new Button();
+ label4 = new Label();
+ comboBoxMember = new ComboBox();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownAge).BeginInit();
+ SuspendLayout();
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(29, 27);
+ label1.Name = "label1";
+ label1.Size = new Size(31, 15);
+ label1.TabIndex = 0;
+ label1.Text = "Имя";
+ //
+ // textBoxPeopleName
+ //
+ textBoxPeopleName.Location = new Point(86, 24);
+ textBoxPeopleName.Name = "textBoxPeopleName";
+ textBoxPeopleName.Size = new Size(121, 23);
+ textBoxPeopleName.TabIndex = 1;
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(18, 124);
+ label2.Name = "label2";
+ label2.Size = new Size(42, 15);
+ label2.TabIndex = 2;
+ label2.Text = "Семья";
+ //
+ // comboBoxFamily
+ //
+ comboBoxFamily.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxFamily.Location = new Point(86, 121);
+ comboBoxFamily.Name = "comboBoxFamily";
+ comboBoxFamily.Size = new Size(121, 23);
+ comboBoxFamily.TabIndex = 3;
+ //
+ // label3
+ //
+ label3.AutoSize = true;
+ label3.Location = new Point(10, 76);
+ label3.Name = "label3";
+ label3.Size = new Size(50, 15);
+ label3.TabIndex = 4;
+ label3.Text = "Возраст";
+ //
+ // numericUpDownAge
+ //
+ numericUpDownAge.Location = new Point(87, 74);
+ numericUpDownAge.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
+ numericUpDownAge.Name = "numericUpDownAge";
+ numericUpDownAge.Size = new Size(120, 23);
+ numericUpDownAge.TabIndex = 5;
+ numericUpDownAge.Value = new decimal(new int[] { 1, 0, 0, 0 });
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(10, 251);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(90, 45);
+ buttonSave.TabIndex = 6;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += buttonSave_Click;
+ //
+ // buttonCansel
+ //
+ buttonCansel.Location = new Point(117, 251);
+ buttonCansel.Name = "buttonCansel";
+ buttonCansel.Size = new Size(90, 43);
+ buttonCansel.TabIndex = 7;
+ buttonCansel.Text = "Отмена";
+ buttonCansel.UseVisualStyleBackColor = true;
+ buttonCansel.Click += buttonCansel_Click;
+ //
+ // label4
+ //
+ label4.AutoSize = true;
+ label4.Location = new Point(10, 171);
+ label4.Name = "label4";
+ label4.Size = new Size(72, 15);
+ label4.TabIndex = 8;
+ label4.Text = "Член семьи";
+ //
+ // comboBoxMember
+ //
+ comboBoxMember.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxMember.FormattingEnabled = true;
+ comboBoxMember.Location = new Point(86, 168);
+ comboBoxMember.Name = "comboBoxMember";
+ comboBoxMember.Size = new Size(121, 23);
+ comboBoxMember.TabIndex = 9;
+ //
+ // FormPeople
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(232, 308);
+ Controls.Add(comboBoxMember);
+ Controls.Add(label4);
+ Controls.Add(buttonCansel);
+ Controls.Add(buttonSave);
+ Controls.Add(numericUpDownAge);
+ Controls.Add(label3);
+ Controls.Add(comboBoxFamily);
+ Controls.Add(label2);
+ Controls.Add(textBoxPeopleName);
+ Controls.Add(label1);
+ Name = "FormPeople";
+ StartPosition = FormStartPosition.CenterParent;
+ Text = "Человек";
+ ((System.ComponentModel.ISupportInitialize)numericUpDownAge).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label label1;
+ private TextBox textBoxPeopleName;
+ private Label label2;
+ private ComboBox comboBoxFamily;
+ private Label label3;
+ private NumericUpDown numericUpDownAge;
+ private Button buttonSave;
+ private Button buttonCansel;
+ private Label label4;
+ private ComboBox comboBoxMember;
+ }
+}
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormPeople.cs b/ProjectFamilyBudget/Forms/FormPeople.cs
new file mode 100644
index 0000000..9be1a10
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormPeople.cs
@@ -0,0 +1,86 @@
+using ProjectFamilyBudget.Entities;
+using ProjectFamilyBudget.Entities.Enums;
+using ProjectFamilyBudget.Repositories;
+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;
+
+namespace ProjectFamilyBudget.Forms
+{
+ public partial class FormPeople : Form
+ {
+ private readonly IPeople _people;
+ private int? _peopleId;
+ public int Id
+ {
+ set
+ {
+ try
+ {
+ var people = _people.ReadPeopleById(value);
+ if (people == null)
+ {
+ throw new InvalidDataException(nameof(people));
+ }
+ textBoxPeopleName.Text = people.Name;
+ comboBoxMember.SelectedItem = people.MemberType;
+ _peopleId = value;
+
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при получени данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+ }
+ public FormPeople(IPeople people, IFamily family)
+ {
+ InitializeComponent();
+ _people = people ??
+ throw new ArgumentNullException(nameof(people));
+ comboBoxFamily.DataSource = Enum.GetValues(typeof(int));
+ comboBoxMember.DataSource = family.ReadFamily();
+ comboBoxMember.DisplayMember = "Name";
+ comboBoxMember.ValueMember = "Id";
+ }
+
+ private void buttonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(textBoxPeopleName.Text)
+ ||
+ (comboBoxFamily.SelectedIndex < 0) || (comboBoxMember.SelectedIndex < 0))
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (_peopleId.HasValue)
+ {
+ _people.UpdatePeople(CreatePeople(_peopleId.Value));
+ }
+ else
+ {
+ _people.CreatePeople(CreatePeople(0));
+ }
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ }
+
+ private void buttonCansel_Click(object sender, EventArgs e) => Close();
+ private People CreatePeople(int id) => People.CreatePeople(id, textBoxPeopleName.Text, Convert.ToInt32(numericUpDownAge.Value),
+ familyId: (int)comboBoxFamily.SelectedValue, (FamilyMemberType)comboBoxMember.SelectedItem!);
+ }
+}
diff --git a/ProjectFamilyBudget/Forms/FormPeople.resx b/ProjectFamilyBudget/Forms/FormPeople.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormPeople.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormPeoples.Designer.cs b/ProjectFamilyBudget/Forms/FormPeoples.Designer.cs
new file mode 100644
index 0000000..74200a5
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormPeoples.Designer.cs
@@ -0,0 +1,125 @@
+namespace ProjectFamilyBudget.Forms
+{
+ partial class FormPeoples
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1 = new Panel();
+ buttonCansel = new Button();
+ buttonEdit = new Button();
+ buttonAdd = new Button();
+ dataGridViewData = new DataGridView();
+ panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.Controls.Add(buttonCansel);
+ panel1.Controls.Add(buttonEdit);
+ panel1.Controls.Add(buttonAdd);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(609, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(191, 450);
+ panel1.TabIndex = 0;
+ //
+ // buttonCansel
+ //
+ buttonCansel.BackgroundImage = Properties.Resources.minus;
+ buttonCansel.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonCansel.Location = new Point(41, 250);
+ buttonCansel.Name = "buttonCansel";
+ buttonCansel.Size = new Size(110, 64);
+ buttonCansel.TabIndex = 2;
+ buttonCansel.UseVisualStyleBackColor = true;
+ buttonCansel.Click += buttonCansel_Click;
+ //
+ // buttonEdit
+ //
+ buttonEdit.BackgroundImage = Properties.Resources.pen;
+ buttonEdit.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonEdit.Location = new Point(41, 136);
+ buttonEdit.Name = "buttonEdit";
+ buttonEdit.Size = new Size(110, 64);
+ buttonEdit.TabIndex = 1;
+ buttonEdit.UseVisualStyleBackColor = true;
+ buttonEdit.Click += buttonEdit_Click;
+ //
+ // buttonAdd
+ //
+ buttonAdd.BackgroundImage = Properties.Resources.plus;
+ buttonAdd.BackgroundImageLayout = ImageLayout.Zoom;
+ buttonAdd.Location = new Point(41, 30);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(110, 64);
+ buttonAdd.TabIndex = 0;
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += buttonAdd_Click;
+ //
+ // dataGridViewData
+ //
+ dataGridViewData.AllowUserToAddRows = false;
+ dataGridViewData.AllowUserToDeleteRows = false;
+ dataGridViewData.AllowUserToResizeColumns = false;
+ dataGridViewData.AllowUserToResizeRows = false;
+ dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewData.Dock = DockStyle.Fill;
+ dataGridViewData.Location = new Point(0, 0);
+ dataGridViewData.MultiSelect = false;
+ dataGridViewData.Name = "dataGridViewData";
+ dataGridViewData.ReadOnly = true;
+ dataGridViewData.RowHeadersVisible = false;
+ dataGridViewData.Size = new Size(609, 450);
+ dataGridViewData.TabIndex = 1;
+ //
+ // FormPeoples
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormPeoples";
+ StartPosition = FormStartPosition.CenterParent;
+ Text = "Люди";
+ Load += FormPeoples_Load;
+ panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private DataGridView dataGridViewData;
+ private Button buttonCansel;
+ private Button buttonEdit;
+ private Button buttonAdd;
+ }
+}
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Forms/FormPeoples.cs b/ProjectFamilyBudget/Forms/FormPeoples.cs
new file mode 100644
index 0000000..2f03ac9
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormPeoples.cs
@@ -0,0 +1,111 @@
+using ProjectFamilyBudget.Entities;
+using ProjectFamilyBudget.Repositories;
+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 Unity;
+
+namespace ProjectFamilyBudget.Forms
+{
+ public partial class FormPeoples : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IPeople _people;
+ public FormPeoples(IUnityContainer container, IPeople people)
+ {
+ InitializeComponent();
+ _container = container ??
+ throw new ArgumentNullException(nameof(container));
+ _people = people ??
+ throw new ArgumentNullException(nameof(people));
+ }
+ private void FormPeoples_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ private void buttonAdd_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при добавлении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void buttonEdit_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ try
+ {
+ var form = _container.Resolve();
+ form.Id = findId;
+ form.ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при изменении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void buttonCansel_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить запись?", "Удаление",
+ MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+ try
+ {
+ _people.DeletePeople(findId);
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при удалении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ private void LoadList() => dataGridViewData.DataSource = _people.ReadPeople;
+ private bool TryGetIdentifierFromSelectedRow(out int id)
+ {
+ id = 0;
+ if (dataGridViewData.SelectedRows.Count < 1)
+ {
+ MessageBox.Show("Нет выбранной записи", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+ id =
+ Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
+ return true;
+ }
+
+ }
+}
diff --git a/ProjectFamilyBudget/Forms/FormPeoples.resx b/ProjectFamilyBudget/Forms/FormPeoples.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectFamilyBudget/Forms/FormPeoples.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectFamilyBudget/ProjectFamilyBudget.csproj b/ProjectFamilyBudget/ProjectFamilyBudget.csproj
index c19bde1..accbdf0 100644
--- a/ProjectFamilyBudget/ProjectFamilyBudget.csproj
+++ b/ProjectFamilyBudget/ProjectFamilyBudget.csproj
@@ -27,8 +27,4 @@
-
-
-
-
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Properties/Resources.Designer.cs b/ProjectFamilyBudget/Properties/Resources.Designer.cs
index 93a94f6..f55cd88 100644
--- a/ProjectFamilyBudget/Properties/Resources.Designer.cs
+++ b/ProjectFamilyBudget/Properties/Resources.Designer.cs
@@ -60,6 +60,36 @@ namespace ProjectFamilyBudget.Properties {
}
}
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap minus {
+ get {
+ object obj = ResourceManager.GetObject("minus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap pen {
+ get {
+ object obj = ResourceManager.GetObject("pen", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap plus {
+ get {
+ object obj = ResourceManager.GetObject("plus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
///
diff --git a/ProjectFamilyBudget/Properties/Resources.resx b/ProjectFamilyBudget/Properties/Resources.resx
index 0427bd9..9f6e4bc 100644
--- a/ProjectFamilyBudget/Properties/Resources.resx
+++ b/ProjectFamilyBudget/Properties/Resources.resx
@@ -121,4 +121,13 @@
..\Resources\свинка.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\minus.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\pen.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/ProjectFamilyBudget/Repositories/IExpenseCategory.cs b/ProjectFamilyBudget/Repositories/IExpenseCategory.cs
index 20d26c1..b8a1dbb 100644
--- a/ProjectFamilyBudget/Repositories/IExpenseCategory.cs
+++ b/ProjectFamilyBudget/Repositories/IExpenseCategory.cs
@@ -10,6 +10,8 @@ namespace ProjectFamilyBudget.Repositories;
public interface IExpenseCategory
{
IEnumerable ReadExpenseCategory();
+ ExpenseCategory ReadExpenseCategoryById(int id);
void CreateExpenseCategory(ExpenseCategory expenseCategory);
+ void UpdateExpenseCategory(Family family);
void DeleteExpenseCategory(int id);
}
diff --git a/ProjectFamilyBudget/Repositories/IIncomeCategory.cs b/ProjectFamilyBudget/Repositories/IIncomeCategory.cs
index 681f034..b7b952c 100644
--- a/ProjectFamilyBudget/Repositories/IIncomeCategory.cs
+++ b/ProjectFamilyBudget/Repositories/IIncomeCategory.cs
@@ -10,6 +10,8 @@ namespace ProjectFamilyBudget.Repositories;
public interface IIncomeCategory
{
IEnumerable ReadIncomeCategory();
+ IncomeCategory ReadIncomeCategoryById(int id);
void CreateIncomeCategory(IncomeCategory IncomeCategory);
+ void UpdateIncomeCategory(Family family);
void DeleteIncomeCategory(int id);
}
diff --git a/ProjectFamilyBudget/Repositories/Implementations/ExpenseCategoryRepository.cs b/ProjectFamilyBudget/Repositories/Implementations/ExpenseCategoryRepository.cs
index 5a2b36f..731afc4 100644
--- a/ProjectFamilyBudget/Repositories/Implementations/ExpenseCategoryRepository.cs
+++ b/ProjectFamilyBudget/Repositories/Implementations/ExpenseCategoryRepository.cs
@@ -21,4 +21,14 @@ public class ExpenseCategoryRepository : IExpenseCategory
{
return [];
}
+
+ public ExpenseCategory ReadExpenseCategoryById(int id)
+ {
+ return ExpenseCategory.CreateExpenseCategory(0,string.Empty);
+ }
+
+ public void UpdateExpenseCategory(Family family)
+ {
+
+ }
}
diff --git a/ProjectFamilyBudget/Repositories/Implementations/FamilyRepository.cs b/ProjectFamilyBudget/Repositories/Implementations/FamilyRepository.cs
index 20384b2..c1c6588 100644
--- a/ProjectFamilyBudget/Repositories/Implementations/FamilyRepository.cs
+++ b/ProjectFamilyBudget/Repositories/Implementations/FamilyRepository.cs
@@ -26,7 +26,7 @@ public class FamilyRepository : IFamily
public Family ReadFamilyById(int id)
{
- return Family.CreateFamily(0, string.Empty);
+ return Family.CreateFamily(0, string.Empty, 0);
}
public void UpdateFamily(Family family)
diff --git a/ProjectFamilyBudget/Repositories/Implementations/IncomeCategoryRepository.cs b/ProjectFamilyBudget/Repositories/Implementations/IncomeCategoryRepository.cs
index 35eb319..7e01aa1 100644
--- a/ProjectFamilyBudget/Repositories/Implementations/IncomeCategoryRepository.cs
+++ b/ProjectFamilyBudget/Repositories/Implementations/IncomeCategoryRepository.cs
@@ -23,4 +23,14 @@ public class IncomeCategoryRepository : IIncomeCategory
{
return [];
}
+
+ public IncomeCategory ReadIncomeCategoryById(int id)
+ {
+ return IncomeCategory.CreateIncomeCategory(0,string.Empty);
+ }
+
+ public void UpdateIncomeCategory(Family family)
+ {
+
+ }
}
diff --git a/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs b/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs
index 37824cd..969892a 100644
--- a/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs
+++ b/ProjectFamilyBudget/Repositories/Implementations/PeopleRepository.cs
@@ -21,7 +21,7 @@ public class PeopleRepository : IPeople
public People ReadPeopleById(int id)
{
- return People.CreatePeople(0, string.Empty, 0);
+ return People.CreatePeople(0, string.Empty, 0, 0, 0);
}
public IEnumerable ReadPeople()
diff --git a/ProjectFamilyBudget/Resources/minus.jpg b/ProjectFamilyBudget/Resources/minus.jpg
new file mode 100644
index 0000000..39b7147
Binary files /dev/null and b/ProjectFamilyBudget/Resources/minus.jpg differ
diff --git a/ProjectFamilyBudget/Resources/pen.png b/ProjectFamilyBudget/Resources/pen.png
new file mode 100644
index 0000000..39999eb
Binary files /dev/null and b/ProjectFamilyBudget/Resources/pen.png differ
diff --git a/ProjectFamilyBudget/Resources/plus.png b/ProjectFamilyBudget/Resources/plus.png
new file mode 100644
index 0000000..95bb2f3
Binary files /dev/null and b/ProjectFamilyBudget/Resources/plus.png differ