Compare commits
2 Commits
a137a4097b
...
f9be6e14b0
Author | SHA1 | Date | |
---|---|---|---|
f9be6e14b0 | |||
e4b40576b0 |
@ -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
|
||||
}
|
||||
Father = 1,
|
||||
Mother = 2,
|
||||
Son = 3,
|
||||
Daugther = 4,
|
||||
Grandfather = 5,
|
||||
Grandmother =6,
|
||||
}
|
@ -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,
|
||||
}
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -23,5 +23,4 @@ public class Income
|
||||
IncomeCategoryId = incomeCategoryId
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
126
ProjectFamilyBudget/Forms/FormFamilies.Designer.cs
generated
Normal file
126
ProjectFamilyBudget/Forms/FormFamilies.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace ProjectFamilyBudget.Forms
|
||||
{
|
||||
partial class FormFamilies
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
114
ProjectFamilyBudget/Forms/FormFamilies.cs
Normal file
114
ProjectFamilyBudget/Forms/FormFamilies.cs
Normal file
@ -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<FormFamily>().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<FormFamily>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
ProjectFamilyBudget/Forms/FormFamilies.resx
Normal file
120
ProjectFamilyBudget/Forms/FormFamilies.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
120
ProjectFamilyBudget/Forms/FormFamily.Designer.cs
generated
Normal file
120
ProjectFamilyBudget/Forms/FormFamily.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
||||
namespace ProjectFamilyBudget.Forms
|
||||
{
|
||||
partial class FormFamily
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
83
ProjectFamilyBudget/Forms/FormFamily.cs
Normal file
83
ProjectFamilyBudget/Forms/FormFamily.cs
Normal file
@ -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!);
|
||||
}
|
||||
}
|
120
ProjectFamilyBudget/Forms/FormFamily.resx
Normal file
120
ProjectFamilyBudget/Forms/FormFamily.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
39
ProjectFamilyBudget/Forms/FormIncome.Designer.cs
generated
Normal file
39
ProjectFamilyBudget/Forms/FormIncome.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace ProjectFamilyBudget.Forms
|
||||
{
|
||||
partial class FormIncome
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
20
ProjectFamilyBudget/Forms/FormIncome.cs
Normal file
20
ProjectFamilyBudget/Forms/FormIncome.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectFamilyBudget/Forms/FormIncome.resx
Normal file
120
ProjectFamilyBudget/Forms/FormIncome.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
169
ProjectFamilyBudget/Forms/FormPeople.Designer.cs
generated
Normal file
169
ProjectFamilyBudget/Forms/FormPeople.Designer.cs
generated
Normal file
@ -0,0 +1,169 @@
|
||||
namespace ProjectFamilyBudget.Forms
|
||||
{
|
||||
partial class FormPeople
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
86
ProjectFamilyBudget/Forms/FormPeople.cs
Normal file
86
ProjectFamilyBudget/Forms/FormPeople.cs
Normal file
@ -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!);
|
||||
}
|
||||
}
|
120
ProjectFamilyBudget/Forms/FormPeople.resx
Normal file
120
ProjectFamilyBudget/Forms/FormPeople.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
125
ProjectFamilyBudget/Forms/FormPeoples.Designer.cs
generated
Normal file
125
ProjectFamilyBudget/Forms/FormPeoples.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace ProjectFamilyBudget.Forms
|
||||
{
|
||||
partial class FormPeoples
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
111
ProjectFamilyBudget/Forms/FormPeoples.cs
Normal file
111
ProjectFamilyBudget/Forms/FormPeoples.cs
Normal file
@ -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<FormFamily>().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<FormFamily>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
ProjectFamilyBudget/Forms/FormPeoples.resx
Normal file
120
ProjectFamilyBudget/Forms/FormPeoples.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -27,8 +27,4 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Forms\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
30
ProjectFamilyBudget/Properties/Resources.Designer.cs
generated
30
ProjectFamilyBudget/Properties/Resources.Designer.cs
generated
@ -60,6 +60,36 @@ namespace ProjectFamilyBudget.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap minus {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("minus", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap pen {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("pen", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap plus {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("plus", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -121,4 +121,13 @@
|
||||
<data name="свинка" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\свинка.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="minus" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\minus.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="pen" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\pen.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -10,6 +10,8 @@ namespace ProjectFamilyBudget.Repositories;
|
||||
public interface IExpenseCategory
|
||||
{
|
||||
IEnumerable<ExpenseCategory> ReadExpenseCategory();
|
||||
ExpenseCategory ReadExpenseCategoryById(int id);
|
||||
void CreateExpenseCategory(ExpenseCategory expenseCategory);
|
||||
void UpdateExpenseCategory(Family family);
|
||||
void DeleteExpenseCategory(int id);
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ namespace ProjectFamilyBudget.Repositories;
|
||||
public interface IIncomeCategory
|
||||
{
|
||||
IEnumerable<IncomeCategory> ReadIncomeCategory();
|
||||
IncomeCategory ReadIncomeCategoryById(int id);
|
||||
void CreateIncomeCategory(IncomeCategory IncomeCategory);
|
||||
void UpdateIncomeCategory(Family family);
|
||||
void DeleteIncomeCategory(int id);
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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<People> ReadPeople()
|
||||
|
BIN
ProjectFamilyBudget/Resources/minus.jpg
Normal file
BIN
ProjectFamilyBudget/Resources/minus.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
ProjectFamilyBudget/Resources/pen.png
Normal file
BIN
ProjectFamilyBudget/Resources/pen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
BIN
ProjectFamilyBudget/Resources/plus.png
Normal file
BIN
ProjectFamilyBudget/Resources/plus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
Loading…
Reference in New Issue
Block a user