сданный вариант

This commit is contained in:
Егор Пыжов 2024-11-15 02:32:00 +04:00 committed by user
parent ae85d1eea3
commit 39fc7769eb
14 changed files with 115 additions and 301 deletions

View File

@ -0,0 +1,12 @@
namespace ITServiceManager.Entities.Enums;
[Flags]
public enum ServiceType
{
None = 0,
Maintenance = 1,
Development = 2,
Testing = 4,
Support = 8,
Consulting = 16
}

View File

@ -1,17 +1,19 @@
namespace ITServiceManager.Entities; using ITServiceManager.Entities.Enums;
namespace ITServiceManager.Entities;
public class Service public class Service
{ {
public int Id { get; private set; } public int Id { get; private set; }
public string Name { get; private set; } = string.Empty; public ServiceType ServiceType { get; private set; }
public string Description { get; private set; } = string.Empty; public string Description { get; private set; } = string.Empty;
public static Service CreateEntity(int id, string serviceName, string description) public static Service CreateEntity(int id, ServiceType type, string description)
{ {
return new Service return new Service
{ {
Id = id, Id = id,
Name = serviceName, ServiceType = type,
Description = description Description = description
}; };
} }

View File

@ -45,30 +45,29 @@
// //
// dataGridView // dataGridView
// //
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnService, ColumnQuantity, ColumnExecutionDate }); dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnService, ColumnQuantity, ColumnExecutionDate });
dataGridView.Location = new Point(12, 232); dataGridView.Location = new Point(14, 309);
dataGridView.Margin = new Padding(3, 4, 3, 4);
dataGridView.MultiSelect = false; dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true; dataGridView.RowHeadersWidth = 51;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(492, 263); dataGridView.Size = new Size(562, 351);
dataGridView.TabIndex = 1; dataGridView.TabIndex = 1;
// //
// ColumnService // ColumnService
// //
ColumnService.HeaderText = "Услуга"; ColumnService.HeaderText = "Услуга";
ColumnService.MinimumWidth = 6;
ColumnService.Name = "ColumnService"; ColumnService.Name = "ColumnService";
ColumnService.ReadOnly = true;
// //
// ColumnQuantity // ColumnQuantity
// //
ColumnQuantity.HeaderText = "Количество"; ColumnQuantity.HeaderText = "Количество";
ColumnQuantity.MinimumWidth = 6;
ColumnQuantity.Name = "ColumnQuantity"; ColumnQuantity.Name = "ColumnQuantity";
ColumnQuantity.ReadOnly = true;
// //
// ColumnExecutionDate // ColumnExecutionDate
// //
@ -76,14 +75,15 @@
dataGridViewCellStyle1.NullValue = null; dataGridViewCellStyle1.NullValue = null;
ColumnExecutionDate.DefaultCellStyle = dataGridViewCellStyle1; ColumnExecutionDate.DefaultCellStyle = dataGridViewCellStyle1;
ColumnExecutionDate.HeaderText = "Срок"; ColumnExecutionDate.HeaderText = "Срок";
ColumnExecutionDate.MinimumWidth = 6;
ColumnExecutionDate.Name = "ColumnExecutionDate"; ColumnExecutionDate.Name = "ColumnExecutionDate";
ColumnExecutionDate.ReadOnly = true;
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(320, 514); buttonCancel.Location = new Point(366, 685);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(112, 28); buttonCancel.Size = new Size(128, 37);
buttonCancel.TabIndex = 9; buttonCancel.TabIndex = 9;
buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
@ -91,9 +91,10 @@
// //
// buttonAdd // buttonAdd
// //
buttonAdd.Location = new Point(64, 514); buttonAdd.Location = new Point(73, 685);
buttonAdd.Margin = new Padding(3, 4, 3, 4);
buttonAdd.Name = "buttonAdd"; buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(112, 28); buttonAdd.Size = new Size(128, 37);
buttonAdd.TabIndex = 8; buttonAdd.TabIndex = 8;
buttonAdd.Text = "Добавить"; buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true; buttonAdd.UseVisualStyleBackColor = true;
@ -102,9 +103,9 @@
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(52, 45); label1.Location = new Point(59, 60);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(63, 15); label1.Size = new Size(81, 20);
label1.TabIndex = 10; label1.TabIndex = 10;
label1.Text = "Компания"; label1.Text = "Компания";
// //
@ -112,34 +113,36 @@
// //
comboBoxCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxCompany.FormattingEnabled = true; comboBoxCompany.FormattingEnabled = true;
comboBoxCompany.Location = new Point(181, 42); comboBoxCompany.Location = new Point(207, 56);
comboBoxCompany.Margin = new Padding(3, 4, 3, 4);
comboBoxCompany.Name = "comboBoxCompany"; comboBoxCompany.Name = "comboBoxCompany";
comboBoxCompany.Size = new Size(240, 23); comboBoxCompany.Size = new Size(274, 28);
comboBoxCompany.TabIndex = 11; comboBoxCompany.TabIndex = 11;
// //
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(52, 123); label2.Location = new Point(59, 164);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(99, 15); label2.Size = new Size(125, 20);
label2.TabIndex = 12; label2.TabIndex = 12;
label2.Text = "Сумма договора"; label2.Text = "Сумма договора";
// //
// numericUpDownPrice // numericUpDownPrice
// //
numericUpDownPrice.DecimalPlaces = 2; numericUpDownPrice.DecimalPlaces = 2;
numericUpDownPrice.Location = new Point(181, 121); numericUpDownPrice.Location = new Point(207, 161);
numericUpDownPrice.Margin = new Padding(3, 4, 3, 4);
numericUpDownPrice.Maximum = new decimal(new int[] { 1000000, 0, 0, 0 }); numericUpDownPrice.Maximum = new decimal(new int[] { 1000000, 0, 0, 0 });
numericUpDownPrice.Name = "numericUpDownPrice"; numericUpDownPrice.Name = "numericUpDownPrice";
numericUpDownPrice.Size = new Size(240, 23); numericUpDownPrice.Size = new Size(274, 27);
numericUpDownPrice.TabIndex = 13; numericUpDownPrice.TabIndex = 13;
// //
// FormOrder // FormOrder
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(516, 576); ClientSize = new Size(590, 768);
Controls.Add(numericUpDownPrice); Controls.Add(numericUpDownPrice);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(comboBoxCompany); Controls.Add(comboBoxCompany);
@ -147,6 +150,7 @@
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonAdd); Controls.Add(buttonAdd);
Controls.Add(dataGridView); Controls.Add(dataGridView);
Margin = new Padding(3, 4, 3, 4);
Name = "FormOrder"; Name = "FormOrder";
Text = "Заказ"; Text = "Заказ";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();

View File

@ -26,7 +26,7 @@ namespace ITServiceManager.Forms
comboBoxCompany.ValueMember = "Id"; comboBoxCompany.ValueMember = "Id";
ColumnService.DataSource = serviceRepository.ReadServices(); ColumnService.DataSource = serviceRepository.ReadServices();
ColumnService.DisplayMember = "Name"; ColumnService.DisplayMember = "ServiceType";
ColumnService.ValueMember = "Id"; ColumnService.ValueMember = "Id";
} }
private void ButtonAdd_Click(object sender, EventArgs e) private void ButtonAdd_Click(object sender, EventArgs e)
@ -37,7 +37,7 @@ namespace ITServiceManager.Forms
} }
try try
{ {
_orderRepository.CreateOrder(Order.CreateOperation(0, comboBoxCompany.SelectedIndex, numericUpDownPrice.Value, CreateListProductFromDataGrid())); _orderRepository.CreateOrder(Order.CreateOperation(0, comboBoxCompany.SelectedIndex, numericUpDownPrice.Value, CreateListServiceFromDataGrid()));
Close(); Close();
} }
catch (Exception ex) catch (Exception ex)
@ -46,7 +46,7 @@ namespace ITServiceManager.Forms
} }
} }
private void ButtonCancel_Click(object sender, EventArgs e) => Close(); private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private List<OrderService> CreateListProductFromDataGrid() private List<OrderService> CreateListServiceFromDataGrid()
{ {
var list = new List<OrderService>(); var list = new List<OrderService>();
foreach (DataGridViewRow row in dataGridView.Rows) foreach (DataGridViewRow row in dataGridView.Rows)

View File

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

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ITServiceManager.Forms
{
public partial class FormOrderService : Form
{
public FormOrderService()
{
InitializeComponent();
}
}
}

View File

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

View File

@ -30,19 +30,18 @@
{ {
buttonCancel = new Button(); buttonCancel = new Button();
buttonAdd = new Button(); buttonAdd = new Button();
textBoxName = new TextBox();
labelDescription = new Label();
richTextBoxDescription = new RichTextBox(); richTextBoxDescription = new RichTextBox();
label1 = new Label(); label1 = new Label();
label2 = new Label(); label2 = new Label();
labelName = new Label(); checkedListBoxType = new CheckedListBox();
SuspendLayout(); SuspendLayout();
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(313, 275); buttonCancel.Location = new Point(358, 367);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(112, 28); buttonCancel.Size = new Size(128, 37);
buttonCancel.TabIndex = 7; buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
@ -50,80 +49,60 @@
// //
// buttonAdd // buttonAdd
// //
buttonAdd.Location = new Point(87, 275); buttonAdd.Location = new Point(99, 367);
buttonAdd.Margin = new Padding(3, 4, 3, 4);
buttonAdd.Name = "buttonAdd"; buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(112, 28); buttonAdd.Size = new Size(128, 37);
buttonAdd.TabIndex = 6; buttonAdd.TabIndex = 6;
buttonAdd.Text = "Добавить"; buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true; buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click; buttonAdd.Click += ButtonAdd_Click;
// //
// textBoxName
//
textBoxName.Location = new Point(243, 22);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(232, 23);
textBoxName.TabIndex = 5;
//
// labelDescription
//
labelDescription.AutoSize = true;
labelDescription.Location = new Point(21, 134);
labelDescription.Name = "labelDescription";
labelDescription.Size = new Size(102, 15);
labelDescription.TabIndex = 8;
labelDescription.Text = "Описание услуги";
//
// richTextBoxDescription // richTextBoxDescription
// //
richTextBoxDescription.Location = new Point(243, 106); richTextBoxDescription.Location = new Point(278, 159);
richTextBoxDescription.Margin = new Padding(3, 2, 3, 2);
richTextBoxDescription.Name = "richTextBoxDescription"; richTextBoxDescription.Name = "richTextBoxDescription";
richTextBoxDescription.Size = new Size(232, 132); richTextBoxDescription.Size = new Size(265, 175);
richTextBoxDescription.TabIndex = 9; richTextBoxDescription.TabIndex = 9;
richTextBoxDescription.Text = ""; richTextBoxDescription.Text = "";
// //
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(24, 25); label1.Location = new Point(68, 36);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(99, 15); label1.Size = new Size(83, 20);
label1.TabIndex = 4; label1.TabIndex = 4;
label1.Text = "Название услуги"; label1.Text = "Тип услуги";
// //
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(24, 134); label2.Location = new Point(52, 179);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(102, 15); label2.Size = new Size(127, 20);
label2.TabIndex = 8; label2.TabIndex = 8;
label2.Text = "Описание услуги"; label2.Text = "Описание услуги";
// //
// labelName // checkedListBoxType
// //
labelName.AutoSize = true; checkedListBoxType.FormattingEnabled = true;
labelName.Location = new Point(21, 22); checkedListBoxType.Location = new Point(278, 12);
labelName.Name = "labelName"; checkedListBoxType.Name = "checkedListBoxType";
labelName.Size = new Size(99, 15); checkedListBoxType.Size = new Size(265, 114);
labelName.TabIndex = 4; checkedListBoxType.TabIndex = 10;
labelName.Text = "Название услуги";
// //
// FormService // FormService
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(511, 338); ClientSize = new Size(584, 451);
Controls.Add(checkedListBoxType);
Controls.Add(richTextBoxDescription); Controls.Add(richTextBoxDescription);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(labelDescription);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonAdd); Controls.Add(buttonAdd);
Controls.Add(textBoxName);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(labelName);
Margin = new Padding(3, 2, 3, 2);
Name = "FormService"; Name = "FormService";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Услуга"; Text = "Услуга";
@ -135,11 +114,9 @@
private Button buttonCancel; private Button buttonCancel;
private Button buttonAdd; private Button buttonAdd;
private TextBox textBoxName;
private Label labelDescription;
private RichTextBox richTextBoxDescription; private RichTextBox richTextBoxDescription;
private Label label1; private Label label1;
private Label label2; private Label label2;
private Label labelName; private CheckedListBox checkedListBoxType;
} }
} }

View File

@ -1,6 +1,7 @@
using ITServiceManager.Entities.Enums; using ITServiceManager.Entities.Enums;
using ITServiceManager.Entities; using ITServiceManager.Entities;
using ITServiceManager.Repositories; using ITServiceManager.Repositories;
using Microsoft.VisualBasic.FileIO;
namespace ITServiceManager.Forms; namespace ITServiceManager.Forms;
@ -21,7 +22,16 @@ public partial class FormService : Form
throw new throw new
InvalidDataException(nameof(service)); InvalidDataException(nameof(service));
} }
textBoxName.Text = service.Name; foreach (ServiceType elem in Enum.GetValues(typeof(ServiceType)))
{
if ((elem & service.ServiceType) != 0)
{
checkedListBoxType.SetItemChecked(checkedListBoxType.Items.IndexOf(
elem), true);
}
}
richTextBoxDescription.Text = service.Description; richTextBoxDescription.Text = service.Description;
_serviceId = value; _serviceId = value;
} }
@ -37,12 +47,17 @@ public partial class FormService : Form
InitializeComponent(); InitializeComponent();
_serviceRepository = serviceRepository ?? _serviceRepository = serviceRepository ??
throw new ArgumentNullException(nameof(serviceRepository)); throw new ArgumentNullException(nameof(serviceRepository));
foreach (var elem in Enum.GetValues(typeof(ServiceType)))
{
checkedListBoxType.Items.Add(elem);
}
} }
private void ButtonAdd_Click(object sender, EventArgs e) private void ButtonAdd_Click(object sender, EventArgs e)
{ {
try try
{ {
if (string.IsNullOrWhiteSpace(textBoxName.Text) || if (checkedListBoxType.CheckedItems.Count == 0 ||
string.IsNullOrWhiteSpace(richTextBoxDescription.Text)) string.IsNullOrWhiteSpace(richTextBoxDescription.Text))
{ {
throw new Exception("Имеются незаполненные поля"); throw new Exception("Имеются незаполненные поля");
@ -64,5 +79,14 @@ public partial class FormService : Form
} }
} }
private void ButtonCancel_Click(object sender, EventArgs e) => Close(); private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Service CreateService(int id) => Service.CreateEntity(id, textBoxName.Text, richTextBoxDescription.Text); private Service CreateService(int id)
{
ServiceType serviceType = ServiceType.None;
foreach (var elem in checkedListBoxType.CheckedItems)
{
serviceType |= (ServiceType)elem;
}
return Service.CreateEntity(id, serviceType, richTextBoxDescription.Text);
}
} }

View File

@ -43,18 +43,20 @@
panel.Controls.Add(buttonRemove); panel.Controls.Add(buttonRemove);
panel.Controls.Add(buttonAdd); panel.Controls.Add(buttonAdd);
panel.Dock = DockStyle.Right; panel.Dock = DockStyle.Right;
panel.Location = new Point(652, 0); panel.Location = new Point(745, 0);
panel.Margin = new Padding(3, 4, 3, 4);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(148, 450); panel.Size = new Size(169, 600);
panel.TabIndex = 3; panel.TabIndex = 3;
// //
// buttonUpdate // buttonUpdate
// //
buttonUpdate.BackgroundImage = Properties.Resources.edit; buttonUpdate.BackgroundImage = Properties.Resources.edit;
buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpdate.Location = new Point(36, 249); buttonUpdate.Location = new Point(41, 332);
buttonUpdate.Margin = new Padding(3, 4, 3, 4);
buttonUpdate.Name = "buttonUpdate"; buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(78, 80); buttonUpdate.Size = new Size(89, 107);
buttonUpdate.TabIndex = 2; buttonUpdate.TabIndex = 2;
buttonUpdate.UseVisualStyleBackColor = true; buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += ButtonUpd_Click; buttonUpdate.Click += ButtonUpd_Click;
@ -63,9 +65,10 @@
// //
buttonRemove.BackgroundImage = Properties.Resources.minus; buttonRemove.BackgroundImage = Properties.Resources.minus;
buttonRemove.BackgroundImageLayout = ImageLayout.Stretch; buttonRemove.BackgroundImageLayout = ImageLayout.Stretch;
buttonRemove.Location = new Point(36, 141); buttonRemove.Location = new Point(41, 188);
buttonRemove.Margin = new Padding(3, 4, 3, 4);
buttonRemove.Name = "buttonRemove"; buttonRemove.Name = "buttonRemove";
buttonRemove.Size = new Size(75, 76); buttonRemove.Size = new Size(86, 101);
buttonRemove.TabIndex = 1; buttonRemove.TabIndex = 1;
buttonRemove.UseVisualStyleBackColor = true; buttonRemove.UseVisualStyleBackColor = true;
buttonRemove.Click += ButtonDel_Click; buttonRemove.Click += ButtonDel_Click;
@ -74,9 +77,10 @@
// //
buttonAdd.BackgroundImage = Properties.Resources.plus; buttonAdd.BackgroundImage = Properties.Resources.plus;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(33, 43); buttonAdd.Location = new Point(38, 57);
buttonAdd.Margin = new Padding(3, 4, 3, 4);
buttonAdd.Name = "buttonAdd"; buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(81, 71); buttonAdd.Size = new Size(93, 95);
buttonAdd.TabIndex = 0; buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true; buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click; buttonAdd.Click += ButtonAdd_Click;
@ -90,6 +94,7 @@
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill; dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0); dataGridView.Location = new Point(0, 0);
dataGridView.Margin = new Padding(3, 4, 3, 4);
dataGridView.MultiSelect = false; dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true; dataGridView.ReadOnly = true;
@ -97,16 +102,17 @@
dataGridView.RowHeadersWidth = 51; dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 25; dataGridView.RowTemplate.Height = 25;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(652, 450); dataGridView.Size = new Size(745, 600);
dataGridView.TabIndex = 4; dataGridView.TabIndex = 4;
// //
// FormServices // FormServices
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(914, 600);
Controls.Add(dataGridView); Controls.Add(dataGridView);
Controls.Add(panel); Controls.Add(panel);
Margin = new Padding(3, 4, 3, 4);
Name = "FormServices"; Name = "FormServices";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Услуги"; Text = "Услуги";

View File

@ -111,8 +111,6 @@ namespace ITServiceManager.Forms
return true; return true;
} }
} }
} }

View File

@ -25,7 +25,6 @@ namespace ITServiceManager
container.RegisterType<IOrderRepository, OrderRepository>(); container.RegisterType<IOrderRepository, OrderRepository>();
container.RegisterType<IAppointmentRepository, AppointmentRepository>(); container.RegisterType<IAppointmentRepository, AppointmentRepository>();
container.RegisterType<IServiceRepository, ServiceRepository>(); container.RegisterType<IServiceRepository, ServiceRepository>();
container.RegisterType<IOrderServiceRepository, OrderServiceRepository>();
container.RegisterType<IEmployeeRepository, EmployeeRepository>(); container.RegisterType<IEmployeeRepository, EmployeeRepository>();
container.RegisterType<ICompanyRepository, CompanyRepository>(); container.RegisterType<ICompanyRepository, CompanyRepository>();

View File

@ -1,10 +0,0 @@
using ITServiceManager.Entities;
namespace ITServiceManager.Repositories;
public interface IOrderServiceRepository
{
IEnumerable<OrderService> ReadServicesConsumption();
OrderService ReadServiceConsumptionById(int id);
void CreateServiceConsumption(OrderService serviceConsumption);
}

View File

@ -1,19 +0,0 @@
using ITServiceManager.Entities;
namespace ITServiceManager.Repositories.Implementations;
public class OrderServiceRepository : IOrderServiceRepository
{
public IEnumerable<OrderService> ReadServicesConsumption()
{
return [];
}
public OrderService ReadServiceConsumptionById(int id)
{
return null;
}
public void CreateServiceConsumption(OrderService serviceConsumption)
{
}
}