Compare commits

..

No commits in common. "Lab1" and "main" have entirely different histories.
Lab1 ... main

53 changed files with 50 additions and 7399 deletions

View File

@ -1,23 +0,0 @@
using System;
namespace IT_Company.Entities
{
public class Cheque
{
public int Id { get; set; }
public int OrganizationId { get; set; }
public int ContractId { get; set; }
public int Amount { get; set; }
public DateTime Date { get; set; }
public static Cheque CreateOperation(int id, int organizationId, int contractId, int Amount)
{
return new Cheque
{
Id = id,
OrganizationId = organizationId,
ContractId = contractId,
Amount = Amount,
Date = DateTime.Now
};
}
}
}

View File

@ -1,27 +0,0 @@
using System;
namespace IT_Company.Entities
{
public class Contract
{
public int Id { get; set; }
public int ExecutorId { get; set; }
public int OrganizationId { get; set; }
public int Price { get; set; }
public DateTime Date { get; set; }
public bool Paid { get; set; }
public IEnumerable<ServicesContracts> ServicesContracts { get; private set; } = [];
public static Contract CreateOperation(int id, int executorId, int organizationId, int price, IEnumerable<ServicesContracts> servicesContracts)
{
return new Contract
{
Id = id,
ExecutorId = executorId,
OrganizationId = organizationId,
Price = price,
Date = DateTime.Now,
ServicesContracts = servicesContracts
};
}
}
}

View File

@ -1,10 +0,0 @@
namespace IT_Company.Entities.Enums
{
public enum ExecutorRang
{
Junior = 0,
Middle = 1,
Senior = 2,
CodeGod = 3,
}
}

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IT_Company.Entities.Enums
{
[Flags]
public enum ExecutorSkills
{
CSharp = 1,
Java = 2,
JavaScript = 4,
Python = 8,
UXUIdesigner = 16,
QAEngineering = 32,
SQL = 64
}
}

View File

@ -1,25 +0,0 @@
using IT_Company.Entities.Enums;
namespace IT_Company.Entities
{
public class Executor
{
public int Id { get; set; }
public string Name { get; set; }
public string PhoneNumber { get; set; }
public string Email { get; set; }
public ExecutorRang ExecutorRang { get; set; }
public ExecutorSkills ExecutorSkills { get; set; }
public static Executor CreateEntity(int id, string name, string phoneNumber, string email, ExecutorRang executorRang, ExecutorSkills executorSkills)
{
return new Executor
{
Id = id,
Name = name ?? string.Empty,
PhoneNumber = phoneNumber ?? string.Empty,
Email = email ?? string.Empty,
ExecutorRang = executorRang,
ExecutorSkills = executorSkills
};
}
}
}

View File

@ -1,19 +0,0 @@
namespace IT_Company.Entities
{
public class Organization
{
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string BankAccount { get; set; }
public static Organization CreateEntity(int id, string name, string address, string BankAccount)
{
return new Organization {
Id = id,
Name = name ?? string.Empty,
Address = address ?? string.Empty,
BankAccount = BankAccount ?? string.Empty
};
}
}
}

View File

@ -1,9 +0,0 @@
namespace IT_Company.Entities.Repositories
{
public interface IChequeRepository
{
void CreateCheque(Cheque cheque);
IEnumerable<Cheque> ReadCheque(DateTime? dateFrom = null, DateTime? dateTo = null, int? organizationId = null, int? contractId = null);
void DeleteCheque(int id);
}
}

View File

@ -1,10 +0,0 @@
namespace IT_Company.Entities.Repositories
{
public interface IContractRepository
{
void CreateContract(Contract contract);
IEnumerable<Contract> ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? executorId = null, int? organizationId = null, bool? Paid = null);
Contract ReadContractById(int id);
void Paid(int id, bool value);
}
}

View File

@ -1,11 +0,0 @@
namespace IT_Company.Entities.Repositories
{
public interface IExecutorRepository
{
void CreateExecutor(Executor Executor);
IEnumerable<Executor> ReadExecutors();
Executor ReadExecutorById(int id);
void UpdateExecutor(Executor Executor);
void DeleteExecutor(int id);
}
}

View File

@ -1,11 +0,0 @@
namespace IT_Company.Entities.Repositories
{
public interface IOrganizationRepository
{
void CreateOrganization(Organization organization);
IEnumerable<Organization> ReadOrganizations();
Organization ReadOrganizationById(int id);
void UpdateOrganization(Organization organization);
void DeleteOrganization(int id);
}
}

View File

@ -1,11 +0,0 @@
namespace IT_Company.Entities.Repositories
{
public interface IServiceRepository
{
void CreateService(Service Service);
IEnumerable<Service> ReadServices();
Service ReadServiceById(int id);
void UpdateService(Service Service);
void DeleteService(int id);
}
}

View File

@ -1,20 +0,0 @@
using System;
namespace IT_Company.Entities.Repositories.Implementations
{
public class ChequeRepository : IChequeRepository
{
public void CreateCheque(Cheque cheque)
{
}
public void DeleteCheque(int id)
{
}
public IEnumerable<Cheque> ReadCheque(DateTime? dateFrom = null, DateTime? dateTo = null, int? organizationId = null, int? contractId = null)
{
return [];
}
}
}

View File

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IT_Company.Entities.Repositories.Implementations
{
internal class ContractRepository : IContractRepository
{
public void CreateContract(Contract contract)
{
}
public void Paid(int id, bool value)
{
}
public Contract ReadContractById(int id)
{
throw new NotImplementedException();
}
public IEnumerable<Contract> ReadContracts(DateTime? dateFrom = null, DateTime? dateTo = null, int? executorId = null, int? organizationId = null, bool? Paid = null)
{
return [];
}
}
}

View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IT_Company.Entities.Repositories.Implementations
{
internal class ExecutorRepository : IExecutorRepository
{
public void CreateExecutor(Executor Executor)
{
}
public void DeleteExecutor(int id)
{
}
public Executor ReadExecutorById(int id)
{
return Executor.CreateEntity(0,string.Empty, string.Empty, string.Empty,0,0);
}
public IEnumerable<Executor> ReadExecutors()
{
return [];
}
public void UpdateExecutor(Executor Executor)
{
}
}
}

View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IT_Company.Entities.Repositories.Implementations
{
internal class OrganizationRepository : IOrganizationRepository
{
public void CreateOrganization(Organization organization)
{
}
public void DeleteOrganization(int id)
{
}
public Organization ReadOrganizationById(int id)
{
return Organization.CreateEntity(0,string.Empty, string.Empty, string.Empty);
}
public IEnumerable<Organization> ReadOrganizations()
{
return [];
}
public void UpdateOrganization(Organization organization)
{
}
}
}

View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IT_Company.Entities.Repositories.Implementations
{
internal class ServiceRepository : IServiceRepository
{
public void CreateService(Service Service)
{
}
public void DeleteService(int id)
{
}
public Service ReadServiceById(int id)
{
return Service.CreateEntity(0,0, string.Empty);
}
public IEnumerable<Service> ReadServices()
{
return [];
}
public void UpdateService(Service Service)
{
}
}
}

View File

@ -1,19 +0,0 @@
namespace IT_Company.Entities
{
public class Service
{
public int Id { get; set; }
public int Price { get; set; }
public string Description { get; set; }
public static Service CreateEntity(int id, int price, string description)
{
return new Service
{
Id = id,
Price = price,
Description = description
};
}
}
}

View File

@ -1,21 +0,0 @@
using System;
namespace IT_Company.Entities
{
public class ServicesContracts
{
public int ServiceId { get; set; }
public int ContractId { get; set; }
public DateTime Deadline { get; set; }
public bool IsComplieted { get; set; }
public static ServicesContracts CreateEntity(int serviceId, int contractId, DateTime deadline)
{
return new ServicesContracts
{
ServiceId = serviceId,
ContractId = contractId,
Deadline = deadline,
IsComplieted = false
};
}
}
}

39
Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,39 @@
namespace 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
}
}

10
Form1.cs Normal file
View File

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

131
FormIT.Designer.cs generated
View File

@ -1,131 +0,0 @@
namespace IT_Company
{
partial class FormIT
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormIT));
menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
executorToolStripMenuItem = new ToolStripMenuItem();
organizationToolStripMenuItem = new ToolStripMenuItem();
serviceToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
chequeToolStripMenuItem = new ToolStripMenuItem();
contractToolStripMenuItem = new ToolStripMenuItem();
отчётыToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчётыToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(800, 28);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { executorToolStripMenuItem, organizationToolStripMenuItem, serviceToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
//
// executorToolStripMenuItem
//
executorToolStripMenuItem.Name = "executorToolStripMenuItem";
executorToolStripMenuItem.Size = new Size(224, 26);
executorToolStripMenuItem.Text = "Executor";
executorToolStripMenuItem.Click += executorToolStripMenuItem_Click;
//
// organizationToolStripMenuItem
//
organizationToolStripMenuItem.Name = "organizationToolStripMenuItem";
organizationToolStripMenuItem.Size = new Size(224, 26);
organizationToolStripMenuItem.Text = "Organization";
organizationToolStripMenuItem.Click += organizationToolStripMenuItem_Click;
//
// serviceToolStripMenuItem
//
serviceToolStripMenuItem.Name = "serviceToolStripMenuItem";
serviceToolStripMenuItem.Size = new Size(224, 26);
serviceToolStripMenuItem.Text = "Service";
serviceToolStripMenuItem.Click += serviceToolStripMenuItem_Click;
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { chequeToolStripMenuItem, contractToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(95, 24);
операцииToolStripMenuItem.Text = "Операции";
//
// contractToolStripMenuItem
//
contractToolStripMenuItem.Name = "contractToolStripMenuItem";
contractToolStripMenuItem.Size = new Size(224, 26);
contractToolStripMenuItem.Text = "Contract";
contractToolStripMenuItem.Click += contractToolStripMenuItem_Click;
//
// отчётыToolStripMenuItem
//
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
отчётыToolStripMenuItem.Size = new Size(73, 24);
отчётыToolStripMenuItem.Text = "Отчёты";
//
// FormIT
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = (Image)resources.GetObject("$this.BackgroundImage");
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(800, 450);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "FormIT";
Text = "FormIT";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem отчётыToolStripMenuItem;
private ToolStripMenuItem executorToolStripMenuItem;
private ToolStripMenuItem organizationToolStripMenuItem;
private ToolStripMenuItem serviceToolStripMenuItem;
private ToolStripMenuItem chequeToolStripMenuItem;
private ToolStripMenuItem contractToolStripMenuItem;
}
}

View File

@ -1,68 +0,0 @@
using Unity;
using IT_Company.Forms;
namespace IT_Company
{
public partial class FormIT : Form
{
private readonly IUnityContainer _container;
public FormIT(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void executorToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormExecutor>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void organizationToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormOrganization>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void serviceToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormService>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void contractToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormContract>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,169 +0,0 @@
namespace IT_Company.Forms
{
partial class FormContract
{
/// <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()
{
labelOrganization = new Label();
labelExecutor = new Label();
buttonSave = new Button();
buttonCancel = new Button();
comboBoxOrganizations = new ComboBox();
comboBoxExecutors = new ComboBox();
groupBoxServices = new GroupBox();
dataGridViewServices = new DataGridView();
Service = new DataGridViewComboBoxColumn();
groupBoxServices.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewServices).BeginInit();
SuspendLayout();
//
// labelOrganization
//
labelOrganization.AutoSize = true;
labelOrganization.Location = new Point(12, 15);
labelOrganization.Name = "labelOrganization";
labelOrganization.Size = new Size(105, 20);
labelOrganization.TabIndex = 5;
labelOrganization.Text = "Организация:";
//
// labelExecutor
//
labelExecutor.AutoSize = true;
labelExecutor.Location = new Point(12, 48);
labelExecutor.Name = "labelExecutor";
labelExecutor.Size = new Size(104, 20);
labelExecutor.TabIndex = 6;
labelExecutor.Text = "Исполнитель:";
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(12, 323);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 10;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(283, 323);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 11;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// comboBoxOrganizations
//
comboBoxOrganizations.FormattingEnabled = true;
comboBoxOrganizations.Location = new Point(226, 12);
comboBoxOrganizations.Name = "comboBoxOrganizations";
comboBoxOrganizations.Size = new Size(151, 28);
comboBoxOrganizations.TabIndex = 12;
//
// comboBoxExecutors
//
comboBoxExecutors.FormattingEnabled = true;
comboBoxExecutors.Location = new Point(226, 45);
comboBoxExecutors.Name = "comboBoxExecutors";
comboBoxExecutors.Size = new Size(151, 28);
comboBoxExecutors.TabIndex = 15;
//
// groupBoxServices
//
groupBoxServices.Controls.Add(dataGridViewServices);
groupBoxServices.Location = new Point(12, 79);
groupBoxServices.Name = "groupBoxServices";
groupBoxServices.Size = new Size(365, 238);
groupBoxServices.TabIndex = 16;
groupBoxServices.TabStop = false;
groupBoxServices.Text = "Услуги";
//
// dataGridViewServices
//
dataGridViewServices.AllowUserToResizeColumns = false;
dataGridViewServices.AllowUserToResizeRows = false;
dataGridViewServices.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewServices.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewServices.ColumnHeadersVisible = false;
dataGridViewServices.Columns.AddRange(new DataGridViewColumn[] { Service });
dataGridViewServices.Dock = DockStyle.Fill;
dataGridViewServices.Location = new Point(3, 23);
dataGridViewServices.Name = "dataGridViewServices";
dataGridViewServices.RowHeadersVisible = false;
dataGridViewServices.RowHeadersWidth = 51;
dataGridViewServices.Size = new Size(359, 212);
dataGridViewServices.TabIndex = 0;
//
// Service
//
Service.HeaderText = "";
Service.MinimumWidth = 6;
Service.Name = "Service";
//
// FormContract
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(389, 362);
Controls.Add(groupBoxServices);
Controls.Add(comboBoxExecutors);
Controls.Add(comboBoxOrganizations);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelExecutor);
Controls.Add(labelOrganization);
Name = "FormContract";
StartPosition = FormStartPosition.CenterParent;
Text = "Исполнитель";
groupBoxServices.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewServices).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox description;
private TextBox price;
private TextBox bankAccount;
private Label labelOrganization;
private Label labelExecutor;
private Label labelBankAccount;
private Button buttonSave;
private Button buttonCancel;
private ComboBox comboBoxOrganizations;
private ComboBox comboBoxExecutors;
private GroupBox groupBoxServices;
private DataGridView dataGridViewServices;
private DataGridViewComboBoxColumn Service;
}
}

View File

@ -1,83 +0,0 @@
using IT_Company.Entities;
using IT_Company.Entities.Repositories;
using System.Data;
namespace IT_Company.Forms
{
public partial class FormContract : Form
{
private readonly IContractRepository _contractRepository;
private int? _contractId;
public int Id
{
set
{
try
{
var contract = _contractRepository.ReadContractById(value);
if (contract != null)
{
throw new InvalidDataException(nameof(contract));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormContract(IContractRepository contractRepository)
{
InitializeComponent();
_contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository));
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(comboBoxExecutors.Text) || string.IsNullOrEmpty(comboBoxOrganizations.Text) || string.IsNullOrEmpty(dataGridViewServices.Text))
{
throw new DataException("Имеются незаполненные поля");
}
_contractRepository.CreateContract(Contract.CreateOperation(0,int.Parse(comboBoxExecutors.Text),int.Parse(comboBoxOrganizations.Text),0,CreateListServicesContractsFromDataGrid()));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private List<ServicesContracts> CreateListServicesContractsFromDataGrid()
{
{
var list = new List<ServicesContracts>();
foreach (DataGridViewRow row in dataGridViewServices.Rows)
{
if (row.Cells["Service"].Value == null)
{
continue;
}
list.Add(ServicesContracts.CreateEntity(0,
Convert.ToInt32(row.Cells["Service"].Value),DateTime.Now));
}
return list;
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Close();
}
private void price_KeyPress(object sender, KeyPressEventArgs e)
{
char c = e.KeyChar;
if (!Char.IsDigit(c) && c != 8)
e.Handled = true;
}
}
}

View File

@ -1,123 +0,0 @@
<?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="Service.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -1,98 +0,0 @@
namespace IT_Company.Forms
{
partial class FormContractList
{
/// <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()
{
dataGridView = new DataGridView();
button1 = new Button();
panel1 = new Panel();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(800, 450);
dataGridView.TabIndex = 0;
//
// button1
//
button1.Anchor = AnchorStyles.Right;
button1.Font = new Font("Segoe UI", 24F);
button1.Location = new Point(3, 3);
button1.Name = "button1";
button1.Size = new Size(90, 90);
button1.TabIndex = 1;
button1.Text = "+";
button1.UseVisualStyleBackColor = true;
button1.Click += ButtonAdd_Click;
//
// panel1
//
panel1.Controls.Add(button1);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(703, 0);
panel1.Name = "panel1";
panel1.Size = new Size(97, 450);
panel1.TabIndex = 4;
//
// FormContractList
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridView);
Name = "FormContractList";
Text = "FormExecutors";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Button button1;
private Panel panel1;
}
}

View File

@ -1,63 +0,0 @@
using IT_Company.Entities.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace IT_Company.Forms
{
public partial class FormContractList : Form
{
private readonly IUnityContainer _container;
private readonly IContractRepository _contractRepository;
public FormContractList(IUnityContainer container, IContractRepository contractRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_contractRepository = contractRepository ?? throw new ArgumentNullException(nameof(contractRepository));
}
private void 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<FormContract>().ShowDialog();
LoadList();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _contractRepository.ReadContracts();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

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

View File

@ -1,194 +0,0 @@
namespace IT_Company.Forms
{
partial class FormExecutor
{
/// <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()
{
name = new TextBox();
phoneNumber = new TextBox();
email = new TextBox();
rang = new ComboBox();
skills = new CheckedListBox();
labelName = new Label();
labelPhoneNumber = new Label();
labelEmail = new Label();
labelRang = new Label();
labelSkills = new Label();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// name
//
name.Anchor = AnchorStyles.Top | AnchorStyles.Right;
name.Location = new Point(172, 12);
name.Name = "name";
name.Size = new Size(151, 27);
name.TabIndex = 0;
//
// phoneNumber
//
phoneNumber.Anchor = AnchorStyles.Top | AnchorStyles.Right;
phoneNumber.Location = new Point(172, 45);
phoneNumber.Name = "phoneNumber";
phoneNumber.Size = new Size(151, 27);
phoneNumber.TabIndex = 1;
phoneNumber.KeyPress += PhoneNumber_KeyPress;
//
// email
//
email.Anchor = AnchorStyles.Top | AnchorStyles.Right;
email.Location = new Point(172, 78);
email.Name = "email";
email.Size = new Size(151, 27);
email.TabIndex = 2;
//
// rang
//
rang.Anchor = AnchorStyles.Top | AnchorStyles.Right;
rang.FormattingEnabled = true;
rang.Location = new Point(172, 111);
rang.Name = "rang";
rang.Size = new Size(151, 28);
rang.TabIndex = 3;
//
// skills
//
skills.Anchor = AnchorStyles.Top | AnchorStyles.Right;
skills.FormattingEnabled = true;
skills.Location = new Point(172, 145);
skills.Name = "skills";
skills.Size = new Size(151, 158);
skills.TabIndex = 4;
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(12, 15);
labelName.Name = "labelName";
labelName.Size = new Size(45, 20);
labelName.TabIndex = 5;
labelName.Text = "ФИО:";
//
// labelPhoneNumber
//
labelPhoneNumber.AutoSize = true;
labelPhoneNumber.Location = new Point(12, 48);
labelPhoneNumber.Name = "labelPhoneNumber";
labelPhoneNumber.Size = new Size(130, 20);
labelPhoneNumber.TabIndex = 6;
labelPhoneNumber.Text = "Номер телефона:";
//
// labelEmail
//
labelEmail.AutoSize = true;
labelEmail.Location = new Point(12, 81);
labelEmail.Name = "labelEmail";
labelEmail.Size = new Size(146, 20);
labelEmail.TabIndex = 7;
labelEmail.Text = "Электронная почта:";
//
// labelRang
//
labelRang.AutoSize = true;
labelRang.Location = new Point(12, 114);
labelRang.Name = "labelRang";
labelRang.Size = new Size(43, 20);
labelRang.TabIndex = 8;
labelRang.Text = "Ранг:";
//
// labelSkills
//
labelSkills.AutoSize = true;
labelSkills.Location = new Point(12, 145);
labelSkills.Name = "labelSkills";
labelSkills.Size = new Size(104, 20);
labelSkills.TabIndex = 9;
labelSkills.Text = "Способности:";
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(12, 323);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 10;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(229, 323);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 11;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormExecutor
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(334, 362);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelSkills);
Controls.Add(labelRang);
Controls.Add(labelEmail);
Controls.Add(labelPhoneNumber);
Controls.Add(labelName);
Controls.Add(skills);
Controls.Add(rang);
Controls.Add(email);
Controls.Add(phoneNumber);
Controls.Add(name);
Name = "FormExecutor";
StartPosition = FormStartPosition.CenterParent;
Text = "Исполнитель";
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox name;
private TextBox phoneNumber;
private TextBox email;
private ComboBox rang;
private CheckedListBox skills;
private Label labelName;
private Label labelPhoneNumber;
private Label labelEmail;
private Label labelRang;
private Label labelSkills;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -1,76 +0,0 @@
using IT_Company.Entities;
using IT_Company.Entities.Repositories;
using System.Data;
namespace IT_Company.Forms
{
public partial class FormExecutor : Form
{
private readonly IExecutorRepository _executorRepository;
private int? _executorId;
public int Id
{
set
{
try
{
var executor = _executorRepository.ReadExecutorById(value);
if (executor != null)
{
throw new InvalidDataException(nameof(executor));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormExecutor(IExecutorRepository executorRepository)
{
InitializeComponent();
_executorRepository = executorRepository ?? throw new ArgumentNullException(nameof(executorRepository));
rang.Items.AddRange(Enum.GetNames(typeof(Entities.Enums.ExecutorRang)));
skills.Items.AddRange(Enum.GetNames(typeof(Entities.Enums.ExecutorSkills)));
}
private void PhoneNumber_KeyPress(object sender, KeyPressEventArgs e)
{
char c = e.KeyChar;
if (!Char.IsDigit(c) && c != 8)
e.Handled = true;
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if(string.IsNullOrEmpty(name.Text) || string.IsNullOrEmpty(phoneNumber.Text) || string.IsNullOrEmpty(email.Text) || string.IsNullOrEmpty(rang.Text))
{
throw new DataException("Имеются незаполненные поля");
}
if (_executorId.HasValue)
{
_executorRepository.UpdateExecutor(CreateExecutor(_executorId.Value));
}
else
{
_executorRepository.CreateExecutor(CreateExecutor(0));
}
Close();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Close();
}
private Executor CreateExecutor(int id) => Executor.CreateEntity(id, name.Text, phoneNumber.Text, email.Text, Enum.Parse<Entities.Enums.ExecutorRang>(rang.Text), (Entities.Enums.ExecutorSkills)skills.CheckedItems.Cast<string>().Aggregate(0, (acc,i) => acc | (int)Enum.Parse<Entities.Enums.ExecutorSkills>(i)));
}
}

View File

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

View File

@ -1,128 +0,0 @@
namespace IT_Company.Forms
{
partial class FormExecutorList
{
/// <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()
{
dataGridView = new DataGridView();
button1 = new Button();
button2 = new Button();
button3 = new Button();
panel1 = new Panel();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(800, 450);
dataGridView.TabIndex = 0;
//
// button1
//
button1.Anchor = AnchorStyles.Right;
button1.Font = new Font("Segoe UI", 24F);
button1.Location = new Point(3, 3);
button1.Name = "button1";
button1.Size = new Size(90, 90);
button1.TabIndex = 1;
button1.Text = "+";
button1.UseVisualStyleBackColor = true;
button1.Click += ButtonAdd_Click;
//
// button2
//
button2.Anchor = AnchorStyles.Right;
button2.Font = new Font("Segoe UI", 24F);
button2.Location = new Point(3, 99);
button2.Name = "button2";
button2.Size = new Size(90, 90);
button2.TabIndex = 2;
button2.Text = "🗘";
button2.UseVisualStyleBackColor = true;
button2.Click += ButtonUpd_Click;
//
// button3
//
button3.Anchor = AnchorStyles.Right;
button3.Font = new Font("Segoe UI", 24F);
button3.Location = new Point(3, 195);
button3.Name = "button3";
button3.Size = new Size(90, 90);
button3.TabIndex = 3;
button3.Text = "—";
button3.UseVisualStyleBackColor = true;
button3.Click += ButtonDel_Click;
//
// panel1
//
panel1.Controls.Add(button1);
panel1.Controls.Add(button3);
panel1.Controls.Add(button2);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(703, 0);
panel1.Name = "panel1";
panel1.Size = new Size(97, 450);
panel1.TabIndex = 4;
//
// FormExecutorList
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridView);
Name = "FormExecutorList";
Text = "FormExecutors";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Button button1;
private Button button2;
private Button button3;
private Panel panel1;
}
}

View File

@ -1,104 +0,0 @@
using IT_Company.Entities.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace IT_Company.Forms
{
public partial class FormExecutorList : Form
{
private readonly IUnityContainer _container;
private readonly IExecutorRepository _executorRepository;
public FormExecutorList(IUnityContainer container, IExecutorRepository executorRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_executorRepository = executorRepository ?? throw new ArgumentNullException(nameof(executorRepository));
}
private void 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<FormExecutor>().ShowDialog();
LoadList();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if(!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormExecutor>();
form.Id = findId;
form.ShowDialog();
LoadList();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_executorRepository.DeleteExecutor(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _executorRepository.ReadExecutors();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

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

View File

@ -1,145 +0,0 @@
namespace IT_Company.Forms
{
partial class FormOrganization
{
/// <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()
{
name = new TextBox();
address = new TextBox();
bankAccount = new TextBox();
labelName = new Label();
labelAddress = new Label();
labelBankAccount = new Label();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// name
//
name.Anchor = AnchorStyles.Top | AnchorStyles.Right;
name.Location = new Point(226, 12);
name.Name = "name";
name.Size = new Size(151, 27);
name.TabIndex = 0;
//
// address
//
address.Anchor = AnchorStyles.Top | AnchorStyles.Right;
address.Location = new Point(226, 45);
address.Name = "address";
address.Size = new Size(151, 27);
address.TabIndex = 1;
//
// bankAccount
//
bankAccount.Anchor = AnchorStyles.Top | AnchorStyles.Right;
bankAccount.Location = new Point(226, 78);
bankAccount.Name = "bankAccount";
bankAccount.Size = new Size(151, 27);
bankAccount.TabIndex = 2;
//
// labelName
//
labelName.AutoSize = true;
labelName.Location = new Point(12, 15);
labelName.Name = "labelName";
labelName.Size = new Size(176, 20);
labelName.TabIndex = 5;
labelName.Text = "Название организации:";
//
// labelAddress
//
labelAddress.AutoSize = true;
labelAddress.Location = new Point(12, 48);
labelAddress.Name = "labelAddress";
labelAddress.Size = new Size(150, 20);
labelAddress.TabIndex = 6;
labelAddress.Text = "Адрес организации:";
//
// labelBankAccount
//
labelBankAccount.AutoSize = true;
labelBankAccount.Location = new Point(12, 81);
labelBankAccount.Name = "labelBankAccount";
labelBankAccount.Size = new Size(150, 20);
labelBankAccount.TabIndex = 7;
labelBankAccount.Text = "Банковский аккаунт:";
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(12, 323);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 10;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(283, 323);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 11;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormOrganization
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(389, 362);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelBankAccount);
Controls.Add(labelAddress);
Controls.Add(labelName);
Controls.Add(bankAccount);
Controls.Add(address);
Controls.Add(name);
Name = "FormOrganization";
StartPosition = FormStartPosition.CenterParent;
Text = "Исполнитель";
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox name;
private TextBox address;
private TextBox bankAccount;
private Label labelName;
private Label labelAddress;
private Label labelBankAccount;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -1,67 +0,0 @@
using IT_Company.Entities;
using IT_Company.Entities.Repositories;
using System.Data;
namespace IT_Company.Forms
{
public partial class FormOrganization: Form
{
private readonly IOrganizationRepository _organizationRepository;
private int? _organizationId;
public int Id
{
set
{
try
{
var organization = _organizationRepository.ReadOrganizationById(value);
if (organization != null)
{
throw new InvalidDataException(nameof(organization));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormOrganization(IOrganizationRepository organizationRepository)
{
InitializeComponent();
_organizationRepository = organizationRepository ?? throw new ArgumentNullException(nameof(organizationRepository));
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if(string.IsNullOrEmpty(name.Text) || string.IsNullOrEmpty(address.Text) || string.IsNullOrEmpty(bankAccount.Text))
{
throw new DataException("Имеются незаполненные поля");
}
if (_organizationId.HasValue)
{
_organizationRepository.UpdateOrganization(CreateOrganization(_organizationId.Value));
}
else
{
_organizationRepository.CreateOrganization(CreateOrganization(0));
}
Close();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Close();
}
private Organization CreateOrganization(int id) => Organization.CreateEntity(id,name.Text,address.Text,bankAccount.Text);
}
}

View File

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

View File

@ -1,128 +0,0 @@
namespace IT_Company.Forms
{
partial class FormOrganizationList
{
/// <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()
{
dataGridView = new DataGridView();
button1 = new Button();
button2 = new Button();
button3 = new Button();
panel1 = new Panel();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(800, 450);
dataGridView.TabIndex = 0;
//
// button1
//
button1.Anchor = AnchorStyles.Right;
button1.Font = new Font("Segoe UI", 24F);
button1.Location = new Point(3, 3);
button1.Name = "button1";
button1.Size = new Size(90, 90);
button1.TabIndex = 1;
button1.Text = "+";
button1.UseVisualStyleBackColor = true;
button1.Click += ButtonAdd_Click;
//
// button2
//
button2.Anchor = AnchorStyles.Right;
button2.Font = new Font("Segoe UI", 24F);
button2.Location = new Point(3, 99);
button2.Name = "button2";
button2.Size = new Size(90, 90);
button2.TabIndex = 2;
button2.Text = "🗘";
button2.UseVisualStyleBackColor = true;
button2.Click += ButtonUpd_Click;
//
// button3
//
button3.Anchor = AnchorStyles.Right;
button3.Font = new Font("Segoe UI", 24F);
button3.Location = new Point(3, 195);
button3.Name = "button3";
button3.Size = new Size(90, 90);
button3.TabIndex = 3;
button3.Text = "—";
button3.UseVisualStyleBackColor = true;
button3.Click += ButtonDel_Click;
//
// panel1
//
panel1.Controls.Add(button1);
panel1.Controls.Add(button3);
panel1.Controls.Add(button2);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(703, 0);
panel1.Name = "panel1";
panel1.Size = new Size(97, 450);
panel1.TabIndex = 4;
//
// FormOrganizationList
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridView);
Name = "FormOrganizationList";
Text = "FormExecutors";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Button button1;
private Button button2;
private Button button3;
private Panel panel1;
}
}

View File

@ -1,104 +0,0 @@
using IT_Company.Entities.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace IT_Company.Forms
{
public partial class FormOrganizationList : Form
{
private readonly IUnityContainer _container;
private readonly IOrganizationRepository _organizationRepository;
public FormOrganizationList(IUnityContainer container, IOrganizationRepository organizationRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_organizationRepository = organizationRepository ?? throw new ArgumentNullException(nameof(organizationRepository));
}
private void 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<FormOrganization>().ShowDialog();
LoadList();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if(!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormOrganization>();
form.Id = findId;
form.ShowDialog();
LoadList();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_organizationRepository.DeleteOrganization(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _organizationRepository.ReadOrganizations();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

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

View File

@ -1,125 +0,0 @@
namespace IT_Company.Forms
{
partial class FormService
{
/// <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()
{
description = new TextBox();
price = new TextBox();
labelDescription = new Label();
labelPrice = new Label();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// description
//
description.Anchor = AnchorStyles.Top | AnchorStyles.Right;
description.Location = new Point(226, 12);
description.Name = "description";
description.Size = new Size(151, 27);
description.TabIndex = 0;
//
// price
//
price.Anchor = AnchorStyles.Top | AnchorStyles.Right;
price.Location = new Point(226, 45);
price.Name = "price";
price.Size = new Size(151, 27);
price.TabIndex = 1;
price.KeyPress += price_KeyPress;
//
// labelDescription
//
labelDescription.AutoSize = true;
labelDescription.Location = new Point(12, 15);
labelDescription.Name = "labelDescription";
labelDescription.Size = new Size(82, 20);
labelDescription.TabIndex = 5;
labelDescription.Text = "Описание:";
//
// labelPrice
//
labelPrice.AutoSize = true;
labelPrice.Location = new Point(12, 48);
labelPrice.Name = "labelPrice";
labelPrice.Size = new Size(48, 20);
labelPrice.TabIndex = 6;
labelPrice.Text = "Цена:";
//
// buttonSave
//
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonSave.Location = new Point(12, 323);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 10;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// buttonCancel
//
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Location = new Point(283, 323);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 11;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// FormService
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(389, 362);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(labelPrice);
Controls.Add(labelDescription);
Controls.Add(price);
Controls.Add(description);
Name = "FormService";
StartPosition = FormStartPosition.CenterParent;
Text = "Исполнитель";
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox description;
private TextBox price;
private TextBox bankAccount;
private Label labelDescription;
private Label labelPrice;
private Label labelBankAccount;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -1,75 +0,0 @@
using IT_Company.Entities;
using IT_Company.Entities.Repositories;
using System.Data;
namespace IT_Company.Forms
{
public partial class FormService : Form
{
private readonly IServiceRepository _serviceRepository;
private int? _serviceId;
public int Id
{
set
{
try
{
var service = _serviceRepository.ReadServiceById(value);
if (service != null)
{
throw new InvalidDataException(nameof(service));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormService(IServiceRepository serviceRepository)
{
InitializeComponent();
_serviceRepository = serviceRepository ?? throw new ArgumentNullException(nameof(serviceRepository));
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(description.Text) || string.IsNullOrEmpty(price.Text) || string.IsNullOrEmpty(bankAccount.Text))
{
throw new DataException("Имеются незаполненные поля");
}
if (_serviceId.HasValue)
{
_serviceRepository.UpdateService(CreateService(_serviceId.Value));
}
else
{
_serviceRepository.CreateService(CreateService(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Close();
}
private Service CreateService(int id) => Service.CreateEntity(id,int.Parse(price.Text),description.Text);
private void price_KeyPress(object sender, KeyPressEventArgs e)
{
char c = e.KeyChar;
if (!Char.IsDigit(c) && c != 8)
e.Handled = true;
}
}
}

View File

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

View File

@ -1,128 +0,0 @@
namespace IT_Company.Forms
{
partial class FormServiceList
{
/// <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()
{
dataGridView = new DataGridView();
button1 = new Button();
button2 = new Button();
button3 = new Button();
panel1 = new Panel();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(800, 450);
dataGridView.TabIndex = 0;
//
// button1
//
button1.Anchor = AnchorStyles.Right;
button1.Font = new Font("Segoe UI", 24F);
button1.Location = new Point(3, 3);
button1.Name = "button1";
button1.Size = new Size(90, 90);
button1.TabIndex = 1;
button1.Text = "+";
button1.UseVisualStyleBackColor = true;
button1.Click += ButtonAdd_Click;
//
// button2
//
button2.Anchor = AnchorStyles.Right;
button2.Font = new Font("Segoe UI", 24F);
button2.Location = new Point(3, 99);
button2.Name = "button2";
button2.Size = new Size(90, 90);
button2.TabIndex = 2;
button2.Text = "🗘";
button2.UseVisualStyleBackColor = true;
button2.Click += ButtonUpd_Click;
//
// button3
//
button3.Anchor = AnchorStyles.Right;
button3.Font = new Font("Segoe UI", 24F);
button3.Location = new Point(3, 195);
button3.Name = "button3";
button3.Size = new Size(90, 90);
button3.TabIndex = 3;
button3.Text = "—";
button3.UseVisualStyleBackColor = true;
button3.Click += ButtonDel_Click;
//
// panel1
//
panel1.Controls.Add(button1);
panel1.Controls.Add(button3);
panel1.Controls.Add(button2);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(703, 0);
panel1.Name = "panel1";
panel1.Size = new Size(97, 450);
panel1.TabIndex = 4;
//
// FormServiceList
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridView);
Name = "FormServiceList";
Text = "FormExecutors";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Button button1;
private Button button2;
private Button button3;
private Panel panel1;
}
}

View File

@ -1,104 +0,0 @@
using IT_Company.Entities.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace IT_Company.Forms
{
public partial class FormServiceList : Form
{
private readonly IUnityContainer _container;
private readonly IServiceRepository _serviceRepository;
public FormServiceList(IUnityContainer container, IServiceRepository serviceRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_serviceRepository = serviceRepository ?? throw new ArgumentNullException(nameof(serviceRepository));
}
private void 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<FormService>().ShowDialog();
LoadList();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if(!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormService>();
form.Id = findId;
form.ShowDialog();
LoadList();
}catch(Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_serviceRepository.DeleteService(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _serviceRepository.ReadServices();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View File

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

View File

@ -9,49 +9,4 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\Background.jpg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Background.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Compile Update="Forms\FormExecutorList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormContract.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormContractList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormServiceList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormService.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\FormOrganization.cs" />
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -1,9 +1,3 @@
using IT_Company.Entities.Repositories;
using IT_Company.Entities.Repositories.Implementations;
using Unity;
using Unity.Lifetime;
using IT_Company.Forms;
namespace IT_Company
{
internal static class Program
@ -17,21 +11,7 @@ namespace IT_Company
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new FormIT(CreateConteiner()));
}
private static IUnityContainer CreateConteiner()
{
var conteiner = new UnityContainer();
conteiner.RegisterType<IChequeRepository, ChequeRepository>(new TransientLifetimeManager());
conteiner.RegisterType<IContractRepository, ContractRepository>(new TransientLifetimeManager());
conteiner.RegisterType<IExecutorRepository, ExecutorRepository>(new TransientLifetimeManager());
conteiner.RegisterType<IOrganizationRepository, OrganizationRepository>(new TransientLifetimeManager());
conteiner.RegisterType<IServiceRepository, ServiceRepository>(new TransientLifetimeManager());
return conteiner;
Application.Run(new Form1());
}
}
}

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Service" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>IT_Company.Entities.Service, IT-Company, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace 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("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;
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 KiB