Compare commits
No commits in common. "labWork7" and "main" have entirely different histories.
3
.gitignore
vendored
3
.gitignore
vendored
@ -36,7 +36,7 @@ bld/
|
|||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
wwwroot/
|
#wwwroot/
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
# Visual Studio 2017 auto generated files
|
||||||
Generated\ Files/
|
Generated\ Files/
|
||||||
@ -398,4 +398,3 @@ FodyWeavers.xsd
|
|||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
/SushiBar/SushiBarDatabaseImplement/Migrations/
|
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.7.34031.279
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBar", "SushiBar\SushiBar.csproj", "{FA7992B7-E081-4E09-9CED-48394FA38B31}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarBusinessLogic", "SushiBarBusinessLogic\SushiBarBusinessLogic.csproj", "{2657FF86-010E-4A49-9D3F-01FCCAC286B1}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarContracts", "SushiBarContracts\SushiBarContracts.csproj", "{2D04F87F-2348-4540-9DCB-44A72201FA1B}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDataModels", "SushiBarDataModels\SushiBarDataModels.csproj", "{8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarListImplement", "SushiBarListImplement\SushiBarListImplement.csproj", "{FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarFileImplement", "SushiBarFileImplement\SushiBarFileImplement.csproj", "{4F721F76-EF7A-4FF3-80B0-77A459D091D7}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarDatabaseImplement", "SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj", "{C9C66AFC-1246-4A0C-AB70-8D5C0CF311D9}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarRestApi", "SushiBarRestApi\SushiBarRestApi.csproj", "{0895AC4A-6C0A-4244-92AB-CD3AFD8B691A}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SushiBarClientApi", "SushiBarClientApi\SushiBarClientApi.csproj", "{C9EF2604-E657-4223-A7C3-945E7A4E2341}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{FA7992B7-E081-4E09-9CED-48394FA38B31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{FA7992B7-E081-4E09-9CED-48394FA38B31}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{FA7992B7-E081-4E09-9CED-48394FA38B31}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{FA7992B7-E081-4E09-9CED-48394FA38B31}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{2657FF86-010E-4A49-9D3F-01FCCAC286B1}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{2D04F87F-2348-4540-9DCB-44A72201FA1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{2D04F87F-2348-4540-9DCB-44A72201FA1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{2D04F87F-2348-4540-9DCB-44A72201FA1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{2D04F87F-2348-4540-9DCB-44A72201FA1B}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{8073F7CA-FED3-48C5-B8CD-1A91A8D8D5BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{FE2BCA7B-A6E4-4628-9DCE-2F04F258BE1F}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{4F721F76-EF7A-4FF3-80B0-77A459D091D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{4F721F76-EF7A-4FF3-80B0-77A459D091D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{4F721F76-EF7A-4FF3-80B0-77A459D091D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{4F721F76-EF7A-4FF3-80B0-77A459D091D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{C9C66AFC-1246-4A0C-AB70-8D5C0CF311D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C9C66AFC-1246-4A0C-AB70-8D5C0CF311D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{C9C66AFC-1246-4A0C-AB70-8D5C0CF311D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C9C66AFC-1246-4A0C-AB70-8D5C0CF311D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{0895AC4A-6C0A-4244-92AB-CD3AFD8B691A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{0895AC4A-6C0A-4244-92AB-CD3AFD8B691A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{0895AC4A-6C0A-4244-92AB-CD3AFD8B691A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{0895AC4A-6C0A-4244-92AB-CD3AFD8B691A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{C9EF2604-E657-4223-A7C3-945E7A4E2341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C9EF2604-E657-4223-A7C3-945E7A4E2341}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{C9EF2604-E657-4223-A7C3-945E7A4E2341}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C9EF2604-E657-4223-A7C3-945E7A4E2341}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {28DB1CDE-A61B-4A26-A1F8-14D39B4DE40B}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<appSettings>
|
|
||||||
<add key="SmtpClientHost" value="smtp.yandex.ru" />
|
|
||||||
<add key="SmtpClientPort" value="587" />
|
|
||||||
<add key="PopHost" value="pop.yandex.com" />
|
|
||||||
<add key="PopPort" value="995" />
|
|
||||||
<add key="MailLogin" value="tester.b.moio@yandex.ru" />
|
|
||||||
<add key="MailPassword" value="pyzzqswchjevecec" />
|
|
||||||
</appSettings>
|
|
||||||
</configuration>
|
|
74
SushiBar/SushiBar/Forms/FormClients.Designer.cs
generated
74
SushiBar/SushiBar/Forms/FormClients.Designer.cs
generated
@ -1,74 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormClients
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
DataGridView = new DataGridView();
|
|
||||||
DeleteButton = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// DataGridView
|
|
||||||
//
|
|
||||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
DataGridView.Location = new Point(12, 34);
|
|
||||||
DataGridView.Name = "DataGridView";
|
|
||||||
DataGridView.RowTemplate.Height = 25;
|
|
||||||
DataGridView.Size = new Size(776, 404);
|
|
||||||
DataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// DeleteButton
|
|
||||||
//
|
|
||||||
DeleteButton.Location = new Point(12, 5);
|
|
||||||
DeleteButton.Name = "DeleteButton";
|
|
||||||
DeleteButton.Size = new Size(123, 23);
|
|
||||||
DeleteButton.TabIndex = 1;
|
|
||||||
DeleteButton.Text = "Удалить";
|
|
||||||
DeleteButton.UseVisualStyleBackColor = true;
|
|
||||||
DeleteButton.Click += DeleteButton_Click;
|
|
||||||
//
|
|
||||||
// ClientsForm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(DeleteButton);
|
|
||||||
Controls.Add(DataGridView);
|
|
||||||
Name = "ClientsForm";
|
|
||||||
Text = "Клиенты";
|
|
||||||
Load += ClientsForm_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView DataGridView;
|
|
||||||
private Button DeleteButton;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
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 LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
DataGridView.DataSource = list;
|
|
||||||
DataGridView.Columns["Id"].Visible = false;
|
|
||||||
DataGridView.Columns["ClientFIO"].AutoSizeMode =
|
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
DataGridView.Columns["Email"].AutoSizeMode =
|
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
DataGridView.Columns["Password"].AutoSizeMode =
|
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка клиентов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки клиентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClientsForm_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление клиента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ClientBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
123
SushiBar/SushiBar/Forms/FormComponent.Designer.cs
generated
123
SushiBar/SushiBar/Forms/FormComponent.Designer.cs
generated
@ -1,123 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormComponent
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
label1 = new Label();
|
|
||||||
textBoxName = new TextBox();
|
|
||||||
textBoxCost = new TextBox();
|
|
||||||
label2 = new Label();
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(12, 9);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(77, 20);
|
|
||||||
label1.TabIndex = 0;
|
|
||||||
label1.Text = "Название";
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
textBoxName.Location = new Point(95, 6);
|
|
||||||
textBoxName.Name = "textBoxName";
|
|
||||||
textBoxName.Size = new Size(246, 27);
|
|
||||||
textBoxName.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// textBoxCost
|
|
||||||
//
|
|
||||||
textBoxCost.Location = new Point(95, 39);
|
|
||||||
textBoxCost.Name = "textBoxCost";
|
|
||||||
textBoxCost.Size = new Size(246, 27);
|
|
||||||
textBoxCost.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.ImeMode = ImeMode.NoControl;
|
|
||||||
label2.Location = new Point(12, 42);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(45, 20);
|
|
||||||
label2.TabIndex = 2;
|
|
||||||
label2.Text = "Цена";
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(95, 85);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(121, 29);
|
|
||||||
ButtonSave.TabIndex = 4;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.ImeMode = ImeMode.NoControl;
|
|
||||||
ButtonCancel.Location = new Point(222, 85);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(119, 29);
|
|
||||||
ButtonCancel.TabIndex = 5;
|
|
||||||
ButtonCancel.Text = "Отмена";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// FormComponent
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleMode = AutoScaleMode.None;
|
|
||||||
ClientSize = new Size(353, 126);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Controls.Add(textBoxCost);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(textBoxName);
|
|
||||||
Controls.Add(label1);
|
|
||||||
MaximizeBox = false;
|
|
||||||
Name = "FormComponent";
|
|
||||||
ShowInTaskbar = false;
|
|
||||||
Text = "Компонент";
|
|
||||||
TopMost = true;
|
|
||||||
Load += FormComponent_Load;
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label label1;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private TextBox textBoxCost;
|
|
||||||
private Label label2;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormComponent : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
public FormComponent(ILogger<FormComponent> logger, IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
private void FormComponent_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение компонента");
|
|
||||||
var view = _logic.ReadElement(new ComponentSearchModel
|
|
||||||
{
|
|
||||||
Id = _id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
textBoxName.Text = view.ComponentName;
|
|
||||||
textBoxCost.Text = view.Cost.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка получения компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new ComponentBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
ComponentName = textBoxName.Text,
|
|
||||||
Cost = Convert.ToDouble(textBoxCost.Text)
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,299 +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>
|
|
||||||
<data name=">>label2.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="Button1.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>4</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonSave.Name" xml:space="preserve">
|
|
||||||
<value>ButtonSave</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button2.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxCost.ZOrder" xml:space="preserve">
|
|
||||||
<value>2</value>
|
|
||||||
</data>
|
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
|
||||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>12, 9</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonCancel.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>5</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBox1.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name="label2.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>2</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxCost.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxCost.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBox1.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>1</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxName.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name="Button2.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>222, 85</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxCost.Name" xml:space="preserve">
|
|
||||||
<value>textBoxCost</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>label1.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button1.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>label2.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name="Button2.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>5</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonSave.ZOrder" xml:space="preserve">
|
|
||||||
<value>1</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBox1.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>800, 450</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonCancel.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>222, 85</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonSave.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>95, 85</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
|
||||||
<value>5</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBoxName.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>1</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonCancel.ZOrder" xml:space="preserve">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name="$this.Text" xml:space="preserve">
|
|
||||||
<value>FormComponent</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button2.ZOrder" xml:space="preserve">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>12, 42</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonSave.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>4</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBoxCost.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>95, 39</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button1.Name" xml:space="preserve">
|
|
||||||
<value>Button1</value>
|
|
||||||
</data>
|
|
||||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>label1.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonSave.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonCancel.Parent" xml:space="preserve">
|
|
||||||
<value>$this</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>label1.Name" xml:space="preserve">
|
|
||||||
<value>label1</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxName.Name" xml:space="preserve">
|
|
||||||
<value>textBoxName</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button1.ZOrder" xml:space="preserve">
|
|
||||||
<value>1</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxName.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBoxCost.TabIndex" type="System.Int32, mscorlib">
|
|
||||||
<value>3</value>
|
|
||||||
</data>
|
|
||||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
|
||||||
<value>8, 20</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBoxName.ZOrder" xml:space="preserve">
|
|
||||||
<value>4</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBox1.Name" xml:space="preserve">
|
|
||||||
<value>textBox1</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>$this.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button2.Name" xml:space="preserve">
|
|
||||||
<value>Button2</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>label2.Name" xml:space="preserve">
|
|
||||||
<value>label2</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonSave.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBox1.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>68, 6</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>label2.ZOrder" xml:space="preserve">
|
|
||||||
<value>3</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button1.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>$this.Name" xml:space="preserve">
|
|
||||||
<value>FormComponent</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>Button2.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
<data name="Button1.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>95, 85</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBoxName.Location" type="System.Drawing.Point, System.Drawing">
|
|
||||||
<value>95, 6</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>textBox1.ZOrder" xml:space="preserve">
|
|
||||||
<value>0</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonCancel.Name" xml:space="preserve">
|
|
||||||
<value>ButtonCancel</value>
|
|
||||||
</data>
|
|
||||||
<data name=">>ButtonCancel.Type" xml:space="preserve">
|
|
||||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
@ -1,171 +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>
|
|
||||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
|
||||||
<value>True</value>
|
|
||||||
</data>
|
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
|
||||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>77, 20</value>
|
|
||||||
</data>
|
|
||||||
<data name="label1.Text" xml:space="preserve">
|
|
||||||
<value>Название</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBoxName.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>246, 27</value>
|
|
||||||
</data>
|
|
||||||
<data name="textBoxCost.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>246, 27</value>
|
|
||||||
</data>
|
|
||||||
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
|
|
||||||
<value>True</value>
|
|
||||||
</data>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
|
||||||
<value>NoControl</value>
|
|
||||||
</data>
|
|
||||||
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>45, 20</value>
|
|
||||||
</data>
|
|
||||||
<data name="label2.Text" xml:space="preserve">
|
|
||||||
<value>Цена</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonSave.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>121, 29</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonSave.Text" xml:space="preserve">
|
|
||||||
<value>Сохранить</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonCancel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
|
||||||
<value>NoControl</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonCancel.Size" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>119, 29</value>
|
|
||||||
</data>
|
|
||||||
<data name="ButtonCancel.Text" xml:space="preserve">
|
|
||||||
<value>Отмена</value>
|
|
||||||
</data>
|
|
||||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
|
||||||
<value>353, 126</value>
|
|
||||||
</data>
|
|
||||||
<data name="$this.Text" xml:space="preserve">
|
|
||||||
<value>Компонент</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
122
SushiBar/SushiBar/Forms/FormComponents.Designer.cs
generated
122
SushiBar/SushiBar/Forms/FormComponents.Designer.cs
generated
@ -1,122 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormComponents
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
ButtonUpd = new Button();
|
|
||||||
ButtonDel = new Button();
|
|
||||||
ButtonRef = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Location = new Point(0, 0);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(694, 408);
|
|
||||||
dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonAdd.Location = new Point(700, 12);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(180, 29);
|
|
||||||
ButtonAdd.TabIndex = 1;
|
|
||||||
ButtonAdd.Text = "Добавить";
|
|
||||||
ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonAdd.Click += ButtonAdd_Click;
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
ButtonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonUpd.Location = new Point(700, 47);
|
|
||||||
ButtonUpd.Name = "ButtonUpd";
|
|
||||||
ButtonUpd.Size = new Size(180, 29);
|
|
||||||
ButtonUpd.TabIndex = 2;
|
|
||||||
ButtonUpd.Text = "Изменить";
|
|
||||||
ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonUpd.Click += ButtonUpd_Click;
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonDel.Location = new Point(700, 82);
|
|
||||||
ButtonDel.Name = "ButtonDel";
|
|
||||||
ButtonDel.Size = new Size(180, 29);
|
|
||||||
ButtonDel.TabIndex = 3;
|
|
||||||
ButtonDel.Text = "Удалить";
|
|
||||||
ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDel.Click += ButtonDel_Click;
|
|
||||||
//
|
|
||||||
// buttonRef
|
|
||||||
//
|
|
||||||
ButtonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonRef.Location = new Point(700, 117);
|
|
||||||
ButtonRef.Name = "ButtonRef";
|
|
||||||
ButtonRef.Size = new Size(180, 29);
|
|
||||||
ButtonRef.TabIndex = 4;
|
|
||||||
ButtonRef.Text = "Обновить";
|
|
||||||
ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
ButtonRef.Click += ButtonRef_Click;
|
|
||||||
//
|
|
||||||
// FormComponents
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(892, 408);
|
|
||||||
Controls.Add(ButtonRef);
|
|
||||||
Controls.Add(ButtonDel);
|
|
||||||
Controls.Add(ButtonUpd);
|
|
||||||
Controls.Add(ButtonAdd);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Name = "FormComponents";
|
|
||||||
Text = "Компоненты";
|
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
Load += FormComponents_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonRef;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,98 +0,0 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormComponents : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentLogic _logic;
|
|
||||||
public FormComponents(ILogger<FormComponents> logger, IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
private void FormComponents_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
|
||||||
if (service is FormComponent form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
|
||||||
if (service is FormComponent form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ComponentBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
148
SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs
generated
148
SushiBar/SushiBar/Forms/FormCreateOrder.Designer.cs
generated
@ -1,148 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormCreateOrder
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
label1 = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
label3 = new Label();
|
|
||||||
TextBoxCount = new TextBox();
|
|
||||||
TextBoxSum = new TextBox();
|
|
||||||
ComboBoxSushi = new ComboBox();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(185, 112);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(100, 30);
|
|
||||||
ButtonSave.TabIndex = 0;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Location = new Point(291, 112);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(100, 30);
|
|
||||||
ButtonCancel.TabIndex = 1;
|
|
||||||
ButtonCancel.Text = "Отмена";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(12, 15);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(49, 20);
|
|
||||||
label1.TabIndex = 2;
|
|
||||||
label1.Text = "Суши:";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(12, 49);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(93, 20);
|
|
||||||
label2.TabIndex = 3;
|
|
||||||
label2.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
label3.AutoSize = true;
|
|
||||||
label3.Location = new Point(12, 82);
|
|
||||||
label3.Name = "label3";
|
|
||||||
label3.Size = new Size(58, 20);
|
|
||||||
label3.TabIndex = 4;
|
|
||||||
label3.Text = "Сумма:";
|
|
||||||
//
|
|
||||||
// TextBoxCount
|
|
||||||
//
|
|
||||||
TextBoxCount.Location = new Point(119, 46);
|
|
||||||
TextBoxCount.Name = "TextBoxCount";
|
|
||||||
TextBoxCount.Size = new Size(272, 27);
|
|
||||||
TextBoxCount.TabIndex = 5;
|
|
||||||
TextBoxCount.TextChanged += TextBoxCount_TextChanged;
|
|
||||||
//
|
|
||||||
// TextBoxSum
|
|
||||||
//
|
|
||||||
TextBoxSum.Location = new Point(119, 79);
|
|
||||||
TextBoxSum.Name = "TextBoxSum";
|
|
||||||
TextBoxSum.ReadOnly = true;
|
|
||||||
TextBoxSum.Size = new Size(272, 27);
|
|
||||||
TextBoxSum.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// ComboBoxSushi
|
|
||||||
//
|
|
||||||
ComboBoxSushi.FormattingEnabled = true;
|
|
||||||
ComboBoxSushi.Location = new Point(119, 12);
|
|
||||||
ComboBoxSushi.Name = "ComboBoxSushi";
|
|
||||||
ComboBoxSushi.Size = new Size(272, 28);
|
|
||||||
ComboBoxSushi.TabIndex = 7;
|
|
||||||
ComboBoxSushi.SelectedIndexChanged += ComboBoxSushi_SelectedIndexChanged;
|
|
||||||
//
|
|
||||||
// FormCreateOrder
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleMode = AutoScaleMode.None;
|
|
||||||
ClientSize = new Size(403, 152);
|
|
||||||
Controls.Add(ComboBoxSushi);
|
|
||||||
Controls.Add(TextBoxSum);
|
|
||||||
Controls.Add(TextBoxCount);
|
|
||||||
Controls.Add(label3);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
MaximizeBox = false;
|
|
||||||
MinimizeBox = false;
|
|
||||||
Name = "FormCreateOrder";
|
|
||||||
ShowInTaskbar = false;
|
|
||||||
Text = "Заказ";
|
|
||||||
TopMost = true;
|
|
||||||
Load += FormCreateOrder_Load;
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Label label3;
|
|
||||||
private TextBox TextBoxCount;
|
|
||||||
private TextBox TextBoxSum;
|
|
||||||
private ComboBox ComboBoxSushi;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,113 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormCreateOrder : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly ISushiLogic _logicS;
|
|
||||||
private readonly IOrderLogic _logicO;
|
|
||||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, ISushiLogic logicS, IOrderLogic logicO)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logicS = logicS;
|
|
||||||
_logicO = logicO;
|
|
||||||
}
|
|
||||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка суши для заказа");
|
|
||||||
List<SushiViewModel>? _list = _logicS.ReadList(null);
|
|
||||||
if (_list != null)
|
|
||||||
{
|
|
||||||
ComboBoxSushi.DisplayMember = "SushiName";
|
|
||||||
ComboBoxSushi.ValueMember = "Id";
|
|
||||||
ComboBoxSushi.DataSource = _list;
|
|
||||||
ComboBoxSushi.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки суши");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void CalcSum()
|
|
||||||
{
|
|
||||||
if (ComboBoxSushi.SelectedValue != null && !string.IsNullOrEmpty(TextBoxCount.Text))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(ComboBoxSushi.SelectedValue);
|
|
||||||
var sushi = _logicS.ReadElement(new SushiSearchModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
});
|
|
||||||
int count = Convert.ToInt32(TextBoxCount.Text);
|
|
||||||
TextBoxSum.Text = Math.Round(count * (sushi?.Price ?? 0), 2).ToString();
|
|
||||||
_logger.LogInformation("Расчет суммы заказа");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка расчета суммы заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void TextBoxCount_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CalcSum();
|
|
||||||
}
|
|
||||||
private void ComboBoxSushi_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CalcSum();
|
|
||||||
}
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(TextBoxCount.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ComboBoxSushi.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Создание заказа");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
|
||||||
{
|
|
||||||
SushiId = Convert.ToInt32(ComboBoxSushi.SelectedValue),
|
|
||||||
Count = Convert.ToInt32(TextBoxCount.Text),
|
|
||||||
Sum = Convert.ToDouble(TextBoxSum.Text)
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка создания заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
173
SushiBar/SushiBar/Forms/FormImplementer.Designer.cs
generated
173
SushiBar/SushiBar/Forms/FormImplementer.Designer.cs
generated
@ -1,173 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormImplementer
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
FIOTextBox = new TextBox();
|
|
||||||
PasswordTextBox = new TextBox();
|
|
||||||
QualificationTextBox = new TextBox();
|
|
||||||
WorkExperienceTextBox = new TextBox();
|
|
||||||
label1 = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
label3 = new Label();
|
|
||||||
label4 = new Label();
|
|
||||||
SaveButton = new Button();
|
|
||||||
CancelButton = new Button();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// FIOTextBox
|
|
||||||
//
|
|
||||||
FIOTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
FIOTextBox.Location = new Point(124, 19);
|
|
||||||
FIOTextBox.Name = "FIOTextBox";
|
|
||||||
FIOTextBox.Size = new Size(411, 27);
|
|
||||||
FIOTextBox.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// PasswordTextBox
|
|
||||||
//
|
|
||||||
PasswordTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
PasswordTextBox.Location = new Point(124, 52);
|
|
||||||
PasswordTextBox.Name = "PasswordTextBox";
|
|
||||||
PasswordTextBox.Size = new Size(411, 27);
|
|
||||||
PasswordTextBox.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// QualificationTextBox
|
|
||||||
//
|
|
||||||
QualificationTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
QualificationTextBox.Location = new Point(124, 85);
|
|
||||||
QualificationTextBox.Name = "QualificationTextBox";
|
|
||||||
QualificationTextBox.Size = new Size(411, 27);
|
|
||||||
QualificationTextBox.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// WorkExperienceTextBox
|
|
||||||
//
|
|
||||||
WorkExperienceTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
WorkExperienceTextBox.Location = new Point(124, 118);
|
|
||||||
WorkExperienceTextBox.Name = "WorkExperienceTextBox";
|
|
||||||
WorkExperienceTextBox.Size = new Size(411, 27);
|
|
||||||
WorkExperienceTextBox.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(9, 19);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(42, 20);
|
|
||||||
label1.TabIndex = 4;
|
|
||||||
label1.Text = "ФИО";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(9, 52);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(62, 20);
|
|
||||||
label2.TabIndex = 5;
|
|
||||||
label2.Text = "Пароль";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
label3.AutoSize = true;
|
|
||||||
label3.Location = new Point(9, 85);
|
|
||||||
label3.Name = "label3";
|
|
||||||
label3.Size = new Size(111, 20);
|
|
||||||
label3.TabIndex = 6;
|
|
||||||
label3.Text = "Квалификация";
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
label4.AutoSize = true;
|
|
||||||
label4.Location = new Point(9, 118);
|
|
||||||
label4.Name = "label4";
|
|
||||||
label4.Size = new Size(99, 20);
|
|
||||||
label4.TabIndex = 7;
|
|
||||||
label4.Text = "Стаж работы";
|
|
||||||
//
|
|
||||||
// SaveButton
|
|
||||||
//
|
|
||||||
SaveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
SaveButton.Location = new Point(341, 151);
|
|
||||||
SaveButton.Name = "SaveButton";
|
|
||||||
SaveButton.Size = new Size(94, 29);
|
|
||||||
SaveButton.TabIndex = 8;
|
|
||||||
SaveButton.Text = "Сохранить";
|
|
||||||
SaveButton.UseVisualStyleBackColor = true;
|
|
||||||
SaveButton.Click += SaveButton_Click;
|
|
||||||
//
|
|
||||||
// CancelButton
|
|
||||||
//
|
|
||||||
CancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
CancelButton.Location = new Point(441, 151);
|
|
||||||
CancelButton.Name = "CancelButton";
|
|
||||||
CancelButton.Size = new Size(94, 29);
|
|
||||||
CancelButton.TabIndex = 9;
|
|
||||||
CancelButton.Text = "Отмена";
|
|
||||||
CancelButton.UseVisualStyleBackColor = true;
|
|
||||||
CancelButton.Click += CancelButton_Click;
|
|
||||||
//
|
|
||||||
// ImplementerForm
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(548, 186);
|
|
||||||
Controls.Add(CancelButton);
|
|
||||||
Controls.Add(SaveButton);
|
|
||||||
Controls.Add(label4);
|
|
||||||
Controls.Add(label3);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Controls.Add(WorkExperienceTextBox);
|
|
||||||
Controls.Add(QualificationTextBox);
|
|
||||||
Controls.Add(PasswordTextBox);
|
|
||||||
Controls.Add(FIOTextBox);
|
|
||||||
MaximizeBox = false;
|
|
||||||
MinimizeBox = false;
|
|
||||||
Name = "ImplementerForm";
|
|
||||||
ShowInTaskbar = false;
|
|
||||||
Text = "Исполнитель";
|
|
||||||
TopMost = true;
|
|
||||||
Load += ImplementerForm_Load;
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private TextBox FIOTextBox;
|
|
||||||
private TextBox PasswordTextBox;
|
|
||||||
private TextBox QualificationTextBox;
|
|
||||||
private TextBox WorkExperienceTextBox;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Label label3;
|
|
||||||
private Label label4;
|
|
||||||
private Button SaveButton;
|
|
||||||
private Button CancelButton;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormImplementer : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
public FormImplementer(ILogger<FormImplementer> logger, IImplementerLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ImplementerForm_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение исполнителя");
|
|
||||||
var view = _logic.ReadElement(new ImplementerSearchModel
|
|
||||||
{
|
|
||||||
Id = _id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
FIOTextBox.Text = view.ImplementerFIO;
|
|
||||||
PasswordTextBox.Text = view.Password;
|
|
||||||
QualificationTextBox.Text = view.Qualification.ToString();
|
|
||||||
WorkExperienceTextBox.Text = view.WorkExperience.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка получения исполнителя");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(FIOTextBox.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните ФИО", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(PasswordTextBox.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните пароль", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new ImplementerBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
ImplementerFIO = FIOTextBox.Text,
|
|
||||||
Password = PasswordTextBox.Text,
|
|
||||||
Qualification = Convert.ToInt32(QualificationTextBox.Text),
|
|
||||||
WorkExperience = Convert.ToInt32(WorkExperienceTextBox.Text),
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения исполнителя");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CancelButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
121
SushiBar/SushiBar/Forms/FormImplementers.Designer.cs
generated
121
SushiBar/SushiBar/Forms/FormImplementers.Designer.cs
generated
@ -1,121 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormImplementers
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
CreateButton = new Button();
|
|
||||||
ChangeButton = new Button();
|
|
||||||
DeleteButton = new Button();
|
|
||||||
RefreshButton = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Location = new Point(12, 12);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(565, 426);
|
|
||||||
dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// CreateButton
|
|
||||||
//
|
|
||||||
CreateButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
CreateButton.Location = new Point(583, 12);
|
|
||||||
CreateButton.Name = "CreateButton";
|
|
||||||
CreateButton.Size = new Size(205, 29);
|
|
||||||
CreateButton.TabIndex = 1;
|
|
||||||
CreateButton.Text = "Создать";
|
|
||||||
CreateButton.UseVisualStyleBackColor = true;
|
|
||||||
CreateButton.Click += CreateButton_Click;
|
|
||||||
//
|
|
||||||
// ChangeButton
|
|
||||||
//
|
|
||||||
ChangeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ChangeButton.Location = new Point(583, 47);
|
|
||||||
ChangeButton.Name = "ChangeButton";
|
|
||||||
ChangeButton.Size = new Size(205, 29);
|
|
||||||
ChangeButton.TabIndex = 2;
|
|
||||||
ChangeButton.Text = "Изменить";
|
|
||||||
ChangeButton.UseVisualStyleBackColor = true;
|
|
||||||
ChangeButton.Click += ChangeButton_Click;
|
|
||||||
//
|
|
||||||
// DeleteButton
|
|
||||||
//
|
|
||||||
DeleteButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
DeleteButton.Location = new Point(583, 82);
|
|
||||||
DeleteButton.Name = "DeleteButton";
|
|
||||||
DeleteButton.Size = new Size(205, 29);
|
|
||||||
DeleteButton.TabIndex = 3;
|
|
||||||
DeleteButton.Text = "Удалить";
|
|
||||||
DeleteButton.UseVisualStyleBackColor = true;
|
|
||||||
DeleteButton.Click += DeleteButton_Click;
|
|
||||||
//
|
|
||||||
// RefreshButton
|
|
||||||
//
|
|
||||||
RefreshButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
RefreshButton.Location = new Point(583, 117);
|
|
||||||
RefreshButton.Name = "RefreshButton";
|
|
||||||
RefreshButton.Size = new Size(205, 29);
|
|
||||||
RefreshButton.TabIndex = 4;
|
|
||||||
RefreshButton.Text = "Обновить";
|
|
||||||
RefreshButton.UseVisualStyleBackColor = true;
|
|
||||||
RefreshButton.Click += RefreshButton_Click;
|
|
||||||
//
|
|
||||||
// FormImplementers
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(RefreshButton);
|
|
||||||
Controls.Add(DeleteButton);
|
|
||||||
Controls.Add(ChangeButton);
|
|
||||||
Controls.Add(CreateButton);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Name = "FormImplementers";
|
|
||||||
Text = "Исполнители";
|
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
Load += ImplementersForm_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button CreateButton;
|
|
||||||
private Button ChangeButton;
|
|
||||||
private Button DeleteButton;
|
|
||||||
private Button RefreshButton;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormImplementers : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerLogic _logic;
|
|
||||||
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ImplementersForm_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["Password"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["Qualification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["WorkExperience"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void CreateButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
|
||||||
if (service is FormImplementer form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ChangeButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
|
||||||
if (service is FormImplementer form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ImplementerBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления исполнителя");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RefreshButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
65
SushiBar/SushiBar/Forms/FormMailView.Designer.cs
generated
65
SushiBar/SushiBar/Forms/FormMailView.Designer.cs
generated
@ -1,65 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormMailView
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Location = new Point(12, 12);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.Size = new Size(776, 426);
|
|
||||||
dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// FormMailView
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Name = "FormMailView";
|
|
||||||
Text = "FormMail";
|
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
Load += FormMailView_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormMailView : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IMessageInfoLogic _logic;
|
|
||||||
public FormMailView(ILogger<FormMailView> logger, IMessageInfoLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormMailView_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
|
||||||
dataGridView.Columns["MessageId"].Visible = false;
|
|
||||||
dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка списка писем");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки писем");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
281
SushiBar/SushiBar/Forms/FormMain.Designer.cs
generated
281
SushiBar/SushiBar/Forms/FormMain.Designer.cs
generated
@ -1,281 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormMain
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
menuStrip1 = new MenuStrip();
|
|
||||||
toolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
sushiToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
componentsToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
clientsToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
implementersToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
отчётыToolStripMenuItem1 = new ToolStripMenuItem();
|
|
||||||
sushisReportToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
componentsReportПоСушиToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
orderReportToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
startWorksToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
sushisToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
componentSushisToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
buttonCreateOrder = new Button();
|
|
||||||
buttonTakeOrderInWork = new Button();
|
|
||||||
buttonOrderReady = new Button();
|
|
||||||
buttonIssuedOrder = new Button();
|
|
||||||
buttonRef = new Button();
|
|
||||||
MailToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
menuStrip1.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Location = new Point(0, 28);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(986, 514);
|
|
||||||
dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// menuStrip1
|
|
||||||
//
|
|
||||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
|
||||||
menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчётыToolStripMenuItem1, startWorksToolStripMenuItem, MailToolStripMenuItem });
|
|
||||||
menuStrip1.Location = new Point(0, 0);
|
|
||||||
menuStrip1.Name = "menuStrip1";
|
|
||||||
menuStrip1.Size = new Size(1184, 28);
|
|
||||||
menuStrip1.TabIndex = 1;
|
|
||||||
menuStrip1.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// toolStripMenuItem
|
|
||||||
//
|
|
||||||
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sushiToolStripMenuItem, componentsToolStripMenuItem, clientsToolStripMenuItem, implementersToolStripMenuItem });
|
|
||||||
toolStripMenuItem.Name = "toolStripMenuItem";
|
|
||||||
toolStripMenuItem.Size = new Size(117, 24);
|
|
||||||
toolStripMenuItem.Text = "Справочники";
|
|
||||||
//
|
|
||||||
// sushiToolStripMenuItem
|
|
||||||
//
|
|
||||||
sushiToolStripMenuItem.Name = "sushiToolStripMenuItem";
|
|
||||||
sushiToolStripMenuItem.Size = new Size(185, 26);
|
|
||||||
sushiToolStripMenuItem.Text = "Суши";
|
|
||||||
sushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// componentsToolStripMenuItem
|
|
||||||
//
|
|
||||||
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
|
||||||
componentsToolStripMenuItem.Size = new Size(185, 26);
|
|
||||||
componentsToolStripMenuItem.Text = "Компоненты";
|
|
||||||
componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// clientsToolStripMenuItem
|
|
||||||
//
|
|
||||||
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
|
|
||||||
clientsToolStripMenuItem.Size = new Size(185, 26);
|
|
||||||
clientsToolStripMenuItem.Text = "Клиенты";
|
|
||||||
clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// implementersToolStripMenuItem
|
|
||||||
//
|
|
||||||
implementersToolStripMenuItem.Name = "implementersToolStripMenuItem";
|
|
||||||
implementersToolStripMenuItem.Size = new Size(185, 26);
|
|
||||||
implementersToolStripMenuItem.Text = "Исполнители";
|
|
||||||
implementersToolStripMenuItem.Click += implementersToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// отчётыToolStripMenuItem1
|
|
||||||
//
|
|
||||||
отчётыToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { sushisReportToolStripMenuItem, componentsReportПоСушиToolStripMenuItem, orderReportToolStripMenuItem });
|
|
||||||
отчётыToolStripMenuItem1.Name = "отчётыToolStripMenuItem1";
|
|
||||||
отчётыToolStripMenuItem1.Size = new Size(73, 24);
|
|
||||||
отчётыToolStripMenuItem1.Text = "Отчёты";
|
|
||||||
//
|
|
||||||
// sushisReportToolStripMenuItem
|
|
||||||
//
|
|
||||||
sushisReportToolStripMenuItem.Name = "sushisReportToolStripMenuItem";
|
|
||||||
sushisReportToolStripMenuItem.Size = new Size(243, 26);
|
|
||||||
sushisReportToolStripMenuItem.Text = "Список суши";
|
|
||||||
sushisReportToolStripMenuItem.Click += sushisReportToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// componentsReportПоСушиToolStripMenuItem
|
|
||||||
//
|
|
||||||
componentsReportПоСушиToolStripMenuItem.Name = "componentsReportПоСушиToolStripMenuItem";
|
|
||||||
componentsReportПоСушиToolStripMenuItem.Size = new Size(243, 26);
|
|
||||||
componentsReportПоСушиToolStripMenuItem.Text = "Компоненты по суши";
|
|
||||||
componentsReportПоСушиToolStripMenuItem.Click += componentsReportПоСушиToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// orderReportToolStripMenuItem
|
|
||||||
//
|
|
||||||
orderReportToolStripMenuItem.Name = "orderReportToolStripMenuItem";
|
|
||||||
orderReportToolStripMenuItem.Size = new Size(243, 26);
|
|
||||||
orderReportToolStripMenuItem.Text = "Список заказов";
|
|
||||||
orderReportToolStripMenuItem.Click += orderReportToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// startWorksToolStripMenuItem
|
|
||||||
//
|
|
||||||
startWorksToolStripMenuItem.Name = "startWorksToolStripMenuItem";
|
|
||||||
startWorksToolStripMenuItem.Size = new Size(114, 24);
|
|
||||||
startWorksToolStripMenuItem.Text = "Запуск работ";
|
|
||||||
startWorksToolStripMenuItem.Click += startWorksToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// отчётыToolStripMenuItem
|
|
||||||
//
|
|
||||||
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
|
||||||
отчётыToolStripMenuItem.Size = new Size(32, 19);
|
|
||||||
//
|
|
||||||
// sushisToolStripMenuItem
|
|
||||||
//
|
|
||||||
sushisToolStripMenuItem.Name = "sushisToolStripMenuItem";
|
|
||||||
sushisToolStripMenuItem.Size = new Size(32, 19);
|
|
||||||
//
|
|
||||||
// componentSushisToolStripMenuItem
|
|
||||||
//
|
|
||||||
componentSushisToolStripMenuItem.Name = "componentSushisToolStripMenuItem";
|
|
||||||
componentSushisToolStripMenuItem.Size = new Size(32, 19);
|
|
||||||
//
|
|
||||||
// ordersToolStripMenuItem
|
|
||||||
//
|
|
||||||
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
|
||||||
ordersToolStripMenuItem.Size = new Size(32, 19);
|
|
||||||
//
|
|
||||||
// buttonCreateOrder
|
|
||||||
//
|
|
||||||
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonCreateOrder.Location = new Point(992, 28);
|
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
|
||||||
buttonCreateOrder.Size = new Size(180, 30);
|
|
||||||
buttonCreateOrder.TabIndex = 8;
|
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
|
||||||
//
|
|
||||||
// buttonTakeOrderInWork
|
|
||||||
//
|
|
||||||
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonTakeOrderInWork.Location = new Point(992, 64);
|
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
|
||||||
buttonTakeOrderInWork.Size = new Size(180, 30);
|
|
||||||
buttonTakeOrderInWork.TabIndex = 9;
|
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
|
||||||
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
|
||||||
//
|
|
||||||
// buttonOrderReady
|
|
||||||
//
|
|
||||||
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonOrderReady.Location = new Point(992, 100);
|
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
|
||||||
buttonOrderReady.Size = new Size(180, 30);
|
|
||||||
buttonOrderReady.TabIndex = 10;
|
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
|
||||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
|
||||||
buttonOrderReady.Click += ButtonOrderReady_Click;
|
|
||||||
//
|
|
||||||
// buttonIssuedOrder
|
|
||||||
//
|
|
||||||
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonIssuedOrder.Location = new Point(992, 136);
|
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
|
||||||
buttonIssuedOrder.Size = new Size(180, 30);
|
|
||||||
buttonIssuedOrder.TabIndex = 11;
|
|
||||||
buttonIssuedOrder.Text = "Заказ Выдан";
|
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
|
||||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
|
||||||
//
|
|
||||||
// buttonRef
|
|
||||||
//
|
|
||||||
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
buttonRef.Location = new Point(992, 172);
|
|
||||||
buttonRef.Name = "buttonRef";
|
|
||||||
buttonRef.Size = new Size(180, 30);
|
|
||||||
buttonRef.TabIndex = 12;
|
|
||||||
buttonRef.Text = "Обновить список";
|
|
||||||
buttonRef.UseVisualStyleBackColor = true;
|
|
||||||
buttonRef.Click += ButtonRef_Click;
|
|
||||||
//
|
|
||||||
// MailToolStripMenuItem
|
|
||||||
//
|
|
||||||
MailToolStripMenuItem.Name = "MailToolStripMenuItem";
|
|
||||||
MailToolStripMenuItem.Size = new Size(65, 24);
|
|
||||||
MailToolStripMenuItem.Text = "Почта";
|
|
||||||
MailToolStripMenuItem.Click += MailToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// FormMain
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(1184, 554);
|
|
||||||
Controls.Add(buttonRef);
|
|
||||||
Controls.Add(buttonIssuedOrder);
|
|
||||||
Controls.Add(buttonOrderReady);
|
|
||||||
Controls.Add(buttonTakeOrderInWork);
|
|
||||||
Controls.Add(buttonCreateOrder);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(menuStrip1);
|
|
||||||
MainMenuStrip = menuStrip1;
|
|
||||||
Name = "FormMain";
|
|
||||||
Text = "Сушибар";
|
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
Load += FormMain_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
menuStrip1.ResumeLayout(false);
|
|
||||||
menuStrip1.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private MenuStrip menuStrip1;
|
|
||||||
private Button buttonCreateOrder;
|
|
||||||
private Button buttonTakeOrderInWork;
|
|
||||||
private Button buttonOrderReady;
|
|
||||||
private Button buttonIssuedOrder;
|
|
||||||
private Button buttonRef;
|
|
||||||
private ToolStripMenuItem toolStripMenuItem;
|
|
||||||
private ToolStripMenuItem sushiToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem componentsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem отчётыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem sushisToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem componentSushisToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem отчётыToolStripMenuItem1;
|
|
||||||
private ToolStripMenuItem sushisReportToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem componentsReportПоСушиToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem orderReportToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem clientsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem implementersToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem startWorksToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem MailToolStripMenuItem;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,208 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarBusinessLogic.BusinessLogics;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormMain : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IOrderLogic _orderLogic;
|
|
||||||
private readonly IReportLogic _reportLogic;
|
|
||||||
private readonly IWorkProcess _workProcess;
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_orderLogic = orderLogic;
|
|
||||||
_reportLogic = reportLogic;
|
|
||||||
_workProcess = workProcess;
|
|
||||||
}
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _orderLogic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["SushiId"].Visible = false;
|
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
|
||||||
dataGridView.Columns["ImplementerId"].Visible = false;
|
|
||||||
dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки суши");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
|
||||||
if (service is FormComponents form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void SushiToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushis));
|
|
||||||
if (service is FormSushis form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
|
||||||
if (service is FormCreateOrder form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sushisReportToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
_reportLogic.SaveSushisToWordFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName
|
|
||||||
});
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiComponents));
|
|
||||||
if (service is FormReportSushiComponents form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void orderReportToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
|
||||||
if (service is FormReportOrders form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
|
||||||
if (service is FormClients form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void implementersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
|
||||||
if (service is FormImplementers form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startWorksToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
|
||||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MailToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormMailView));
|
|
||||||
if (service is FormMailView form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
142
SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs
generated
142
SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs
generated
@ -1,142 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormReportOrders
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
panel = new Panel();
|
|
||||||
label2 = new Label();
|
|
||||||
label1 = new Label();
|
|
||||||
dateTimePickerTo = new DateTimePicker();
|
|
||||||
dateTimePickerFrom = new DateTimePicker();
|
|
||||||
buttonToPdf = new Button();
|
|
||||||
buttonMake = new Button();
|
|
||||||
panelBody = new Panel();
|
|
||||||
panel.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel
|
|
||||||
//
|
|
||||||
panel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
panel.Controls.Add(label2);
|
|
||||||
panel.Controls.Add(label1);
|
|
||||||
panel.Controls.Add(dateTimePickerTo);
|
|
||||||
panel.Controls.Add(dateTimePickerFrom);
|
|
||||||
panel.Controls.Add(buttonToPdf);
|
|
||||||
panel.Controls.Add(buttonMake);
|
|
||||||
panel.Location = new Point(0, 0);
|
|
||||||
panel.Name = "panel";
|
|
||||||
panel.Size = new Size(1242, 51);
|
|
||||||
panel.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(317, 19);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(27, 20);
|
|
||||||
label2.TabIndex = 5;
|
|
||||||
label2.Text = "по";
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(39, 19);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(18, 20);
|
|
||||||
label1.TabIndex = 4;
|
|
||||||
label1.Text = "С";
|
|
||||||
//
|
|
||||||
// dateTimePickerTo
|
|
||||||
//
|
|
||||||
dateTimePickerTo.Location = new Point(366, 14);
|
|
||||||
dateTimePickerTo.Name = "dateTimePickerTo";
|
|
||||||
dateTimePickerTo.Size = new Size(210, 27);
|
|
||||||
dateTimePickerTo.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// dateTimePickerFrom
|
|
||||||
//
|
|
||||||
dateTimePickerFrom.Location = new Point(73, 14);
|
|
||||||
dateTimePickerFrom.Name = "dateTimePickerFrom";
|
|
||||||
dateTimePickerFrom.Size = new Size(214, 27);
|
|
||||||
dateTimePickerFrom.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// buttonToPdf
|
|
||||||
//
|
|
||||||
buttonToPdf.Location = new Point(1076, 10);
|
|
||||||
buttonToPdf.Name = "buttonToPdf";
|
|
||||||
buttonToPdf.Size = new Size(154, 29);
|
|
||||||
buttonToPdf.TabIndex = 1;
|
|
||||||
buttonToPdf.Text = "В PdF";
|
|
||||||
buttonToPdf.UseVisualStyleBackColor = true;
|
|
||||||
buttonToPdf.Click += buttonToPdf_Click;
|
|
||||||
//
|
|
||||||
// buttonMake
|
|
||||||
//
|
|
||||||
buttonMake.Location = new Point(916, 10);
|
|
||||||
buttonMake.Name = "buttonMake";
|
|
||||||
buttonMake.Size = new Size(154, 29);
|
|
||||||
buttonMake.TabIndex = 0;
|
|
||||||
buttonMake.Text = "Сформировать";
|
|
||||||
buttonMake.UseVisualStyleBackColor = true;
|
|
||||||
buttonMake.Click += buttonMake_Click;
|
|
||||||
//
|
|
||||||
// panelBody
|
|
||||||
//
|
|
||||||
panelBody.AllowDrop = true;
|
|
||||||
panelBody.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
panelBody.Location = new Point(12, 57);
|
|
||||||
panelBody.Name = "panelBody";
|
|
||||||
panelBody.Size = new Size(1218, 506);
|
|
||||||
panelBody.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// FormReportOrders
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(1242, 575);
|
|
||||||
Controls.Add(panelBody);
|
|
||||||
Controls.Add(panel);
|
|
||||||
Name = "FormReportOrders";
|
|
||||||
Text = "FormReportOrders";
|
|
||||||
panel.ResumeLayout(false);
|
|
||||||
panel.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel;
|
|
||||||
private Button buttonToPdf;
|
|
||||||
private Button buttonMake;
|
|
||||||
private DateTimePicker dateTimePickerTo;
|
|
||||||
private DateTimePicker dateTimePickerFrom;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private Panel panelBody;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Reporting.WinForms;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormReportOrders : Form
|
|
||||||
{
|
|
||||||
private readonly ReportViewer reportViewer;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
reportViewer = new ReportViewer
|
|
||||||
{
|
|
||||||
Dock = DockStyle.Fill
|
|
||||||
};
|
|
||||||
reportViewer.LocalReport.LoadReportDefinition(
|
|
||||||
new FileStream("Report/ReportOrders.rdlc", FileMode.Open));
|
|
||||||
panelBody.Controls.Add(reportViewer);
|
|
||||||
}
|
|
||||||
private void buttonMake_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания",
|
|
||||||
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dataSource = _logic.GetOrders(new ReportBindingModel
|
|
||||||
{
|
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
|
||||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
|
||||||
var parameters = new[] {
|
|
||||||
new ReportParameter("ReportParameterPeriod",
|
|
||||||
$"c{dateTimePickerFrom.Value.ToShortDateString()} по" +
|
|
||||||
$" {dateTimePickerTo.Value.ToShortDateString()}") };
|
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
|
||||||
reportViewer.RefreshReport();
|
|
||||||
_logger.LogInformation("Загрузка списка заказов на период {From}-{ To}",
|
|
||||||
dateTimePickerFrom.Value.ToShortDateString(),
|
|
||||||
dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка заказов на период");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void buttonToPdf_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "pdf|*.pdf"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
|
||||||
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName,
|
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка заказов на период { From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
@ -1,108 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormReportSushiComponents
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
buttonSaveToExcel = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
Component = new DataGridViewTextBoxColumn();
|
|
||||||
Sushi = new DataGridViewTextBoxColumn();
|
|
||||||
Count = new DataGridViewTextBoxColumn();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonSaveToExcel
|
|
||||||
//
|
|
||||||
buttonSaveToExcel.Location = new Point(11, 12);
|
|
||||||
buttonSaveToExcel.Name = "buttonSaveToExcel";
|
|
||||||
buttonSaveToExcel.Size = new Size(234, 29);
|
|
||||||
buttonSaveToExcel.TabIndex = 0;
|
|
||||||
buttonSaveToExcel.Text = "Сохранить в Excel";
|
|
||||||
buttonSaveToExcel.UseVisualStyleBackColor = true;
|
|
||||||
buttonSaveToExcel.Click += buttonSaveToExcel_Click;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Component, Sushi, Count });
|
|
||||||
dataGridView.Location = new Point(11, 47);
|
|
||||||
dataGridView.MultiSelect = false;
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(883, 391);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// Component
|
|
||||||
//
|
|
||||||
Component.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
Component.HeaderText = "Компонент";
|
|
||||||
Component.MinimumWidth = 6;
|
|
||||||
Component.Name = "Component";
|
|
||||||
//
|
|
||||||
// Sushi
|
|
||||||
//
|
|
||||||
Sushi.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
Sushi.HeaderText = "Суши";
|
|
||||||
Sushi.MinimumWidth = 6;
|
|
||||||
Sushi.Name = "Sushi";
|
|
||||||
//
|
|
||||||
// Count
|
|
||||||
//
|
|
||||||
Count.HeaderText = "Количество";
|
|
||||||
Count.MinimumWidth = 6;
|
|
||||||
Count.Name = "Count";
|
|
||||||
Count.Width = 125;
|
|
||||||
//
|
|
||||||
// FormReportSushiComponents
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(909, 457);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Controls.Add(buttonSaveToExcel);
|
|
||||||
Name = "FormReportSushiComponents";
|
|
||||||
Text = "FormReportSushiComponents";
|
|
||||||
Load += FormReportSushiComponents_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button buttonSaveToExcel;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private DataGridViewTextBoxColumn Component;
|
|
||||||
private DataGridViewTextBoxColumn Sushi;
|
|
||||||
private DataGridViewTextBoxColumn Count;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormReportSushiComponents : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
public FormReportSushiComponents(ILogger<FormReportSushiComponents>
|
|
||||||
logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
private void FormReportSushiComponents_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dict = _logic.GetSushiComponent();
|
|
||||||
if (dict != null)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Clear();
|
|
||||||
foreach (var elem in dict)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] {
|
|
||||||
elem.SushiName, "", ""
|
|
||||||
});
|
|
||||||
foreach (var listElem in elem.Components)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] {
|
|
||||||
"", listElem.Item1, listElem.Item2
|
|
||||||
});
|
|
||||||
}
|
|
||||||
dataGridView.Rows.Add(new object[] {
|
|
||||||
"Итого", "", elem.TotalCount
|
|
||||||
});
|
|
||||||
dataGridView.Rows.Add(Array.Empty<object>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка списка суши по компонентам");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void buttonSaveToExcel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "xlsx|*.xlsx"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logic.SaveSushiComponentToExcelFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка изделий по компонентам");
|
|
||||||
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
|
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,129 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="Component.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Sushi.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
255
SushiBar/SushiBar/Forms/FormSushi.Designer.cs
generated
255
SushiBar/SushiBar/Forms/FormSushi.Designer.cs
generated
@ -1,255 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormSushi
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
dataGridView = new DataGridView();
|
|
||||||
ID = new DataGridViewTextBoxColumn();
|
|
||||||
ComponentName = new DataGridViewTextBoxColumn();
|
|
||||||
ComponentCount = new DataGridViewTextBoxColumn();
|
|
||||||
groupBox1 = new GroupBox();
|
|
||||||
ButtonRef = new Button();
|
|
||||||
ButtonDel = new Button();
|
|
||||||
ButtonUpd = new Button();
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
label1 = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
textBoxPrice = new TextBox();
|
|
||||||
textBoxName = new TextBox();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
groupBox1.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonAdd.Location = new Point(614, 28);
|
|
||||||
ButtonAdd.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(151, 39);
|
|
||||||
ButtonAdd.TabIndex = 0;
|
|
||||||
ButtonAdd.Text = "Добавить";
|
|
||||||
ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonAdd.Click += ButtonAdd_Click;
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.AllowUserToAddRows = false;
|
|
||||||
dataGridView.AllowUserToDeleteRows = false;
|
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, ComponentName, ComponentCount });
|
|
||||||
dataGridView.Location = new Point(3, 24);
|
|
||||||
dataGridView.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.ReadOnly = true;
|
|
||||||
dataGridView.RowHeadersWidth = 51;
|
|
||||||
dataGridView.RowTemplate.Height = 25;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(605, 243);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// ID
|
|
||||||
//
|
|
||||||
ID.HeaderText = "";
|
|
||||||
ID.MinimumWidth = 6;
|
|
||||||
ID.Name = "ID";
|
|
||||||
ID.ReadOnly = true;
|
|
||||||
ID.Visible = false;
|
|
||||||
ID.Width = 125;
|
|
||||||
//
|
|
||||||
// ComponentName
|
|
||||||
//
|
|
||||||
ComponentName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
ComponentName.HeaderText = "Компонент";
|
|
||||||
ComponentName.MinimumWidth = 6;
|
|
||||||
ComponentName.Name = "ComponentName";
|
|
||||||
ComponentName.ReadOnly = true;
|
|
||||||
//
|
|
||||||
// ComponentCount
|
|
||||||
//
|
|
||||||
ComponentCount.HeaderText = "Количество";
|
|
||||||
ComponentCount.MinimumWidth = 6;
|
|
||||||
ComponentCount.Name = "ComponentCount";
|
|
||||||
ComponentCount.ReadOnly = true;
|
|
||||||
ComponentCount.Width = 125;
|
|
||||||
//
|
|
||||||
// groupBox1
|
|
||||||
//
|
|
||||||
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
groupBox1.Controls.Add(ButtonRef);
|
|
||||||
groupBox1.Controls.Add(ButtonDel);
|
|
||||||
groupBox1.Controls.Add(ButtonUpd);
|
|
||||||
groupBox1.Controls.Add(dataGridView);
|
|
||||||
groupBox1.Controls.Add(ButtonAdd);
|
|
||||||
groupBox1.Location = new Point(14, 101);
|
|
||||||
groupBox1.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
groupBox1.Name = "groupBox1";
|
|
||||||
groupBox1.Padding = new Padding(3, 4, 3, 4);
|
|
||||||
groupBox1.Size = new Size(774, 295);
|
|
||||||
groupBox1.TabIndex = 2;
|
|
||||||
groupBox1.TabStop = false;
|
|
||||||
groupBox1.Text = "Компоненты";
|
|
||||||
//
|
|
||||||
// buttonRef
|
|
||||||
//
|
|
||||||
ButtonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonRef.Location = new Point(614, 168);
|
|
||||||
ButtonRef.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
ButtonRef.Name = "ButtonRef";
|
|
||||||
ButtonRef.Size = new Size(151, 39);
|
|
||||||
ButtonRef.TabIndex = 4;
|
|
||||||
ButtonRef.Text = "Обновить";
|
|
||||||
ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
ButtonRef.Click += ButtonRef_Click;
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonDel.Location = new Point(614, 122);
|
|
||||||
ButtonDel.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
ButtonDel.Name = "ButtonDel";
|
|
||||||
ButtonDel.Size = new Size(151, 39);
|
|
||||||
ButtonDel.TabIndex = 3;
|
|
||||||
ButtonDel.Text = "Удалить";
|
|
||||||
ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDel.Click += ButtonDel_Click;
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
ButtonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonUpd.Location = new Point(614, 75);
|
|
||||||
ButtonUpd.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
ButtonUpd.Name = "ButtonUpd";
|
|
||||||
ButtonUpd.Size = new Size(151, 39);
|
|
||||||
ButtonUpd.TabIndex = 2;
|
|
||||||
ButtonUpd.Text = "Изменить";
|
|
||||||
ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonUpd.Click += ButtonUpd_Click;
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
ButtonSave.Location = new Point(573, 404);
|
|
||||||
ButtonSave.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(100, 31);
|
|
||||||
ButtonSave.TabIndex = 3;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
ButtonCancel.Location = new Point(679, 404);
|
|
||||||
ButtonCancel.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(100, 31);
|
|
||||||
ButtonCancel.TabIndex = 4;
|
|
||||||
ButtonCancel.Text = "Отмена";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(25, 16);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(80, 20);
|
|
||||||
label1.TabIndex = 5;
|
|
||||||
label1.Text = "Название:";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(25, 60);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(86, 20);
|
|
||||||
label2.TabIndex = 6;
|
|
||||||
label2.Text = "Стоимость:";
|
|
||||||
//
|
|
||||||
// textBoxPrice
|
|
||||||
//
|
|
||||||
textBoxPrice.Location = new Point(112, 56);
|
|
||||||
textBoxPrice.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
textBoxPrice.Name = "textBoxPrice";
|
|
||||||
textBoxPrice.Size = new Size(278, 27);
|
|
||||||
textBoxPrice.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
textBoxName.Location = new Point(112, 17);
|
|
||||||
textBoxName.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
textBoxName.Name = "textBoxName";
|
|
||||||
textBoxName.Size = new Size(278, 27);
|
|
||||||
textBoxName.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// FormSushi
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 451);
|
|
||||||
Controls.Add(textBoxName);
|
|
||||||
Controls.Add(textBoxPrice);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Controls.Add(groupBox1);
|
|
||||||
Name = "FormSushi";
|
|
||||||
Text = "Суши";
|
|
||||||
Load += FormSushi_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
groupBox1.ResumeLayout(false);
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button ButtonAdd;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private GroupBox groupBox1;
|
|
||||||
private Button ButtonRef;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private TextBox textBoxPrice;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private DataGridViewTextBoxColumn ID;
|
|
||||||
private DataGridViewTextBoxColumn ComponentName;
|
|
||||||
private DataGridViewTextBoxColumn ComponentCount;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,199 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarDataModels.Models;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormSushi : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly ISushiLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
private Dictionary<int, (IComponentModel, int)> _sushiComponents;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
public FormSushi(ILogger<FormSushi> logger, ISushiLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
_sushiComponents = new Dictionary<int, (IComponentModel, int)>();
|
|
||||||
}
|
|
||||||
private void FormSushi_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var view = _logic.ReadElement(new SushiSearchModel
|
|
||||||
{
|
|
||||||
Id = _id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
textBoxName.Text = view.SushiName;
|
|
||||||
textBoxPrice.Text = view.Price.ToString();
|
|
||||||
_sushiComponents = view.SushiComponents ?? new Dictionary<int, (IComponentModel, int)>();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка компонент изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_sushiComponents != null)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Clear();
|
|
||||||
foreach (var sc in _sushiComponents)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { sc.Key, sc.Value.Item1.ComponentName, sc.Value.Item2 });
|
|
||||||
}
|
|
||||||
textBoxPrice.Text = CalcPrice().ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонент изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent));
|
|
||||||
if (service is FormSushiComponent form)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (form.ComponentModel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
|
|
||||||
if (_sushiComponents.ContainsKey(form.Id))
|
|
||||||
{
|
|
||||||
_sushiComponents[form.Id] = (form.ComponentModel, form.Count);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_sushiComponents.Add(form.Id, (form.ComponentModel, form.Count));
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent));
|
|
||||||
if (service is FormSushiComponent form)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
|
||||||
form.Id = id;
|
|
||||||
form.Count = _sushiComponents[id].Item2;
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (form.ComponentModel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
|
|
||||||
_sushiComponents[form.Id] = (form.ComponentModel, form.Count);
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Удаление компонента: { ComponentName} - { Count}", dataGridView.SelectedRows[0].Cells[1].Value);
|
|
||||||
_sushiComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(textBoxPrice.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_sushiComponents == null || _sushiComponents.Count == 0)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new SushiBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
SushiName = textBoxName.Text,
|
|
||||||
Price = Convert.ToDouble(textBoxPrice.Text),
|
|
||||||
SushiComponents = _sushiComponents
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
private double CalcPrice()
|
|
||||||
{
|
|
||||||
double price = 0;
|
|
||||||
foreach (var elem in _sushiComponents)
|
|
||||||
{
|
|
||||||
price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
|
|
||||||
}
|
|
||||||
return Math.Round(price * 1.1, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,129 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="ComponentName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="ComponentCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
123
SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs
generated
123
SushiBar/SushiBar/Forms/FormSushiComponent.Designer.cs
generated
@ -1,123 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormSushiComponent
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
label1 = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
comboBoxComponent = new ComboBox();
|
|
||||||
textBoxCount = new TextBox();
|
|
||||||
ButtonSave = new Button();
|
|
||||||
ButtonCancel = new Button();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(12, 15);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(91, 20);
|
|
||||||
label1.TabIndex = 0;
|
|
||||||
label1.Text = "Компонент:";
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(12, 65);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(93, 20);
|
|
||||||
label2.TabIndex = 1;
|
|
||||||
label2.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// comboBoxComponent
|
|
||||||
//
|
|
||||||
comboBoxComponent.FormattingEnabled = true;
|
|
||||||
comboBoxComponent.Location = new Point(125, 12);
|
|
||||||
comboBoxComponent.Name = "comboBoxComponent";
|
|
||||||
comboBoxComponent.Size = new Size(227, 28);
|
|
||||||
comboBoxComponent.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// textBoxCount
|
|
||||||
//
|
|
||||||
textBoxCount.Location = new Point(125, 62);
|
|
||||||
textBoxCount.Name = "textBoxCount";
|
|
||||||
textBoxCount.Size = new Size(227, 27);
|
|
||||||
textBoxCount.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// ButtonSave
|
|
||||||
//
|
|
||||||
ButtonSave.Location = new Point(158, 95);
|
|
||||||
ButtonSave.Name = "ButtonSave";
|
|
||||||
ButtonSave.Size = new Size(94, 29);
|
|
||||||
ButtonSave.TabIndex = 4;
|
|
||||||
ButtonSave.Text = "Сохранить";
|
|
||||||
ButtonSave.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSave.Click += ButtonSave_Click;
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
ButtonCancel.Location = new Point(258, 95);
|
|
||||||
ButtonCancel.Name = "ButtonCancel";
|
|
||||||
ButtonCancel.Size = new Size(94, 29);
|
|
||||||
ButtonCancel.TabIndex = 5;
|
|
||||||
ButtonCancel.Text = "Отмена";
|
|
||||||
ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonCancel.Click += ButtonCancel_Click;
|
|
||||||
//
|
|
||||||
// FormSushiComponent
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(364, 132);
|
|
||||||
Controls.Add(ButtonCancel);
|
|
||||||
Controls.Add(ButtonSave);
|
|
||||||
Controls.Add(textBoxCount);
|
|
||||||
Controls.Add(comboBoxComponent);
|
|
||||||
Controls.Add(label2);
|
|
||||||
Controls.Add(label1);
|
|
||||||
MaximizeBox = false;
|
|
||||||
MinimizeBox = false;
|
|
||||||
Name = "FormSushiComponent";
|
|
||||||
ShowInTaskbar = false;
|
|
||||||
Text = "Компонент Изделия";
|
|
||||||
TopMost = true;
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label label1;
|
|
||||||
private Label label2;
|
|
||||||
private ComboBox comboBoxComponent;
|
|
||||||
private TextBox textBoxCount;
|
|
||||||
private Button ButtonSave;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
using SushiBarDataModels.Models;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormSushiComponent : Form
|
|
||||||
{
|
|
||||||
private readonly List<ComponentViewModel>? _list;
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Convert.ToInt32(comboBoxComponent.SelectedValue);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
comboBoxComponent.SelectedValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public IComponentModel? ComponentModel
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_list == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var elem in _list)
|
|
||||||
{
|
|
||||||
if (elem.Id == Id)
|
|
||||||
{
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { return Convert.ToInt32(textBoxCount.Text); }
|
|
||||||
set
|
|
||||||
{ textBoxCount.Text = value.ToString(); }
|
|
||||||
}
|
|
||||||
public FormSushiComponent(IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_list = logic.ReadList(null);
|
|
||||||
if (_list != null)
|
|
||||||
{
|
|
||||||
comboBoxComponent.DisplayMember = "ComponentName";
|
|
||||||
comboBoxComponent.ValueMember = "Id";
|
|
||||||
comboBoxComponent.DataSource = _list;
|
|
||||||
comboBoxComponent.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxComponent.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите компонент", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
123
SushiBar/SushiBar/Forms/FormSushis.Designer.cs
generated
123
SushiBar/SushiBar/Forms/FormSushis.Designer.cs
generated
@ -1,123 +0,0 @@
|
|||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
partial class FormSushis
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
ButtonRef = new Button();
|
|
||||||
ButtonDel = new Button();
|
|
||||||
ButtonUpd = new Button();
|
|
||||||
ButtonAdd = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader;
|
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
dataGridView.Location = new Point(0, 0);
|
|
||||||
dataGridView.Name = "dataGridView";
|
|
||||||
dataGridView.RowHeadersWidth = 70;
|
|
||||||
dataGridView.RowTemplate.Height = 29;
|
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
dataGridView.Size = new Size(777, 450);
|
|
||||||
dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// ButtonRef
|
|
||||||
//
|
|
||||||
ButtonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonRef.Location = new Point(783, 117);
|
|
||||||
ButtonRef.Name = "ButtonRef";
|
|
||||||
ButtonRef.Size = new Size(150, 29);
|
|
||||||
ButtonRef.TabIndex = 8;
|
|
||||||
ButtonRef.Text = "Обновить";
|
|
||||||
ButtonRef.UseVisualStyleBackColor = true;
|
|
||||||
ButtonRef.Click += ButtonRef_Click;
|
|
||||||
//
|
|
||||||
// ButtonDel
|
|
||||||
//
|
|
||||||
ButtonDel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonDel.Location = new Point(783, 82);
|
|
||||||
ButtonDel.Name = "ButtonDel";
|
|
||||||
ButtonDel.Size = new Size(150, 29);
|
|
||||||
ButtonDel.TabIndex = 7;
|
|
||||||
ButtonDel.Text = "Удалить";
|
|
||||||
ButtonDel.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDel.Click += ButtonDel_Click;
|
|
||||||
//
|
|
||||||
// ButtonUpd
|
|
||||||
//
|
|
||||||
ButtonUpd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonUpd.Location = new Point(783, 47);
|
|
||||||
ButtonUpd.Name = "ButtonUpd";
|
|
||||||
ButtonUpd.Size = new Size(150, 29);
|
|
||||||
ButtonUpd.TabIndex = 6;
|
|
||||||
ButtonUpd.Text = "Изменить";
|
|
||||||
ButtonUpd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonUpd.Click += ButtonUpd_Click;
|
|
||||||
//
|
|
||||||
// ButtonAdd
|
|
||||||
//
|
|
||||||
ButtonAdd.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
ButtonAdd.Location = new Point(783, 12);
|
|
||||||
ButtonAdd.Name = "ButtonAdd";
|
|
||||||
ButtonAdd.Size = new Size(150, 29);
|
|
||||||
ButtonAdd.TabIndex = 5;
|
|
||||||
ButtonAdd.Text = "Добавить";
|
|
||||||
ButtonAdd.UseVisualStyleBackColor = true;
|
|
||||||
ButtonAdd.Click += ButtonAdd_Click;
|
|
||||||
//
|
|
||||||
// FormSushis
|
|
||||||
//
|
|
||||||
AllowDrop = true;
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(945, 450);
|
|
||||||
Controls.Add(ButtonRef);
|
|
||||||
Controls.Add(ButtonDel);
|
|
||||||
Controls.Add(ButtonUpd);
|
|
||||||
Controls.Add(ButtonAdd);
|
|
||||||
Controls.Add(dataGridView);
|
|
||||||
Name = "FormSushis";
|
|
||||||
Text = "Суши";
|
|
||||||
WindowState = FormWindowState.Maximized;
|
|
||||||
Load += FormSushis_Load;
|
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button ButtonRef;
|
|
||||||
private Button ButtonDel;
|
|
||||||
private Button ButtonUpd;
|
|
||||||
private Button ButtonAdd;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
|
||||||
{
|
|
||||||
public partial class FormSushis : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly ISushiLogic _logic;
|
|
||||||
public FormSushis(ILogger<FormSushis> logger, ISushiLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
private void FormSushis_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["SushiComponents"].Visible = false;
|
|
||||||
dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка суши");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки суши");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushi));
|
|
||||||
if (service is FormSushi form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushi));
|
|
||||||
if (service is FormSushi form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Удаление компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new SushiBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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>
|
|
@ -1,102 +0,0 @@
|
|||||||
using IceCreamShopContracts.StoragesContracts;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using NLog.Extensions.Logging;
|
|
||||||
using SushiBar.Forms;
|
|
||||||
using SushiBarBusinessLogic.BusinessLogics;
|
|
||||||
using SushiBarBusinessLogic.MailWorker;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.Implements;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.StoragesContracts;
|
|
||||||
using SushiBarDatabaseImplement.Implements;
|
|
||||||
|
|
||||||
namespace SushiBar
|
|
||||||
{
|
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
private static ServiceProvider? _serviceProvider;
|
|
||||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
|
||||||
// see https://aka.ms/applicationconfiguration.
|
|
||||||
ApplicationConfiguration.Initialize();
|
|
||||||
var services = new ServiceCollection();
|
|
||||||
ConfigureServices(services);
|
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var mailSender = _serviceProvider.GetService<AbstractMailWorker>();
|
|
||||||
mailSender?.MailConfig(new MailConfigBindingModel
|
|
||||||
{
|
|
||||||
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
|
||||||
MailPassword = System.Configuration.ConfigurationManager.AppSettings["MailPassword"] ?? string.Empty,
|
|
||||||
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ?? string.Empty,
|
|
||||||
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
|
||||||
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
|
||||||
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
|
||||||
});
|
|
||||||
var timer = new System.Threading.Timer(new
|
|
||||||
TimerCallback(MailCheck!), null, 0, 100000);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var logger = _serviceProvider.GetService<ILogger>();
|
|
||||||
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
|
|
||||||
}
|
|
||||||
|
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
|
||||||
}
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddLogging(option =>
|
|
||||||
{
|
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
|
||||||
option.AddNLog("nlog.config");
|
|
||||||
});
|
|
||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
|
||||||
services.AddTransient<ISushiStorage, SushiStorage>();
|
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
|
||||||
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
|
||||||
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
|
|
||||||
|
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
|
||||||
services.AddTransient<ISushiLogic, SushiLogic>();
|
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
|
||||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
|
||||||
services.AddSingleton<IWorkProcess, WorkModeling>();
|
|
||||||
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
|
||||||
|
|
||||||
services.AddTransient<FormMain>();
|
|
||||||
services.AddTransient<FormComponent>();
|
|
||||||
services.AddTransient<FormComponents>();
|
|
||||||
services.AddTransient<FormCreateOrder>();
|
|
||||||
services.AddTransient<FormClients>();
|
|
||||||
services.AddTransient<FormSushi>();
|
|
||||||
services.AddTransient<FormSushiComponent>();
|
|
||||||
services.AddTransient<FormSushis>();
|
|
||||||
services.AddTransient<FormReportSushiComponents>();
|
|
||||||
services.AddTransient<FormReportOrders>();
|
|
||||||
services.AddTransient<FormImplementers>();
|
|
||||||
services.AddTransient<FormImplementer>();
|
|
||||||
services.AddTransient<FormMailView>();
|
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
|
||||||
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,599 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
|
||||||
<AutoRefresh>0</AutoRefresh>
|
|
||||||
<DataSources>
|
|
||||||
<DataSource Name="SushiBarContractsViewModels">
|
|
||||||
<ConnectionProperties>
|
|
||||||
<DataProvider>System.Data.DataSet</DataProvider>
|
|
||||||
<ConnectString>/* Local Connection */</ConnectString>
|
|
||||||
</ConnectionProperties>
|
|
||||||
<rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
|
|
||||||
</DataSource>
|
|
||||||
</DataSources>
|
|
||||||
<DataSets>
|
|
||||||
<DataSet Name="DataSetOrders">
|
|
||||||
<Query>
|
|
||||||
<DataSourceName>SushiBarContractsViewModels</DataSourceName>
|
|
||||||
<CommandText>/* Local Query */</CommandText>
|
|
||||||
</Query>
|
|
||||||
<Fields>
|
|
||||||
<Field Name="Id">
|
|
||||||
<DataField>Id</DataField>
|
|
||||||
<rd:TypeName>System.Int32</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="DateCreate">
|
|
||||||
<DataField>DateCreate</DataField>
|
|
||||||
<rd:TypeName>System.DateTime</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="SushiName">
|
|
||||||
<DataField>SushiName</DataField>
|
|
||||||
<rd:TypeName>System.String</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="OrderStatus">
|
|
||||||
<DataField>OrderStatus</DataField>
|
|
||||||
<rd:TypeName>SushiBarDataModels.OrderStatus</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="Sum">
|
|
||||||
<DataField>Sum</DataField>
|
|
||||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
</Fields>
|
|
||||||
<rd:DataSetInfo>
|
|
||||||
<rd:DataSetName>SushiBarContracts.ViewModels</rd:DataSetName>
|
|
||||||
<rd:TableName>ReportOrderViewModel</rd:TableName>
|
|
||||||
<rd:ObjectDataSourceType>SushiBarContracts.ViewModels.ReportOrderViewModel, SushiBarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
|
||||||
</rd:DataSetInfo>
|
|
||||||
</DataSet>
|
|
||||||
</DataSets>
|
|
||||||
<ReportSections>
|
|
||||||
<ReportSection>
|
|
||||||
<Body>
|
|
||||||
<ReportItems>
|
|
||||||
<Textbox Name="ReportParameterPeriod">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
|
||||||
<Style>
|
|
||||||
<FontSize>14pt</FontSize>
|
|
||||||
<FontWeight>Normal</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
|
||||||
<Top>1cm</Top>
|
|
||||||
<Height>1cm</Height>
|
|
||||||
<Width>21cm</Width>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<VerticalAlign>Middle</VerticalAlign>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="TextboxTitle">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Заказы</Value>
|
|
||||||
<Style>
|
|
||||||
<FontSize>16pt</FontSize>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Height>1cm</Height>
|
|
||||||
<Width>21cm</Width>
|
|
||||||
<ZIndex>1</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<VerticalAlign>Middle</VerticalAlign>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Tablix Name="Tablix1">
|
|
||||||
<TablixBody>
|
|
||||||
<TablixColumns>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.59525cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>3.30963cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>8.32842cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.59525cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.59525cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
</TablixColumns>
|
|
||||||
<TablixRows>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox5">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Номер</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox5</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox1">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Дата создания</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox1</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox3">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Суши</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox3</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox2">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Статус Заказа</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox2</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox7">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Сумма</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox7</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Id">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Id.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Id</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="DateCreate">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!DateCreate.Value</Value>
|
|
||||||
<Style>
|
|
||||||
<Format>d</Format>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>DateCreate</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="SushiName">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!SushiName.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>SushiName</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="OrderStatus">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!OrderStatus.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>OrderStatus</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Sum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Sum.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Sum</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
</TablixRows>
|
|
||||||
</TablixBody>
|
|
||||||
<TablixColumnHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixColumnHierarchy>
|
|
||||||
<TablixRowHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember>
|
|
||||||
<KeepWithGroup>After</KeepWithGroup>
|
|
||||||
</TablixMember>
|
|
||||||
<TablixMember>
|
|
||||||
<Group Name="Подробности" />
|
|
||||||
</TablixMember>
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixRowHierarchy>
|
|
||||||
<DataSetName>DataSetOrders</DataSetName>
|
|
||||||
<Top>2.48391cm</Top>
|
|
||||||
<Left>0.55245cm</Left>
|
|
||||||
<Height>1.2cm</Height>
|
|
||||||
<Width>19.4238cm</Width>
|
|
||||||
<ZIndex>2</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>Double</Style>
|
|
||||||
</Border>
|
|
||||||
</Style>
|
|
||||||
</Tablix>
|
|
||||||
<Textbox Name="TextboxTotalSum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Итого:</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Right</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Top>4.21167cm</Top>
|
|
||||||
<Left>14.97625cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
<ZIndex>3</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="SumTotal">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
|
|
||||||
<Style>
|
|
||||||
<FontWeight>Bold</FontWeight>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Right</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Top>4.21167cm</Top>
|
|
||||||
<Left>17.47625cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
<ZIndex>4</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</ReportItems>
|
|
||||||
<Height>5.72875cm</Height>
|
|
||||||
<Style />
|
|
||||||
</Body>
|
|
||||||
<Width>21cm</Width>
|
|
||||||
<Page>
|
|
||||||
<PageHeight>29.7cm</PageHeight>
|
|
||||||
<PageWidth>21cm</PageWidth>
|
|
||||||
<LeftMargin>2cm</LeftMargin>
|
|
||||||
<RightMargin>2cm</RightMargin>
|
|
||||||
<TopMargin>2cm</TopMargin>
|
|
||||||
<BottomMargin>2cm</BottomMargin>
|
|
||||||
<ColumnSpacing>0.13cm</ColumnSpacing>
|
|
||||||
<Style />
|
|
||||||
</Page>
|
|
||||||
</ReportSection>
|
|
||||||
</ReportSections>
|
|
||||||
<ReportParameters>
|
|
||||||
<ReportParameter Name="ReportParameterPeriod">
|
|
||||||
<DataType>String</DataType>
|
|
||||||
<Nullable>true</Nullable>
|
|
||||||
<Prompt>ReportParameter1</Prompt>
|
|
||||||
</ReportParameter>
|
|
||||||
</ReportParameters>
|
|
||||||
<ReportParametersLayout>
|
|
||||||
<GridLayoutDefinition>
|
|
||||||
<NumberOfColumns>5</NumberOfColumns>
|
|
||||||
<NumberOfRows>2</NumberOfRows>
|
|
||||||
<CellDefinitions>
|
|
||||||
<CellDefinition>
|
|
||||||
<ColumnIndex>0</ColumnIndex>
|
|
||||||
<RowIndex>0</RowIndex>
|
|
||||||
<ParameterName>ReportParameterPeriod</ParameterName>
|
|
||||||
</CellDefinition>
|
|
||||||
</CellDefinitions>
|
|
||||||
</GridLayoutDefinition>
|
|
||||||
</ReportParametersLayout>
|
|
||||||
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
|
||||||
<rd:ReportID>1c0c12af-b9e8-41db-8d1f-26d1acbf91cc</rd:ReportID>
|
|
||||||
</Report>
|
|
@ -1,40 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
|
||||||
<PackageReference Include="NLog" Version="5.2.8" />
|
|
||||||
<PackageReference Include="NLog.Config" Version="4.7.15" />
|
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
|
||||||
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
|
|
||||||
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\SushiBarFileImplement\SushiBarFileImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\SushiBarListImplement\SushiBarListImplement.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="nlog.config">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="Report\ReportOrders.rdlc">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
autoReload="true" internalLogLevel="Info">
|
|
||||||
<targets>
|
|
||||||
<target xsi:type="File" name="tofile" fileName="sushibar-${shortdate}.log" />
|
|
||||||
</targets>
|
|
||||||
<rules>
|
|
||||||
<logger name="*" minlevel="Debug" writeTo="tofile" />
|
|
||||||
</rules>
|
|
||||||
</nlog>
|
|
||||||
</configuration>
|
|
@ -1,116 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.StoragesContracts;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ClientLogic : IClientLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IClientStorage _clientStorage;
|
|
||||||
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage componentStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_clientStorage = componentStorage;
|
|
||||||
}
|
|
||||||
public List<ClientViewModel>? ReadList(ClientSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ClientFIO:{ClientFIO}. Id:{ Id}", model?.ClientFIO, model?.Id);
|
|
||||||
var list = model == null ? _clientStorage.GetFullList() :
|
|
||||||
_clientStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
public ClientViewModel? ReadElement(ClientSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. Id:{ Id} ClientFIO:{ ClientFIO} email:{ email} password:{ password}.", model.Id, model.ClientFIO, model.Email, model.Password);
|
|
||||||
var element = _clientStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
public bool Create(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_clientStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Update(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_clientStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Delete(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_clientStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private void CheckModel(ClientBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.ClientFIO))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет ФИО клиента",
|
|
||||||
nameof(model.ClientFIO));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Email))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет Email клиента",
|
|
||||||
nameof(model.ClientFIO));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Password))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет пароля клиента",
|
|
||||||
nameof(model.ClientFIO));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Client. ClientFIO:{ClientFIO}." +
|
|
||||||
"Email:{ Email}. Password:{ Password}. Id: { Id} ", model.ClientFIO, model.Email, model.Password, model.Id);
|
|
||||||
var element = _clientStorage.GetElement(new ClientSearchModel
|
|
||||||
{
|
|
||||||
Email = model.Email,
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Клиент с таким лоигном уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,109 +0,0 @@
|
|||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.StoragesContracts;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ComponentLogic : IComponentLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentStorage _componentStorage;
|
|
||||||
public ComponentLogic(ILogger<ComponentLogic> logger, IComponentStorage componentStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_componentStorage = componentStorage;
|
|
||||||
}
|
|
||||||
public List<ComponentViewModel>? ReadList(ComponentSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ComponentName:{ComponentName}. Id:{ Id}", model?.ComponentName, model?.Id);
|
|
||||||
var list = model == null ? _componentStorage.GetFullList() :
|
|
||||||
_componentStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
public ComponentViewModel? ReadElement(ComponentSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ComponentName:{ComponentName}. Id:{ Id}", model.ComponentName, model.Id);
|
|
||||||
var element = _componentStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
public bool Create(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_componentStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Update(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_componentStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Delete(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_componentStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private void CheckModel(ComponentBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.ComponentName))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет названия компонента", nameof(model.ComponentName));
|
|
||||||
}
|
|
||||||
if (model.Cost <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Component. ComponentName:{ComponentName}. Cost:{ Cost}. Id: { Id}", model.ComponentName, model.Cost, model.Id);
|
|
||||||
var element = _componentStorage.GetElement(new ComponentSearchModel
|
|
||||||
{
|
|
||||||
ComponentName = model.ComponentName
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
using IceCreamShopContracts.StoragesContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ImplementerLogic : IImplementerLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IImplementerStorage _implementerStorage;
|
|
||||||
public ImplementerLogic(ILogger<ImplementerLogic> logger, IImplementerStorage implementerStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_implementerStorage = implementerStorage;
|
|
||||||
}
|
|
||||||
public List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ImplementerFIO:{ClientFIO}. Id:{ Id}", model?.ImplementerFIO, model?.Id);
|
|
||||||
var list = model == null ? _implementerStorage.GetFullList() : _implementerStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
public ImplementerViewModel? ReadElement(ImplementerSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ImplementerFIO:{ImplementerFIO}.Id:{ Id}", model.ImplementerFIO, model.Id);
|
|
||||||
var element = _implementerStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
public bool Create(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_implementerStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Update(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_implementerStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Delete(ImplementerBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_implementerStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private void CheckModel(ImplementerBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет ФИО исполнителя", nameof(model.ImplementerFIO));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Password))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет пароля клиента", nameof(model.Password));
|
|
||||||
}
|
|
||||||
if (model.WorkExperience < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Стаж меньше 0", nameof(model.WorkExperience));
|
|
||||||
}
|
|
||||||
if (model.Qualification < 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Квалификация меньше 0", nameof(model.Qualification));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Implementer. ImplementerFIO:{ImplementerFIO}." + "Password:{ Password}. WorkExperience:{ WorkExperience}. Qualification:{ Qualification}. Id: { Id} ",
|
|
||||||
model.ImplementerFIO, model.Password, model.WorkExperience, model.Qualification, model.Id);
|
|
||||||
var element = _implementerStorage.GetElement(new ImplementerSearchModel
|
|
||||||
{
|
|
||||||
ImplementerFIO = model.ImplementerFIO,
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Исполнитель с таким ФИО уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.StoragesContracts;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class MessageInfoLogic : IMessageInfoLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IMessageInfoStorage _messageInfoStorage;
|
|
||||||
public MessageInfoLogic(ILogger<MessageInfoLogic> logger, IMessageInfoStorage MessageInfoStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_messageInfoStorage = MessageInfoStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(MessageInfoBindingModel model)
|
|
||||||
{
|
|
||||||
if (_messageInfoStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. MessageId:{MessageId}.ClientId:{ClientId} ", model?.MessageId, model?.ClientId);
|
|
||||||
var list = (model == null) ? _messageInfoStorage.GetFullList() : _messageInfoStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,181 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarBusinessLogic.MailWorker;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.StoragesContracts;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
using SushiBarDataModels.Enums;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class OrderLogic : IOrderLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
|
||||||
private readonly AbstractMailWorker _mailWorker;
|
|
||||||
private readonly IClientLogic _clientLogic;
|
|
||||||
static readonly object locker = new object();
|
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage,
|
|
||||||
AbstractMailWorker mailWorker, IClientLogic clientLogic)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_orderStorage = orderStorage;
|
|
||||||
_mailWorker = mailWorker;
|
|
||||||
_clientLogic = clientLogic;
|
|
||||||
}
|
|
||||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
|
|
||||||
var list = model == null ? _orderStorage.GetFullList() :
|
|
||||||
_orderStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
public OrderViewModel? ReadElement(OrderSearchModel model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadElement.");
|
|
||||||
var element = model == null ? null : _orderStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement Id:{ Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (model.Status != OrderStatus.Неизвестен)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Wrong Order Status");
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
model.Status = OrderStatus.Принят;
|
|
||||||
var res = _orderStorage.Insert(model);
|
|
||||||
if (res == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SendOrderStatusMail(model.ClientId, $"Изменен статус заказа #{res.Id}", $"Заказ #{res.Id} изменен статус на {model.Status}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
return ToNextStatus(model, OrderStatus.Выполняется);
|
|
||||||
}
|
|
||||||
public bool DeliveryOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
return ToNextStatus(model, OrderStatus.Выдан);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
return ToNextStatus(model, OrderStatus.Готов);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ToNextStatus(OrderBindingModel model, OrderStatus orderStatus)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
var element = _orderStorage.GetElement(new OrderSearchModel()
|
|
||||||
{
|
|
||||||
Id = model.Id
|
|
||||||
});
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(element));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (element.ImplementerId != null && model.ImplementerId != null && model.ImplementerId != element.ImplementerId)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(nameof(model.ImplementerId));
|
|
||||||
}
|
|
||||||
|
|
||||||
model.SushiId = element.SushiId;
|
|
||||||
model.DateCreate = element.DateCreate;
|
|
||||||
model.DateImplement = element.DateImplement;
|
|
||||||
model.Status = element.Status;
|
|
||||||
model.Count = element.Count;
|
|
||||||
model.Sum = element.Sum;
|
|
||||||
model.ClientId = element.ClientId;
|
|
||||||
model.ImplementerId = element.ImplementerId.HasValue ? element.ImplementerId : model.ImplementerId;
|
|
||||||
|
|
||||||
if (model.Status != orderStatus - 1)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Status update to " + orderStatus + " operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
model.Status = orderStatus;
|
|
||||||
|
|
||||||
if (model.Status == OrderStatus.Выдан)
|
|
||||||
{
|
|
||||||
model.DateImplement = DateTime.Now;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = _orderStorage.Update(model);
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
model.Status--;
|
|
||||||
_logger.LogWarning("Changing status operation faled");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SendOrderStatusMail(result.ClientId, $"Изменен статус заказа #{result.Id}", $"Заказ #{model.Id} изменен статус на {result.Status}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (model.DateImplement != null && model.DateCreate > model.DateImplement)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Заказ не может быть начат после его завершения");
|
|
||||||
}
|
|
||||||
if (model.Count <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Количество продукта должно быть бльше 0");
|
|
||||||
}
|
|
||||||
if (model.Sum <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Сумма заказа должна быть больше 0", nameof(model.Sum));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private bool SendOrderStatusMail(int clientId, string subject, string text)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var client = _clientLogic.ReadElement(new() { Id = clientId });
|
|
||||||
if (client == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_mailWorker.MailSendAsync(new()
|
|
||||||
{
|
|
||||||
MailAddress = client.Email,
|
|
||||||
Subject = subject,
|
|
||||||
Text = text
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.StoragesContracts;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ReportLogic : IReportLogic
|
|
||||||
{
|
|
||||||
private readonly IComponentStorage _componentStorage;
|
|
||||||
private readonly ISushiStorage _sushiStorage;
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
|
||||||
private readonly AbstractSaveToExcel _saveToExcel;
|
|
||||||
private readonly AbstractSaveToWord _saveToWord;
|
|
||||||
private readonly AbstractSaveToPdf _saveToPdf;
|
|
||||||
public ReportLogic(ISushiStorage sushiStorage, IComponentStorage componentStorage,
|
|
||||||
IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
|
||||||
{
|
|
||||||
_sushiStorage = sushiStorage;
|
|
||||||
_componentStorage = componentStorage;
|
|
||||||
_orderStorage = orderStorage;
|
|
||||||
_saveToExcel = saveToExcel;
|
|
||||||
_saveToWord = saveToWord;
|
|
||||||
_saveToPdf = saveToPdf;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ReportSushiComponentViewModel> GetSushiComponent()
|
|
||||||
{
|
|
||||||
var sushis = _sushiStorage.GetFullList();
|
|
||||||
var list = new List<ReportSushiComponentViewModel>();
|
|
||||||
foreach (var sushi in sushis)
|
|
||||||
{
|
|
||||||
var record = new ReportSushiComponentViewModel
|
|
||||||
{
|
|
||||||
SushiName = sushi.SushiName,
|
|
||||||
Components = new List<Tuple<string, int>>(),
|
|
||||||
TotalCount = 0
|
|
||||||
};
|
|
||||||
foreach (var component in sushi.SushiComponents)
|
|
||||||
{
|
|
||||||
record.Components.Add(new Tuple<string, int>(
|
|
||||||
component.Value.Item1.ComponentName,
|
|
||||||
component.Value.Item2
|
|
||||||
));
|
|
||||||
record.TotalCount += component.Value.Item2;
|
|
||||||
}
|
|
||||||
list.Add(record);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение списка заказов за определенный период
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
|
||||||
{
|
|
||||||
DateFrom = model.DateFrom,
|
|
||||||
DateTo = model.DateTo
|
|
||||||
})
|
|
||||||
.Select(x => new ReportOrdersViewModel
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
DateCreate = x.DateCreate,
|
|
||||||
SushiName = x.SushiName,
|
|
||||||
OrderStatus = x.Status.ToString(),
|
|
||||||
Sum = x.Sum
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение компонент в файл-Word
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveSushisToWordFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToWord.CreateDoc(new WordInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список суши",
|
|
||||||
Sushis = _sushiStorage.GetFullList()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveSushiComponentToExcelFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToExcel.CreateReport(new ExcelInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список суши",
|
|
||||||
SushiComponents = GetSushiComponent()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение заказов в файл-Pdf
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToPdf.CreateDoc(new PdfInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список заказов",
|
|
||||||
DateFrom = model.DateFrom!.Value,
|
|
||||||
DateTo = model.DateTo!.Value,
|
|
||||||
Orders = GetOrders(model)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.StoragesContracts;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class SushiLogic : ISushiLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly ISushiStorage _sushiStorage;
|
|
||||||
public SushiLogic(ILogger<SushiLogic> logger, ISushiStorage sushiStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_sushiStorage = sushiStorage;
|
|
||||||
}
|
|
||||||
public List<SushiViewModel>? ReadList(SushiSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. SushiName:{SushiName}. Id:{ Id}", model?.SushiName, model?.Id);
|
|
||||||
var list = model == null ? _sushiStorage.GetFullList() :
|
|
||||||
_sushiStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
public SushiViewModel? ReadElement(SushiSearchModel model)
|
|
||||||
{
|
|
||||||
if(model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. SushiName:{SushiName}. Id:{ Id}", model.SushiName, model.Id);
|
|
||||||
var element = _sushiStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
public bool Create(SushiBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_sushiStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Update(SushiBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_sushiStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Delete(SushiBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_sushiStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private void CheckModel(SushiBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.SushiName))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Нет названия продукта", nameof(model.SushiName));
|
|
||||||
}
|
|
||||||
if (model.Price <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Цена продукта должна быть больше 0", nameof(model.Price));
|
|
||||||
}
|
|
||||||
var element = _sushiStorage.GetElement(new SushiSearchModel
|
|
||||||
{
|
|
||||||
SushiName = model.SushiName
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Продукт с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using SushiBarContracts.SearchModels;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
using SushiBarDataModels.Enums;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class WorkModeling : IWorkProcess
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly Random _rnd;
|
|
||||||
private IOrderLogic? _orderLogic;
|
|
||||||
public WorkModeling(ILogger<WorkModeling> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_rnd = new Random(1000);
|
|
||||||
}
|
|
||||||
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
|
|
||||||
{
|
|
||||||
_orderLogic = orderLogic;
|
|
||||||
var implementers = implementerLogic.ReadList(null);
|
|
||||||
if (implementers == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("DoWork. Implementers is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var orders = _orderLogic.ReadList(new OrderSearchModel
|
|
||||||
{
|
|
||||||
Status = OrderStatus.Принят
|
|
||||||
});
|
|
||||||
if (orders == null || orders.Count == 0)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("DoWork. Orders is null or empty");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
|
||||||
foreach (var implementer in implementers)
|
|
||||||
{
|
|
||||||
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Иммитация работы исполнителя
|
|
||||||
private async Task WorkerWorkAsync(ImplementerViewModel implementer, List<OrderViewModel> orders)
|
|
||||||
{
|
|
||||||
if (_orderLogic == null || implementer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await RunOrderInWork(implementer);
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
foreach (var order in orders)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} try get order { Order}", implementer.Id, order.Id);
|
|
||||||
// пытаемся назначить заказ на исполнителя
|
|
||||||
_orderLogic.TakeOrderInWork(new OrderBindingModel
|
|
||||||
{
|
|
||||||
Id = order.Id,
|
|
||||||
ImplementerId = implementer.Id
|
|
||||||
});
|
|
||||||
// делаем работу
|
|
||||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} finish order { Order}", implementer.Id, order.Id);
|
|
||||||
|
|
||||||
_orderLogic.FinishOrder(new OrderBindingModel
|
|
||||||
{
|
|
||||||
Id = order.Id
|
|
||||||
});
|
|
||||||
// отдыхаем
|
|
||||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
|
||||||
}
|
|
||||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
|
||||||
catch (InvalidOperationException ex)
|
|
||||||
{
|
|
||||||
_logger.LogWarning(ex, "Error try get work");
|
|
||||||
}
|
|
||||||
// заканчиваем выполнение имитации в случае иной ошибки
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error while do work");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
|
|
||||||
private async Task RunOrderInWork(ImplementerViewModel implementer)
|
|
||||||
{
|
|
||||||
if (_orderLogic == null || implementer == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel()
|
|
||||||
{
|
|
||||||
ImplementerId = implementer.Id,
|
|
||||||
Status = OrderStatus.Выполняется
|
|
||||||
}));
|
|
||||||
if (runOrder == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
|
||||||
// доделываем работу
|
|
||||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
|
||||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, runOrder.Id);
|
|
||||||
_orderLogic.FinishOrder(new OrderBindingModel
|
|
||||||
{
|
|
||||||
Id = runOrder.Id
|
|
||||||
});
|
|
||||||
// отдыхаем
|
|
||||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
|
||||||
}
|
|
||||||
// заказа может не быть, просто игнорируем ошибку
|
|
||||||
catch (InvalidOperationException ex)
|
|
||||||
{
|
|
||||||
_logger.LogWarning(ex, "Error try get work");
|
|
||||||
}
|
|
||||||
// а может возникнуть иная ошибка, тогда просто заканчиваем выполнение имитации
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error while do work");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.MailWorker
|
|
||||||
{
|
|
||||||
public abstract class AbstractMailWorker
|
|
||||||
{
|
|
||||||
protected string _mailLogin = string.Empty;
|
|
||||||
protected string _mailPassword = string.Empty;
|
|
||||||
protected string _smtpClientHost = string.Empty;
|
|
||||||
protected int _smtpClientPort;
|
|
||||||
protected string _popHost = string.Empty;
|
|
||||||
protected int _popPort;
|
|
||||||
private readonly IMessageInfoLogic _messageInfoLogic;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IMessageInfoLogic messageInfoLogic)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_messageInfoLogic = messageInfoLogic;
|
|
||||||
}
|
|
||||||
public void MailConfig(MailConfigBindingModel config)
|
|
||||||
{
|
|
||||||
_mailLogin = config.MailLogin;
|
|
||||||
_mailPassword = config.MailPassword;
|
|
||||||
_smtpClientHost = config.SmtpClientHost;
|
|
||||||
_smtpClientPort = config.SmtpClientPort;
|
|
||||||
_popHost = config.PopHost;
|
|
||||||
_popPort = config.PopPort;
|
|
||||||
_logger.LogDebug("Config: {login}, {password}, {clientHost}, { clientPOrt}, { popHost}, { popPort}",
|
|
||||||
_mailLogin, _mailPassword, _smtpClientHost, _smtpClientPort, _popHost, _popPort);
|
|
||||||
}
|
|
||||||
public async void MailSendAsync(MailSendInfoBindingModel info)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(_smtpClientHost) || _smtpClientPort == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(info.MailAddress) || string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Text))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Send Mail: {To}, {Subject}", info.MailAddress, info.Subject);
|
|
||||||
await SendMailAsync(info);
|
|
||||||
}
|
|
||||||
public async void MailCheck()
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(_popHost) || _popPort == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_messageInfoLogic == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var list = await ReceiveMailAsync();
|
|
||||||
_logger.LogDebug("Check Mail: {Count} new mails", list.Count);
|
|
||||||
foreach (var mail in list)
|
|
||||||
{
|
|
||||||
_messageInfoLogic.Create(mail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
|
|
||||||
protected abstract Task<List<MessageInfoBindingModel>> ReceiveMailAsync();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using MailKit.Security;
|
|
||||||
using MailKit.Net.Pop3;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.MailWorker
|
|
||||||
{
|
|
||||||
public class MailKitWorker : AbstractMailWorker
|
|
||||||
{
|
|
||||||
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic) : base(logger, messageInfoLogic) { }
|
|
||||||
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
|
||||||
{
|
|
||||||
using var objMailMessage = new MailMessage();
|
|
||||||
using var objSmtpClient = new SmtpClient(_smtpClientHost, _smtpClientPort);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
objMailMessage.From = new MailAddress(_mailLogin);
|
|
||||||
objMailMessage.To.Add(new MailAddress(info.MailAddress));
|
|
||||||
objMailMessage.Subject = info.Subject;
|
|
||||||
objMailMessage.Body = info.Text;
|
|
||||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
|
||||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
|
||||||
objSmtpClient.UseDefaultCredentials = false;
|
|
||||||
objSmtpClient.EnableSsl = true;
|
|
||||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
|
||||||
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
|
|
||||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override async Task<List<MessageInfoBindingModel>>
|
|
||||||
ReceiveMailAsync()
|
|
||||||
{
|
|
||||||
var list = new List<MessageInfoBindingModel>();
|
|
||||||
using var client = new Pop3Client();
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
client.Connect(_popHost, _popPort, SecureSocketOptions.SslOnConnect);
|
|
||||||
client.Authenticate(_mailLogin, _mailPassword);
|
|
||||||
for (int i = 0; i < client.Count; i++)
|
|
||||||
{
|
|
||||||
var message = client.GetMessage(i);
|
|
||||||
foreach (var mail in message.From.Mailboxes)
|
|
||||||
{
|
|
||||||
list.Add(new MessageInfoBindingModel
|
|
||||||
{
|
|
||||||
DateDelivery = message.Date.DateTime,
|
|
||||||
MessageId = message.MessageId,
|
|
||||||
SenderName = mail.Address,
|
|
||||||
Subject = message.Subject,
|
|
||||||
Body = message.TextBody
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (AuthenticationException) { }
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
client.Disconnect(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToExcel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Создание отчета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
public void CreateReport(ExcelInfo info)
|
|
||||||
{
|
|
||||||
CreateExcel(info);
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = 1,
|
|
||||||
Text = info.Title,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
|
||||||
});
|
|
||||||
MergeCells(new ExcelMergeParameters
|
|
||||||
{
|
|
||||||
CellFromName = "A1",
|
|
||||||
CellToName = "C1"
|
|
||||||
});
|
|
||||||
uint rowIndex = 2;
|
|
||||||
foreach (var sc in info.SushiComponents)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = sc.SushiName,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
++rowIndex;
|
|
||||||
foreach (var sushi in sc.Components)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "B",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = sushi.Item1,
|
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = sushi.Item2.ToString(),
|
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
++rowIndex;
|
|
||||||
}
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = "Итого",
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = sc.TotalCount.ToString(),
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
++rowIndex;
|
|
||||||
}
|
|
||||||
SaveExcel(info);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание excel-файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void CreateExcel(ExcelInfo info);
|
|
||||||
/// <summary>
|
|
||||||
/// Добавляем новую ячейку в лист
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cellParameters"></param>
|
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
|
||||||
/// <summary>
|
|
||||||
/// Объединение ячеек
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mergeParameters"></param>
|
|
||||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение файла
|
|
||||||
/// </summary>
|
|
||||||
/// /// <param name="info"></param>
|
|
||||||
protected abstract void SaveExcel(ExcelInfo info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToPdf
|
|
||||||
{
|
|
||||||
public void CreateDoc(PdfInfo info)
|
|
||||||
{
|
|
||||||
CreatePdf(info);
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = info.Title,
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }",
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "4cm" });
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма", "Статус" },
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
foreach (var order in info.Orders)
|
|
||||||
{
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> {
|
|
||||||
order.Id.ToString(),
|
|
||||||
order.DateCreate.ToShortDateString(),
|
|
||||||
order.SushiName,
|
|
||||||
$"{order.Sum:C2}",
|
|
||||||
order.OrderStatus.ToString()
|
|
||||||
},
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
|
||||||
});
|
|
||||||
}
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = $"Итого: {info.Orders.Sum(x => x.Sum):C2}\t",
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
|
|
||||||
});
|
|
||||||
SavePdf(info);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание doc-файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void CreatePdf(PdfInfo info);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание параграфа с текстом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="title"></param>
|
|
||||||
/// <param name="style"></param>
|
|
||||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание таблицы
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="title"></param>
|
|
||||||
/// <param name="style"></param>
|
|
||||||
protected abstract void CreateTable(List<string> columns);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание и заполнение строки
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="rowParameters"></param>
|
|
||||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void SavePdf(PdfInfo info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToWord
|
|
||||||
{
|
|
||||||
public void CreateDoc(WordInfo info)
|
|
||||||
{
|
|
||||||
CreateWord(info);
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
|
||||||
(info.Title, new WordTextProperties {
|
|
||||||
Bold = true, Size = "24",
|
|
||||||
})
|
|
||||||
},
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Center
|
|
||||||
}
|
|
||||||
});
|
|
||||||
foreach (var sushis in info.Sushis)
|
|
||||||
{
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
|
||||||
(sushis.SushiName, new WordTextProperties { Size = "24", Bold = true }),
|
|
||||||
(" - цена " + sushis.Price.ToString(), new WordTextProperties { Size = "24" })
|
|
||||||
},
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Both
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
SaveWord(info);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание doc-файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void CreateWord(WordInfo info);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание абзаца с текстом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="paragraph"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
protected abstract void SaveWord(WordInfo info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum ExcelStyleInfoType
|
|
||||||
{
|
|
||||||
Title,
|
|
||||||
Text,
|
|
||||||
TextWithBroder
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum PdfParagraphAlignmentType
|
|
||||||
{
|
|
||||||
Center,
|
|
||||||
Left,
|
|
||||||
Rigth
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum WordJustificationType
|
|
||||||
{
|
|
||||||
Center,
|
|
||||||
Both
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelCellParameters
|
|
||||||
{
|
|
||||||
public string ColumnName { get; set; } = string.Empty;
|
|
||||||
public uint RowIndex { get; set; }
|
|
||||||
public string Text { get; set; } = string.Empty;
|
|
||||||
public string CellReference => $"{ColumnName}{RowIndex}";
|
|
||||||
public ExcelStyleInfoType StyleInfo { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelInfo
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<ReportSushiComponentViewModel> SushiComponents
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
} = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelMergeParameters
|
|
||||||
{
|
|
||||||
public string CellFromName { get; set; } = string.Empty;
|
|
||||||
public string CellToName { get; set; } = string.Empty;
|
|
||||||
public string Merge => $"{CellFromName}:{CellToName}";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfInfo
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public DateTime DateFrom { get; set; }
|
|
||||||
public DateTime DateTo { get; set; }
|
|
||||||
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfParagraph
|
|
||||||
{
|
|
||||||
public string Text { get; set; } = string.Empty;
|
|
||||||
public string Style { get; set; } = string.Empty;
|
|
||||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfRowParameters
|
|
||||||
{
|
|
||||||
public List<string> Texts { get; set; } = new();
|
|
||||||
public string Style { get; set; } = string.Empty;
|
|
||||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using SushiBarContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordInfo
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<SushiViewModel> Sushis { get; set; } = new();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordParagraph
|
|
||||||
{
|
|
||||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
|
||||||
public WordTextProperties? TextProperties { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordTextProperties
|
|
||||||
{
|
|
||||||
public string Size { get; set; } = string.Empty;
|
|
||||||
public bool Bold { get; set; }
|
|
||||||
public WordJustificationType JustificationType { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,319 +0,0 @@
|
|||||||
using DocumentFormat.OpenXml;
|
|
||||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
||||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToExcel : AbstractSaveToExcel
|
|
||||||
{
|
|
||||||
private SpreadsheetDocument? _spreadsheetDocument;
|
|
||||||
private SharedStringTablePart? _shareStringPart;
|
|
||||||
private Worksheet? _worksheet;
|
|
||||||
/// <summary>
|
|
||||||
/// Настройка стилей для файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="workbookpart"></param>
|
|
||||||
private static void CreateStyles(WorkbookPart workbookpart)
|
|
||||||
{
|
|
||||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
|
||||||
sp.Stylesheet = new Stylesheet();
|
|
||||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
|
||||||
var fontUsual = new Font();
|
|
||||||
fontUsual.Append(new FontSize() { Val = 12D });
|
|
||||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Theme = 1U });
|
|
||||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
|
||||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
|
||||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
|
||||||
var fontTitle = new Font();
|
|
||||||
fontTitle.Append(new Bold());
|
|
||||||
fontTitle.Append(new FontSize() { Val = 14D });
|
|
||||||
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Theme = 1U });
|
|
||||||
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
|
||||||
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
|
||||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
|
||||||
fonts.Append(fontUsual);
|
|
||||||
fonts.Append(fontTitle);
|
|
||||||
var fills = new Fills() { Count = 2U };
|
|
||||||
var fill1 = new Fill();
|
|
||||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
|
||||||
var fill2 = new Fill();
|
|
||||||
fill2.Append(new PatternFill()
|
|
||||||
{
|
|
||||||
PatternType = PatternValues.Gray125
|
|
||||||
});
|
|
||||||
fills.Append(fill1);
|
|
||||||
fills.Append(fill2);
|
|
||||||
var borders = new Borders() { Count = 2U };
|
|
||||||
var borderNoBorder = new Border();
|
|
||||||
borderNoBorder.Append(new LeftBorder());
|
|
||||||
borderNoBorder.Append(new RightBorder());
|
|
||||||
borderNoBorder.Append(new TopBorder());
|
|
||||||
borderNoBorder.Append(new BottomBorder());
|
|
||||||
borderNoBorder.Append(new DiagonalBorder());
|
|
||||||
var borderThin = new Border();
|
|
||||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
|
||||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var rightBorder = new RightBorder()
|
|
||||||
{
|
|
||||||
Style = BorderStyleValues.Thin
|
|
||||||
};
|
|
||||||
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
|
||||||
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var bottomBorder = new BottomBorder()
|
|
||||||
{
|
|
||||||
Style = BorderStyleValues.Thin
|
|
||||||
};
|
|
||||||
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
borderThin.Append(leftBorder);
|
|
||||||
borderThin.Append(rightBorder);
|
|
||||||
borderThin.Append(topBorder);
|
|
||||||
borderThin.Append(bottomBorder);
|
|
||||||
borderThin.Append(new DiagonalBorder());
|
|
||||||
borders.Append(borderNoBorder);
|
|
||||||
borders.Append(borderThin);
|
|
||||||
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
|
|
||||||
var cellFormatStyle = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U
|
|
||||||
};
|
|
||||||
cellStyleFormats.Append(cellFormatStyle);
|
|
||||||
var cellFormats = new CellFormats() { Count = 3U };
|
|
||||||
var cellFormatFont = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U,
|
|
||||||
FormatId = 0U,
|
|
||||||
ApplyFont = true
|
|
||||||
};
|
|
||||||
var cellFormatFontAndBorder = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 1U,
|
|
||||||
FormatId = 0U,
|
|
||||||
ApplyFont = true,
|
|
||||||
ApplyBorder = true
|
|
||||||
};
|
|
||||||
var cellFormatTitle = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 1U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U,
|
|
||||||
FormatId = 0U,
|
|
||||||
Alignment = new Alignment()
|
|
||||||
{
|
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
|
||||||
WrapText = true,
|
|
||||||
Horizontal = HorizontalAlignmentValues.Center
|
|
||||||
},
|
|
||||||
ApplyFont = true
|
|
||||||
};
|
|
||||||
cellFormats.Append(cellFormatFont);
|
|
||||||
cellFormats.Append(cellFormatFontAndBorder);
|
|
||||||
cellFormats.Append(cellFormatTitle);
|
|
||||||
var cellStyles = new CellStyles() { Count = 1U };
|
|
||||||
cellStyles.Append(new CellStyle()
|
|
||||||
{
|
|
||||||
Name = "Normal",
|
|
||||||
FormatId = 0U,
|
|
||||||
BuiltinId = 0U
|
|
||||||
});
|
|
||||||
var differentialFormats = new DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
|
||||||
{ Count = 0U };
|
|
||||||
|
|
||||||
var tableStyles = new TableStyles()
|
|
||||||
{
|
|
||||||
Count = 0U,
|
|
||||||
DefaultTableStyle = "TableStyleMedium2",
|
|
||||||
DefaultPivotStyle = "PivotStyleLight16"
|
|
||||||
};
|
|
||||||
var stylesheetExtensionList = new StylesheetExtensionList();
|
|
||||||
var stylesheetExtension1 = new StylesheetExtension()
|
|
||||||
{
|
|
||||||
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
|
||||||
};
|
|
||||||
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
|
||||||
stylesheetExtension1.Append(new SlicerStyles()
|
|
||||||
{
|
|
||||||
DefaultSlicerStyle = "SlicerStyleLight1"
|
|
||||||
});
|
|
||||||
var stylesheetExtension2 = new StylesheetExtension()
|
|
||||||
{
|
|
||||||
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
|
||||||
};
|
|
||||||
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
|
||||||
stylesheetExtension2.Append(new TimelineStyles()
|
|
||||||
{
|
|
||||||
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
|
||||||
});
|
|
||||||
stylesheetExtensionList.Append(stylesheetExtension1);
|
|
||||||
stylesheetExtensionList.Append(stylesheetExtension2);
|
|
||||||
sp.Stylesheet.Append(fonts);
|
|
||||||
sp.Stylesheet.Append(fills);
|
|
||||||
sp.Stylesheet.Append(borders);
|
|
||||||
sp.Stylesheet.Append(cellStyleFormats);
|
|
||||||
sp.Stylesheet.Append(cellFormats);
|
|
||||||
sp.Stylesheet.Append(cellStyles);
|
|
||||||
sp.Stylesheet.Append(differentialFormats);
|
|
||||||
sp.Stylesheet.Append(tableStyles);
|
|
||||||
sp.Stylesheet.Append(stylesheetExtensionList);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение номера стиля из типа
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="styleInfo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
|
||||||
{
|
|
||||||
return styleInfo switch
|
|
||||||
{
|
|
||||||
ExcelStyleInfoType.Title => 2U,
|
|
||||||
ExcelStyleInfoType.TextWithBroder => 1U,
|
|
||||||
ExcelStyleInfoType.Text => 0U,
|
|
||||||
_ => 0U,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
protected override void CreateExcel(ExcelInfo info)
|
|
||||||
{
|
|
||||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
|
||||||
// Создаем книгу (в ней хранятся листы)
|
|
||||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
|
||||||
workbookpart.Workbook = new Workbook();
|
|
||||||
CreateStyles(workbookpart);
|
|
||||||
// Получаем/создаем хранилище текстов для книги
|
|
||||||
_shareStringPart =
|
|
||||||
_spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any() ?
|
|
||||||
_spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First() :
|
|
||||||
_spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
|
||||||
// Создаем SharedStringTable, если его нет
|
|
||||||
if (_shareStringPart.SharedStringTable == null)
|
|
||||||
{
|
|
||||||
_shareStringPart.SharedStringTable = new SharedStringTable();
|
|
||||||
}
|
|
||||||
// Создаем лист в книгу
|
|
||||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
|
||||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
|
||||||
// Добавляем лист в книгу
|
|
||||||
var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
|
||||||
var sheet = new Sheet()
|
|
||||||
{
|
|
||||||
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
|
||||||
SheetId = 1,
|
|
||||||
Name = "Лист"
|
|
||||||
};
|
|
||||||
sheets.Append(sheet);
|
|
||||||
_worksheet = worksheetPart.Worksheet;
|
|
||||||
}
|
|
||||||
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
|
|
||||||
{
|
|
||||||
if (_worksheet == null || _shareStringPart == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
|
||||||
if (sheetData == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Ищем строку, либо добавляем ее
|
|
||||||
Row row;
|
|
||||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).Any())
|
|
||||||
{
|
|
||||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! == excelParams.RowIndex).First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
row = new Row() { RowIndex = excelParams.RowIndex };
|
|
||||||
sheetData.Append(row);
|
|
||||||
}
|
|
||||||
// Ищем нужную ячейку
|
|
||||||
Cell cell;
|
|
||||||
if (row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).Any())
|
|
||||||
{
|
|
||||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value == excelParams.CellReference).First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Все ячейки должны быть последовательно друг за другом расположены
|
|
||||||
// нужно определить, после какой вставлять
|
|
||||||
Cell? refCell = null;
|
|
||||||
foreach (Cell rowCell in row.Elements<Cell>())
|
|
||||||
{
|
|
||||||
if (string.Compare(rowCell.CellReference!.Value, excelParams.CellReference, true) > 0)
|
|
||||||
{
|
|
||||||
refCell = rowCell;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var newCell = new Cell()
|
|
||||||
{
|
|
||||||
CellReference = excelParams.CellReference
|
|
||||||
};
|
|
||||||
row.InsertBefore(newCell, refCell);
|
|
||||||
cell = newCell;
|
|
||||||
}
|
|
||||||
// вставляем новый текст
|
|
||||||
_shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
|
|
||||||
_shareStringPart.SharedStringTable.Save();
|
|
||||||
cell.CellValue = new CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
|
|
||||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
|
||||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
|
||||||
}
|
|
||||||
protected override void MergeCells(ExcelMergeParameters excelParams)
|
|
||||||
{
|
|
||||||
if (_worksheet == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MergeCells mergeCells;
|
|
||||||
if (_worksheet.Elements<MergeCells>().Any())
|
|
||||||
{
|
|
||||||
mergeCells = _worksheet.Elements<MergeCells>().First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mergeCells = new MergeCells();
|
|
||||||
if (_worksheet.Elements<CustomSheetView>().Any())
|
|
||||||
{
|
|
||||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<CustomSheetView>().First());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_worksheet.InsertAfter(mergeCells, _worksheet.Elements<SheetData>().First());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var mergeCell = new MergeCell()
|
|
||||||
{
|
|
||||||
Reference = new StringValue(excelParams.Merge)
|
|
||||||
};
|
|
||||||
mergeCells.Append(mergeCell);
|
|
||||||
}
|
|
||||||
protected override void SaveExcel(ExcelInfo info)
|
|
||||||
{
|
|
||||||
if (_spreadsheetDocument == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
|
||||||
_spreadsheetDocument.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
using MigraDoc.DocumentObjectModel;
|
|
||||||
using MigraDoc.DocumentObjectModel.Tables;
|
|
||||||
using MigraDoc.Rendering;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToPdf : AbstractSaveToPdf
|
|
||||||
{
|
|
||||||
private Document? _document;
|
|
||||||
private Section? _section;
|
|
||||||
private Table? _table;
|
|
||||||
private static ParagraphAlignment
|
|
||||||
GetParagraphAlignment(PdfParagraphAlignmentType type)
|
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
|
||||||
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
|
||||||
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
|
||||||
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
|
||||||
_ => ParagraphAlignment.Justify,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Создание стилей для документа
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="document"></param>
|
|
||||||
private static void DefineStyles(Document document)
|
|
||||||
{
|
|
||||||
var style = document.Styles["Normal"];
|
|
||||||
style.Font.Name = "Times New Roman";
|
|
||||||
style.Font.Size = 14;
|
|
||||||
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
|
||||||
style.Font.Bold = true;
|
|
||||||
}
|
|
||||||
protected override void CreatePdf(PdfInfo info)
|
|
||||||
{
|
|
||||||
_document = new Document();
|
|
||||||
DefineStyles(_document);
|
|
||||||
_section = _document.AddSection();
|
|
||||||
}
|
|
||||||
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
|
||||||
{
|
|
||||||
if (_section == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
|
||||||
paragraph.Format.SpaceAfter = "1cm";
|
|
||||||
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
|
||||||
paragraph.Style = pdfParagraph.Style;
|
|
||||||
}
|
|
||||||
protected override void CreateTable(List<string> columns)
|
|
||||||
{
|
|
||||||
if (_document == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_table = _document.LastSection.AddTable();
|
|
||||||
foreach (var elem in columns)
|
|
||||||
{
|
|
||||||
_table.AddColumn(elem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override void CreateRow(PdfRowParameters rowParameters)
|
|
||||||
{
|
|
||||||
if (_table == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var row = _table.AddRow();
|
|
||||||
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
|
||||||
{
|
|
||||||
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
|
||||||
if (!string.IsNullOrEmpty(rowParameters.Style))
|
|
||||||
{
|
|
||||||
row.Cells[i].Style = rowParameters.Style;
|
|
||||||
}
|
|
||||||
Unit borderWidth = 0.5;
|
|
||||||
row.Cells[i].Borders.Left.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Right.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Top.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
|
||||||
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
|
||||||
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override void SavePdf(PdfInfo info)
|
|
||||||
{
|
|
||||||
var renderer = new PdfDocumentRenderer(true)
|
|
||||||
{
|
|
||||||
Document = _document
|
|
||||||
};
|
|
||||||
renderer.RenderDocument();
|
|
||||||
renderer.PdfDocument.Save(info.FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
using SushiBarBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using DocumentFormat.OpenXml;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
using SushiBarBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToWord : AbstractSaveToWord
|
|
||||||
{
|
|
||||||
private WordprocessingDocument? _wordDocument;
|
|
||||||
private Body? _docBody;
|
|
||||||
/// <summary>
|
|
||||||
/// Получение типа выравнивания
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
|
||||||
WordJustificationType.Both => JustificationValues.Both,
|
|
||||||
WordJustificationType.Center => JustificationValues.Center,
|
|
||||||
_ => JustificationValues.Left,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Настройки страницы
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static SectionProperties CreateSectionProperties()
|
|
||||||
{
|
|
||||||
var properties = new SectionProperties();
|
|
||||||
var pageSize = new PageSize
|
|
||||||
{
|
|
||||||
Orient = PageOrientationValues.Portrait
|
|
||||||
};
|
|
||||||
properties.AppendChild(pageSize);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Задание форматирования для абзаца
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="paragraphProperties"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
|
||||||
{
|
|
||||||
if (paragraphProperties == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var properties = new ParagraphProperties();
|
|
||||||
properties.AppendChild(new Justification()
|
|
||||||
{
|
|
||||||
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
|
||||||
});
|
|
||||||
properties.AppendChild(new SpacingBetweenLines
|
|
||||||
{
|
|
||||||
LineRule = LineSpacingRuleValues.Auto
|
|
||||||
});
|
|
||||||
|
|
||||||
properties.AppendChild(new Indentation());
|
|
||||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
|
||||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
|
||||||
{
|
|
||||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
|
||||||
{
|
|
||||||
Val = paragraphProperties.Size
|
|
||||||
});
|
|
||||||
}
|
|
||||||
properties.AppendChild(paragraphMarkRunProperties);
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateWord(WordInfo info)
|
|
||||||
{
|
|
||||||
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
|
||||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
|
||||||
mainPart.Document = new Document();
|
|
||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
|
||||||
}
|
|
||||||
protected override void CreateParagraph(WordParagraph paragraph)
|
|
||||||
{
|
|
||||||
if (_docBody == null || paragraph == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var docParagraph = new Paragraph();
|
|
||||||
|
|
||||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
|
||||||
foreach (var run in paragraph.Texts)
|
|
||||||
{
|
|
||||||
var docRun = new Run();
|
|
||||||
var properties = new RunProperties();
|
|
||||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
|
||||||
if (run.Item2.Bold)
|
|
||||||
{
|
|
||||||
properties.AppendChild(new Bold());
|
|
||||||
}
|
|
||||||
docRun.AppendChild(properties);
|
|
||||||
docRun.AppendChild(new Text
|
|
||||||
{
|
|
||||||
Text = run.Item1,
|
|
||||||
Space = SpaceProcessingModeValues.Preserve
|
|
||||||
});
|
|
||||||
docParagraph.AppendChild(docRun);
|
|
||||||
}
|
|
||||||
_docBody.AppendChild(docParagraph);
|
|
||||||
}
|
|
||||||
protected override void SaveWord(WordInfo info)
|
|
||||||
{
|
|
||||||
if (_docBody == null || _wordDocument == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_docBody.AppendChild(CreateSectionProperties());
|
|
||||||
_wordDocument.MainDocumentPart!.Document.Save();
|
|
||||||
_wordDocument.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
|
|
||||||
<PackageReference Include="DocumentFormat.OpenXml.Framework" Version="3.0.2" />
|
|
||||||
<PackageReference Include="MailKit" Version="4.6.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
|
||||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,44 +0,0 @@
|
|||||||
using Newtonsoft.Json;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace SushiBarClientApp
|
|
||||||
{
|
|
||||||
public static class APIClient
|
|
||||||
{
|
|
||||||
private static readonly HttpClient _client = new();
|
|
||||||
public static ClientViewModel? Client { get; set; } = null;
|
|
||||||
public static void Connect(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
|
||||||
_client.DefaultRequestHeaders.Accept.Clear();
|
|
||||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
||||||
}
|
|
||||||
public static T? GetRequest<T>(string requestUrl)
|
|
||||||
{
|
|
||||||
var response = _client.GetAsync(requestUrl);
|
|
||||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
|
||||||
if (response.Result.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
return JsonConvert.DeserializeObject<T>(result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void PostRequest<T>(string requestUrl, T model)
|
|
||||||
{
|
|
||||||
var json = JsonConvert.SerializeObject(model);
|
|
||||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
|
||||||
var response = _client.PostAsync(requestUrl, data);
|
|
||||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
|
||||||
if (!response.Result.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
throw new Exception(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,162 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using SushiBarClientApp.Models;
|
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.ViewModels;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace SushiBarClientApp.Controllers
|
|
||||||
{
|
|
||||||
public class HomeController : Controller
|
|
||||||
{
|
|
||||||
private readonly ILogger<HomeController> _logger;
|
|
||||||
public HomeController(ILogger<HomeController> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
public IActionResult Index()
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
return Redirect("~/Home/Enter");
|
|
||||||
}
|
|
||||||
return
|
|
||||||
View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Privacy()
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
return Redirect("~/Home/Enter");
|
|
||||||
}
|
|
||||||
return View(APIClient.Client);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Privacy(string login, string password, string fio)
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/updatedata", new
|
|
||||||
ClientBindingModel
|
|
||||||
{
|
|
||||||
Id = APIClient.Client.Id,
|
|
||||||
ClientFIO = fio,
|
|
||||||
Email = login,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
APIClient.Client.ClientFIO = fio;
|
|
||||||
APIClient.Client.Email = login;
|
|
||||||
APIClient.Client.Password = password;
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
||||||
public IActionResult Error()
|
|
||||||
{
|
|
||||||
return View(new ErrorViewModel
|
|
||||||
{
|
|
||||||
RequestId =
|
|
||||||
Activity.Current?.Id ?? HttpContext.TraceIdentifier
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Enter()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Enter(string login, string password)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин и пароль");
|
|
||||||
}
|
|
||||||
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Неверный логин/пароль");
|
|
||||||
}
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Register()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Register(string login, string password, string fio)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/register", new
|
|
||||||
ClientBindingModel
|
|
||||||
{
|
|
||||||
ClientFIO = fio,
|
|
||||||
Email = login,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
Response.Redirect("Enter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Create()
|
|
||||||
{
|
|
||||||
ViewBag.Sushis = APIClient.GetRequest<List<SushiViewModel>>("api/main/getsushilist");
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Create(int sushi, int count)
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
|
||||||
}
|
|
||||||
if (count <= 0)
|
|
||||||
{
|
|
||||||
throw new Exception("Количество и сумма должны быть больше 0");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/main/createorder", new OrderBindingModel
|
|
||||||
{
|
|
||||||
ClientId = APIClient.Client.Id,
|
|
||||||
SushiId = sushi,
|
|
||||||
Count = count,
|
|
||||||
Sum = Calc(count, sushi)
|
|
||||||
});
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public double Calc(int count, int sushi)
|
|
||||||
{
|
|
||||||
var _sushi = APIClient.GetRequest<SushiViewModel>($"api/main/getsushi?sushiid={sushi}");
|
|
||||||
return Math.Round(count * (_sushi?.Price ?? 1), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult Mails()
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
return Redirect("~/Home/Enter");
|
|
||||||
}
|
|
||||||
return
|
|
||||||
View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace SushiBarClientApp.Models
|
|
||||||
{
|
|
||||||
public class ErrorViewModel
|
|
||||||
{
|
|
||||||
public string? RequestId { get; set; }
|
|
||||||
|
|
||||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
using SushiBarClientApp;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
|
|
||||||
// Add services to the container.
|
|
||||||
builder.Services.AddControllersWithViews();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
APIClient.Connect(builder.Configuration);
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
|
||||||
if (!app.Environment.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseExceptionHandler("/Home/Error");
|
|
||||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
||||||
app.UseHsts();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseStaticFiles();
|
|
||||||
|
|
||||||
app.UseRouting();
|
|
||||||
|
|
||||||
app.UseAuthorization();
|
|
||||||
|
|
||||||
app.MapControllerRoute(
|
|
||||||
name: "default",
|
|
||||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
||||||
|
|
||||||
app.Run();
|
|
@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:33714",
|
|
||||||
"sslPort": 44315
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
|
||||||
"http": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "http://localhost:5051",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"https": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "https://localhost:7071;http://localhost:5051",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,56 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Create";
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Создание заказа</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Суши:</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<select id="sushi" name="sushi" class="form-control" asp-items="@(new SelectList(@ViewBag.Sushis,"Id", "SushiName"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Количество:</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<input type="text" name="count" id="count" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Сумма:</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<input type="text" id="sum" name="sum" readonly />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4">
|
|
||||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<script>
|
|
||||||
$('#sushi').on('change', function () {
|
|
||||||
check();
|
|
||||||
});
|
|
||||||
$('#count').on('change', function () {
|
|
||||||
check();
|
|
||||||
});
|
|
||||||
|
|
||||||
function check() {
|
|
||||||
var count = $('#count').val();
|
|
||||||
var sushi = $('#sushi').val();
|
|
||||||
if (count && sushi) {
|
|
||||||
$.ajax({
|
|
||||||
method: "POST",
|
|
||||||
url: "/Home/Calc",
|
|
||||||
data: { count: count, sushi: sushi },
|
|
||||||
success: function (result) {
|
|
||||||
$("#sum").val(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,20 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Enter";
|
|
||||||
}
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Вход в приложение</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Логин:</div>
|
|
||||||
<div class="col-8"><input type="text" name="login" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Пароль:</div>
|
|
||||||
<div class="col-8"><input type="password" name="password" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4"><input type="submit" value="Вход" class="btn btnprimary" /></div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
@ -1,69 +0,0 @@
|
|||||||
@using SushiBarContracts.ViewModels
|
|
||||||
@model List<OrderViewModel>
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Home Page";
|
|
||||||
}
|
|
||||||
<div class="text-center">
|
|
||||||
<h1 class="display-4">Заказы</h1>
|
|
||||||
</div>
|
|
||||||
<div class="text-center">
|
|
||||||
@{
|
|
||||||
if (Model == null)
|
|
||||||
{
|
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
<p>
|
|
||||||
<a asp-action="Create">Создать заказ</a>
|
|
||||||
</p>
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
Номер
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Суши
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Дата создания
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Количество
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Сумма
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Статус
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var item in Model)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Id)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.SushiName)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.DateCreate)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Count)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Sum)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Status)
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
</div>
|
|
@ -1,54 +0,0 @@
|
|||||||
@using SushiBarContracts.ViewModels
|
|
||||||
|
|
||||||
@model List<MessageInfoViewModel>
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Mails";
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
<h1 class="display-4">Заказы</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
@{
|
|
||||||
if (Model == null)
|
|
||||||
{
|
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
Дата письма
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Заголовок
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Текст
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var item in Model)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.DateDelivery)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Subject)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Body)
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
</div>
|
|
@ -1,28 +0,0 @@
|
|||||||
@using SushiBarContracts.ViewModels
|
|
||||||
|
|
||||||
@model ClientViewModel
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Privacy Policy";
|
|
||||||
}
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Личные данные</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Логин:</div>
|
|
||||||
<div class="col-8"><input type="text" name="login" value="@Model.Email"/></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Пароль:</div>
|
|
||||||
<div class="col-8"><input type="password" name="password" value="@Model.Password"/></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">ФИО:</div>
|
|
||||||
<div class="col-8"><input type="text" name="fio" value="@Model.ClientFIO"/></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
@ -1,27 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Register";
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="display-4">Регистрация</h2>
|
|
||||||
</div>
|
|
||||||
<form method="post">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Логин:</div>
|
|
||||||
<div class="col-8"><input type="text" name="login" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Пароль:</div>
|
|
||||||
<div class="col-8"><input type="password" name="password" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">ФИО:</div>
|
|
||||||
<div class="col-8"><input type="text" name="fio" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4">
|
|
||||||
<input type="submit" value="Регистрация" class="btn btn-primary" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
@ -1,25 +0,0 @@
|
|||||||
@model ErrorViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Error";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h1 class="text-danger">Error.</h1>
|
|
||||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
|
||||||
|
|
||||||
@if (Model.ShowRequestId)
|
|
||||||
{
|
|
||||||
<p>
|
|
||||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
|
||||||
</p>
|
|
||||||
}
|
|
||||||
|
|
||||||
<h3>Development Mode</h3>
|
|
||||||
<p>
|
|
||||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
|
||||||
It can result in displaying sensitive information from exceptions to end users.
|
|
||||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
|
||||||
and restarting the app.
|
|
||||||
</p>
|
|
@ -1,53 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>@ViewData["Title"] - SushiBarClientApp</title>
|
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
|
||||||
<link rel="stylesheet" href="~/css/site.css" />
|
|
||||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
|
||||||
<div class="container">
|
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Суши бар</a>
|
|
||||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
|
||||||
aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
|
|
||||||
<ul class="navbar-nav flex-grow-1">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Index">Заказы</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
|
||||||
<main role="main" class="pb-3">
|
|
||||||
@RenderBody()
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
<footer class="border-top footer text-muted">
|
|
||||||
<div class="container">
|
|
||||||
© 2024 - Суши бар - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
|
||||||
@RenderSection("Scripts", required: false)
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,48 +0,0 @@
|
|||||||
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
|
||||||
for details on configuring this project to bundle and minify static web assets. */
|
|
||||||
|
|
||||||
a.navbar-brand {
|
|
||||||
white-space: normal;
|
|
||||||
text-align: center;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #0077cc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #1b6ec2;
|
|
||||||
border-color: #1861ac;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #1b6ec2;
|
|
||||||
border-color: #1861ac;
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-top {
|
|
||||||
border-top: 1px solid #e5e5e5;
|
|
||||||
}
|
|
||||||
.border-bottom {
|
|
||||||
border-bottom: 1px solid #e5e5e5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.box-shadow {
|
|
||||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
|
||||||
}
|
|
||||||
|
|
||||||
button.accept-policy {
|
|
||||||
font-size: 1rem;
|
|
||||||
line-height: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
line-height: 60px;
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
|
||||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
|
@ -1,3 +0,0 @@
|
|||||||
@using SushiBarClientApp
|
|
||||||
@using SushiBarClientApp.Models
|
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
|
@ -1,3 +0,0 @@
|
|||||||
@{
|
|
||||||
Layout = "_Layout";
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
|
|
||||||
"IPAddress": "http://localhost:5050"
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using SushiBarDataModels.Models;
|
|
||||||
|
|
||||||
namespace SushiBarContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class ClientBindingModel : IClientModel
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
|
||||||
public string Email { get; set; } = string.Empty;
|
|
||||||
public string Password { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using SushiBarDataModels.Models;
|
|
||||||
|
|
||||||
namespace SushiBarContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class ComponentBindingModel : IComponentModel
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
|
||||||
public double Cost { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using SushiBarDataModels.Models;
|
|
||||||
|
|
||||||
namespace SushiBarContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class ImplementerBindingModel : IImplementerModel
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
|
||||||
public int WorkExperience { get; set; } = 0;
|
|
||||||
public int Qualification { get; set; } = 0;
|
|
||||||
public string Password { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
namespace SushiBarContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class MailConfigBindingModel
|
|
||||||
{
|
|
||||||
public string MailLogin { get; set; } = string.Empty;
|
|
||||||
public string MailPassword { get; set; } = string.Empty;
|
|
||||||
public string SmtpClientHost { get; set; } = string.Empty;
|
|
||||||
public int SmtpClientPort { get; set; }
|
|
||||||
public string PopHost { get; set; } = string.Empty;
|
|
||||||
public int PopPort { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace SushiBarContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class MailSendInfoBindingModel
|
|
||||||
{
|
|
||||||
public string MailAddress { get; set; } = string.Empty;
|
|
||||||
public string Subject { get; set; } = string.Empty;
|
|
||||||
public string Text { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user