PIbd-22. Safiulova K.N. LabWork_05_base #9

Closed
safiulova.k wants to merge 16 commits from LabWork_05 into LabWork_04
10 changed files with 612 additions and 85 deletions
Showing only changes of commit abe8efdfaa - Show all commits

View File

@ -0,0 +1,94 @@
2024-04-22 21:04:15,555 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: https://localhost:7282
2024-04-22 21:04:15,625 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: http://localhost:5121
2024-04-22 21:04:15,635 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Application started. Press Ctrl+C to shut down.
2024-04-22 21:04:15,639 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Hosting environment: Development
2024-04-22 21:04:15,641 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Content root path: C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantRestApi\
2024-04-22 21:07:24,198 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadList [47] - MESSAGE: ReadList. PlaneName:(null).Id:(null)
2024-04-22 21:07:30,192 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadList [56] - MESSAGE: ReadList. Count:2
2024-04-22 22:10:11,896 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: https://localhost:7282
2024-04-22 22:10:11,946 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: http://localhost:5121
2024-04-22 22:10:11,954 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Application started. Press Ctrl+C to shut down.
2024-04-22 22:10:11,958 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Hosting environment: Development
2024-04-22 22:10:11,960 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Content root path: C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantRestApi\
2024-04-22 22:22:53,975 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: https://localhost:7282
2024-04-22 22:22:54,010 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: http://localhost:5121
2024-04-22 22:22:54,018 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Application started. Press Ctrl+C to shut down.
2024-04-22 22:22:54,021 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Hosting environment: Development
2024-04-22 22:22:54,022 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Content root path: C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantRestApi\
2024-04-22 22:24:52,282 INFO AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.CheckModel [114] - MESSAGE: Client. ClientFIO: Иванов И.И.. Email: client@email.com. Id: 0
2024-04-22 22:24:57,450 ERROR AircraftPlantRestApi.Controllers.ClientController.Register [43] - MESSAGE: Ошибка регистрации
Microsoft.Data.SqlClient.SqlException (0x80131904): Недопустимое имя объекта "Clients".
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Boolean& found)
at lambda_method15(Closure , QueryContext )
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
at AircraftPlantDatabaseImplement.Implements.ClientStorage.GetElement(ClientSearchModel model) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantDatabaseImplement\Implements\ClientStorage.cs:line 51
at AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.CheckModel(ClientBindingModel model, Boolean withParams) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantBusinessLogic\BusinessLogics\ClientLogic.cs:line 115
at AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.Create(ClientBindingModel model) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantBusinessLogic\BusinessLogics\ClientLogic.cs:line 59
at AircraftPlantRestApi.Controllers.ClientController.Register(ClientBindingModel model) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantRestApi\Controllers\ClientController.cs:line 43
ClientConnectionId:2857b5f6-18fd-479e-a483-0cadf995dd85
Error Number:208,State:1,Class:16
2024-04-22 22:29:44,047 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: https://localhost:7282
2024-04-22 22:29:44,085 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: http://localhost:5121
2024-04-22 22:29:44,094 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Application started. Press Ctrl+C to shut down.
2024-04-22 22:29:44,098 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Hosting environment: Development
2024-04-22 22:29:44,100 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Content root path: C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantRestApi\
2024-04-22 22:30:11,756 INFO AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.CheckModel [114] - MESSAGE: Client. ClientFIO: Иванов И.И.. Email: client@email.com. Id: 0
2024-04-22 22:30:13,742 ERROR AircraftPlantRestApi.Controllers.ClientController.Register [43] - MESSAGE: Ошибка регистрации
Microsoft.Data.SqlClient.SqlException (0x80131904): Недопустимое имя объекта "Clients".
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Boolean& found)
at lambda_method15(Closure , QueryContext )
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
at AircraftPlantDatabaseImplement.Implements.ClientStorage.GetElement(ClientSearchModel model) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantDatabaseImplement\Implements\ClientStorage.cs:line 51
at AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.CheckModel(ClientBindingModel model, Boolean withParams) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantBusinessLogic\BusinessLogics\ClientLogic.cs:line 115
at AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.Create(ClientBindingModel model) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantBusinessLogic\BusinessLogics\ClientLogic.cs:line 59
at AircraftPlantRestApi.Controllers.ClientController.Register(ClientBindingModel model) in C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantRestApi\Controllers\ClientController.cs:line 43
ClientConnectionId:3f725802-e3b8-4a60-be33-de60726794d6
Error Number:208,State:1,Class:16
2024-04-22 23:24:31,757 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: https://localhost:7282
2024-04-22 23:24:31,797 INFO Microsoft.Hosting.Lifetime.? [?] - MESSAGE: Now listening on: http://localhost:5121
2024-04-22 23:24:31,804 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Application started. Press Ctrl+C to shut down.
2024-04-22 23:24:31,807 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Hosting environment: Development
2024-04-22 23:24:31,808 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Content root path: C:\Users\Admin\Desktop\4 семестр\rpp\AircraftPlant\AircraftPlantRestApi\
2024-04-22 23:24:57,638 INFO AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.CheckModel [114] - MESSAGE: Client. ClientFIO: Иванов И.И.. Email: client@email.com. Id: 0
2024-04-22 23:26:26,726 INFO AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.ReadElement [45] - MESSAGE: ReadElement. ClientEmail:client@email.com.Id:(null)
2024-04-22 23:26:26,789 INFO AircraftPlantBusinessLogic.BusinessLogics.ClientLogic.ReadElement [54] - MESSAGE: ReadElement find. Id:1
2024-04-22 23:26:26,844 INFO AircraftPlantBusinessLogic.BusinessLogics.OrderLogic.ReadList [48] - MESSAGE: ReadList. Order.Id:(null)
2024-04-22 23:26:26,911 INFO AircraftPlantBusinessLogic.BusinessLogics.OrderLogic.ReadList [57] - MESSAGE: ReadList. Count:0
2024-04-22 23:26:32,911 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadList [47] - MESSAGE: ReadList. PlaneName:(null).Id:(null)
2024-04-22 23:26:32,999 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadList [56] - MESSAGE: ReadList. Count:2
2024-04-22 23:26:38,094 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadElement [72] - MESSAGE: ReadElement. PlaneName:(null).Id:1
2024-04-22 23:26:38,123 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadElement [81] - MESSAGE: ReadElement find. Id:1
2024-04-22 23:26:39,425 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadElement [72] - MESSAGE: ReadElement. PlaneName:(null).Id:1
2024-04-22 23:26:39,431 INFO AircraftPlantBusinessLogic.BusinessLogics.PlaneLogic.ReadElement [81] - MESSAGE: ReadElement find. Id:1
2024-04-22 23:26:39,452 INFO AircraftPlantBusinessLogic.BusinessLogics.OrderLogic.CheckModel [137] - MESSAGE: Order. OrderID:0.Sum:81400. PlaneId: 1
2024-04-22 23:26:39,514 INFO AircraftPlantBusinessLogic.BusinessLogics.OrderLogic.ReadList [48] - MESSAGE: ReadList. Order.Id:(null)
2024-04-22 23:26:39,524 INFO AircraftPlantBusinessLogic.BusinessLogics.OrderLogic.ReadList [57] - MESSAGE: ReadList. Count:1

View File

@ -0,0 +1,92 @@
namespace AircraftPlantView
{
partial class FormClients
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dataGridViewClients = new DataGridView();
buttonDelete = new Button();
buttonRefresh = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewClients).BeginInit();
SuspendLayout();
//
// dataGridViewClients
//
dataGridViewClients.BackgroundColor = SystemColors.ControlLightLight;
dataGridViewClients.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewClients.Location = new Point(0, 0);
dataGridViewClients.Name = "dataGridViewClients";
dataGridViewClients.RowHeadersWidth = 51;
dataGridViewClients.RowTemplate.Height = 29;
dataGridViewClients.Size = new Size(485, 449);
dataGridViewClients.TabIndex = 0;
//
// buttonDelete
//
buttonDelete.BackColor = SystemColors.ControlLightLight;
buttonDelete.Location = new Point(528, 25);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 29);
buttonDelete.TabIndex = 1;
buttonDelete.Text = "Удалить";
buttonDelete.UseVisualStyleBackColor = false;
buttonDelete.Click += buttonDelete_Click;
//
// buttonRefresh
//
buttonRefresh.BackColor = SystemColors.ControlLightLight;
buttonRefresh.Location = new Point(528, 81);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(94, 29);
buttonRefresh.TabIndex = 2;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = false;
buttonRefresh.Click += buttonRefresh_Click;
//
// FormClients
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = SystemColors.Control;
ClientSize = new Size(666, 450);
Controls.Add(buttonRefresh);
Controls.Add(buttonDelete);
Controls.Add(dataGridViewClients);
Name = "FormClients";
Text = "Клиенты";
Load += FormClients_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewClients).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewClients;
private Button buttonDelete;
private Button buttonRefresh;
}
}

View File

@ -0,0 +1,85 @@
using AircraftPlantContracts.BindingModels;
using AircraftPlantContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
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 AircraftPlantView
{
public partial class FormClients : Form
{
private readonly ILogger _logger;
private readonly IClientLogic _logic;
public FormClients(ILogger<FormClients> logger, IClientLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void FormClients_Load(object sender, EventArgs e)
{
LoadData();
}
private void buttonDelete_Click(object sender, EventArgs e)
{
if (dataGridViewClients.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
int id = Convert.ToInt32(dataGridViewClients.SelectedRows[0].Cells["Id"].Value);
try
{
if (!_logic.Delete(new ClientBindingModel { Id = id }))
{
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
}
_logger.LogInformation("Удаление клиента");
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка удаления клиента");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
LoadData();
}
}
}
private void buttonRefresh_Click(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridViewClients.DataSource = list;
dataGridViewClients.Columns["Id"].Visible = false;
dataGridViewClients.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridViewClients.Columns["Email"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка клиентов");
}
catch (Exception ex)
{
_logger.LogError(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

@ -28,106 +28,133 @@
/// </summary>
private void InitializeComponent()
{
this.labelPlane = new System.Windows.Forms.Label();
this.labelCount = new System.Windows.Forms.Label();
this.labelSum = new System.Windows.Forms.Label();
this.comboBoxPlane = new System.Windows.Forms.ComboBox();
this.textBoxCount = new System.Windows.Forms.TextBox();
this.textBoxSum = new System.Windows.Forms.TextBox();
this.ButtonSave = new System.Windows.Forms.Button();
this.ButtonCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
labelPlane = new Label();
labelCount = new Label();
labelSum = new Label();
comboBoxPlane = new ComboBox();
textBoxCount = new TextBox();
textBoxSum = new TextBox();
ButtonSave = new Button();
ButtonCancel = new Button();
labelClient = new Label();
comboBoxClient = new ComboBox();
SuspendLayout();
//
// labelPlane
//
this.labelPlane.AutoSize = true;
this.labelPlane.Location = new System.Drawing.Point(12, 13);
this.labelPlane.Name = "labelPlane";
this.labelPlane.Size = new System.Drawing.Size(56, 15);
this.labelPlane.TabIndex = 0;
this.labelPlane.Text = "Изделие:";
labelPlane.AutoSize = true;
labelPlane.Location = new Point(14, 21);
labelPlane.Name = "labelPlane";
labelPlane.Size = new Size(71, 20);
labelPlane.TabIndex = 0;
labelPlane.Text = "Изделие:";
//
// labelCount
//
this.labelCount.AutoSize = true;
this.labelCount.Location = new System.Drawing.Point(12, 42);
this.labelCount.Name = "labelCount";
this.labelCount.Size = new System.Drawing.Size(75, 15);
this.labelCount.TabIndex = 1;
this.labelCount.Text = "Количество:";
labelCount.AutoSize = true;
labelCount.Location = new Point(12, 109);
labelCount.Name = "labelCount";
labelCount.Size = new Size(93, 20);
labelCount.TabIndex = 1;
labelCount.Text = "Количество:";
//
// labelSum
//
this.labelSum.AutoSize = true;
this.labelSum.Location = new System.Drawing.Point(12, 71);
this.labelSum.Name = "labelSum";
this.labelSum.Size = new System.Drawing.Size(48, 15);
this.labelSum.TabIndex = 2;
this.labelSum.Text = "Сумма:";
labelSum.AutoSize = true;
labelSum.Location = new Point(14, 154);
labelSum.Name = "labelSum";
labelSum.Size = new Size(58, 20);
labelSum.TabIndex = 2;
labelSum.Text = "Сумма:";
//
// comboBoxPlane
//
this.comboBoxPlane.FormattingEnabled = true;
this.comboBoxPlane.Location = new System.Drawing.Point(111, 10);
this.comboBoxPlane.Name = "comboBoxPlane";
this.comboBoxPlane.Size = new System.Drawing.Size(236, 23);
this.comboBoxPlane.TabIndex = 3;
this.comboBoxPlane.SelectedIndexChanged += new System.EventHandler(this.comboBoxPlane_SelectedIndexChanged);
comboBoxPlane.FormattingEnabled = true;
comboBoxPlane.Location = new Point(127, 13);
comboBoxPlane.Margin = new Padding(3, 4, 3, 4);
comboBoxPlane.Name = "comboBoxPlane";
comboBoxPlane.Size = new Size(277, 28);
comboBoxPlane.TabIndex = 3;
comboBoxPlane.SelectedIndexChanged += comboBoxPlane_SelectedIndexChanged;
//
// textBoxCount
//
this.textBoxCount.Location = new System.Drawing.Point(111, 39);
this.textBoxCount.Name = "textBoxCount";
this.textBoxCount.Size = new System.Drawing.Size(236, 23);
this.textBoxCount.TabIndex = 4;
this.textBoxCount.TextChanged += new System.EventHandler(this.textBoxCount_TextChanged);
textBoxCount.Location = new Point(127, 102);
textBoxCount.Margin = new Padding(3, 4, 3, 4);
textBoxCount.Name = "textBoxCount";
textBoxCount.Size = new Size(277, 27);
textBoxCount.TabIndex = 4;
textBoxCount.TextChanged += textBoxCount_TextChanged;
//
// textBoxSum
//
this.textBoxSum.Location = new System.Drawing.Point(111, 68);
this.textBoxSum.Name = "textBoxSum";
this.textBoxSum.Size = new System.Drawing.Size(236, 23);
this.textBoxSum.TabIndex = 5;
textBoxSum.Location = new Point(127, 147);
textBoxSum.Margin = new Padding(3, 4, 3, 4);
textBoxSum.Name = "textBoxSum";
textBoxSum.Size = new Size(277, 27);
textBoxSum.TabIndex = 5;
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(179, 97);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
this.ButtonSave.TabIndex = 6;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.buttonSave_Click);
ButtonSave.Location = new Point(205, 182);
ButtonSave.Margin = new Padding(3, 4, 3, 4);
ButtonSave.Name = "ButtonSave";
ButtonSave.Size = new Size(100, 31);
ButtonSave.TabIndex = 6;
ButtonSave.Text = "Сохранить";
ButtonSave.UseVisualStyleBackColor = true;
ButtonSave.Click += buttonSave_Click;
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(272, 97);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
this.ButtonCancel.TabIndex = 7;
this.ButtonCancel.Text = "Отмена";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
ButtonCancel.Location = new Point(311, 182);
ButtonCancel.Margin = new Padding(3, 4, 3, 4);
ButtonCancel.Name = "ButtonCancel";
ButtonCancel.Size = new Size(93, 31);
ButtonCancel.TabIndex = 7;
ButtonCancel.Text = "Отмена";
ButtonCancel.UseVisualStyleBackColor = true;
ButtonCancel.Click += buttonCancel_Click;
//
// labelClient
//
labelClient.AutoSize = true;
labelClient.Location = new Point(14, 67);
labelClient.Name = "labelClient";
labelClient.Size = new Size(61, 20);
labelClient.TabIndex = 9;
labelClient.Text = "Клиент:";
//
// comboBoxClient
//
comboBoxClient.FormattingEnabled = true;
comboBoxClient.Location = new Point(127, 59);
comboBoxClient.Margin = new Padding(3, 4, 3, 4);
comboBoxClient.Name = "comboBoxClient";
comboBoxClient.Size = new Size(277, 28);
comboBoxClient.TabIndex = 10;
//
// FormCreateOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(359, 128);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.textBoxSum);
this.Controls.Add(this.textBoxCount);
this.Controls.Add(this.comboBoxPlane);
this.Controls.Add(this.labelSum);
this.Controls.Add(this.labelCount);
this.Controls.Add(this.labelPlane);
this.Name = "FormCreateOrder";
this.Text = "Заказ";
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(436, 222);
Controls.Add(comboBoxClient);
Controls.Add(labelClient);
Controls.Add(ButtonCancel);
Controls.Add(ButtonSave);
Controls.Add(textBoxSum);
Controls.Add(textBoxCount);
Controls.Add(comboBoxPlane);
Controls.Add(labelSum);
Controls.Add(labelCount);
Controls.Add(labelPlane);
Margin = new Padding(3, 4, 3, 4);
Name = "FormCreateOrder";
Text = "Заказ";
Load += FormCreateOrder_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion
@ -140,5 +167,7 @@
private TextBox textBoxSum;
private Button ButtonSave;
private Button ButtonCancel;
private Label labelClient;
private ComboBox comboBoxClient;
}
}

View File

@ -25,6 +25,10 @@ namespace AircraftPlantView
/// </summary>
private readonly IPlaneLogic _logicP;
/// <summary>
/// Бизнес-логика для клиентов
/// </summary>
private readonly IClientLogic _logicC;
/// <summary>
/// Бизнес-логика для заказов
/// </summary>
private readonly IOrderLogic _logicO;
@ -34,12 +38,13 @@ namespace AircraftPlantView
/// <param name="logger"></param>
/// <param name="logicP"></param>
/// <param name="logicO"></param>
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPlaneLogic logicP, IOrderLogic logicO)
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPlaneLogic logicP, IOrderLogic logicO, IClientLogic logicC)
{
InitializeComponent();
_logger = logger;
_logicP = logicP;
_logicO = logicO;
_logicC = logicC;
}
/// <summary>
/// Загрузка списка изделий для заказа
@ -66,6 +71,24 @@ namespace AircraftPlantView
_logger.LogError(ex, "Ошибка загрузки списка изделий");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
_logger.LogInformation("Загрузка клиентов для заказа");
try
{
var list = _logicC.ReadList(null);
if (list != null)
{
comboBoxClient.DisplayMember = "ClientFIO";
comboBoxClient.ValueMember = "Id";
comboBoxClient.DataSource = list;
comboBoxClient.SelectedItem = null;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки списка клиентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
/// <summary>
/// Изменение поля "Количество"
@ -102,12 +125,18 @@ namespace AircraftPlantView
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (comboBoxClient.SelectedValue == null)
{
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Создание заказа");
try
{
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
PlaneId = Convert.ToInt32(comboBoxPlane.SelectedValue),
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text)
});

View File

@ -1,4 +1,64 @@
<root>
<?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">

View File

@ -50,6 +50,7 @@
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.BackgroundColor = Color.White;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Left;
@ -63,12 +64,12 @@
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 25;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(891, 505);
dataGridView.Size = new Size(1162, 505);
dataGridView.TabIndex = 0;
//
// ButtonCreateOrder
//
ButtonCreateOrder.Location = new Point(919, 56);
ButtonCreateOrder.Location = new Point(1168, 44);
ButtonCreateOrder.Margin = new Padding(3, 4, 3, 4);
ButtonCreateOrder.Name = "ButtonCreateOrder";
ButtonCreateOrder.Size = new Size(213, 31);
@ -79,7 +80,7 @@
//
// ButtonTakeOrderInWork
//
ButtonTakeOrderInWork.Location = new Point(919, 119);
ButtonTakeOrderInWork.Location = new Point(1168, 96);
ButtonTakeOrderInWork.Margin = new Padding(3, 4, 3, 4);
ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork";
ButtonTakeOrderInWork.Size = new Size(213, 31);
@ -90,7 +91,7 @@
//
// ButtonOrderReady
//
ButtonOrderReady.Location = new Point(919, 185);
ButtonOrderReady.Location = new Point(1168, 149);
ButtonOrderReady.Margin = new Padding(3, 4, 3, 4);
ButtonOrderReady.Name = "ButtonOrderReady";
ButtonOrderReady.Size = new Size(213, 31);
@ -101,7 +102,7 @@
//
// ButtonIssuedOrder
//
ButtonIssuedOrder.Location = new Point(919, 249);
ButtonIssuedOrder.Location = new Point(1168, 202);
ButtonIssuedOrder.Margin = new Padding(3, 4, 3, 4);
ButtonIssuedOrder.Name = "ButtonIssuedOrder";
ButtonIssuedOrder.Size = new Size(213, 31);
@ -112,7 +113,7 @@
//
// ButtonRef
//
ButtonRef.Location = new Point(919, 315);
ButtonRef.Location = new Point(1168, 253);
ButtonRef.Margin = new Padding(3, 4, 3, 4);
ButtonRef.Name = "ButtonRef";
ButtonRef.Size = new Size(213, 31);
@ -128,7 +129,7 @@
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Padding = new Padding(7, 3, 0, 3);
menuStrip1.Size = new Size(1154, 30);
menuStrip1.Size = new Size(1388, 30);
menuStrip1.TabIndex = 6;
menuStrip1.Text = "menuStrip1";
//
@ -142,14 +143,14 @@
// компонентыToolStripMenuItem
//
компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
компонентыToolStripMenuItem.Size = new Size(224, 26);
компонентыToolStripMenuItem.Size = new Size(182, 26);
компонентыToolStripMenuItem.Text = "Компоненты";
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
//
// изделияToolStripMenuItem
//
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
изделияToolStripMenuItem.Size = new Size(224, 26);
изделияToolStripMenuItem.Size = new Size(182, 26);
изделияToolStripMenuItem.Text = "Изделия";
изделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
//
@ -185,7 +186,7 @@
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1154, 535);
ClientSize = new Size(1388, 535);
Controls.Add(ButtonRef);
Controls.Add(ButtonIssuedOrder);
Controls.Add(ButtonOrderReady);

View File

@ -77,6 +77,19 @@ namespace AircraftPlantView
}
}
/// <summary>
/// Показать список всех клиентов
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
/// <summary>
/// Кнопка "Создать заказ"
/// </summary>
/// <param name="sender"></param>
@ -196,6 +209,7 @@ namespace AircraftPlantView
dataGridView.DataSource = list;
dataGridView.Columns["PlaneName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["PlaneId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false;
}
_logger.LogInformation("Загрузка заказов");
}

View File

@ -51,11 +51,13 @@ namespace AircraftPlantView
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IPlaneStorage, PlaneStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IPlaneLogic, PlaneLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
@ -70,6 +72,7 @@ namespace AircraftPlantView
services.AddTransient<FormPlanes>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportPlaneComponents>();
services.AddTransient<FormClients>();
}
}
}