Compare commits

...

6 Commits
main ... Laba1

70 changed files with 5097 additions and 77 deletions

View File

@ -9,4 +9,23 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -0,0 +1,21 @@

namespace Accounting_Time_It_Company.Entities;
public class Client
{
public int Id { get; private set; }
public string NameClient { get; private set; } = string.Empty;
public string Phone { get; private set; } = string.Empty;
public static Client CreateEntity(int id, string nameClaent, string phone)
{
return new Client
{
Id = id,
NameClient = nameClaent,
Phone = phone
};
}
}

View File

@ -0,0 +1,27 @@

namespace Accounting_Time_It_Company.Entities;
public class Employee
{
public int Id { get; private set; }
public int PostId { get; private set; }
public string Name { get; private set; } = string.Empty;
public string Phone { get; private set; } = string.Empty;
public float Allowance { get; private set; }
public static Employee CreateEntity(int id, int postId, string name, string phone, float allowance)
{
return new Employee
{
Id = id,
PostId = postId,
Name = name,
Phone = phone,
Allowance = allowance,
};
}
}

View File

@ -0,0 +1,8 @@
namespace Accounting_Time_It_Company.Entities.Enums;
public enum TypePost
{
None = 0,
Developer = 1,
Manager = 2
}

View File

@ -0,0 +1,14 @@

namespace Accounting_Time_It_Company.Entities.Enums;
[Flags]
public enum TypeProduct
{
None = 0,
Development = 1,
Suppurt = 2,
Supervision = 4
}

View File

@ -0,0 +1,25 @@
using Accounting_Time_It_Company.Entities.Enums;
namespace Accounting_Time_It_Company.Entities;
public class Post
{
public int Id { get; private set; }
public TypePost NamePost { get; private set; }
public string LevelPost { get; private set; } = string.Empty;
public int Wage { get; private set; }
public static Post CreateEntity(int id, TypePost namePost, string levelPost, int wage)
{
return new Post
{
Id = id,
NamePost = namePost,
LevelPost = levelPost,
Wage = wage
};
}
}

View File

@ -0,0 +1,25 @@
using Accounting_Time_It_Company.Entities.Enums;
namespace Accounting_Time_It_Company.Entities;
public class Product
{
public int Id { get; private set; }
public int ClientId { get; private set; }
public string Name { get; private set; } = string.Empty;
public TypeProduct Type { get; private set; }
public static Product CreateEntity(int id, int clientId, string name, TypeProduct type)
{
return new Product
{
Id = id,
ClientId = clientId,
Name = name,
Type = type
};
}
}

View File

@ -0,0 +1,34 @@

namespace Accounting_Time_It_Company.Entities;
public class TypeJob
{
public int Id { get; private set; }
public int ProductId { get; private set; }
public string Description { get; private set; } = string.Empty;
public int AllowanceForJob { get; private set; }
public DateTime Date { get; private set; }
public IEnumerable<WorkTime> WorkTimesDevelop { get; private set; } = [];
public IEnumerable<WorkTime> WorkTimesManager { get; private set; } = [];
public static TypeJob CreateOperation(int id, int productId, string discription, int allowanceForJob,
IEnumerable<WorkTime> workTimesDevelop, IEnumerable<WorkTime> workTimesManager)
{
return new TypeJob
{
Id = id,
ProductId = productId,
Description = discription,
AllowanceForJob = allowanceForJob,
Date = DateTime.Now,
WorkTimesDevelop = workTimesDevelop,
WorkTimesManager = workTimesManager
};
}
}

View File

@ -0,0 +1,24 @@

namespace Accounting_Time_It_Company.Entities;
public class Vacation
{
public int Id { get; private set; }
public int EmployeeId { get; private set; }
public DateTime StartDate { get; private set; }
public DateTime EndDate { get; private set; }
public static Vacation CreateOpeartion(int id, int EmployeeId, DateTime startDate, DateTime endDate)
{
return new Vacation
{
Id = id,
EmployeeId = EmployeeId,
StartDate = startDate,
EndDate = endDate
};
}
}

View File

@ -0,0 +1,21 @@

namespace Accounting_Time_It_Company.Entities;
public class WorkTime
{
public int Id { get; private set; }
public int EmployeeId { get; private set; }
public int Hours { get; private set; }
public static WorkTime CreateElement(int id, int employeeId, int hours)
{
return new WorkTime
{
Id = id,
EmployeeId = employeeId,
Hours = hours
};
}
}

View File

@ -1,39 +0,0 @@
namespace Accounting_Time_It_Company
{
partial class Form1
{
/// <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 = "Form1";
}
#endregion
}
}

View File

@ -1,10 +0,0 @@
namespace Accounting_Time_It_Company
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,147 @@
namespace Accounting_Time_It_Company
{
partial class FormCompany
{
/// <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()
{
menuStrip1 = new MenuStrip();
directorysToolStripMenuItem = new ToolStripMenuItem();
PostsToolStripMenuItem = new ToolStripMenuItem();
ClientsToolStripMenuItem = new ToolStripMenuItem();
ProductsToolStripMenuItem = new ToolStripMenuItem();
EmployeesToolStripMenuItem = new ToolStripMenuItem();
operationsToolStripMenuItem = new ToolStripMenuItem();
vacationsToolStripMenuItem = new ToolStripMenuItem();
typeJobsРаботуToolStripMenuItem = new ToolStripMenuItem();
reportsToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { directorysToolStripMenuItem, operationsToolStripMenuItem, reportsToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(877, 28);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip";
//
// directorysToolStripMenuItem
//
directorysToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { PostsToolStripMenuItem, ClientsToolStripMenuItem, ProductsToolStripMenuItem, EmployeesToolStripMenuItem });
directorysToolStripMenuItem.Name = "directorysToolStripMenuItem";
directorysToolStripMenuItem.Size = new Size(117, 24);
directorysToolStripMenuItem.Text = "Справочники";
//
// PostsToolStripMenuItem
//
PostsToolStripMenuItem.Name = "PostsToolStripMenuItem";
PostsToolStripMenuItem.Size = new Size(170, 26);
PostsToolStripMenuItem.Text = "Должности";
PostsToolStripMenuItem.Click += PostsToolStripMenuItem_Click;
//
// ClientsToolStripMenuItem
//
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
ClientsToolStripMenuItem.Size = new Size(170, 26);
ClientsToolStripMenuItem.Text = "Клиенты";
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
//
// ProductsToolStripMenuItem
//
ProductsToolStripMenuItem.Name = "ProductsToolStripMenuItem";
ProductsToolStripMenuItem.Size = new Size(170, 26);
ProductsToolStripMenuItem.Text = "Проекты";
ProductsToolStripMenuItem.Click += ProductsToolStripMenuItem_Click;
//
// EmployeesToolStripMenuItem
//
EmployeesToolStripMenuItem.Name = "EmployeesToolStripMenuItem";
EmployeesToolStripMenuItem.Size = new Size(170, 26);
EmployeesToolStripMenuItem.Text = "Работник";
EmployeesToolStripMenuItem.Click += EmployeesToolStripMenuItem_Click;
//
// operationsToolStripMenuItem
//
operationsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { vacationsToolStripMenuItem, typeJobsРаботуToolStripMenuItem });
operationsToolStripMenuItem.Name = "operationsToolStripMenuItem";
operationsToolStripMenuItem.Size = new Size(95, 24);
operationsToolStripMenuItem.Text = "Операции";
//
// vacationsToolStripMenuItem
//
vacationsToolStripMenuItem.Name = "vacationsToolStripMenuItem";
vacationsToolStripMenuItem.Size = new Size(227, 26);
vacationsToolStripMenuItem.Text = "Отправить в отпуск";
vacationsToolStripMenuItem.Click += VacationsToolStripMenuItem_Click;
//
// typeJobsРаботуToolStripMenuItem
//
typeJobsРаботуToolStripMenuItem.Name = "typeJobsРаботуToolStripMenuItem";
typeJobsРаботуToolStripMenuItem.Size = new Size(227, 26);
typeJobsРаботуToolStripMenuItem.Text = "Добавит работу";
typeJobsРаботуToolStripMenuItem.Click += TypeJobsToolStripMenuItem_Click;
//
// reportsToolStripMenuItem
//
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
reportsToolStripMenuItem.Size = new Size(73, 24);
reportsToolStripMenuItem.Text = "Отчеты";
//
// FormCompany
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.BG;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(877, 482);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "FormCompany";
StartPosition = FormStartPosition.CenterScreen;
Text = "IT Компания";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem directorysToolStripMenuItem;
private ToolStripMenuItem PostsToolStripMenuItem;
private ToolStripMenuItem ClientsToolStripMenuItem;
private ToolStripMenuItem ProductsToolStripMenuItem;
private ToolStripMenuItem operationsToolStripMenuItem;
private ToolStripMenuItem vacationsToolStripMenuItem;
private ToolStripMenuItem typeJobsРаботуToolStripMenuItem;
private ToolStripMenuItem reportsToolStripMenuItem;
private ToolStripMenuItem EmployeesToolStripMenuItem;
}
}

View File

@ -0,0 +1,94 @@
using Accounting_Time_It_Company.Forms;
using Unity;
namespace Accounting_Time_It_Company
{
public partial class FormCompany : Form
{
private readonly IUnityContainer _container;
public FormCompany(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void PostsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPosts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormClients>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ProductsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormProducts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void EmployeesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormEmployees>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void VacationsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormVacations>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void TypeJobsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormTypeJobs>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,119 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormClient
{
/// <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()
{
labelName = new Label();
textBoxName = new TextBox();
labelPhone = new Label();
buttonSave = new Button();
buttonCansle = new Button();
maskedTextBoxPhone = new MaskedTextBox();
SuspendLayout();
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(12, 28);
labelName.Name = "labelName";
labelName.Size = new Size(42, 20);
labelName.TabIndex = 0;
labelName.Text = "Имя:";
//
// textBoxName
//
textBoxName.Location = new Point(95, 25);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(203, 27);
textBoxName.TabIndex = 1;
//
// labelPhone
//
labelPhone.AutoSize = true;
labelPhone.Location = new Point(12, 83);
labelPhone.Name = "labelPhone";
labelPhone.Size = new Size(72, 20);
labelPhone.TabIndex = 2;
labelPhone.Text = "Телефон:";
//
// buttonSave
//
buttonSave.Location = new Point(95, 181);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 4;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCansle
//
buttonCansle.Location = new Point(204, 181);
buttonCansle.Name = "buttonCansle";
buttonCansle.Size = new Size(94, 29);
buttonCansle.TabIndex = 5;
buttonCansle.Text = "Отмена";
buttonCansle.UseVisualStyleBackColor = true;
buttonCansle.Click += ButtonCansle_Click;
//
// maskedTextBoxPhone
//
maskedTextBoxPhone.Location = new Point(95, 80);
maskedTextBoxPhone.Mask = "000 000 0000";
maskedTextBoxPhone.Name = "maskedTextBoxPhone";
maskedTextBoxPhone.Size = new Size(203, 27);
maskedTextBoxPhone.TabIndex = 6;
//
// FormClient
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(310, 239);
Controls.Add(maskedTextBoxPhone);
Controls.Add(buttonCansle);
Controls.Add(buttonSave);
Controls.Add(labelPhone);
Controls.Add(textBoxName);
Controls.Add(labelName);
Name = "FormClient";
StartPosition = FormStartPosition.CenterParent;
Text = "Клиент";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelName;
private TextBox textBoxName;
private Label labelPhone;
private Button buttonSave;
private Button buttonCansle;
private MaskedTextBox maskedTextBoxPhone;
}
}

View File

@ -0,0 +1,72 @@
using Accounting_Time_It_Company.Entities;
using Accounting_Time_It_Company.Repositories;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormClient : Form
{
private readonly IClientRepositories _clientRepositories;
private int? _clientId;
public int Id
{
set
{
try
{
var client = _clientRepositories.ReadClientById(value);
if (client == null)
{
throw new InvalidDataException(nameof(client));
}
textBoxName.Text = client.NameClient;
maskedTextBoxPhone.Text = client.Phone.ToString();
_clientId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении двнных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormClient(IClientRepositories clientRepositories)
{
InitializeComponent();
_clientRepositories = clientRepositories ?? throw new ArgumentNullException(nameof(clientRepositories));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
string.IsNullOrWhiteSpace(maskedTextBoxPhone.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_clientId.HasValue)
{
_clientRepositories.UpdateClient(CreateClient(_clientId.Value));
}
else
{
_clientRepositories.CreateClient(CreateClient(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCansle_Click(object sender, EventArgs e) => Close();
private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text, maskedTextBoxPhone.Text);
}
}

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
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
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>
@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -0,0 +1,127 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormClients
{
/// <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();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
dataGridViewData = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonDelete);
panel1.Controls.Add(buttonUpdate);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(686, 0);
panel1.Name = "panel1";
panel1.Size = new Size(114, 450);
panel1.TabIndex = 0;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(8, 280);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 94);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(8, 167);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(94, 94);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(8, 59);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 94);
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.RowHeadersWidth = 51;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(686, 450);
dataGridViewData.TabIndex = 1;
//
// FormClients
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel1);
Name = "FormClients";
StartPosition = FormStartPosition.CenterParent;
Text = "Клиенты";
Load += FormClients_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,98 @@
using Accounting_Time_It_Company.Repositories;
using Unity;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormClients : Form
{
private readonly IUnityContainer _container;
private readonly IClientRepositories _clientRepositories;
public FormClients(IUnityContainer container, IClientRepositories clientRepositories)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_clientRepositories = clientRepositories ?? throw new ArgumentNullException(nameof(clientRepositories));
}
private void FormClients_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<FormClient>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormClient>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDelete_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_clientRepositories.DeleteClient(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _clientRepositories.ReadClients();
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;
}
}
}

View 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>

View File

@ -0,0 +1,169 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormEmployee
{
/// <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()
{
maskedTextBoxPhone = new MaskedTextBox();
buttonCansle = new Button();
buttonSave = new Button();
labelPhone = new Label();
textBoxName = new TextBox();
labelName = new Label();
labelPost = new Label();
labelAllowance = new Label();
comboBoxPost = new ComboBox();
numericUpDownAllowance = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)numericUpDownAllowance).BeginInit();
SuspendLayout();
//
// maskedTextBoxPhone
//
maskedTextBoxPhone.Location = new Point(107, 84);
maskedTextBoxPhone.Mask = "000 000 0000";
maskedTextBoxPhone.Name = "maskedTextBoxPhone";
maskedTextBoxPhone.Size = new Size(205, 27);
maskedTextBoxPhone.TabIndex = 12;
//
// buttonCansle
//
buttonCansle.Location = new Point(218, 242);
buttonCansle.Name = "buttonCansle";
buttonCansle.Size = new Size(94, 29);
buttonCansle.TabIndex = 11;
buttonCansle.Text = "Отмена";
buttonCansle.UseVisualStyleBackColor = true;
buttonCansle.Click += ButtonCansle_Click;
//
// buttonSave
//
buttonSave.Location = new Point(109, 242);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 10;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// labelPhone
//
labelPhone.AutoSize = true;
labelPhone.Location = new Point(14, 87);
labelPhone.Name = "labelPhone";
labelPhone.Size = new Size(72, 20);
labelPhone.TabIndex = 9;
labelPhone.Text = "Телефон:";
//
// textBoxName
//
textBoxName.Location = new Point(107, 28);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(205, 27);
textBoxName.TabIndex = 8;
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(14, 31);
labelName.Name = "labelName";
labelName.Size = new Size(42, 20);
labelName.TabIndex = 7;
labelName.Text = "Имя:";
//
// labelPost
//
labelPost.AutoSize = true;
labelPost.Location = new Point(14, 139);
labelPost.Name = "labelPost";
labelPost.Size = new Size(89, 20);
labelPost.TabIndex = 13;
labelPost.Text = "Должность:";
//
// labelAllowance
//
labelAllowance.AutoSize = true;
labelAllowance.Location = new Point(14, 189);
labelAllowance.Name = "labelAllowance";
labelAllowance.Size = new Size(79, 20);
labelAllowance.TabIndex = 14;
labelAllowance.Text = "Надбавка:";
//
// comboBoxPost
//
comboBoxPost.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPost.FormattingEnabled = true;
comboBoxPost.Location = new Point(107, 136);
comboBoxPost.Name = "comboBoxPost";
comboBoxPost.Size = new Size(205, 28);
comboBoxPost.TabIndex = 15;
//
// numericUpDownAllowance
//
numericUpDownAllowance.DecimalPlaces = 2;
numericUpDownAllowance.Location = new Point(107, 187);
numericUpDownAllowance.Maximum = new decimal(new int[] { 1, 0, 0, 0 });
numericUpDownAllowance.Name = "numericUpDownAllowance";
numericUpDownAllowance.Size = new Size(205, 27);
numericUpDownAllowance.TabIndex = 16;
//
// FormEmployee
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(349, 303);
Controls.Add(numericUpDownAllowance);
Controls.Add(comboBoxPost);
Controls.Add(labelAllowance);
Controls.Add(labelPost);
Controls.Add(maskedTextBoxPhone);
Controls.Add(buttonCansle);
Controls.Add(buttonSave);
Controls.Add(labelPhone);
Controls.Add(textBoxName);
Controls.Add(labelName);
Name = "FormEmployee";
StartPosition = FormStartPosition.CenterParent;
Text = "Работник";
((System.ComponentModel.ISupportInitialize)numericUpDownAllowance).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MaskedTextBox maskedTextBoxPhone;
private Button buttonCansle;
private Button buttonSave;
private Label labelPhone;
private TextBox textBoxName;
private Label labelName;
private Label labelPost;
private Label labelAllowance;
private ComboBox comboBoxPost;
private NumericUpDown numericUpDownAllowance;
}
}

View File

@ -0,0 +1,80 @@
using Accounting_Time_It_Company.Entities;
using Accounting_Time_It_Company.Repositories;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormEmployee : Form
{
private readonly IEmployeeRepositories _employeeRepositories;
private int? _employeeId;
public int Id
{
set
{
try
{
var employee = _employeeRepositories.ReadEmployeeById(value);
if (employee == null)
{
throw new InvalidDataException(nameof(employee));
}
textBoxName.Text = employee.Name;
maskedTextBoxPhone.Text = employee.Phone.ToString();
comboBoxPost.SelectedValue = employee.PostId;
labelAllowance.Text = employee.Allowance.ToString();
_employeeId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении двнных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormEmployee(IEmployeeRepositories employeeRepositories, IPostRepositories postRepositories)
{
InitializeComponent();
_employeeRepositories = employeeRepositories ?? throw new ArgumentNullException(nameof(employeeRepositories));
comboBoxPost.DataSource = postRepositories.ReadPosts();
comboBoxPost.DisplayMember = "NamePost";
comboBoxPost.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
string.IsNullOrWhiteSpace(maskedTextBoxPhone.Text) ||
comboBoxPost.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
if (_employeeId.HasValue)
{
_employeeRepositories.UpdateEmployee(CreateEmployee(_employeeId.Value));
}
else
{
_employeeRepositories.CreateEmployee(CreateEmployee(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCansle_Click(object sender, EventArgs e) => Close();
private Employee CreateEmployee(int id) => Employee.CreateEntity(id, (int)comboBoxPost.SelectedValue!, textBoxName.Text,
maskedTextBoxPhone.Text, (float)numericUpDownAllowance.Value);
}
}

View 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>

View File

@ -0,0 +1,127 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormEmployees
{
/// <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()
{
dataGridViewData = new DataGridView();
panel1 = new Panel();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// 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.RowHeadersWidth = 51;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(686, 450);
dataGridViewData.TabIndex = 3;
//
// panel1
//
panel1.Controls.Add(buttonDelete);
panel1.Controls.Add(buttonUpdate);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(686, 0);
panel1.Name = "panel1";
panel1.Size = new Size(114, 450);
panel1.TabIndex = 2;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(8, 280);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 94);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(8, 167);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(94, 94);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(8, 59);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 94);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// FormEmployees
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel1);
Name = "FormEmployees";
StartPosition = FormStartPosition.CenterParent;
Text = "Работники";
Load += FormEmployees_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel1;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,98 @@
using Accounting_Time_It_Company.Repositories;
using Unity;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormEmployees : Form
{
private readonly IUnityContainer _container;
private readonly IEmployeeRepositories _employeeRepositories;
public FormEmployees(IUnityContainer container, IEmployeeRepositories employeeRepositories)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_employeeRepositories = employeeRepositories ?? throw new ArgumentNullException(nameof(employeeRepositories));
}
private void FormEmployees_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<FormEmployee>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormEmployee>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDelete_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_employeeRepositories.DeleteEmployee(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _employeeRepositories.ReadEmployees();
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;
}
}
}

View 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>

View File

@ -0,0 +1,148 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormPost
{
/// <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()
{
numericUpDownWage = new NumericUpDown();
labelAllowance = new Label();
labelName = new Label();
buttonCansle = new Button();
buttonSave = new Button();
comboBoxName = new ComboBox();
labelLevelPost = new Label();
textBoxLevelPost = new TextBox();
((System.ComponentModel.ISupportInitialize)numericUpDownWage).BeginInit();
SuspendLayout();
//
// numericUpDownWage
//
numericUpDownWage.DecimalPlaces = 2;
numericUpDownWage.Location = new Point(132, 87);
numericUpDownWage.Maximum = new decimal(new int[] { 500, 0, 0, 0 });
numericUpDownWage.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownWage.Name = "numericUpDownWage";
numericUpDownWage.Size = new Size(205, 27);
numericUpDownWage.TabIndex = 20;
numericUpDownWage.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// labelAllowance
//
labelAllowance.AutoSize = true;
labelAllowance.Location = new Point(13, 89);
labelAllowance.Name = "labelAllowance";
labelAllowance.Size = new Size(80, 20);
labelAllowance.TabIndex = 19;
labelAllowance.Text = "Зарплата: ";
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(13, 18);
labelName.Name = "labelName";
labelName.Size = new Size(119, 20);
labelName.TabIndex = 17;
labelName.Text = "Наименование:";
//
// buttonCansle
//
buttonCansle.Location = new Point(243, 120);
buttonCansle.Name = "buttonCansle";
buttonCansle.Size = new Size(94, 29);
buttonCansle.TabIndex = 22;
buttonCansle.Text = "Отмена";
buttonCansle.UseVisualStyleBackColor = true;
buttonCansle.Click += ButtonCansle_Click;
//
// buttonSave
//
buttonSave.Location = new Point(132, 120);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 21;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// comboBoxName
//
comboBoxName.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxName.FormattingEnabled = true;
comboBoxName.Location = new Point(132, 15);
comboBoxName.Name = "comboBoxName";
comboBoxName.Size = new Size(205, 28);
comboBoxName.TabIndex = 23;
//
// labelLevelPost
//
labelLevelPost.AutoSize = true;
labelLevelPost.Location = new Point(13, 55);
labelLevelPost.Name = "labelLevelPost";
labelLevelPost.Size = new Size(69, 20);
labelLevelPost.TabIndex = 24;
labelLevelPost.Text = "Уровень";
//
// textBoxLevelPost
//
textBoxLevelPost.Location = new Point(132, 52);
textBoxLevelPost.Name = "textBoxLevelPost";
textBoxLevelPost.Size = new Size(205, 27);
textBoxLevelPost.TabIndex = 25;
//
// FormPost
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(348, 162);
Controls.Add(textBoxLevelPost);
Controls.Add(labelLevelPost);
Controls.Add(comboBoxName);
Controls.Add(buttonCansle);
Controls.Add(buttonSave);
Controls.Add(numericUpDownWage);
Controls.Add(labelAllowance);
Controls.Add(labelName);
Name = "FormPost";
StartPosition = FormStartPosition.CenterParent;
Text = "Должность";
((System.ComponentModel.ISupportInitialize)numericUpDownWage).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private NumericUpDown numericUpDownWage;
private Label labelAllowance;
private Label labelName;
private Button buttonCansle;
private Button buttonSave;
private ComboBox comboBoxName;
private Label labelLevelPost;
private TextBox textBoxLevelPost;
}
}

View File

@ -0,0 +1,76 @@
using Accounting_Time_It_Company.Entities;
using Accounting_Time_It_Company.Entities.Enums;
using Accounting_Time_It_Company.Repositories;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormPost : Form
{
private readonly IPostRepositories _postRepositories;
private int? _postId;
public int Id
{
set
{
try
{
var post = _postRepositories.ReadPostById(value);
if (post == null)
{
throw new InvalidDataException(nameof(post));
}
comboBoxName.SelectedItem = post.NamePost;
textBoxLevelPost.Text = post.LevelPost;
numericUpDownWage.Value = post.Wage;
_postId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении двнных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormPost(IPostRepositories postRepositories)
{
InitializeComponent();
_postRepositories = postRepositories ?? throw new ArgumentNullException(nameof(postRepositories));
comboBoxName.DataSource = Enum.GetValues(typeof(TypePost));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxName.SelectedIndex < 0 ||
string.IsNullOrWhiteSpace(textBoxLevelPost.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_postId.HasValue)
{
_postRepositories.UpdatePost(CreatePost(_postId.Value));
}
else
{
_postRepositories.CreatePost(CreatePost(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCansle_Click(object sender, EventArgs e) => Close();
private Post CreatePost(int id) => Post.CreateEntity(id, (TypePost)comboBoxName.SelectedItem!,
textBoxLevelPost.Text, (int)numericUpDownWage.Value);
}
}

View 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>

View File

@ -0,0 +1,127 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormPosts
{
/// <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()
{
dataGridViewData = new DataGridView();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
panel1 = new Panel();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// 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.RowHeadersWidth = 51;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(686, 450);
dataGridViewData.TabIndex = 5;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(8, 280);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 94);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(8, 167);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(94, 94);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(8, 59);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 94);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// panel1
//
panel1.Controls.Add(buttonDelete);
panel1.Controls.Add(buttonUpdate);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(686, 0);
panel1.Name = "panel1";
panel1.Size = new Size(114, 450);
panel1.TabIndex = 4;
//
// FormPosts
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel1);
Name = "FormPosts";
StartPosition = FormStartPosition.CenterParent;
Text = "Должности";
Load += FormPosts_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
private Panel panel1;
}
}

View File

@ -0,0 +1,98 @@
using Accounting_Time_It_Company.Repositories;
using Unity;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormPosts : Form
{
private readonly IUnityContainer _container;
private readonly IPostRepositories _postRepositories;
public FormPosts(IUnityContainer container, IPostRepositories postRepositories)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_postRepositories = postRepositories ?? throw new ArgumentNullException(nameof(postRepositories));
}
private void FormPosts_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<FormPost>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormPost>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDelete_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_postRepositories.DeletePost(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _postRepositories.ReadPosts();
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;
}
}
}

View 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>

View File

@ -0,0 +1,143 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormProduct
{
/// <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()
{
textBoxName = new TextBox();
labelName = new Label();
labelClientName = new Label();
comboBoxClientName = new ComboBox();
buttonCansle = new Button();
buttonSave = new Button();
checkedListBoxTypeProduct = new CheckedListBox();
labelTypeProduct = new Label();
SuspendLayout();
//
// textBoxName
//
textBoxName.Location = new Point(85, 207);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(205, 27);
textBoxName.TabIndex = 20;
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(10, 210);
labelName.Name = "labelName";
labelName.Size = new Size(42, 20);
labelName.TabIndex = 19;
labelName.Text = "Имя:";
//
// labelClientName
//
labelClientName.AutoSize = true;
labelClientName.Location = new Point(10, 252);
labelClientName.Name = "labelClientName";
labelClientName.Size = new Size(74, 20);
labelClientName.TabIndex = 21;
labelClientName.Text = "Заказчик:";
//
// comboBoxClientName
//
comboBoxClientName.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxClientName.FormattingEnabled = true;
comboBoxClientName.Location = new Point(85, 249);
comboBoxClientName.Name = "comboBoxClientName";
comboBoxClientName.Size = new Size(205, 28);
comboBoxClientName.TabIndex = 23;
//
// buttonCansle
//
buttonCansle.Location = new Point(196, 290);
buttonCansle.Name = "buttonCansle";
buttonCansle.Size = new Size(94, 29);
buttonCansle.TabIndex = 25;
buttonCansle.Text = "Отмена";
buttonCansle.UseVisualStyleBackColor = true;
buttonCansle.Click += ButtonCansle_Click;
//
// buttonSave
//
buttonSave.Location = new Point(87, 290);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 24;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// checkedListBoxTypeProduct
//
checkedListBoxTypeProduct.FormattingEnabled = true;
checkedListBoxTypeProduct.Location = new Point(87, 12);
checkedListBoxTypeProduct.Name = "checkedListBoxTypeProduct";
checkedListBoxTypeProduct.Size = new Size(203, 180);
checkedListBoxTypeProduct.TabIndex = 26;
//
// labelTypeProduct
//
labelTypeProduct.AutoSize = true;
labelTypeProduct.Location = new Point(10, 12);
labelTypeProduct.Name = "labelTypeProduct";
labelTypeProduct.Size = new Size(38, 20);
labelTypeProduct.TabIndex = 27;
labelTypeProduct.Text = "Тип:";
//
// FormProduct
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(315, 336);
Controls.Add(labelTypeProduct);
Controls.Add(checkedListBoxTypeProduct);
Controls.Add(buttonCansle);
Controls.Add(buttonSave);
Controls.Add(comboBoxClientName);
Controls.Add(labelClientName);
Controls.Add(textBoxName);
Controls.Add(labelName);
Name = "FormProduct";
StartPosition = FormStartPosition.CenterParent;
Text = "Проект";
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBoxName;
private Label labelName;
private Label labelClientName;
private ComboBox comboBoxClientName;
private Button buttonCansle;
private Button buttonSave;
private CheckedListBox checkedListBoxTypeProduct;
private Label labelTypeProduct;
}
}

View File

@ -0,0 +1,98 @@
using Accounting_Time_It_Company.Entities;
using Accounting_Time_It_Company.Entities.Enums;
using Accounting_Time_It_Company.Repositories;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormProduct : Form
{
private readonly IProductRepositories _productRepositories;
private int? _productId;
public int Id
{
set
{
try
{
var product = _productRepositories.ReadProductById(value);
if (product == null)
{
throw new InvalidDataException(nameof(product));
}
foreach (TypeProduct elem in Enum.GetValues(typeof(TypeProduct)))
{
if ((elem & product.Type) != 0)
{
checkedListBoxTypeProduct.SetItemChecked(checkedListBoxTypeProduct.Items.IndexOf(elem), true);
}
}
textBoxName.Text = product.Name;
comboBoxClientName.SelectedValue = product.ClientId;
_productId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении двнных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormProduct(IProductRepositories productRepositories, IClientRepositories clientRepositories)
{
InitializeComponent();
_productRepositories = productRepositories ?? throw new ArgumentNullException(nameof(productRepositories));
comboBoxClientName.DataSource = clientRepositories.ReadClients();
comboBoxClientName.DisplayMember = "NameClient";
comboBoxClientName.ValueMember = "Id";
foreach (TypeProduct elem in Enum.GetValues(typeof(TypeProduct)))
{
checkedListBoxTypeProduct.Items.Add(elem);
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
comboBoxClientName.SelectedIndex < 0 ||
checkedListBoxTypeProduct.CheckedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
if (_productId.HasValue)
{
_productRepositories.UpdateProduct(CreateProduct(_productId.Value));
}
else
{
_productRepositories.CreateProduct(CreateProduct(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCansle_Click(object sender, EventArgs e) => Close();
private Product CreateProduct(int id)
{
TypeProduct type = TypeProduct.None;
foreach (var elem in checkedListBoxTypeProduct.CheckedItems)
{
type |= (TypeProduct)elem;
}
return Product.CreateEntity(id, (int)comboBoxClientName.SelectedValue!, textBoxName.Text, type);
}
}
}

View 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>

View File

@ -0,0 +1,127 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormProducts
{
/// <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()
{
dataGridViewData = new DataGridView();
panel1 = new Panel();
buttonDelete = new Button();
buttonUpdate = new Button();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// 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.RowHeadersWidth = 51;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(686, 450);
dataGridViewData.TabIndex = 7;
//
// panel1
//
panel1.Controls.Add(buttonDelete);
panel1.Controls.Add(buttonUpdate);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(686, 0);
panel1.Name = "panel1";
panel1.Size = new Size(114, 450);
panel1.TabIndex = 6;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(8, 280);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 94);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.BackgroundImage = Properties.Resources.Update;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(8, 167);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(94, 94);
buttonUpdate.TabIndex = 1;
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpdate_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(8, 59);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 94);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// FormProducts
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewData);
Controls.Add(panel1);
Name = "FormProducts";
StartPosition = FormStartPosition.CenterParent;
Text = "Проекты";
Load += FormProducts_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel1;
private Button buttonDelete;
private Button buttonUpdate;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,98 @@
using Accounting_Time_It_Company.Repositories;
using Unity;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormProducts : Form
{
private readonly IUnityContainer _container;
private readonly IProductRepositories _productRepositories;
public FormProducts(IUnityContainer container, IProductRepositories productRepositories)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_productRepositories = productRepositories ?? throw new ArgumentNullException(nameof(productRepositories));
}
private void FormProducts_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<FormProduct>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpdate_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormProduct>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDelete_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_productRepositories.DeleteProduct(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _productRepositories.ReadProducts();
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;
}
}
}

View 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>

View File

@ -0,0 +1,273 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormTypeJob
{
/// <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()
{
labelProduct = new Label();
textBoxDescriptoin = new TextBox();
comboBoxProduct = new ComboBox();
numericUpDownAllowanceForJob = new NumericUpDown();
labelDescriptoin = new Label();
labelAllowanceForJob = new Label();
buttonCansle = new Button();
buttonSave = new Button();
groupBoxDevelops = new GroupBox();
dataGridViewDevelops = new DataGridView();
ColumnDevelop = new DataGridViewComboBoxColumn();
ColumnHoursDev = new DataGridViewTextBoxColumn();
groupBoxManagers = new GroupBox();
dataGridViewManagers = new DataGridView();
ColumnManager = new DataGridViewComboBoxColumn();
ColumnHoursMan = new DataGridViewTextBoxColumn();
labelDate = new Label();
dateTimePickerDate = new DateTimePicker();
((System.ComponentModel.ISupportInitialize)numericUpDownAllowanceForJob).BeginInit();
groupBoxDevelops.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewDevelops).BeginInit();
groupBoxManagers.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewManagers).BeginInit();
SuspendLayout();
//
// labelProduct
//
labelProduct.AutoSize = true;
labelProduct.Location = new Point(22, 24);
labelProduct.Name = "labelProduct";
labelProduct.Size = new Size(62, 20);
labelProduct.TabIndex = 0;
labelProduct.Text = "Проект:";
//
// textBoxDescriptoin
//
textBoxDescriptoin.Location = new Point(178, 54);
textBoxDescriptoin.Name = "textBoxDescriptoin";
textBoxDescriptoin.Size = new Size(203, 27);
textBoxDescriptoin.TabIndex = 1;
//
// comboBoxProduct
//
comboBoxProduct.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxProduct.FormattingEnabled = true;
comboBoxProduct.Location = new Point(178, 21);
comboBoxProduct.Name = "comboBoxProduct";
comboBoxProduct.Size = new Size(203, 28);
comboBoxProduct.TabIndex = 2;
//
// numericUpDownAllowanceForJob
//
numericUpDownAllowanceForJob.Location = new Point(179, 87);
numericUpDownAllowanceForJob.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownAllowanceForJob.Name = "numericUpDownAllowanceForJob";
numericUpDownAllowanceForJob.Size = new Size(202, 27);
numericUpDownAllowanceForJob.TabIndex = 5;
//
// labelDescriptoin
//
labelDescriptoin.AutoSize = true;
labelDescriptoin.Location = new Point(22, 57);
labelDescriptoin.Name = "labelDescriptoin";
labelDescriptoin.Size = new Size(138, 20);
labelDescriptoin.TabIndex = 6;
labelDescriptoin.Text = "Описание работы:";
//
// labelAllowanceForJob
//
labelAllowanceForJob.AutoSize = true;
labelAllowanceForJob.Location = new Point(22, 89);
labelAllowanceForJob.Name = "labelAllowanceForJob";
labelAllowanceForJob.Size = new Size(150, 20);
labelAllowanceForJob.TabIndex = 7;
labelAllowanceForJob.Text = "Надбавка за работу:";
//
// buttonCansle
//
buttonCansle.Location = new Point(289, 557);
buttonCansle.Name = "buttonCansle";
buttonCansle.Size = new Size(94, 29);
buttonCansle.TabIndex = 11;
buttonCansle.Text = "Отмена";
buttonCansle.UseVisualStyleBackColor = true;
buttonCansle.Click += ButtonCansle_Click;
//
// buttonSave
//
buttonSave.Location = new Point(179, 557);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 10;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// groupBoxDevelops
//
groupBoxDevelops.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBoxDevelops.Controls.Add(dataGridViewDevelops);
groupBoxDevelops.Location = new Point(26, 165);
groupBoxDevelops.Name = "groupBoxDevelops";
groupBoxDevelops.Size = new Size(358, 167);
groupBoxDevelops.TabIndex = 12;
groupBoxDevelops.TabStop = false;
groupBoxDevelops.Text = "Разработчики";
//
// dataGridViewDevelops
//
dataGridViewDevelops.AllowUserToResizeColumns = false;
dataGridViewDevelops.AllowUserToResizeRows = false;
dataGridViewDevelops.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewDevelops.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewDevelops.Columns.AddRange(new DataGridViewColumn[] { ColumnDevelop, ColumnHoursDev });
dataGridViewDevelops.Location = new Point(3, 23);
dataGridViewDevelops.MultiSelect = false;
dataGridViewDevelops.Name = "dataGridViewDevelops";
dataGridViewDevelops.RowHeadersVisible = false;
dataGridViewDevelops.RowHeadersWidth = 51;
dataGridViewDevelops.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewDevelops.Size = new Size(352, 141);
dataGridViewDevelops.TabIndex = 8;
//
// ColumnDevelop
//
ColumnDevelop.HeaderText = "Разработчик";
ColumnDevelop.MinimumWidth = 6;
ColumnDevelop.Name = "ColumnDevelop";
//
// ColumnHoursDev
//
ColumnHoursDev.HeaderText = "Часы";
ColumnHoursDev.MinimumWidth = 6;
ColumnHoursDev.Name = "ColumnHoursDev";
//
// groupBoxManagers
//
groupBoxManagers.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupBoxManagers.Controls.Add(dataGridViewManagers);
groupBoxManagers.Location = new Point(26, 352);
groupBoxManagers.Name = "groupBoxManagers";
groupBoxManagers.Size = new Size(358, 168);
groupBoxManagers.TabIndex = 13;
groupBoxManagers.TabStop = false;
groupBoxManagers.Text = "Менеджеры";
//
// dataGridViewManagers
//
dataGridViewManagers.AllowUserToResizeColumns = false;
dataGridViewManagers.AllowUserToResizeRows = false;
dataGridViewManagers.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewManagers.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewManagers.Columns.AddRange(new DataGridViewColumn[] { ColumnManager, ColumnHoursMan });
dataGridViewManagers.Dock = DockStyle.Fill;
dataGridViewManagers.Location = new Point(3, 23);
dataGridViewManagers.MultiSelect = false;
dataGridViewManagers.Name = "dataGridViewManagers";
dataGridViewManagers.RowHeadersVisible = false;
dataGridViewManagers.RowHeadersWidth = 51;
dataGridViewManagers.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewManagers.Size = new Size(352, 142);
dataGridViewManagers.TabIndex = 9;
//
// ColumnManager
//
ColumnManager.HeaderText = "Менеджер";
ColumnManager.MinimumWidth = 6;
ColumnManager.Name = "ColumnManager";
//
// ColumnHoursMan
//
ColumnHoursMan.HeaderText = "Часы";
ColumnHoursMan.MinimumWidth = 6;
ColumnHoursMan.Name = "ColumnHoursMan";
//
// labelDate
//
labelDate.AutoSize = true;
labelDate.Location = new Point(22, 125);
labelDate.Name = "labelDate";
labelDate.Size = new Size(44, 20);
labelDate.TabIndex = 14;
labelDate.Text = "Дата:";
//
// dateTimePickerDate
//
dateTimePickerDate.Enabled = false;
dateTimePickerDate.Location = new Point(178, 120);
dateTimePickerDate.Name = "dateTimePickerDate";
dateTimePickerDate.Size = new Size(206, 27);
dateTimePickerDate.TabIndex = 15;
//
// FormTypeJob
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(391, 598);
Controls.Add(dateTimePickerDate);
Controls.Add(labelDate);
Controls.Add(groupBoxManagers);
Controls.Add(groupBoxDevelops);
Controls.Add(buttonCansle);
Controls.Add(buttonSave);
Controls.Add(labelAllowanceForJob);
Controls.Add(labelDescriptoin);
Controls.Add(numericUpDownAllowanceForJob);
Controls.Add(comboBoxProduct);
Controls.Add(textBoxDescriptoin);
Controls.Add(labelProduct);
Name = "FormTypeJob";
StartPosition = FormStartPosition.CenterParent;
Text = "Тип работы";
((System.ComponentModel.ISupportInitialize)numericUpDownAllowanceForJob).EndInit();
groupBoxDevelops.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewDevelops).EndInit();
groupBoxManagers.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewManagers).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelProduct;
private TextBox textBoxDescriptoin;
private ComboBox comboBoxProduct;
private NumericUpDown numericUpDownAllowanceForJob;
private Label labelDescriptoin;
private Label labelAllowanceForJob;
private Button buttonCansle;
private Button buttonSave;
private GroupBox groupBoxDevelops;
private GroupBox groupBoxManagers;
private DataGridView dataGridViewDevelops;
private DataGridView dataGridViewManagers;
private Label labelDate;
private DateTimePicker dateTimePickerDate;
private DataGridViewComboBoxColumn ColumnDevelop;
private DataGridViewTextBoxColumn ColumnHoursDev;
private DataGridViewComboBoxColumn ColumnManager;
private DataGridViewTextBoxColumn ColumnHoursMan;
}
}

View File

@ -0,0 +1,69 @@
using Accounting_Time_It_Company.Entities;
using Accounting_Time_It_Company.Entities.Enums;
using Accounting_Time_It_Company.Repositories;
using System.Data;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormTypeJob : Form
{
private readonly ITypeJobRepositories _typeJobRepositories;
public FormTypeJob(ITypeJobRepositories typeJobRepositories, IProductRepositories productRepositories,
IEmployeeRepositories employeeRepositories)
{
InitializeComponent();
_typeJobRepositories = typeJobRepositories ?? throw new ArgumentNullException(nameof(typeJobRepositories));
comboBoxProduct.DataSource = productRepositories.ReadProducts();
comboBoxProduct.DisplayMember = "Name";
comboBoxProduct.ValueMember = "Id";
ColumnDevelop.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId == (int)TypePost.Developer).ToList();
ColumnDevelop.DisplayMember = "Name";
ColumnDevelop.ValueMember = "Id";
ColumnManager.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId == (int)TypePost.Manager).ToList();
ColumnManager.DisplayMember = "Name";
ColumnManager.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxDescriptoin.Text) ||
comboBoxProduct.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_typeJobRepositories.CreateTypeJob(TypeJob.CreateOperation(0, (int)comboBoxProduct.SelectedIndex!, textBoxDescriptoin.Text,
(int)numericUpDownAllowanceForJob.Value, CreateListWorkTimeFromDataGrid(dataGridViewDevelops),
CreateListWorkTimeFromDataGrid(dataGridViewManagers)));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCansle_Click(object sender, EventArgs e) => Close();
private List<WorkTime> CreateListWorkTimeFromDataGrid(DataGridView dataGrid)
{
var list = new List<WorkTime>();
foreach (DataGridViewRow row in dataGrid.Rows)
{
if (row.Cells[0].Value == null || row.Cells[1] == null)
{
continue;
}
list.Add(WorkTime.CreateElement(0, Convert.ToInt32(row.Cells[0].Value), Convert.ToInt32(row.Cells[1].Value)));
}
return list;
}
}
}

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ColumnDevelop.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnHoursDev.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnManager.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnHoursMan.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,113 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormTypeJobs
{
/// <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();
buttonDelete = new Button();
buttonAdd = new Button();
dataGridViewData = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonDelete);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(686, 0);
panel1.Name = "panel1";
panel1.Size = new Size(114, 450);
panel1.TabIndex = 6;
//
// buttonDelete
//
buttonDelete.BackgroundImage = Properties.Resources.Delete;
buttonDelete.BackgroundImageLayout = ImageLayout.Stretch;
buttonDelete.Location = new Point(8, 159);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 94);
buttonDelete.TabIndex = 2;
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += ButtonDelete_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(8, 59);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 94);
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.RowHeadersWidth = 51;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(800, 450);
dataGridViewData.TabIndex = 7;
//
// FormTypeJobs
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridViewData);
Name = "FormTypeJobs";
StartPosition = FormStartPosition.CenterParent;
Text = "Тип работ";
Load += FormTypeJobs_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button buttonDelete;
private Button buttonAdd;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,79 @@
using Accounting_Time_It_Company.Repositories;
using Unity;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormTypeJobs : Form
{
private readonly IUnityContainer _container;
private readonly ITypeJobRepositories _typeJobRepositories;
public FormTypeJobs(IUnityContainer container, ITypeJobRepositories typeJobRepositories)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_typeJobRepositories = typeJobRepositories ?? throw new ArgumentNullException(nameof(typeJobRepositories));
}
private void FormTypeJobs_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<FormTypeJob>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDelete_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_typeJobRepositories.DeleteTypeJob(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _typeJobRepositories.ReadTypeJobs();
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;
}
}
}

View 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>

View File

@ -0,0 +1,142 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormVacation
{
/// <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()
{
labelEmployee = new Label();
comboBoxEmployee = new ComboBox();
dateTimePickerStartDate = new DateTimePicker();
labelStartDate = new Label();
labelEndDate = new Label();
dateTimePickerEndDate = new DateTimePicker();
buttonCansle = new Button();
buttonSave = new Button();
SuspendLayout();
//
// labelEmployee
//
labelEmployee.AutoSize = true;
labelEmployee.Location = new Point(12, 9);
labelEmployee.Name = "labelEmployee";
labelEmployee.Size = new Size(77, 20);
labelEmployee.TabIndex = 0;
labelEmployee.Text = "Работник:";
//
// comboBoxEmployee
//
comboBoxEmployee.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxEmployee.FormattingEnabled = true;
comboBoxEmployee.Location = new Point(112, 6);
comboBoxEmployee.Name = "comboBoxEmployee";
comboBoxEmployee.Size = new Size(203, 28);
comboBoxEmployee.TabIndex = 1;
//
// dateTimePickerStartDate
//
dateTimePickerStartDate.Location = new Point(112, 40);
dateTimePickerStartDate.Name = "dateTimePickerStartDate";
dateTimePickerStartDate.Size = new Size(203, 27);
dateTimePickerStartDate.TabIndex = 2;
//
// labelStartDate
//
labelStartDate.AutoSize = true;
labelStartDate.Location = new Point(12, 45);
labelStartDate.Name = "labelStartDate";
labelStartDate.Size = new Size(64, 20);
labelStartDate.TabIndex = 3;
labelStartDate.Text = "Начало:";
//
// labelEndDate
//
labelEndDate.AutoSize = true;
labelEndDate.Location = new Point(12, 79);
labelEndDate.Name = "labelEndDate";
labelEndDate.Size = new Size(56, 20);
labelEndDate.TabIndex = 4;
labelEndDate.Text = "Конец:";
//
// dateTimePickerEndDate
//
dateTimePickerEndDate.Location = new Point(112, 74);
dateTimePickerEndDate.Name = "dateTimePickerEndDate";
dateTimePickerEndDate.Size = new Size(203, 27);
dateTimePickerEndDate.TabIndex = 5;
//
// buttonCansle
//
buttonCansle.Location = new Point(221, 123);
buttonCansle.Name = "buttonCansle";
buttonCansle.Size = new Size(94, 29);
buttonCansle.TabIndex = 24;
buttonCansle.Text = "Отмена";
buttonCansle.UseVisualStyleBackColor = true;
buttonCansle.Click += ButtonCansle_Click;
//
// buttonSave
//
buttonSave.Location = new Point(112, 123);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 23;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// FormVacation
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(321, 157);
Controls.Add(buttonCansle);
Controls.Add(buttonSave);
Controls.Add(dateTimePickerEndDate);
Controls.Add(labelEndDate);
Controls.Add(labelStartDate);
Controls.Add(dateTimePickerStartDate);
Controls.Add(comboBoxEmployee);
Controls.Add(labelEmployee);
Name = "FormVacation";
StartPosition = FormStartPosition.CenterParent;
Text = "Отпуск";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelEmployee;
private ComboBox comboBoxEmployee;
private DateTimePicker dateTimePickerStartDate;
private Label labelStartDate;
private Label labelEndDate;
private DateTimePicker dateTimePickerEndDate;
private Button buttonCansle;
private Button buttonSave;
}
}

View File

@ -0,0 +1,42 @@
using Accounting_Time_It_Company.Entities;
using Accounting_Time_It_Company.Repositories;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormVacation : Form
{
private readonly IVacationRepositories _vacationRepositories;
public FormVacation(IVacationRepositories vacationRepositories, IEmployeeRepositories employeeRepositories)
{
InitializeComponent();
_vacationRepositories = vacationRepositories ?? throw new ArgumentNullException(nameof(vacationRepositories));
comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees();
comboBoxEmployee.DisplayMember = "Name";
comboBoxEmployee.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxEmployee.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_vacationRepositories.CreateVacation(Vacation.CreateOpeartion(0, (int)comboBoxEmployee.SelectedIndex!,
dateTimePickerStartDate.Value, dateTimePickerEndDate.Value));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCansle_Click(object sender, EventArgs e) => Close();
}
}

View 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>

View File

@ -0,0 +1,99 @@
namespace Accounting_Time_It_Company.Forms
{
partial class FormVacations
{
/// <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()
{
buttonAdd = new Button();
panel1 = new Panel();
dataGridViewData = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
SuspendLayout();
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.Add;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(8, 59);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 94);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// panel1
//
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(686, 0);
panel1.Name = "panel1";
panel1.Size = new Size(114, 450);
panel1.TabIndex = 8;
//
// 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.RowHeadersWidth = 51;
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridViewData.Size = new Size(800, 450);
dataGridViewData.TabIndex = 9;
//
// FormVacations
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridViewData);
Name = "FormVacations";
StartPosition = FormStartPosition.CenterParent;
Text = "Отпуска";
Load += FormVacations_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
ResumeLayout(false);
}
#endregion
private Button buttonAdd;
private Panel panel1;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,46 @@
using Accounting_Time_It_Company.Repositories;
using Unity;
namespace Accounting_Time_It_Company.Forms
{
public partial class FormVacations : Form
{
private readonly IUnityContainer _container;
private readonly IVacationRepositories _vacationRepositories;
public FormVacations(IUnityContainer container, IVacationRepositories vacationRepositories)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_vacationRepositories = vacationRepositories ?? throw new ArgumentNullException(nameof(vacationRepositories));
}
private void FormVacations_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<FormVacation>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _vacationRepositories.ReadVacations();
}
}

View 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>

View File

@ -1,3 +1,7 @@
using Accounting_Time_It_Company.Repositories;
using Accounting_Time_It_Company.Repositories.Implementations;
using Unity;
namespace Accounting_Time_It_Company
{
internal static class Program
@ -11,7 +15,19 @@ namespace Accounting_Time_It_Company
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(CreateContainer().Resolve<FormCompany>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IClientRepositories, ClientRepositories>();
container.RegisterType<IEmployeeRepositories, EmployeeRepositories>();
container.RegisterType<IPostRepositories, PostRepositories>();
container.RegisterType<IProductRepositories, ProductRepositories>();
container.RegisterType<ITypeJobRepositories, TypeJobRepositories>();
container.RegisterType<IVacationRepositories, VacationRepositories>();
return container;
}
}
}

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Accounting_Time_It_Company.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Accounting_Time_It_Company.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Add {
get {
object obj = ResourceManager.GetObject("Add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap BG {
get {
object obj = ResourceManager.GetObject("BG", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Delete {
get {
object obj = ResourceManager.GetObject("Delete", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Update {
get {
object obj = ResourceManager.GetObject("Update", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,133 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="BG" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BG.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Delete.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Update" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Update.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,16 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories;
public interface IClientRepositories
{
IEnumerable<Client> ReadClients();
Client ReadClientById(int id);
void CreateClient(Client client);
void UpdateClient(Client client);
void DeleteClient(int id);
}

View File

@ -0,0 +1,16 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories;
public interface IEmployeeRepositories
{
IEnumerable<Employee> ReadEmployees();
Employee ReadEmployeeById(int id);
void CreateEmployee(Employee employee);
void UpdateEmployee(Employee employee);
void DeleteEmployee(int id);
}

View File

@ -0,0 +1,16 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories;
public interface IPostRepositories
{
IEnumerable<Post> ReadPosts();
Post ReadPostById(int id);
void CreatePost(Post post);
void UpdatePost(Post post);
void DeletePost(int id);
}

View File

@ -0,0 +1,16 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories;
public interface IProductRepositories
{
IEnumerable<Product> ReadProducts();
Product ReadProductById(int id);
void CreateProduct(Product product);
void UpdateProduct(Product product);
void DeleteProduct(int id);
}

View File

@ -0,0 +1,12 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories;
public interface ITypeJobRepositories
{
IEnumerable<TypeJob> ReadTypeJobs(int? productId = null, int? developId = null, int? managerId = null);
void CreateTypeJob(TypeJob typeJob);
void DeleteTypeJob(int id);
}

View File

@ -0,0 +1,12 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories;
public interface IVacationRepositories
{
IEnumerable<Vacation> ReadVacations(DateTime? startDateFrom = null, DateTime? startDateTo = null,
DateTime? endDateFrom = null, DateTime? endtDateTo = null,
int? employeeId = null);
void CreateVacation(Vacation vacation);
}

View File

@ -0,0 +1,28 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories.Implementations;
internal class ClientRepositories : IClientRepositories
{
public void CreateClient(Client client)
{
}
public void DeleteClient(int id)
{
}
public Client ReadClientById(int id)
{
return Client.CreateEntity(0, string.Empty, string.Empty);
}
public IEnumerable<Client> ReadClients()
{
return [];
}
public void UpdateClient(Client client)
{
}
}

View File

@ -0,0 +1,28 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories.Implementations;
public class EmployeeRepositories : IEmployeeRepositories
{
public void CreateEmployee(Employee employee)
{
}
public void DeleteEmployee(int id)
{
}
public Employee ReadEmployeeById(int id)
{
return Employee.CreateEntity(0, 0, string.Empty, string.Empty, 0f);
}
public IEnumerable<Employee> ReadEmployees()
{
return [];
}
public void UpdateEmployee(Employee employee)
{
}
}

View File

@ -0,0 +1,28 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories.Implementations;
public class PostRepositories : IPostRepositories
{
public void CreatePost(Post post)
{
}
public void DeletePost(int id)
{
}
public Post ReadPostById(int id)
{
return Post.CreateEntity(0, 0, string.Empty, 0);
}
public IEnumerable<Post> ReadPosts()
{
return [];
}
public void UpdatePost(Post post)
{
}
}

View File

@ -0,0 +1,28 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories.Implementations;
public class ProductRepositories : IProductRepositories
{
public void CreateProduct(Product product)
{
}
public void DeleteProduct(int id)
{
}
public Product ReadProductById(int id)
{
return Product.CreateEntity(0, 0, string.Empty, 0);
}
public IEnumerable<Product> ReadProducts()
{
return [];
}
public void UpdateProduct(Product product)
{
}
}

View File

@ -0,0 +1,19 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories.Implementations;
public class TypeJobRepositories : ITypeJobRepositories
{
public void CreateTypeJob(TypeJob typeJob)
{
}
public void DeleteTypeJob(int id)
{
}
public IEnumerable<TypeJob> ReadTypeJobs(int? productId = null, int? developId = null, int? managerId = null)
{
return [];
}
}

View File

@ -0,0 +1,16 @@
using Accounting_Time_It_Company.Entities;
namespace Accounting_Time_It_Company.Repositories.Implementations;
public class VacationRepositories : IVacationRepositories
{
public void CreateVacation(Vacation vacation)
{
}
public IEnumerable<Vacation> ReadVacations(DateTime? startDateFrom = null, DateTime? startDateTo = null,
DateTime? endDateFrom = null, DateTime? endtDateTo = null, int? employeeId = null)
{
return [];
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB