ПИбд-21. Абакаров А.А. Лабораторная работа 1 #2

Closed
A-r-s-l-a-n wants to merge 1 commits from Laba1 into main
61 changed files with 4361 additions and 75 deletions

View File

@ -0,0 +1,24 @@
using ProjectRepairWork.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities;
public class Contractors
{
public int Id { get; private set; }
public string CompanyName { get; private set; } = string.Empty;
public string Contacts { get; private set; } = string.Empty;
public static Contractors CreatEntity(int id, string companyName, string contants)
{
return new Contractors
{ Id = id,
CompanyName = companyName,
Contacts = contants
};
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities;
public class Cost
{
public int Id { get; private set; }
public int Price { get; private set; }
public static Cost CreatEntity(int id, int price)
{
return new Cost
{
Id = id,
Price = price
};
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities.Enums;
[Flags]
public enum MaterialsName
{
None = 0,
Tiles = 1, // напольная плитка
Wallpaper = 2, // обои
Paints = 3, // краски
Furniture = 4, // мебель
Windows = 5, // окна
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities.Enums
{
public enum PremisesType
{
None = 0,
SivingSpace = 1,
OfficeSpace = 2,
}
}

View File

@ -0,0 +1,31 @@
using ProjectRepairWork.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities;
public class Premises
{
public int Id { get; private set; }
public string ClientName { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public int Area { get; private set; }
public PremisesType PremisesType { get; private set; }
public DateTime DateStart { get; private set; }
public DateTime DateEnd { get; private set; }
public static Premises CreatEntity(int id, string clientName, string address, int area, DateTime dateStart, DateTime dateEnd, PremisesType premisesType)
{
return new Premises
{
Id = id,
ClientName = clientName,
Address = address,
Area = area,
DateStart = dateStart,
DateEnd = dateEnd,
PremisesType = premisesType
};
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities;
public class Repair
{
public int Id { get; private set; }
public int ContractorsId { get; private set; }
public int PremisesId { get; private set; }
public IEnumerable<RepairRepair> RepairRepair { get; private set; } = [];
public static Repair CreatOpertions(int id, int contractorsId, int premisesId, IEnumerable<RepairRepair> repairRepair)
{
return new Repair
{
Id = id,
ContractorsId = contractorsId,
PremisesId = premisesId,
RepairRepair = repairRepair,
};
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities;
public class RepairRepair
{
public int Id { get; private set; }
public int WorkId { get; private set; }
public int Count { get; private set; }
public static RepairRepair CreatElement(int id, int workId, int count)
{
return new RepairRepair
{
Id = id,
WorkId = workId,
Count = count,
};
}
}

View File

@ -0,0 +1,24 @@
using ProjectRepairWork.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Entities;
public class Works
{
public int Id { get; private set; }
public string WorkName { get; private set; } = string.Empty;
public MaterialsName MaterialsName { get; private set; }
public static Works CreatEntity(int id, string workName, MaterialsName materialsName)
{
return new Works
{
Id = id,
WorkName = workName,
MaterialsName = materialsName
};
}
}

View File

@ -1,39 +0,0 @@
namespace ProjectRepairWork
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

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

View File

@ -0,0 +1,138 @@
namespace ProjectRepairWork
{
partial class FormRepairWork
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
ContractorsToolStripMenuItem = new ToolStripMenuItem();
PremisesToolStripMenuItem = new ToolStripMenuItem();
CostToolStripMenuItem = new ToolStripMenuItem();
WorksToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
RepairToolStripMenuItem = 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 = "menuStrip";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ContractorsToolStripMenuItem, PremisesToolStripMenuItem, CostToolStripMenuItem, WorksToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
//
// ContractorsToolStripMenuItem
//
ContractorsToolStripMenuItem.Name = "ContractorsToolStripMenuItem";
ContractorsToolStripMenuItem.Size = new Size(224, 26);
ContractorsToolStripMenuItem.Text = "Подрядчики";
ContractorsToolStripMenuItem.Click += ContractorsToolStripMenuItem_Click;
//
// PremisesToolStripMenuItem
//
PremisesToolStripMenuItem.Name = "PremisesToolStripMenuItem";
PremisesToolStripMenuItem.Size = new Size(224, 26);
PremisesToolStripMenuItem.Text = "Помещения";
PremisesToolStripMenuItem.Click += PremisesToolStripMenuItem_Click;
//
// CostToolStripMenuItem
//
CostToolStripMenuItem.Name = "CostToolStripMenuItem";
CostToolStripMenuItem.Size = new Size(224, 26);
CostToolStripMenuItem.Text = "Затраты";
CostToolStripMenuItem.Click += CostToolStripMenuItem_Click;
//
// WorksToolStripMenuItem
//
WorksToolStripMenuItem.Name = "WorksToolStripMenuItem";
WorksToolStripMenuItem.Size = new Size(224, 26);
WorksToolStripMenuItem.Text = "Работы";
WorksToolStripMenuItem.Click += WorksToolStripMenuItem_Click;
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { RepairToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(95, 24);
операцииToolStripMenuItem.Text = "Операции";
//
// RepairToolStripMenuItem
//
RepairToolStripMenuItem.Name = "RepairToolStripMenuItem";
RepairToolStripMenuItem.Size = new Size(224, 26);
RepairToolStripMenuItem.Text = "Ремонт";
RepairToolStripMenuItem.Click += RepairToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(73, 24);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// FormRepairWork
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackgroundImage = Properties.Resources.photo_2024_11_11_02_05_26;
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(800, 450);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "FormRepairWork";
StartPosition = FormStartPosition.CenterScreen;
Text = "Ремонтные работы";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem ContractorsToolStripMenuItem;
private ToolStripMenuItem PremisesToolStripMenuItem;
private ToolStripMenuItem CostToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem RepairToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem WorksToolStripMenuItem;
}
}

View File

@ -0,0 +1,76 @@
using ProjectRepairWork.Forms;
using System.ComponentModel;
using Unity;
namespace ProjectRepairWork
{
public partial class FormRepairWork : Form
{
private readonly IUnityContainer _container;
public FormRepairWork(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void WorksToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormWorks>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void CostToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCost>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void PremisesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPremises>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ContractorsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormContractors>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void RepairToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormRepairs>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

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

View File

@ -0,0 +1,118 @@
namespace ProjectRepairWork.Forms
{
partial class FormContractor
{
/// <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()
{
textBoxContacts = new TextBox();
Contacts = new Label();
textBoxCompanyName = new TextBox();
CompanyName = new Label();
ButtonCancel = new Button();
ButtonSave = new Button();
SuspendLayout();
//
// textBoxContacts
//
textBoxContacts.Location = new Point(192, 95);
textBoxContacts.Name = "textBoxContacts";
textBoxContacts.Size = new Size(200, 27);
textBoxContacts.TabIndex = 18;
textBoxContacts.Text = "+7";
//
// Contacts
//
Contacts.AutoSize = true;
Contacts.Location = new Point(107, 98);
Contacts.Name = "Contacts";
Contacts.Size = new Size(69, 20);
Contacts.TabIndex = 17;
Contacts.Text = "Телефон";
//
// textBoxCompanyName
//
textBoxCompanyName.Location = new Point(192, 42);
textBoxCompanyName.Name = "textBoxCompanyName";
textBoxCompanyName.Size = new Size(200, 27);
textBoxCompanyName.TabIndex = 16;
//
// CompanyName
//
CompanyName.AutoSize = true;
CompanyName.Location = new Point(12, 45);
CompanyName.Name = "CompanyName";
CompanyName.Size = new Size(164, 20);
CompanyName.TabIndex = 15;
CompanyName.Text = "Название подрядчика";
//
// ButtonCancel
//
ButtonCancel.Location = new Point(223, 165);
ButtonCancel.Name = "ButtonCancel";
ButtonCancel.Size = new Size(169, 29);
ButtonCancel.TabIndex = 20;
ButtonCancel.Text = "Отмена";
ButtonCancel.UseVisualStyleBackColor = true;
ButtonCancel.Click += Cancel_Click;
//
// ButtonSave
//
ButtonSave.Location = new Point(12, 165);
ButtonSave.Name = "ButtonSave";
ButtonSave.Size = new Size(169, 29);
ButtonSave.TabIndex = 19;
ButtonSave.Text = "Сохранить";
ButtonSave.UseVisualStyleBackColor = true;
ButtonSave.Click += Save_Click;
//
// FormContractor
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(403, 217);
Controls.Add(ButtonCancel);
Controls.Add(ButtonSave);
Controls.Add(textBoxContacts);
Controls.Add(Contacts);
Controls.Add(textBoxCompanyName);
Controls.Add(CompanyName);
Name = "FormContractor";
Text = "Подрядчик";
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBoxContacts;
private Label Contacts;
private TextBox textBoxCompanyName;
private Label CompanyName;
private Button ButtonCancel;
private Button ButtonSave;
}
}

View File

@ -0,0 +1,75 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Entities;
using ProjectRepairWork.Repositories.Implementation;
using ProjectRepairWork.Entities.Enums;
using System.Diagnostics.Contracts;
namespace ProjectRepairWork.Forms
{
public partial class FormContractor : Form
{
private readonly IContractorsRepository _contractorsRepository;
private int? _contractorsId;
public int Id
{
set
{
try
{
var contractors = _contractorsRepository.ReadContractorsById(value);
if (contractors == null)
{
throw new InvalidDataException(nameof(contractors));
}
textBoxCompanyName.Text = contractors.CompanyName;
textBoxContacts.Text = contractors.Contacts;
_contractorsId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormContractor(IContractorsRepository contractorsRepository)
{
InitializeComponent();
_contractorsRepository = contractorsRepository ?? throw new ArgumentNullException(nameof(contractorsRepository));
}
private void Cancel_Click(object sender, EventArgs e) => Close();
private Contractors CreateContractors(int id) => Contractors.CreatEntity(
id,
textBoxCompanyName.Text,
textBoxContacts.Text);
private void Save_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxCompanyName.Text) ||
string.IsNullOrWhiteSpace(textBoxContacts.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_contractorsId.HasValue)
{
_contractorsRepository.UpdateContractors(CreateContractors(_contractorsId.Value));
}
else
{
_contractorsRepository.CreateContractors(CreateContractors(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -1,17 +1,17 @@
<?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
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -0,0 +1,125 @@
namespace ProjectRepairWork.Forms
{
partial class FormContractors
{
/// <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();
panel1 = new Panel();
ButtonDel = new Button();
ButtonUpd = new Button();
ButtonAdd = new Button();
((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.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(771, 446);
dataGridView.TabIndex = 3;
//
// panel1
//
panel1.Controls.Add(ButtonDel);
panel1.Controls.Add(ButtonUpd);
panel1.Controls.Add(ButtonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(771, 0);
panel1.Name = "panel1";
panel1.Size = new Size(167, 446);
panel1.TabIndex = 2;
//
// ButtonDel
//
ButtonDel.BackgroundImage = Properties.Resources.free_icon_font_cross;
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
ButtonDel.Location = new Point(32, 252);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(105, 92);
ButtonDel.TabIndex = 2;
ButtonDel.UseVisualStyleBackColor = true;
ButtonDel.Click += ButtonDel_Click;
//
// ButtonUpd
//
ButtonUpd.BackgroundImage = Properties.Resources.free_icon_font_pencil_3917376;
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonUpd.Location = new Point(32, 137);
ButtonUpd.Name = "ButtonUpd";
ButtonUpd.Size = new Size(105, 92);
ButtonUpd.TabIndex = 1;
ButtonUpd.UseVisualStyleBackColor = true;
ButtonUpd.Click += ButtonUpd_Click;
//
// ButtonAdd
//
ButtonAdd.BackgroundImage = Properties.Resources.free_icon_font_plus;
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonAdd.Location = new Point(32, 12);
ButtonAdd.Name = "ButtonAdd";
ButtonAdd.Size = new Size(105, 92);
ButtonAdd.TabIndex = 0;
ButtonAdd.UseVisualStyleBackColor = true;
ButtonAdd.Click += ButtonAdd_Click;
//
// FormContractors
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(938, 446);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormContractors";
Text = "Подрядчики";
Load += FormContractors_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Panel panel1;
private Button ButtonDel;
private Button ButtonUpd;
private Button ButtonAdd;
}
}

View File

@ -0,0 +1,107 @@
using ProjectRepairWork.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 System.Xml.Linq;
using Unity;
namespace ProjectRepairWork.Forms
{
public partial class FormContractors : Form
{
private readonly IUnityContainer _container;
private readonly IContractorsRepository _contractorsRepository;
public FormContractors(IUnityContainer container, IContractorsRepository premisesRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_contractorsRepository = premisesRepository ?? throw new ArgumentNullException(nameof(premisesRepository));
}
private void FormContractors_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<FormContractor>().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<FormPremise>();
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
{
_contractorsRepository.DeletedContractors(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _contractorsRepository.ReadContractors();
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

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

View File

@ -0,0 +1,98 @@
namespace ProjectRepairWork.Forms
{
partial class FormCost
{
/// <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()
{
ButtonCancel = new Button();
ButtonSave = new Button();
numericUpDownPrice = new NumericUpDown();
PriceLabel = new Label();
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
SuspendLayout();
//
// ButtonCancel
//
ButtonCancel.Location = new Point(220, 211);
ButtonCancel.Name = "ButtonCancel";
ButtonCancel.Size = new Size(170, 29);
ButtonCancel.TabIndex = 16;
ButtonCancel.Text = "Отмена";
ButtonCancel.UseVisualStyleBackColor = true;
ButtonCancel.Click += ButtonCancel_Click;
//
// ButtonSave
//
ButtonSave.Location = new Point(18, 211);
ButtonSave.Name = "ButtonSave";
ButtonSave.Size = new Size(170, 29);
ButtonSave.TabIndex = 15;
ButtonSave.Text = "Сохранить";
ButtonSave.UseVisualStyleBackColor = true;
ButtonSave.Click += ButtonSave_Click;
//
// numericUpDownPrice
//
numericUpDownPrice.Location = new Point(180, 97);
numericUpDownPrice.Name = "numericUpDownPrice";
numericUpDownPrice.Size = new Size(200, 27);
numericUpDownPrice.TabIndex = 14;
numericUpDownPrice.Value = new decimal(new int[] { 1, 0, 0, 131072 });
//
// PriceLabel
//
PriceLabel.AutoSize = true;
PriceLabel.Location = new Point(72, 104);
PriceLabel.Name = "PriceLabel";
PriceLabel.Size = new Size(83, 20);
PriceLabel.TabIndex = 13;
PriceLabel.Text = "Стоимость";
//
// FormCost
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(408, 259);
Controls.Add(ButtonCancel);
Controls.Add(ButtonSave);
Controls.Add(numericUpDownPrice);
Controls.Add(PriceLabel);
Name = "FormCost";
Text = "Затрата";
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button ButtonCancel;
private Button ButtonSave;
private NumericUpDown numericUpDownPrice;
private Label PriceLabel;
}
}

View File

@ -0,0 +1,82 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Entities;
using ProjectRepairWork.Repositories.Implementation;
using System.Windows.Forms;
using ProjectRepairWork.Entities.Enums;
namespace ProjectRepairWork.Forms
{
public partial class FormCost : Form
{
private readonly ICostRepository _costRepository;
private int? _costId;
public int Id
{
set
{
try
{
var premises = _costRepository.ReadCostById(value);
if (premises == null)
{
throw new InvalidDataException(nameof(premises));
}
numericUpDownPrice.Value = (decimal)premises.Price;
_costId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormCost(ICostRepository costRepository)
{
InitializeComponent();
_costRepository = costRepository ?? throw new ArgumentNullException(nameof(costRepository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (numericUpDownPrice.Value == 0)
{
throw new Exception("Имеются незаполненные поля");
}
if (_costId.HasValue)
{
_costRepository.UpdateCost(CreateCost(_costId.Value));
}
else
{
_costRepository.CreateCost(CreateCost(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private Cost CreateCost(int id) => Cost.CreatEntity(
id, Convert.ToInt32(numericUpDownPrice.Value));
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
}
}

View File

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

View File

@ -0,0 +1,125 @@
namespace ProjectRepairWork.Forms
{
partial class FormCosts
{
/// <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();
panel1 = new Panel();
ButtonDel = new Button();
ButtonUpd = new Button();
ButtonAdd = new Button();
((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.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(633, 450);
dataGridView.TabIndex = 5;
//
// panel1
//
panel1.Controls.Add(ButtonDel);
panel1.Controls.Add(ButtonUpd);
panel1.Controls.Add(ButtonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(633, 0);
panel1.Name = "panel1";
panel1.Size = new Size(167, 450);
panel1.TabIndex = 4;
//
// ButtonDel
//
ButtonDel.BackgroundImage = Properties.Resources.free_icon_font_cross;
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
ButtonDel.Location = new Point(32, 252);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(105, 92);
ButtonDel.TabIndex = 2;
ButtonDel.UseVisualStyleBackColor = true;
ButtonDel.Click += ButtonDel_Click;
//
// ButtonUpd
//
ButtonUpd.BackgroundImage = Properties.Resources.free_icon_font_pencil_3917376;
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonUpd.Location = new Point(32, 137);
ButtonUpd.Name = "ButtonUpd";
ButtonUpd.Size = new Size(105, 92);
ButtonUpd.TabIndex = 1;
ButtonUpd.UseVisualStyleBackColor = true;
ButtonUpd.Click += ButtonUpd_Click;
//
// ButtonAdd
//
ButtonAdd.BackgroundImage = Properties.Resources.free_icon_font_plus;
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonAdd.Location = new Point(32, 12);
ButtonAdd.Name = "ButtonAdd";
ButtonAdd.Size = new Size(105, 92);
ButtonAdd.TabIndex = 0;
ButtonAdd.UseVisualStyleBackColor = true;
ButtonAdd.Click += ButtonAdd_Click;
//
// FormCosts
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormCosts";
Text = "Затраты";
Load += FormCosts_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Panel panel1;
private Button ButtonDel;
private Button ButtonUpd;
private Button ButtonAdd;
}
}

View File

@ -0,0 +1,107 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Repositories.Implementation;
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 System.Xml.Linq;
using Unity;
namespace ProjectRepairWork.Forms
{
public partial class FormCosts : Form
{
private readonly IUnityContainer _container;
private readonly ICostRepository _costRepository;
public FormCosts(ICostRepository costRepository, IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_costRepository = costRepository ?? throw new ArgumentNullException(nameof(costRepository));
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormCost>().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<FormPremise>();
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
{
_costRepository.DeletedCost(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _costRepository.ReadCost();
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;
}
private void FormCosts_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

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

View File

@ -0,0 +1,212 @@
namespace ProjectRepairWork.Forms
{
partial class FormPremise
{
/// <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()
{
ClientName = new Label();
textBoxClientName = new TextBox();
Address = new Label();
textBoxAddress = new TextBox();
Area = new Label();
dateTimePickerStart = new DateTimePicker();
dateTimePickerEnd = new DateTimePicker();
numericUpDownArea = new NumericUpDown();
DateStart = new Label();
DateEnd = new Label();
ButtonSave = new Button();
ButtonCancel = new Button();
labelPremisesType = new Label();
comboBoxPremisesType = new ComboBox();
((System.ComponentModel.ISupportInitialize)numericUpDownArea).BeginInit();
SuspendLayout();
//
// ClientName
//
ClientName.AutoSize = true;
ClientName.Location = new Point(96, 30);
ClientName.Name = "ClientName";
ClientName.Size = new Size(98, 20);
ClientName.TabIndex = 0;
ClientName.Text = "Имя клиента";
//
// textBoxClientName
//
textBoxClientName.Location = new Point(200, 30);
textBoxClientName.Name = "textBoxClientName";
textBoxClientName.Size = new Size(200, 27);
textBoxClientName.TabIndex = 1;
//
// Address
//
Address.AutoSize = true;
Address.Location = new Point(143, 76);
Address.Name = "Address";
Address.Size = new Size(51, 20);
Address.TabIndex = 2;
Address.Text = "Адрес";
//
// textBoxAddress
//
textBoxAddress.Location = new Point(200, 76);
textBoxAddress.Name = "textBoxAddress";
textBoxAddress.Size = new Size(200, 27);
textBoxAddress.TabIndex = 3;
//
// Area
//
Area.AutoSize = true;
Area.Location = new Point(85, 130);
Area.Name = "Area";
Area.Size = new Size(109, 20);
Area.TabIndex = 4;
Area.Text = "Площадь, кв.м";
//
// dateTimePickerStart
//
dateTimePickerStart.Location = new Point(200, 217);
dateTimePickerStart.Name = "dateTimePickerStart";
dateTimePickerStart.Size = new Size(200, 27);
dateTimePickerStart.TabIndex = 6;
//
// dateTimePickerEnd
//
dateTimePickerEnd.Location = new Point(200, 250);
dateTimePickerEnd.Name = "dateTimePickerEnd";
dateTimePickerEnd.Size = new Size(200, 27);
dateTimePickerEnd.TabIndex = 7;
//
// numericUpDownArea
//
numericUpDownArea.DecimalPlaces = 2;
numericUpDownArea.Location = new Point(200, 123);
numericUpDownArea.Name = "numericUpDownArea";
numericUpDownArea.Size = new Size(200, 27);
numericUpDownArea.TabIndex = 8;
numericUpDownArea.Value = new decimal(new int[] { 1, 0, 0, 131072 });
//
// DateStart
//
DateStart.AutoSize = true;
DateStart.Location = new Point(55, 222);
DateStart.Name = "DateStart";
DateStart.Size = new Size(139, 20);
DateStart.TabIndex = 9;
DateStart.Text = "Дата начала работ";
//
// DateEnd
//
DateEnd.AutoSize = true;
DateEnd.Location = new Point(28, 255);
DateEnd.Name = "DateEnd";
DateEnd.Size = new Size(166, 20);
DateEnd.TabIndex = 10;
DateEnd.Text = "Дата окончания работ";
//
// ButtonSave
//
ButtonSave.Location = new Point(28, 316);
ButtonSave.Name = "ButtonSave";
ButtonSave.Size = new Size(170, 29);
ButtonSave.TabIndex = 11;
ButtonSave.Text = "Сохранить";
ButtonSave.UseVisualStyleBackColor = true;
ButtonSave.Click += Save_Click;
//
// ButtonCancel
//
ButtonCancel.Location = new Point(230, 316);
ButtonCancel.Name = "ButtonCancel";
ButtonCancel.Size = new Size(170, 29);
ButtonCancel.TabIndex = 12;
ButtonCancel.Text = "Отмена";
ButtonCancel.UseVisualStyleBackColor = true;
ButtonCancel.Click += Cancel_Click;
//
// labelPremisesType
//
labelPremisesType.AutoSize = true;
labelPremisesType.Location = new Point(72, 174);
labelPremisesType.Name = "labelPremisesType";
labelPremisesType.Size = new Size(122, 20);
labelPremisesType.TabIndex = 13;
labelPremisesType.Text = "Тип помещения";
//
// comboBoxPremisesType
//
comboBoxPremisesType.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPremisesType.FormattingEnabled = true;
comboBoxPremisesType.Location = new Point(200, 171);
comboBoxPremisesType.Name = "comboBoxPremisesType";
comboBoxPremisesType.Size = new Size(200, 28);
comboBoxPremisesType.TabIndex = 14;
//
// FormPremise
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(424, 376);
Controls.Add(comboBoxPremisesType);
Controls.Add(labelPremisesType);
Controls.Add(ButtonCancel);
Controls.Add(ButtonSave);
Controls.Add(DateEnd);
Controls.Add(DateStart);
Controls.Add(numericUpDownArea);
Controls.Add(dateTimePickerEnd);
Controls.Add(dateTimePickerStart);
Controls.Add(Area);
Controls.Add(textBoxAddress);
Controls.Add(Address);
Controls.Add(textBoxClientName);
Controls.Add(ClientName);
Name = "FormPremise";
StartPosition = FormStartPosition.CenterScreen;
Text = "Помещение";
((System.ComponentModel.ISupportInitialize)numericUpDownArea).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label ClientName;
private TextBox textBoxClientName;
private Label Address;
private TextBox textBoxAddress;
private Label Area;
private DateTimePicker dateTimePickerStart;
private DateTimePicker dateTimePickerEnd;
private NumericUpDown numericUpDownArea;
private Label DateStart;
private Label DateEnd;
private Button ButtonSave;
private Button ButtonCancel;
private Label labelPremisesType;
private ComboBox comboBoxPremisesType;
}
}

View File

@ -0,0 +1,88 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Entities;
using ProjectRepairWork.Repositories.Implementation;
using System.Windows.Forms;
using ProjectRepairWork.Entities.Enums;
namespace ProjectRepairWork.Forms
{
public partial class FormPremise : Form
{
private readonly IPremisesRepository _premisesRepository;
private int? _premisesId;
public int Id
{
set
{
try
{
var premises = _premisesRepository.ReadPremisesById(value);
if (premises == null)
{
throw new InvalidDataException(nameof(premises));
}
textBoxClientName.Text = premises.ClientName;
textBoxAddress.Text = premises.Address;
numericUpDownArea.Value = (decimal)premises.Area;
dateTimePickerStart.Value = DateTime.Now;
dateTimePickerEnd.Value = DateTime.Now;
comboBoxPremisesType.SelectedItem = premises.PremisesType;
_premisesId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormPremise(IPremisesRepository premisesRepository)
{
InitializeComponent();
_premisesRepository = premisesRepository ?? throw new ArgumentNullException(nameof(premisesRepository));
comboBoxPremisesType.DataSource = Enum.GetValues(typeof(PremisesType));
}
private void Save_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxClientName.Text) ||
string.IsNullOrWhiteSpace(textBoxAddress.Text) ||
comboBoxPremisesType.SelectedIndex < 1)
{
throw new Exception("Имеются незаполненные поля");
}
if (_premisesId.HasValue)
{
_premisesRepository.UpdatePremises(CreatePremises(_premisesId.Value));
}
else
{
_premisesRepository.CreatePremises(CreatePremises(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Cancel_Click(object sender, EventArgs e) => Close();
private Premises CreatePremises(int id) => Premises.CreatEntity(
id,
textBoxClientName.Text,
textBoxAddress.Text,
Convert.ToInt32(numericUpDownArea.Value),
dateTimePickerStart.Value, dateTimePickerStart.Value, (PremisesType)comboBoxPremisesType.SelectedItem!);
}
}

View File

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

View File

@ -0,0 +1,126 @@
namespace ProjectRepairWork.Forms
{
partial class FormPremises
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
ButtonDel = new Button();
ButtonUpd = new Button();
ButtonAdd = new Button();
dataGridView = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(ButtonDel);
panel1.Controls.Add(ButtonUpd);
panel1.Controls.Add(ButtonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(771, 0);
panel1.Name = "panel1";
panel1.Size = new Size(167, 446);
panel1.TabIndex = 0;
//
// ButtonDel
//
ButtonDel.BackgroundImage = Properties.Resources.free_icon_font_cross;
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
ButtonDel.Location = new Point(32, 252);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(105, 92);
ButtonDel.TabIndex = 2;
ButtonDel.UseVisualStyleBackColor = true;
ButtonDel.Click += ButtonDel_Click;
//
// ButtonUpd
//
ButtonUpd.BackgroundImage = Properties.Resources.free_icon_font_pencil_3917376;
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonUpd.Location = new Point(32, 137);
ButtonUpd.Name = "ButtonUpd";
ButtonUpd.Size = new Size(105, 92);
ButtonUpd.TabIndex = 1;
ButtonUpd.UseVisualStyleBackColor = true;
ButtonUpd.Click += ButtonUpd_Click;
//
// ButtonAdd
//
ButtonAdd.BackgroundImage = Properties.Resources.free_icon_font_plus;
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonAdd.Location = new Point(32, 12);
ButtonAdd.Name = "ButtonAdd";
ButtonAdd.Size = new Size(105, 92);
ButtonAdd.TabIndex = 0;
ButtonAdd.UseVisualStyleBackColor = true;
ButtonAdd.Click += ButtonAdd_Click;
//
// 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.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(771, 446);
dataGridView.TabIndex = 1;
//
// FormPremises
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(938, 446);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormPremises";
StartPosition = FormStartPosition.CenterScreen;
Text = "Помещения";
Load += FormPremises_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button ButtonAdd;
private DataGridView dataGridView;
private Button ButtonDel;
private Button ButtonUpd;
}
}

View File

@ -0,0 +1,96 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Entities;
using Unity;
namespace ProjectRepairWork.Forms
{
public partial class FormPremises : Form
{
private readonly IUnityContainer _container;
private readonly IPremisesRepository _premisesRepository;
public FormPremises(IUnityContainer container, IPremisesRepository premisesRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_premisesRepository = premisesRepository ?? throw new ArgumentNullException(nameof(premisesRepository));
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPremise>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormPremises_Load(object sender, EventArgs e)
{
try
{
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<FormPremise>();
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
{
_premisesRepository.DeletePremises(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _premisesRepository.ReadPremises();
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

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

View File

@ -0,0 +1,160 @@
namespace ProjectRepairWork.Forms
{
partial class FormRepair
{
/// <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()
{
comboBoxPremises = new ComboBox();
comboBoxContractors = new ComboBox();
ButtonCancel = new Button();
ButtonSave = new Button();
label2 = new Label();
label1 = new Label();
dataGridViewWorks = new DataGridView();
ColumnWork = new DataGridViewComboBoxColumn();
ColumnCount = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridViewWorks).BeginInit();
SuspendLayout();
//
// comboBoxPremises
//
comboBoxPremises.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPremises.FormattingEnabled = true;
comboBoxPremises.Location = new Point(152, 72);
comboBoxPremises.Margin = new Padding(3, 4, 3, 4);
comboBoxPremises.Name = "comboBoxPremises";
comboBoxPremises.Size = new Size(199, 28);
comboBoxPremises.TabIndex = 27;
//
// comboBoxContractors
//
comboBoxContractors.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxContractors.FormattingEnabled = true;
comboBoxContractors.Location = new Point(152, 28);
comboBoxContractors.Margin = new Padding(3, 4, 3, 4);
comboBoxContractors.Name = "comboBoxContractors";
comboBoxContractors.Size = new Size(199, 28);
comboBoxContractors.TabIndex = 26;
//
// ButtonCancel
//
ButtonCancel.Location = new Point(368, 418);
ButtonCancel.Margin = new Padding(3, 4, 3, 4);
ButtonCancel.Name = "ButtonCancel";
ButtonCancel.Size = new Size(110, 31);
ButtonCancel.TabIndex = 25;
ButtonCancel.Text = "Отменить";
ButtonCancel.UseVisualStyleBackColor = true;
ButtonCancel.Click += ButtonCancel_Click;
//
// ButtonSave
//
ButtonSave.Location = new Point(14, 418);
ButtonSave.Margin = new Padding(3, 4, 3, 4);
ButtonSave.Name = "ButtonSave";
ButtonSave.Size = new Size(110, 31);
ButtonSave.TabIndex = 24;
ButtonSave.Text = "Сохранить";
ButtonSave.UseVisualStyleBackColor = true;
ButtonSave.Click += ButtonSave_Click;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(29, 69);
label2.Name = "label2";
label2.Size = new Size(94, 20);
label2.TabIndex = 19;
label2.Text = "Помещения";
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(29, 28);
label1.Name = "label1";
label1.Size = new Size(95, 20);
label1.TabIndex = 18;
label1.Text = "Подрядчики";
//
// dataGridViewWorks
//
dataGridViewWorks.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewWorks.Columns.AddRange(new DataGridViewColumn[] { ColumnWork, ColumnCount });
dataGridViewWorks.Location = new Point(14, 212);
dataGridViewWorks.Name = "dataGridViewWorks";
dataGridViewWorks.RowHeadersVisible = false;
dataGridViewWorks.RowHeadersWidth = 51;
dataGridViewWorks.Size = new Size(464, 188);
dataGridViewWorks.TabIndex = 30;
//
// ColumnWork
//
ColumnWork.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnWork.HeaderText = "Вид Работы";
ColumnWork.MinimumWidth = 6;
ColumnWork.Name = "ColumnWork";
ColumnWork.Resizable = DataGridViewTriState.True;
ColumnWork.SortMode = DataGridViewColumnSortMode.Automatic;
//
// ColumnCount
//
ColumnCount.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumnCount.HeaderText = "Количество";
ColumnCount.MinimumWidth = 6;
ColumnCount.Name = "ColumnCount";
//
// FormRepair
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(490, 462);
Controls.Add(dataGridViewWorks);
Controls.Add(comboBoxPremises);
Controls.Add(comboBoxContractors);
Controls.Add(ButtonCancel);
Controls.Add(ButtonSave);
Controls.Add(label2);
Controls.Add(label1);
Name = "FormRepair";
Text = "Ремонт";
((System.ComponentModel.ISupportInitialize)dataGridViewWorks).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBoxPremises;
private ComboBox comboBoxContractors;
private Button ButtonCancel;
private Button ButtonSave;
private Label label2;
private Label label1;
private DataGridView dataGridViewWorks;
private DataGridViewComboBoxColumn ColumnWork;
private DataGridViewTextBoxColumn ColumnCount;
}
}

View File

@ -0,0 +1,78 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Entities;
using ProjectRepairWork.Repositories.Implementation;
using System.Windows.Forms;
using ProjectRepairWork.Entities.Enums;
namespace ProjectRepairWork.Forms
{
public partial class FormRepair : Form
{
private readonly IRepairRepository _repairRepository;
public FormRepair(IRepairRepository repairRepository, IContractorsRepository contractorsRepository, ICostRepository costRepository, IPremisesRepository premisesRepository, IWorksRepository worksRepository)
{
InitializeComponent();
_repairRepository = repairRepository ?? throw new ArgumentNullException(nameof(repairRepository));
comboBoxContractors.DataSource = contractorsRepository.ReadContractors();
comboBoxContractors.DisplayMember = "CompanyName";
comboBoxContractors.ValueMember = "Id";
comboBoxPremises.DataSource = premisesRepository.ReadPremises();
comboBoxPremises.DisplayMember = "Name";
comboBoxPremises.ValueMember = "Id";
ColumnWork.DataSource = worksRepository.ReadWorks();
ColumnWork.DisplayMember = "Name";
ColumnWork.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (dataGridViewWorks.RowCount < 1|| comboBoxContractors.SelectedIndex < 0 ||
comboBoxPremises.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_repairRepository.CraeteRepair(Repair.CreatOpertions(0,
(int)comboBoxContractors.SelectedValue!,
(int)comboBoxPremises.SelectedValue!, CreateRepairFromDataGrid()));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private List<RepairRepair> CreateRepairFromDataGrid()
{
var list = new List<RepairRepair>();
foreach(DataGridViewRow row in dataGridViewWorks.Rows)
{
if (row.Cells["ColumnWork"].Value == null ||
row.Cells["ColumnCount"].Value == null)
{
continue;
}
list.Add(RepairRepair.CreatElement(0,
Convert.ToInt32(row.Cells["ColumnWork"].Value),
Convert.ToInt32(row.Cells["ColumnCount"].Value)));
}
return list;
}
}
}

View File

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

View File

@ -0,0 +1,97 @@
namespace ProjectRepairWork.Forms
{
partial class FormRepairs
{
/// <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();
panel1 = new Panel();
ButtonAdd = new Button();
((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.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(633, 450);
dataGridView.TabIndex = 3;
//
// panel1
//
panel1.Controls.Add(ButtonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(633, 0);
panel1.Name = "panel1";
panel1.Size = new Size(167, 450);
panel1.TabIndex = 2;
//
// ButtonAdd
//
ButtonAdd.BackgroundImage = Properties.Resources.free_icon_font_plus;
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonAdd.Location = new Point(32, 12);
ButtonAdd.Name = "ButtonAdd";
ButtonAdd.Size = new Size(105, 92);
ButtonAdd.TabIndex = 0;
ButtonAdd.UseVisualStyleBackColor = true;
ButtonAdd.Click += ButtonAdd_Click;
//
// FormRepairs
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormRepairs";
Text = "Ремонтные работы";
Load += FormRepairs_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Panel panel1;
private Button ButtonAdd;
}
}

View File

@ -0,0 +1,52 @@
using ProjectRepairWork.Repositories;
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 ProjectRepairWork.Forms
{
public partial class FormRepairs : Form
{
private readonly IUnityContainer _container;
private readonly IRepairRepository _repairRepository;
public FormRepairs(IUnityContainer container, IRepairRepository repairRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_repairRepository = repairRepository ?? throw new ArgumentNullException(nameof(repairRepository));
}
private void FormRepairs_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _repairRepository.ReadRepair();
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormRepair>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

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

View File

@ -0,0 +1,117 @@
namespace ProjectRepairWork.Forms
{
partial class FormWork
{
/// <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()
{
labelMaterialsName = new Label();
textBoxWorksName = new TextBox();
WorksName = new Label();
Cancel = new Button();
Save = new Button();
checkedListBoxMaterialsName = new CheckedListBox();
SuspendLayout();
//
// labelMaterialsName
//
labelMaterialsName.AutoSize = true;
labelMaterialsName.Location = new Point(103, 80);
labelMaterialsName.Name = "labelMaterialsName";
labelMaterialsName.Size = new Size(89, 20);
labelMaterialsName.TabIndex = 17;
labelMaterialsName.Text = "Материалы";
//
// textBoxWorksName
//
textBoxWorksName.Location = new Point(198, 26);
textBoxWorksName.Name = "textBoxWorksName";
textBoxWorksName.Size = new Size(200, 27);
textBoxWorksName.TabIndex = 16;
//
// WorksName
//
WorksName.AutoSize = true;
WorksName.Location = new Point(22, 29);
WorksName.Name = "WorksName";
WorksName.Size = new Size(170, 20);
WorksName.TabIndex = 15;
WorksName.Text = "Название вида работы";
//
// Cancel
//
Cancel.Location = new Point(228, 233);
Cancel.Name = "Cancel";
Cancel.Size = new Size(170, 30);
Cancel.TabIndex = 20;
Cancel.Text = "Отмена";
Cancel.UseVisualStyleBackColor = true;
Cancel.Click += Cancel_Click;
//
// Save
//
Save.Location = new Point(22, 233);
Save.Name = "Save";
Save.Size = new Size(170, 30);
Save.TabIndex = 19;
Save.Text = "Сохранить";
Save.UseVisualStyleBackColor = true;
Save.Click += Save_Click;
//
// checkedListBoxMaterialsName
//
checkedListBoxMaterialsName.FormattingEnabled = true;
checkedListBoxMaterialsName.Location = new Point(202, 80);
checkedListBoxMaterialsName.Name = "checkedListBoxMaterialsName";
checkedListBoxMaterialsName.Size = new Size(196, 114);
checkedListBoxMaterialsName.TabIndex = 21;
//
// FormWork
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(410, 288);
Controls.Add(checkedListBoxMaterialsName);
Controls.Add(Cancel);
Controls.Add(Save);
Controls.Add(labelMaterialsName);
Controls.Add(textBoxWorksName);
Controls.Add(WorksName);
Name = "FormWork";
Text = "Работа";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label labelMaterialsName;
private TextBox textBoxWorksName;
private Label WorksName;
private Button Cancel;
private Button Save;
private CheckedListBox checkedListBoxMaterialsName;
}
}

View File

@ -0,0 +1,95 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Entities;
using ProjectRepairWork.Repositories.Implementation;
using System.Windows.Forms;
using ProjectRepairWork.Entities.Enums;
namespace ProjectRepairWork.Forms
{
public partial class FormWork : Form
{
private readonly IWorksRepository _worksRepository;
private int? _worksId;
public int Id
{
set
{
try
{
var works = _worksRepository.ReadWorksById(value);
if (works == null)
{
throw new InvalidDataException(nameof(works));
}
foreach (MaterialsName elem in Enum.GetValues(typeof(MaterialsName)))
{
if ((elem & works.MaterialsName) != 0)
{
checkedListBoxMaterialsName.SetItemChecked(checkedListBoxMaterialsName.Items.IndexOf(elem), true);
}
}
textBoxWorksName.Text = works.WorkName;
_worksId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormWork(IWorksRepository worksRepository)
{
InitializeComponent();
_worksRepository = worksRepository ?? throw new ArgumentNullException(nameof(worksRepository));
foreach(var elem in Enum.GetValues(typeof(MaterialsName)))
{
checkedListBoxMaterialsName.Items.Add(elem);
}
}
private void Save_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxWorksName.Text) ||
checkedListBoxMaterialsName.CheckedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
if (_worksId.HasValue)
{
_worksRepository.UpdateWorks(CreateWorks(_worksId.Value));
}
else
{
_worksRepository.CreateWorks(CreateWorks(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Cancel_Click(object sender, EventArgs e) => Close();
private Works CreateWorks(int id)
{
MaterialsName materialsName = MaterialsName.None;
foreach(var elem in checkedListBoxMaterialsName.CheckedItems)
{
materialsName |= (MaterialsName)elem;
}
return Works.CreatEntity(id, textBoxWorksName.Text, materialsName);
}
}
}

View File

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

View File

@ -0,0 +1,126 @@
namespace ProjectRepairWork.Forms
{
partial class FormWorks
{
/// <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();
panel1 = new Panel();
ButtonDel = new Button();
ButtonUpd = new Button();
ButtonAdd = new Button();
((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.RowHeadersVisible = false;
dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(771, 446);
dataGridView.TabIndex = 3;
//
// panel1
//
panel1.Controls.Add(ButtonDel);
panel1.Controls.Add(ButtonUpd);
panel1.Controls.Add(ButtonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(771, 0);
panel1.Name = "panel1";
panel1.Size = new Size(167, 446);
panel1.TabIndex = 2;
//
// ButtonDel
//
ButtonDel.BackgroundImage = Properties.Resources.free_icon_font_cross;
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
ButtonDel.Location = new Point(32, 252);
ButtonDel.Name = "ButtonDel";
ButtonDel.Size = new Size(105, 92);
ButtonDel.TabIndex = 2;
ButtonDel.UseVisualStyleBackColor = true;
ButtonDel.Click += ButtonDel_Click;
//
// ButtonUpd
//
ButtonUpd.BackgroundImage = Properties.Resources.free_icon_font_pencil_3917376;
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonUpd.Location = new Point(32, 137);
ButtonUpd.Name = "ButtonUpd";
ButtonUpd.Size = new Size(105, 92);
ButtonUpd.TabIndex = 1;
ButtonUpd.UseVisualStyleBackColor = true;
ButtonUpd.Click += ButtonUpd_Click;
//
// ButtonAdd
//
ButtonAdd.BackgroundImage = Properties.Resources.free_icon_font_plus;
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
ButtonAdd.Location = new Point(32, 12);
ButtonAdd.Name = "ButtonAdd";
ButtonAdd.Size = new Size(105, 92);
ButtonAdd.TabIndex = 0;
ButtonAdd.UseVisualStyleBackColor = true;
ButtonAdd.Click += ButtonAdd_Click;
//
// FormWorks
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(938, 446);
Controls.Add(dataGridView);
Controls.Add(panel1);
Name = "FormWorks";
StartPosition = FormStartPosition.CenterScreen;
Text = "Работы";
Load += FormWorks_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Panel panel1;
private Button ButtonDel;
private Button ButtonUpd;
private Button ButtonAdd;
}
}

View File

@ -0,0 +1,108 @@
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Repositories.Implementation;
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 System.Xml.Linq;
using Unity;
namespace ProjectRepairWork.Forms
{
public partial class FormWorks : Form
{
private readonly IUnityContainer _container;
private readonly IWorksRepository _worksRepository;
public FormWorks(IUnityContainer container, IWorksRepository worksRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_worksRepository = worksRepository ?? throw new ArgumentNullException(nameof(worksRepository));
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormWork>().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<FormPremise>();
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
{
_worksRepository.DeleteWorks(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormWorks_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView.DataSource = _worksRepository.ReadWorks();
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

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

View File

@ -1,3 +1,7 @@
using Unity;
using ProjectRepairWork.Repositories;
using ProjectRepairWork.Repositories.Implementation;
using Unity.Lifetime;
namespace ProjectRepairWork
{
internal static class Program
@ -11,7 +15,18 @@ namespace ProjectRepairWork
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(CreateContainer().Resolve<FormRepairWork>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<ICostRepository, CostRepository>(new TransientLifetimeManager());
container.RegisterType<IContractorsRepository, ContractorsRepository>(new TransientLifetimeManager());
container.RegisterType<IPremisesRepository, PremisesRepository>(new TransientLifetimeManager());
container.RegisterType<IRepairRepository, RepairRepository>(new TransientLifetimeManager());
container.RegisterType<IWorksRepository, WorksRepository>(new TransientLifetimeManager());
return container;
}
}
}

View File

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

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectRepairWork.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("ProjectRepairWork.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap free_icon_font_cross {
get {
object obj = ResourceManager.GetObject("free-icon-font-cross", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap free_icon_font_pencil_3917376 {
get {
object obj = ResourceManager.GetObject("free-icon-font-pencil-3917376", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap free_icon_font_plus {
get {
object obj = ResourceManager.GetObject("free-icon-font-plus", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap photo_2024_11_11_02_05_26 {
get {
object obj = ResourceManager.GetObject("photo_2024-11-11_02-05-26", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

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

View File

@ -0,0 +1,18 @@
using ProjectRepairWork.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories;
public interface IContractorsRepository
{
IEnumerable<Contractors> ReadContractors();
Contractors ReadContractorsById(int id);
void CreateContractors(Contractors contractors);
void UpdateContractors(Contractors contractors);
void DeletedContractors(int id);
}

View File

@ -0,0 +1,18 @@
using ProjectRepairWork.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories;
public interface ICostRepository
{
IEnumerable<Cost> ReadCost();
Cost ReadCostById(int id);
void CreateCost(Cost cost);
void UpdateCost(Cost cost);
void DeletedCost(int id);
}

View File

@ -0,0 +1,18 @@
using ProjectRepairWork.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories;
public interface IPremisesRepository
{
IEnumerable<Premises> ReadPremises();
Premises ReadPremisesById(int id);
void CreatePremises(Premises premises);
void UpdatePremises(Premises premises);
void DeletePremises(int id);
}

View File

@ -0,0 +1,14 @@
using ProjectRepairWork.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories;
public interface IRepairRepository
{
IEnumerable<Repair> ReadRepair(int? contractorsId = null, int? costId = null, int? worksId = null, int? premisesId = null);
void CraeteRepair(Repair repair);
}

View File

@ -0,0 +1,18 @@
using ProjectRepairWork.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories;
public interface IWorksRepository
{
IEnumerable<Works> ReadWorks();
Works ReadWorksById(int id);
void CreateWorks(Works works);
void UpdateWorks(Works works);
void DeleteWorks(int id);
}

View File

@ -0,0 +1,37 @@
using ProjectRepairWork.Entities;
using ProjectRepairWork.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories.Implementation;
public class ContractorsRepository : IContractorsRepository
{
public void CreateContractors(Contractors contractors)
{
}
public void DeletedContractors(int id)
{
}
public IEnumerable<Contractors> ReadContractors()
{
return [];
}
public Contractors ReadContractorsById(int id)
{
return Contractors.CreatEntity(0, string.Empty, string.Empty);
}
public void UpdateContractors(Contractors contractors)
{
}
}

View File

@ -0,0 +1,37 @@
using ProjectRepairWork.Entities;
using ProjectRepairWork.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories.Implementation;
public class CostRepository : ICostRepository
{
public void CreateCost(Cost cost)
{
}
public void DeletedCost(int id)
{
}
public IEnumerable<Cost> ReadCost()
{
return [];
}
public Cost ReadCostById(int id)
{
return Cost.CreatEntity(0, 0);
}
public void UpdateCost(Cost cost)
{
}
}

View File

@ -0,0 +1,35 @@
using ProjectRepairWork.Entities;
using ProjectRepairWork.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories.Implementation;
public class PremisesRepository : IPremisesRepository
{
public void CreatePremises(Premises premises)
{
}
public void DeletePremises(int id)
{
}
public IEnumerable<Premises> ReadPremises()
{
return [];
}
public Premises ReadPremisesById(int id)
{
return Premises.CreatEntity(0, string.Empty, string.Empty, 0, DateTime.Now, DateTime.Now, PremisesType.None);
}
public void UpdatePremises(Premises premises)
{
}
}

View File

@ -0,0 +1,21 @@
using ProjectRepairWork.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories.Implementation;
public class RepairRepository : IRepairRepository
{
public void CraeteRepair(Repair repair)
{
}
public IEnumerable<Repair> ReadRepair(int? contractorsId = null, int? costId = null, int? worksId = null, int? premisesId = null)
{
return[];
}
}

View File

@ -0,0 +1,37 @@
using ProjectRepairWork.Entities;
using ProjectRepairWork.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectRepairWork.Repositories.Implementation;
public class WorksRepository : IWorksRepository
{
public void CreateWorks(Works works)
{
}
public void DeleteWorks(int id)
{
}
public IEnumerable<Works> ReadWorks()
{
return [];
}
public Works ReadWorksById(int id)
{
return Works.CreatEntity(0,string.Empty, MaterialsName.None);
}
public void UpdateWorks(Works works)
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB