Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
2e8b98b5a8 | |||
58680c1f80 | |||
5b2d2b883c | |||
71e7a114de | |||
43d383e34a | |||
c8356c5d02 | |||
fe2dc84b65 | |||
ab55cec4ef | |||
d8e396a649 | |||
9214fd3879 | |||
6c11146c7e | |||
9cc5412c9e | |||
410b1f42ab | |||
46f953858d | |||
90437340b3 | |||
c5b53aac84 | |||
2bb556bc3f | |||
44c4998db1 | |||
57651f249a | |||
cd79ab9f26 | |||
736b16822b | |||
d5a10abe57 | |||
8e14ffaef6 | |||
68715a92d9 |
@ -9,4 +9,41 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
<PackageReference Include="Npgsql" Version="9.0.1" />
|
||||||
|
<PackageReference Include="Serilog" Version="4.0.2" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
|
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
|
||||||
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
|
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace Accounting_Time_It_Company.Entities.Enums;
|
||||||
|
|
||||||
|
public enum TypePost
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Developer = 1,
|
||||||
|
Manager = 2,
|
||||||
|
Director = 3
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Entities.Enums;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum TypeProduct
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
Development = 1,
|
||||||
|
|
||||||
|
Suppurt = 2,
|
||||||
|
|
||||||
|
Supervision = 4
|
||||||
|
}
|
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Entities;
|
||||||
|
|
||||||
|
public class TypeJob
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
public int ProductId { get; private set; }
|
||||||
|
|
||||||
|
public int Director { 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, int director, string discription, int allowanceForJob,
|
||||||
|
IEnumerable<WorkTime> workTimesDevelop, IEnumerable<WorkTime> workTimesManager)
|
||||||
|
{
|
||||||
|
return new TypeJob
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
ProductId = productId,
|
||||||
|
Director = director,
|
||||||
|
Description = discription,
|
||||||
|
AllowanceForJob = allowanceForJob,
|
||||||
|
Date = DateTime.Now,
|
||||||
|
WorkTimesDevelop = workTimesDevelop,
|
||||||
|
WorkTimesManager = workTimesManager
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Entities;
|
||||||
|
|
||||||
|
public class Vacation
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
public int EmployeeId { get; private set; }
|
||||||
|
|
||||||
|
public int DirectorId { get; private set; }
|
||||||
|
|
||||||
|
public DateTime StartDate { get; private set; }
|
||||||
|
|
||||||
|
public DateTime EndDate { get; private set; }
|
||||||
|
|
||||||
|
public static Vacation CreateOpeartion(int id, int directorId, int employeeId, DateTime startDate, DateTime endDate)
|
||||||
|
{
|
||||||
|
return new Vacation
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
DirectorId = directorId,
|
||||||
|
EmployeeId = employeeId,
|
||||||
|
StartDate = startDate,
|
||||||
|
EndDate = endDate
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace Accounting_Time_It_Company
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
147
Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.Designer.cs
generated
Normal file
147
Accounting-Time-It-Company/Accounting-Time-It-Company/FormCompany.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
119
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormClient.Designer.cs
generated
Normal file
119
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormClient.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</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>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
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
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
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
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
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
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormClients.Designer.cs
generated
Normal file
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormClients.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
169
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployee.Designer.cs
generated
Normal file
169
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployee.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
numericUpDownAllowance.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);
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployees.Designer.cs
generated
Normal file
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployees.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
148
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormPost.Designer.cs
generated
Normal file
148
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormPost.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormPosts.Designer.cs
generated
Normal file
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormPosts.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
143
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.Designer.cs
generated
Normal file
143
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProduct.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProducts.Designer.cs
generated
Normal file
127
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormProducts.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
297
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.Designer.cs
generated
Normal file
297
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJob.Designer.cs
generated
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
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();
|
||||||
|
comboBoxDirector = new ComboBox();
|
||||||
|
labelDirector = new Label();
|
||||||
|
((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, 89);
|
||||||
|
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, 122);
|
||||||
|
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, 92);
|
||||||
|
labelDescriptoin.Name = "labelDescriptoin";
|
||||||
|
labelDescriptoin.Size = new Size(138, 20);
|
||||||
|
labelDescriptoin.TabIndex = 6;
|
||||||
|
labelDescriptoin.Text = "Описание работы:";
|
||||||
|
//
|
||||||
|
// labelAllowanceForJob
|
||||||
|
//
|
||||||
|
labelAllowanceForJob.AutoSize = true;
|
||||||
|
labelAllowanceForJob.Location = new Point(22, 124);
|
||||||
|
labelAllowanceForJob.Name = "labelAllowanceForJob";
|
||||||
|
labelAllowanceForJob.Size = new Size(150, 20);
|
||||||
|
labelAllowanceForJob.TabIndex = 7;
|
||||||
|
labelAllowanceForJob.Text = "Надбавка за работу:";
|
||||||
|
//
|
||||||
|
// buttonCansle
|
||||||
|
//
|
||||||
|
buttonCansle.Location = new Point(287, 577);
|
||||||
|
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(177, 577);
|
||||||
|
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, 188);
|
||||||
|
groupBoxDevelops.Name = "groupBoxDevelops";
|
||||||
|
groupBoxDevelops.Size = new Size(358, 183);
|
||||||
|
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, 377);
|
||||||
|
groupBoxManagers.Name = "groupBoxManagers";
|
||||||
|
groupBoxManagers.Size = new Size(358, 182);
|
||||||
|
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, 156);
|
||||||
|
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, 160);
|
||||||
|
labelDate.Name = "labelDate";
|
||||||
|
labelDate.Size = new Size(44, 20);
|
||||||
|
labelDate.TabIndex = 14;
|
||||||
|
labelDate.Text = "Дата:";
|
||||||
|
//
|
||||||
|
// dateTimePickerDate
|
||||||
|
//
|
||||||
|
dateTimePickerDate.Enabled = false;
|
||||||
|
dateTimePickerDate.Location = new Point(178, 155);
|
||||||
|
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||||
|
dateTimePickerDate.Size = new Size(206, 27);
|
||||||
|
dateTimePickerDate.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// comboBoxDirector
|
||||||
|
//
|
||||||
|
comboBoxDirector.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxDirector.FormattingEnabled = true;
|
||||||
|
comboBoxDirector.Location = new Point(178, 55);
|
||||||
|
comboBoxDirector.Name = "comboBoxDirector";
|
||||||
|
comboBoxDirector.Size = new Size(203, 28);
|
||||||
|
comboBoxDirector.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// labelDirector
|
||||||
|
//
|
||||||
|
labelDirector.AutoSize = true;
|
||||||
|
labelDirector.Location = new Point(22, 58);
|
||||||
|
labelDirector.Name = "labelDirector";
|
||||||
|
labelDirector.Size = new Size(76, 20);
|
||||||
|
labelDirector.TabIndex = 16;
|
||||||
|
labelDirector.Text = "Директор";
|
||||||
|
//
|
||||||
|
// FormTypeJob
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(391, 717);
|
||||||
|
Controls.Add(comboBoxDirector);
|
||||||
|
Controls.Add(labelDirector);
|
||||||
|
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;
|
||||||
|
private ComboBox comboBoxDirector;
|
||||||
|
private Label labelDirector;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Accounting_Time_It_Company.Entities.Enums;
|
||||||
|
using Accounting_Time_It_Company.Repositories;
|
||||||
|
using Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
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, IPostRepositories postRepositories)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_typeJobRepositories = typeJobRepositories ?? throw new ArgumentNullException(nameof(typeJobRepositories));
|
||||||
|
|
||||||
|
comboBoxProduct.DataSource = productRepositories.ReadProducts();
|
||||||
|
comboBoxProduct.DisplayMember = "Name";
|
||||||
|
comboBoxProduct.ValueMember = "Id";
|
||||||
|
|
||||||
|
List<int> DirectorId = postRepositories.ReadPosts().Where(y => y.NamePost == TypePost.Director).Select(y => y.Id).ToList();
|
||||||
|
List<int> ManagerId = postRepositories.ReadPosts().Where(y => y.NamePost == TypePost.Manager).Select(y => y.Id).ToList();
|
||||||
|
List<int> DeveloperId = postRepositories.ReadPosts().Where(y => y.NamePost == TypePost.Developer).Select(y => y.Id).ToList();
|
||||||
|
|
||||||
|
comboBoxDirector.DataSource = employeeRepositories.ReadEmployees().Where(x => DirectorId.Any(z => z == x.PostId)).ToList();
|
||||||
|
comboBoxDirector.DisplayMember = "Name";
|
||||||
|
comboBoxDirector.ValueMember = "Id";
|
||||||
|
|
||||||
|
ColumnDevelop.DataSource = employeeRepositories.ReadEmployees().Where(x => DeveloperId.Any(z => z == x.PostId)).ToList();
|
||||||
|
ColumnDevelop.DisplayMember = "Name";
|
||||||
|
ColumnDevelop.ValueMember = "Id";
|
||||||
|
|
||||||
|
ColumnManager.DataSource = employeeRepositories.ReadEmployees().Where(x => ManagerId.Any(z => z == x.PostId)).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.SelectedValue!, (int)comboBoxDirector.SelectedValue!, 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,144 @@
|
|||||||
|
<?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="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>
|
||||||
|
<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>
|
113
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJobs.Designer.cs
generated
Normal file
113
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormTypeJobs.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
166
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormVacation.Designer.cs
generated
Normal file
166
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormVacation.Designer.cs
generated
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
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();
|
||||||
|
comboBoxDirector = new ComboBox();
|
||||||
|
labelDirector = new Label();
|
||||||
|
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, 75);
|
||||||
|
dateTimePickerStartDate.Name = "dateTimePickerStartDate";
|
||||||
|
dateTimePickerStartDate.Size = new Size(203, 27);
|
||||||
|
dateTimePickerStartDate.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// labelStartDate
|
||||||
|
//
|
||||||
|
labelStartDate.AutoSize = true;
|
||||||
|
labelStartDate.Location = new Point(12, 80);
|
||||||
|
labelStartDate.Name = "labelStartDate";
|
||||||
|
labelStartDate.Size = new Size(64, 20);
|
||||||
|
labelStartDate.TabIndex = 3;
|
||||||
|
labelStartDate.Text = "Начало:";
|
||||||
|
//
|
||||||
|
// labelEndDate
|
||||||
|
//
|
||||||
|
labelEndDate.AutoSize = true;
|
||||||
|
labelEndDate.Location = new Point(12, 114);
|
||||||
|
labelEndDate.Name = "labelEndDate";
|
||||||
|
labelEndDate.Size = new Size(56, 20);
|
||||||
|
labelEndDate.TabIndex = 4;
|
||||||
|
labelEndDate.Text = "Конец:";
|
||||||
|
//
|
||||||
|
// dateTimePickerEndDate
|
||||||
|
//
|
||||||
|
dateTimePickerEndDate.Location = new Point(112, 109);
|
||||||
|
dateTimePickerEndDate.Name = "dateTimePickerEndDate";
|
||||||
|
dateTimePickerEndDate.Size = new Size(203, 27);
|
||||||
|
dateTimePickerEndDate.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonCansle
|
||||||
|
//
|
||||||
|
buttonCansle.Location = new Point(221, 158);
|
||||||
|
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, 158);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(94, 29);
|
||||||
|
buttonSave.TabIndex = 23;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// comboBoxDirector
|
||||||
|
//
|
||||||
|
comboBoxDirector.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxDirector.FormattingEnabled = true;
|
||||||
|
comboBoxDirector.Location = new Point(112, 40);
|
||||||
|
comboBoxDirector.Name = "comboBoxDirector";
|
||||||
|
comboBoxDirector.Size = new Size(203, 28);
|
||||||
|
comboBoxDirector.TabIndex = 26;
|
||||||
|
//
|
||||||
|
// labelDirector
|
||||||
|
//
|
||||||
|
labelDirector.AutoSize = true;
|
||||||
|
labelDirector.Location = new Point(12, 43);
|
||||||
|
labelDirector.Name = "labelDirector";
|
||||||
|
labelDirector.Size = new Size(79, 20);
|
||||||
|
labelDirector.TabIndex = 25;
|
||||||
|
labelDirector.Text = "Директор:";
|
||||||
|
//
|
||||||
|
// FormVacation
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(321, 194);
|
||||||
|
Controls.Add(comboBoxDirector);
|
||||||
|
Controls.Add(labelDirector);
|
||||||
|
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;
|
||||||
|
private ComboBox comboBoxDirector;
|
||||||
|
private Label labelDirector;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Accounting_Time_It_Company.Entities.Enums;
|
||||||
|
using Accounting_Time_It_Company.Repositories;
|
||||||
|
using Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Forms
|
||||||
|
{
|
||||||
|
public partial class FormVacation : Form
|
||||||
|
{
|
||||||
|
private readonly IVacationRepositories _vacationRepositories;
|
||||||
|
|
||||||
|
public FormVacation(IVacationRepositories vacationRepositories, IEmployeeRepositories employeeRepositories, IPostRepositories postRepositories)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_vacationRepositories = vacationRepositories ?? throw new ArgumentNullException(nameof(vacationRepositories));
|
||||||
|
|
||||||
|
List<int> DirectorId = postRepositories.ReadPosts().Where(y => y.NamePost == TypePost.Director).Select(y => y.Id).ToList();
|
||||||
|
|
||||||
|
comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees().Where(x => DirectorId.Any(z => z != x.PostId)).ToList();
|
||||||
|
comboBoxEmployee.DisplayMember = "Name";
|
||||||
|
comboBoxEmployee.ValueMember = "Id";
|
||||||
|
|
||||||
|
comboBoxDirector.DataSource = employeeRepositories.ReadEmployees().Where(x => DirectorId.Any(z => z == x.PostId)).ToList();
|
||||||
|
comboBoxDirector.DisplayMember = "Name";
|
||||||
|
comboBoxDirector.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxEmployee.SelectedIndex < 0 || comboBoxDirector.SelectedIndex < 0 ||
|
||||||
|
dateTimePickerStartDate.Value >= dateTimePickerEndDate.Value)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
_vacationRepositories.CreateVacation(Vacation.CreateOpeartion(0, (int)comboBoxDirector.SelectedValue!, (int)comboBoxEmployee.SelectedValue!,
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
99
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormVacations.Designer.cs
generated
Normal file
99
Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormVacations.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -1,3 +1,11 @@
|
|||||||
|
using Accounting_Time_It_Company.Repositories;
|
||||||
|
using Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Serilog;
|
||||||
|
using Unity;
|
||||||
|
using Unity.Microsoft.Logging;
|
||||||
|
|
||||||
namespace Accounting_Time_It_Company
|
namespace Accounting_Time_It_Company
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -11,7 +19,36 @@ namespace Accounting_Time_It_Company
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(CreateContainer().Resolve<FormCompany>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IUnityContainer CreateContainer()
|
||||||
|
{
|
||||||
|
var container = new UnityContainer();
|
||||||
|
|
||||||
|
container.AddExtension(new LoggingExtension(CreateLoggerFactory()));
|
||||||
|
|
||||||
|
container.RegisterType<IClientRepositories, ClientRepositories>();
|
||||||
|
container.RegisterType<IEmployeeRepositories, EmployeeRepositories>();
|
||||||
|
container.RegisterType<IPostRepositories, PostRepositories>();
|
||||||
|
container.RegisterType<IProductRepositories, ProductRepositories>();
|
||||||
|
container.RegisterType<ITypeJobRepositories, TypeJobRepositories>();
|
||||||
|
container.RegisterType<IVacationRepositories, VacationRepositories>();
|
||||||
|
|
||||||
|
container.RegisterType<IConnectionString, ConnectionString>();
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static LoggerFactory CreateLoggerFactory()
|
||||||
|
{
|
||||||
|
var loggerFactory = new LoggerFactory();
|
||||||
|
loggerFactory.AddSerilog(new LoggerConfiguration()
|
||||||
|
.ReadFrom.Configuration(new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile("appsettings.json")
|
||||||
|
.Build())
|
||||||
|
.CreateLogger());
|
||||||
|
return loggerFactory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
103
Accounting-Time-It-Company/Accounting-Time-It-Company/Properties/Resources.Designer.cs
generated
Normal file
103
Accounting-Time-It-Company/Accounting-Time-It-Company/Properties/Resources.Designer.cs
generated
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -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);
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories;
|
||||||
|
|
||||||
|
public interface IConnectionString
|
||||||
|
{
|
||||||
|
string ConnectionString { get; }
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories;
|
||||||
|
|
||||||
|
public interface ITypeJobRepositories
|
||||||
|
{
|
||||||
|
IEnumerable<TypeJob> ReadTypeJobs(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? directorId = null);
|
||||||
|
|
||||||
|
void CreateTypeJob(TypeJob typeJob);
|
||||||
|
|
||||||
|
void DeleteTypeJob(int id);
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Dapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Npgsql;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
#pragma warning disable CS0618
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
internal class ClientRepositories : IClientRepositories
|
||||||
|
{
|
||||||
|
private readonly IConnectionString _connectionString;
|
||||||
|
|
||||||
|
private readonly ILogger<ClientRepositories> _logger;
|
||||||
|
|
||||||
|
public ClientRepositories(IConnectionString connectionString, ILogger<ClientRepositories> logger)
|
||||||
|
{
|
||||||
|
_connectionString = connectionString;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateClient(Client client)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Добавление объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(client));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryInsert = @"
|
||||||
|
INSERT INTO Client
|
||||||
|
VALUES (DEFAULT, @NameClient, @Phone)";
|
||||||
|
connection.Execute(queryInsert, client);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при добавдении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void UpdateClient(Client client)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Редактирование объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}",
|
||||||
|
JsonConvert.SerializeObject(client));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryUpdate = @"
|
||||||
|
UPDATE Client
|
||||||
|
SET
|
||||||
|
NameClient=@NameClient,
|
||||||
|
Phone=@Phone
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryUpdate, client);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteClient(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Удаление объекта");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryDelete = @"
|
||||||
|
DELETE FROM Client
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryDelete, new { id });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Client ReadClientById(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение объекта по идентификатору");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = @"
|
||||||
|
SELECT * FROM Client
|
||||||
|
WHERE Id=@id";
|
||||||
|
var client = connection.QueryFirst<Client>(querySelect, new { id });
|
||||||
|
_logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(client));
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Client> ReadClients()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение всех объектов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = "SELECT * FROM Client";
|
||||||
|
var clients = connection.Query<Client>(querySelect);
|
||||||
|
_logger.LogDebug("Полученные объекты: {json}",
|
||||||
|
JsonConvert.SerializeObject(clients));
|
||||||
|
return clients;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class ConnectionString : IConnectionString
|
||||||
|
{
|
||||||
|
string IConnectionString.ConnectionString => "Server=localhost:5432;Database=workTime;User Id=postgres;Password=postgres;";
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Dapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class EmployeeRepositories : IEmployeeRepositories
|
||||||
|
{
|
||||||
|
private readonly IConnectionString _connectionString;
|
||||||
|
|
||||||
|
private readonly ILogger<EmployeeRepositories> _logger;
|
||||||
|
|
||||||
|
public EmployeeRepositories(IConnectionString connectionString, ILogger<EmployeeRepositories> logger)
|
||||||
|
{
|
||||||
|
_connectionString = connectionString;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateEmployee(Employee employee)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Добавление объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(employee));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryInsert = @"
|
||||||
|
INSERT INTO Employee
|
||||||
|
VALUES (DEFAULT, @PostId, @Name, @Phone, @Allowance)";
|
||||||
|
connection.Execute(queryInsert, employee);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при добавдении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateEmployee(Employee employee)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Редактирование объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}",
|
||||||
|
JsonConvert.SerializeObject(employee));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryUpdate = @"
|
||||||
|
UPDATE Employee
|
||||||
|
SET
|
||||||
|
PostId=@PostId,
|
||||||
|
Name=@Name,
|
||||||
|
Phone=@Phone,
|
||||||
|
Allowance=@Allowance
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryUpdate, employee);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteEmployee(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Удаление объекта");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryDelete = @"
|
||||||
|
DELETE FROM Employee
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryDelete, new { id });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Employee ReadEmployeeById(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение объекта по идентификатору");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = @"
|
||||||
|
SELECT * FROM Employee
|
||||||
|
WHERE Id=@id";
|
||||||
|
var employee = connection.QueryFirst<Employee>(querySelect, new { id });
|
||||||
|
_logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(employee));
|
||||||
|
return employee;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Employee> ReadEmployees()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение всех объектов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = "SELECT * FROM Employee";
|
||||||
|
var employees = connection.Query<Employee>(querySelect);
|
||||||
|
_logger.LogDebug("Полученные объекты: {json}",
|
||||||
|
JsonConvert.SerializeObject(employees));
|
||||||
|
return employees;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Dapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class PostRepositories : IPostRepositories
|
||||||
|
{
|
||||||
|
private readonly IConnectionString _connectionString;
|
||||||
|
|
||||||
|
private readonly ILogger<PostRepositories> _logger;
|
||||||
|
|
||||||
|
public PostRepositories(IConnectionString connectionString, ILogger<PostRepositories> logger)
|
||||||
|
{
|
||||||
|
_connectionString = connectionString;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreatePost(Post post)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Добавление объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(post));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryInsert = @"
|
||||||
|
INSERT INTO Post
|
||||||
|
VALUES (DEFAULT, @NamePost, @LevelPost, @Wage)";
|
||||||
|
connection.Execute(queryInsert, new { NamePost = post.NamePost.ToString(), post.LevelPost, post.Wage });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при добавдении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdatePost(Post post)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Редактирование объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}",
|
||||||
|
JsonConvert.SerializeObject(post));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryUpdate = @"
|
||||||
|
UPDATE Post
|
||||||
|
SET
|
||||||
|
NamePost=@NamePost,
|
||||||
|
LevelPost=@LevelPost,
|
||||||
|
Wage=@Wage
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryUpdate, new { id = post.Id, NamePost = post.NamePost.ToString(), post.LevelPost, post.Wage });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeletePost(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Удаление объекта");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryDelete = @"
|
||||||
|
DELETE FROM Post
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryDelete, new { id });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Post ReadPostById(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение объекта по идентификатору");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = @"
|
||||||
|
SELECT * FROM Post
|
||||||
|
WHERE Id=@id";
|
||||||
|
var post = connection.QueryFirst<Post>(querySelect, new { id });
|
||||||
|
_logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(post));
|
||||||
|
return post;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Post> ReadPosts()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение всех объектов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = "SELECT * FROM Post";
|
||||||
|
var posts = connection.Query<Post>(querySelect);
|
||||||
|
_logger.LogDebug("Полученные объекты: {json}",
|
||||||
|
JsonConvert.SerializeObject(posts));
|
||||||
|
return posts;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Dapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class ProductRepositories : IProductRepositories
|
||||||
|
{
|
||||||
|
private readonly IConnectionString _connectionString;
|
||||||
|
|
||||||
|
private readonly ILogger<ProductRepositories> _logger;
|
||||||
|
|
||||||
|
public ProductRepositories(IConnectionString connectionString, ILogger<ProductRepositories> logger)
|
||||||
|
{
|
||||||
|
_connectionString = connectionString;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateProduct(Product product)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Добавление объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(product));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryInsert = @"
|
||||||
|
INSERT INTO Product
|
||||||
|
VALUES (DEFAULT, @ClientId, @Name, @Type)";
|
||||||
|
connection.Execute(queryInsert, product);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при добавдении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateProduct(Product product)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Редактирование объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}",
|
||||||
|
JsonConvert.SerializeObject(product));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryUpdate = @"
|
||||||
|
UPDATE Product
|
||||||
|
SET
|
||||||
|
ClientId=@ClientId,
|
||||||
|
Name=@Name,
|
||||||
|
Type=@Type
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryUpdate, product);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при редактировании объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteProduct(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Удаление объекта");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryDelete = @"
|
||||||
|
DELETE FROM Product
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryDelete, new { id });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product ReadProductById(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение объекта по идентификатору");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = @"
|
||||||
|
SELECT * FROM Product
|
||||||
|
WHERE Id=@id";
|
||||||
|
var product = connection.QueryFirst<Product>(querySelect, new { id });
|
||||||
|
_logger.LogDebug("Найденный объект: {json}", JsonConvert.SerializeObject(product));
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при поиске объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Product> ReadProducts()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение всех объектов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = "SELECT * FROM Product";
|
||||||
|
var products = connection.Query<Product>(querySelect);
|
||||||
|
_logger.LogDebug("Полученные объекты: {json}",
|
||||||
|
JsonConvert.SerializeObject(products));
|
||||||
|
return products;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Dapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class TypeJobRepositories : ITypeJobRepositories
|
||||||
|
{
|
||||||
|
private readonly IConnectionString _connectionString;
|
||||||
|
|
||||||
|
private readonly ILogger<TypeJobRepositories> _logger;
|
||||||
|
|
||||||
|
public TypeJobRepositories(IConnectionString connectionString, ILogger<TypeJobRepositories> logger)
|
||||||
|
{
|
||||||
|
_connectionString = connectionString;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateTypeJob(TypeJob typeJob)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Добавление объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}",
|
||||||
|
JsonConvert.SerializeObject(typeJob));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
using var transaction = connection.BeginTransaction();
|
||||||
|
var queryInsert = @"
|
||||||
|
INSERT INTO TypeJob
|
||||||
|
VALUES (DEFAULT, @ProductId, @Director, @Description, @AllowanceForJob, @Date);
|
||||||
|
SELECT MAX(Id) FROM TypeJob";
|
||||||
|
var typeJobId = connection.QueryFirst<int>(queryInsert, typeJob, transaction);
|
||||||
|
var querySubInsert = @"
|
||||||
|
INSERT INTO WorkTime
|
||||||
|
VALUES (DEFAULT, @TypeJobId, @EmployeeId, @Hours)";
|
||||||
|
foreach (var elem in typeJob.WorkTimesDevelop)
|
||||||
|
{
|
||||||
|
connection.Execute(querySubInsert, new
|
||||||
|
{
|
||||||
|
typeJobId,
|
||||||
|
elem.EmployeeId,
|
||||||
|
elem.Hours
|
||||||
|
}, transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var elem in typeJob.WorkTimesManager)
|
||||||
|
{
|
||||||
|
connection.Execute(querySubInsert, new
|
||||||
|
{
|
||||||
|
typeJobId,
|
||||||
|
elem.EmployeeId,
|
||||||
|
elem.Hours
|
||||||
|
}, transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteTypeJob(int id)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Удаление объекта");
|
||||||
|
_logger.LogDebug("Объект: {id}", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryDelete = @"
|
||||||
|
DELETE FROM TypeJob
|
||||||
|
WHERE Id=@id";
|
||||||
|
connection.Execute(queryDelete, new { id });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при удалении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<TypeJob> ReadTypeJobs(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? directorId = null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение всех объектов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = @"SELECT * FROM TypeJob";
|
||||||
|
var typeJobs = connection.Query<TypeJob>(querySelect);
|
||||||
|
_logger.LogDebug("Полученные объекты: {json}",
|
||||||
|
JsonConvert.SerializeObject(typeJobs));
|
||||||
|
return typeJobs;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
|
using Dapper;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
|
namespace Accounting_Time_It_Company.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class VacationRepositories : IVacationRepositories
|
||||||
|
{
|
||||||
|
private readonly IConnectionString _connectionString;
|
||||||
|
|
||||||
|
private readonly ILogger<VacationRepositories> _logger;
|
||||||
|
|
||||||
|
public VacationRepositories(IConnectionString connectionString, ILogger<VacationRepositories> logger)
|
||||||
|
{
|
||||||
|
_connectionString = connectionString;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateVacation(Vacation vacation)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Добавление объекта");
|
||||||
|
_logger.LogDebug("Объект: {json}",
|
||||||
|
JsonConvert.SerializeObject(vacation));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var queryInsert = @"
|
||||||
|
INSERT INTO Vacation
|
||||||
|
VALUES (DEFAULT, @DirectorId, @EmployeeId, @StartDate, @EndDate)";
|
||||||
|
connection.Execute(queryInsert, vacation);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Vacation> ReadVacations(DateTime? startDateFrom = null, DateTime? startDateTo = null,
|
||||||
|
DateTime? endDateFrom = null, DateTime? endtDateTo = null, int? employeeId = null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Получение всех объектов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||||
|
connection.Open();
|
||||||
|
var querySelect = "SELECT * FROM Vacation";
|
||||||
|
var vacations = connection.Query<Vacation>(querySelect);
|
||||||
|
_logger.LogDebug("Полученные объекты: {json}",
|
||||||
|
JsonConvert.SerializeObject(vacations));
|
||||||
|
return vacations;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
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 |
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [ "Serilog.Sinks.File" ],
|
||||||
|
"MinimumLevel": "Debug",
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
"path": "Logs/company_log.txt",
|
||||||
|
"rollingInterval": "Day"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user