Летс гоу
This commit is contained in:
commit
b03c89593a
1
.gitignore
vendored
1
.gitignore
vendored
@ -398,3 +398,4 @@ FodyWeavers.xsd
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
/PIbd-23_Panina.A.D_JewelryStore/JewelryStoreClientApp/JewelryStoreClientApp.csproj
|
||||
|
@ -0,0 +1,17 @@
|
||||
using JewelryShopDataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreDataModels.Models
|
||||
{
|
||||
public interface IStoreModel : IId
|
||||
{
|
||||
public string StoreName { get; }
|
||||
public string StoreAdress { get; }
|
||||
DateTime OpeningDate { get; }
|
||||
Dictionary<int, (IJewelModel, int)> Jewels { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreDataModels.Models
|
||||
{
|
||||
public interface ISupplyModel
|
||||
{
|
||||
int ShopId { get; }
|
||||
int JewelId { get; }
|
||||
int Count { get; }
|
||||
}
|
||||
}
|
@ -17,9 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreFileImplement",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreDatabaseImplement", "JewelryStoreDatabaseImplement\JewelryStoreDatabaseImplement.csproj", "{8AA20901-3D23-4622-A0E8-1FC830923335}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JewelryStoreRestApi", "JewelryStoreRestApi\JewelryStoreRestApi.csproj", "{26DBFC2C-876E-47B7-B1BF-43873B807C6E}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreRestApi", "JewelryStoreRestApi\JewelryStoreRestApi.csproj", "{26DBFC2C-876E-47B7-B1BF-43873B807C6E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JewelryStoreClientApp", "JewelryStoreClientApp\JewelryStoreClientApp.csproj", "{DF7A00DE-A581-4A42-819F-4C49047FAE86}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreShopApp", "JewelryStoreShopApp\JewelryStoreShopApp.csproj", "{784174AD-62FD-4777-99D8-26ED43CBF2C9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -59,10 +59,10 @@ Global
|
||||
{26DBFC2C-876E-47B7-B1BF-43873B807C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{26DBFC2C-876E-47B7-B1BF-43873B807C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{26DBFC2C-876E-47B7-B1BF-43873B807C6E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DF7A00DE-A581-4A42-819F-4C49047FAE86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DF7A00DE-A581-4A42-819F-4C49047FAE86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DF7A00DE-A581-4A42-819F-4C49047FAE86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DF7A00DE-A581-4A42-819F-4C49047FAE86}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
143
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormCreateSupply.Designer.cs
generated
Normal file
143
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormCreateSupply.Designer.cs
generated
Normal file
@ -0,0 +1,143 @@
|
||||
namespace JewelryStoreView
|
||||
{
|
||||
partial class FormCreateSupply
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.comboBoxShop = new System.Windows.Forms.ComboBox();
|
||||
this.labelShop = new System.Windows.Forms.Label();
|
||||
this.labelJewel = new System.Windows.Forms.Label();
|
||||
this.comboBoxJewel = new System.Windows.Forms.ComboBox();
|
||||
this.labelCount = new System.Windows.Forms.Label();
|
||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comboBoxShop
|
||||
//
|
||||
this.comboBoxShop.FormattingEnabled = true;
|
||||
this.comboBoxShop.Location = new System.Drawing.Point(115, 12);
|
||||
this.comboBoxShop.Name = "comboBoxShop";
|
||||
this.comboBoxShop.Size = new System.Drawing.Size(344, 28);
|
||||
this.comboBoxShop.TabIndex = 0;
|
||||
//
|
||||
// labelShop
|
||||
//
|
||||
this.labelShop.AutoSize = true;
|
||||
this.labelShop.Location = new System.Drawing.Point(12, 15);
|
||||
this.labelShop.Name = "labelShop";
|
||||
this.labelShop.Size = new System.Drawing.Size(76, 20);
|
||||
this.labelShop.TabIndex = 1;
|
||||
this.labelShop.Text = "Магазин: ";
|
||||
//
|
||||
// labelJewel
|
||||
//
|
||||
this.labelJewel.AutoSize = true;
|
||||
this.labelJewel.Location = new System.Drawing.Point(12, 49);
|
||||
this.labelJewel.Name = "labelJewel";
|
||||
this.labelJewel.Size = new System.Drawing.Size(75, 20);
|
||||
this.labelJewel.TabIndex = 2;
|
||||
this.labelJewel.Text = "Изделие: ";
|
||||
//
|
||||
// comboBoxJewel
|
||||
//
|
||||
this.comboBoxJewel.FormattingEnabled = true;
|
||||
this.comboBoxJewel.Location = new System.Drawing.Point(115, 46);
|
||||
this.comboBoxJewel.Name = "comboBoxJewel";
|
||||
this.comboBoxJewel.Size = new System.Drawing.Size(344, 28);
|
||||
this.comboBoxJewel.TabIndex = 3;
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
this.labelCount.AutoSize = true;
|
||||
this.labelCount.Location = new System.Drawing.Point(12, 83);
|
||||
this.labelCount.Name = "labelCount";
|
||||
this.labelCount.Size = new System.Drawing.Size(97, 20);
|
||||
this.labelCount.TabIndex = 4;
|
||||
this.labelCount.Text = "Количество: ";
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
this.textBoxCount.Location = new System.Drawing.Point(115, 80);
|
||||
this.textBoxCount.Name = "textBoxCount";
|
||||
this.textBoxCount.Size = new System.Drawing.Size(344, 27);
|
||||
this.textBoxCount.TabIndex = 5;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(300, 113);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(116, 39);
|
||||
this.buttonCancel.TabIndex = 6;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(168, 113);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(116, 39);
|
||||
this.buttonSave.TabIndex = 7;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
||||
//
|
||||
// FormCreateSupply
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(471, 164);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.textBoxCount);
|
||||
this.Controls.Add(this.labelCount);
|
||||
this.Controls.Add(this.comboBoxJewel);
|
||||
this.Controls.Add(this.labelJewel);
|
||||
this.Controls.Add(this.labelShop);
|
||||
this.Controls.Add(this.comboBoxShop);
|
||||
this.Name = "FormCreateSupply";
|
||||
this.Text = "Создание поставки";
|
||||
this.Load += new System.EventHandler(this.FormCreateSupply_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxShop;
|
||||
private Label labelShop;
|
||||
private Label labelJewel;
|
||||
private ComboBox comboBoxJewel;
|
||||
private Label labelCount;
|
||||
private TextBox textBoxCount;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
100
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormCreateSupply.cs
Normal file
100
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormCreateSupply.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
|
||||
namespace JewelryStoreView
|
||||
{
|
||||
public partial class FormCreateSupply : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IJewelLogic _logicP;
|
||||
private readonly IStoreLogic _logicS;
|
||||
private List<StoreViewModel> _shopList = new List<StoreViewModel>();
|
||||
private List<JewelViewModel> _jewelList = new List<JewelViewModel>();
|
||||
|
||||
public FormCreateSupply(ILogger<FormCreateSupply> logger, IJewelLogic logicP, IStoreLogic logicS)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicP = logicP;
|
||||
_logicS = logicS;
|
||||
}
|
||||
|
||||
private void FormCreateSupply_Load(object sender, EventArgs e)
|
||||
{
|
||||
_shopList = _logicS.ReadList(null);
|
||||
_jewelList = _logicP.ReadList(null);
|
||||
if (_shopList != null)
|
||||
{
|
||||
comboBoxShop.DisplayMember = "ShopName";
|
||||
comboBoxShop.ValueMember = "Id";
|
||||
comboBoxShop.DataSource = _shopList;
|
||||
comboBoxShop.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка магазинов для поставок");
|
||||
}
|
||||
if (_jewelList != null)
|
||||
{
|
||||
comboBoxJewel.DisplayMember = "JewelName";
|
||||
comboBoxJewel.ValueMember = "Id";
|
||||
comboBoxJewel.DataSource = _jewelList;
|
||||
comboBoxJewel.SelectedItem = null;
|
||||
_logger.LogInformation("Загрузка изделий для поставок");
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxShop.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxJewel.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание поставки");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicS.MakeSupply(new SupplyBindingModel
|
||||
{
|
||||
ShopId = Convert.ToInt32(comboBoxShop.SelectedValue),
|
||||
JewelId = Convert.ToInt32(comboBoxJewel.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.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();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -41,7 +41,7 @@
|
||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
||||
this.buttonRefresh = new System.Windows.Forms.Button();
|
||||
this.исполнителиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.пополнениеМагазинаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@ -64,7 +64,7 @@
|
||||
this.СправочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.КомпонентыToolStripMenuItem,
|
||||
this.ИзделияToolStripMenuItem,
|
||||
this.исполнителиToolStripMenuItem});
|
||||
this.магазиныToolStripMenuItem});
|
||||
this.СправочникиToolStripMenuItem.Name = "СправочникиToolStripMenuItem";
|
||||
this.СправочникиToolStripMenuItem.Size = new System.Drawing.Size(139, 29);
|
||||
this.СправочникиToolStripMenuItem.Text = "Справочники";
|
||||
@ -123,16 +123,12 @@
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 36);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowHeadersWidth = 62;
|
||||
this.dataGridView.RowTemplate.Height = 33;
|
||||
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dataGridView.Size = new System.Drawing.Size(851, 402);
|
||||
this.dataGridView.TabIndex = 1;
|
||||
//
|
||||
@ -166,12 +162,12 @@
|
||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
||||
this.buttonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
||||
//
|
||||
// исполнителиToolStripMenuItem
|
||||
// пополнениеМагазинаToolStripMenuItem
|
||||
//
|
||||
this.исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
||||
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
|
||||
this.исполнителиToolStripMenuItem.Text = "Исполнители";
|
||||
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.ИсполнителиToolStripMenuItem_Click);
|
||||
this.пополнениеМагазинаToolStripMenuItem.Name = "пополнениеМагазинаToolStripMenuItem";
|
||||
this.пополнениеМагазинаToolStripMenuItem.Size = new System.Drawing.Size(210, 29);
|
||||
this.пополнениеМагазинаToolStripMenuItem.Text = "Пополнение магазина";
|
||||
this.пополнениеМагазинаToolStripMenuItem.Click += new System.EventHandler(this.ПополнениеМагазинаToolStripMenuItem_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
|
@ -2,8 +2,10 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreDataModels.Enums;
|
||||
using JewelryStoreView;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Windows.Forms;
|
||||
using PizzeriaView;
|
||||
|
||||
namespace JewelryStore
|
||||
{
|
||||
@ -102,6 +104,23 @@ namespace JewelryStore
|
||||
}
|
||||
}
|
||||
}
|
||||
private void shopsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStores));
|
||||
if (service is FormStores form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void transactionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateSupply));
|
||||
if (service is FormCreateSupply form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -162,61 +181,50 @@ namespace JewelryStore
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void BusyShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportShop));
|
||||
if (service is FormReportShop form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void СписокИзделийToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void ПополнениеМагазинаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveJewelsToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
private void КомпонентыПоИзделиямToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportJewelComponents));
|
||||
if (service is FormReportJewelComponents form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void СписокЗаказовToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||
if (service is FormReportOrders form)
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStoreReplenishment));
|
||||
|
||||
if (service is FormStoreReplenishment form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveJewelsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
private void InfoToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveShopsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
private void GroupOrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders));
|
||||
if (service is FormReportGroupedOrders form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||
if (service is FormClients form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ЗапускРаботToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void ИсполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||
|
||||
if (service is FormImplementers form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
86
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormReportGroupedOrders.Designer.cs
generated
Normal file
86
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormReportGroupedOrders.Designer.cs
generated
Normal file
@ -0,0 +1,86 @@
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormReportGroupedOrders
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel = new System.Windows.Forms.Panel();
|
||||
this.buttonToPDF = new System.Windows.Forms.Button();
|
||||
this.buttonMake = new System.Windows.Forms.Button();
|
||||
this.panel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
this.panel.Controls.Add(this.buttonToPDF);
|
||||
this.panel.Controls.Add(this.buttonMake);
|
||||
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel.Name = "panel";
|
||||
this.panel.Size = new System.Drawing.Size(970, 52);
|
||||
this.panel.TabIndex = 1;
|
||||
//
|
||||
// buttonToPDF
|
||||
//
|
||||
this.buttonToPDF.Location = new System.Drawing.Point(486, 12);
|
||||
this.buttonToPDF.Name = "buttonToPDF";
|
||||
this.buttonToPDF.Size = new System.Drawing.Size(411, 29);
|
||||
this.buttonToPDF.TabIndex = 5;
|
||||
this.buttonToPDF.Text = "В PDF";
|
||||
this.buttonToPDF.UseVisualStyleBackColor = true;
|
||||
this.buttonToPDF.Click += new System.EventHandler(this.buttonToPDF_Click);
|
||||
//
|
||||
// buttonMake
|
||||
//
|
||||
this.buttonMake.Location = new System.Drawing.Point(49, 12);
|
||||
this.buttonMake.Name = "buttonMake";
|
||||
this.buttonMake.Size = new System.Drawing.Size(377, 29);
|
||||
this.buttonMake.TabIndex = 4;
|
||||
this.buttonMake.Text = "Сформировать";
|
||||
this.buttonMake.UseVisualStyleBackColor = true;
|
||||
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
||||
//
|
||||
// FormReportGroupedOrders
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(970, 450);
|
||||
this.Controls.Add(this.panel);
|
||||
this.Name = "FormReportGroupedOrders";
|
||||
this.Text = "Отчёт по группированным заказам ";
|
||||
this.panel.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonToPDF;
|
||||
private Button buttonMake;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Reporting.WinForms;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormReportGroupedOrders : Form
|
||||
{
|
||||
private readonly ReportViewer reportViewer;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IReportLogic _logic;
|
||||
|
||||
public FormReportGroupedOrders(ILogger<FormReportGroupedOrders> logger, IReportLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
reportViewer = new ReportViewer
|
||||
{
|
||||
Dock = DockStyle.Fill
|
||||
};
|
||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportGroupedOrders.rdlc", FileMode.Open));
|
||||
Controls.Clear();
|
||||
Controls.Add(reportViewer);
|
||||
Controls.Add(panel);
|
||||
}
|
||||
|
||||
private void ButtonMake_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataSource = _logic.GetGroupedOrders();
|
||||
var source = new ReportDataSource("DataSetGroupedOrders", dataSource);
|
||||
reportViewer.LocalReport.DataSources.Clear();
|
||||
reportViewer.LocalReport.DataSources.Add(source);
|
||||
|
||||
reportViewer.RefreshReport();
|
||||
_logger.LogInformation("Загрузка списка группированных заказов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки списка группированных заказов на период");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buttonToPDF_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.SaveGroupedOrdersToPdfFile(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
115
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormReportShop.Designer.cs
generated
Normal file
115
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormReportShop.Designer.cs
generated
Normal file
@ -0,0 +1,115 @@
|
||||
namespace PizzeriaView
|
||||
{
|
||||
partial class FormReportShop
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.buttonSaveToExcel = new System.Windows.Forms.Button();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ColumnShop = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnJewel = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonSaveToExcel
|
||||
//
|
||||
this.buttonSaveToExcel.Location = new System.Drawing.Point(0, 6);
|
||||
this.buttonSaveToExcel.Name = "buttonSaveToExcel";
|
||||
this.buttonSaveToExcel.Size = new System.Drawing.Size(223, 29);
|
||||
this.buttonSaveToExcel.TabIndex = 3;
|
||||
this.buttonSaveToExcel.Text = "Сохранить в Excel";
|
||||
this.buttonSaveToExcel.UseVisualStyleBackColor = true;
|
||||
this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.AllowUserToOrderColumns = true;
|
||||
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ColumnShop,
|
||||
this.ColumnJewel,
|
||||
this.ColumnCount});
|
||||
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.dataGridView.Location = new System.Drawing.Point(0, 47);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.ReadOnly = true;
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(598, 403);
|
||||
this.dataGridView.TabIndex = 2;
|
||||
//
|
||||
// ColumnShop
|
||||
//
|
||||
this.ColumnShop.FillWeight = 130F;
|
||||
this.ColumnShop.HeaderText = "Магазин";
|
||||
this.ColumnShop.MinimumWidth = 6;
|
||||
this.ColumnShop.Name = "ColumnShop";
|
||||
this.ColumnShop.ReadOnly = true;
|
||||
|
||||
//
|
||||
this.ColumnJewel.FillWeight = 140F;
|
||||
this.ColumnJewel.HeaderText = "Украшения";
|
||||
this.ColumnJewel.MinimumWidth = 6;
|
||||
this.ColumnJewel.Name = "ColumnJewel";
|
||||
this.ColumnJewel.ReadOnly = true;
|
||||
//
|
||||
// ColumnCount
|
||||
//
|
||||
this.ColumnCount.FillWeight = 90F;
|
||||
this.ColumnCount.HeaderText = "Количество";
|
||||
this.ColumnCount.MinimumWidth = 6;
|
||||
this.ColumnCount.Name = "ColumnCount";
|
||||
this.ColumnCount.ReadOnly = true;
|
||||
//
|
||||
// FormReportShop
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(598, 450);
|
||||
this.Controls.Add(this.buttonSaveToExcel);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormReportShop";
|
||||
this.Text = "Наполненость магазинов";
|
||||
this.Load += new System.EventHandler(this.FormReportShop_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonSaveToExcel;
|
||||
private DataGridView dataGridView;
|
||||
private DataGridViewTextBoxColumn ColumnShop;
|
||||
private DataGridViewTextBoxColumn ColumnJewel;
|
||||
private DataGridViewTextBoxColumn ColumnCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PizzeriaView
|
||||
{
|
||||
public partial class FormReportShop : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IReportLogic _logic;
|
||||
|
||||
public FormReportShop(ILogger<FormReportShop> logger, IReportLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormReportShop_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dict = _logic.GetShops();
|
||||
if (dict != null)
|
||||
{
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
|
||||
foreach (var listElem in elem.Jewels)
|
||||
{
|
||||
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.SaveShopsToExcelFile(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormReportShop.resx
Normal file
120
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormReportShop.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
200
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStore.Designer.cs
generated
Normal file
200
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStore.Designer.cs
generated
Normal file
@ -0,0 +1,200 @@
|
||||
namespace JewelryStore
|
||||
{
|
||||
partial class FormStore
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.StoreNameLabel = new System.Windows.Forms.Label();
|
||||
this.StoreAdressLabel = new System.Windows.Forms.Label();
|
||||
this.OpeningDateLabel = new System.Windows.Forms.Label();
|
||||
this.NameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.AdressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.DataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.JewelName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.JewelPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.JewelCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.SaveButton = new System.Windows.Forms.Button();
|
||||
|
||||
this.OpeningDatePicker = new System.Windows.Forms.DateTimePicker();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpJewelMaxCount)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// StoreNameLabel
|
||||
//
|
||||
this.StoreNameLabel.AutoSize = true;
|
||||
this.StoreNameLabel.Location = new System.Drawing.Point(17, 13);
|
||||
this.StoreNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.StoreNameLabel.Name = "StoreNameLabel";
|
||||
this.StoreNameLabel.Size = new System.Drawing.Size(179, 25);
|
||||
this.StoreNameLabel.TabIndex = 0;
|
||||
this.StoreNameLabel.Text = "Название магазина: ";
|
||||
//
|
||||
// StoreAdressLabel
|
||||
//
|
||||
this.StoreAdressLabel.AutoSize = true;
|
||||
this.StoreAdressLabel.Location = new System.Drawing.Point(17, 54);
|
||||
this.StoreAdressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.StoreAdressLabel.Name = "StoreAdressLabel";
|
||||
this.StoreAdressLabel.Size = new System.Drawing.Size(151, 25);
|
||||
this.StoreAdressLabel.TabIndex = 1;
|
||||
this.StoreAdressLabel.Text = "Адрес магазина: ";
|
||||
//
|
||||
// OpeningDateLabel
|
||||
//
|
||||
this.OpeningDateLabel.AutoSize = true;
|
||||
this.OpeningDateLabel.Location = new System.Drawing.Point(17, 99);
|
||||
this.OpeningDateLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.OpeningDateLabel.Name = "OpeningDateLabel";
|
||||
this.OpeningDateLabel.Size = new System.Drawing.Size(140, 25);
|
||||
this.OpeningDateLabel.TabIndex = 2;
|
||||
this.OpeningDateLabel.Text = "Дата открытия: ";
|
||||
//
|
||||
// NameTextBox
|
||||
//
|
||||
this.NameTextBox.Location = new System.Drawing.Point(204, 10);
|
||||
this.NameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.NameTextBox.Name = "NameTextBox";
|
||||
this.NameTextBox.Size = new System.Drawing.Size(247, 31);
|
||||
this.NameTextBox.TabIndex = 3;
|
||||
//
|
||||
// AdressTextBox
|
||||
//
|
||||
this.AdressTextBox.Location = new System.Drawing.Point(204, 51);
|
||||
this.AdressTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.AdressTextBox.Name = "AdressTextBox";
|
||||
this.AdressTextBox.Size = new System.Drawing.Size(247, 31);
|
||||
this.AdressTextBox.TabIndex = 4;
|
||||
//
|
||||
// DataGridView
|
||||
//
|
||||
this.DataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.JewelName,
|
||||
this.JewelPrice,
|
||||
this.JewelCount});
|
||||
this.DataGridView.Location = new System.Drawing.Point(13, 135);
|
||||
this.DataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.DataGridView.Name = "DataGridView";
|
||||
this.DataGridView.RowHeadersWidth = 62;
|
||||
this.DataGridView.RowTemplate.Height = 25;
|
||||
this.DataGridView.Size = new System.Drawing.Size(802, 365);
|
||||
this.DataGridView.TabIndex = 6;
|
||||
//
|
||||
// JewelName
|
||||
//
|
||||
this.JewelName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.JewelName.HeaderText = "Название изделия";
|
||||
this.JewelName.MinimumWidth = 8;
|
||||
this.JewelName.Name = "JewelName";
|
||||
//
|
||||
// JewelPrice
|
||||
//
|
||||
this.JewelPrice.HeaderText = "Цена";
|
||||
this.JewelPrice.MinimumWidth = 8;
|
||||
this.JewelPrice.Name = "JewelPrice";
|
||||
this.JewelPrice.Width = 150;
|
||||
//
|
||||
// JewelCount
|
||||
//
|
||||
this.JewelCount.HeaderText = "Количество";
|
||||
this.JewelCount.MinimumWidth = 8;
|
||||
this.JewelCount.Name = "JewelCount";
|
||||
this.JewelCount.Width = 150;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
this.SaveButton.Location = new System.Drawing.Point(531, 510);
|
||||
this.SaveButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.SaveButton.Name = "SaveButton";
|
||||
this.SaveButton.Size = new System.Drawing.Size(138, 35);
|
||||
this.SaveButton.TabIndex = 7;
|
||||
this.SaveButton.Text = "Сохранить";
|
||||
this.SaveButton.UseVisualStyleBackColor = true;
|
||||
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
this.ButtonCancel.Location = new System.Drawing.Point(677, 510);
|
||||
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ButtonCancel.Name = "ButtonCancel";
|
||||
this.ButtonCancel.Size = new System.Drawing.Size(138, 35);
|
||||
this.ButtonCancel.TabIndex = 8;
|
||||
this.ButtonCancel.Text = "Отменить";
|
||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// OpeningDatePicker
|
||||
//
|
||||
this.OpeningDatePicker.Location = new System.Drawing.Point(204, 94);
|
||||
this.OpeningDatePicker.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.OpeningDatePicker.Name = "OpeningDatePicker";
|
||||
this.OpeningDatePicker.Size = new System.Drawing.Size(247, 31);
|
||||
this.OpeningDatePicker.TabIndex = 9;
|
||||
//
|
||||
// FormStore
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(867, 560);
|
||||
this.Controls.Add(this.OpeningDatePicker);
|
||||
this.Controls.Add(this.ButtonCancel);
|
||||
this.Controls.Add(this.SaveButton);
|
||||
this.Controls.Add(this.DataGridView);
|
||||
this.Controls.Add(this.AdressTextBox);
|
||||
this.Controls.Add(this.NameTextBox);
|
||||
this.Controls.Add(this.OpeningDateLabel);
|
||||
this.Controls.Add(this.StoreAdressLabel);
|
||||
this.Controls.Add(this.StoreNameLabel);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "FormStore";
|
||||
this.Text = "Изделия магазина";
|
||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label StoreNameLabel;
|
||||
private Label StoreAdressLabel;
|
||||
private Label OpeningDateLabel;
|
||||
private TextBox NameTextBox;
|
||||
private TextBox AdressTextBox;
|
||||
private DataGridView DataGridView;
|
||||
private Button SaveButton;
|
||||
private Button ButtonCancel;
|
||||
private DataGridViewTextBoxColumn JewelName;
|
||||
private DataGridViewTextBoxColumn JewelPrice;
|
||||
private DataGridViewTextBoxColumn JewelCount;
|
||||
private DateTimePicker OpeningDatePicker;
|
||||
private DateTimePicker dateTimeOpen;
|
||||
private NumericUpDown numericUpJewelMaxCount;
|
||||
}
|
||||
}
|
136
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStore.cs
Normal file
136
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStore.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JewelryStore
|
||||
{
|
||||
public partial class FormStore : Form
|
||||
{
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
private Dictionary<int, (IJewelModel, int)> _Jewels;
|
||||
private DateTime? _openingDate = null;
|
||||
private readonly IStoreLogic _logic;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public FormStore(ILogger<FormStore> logger, IStoreLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_Jewels = new Dictionary<int, (IJewelModel, int)>();
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormShop_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_id.HasValue)
|
||||
{
|
||||
_logger.LogInformation("Загрузка магазина");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new StoreSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
NameTextBox.Text = view.StoreName;
|
||||
AdressTextBox.Text = view.StoreAdress;
|
||||
dateTimeOpen.Value = view.OpeningDate;
|
||||
numericUpJewelMaxCount.Value = view.JewelMaxCount;
|
||||
_Jewels = view.Jewels ?? new Dictionary<int, (IJewelModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
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(NameTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(AdressTextBox.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение магазина");
|
||||
try
|
||||
{
|
||||
var model = new StoreBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
StoreName = NameTextBox.Text,
|
||||
StoreAdress = AdressTextBox.Text,
|
||||
OpeningDate = dateTimeOpen.Value,
|
||||
JewelMaxCount = (int)numericUpJewelMaxCount.Value
|
||||
};
|
||||
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 void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка изделий в магазине");
|
||||
try
|
||||
{
|
||||
if (_Jewels != null)
|
||||
{
|
||||
DataGridView.Rows.Clear();
|
||||
foreach (var sr in _Jewels)
|
||||
{
|
||||
DataGridView.Rows.Add(new object[] { sr.Key, sr.Value.Item1.JewelName, sr.Value.Item2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки изделий магазина");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
60
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStore.resx
Normal file
60
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStore.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
151
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStoreReplenishment.Designer.cs
generated
Normal file
151
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStoreReplenishment.Designer.cs
generated
Normal file
@ -0,0 +1,151 @@
|
||||
namespace JewelryStore
|
||||
{
|
||||
partial class FormStoreReplenishment
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.StoreNameLabel = new System.Windows.Forms.Label();
|
||||
this.JewelNameLabel = new System.Windows.Forms.Label();
|
||||
this.CountLabel = new System.Windows.Forms.Label();
|
||||
this.StoreNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.JewelNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.CountTextBox = new System.Windows.Forms.TextBox();
|
||||
this.SaveButton = new System.Windows.Forms.Button();
|
||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// StoreNameLabel
|
||||
//
|
||||
this.StoreNameLabel.AutoSize = true;
|
||||
this.StoreNameLabel.Location = new System.Drawing.Point(9, 9);
|
||||
this.StoreNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.StoreNameLabel.Name = "StoreNameLabel";
|
||||
this.StoreNameLabel.Size = new System.Drawing.Size(179, 25);
|
||||
this.StoreNameLabel.TabIndex = 0;
|
||||
this.StoreNameLabel.Text = "Название магазина: ";
|
||||
//
|
||||
// JewelNameLabel
|
||||
//
|
||||
this.JewelNameLabel.AutoSize = true;
|
||||
this.JewelNameLabel.Location = new System.Drawing.Point(9, 58);
|
||||
this.JewelNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.JewelNameLabel.Name = "JewelNameLabel";
|
||||
this.JewelNameLabel.Size = new System.Drawing.Size(169, 25);
|
||||
this.JewelNameLabel.TabIndex = 1;
|
||||
this.JewelNameLabel.Text = "Название изделия: ";
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
this.CountLabel.AutoSize = true;
|
||||
this.CountLabel.Location = new System.Drawing.Point(9, 107);
|
||||
this.CountLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.CountLabel.Name = "CountLabel";
|
||||
this.CountLabel.Size = new System.Drawing.Size(116, 25);
|
||||
this.CountLabel.TabIndex = 2;
|
||||
this.CountLabel.Text = "Количество: ";
|
||||
//
|
||||
// StoreNameComboBox
|
||||
//
|
||||
this.StoreNameComboBox.FormattingEnabled = true;
|
||||
this.StoreNameComboBox.Location = new System.Drawing.Point(196, 6);
|
||||
this.StoreNameComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.StoreNameComboBox.Name = "StoreNameComboBox";
|
||||
this.StoreNameComboBox.Size = new System.Drawing.Size(272, 33);
|
||||
this.StoreNameComboBox.TabIndex = 3;
|
||||
//
|
||||
// JewelNameComboBox
|
||||
//
|
||||
this.JewelNameComboBox.FormattingEnabled = true;
|
||||
this.JewelNameComboBox.Location = new System.Drawing.Point(196, 55);
|
||||
this.JewelNameComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.JewelNameComboBox.Name = "JewelNameComboBox";
|
||||
this.JewelNameComboBox.Size = new System.Drawing.Size(272, 33);
|
||||
this.JewelNameComboBox.TabIndex = 4;
|
||||
//
|
||||
// CountTextBox
|
||||
//
|
||||
this.CountTextBox.Location = new System.Drawing.Point(196, 104);
|
||||
this.CountTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.CountTextBox.Name = "CountTextBox";
|
||||
this.CountTextBox.Size = new System.Drawing.Size(272, 31);
|
||||
this.CountTextBox.TabIndex = 5;
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
this.SaveButton.Location = new System.Drawing.Point(234, 145);
|
||||
this.SaveButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.SaveButton.Name = "SaveButton";
|
||||
this.SaveButton.Size = new System.Drawing.Size(107, 38);
|
||||
this.SaveButton.TabIndex = 6;
|
||||
this.SaveButton.Text = "Сохранить";
|
||||
this.SaveButton.UseVisualStyleBackColor = true;
|
||||
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
this.ButtonCancel.Location = new System.Drawing.Point(361, 145);
|
||||
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ButtonCancel.Name = "ButtonCancel";
|
||||
this.ButtonCancel.Size = new System.Drawing.Size(107, 38);
|
||||
this.ButtonCancel.TabIndex = 7;
|
||||
this.ButtonCancel.Text = "Отмена";
|
||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormStoreReplenishment
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(481, 200);
|
||||
this.Controls.Add(this.ButtonCancel);
|
||||
this.Controls.Add(this.SaveButton);
|
||||
this.Controls.Add(this.CountTextBox);
|
||||
this.Controls.Add(this.JewelNameComboBox);
|
||||
this.Controls.Add(this.StoreNameComboBox);
|
||||
this.Controls.Add(this.CountLabel);
|
||||
this.Controls.Add(this.JewelNameLabel);
|
||||
this.Controls.Add(this.StoreNameLabel);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "FormStoreReplenishment";
|
||||
this.Text = "Пополнение магазина";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label StoreNameLabel;
|
||||
private Label JewelNameLabel;
|
||||
private Label CountLabel;
|
||||
private ComboBox StoreNameComboBox;
|
||||
private ComboBox JewelNameComboBox;
|
||||
private TextBox CountTextBox;
|
||||
private Button SaveButton;
|
||||
private Button ButtonCancel;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JewelryStore
|
||||
{
|
||||
public partial class FormStoreReplenishment : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStoreLogic _storeLogic;
|
||||
private readonly IJewelLogic _jewelLogic;
|
||||
private readonly List<StoreViewModel>? _listStores;
|
||||
private readonly List<JewelViewModel>? _listJewels;
|
||||
public FormStoreReplenishment(ILogger<FormStoreReplenishment> logger, IStoreLogic storeLogic, IJewelLogic jewelLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_storeLogic = storeLogic;
|
||||
_jewelLogic = jewelLogic;
|
||||
_logger = logger;
|
||||
_listStores = storeLogic.ReadList(null);
|
||||
if (_listStores != null)
|
||||
{
|
||||
StoreNameComboBox.DisplayMember = "StoreName";
|
||||
StoreNameComboBox.ValueMember = "Id";
|
||||
StoreNameComboBox.DataSource = _listStores;
|
||||
StoreNameComboBox.SelectedItem = null;
|
||||
}
|
||||
|
||||
_listJewels = jewelLogic.ReadList(null);
|
||||
if (_listJewels != null)
|
||||
{
|
||||
JewelNameComboBox.DisplayMember = "JewelName";
|
||||
JewelNameComboBox.ValueMember = "Id";
|
||||
JewelNameComboBox.DataSource = _listJewels;
|
||||
JewelNameComboBox.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (JewelNameComboBox.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание покупки");
|
||||
try
|
||||
{
|
||||
bool resout = _storeLogic.Sale(new SupplySearchModel
|
||||
{
|
||||
JewelId = Convert.ToInt32(JewelNameComboBox.SelectedValue),
|
||||
Count = Convert.ToInt32(CountTextBox.Text)
|
||||
});
|
||||
if (resout)
|
||||
{
|
||||
_logger.LogInformation("Проверка пройдена, продажа проведена");
|
||||
MessageBox.Show("Продажа проведена", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("Проверка не пройдена");
|
||||
MessageBox.Show("Продажа не может быть создана.", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
122
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStores.Designer.cs
generated
Normal file
122
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStores.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
||||
namespace JewelryStore
|
||||
{
|
||||
partial class FormStores
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.DataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.AddButton = new System.Windows.Forms.Button();
|
||||
this.ChangeButton = new System.Windows.Forms.Button();
|
||||
this.DeleteButton = new System.Windows.Forms.Button();
|
||||
this.UpdateButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// DataGridView
|
||||
//
|
||||
this.DataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.DataGridView.Location = new System.Drawing.Point(1, 2);
|
||||
this.DataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.DataGridView.Name = "DataGridView";
|
||||
this.DataGridView.RowHeadersWidth = 62;
|
||||
this.DataGridView.RowTemplate.Height = 25;
|
||||
this.DataGridView.Size = new System.Drawing.Size(768, 452);
|
||||
this.DataGridView.TabIndex = 0;
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.Location = new System.Drawing.Point(807, 52);
|
||||
this.AddButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(151, 38);
|
||||
this.AddButton.TabIndex = 1;
|
||||
this.AddButton.Text = "Добавить";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
//
|
||||
// ChangeButton
|
||||
//
|
||||
this.ChangeButton.Location = new System.Drawing.Point(807, 129);
|
||||
this.ChangeButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ChangeButton.Name = "ChangeButton";
|
||||
this.ChangeButton.Size = new System.Drawing.Size(151, 38);
|
||||
this.ChangeButton.TabIndex = 2;
|
||||
this.ChangeButton.Text = "Изменить";
|
||||
this.ChangeButton.UseVisualStyleBackColor = true;
|
||||
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
||||
//
|
||||
// DeleteButton
|
||||
//
|
||||
this.DeleteButton.Location = new System.Drawing.Point(807, 203);
|
||||
this.DeleteButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.DeleteButton.Name = "DeleteButton";
|
||||
this.DeleteButton.Size = new System.Drawing.Size(151, 38);
|
||||
this.DeleteButton.TabIndex = 3;
|
||||
this.DeleteButton.Text = "Удалить";
|
||||
this.DeleteButton.UseVisualStyleBackColor = true;
|
||||
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
||||
//
|
||||
// UpdateButton
|
||||
//
|
||||
this.UpdateButton.Location = new System.Drawing.Point(807, 277);
|
||||
this.UpdateButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.UpdateButton.Name = "UpdateButton";
|
||||
this.UpdateButton.Size = new System.Drawing.Size(151, 35);
|
||||
this.UpdateButton.TabIndex = 4;
|
||||
this.UpdateButton.Text = "Обновить";
|
||||
this.UpdateButton.UseVisualStyleBackColor = true;
|
||||
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
||||
//
|
||||
// FormStores
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(988, 457);
|
||||
this.Controls.Add(this.UpdateButton);
|
||||
this.Controls.Add(this.DeleteButton);
|
||||
this.Controls.Add(this.ChangeButton);
|
||||
this.Controls.Add(this.AddButton);
|
||||
this.Controls.Add(this.DataGridView);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "FormStores";
|
||||
this.Text = "Магазины";
|
||||
this.Load += new System.EventHandler(this.FormStores_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView DataGridView;
|
||||
private Button AddButton;
|
||||
private Button ChangeButton;
|
||||
private Button DeleteButton;
|
||||
private Button UpdateButton;
|
||||
}
|
||||
}
|
122
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStores.cs
Normal file
122
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStores.cs
Normal file
@ -0,0 +1,122 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JewelryStore
|
||||
{
|
||||
public partial class FormStores : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStoreLogic _logic;
|
||||
public FormStores(ILogger<FormStores> logger, IStoreLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
private void FormStores_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["StoreName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
DataGridView.Columns["Jewels"].Visible = false;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Загрузка магазинов");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateButton_Click(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 StoreBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStore));
|
||||
|
||||
if (service is FormStore form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStore));
|
||||
|
||||
if (service is FormStore form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStores.resx
Normal file
60
PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormStores.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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,13 +1,14 @@
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreContracts.StoragesContracts;
|
||||
using JewelryStoreDatabaseImplement.Implements;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
using JewelryStoreBusinessLogic.BusinessLogics;
|
||||
using JewelryStoreContracts.StoragesModels;
|
||||
using JewelryStoreListImplement.Implements;
|
||||
using JewelryStoreBusinessLogic.OfficePackage.Implements;
|
||||
using JewelryStoreBusinessLogic.OfficePackage;
|
||||
using JewelryStoreContracts.StoragesModels;
|
||||
using PizzeriaView;
|
||||
|
||||
namespace JewelryStore
|
||||
{
|
||||
@ -15,9 +16,7 @@ namespace JewelryStore
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
@ -38,31 +37,30 @@ namespace JewelryStore
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IJewelStorage, JewelStorage>();
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IStoreStorage, StoreStorage>();
|
||||
services.AddTransient<IStoreStorage, StoreStorage>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IJewelLogic, JewelLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||
|
||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
services.AddTransient<IStoreLogic, StoreLogic>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormComponent>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
services.AddTransient<FormComponent>();
|
||||
services.AddTransient<FormComponents>();
|
||||
services.AddTransient<FormCreateOrder>();
|
||||
services.AddTransient<FormJewel>();
|
||||
services.AddTransient<FormJewelComponent>();
|
||||
services.AddTransient<FormJewels>();
|
||||
services.AddTransient<FormReportJewelComponents>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormClients>();
|
||||
services.AddTransient<FormImplementer>();
|
||||
services.AddTransient<FormImplementers>();
|
||||
services.AddTransient<FormStores>();
|
||||
services.AddTransient<FormStore>();
|
||||
services.AddTransient<FormReportJewelComponents>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormReportShop>();
|
||||
services.AddTransient<FormReportGroupedOrders>();
|
||||
services.AddTransient<FormStoreReplenishment>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,441 @@
|
||||
<?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="PrecastConcretePlantContractsViewModels">
|
||||
<ConnectionProperties>
|
||||
<DataProvider>System.Data.DataSet</DataProvider>
|
||||
<ConnectString>/* Local Connection */</ConnectString>
|
||||
</ConnectionProperties>
|
||||
<rd:DataSourceID>20791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
||||
</DataSource>
|
||||
</DataSources>
|
||||
<DataSets>
|
||||
<DataSet Name="DataSetGroupedOrders">
|
||||
<Query>
|
||||
<DataSourceName>PrecastConcretePlantContractsViewModels</DataSourceName>
|
||||
<CommandText>/* Local Query */</CommandText>
|
||||
</Query>
|
||||
<Fields>
|
||||
<Field Name="Date">
|
||||
<DataField>Date</DataField>
|
||||
<rd:TypeName>System.DateTime</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="OrdersCount">
|
||||
<DataField>OrdersCount</DataField>
|
||||
<rd:TypeName>System.Int32</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="OrdersSum">
|
||||
<DataField>OrdersSum</DataField>
|
||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
||||
</Field>
|
||||
</Fields>
|
||||
<rd:DataSetInfo>
|
||||
<rd:DataSetName>PrecastConcretePlantContracts.ViewModels</rd:DataSetName>
|
||||
<rd:TableName>ReportGroupOrdersViewModel</rd:TableName>
|
||||
<rd:ObjectDataSourceType>PrecastConcretePlantContracts.ViewModels.ReportGroupOrdersViewModel, PrecastConcretePlantContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
||||
</rd:DataSetInfo>
|
||||
</DataSet>
|
||||
</DataSets>
|
||||
<ReportSections>
|
||||
<ReportSection>
|
||||
<Body>
|
||||
<ReportItems>
|
||||
<Textbox Name="TextboxTitle">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Отчёт по заказам</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Center</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<Height>0.6cm</Height>
|
||||
<Width>16.51cm</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="ReportParameterPeriod">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
||||
<Style>
|
||||
<Format>d</Format>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Center</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
||||
<Top>0.6cm</Top>
|
||||
<Height>0.6cm</Height>
|
||||
<Width>16.51cm</Width>
|
||||
<ZIndex>1</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<Tablix Name="Tablix1">
|
||||
<TablixBody>
|
||||
<TablixColumns>
|
||||
<TablixColumn>
|
||||
<Width>3.90406cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>3.97461cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>3.65711cm</Width>
|
||||
</TablixColumn>
|
||||
</TablixColumns>
|
||||
<TablixRows>
|
||||
<TablixRow>
|
||||
<Height>0.6cm</Height>
|
||||
<TablixCells>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="TextboxDate">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Дата создания</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<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="TextboxCount">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Количество заказов</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<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="TextboxSum">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Общая сумма заказов</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<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="Date">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!Date.Value</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Date</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="OrdersCount">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!OrdersCount.Value</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>OrdersCount</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="OrdersSum">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!OrdersSum.Value</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>OrdersSum</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 />
|
||||
</TablixMembers>
|
||||
</TablixColumnHierarchy>
|
||||
<TablixRowHierarchy>
|
||||
<TablixMembers>
|
||||
<TablixMember>
|
||||
<KeepWithGroup>After</KeepWithGroup>
|
||||
</TablixMember>
|
||||
<TablixMember>
|
||||
<Group Name="Подробности" />
|
||||
</TablixMember>
|
||||
</TablixMembers>
|
||||
</TablixRowHierarchy>
|
||||
<DataSetName>DataSetGroupedOrders</DataSetName>
|
||||
<Top>1.88242cm</Top>
|
||||
<Left>2.68676cm</Left>
|
||||
<Height>1.2cm</Height>
|
||||
<Width>11.53578cm</Width>
|
||||
<ZIndex>2</ZIndex>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
</Style>
|
||||
</Tablix>
|
||||
<Textbox Name="TextboxResout">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Итого:</Value>
|
||||
<Style />
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Right</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<Top>3.29409cm</Top>
|
||||
<Left>8.06542cm</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="TextboxFullSum">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Sum(Fields!OrdersSum.Value, "DataSetGroupedOrders")</Value>
|
||||
<Style>
|
||||
<Format>0.00;(0.00)</Format>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Right</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<Top>3.29409cm</Top>
|
||||
<Left>10.70653cm</Left>
|
||||
<Height>0.6cm</Height>
|
||||
<Width>3.48072cm</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>2in</Height>
|
||||
<Style />
|
||||
</Body>
|
||||
<Width>6.5in</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>4</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>b5a8ad5e-1151-4687-8576-a5270295c079</rd:ReportID>
|
||||
</Report>
|
@ -2,6 +2,7 @@
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.StoragesContracts;
|
||||
using JewelryStoreContracts.StoragesModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreDataModels.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -12,12 +13,14 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
private readonly IStoreStorage _shopStorage;
|
||||
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IStoreStorage shopStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_orderStorage = orderStorage;
|
||||
}
|
||||
_shopStorage = shopStorage;
|
||||
}
|
||||
|
||||
public bool CreateOrder(OrderBindingModel model)
|
||||
{
|
||||
@ -34,19 +37,28 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
|
||||
public bool StatusUpdate(OrderBindingModel model, OrderStatus newStatus)
|
||||
{
|
||||
var vmodel = _orderStorage.GetElement(new() { Id = model.Id });
|
||||
if (vmodel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
var order = _orderStorage.GetElement(new OrderSearchModel
|
||||
{
|
||||
Id = model.Id,
|
||||
});
|
||||
if (order == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(order));
|
||||
}
|
||||
if (!_shopStorage.RestockingShops(new SupplyBindingModel
|
||||
{
|
||||
JewelId = order.JewelId,
|
||||
Count = order.Count
|
||||
}))
|
||||
{
|
||||
throw new ArgumentException("Недостаточно места");
|
||||
}
|
||||
|
||||
if ((int)vmodel.Status + 1 != (int)newStatus)
|
||||
{
|
||||
throw new InvalidOperationException($"Попытка перевести заказ не в следующий статус: " +
|
||||
$"Текущий статус: {vmodel.Status} \n" +
|
||||
$"Планируемый статус: {newStatus} \n" +
|
||||
$"Доступный статус: {(OrderStatus)((int)vmodel.Status + 1)}");
|
||||
}
|
||||
model.Status = OrderStatus.Выдан;
|
||||
model.DateImplement = DateTime.Now;
|
||||
_orderStorage.Update(model);
|
||||
return true;
|
||||
}
|
||||
|
||||
model.Status = newStatus;
|
||||
model.DateCreate = vmodel.DateCreate;
|
||||
|
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JewelryStoreContracts.StoragesModels;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
{
|
||||
@ -18,23 +19,22 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
private readonly IComponentStorage _componentStorage;
|
||||
private readonly IJewelStorage _jewelStorage;
|
||||
private readonly IOrderStorage _orderStorage;
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
private readonly IStoreStorage _shopStorage;
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
public ReportLogic(IJewelStorage jewelStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
IStoreStorage shopStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_jewelStorage = jewelStorage;
|
||||
_componentStorage = componentStorage;
|
||||
_orderStorage = orderStorage;
|
||||
_shopStorage = shopStorage;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public List<ReportJewelComponentViewModel> GetJewelComponent()
|
||||
{
|
||||
return _jewelStorage.GetFullList().Select(x => new ReportJewelComponentViewModel
|
||||
@ -44,11 +44,7 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
TotalCount = x.JewelComponents.Select(x => x.Value.Item2).Sum()
|
||||
}).ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение списка заказов за определенный период
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
||||
{
|
||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
||||
@ -65,10 +61,7 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение компонент в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
|
||||
public void SaveJewelsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
@ -78,23 +71,17 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
Jewels = _jewelStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
|
||||
public void SaveJewelComponentToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список компонент",
|
||||
Title = "Список компонентов",
|
||||
JewelComponents = GetJewelComponent()
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение заказов в файл-Pdf
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
|
||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToPdf.CreateDoc(new PdfInfo
|
||||
@ -106,5 +93,54 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
Orders = GetOrders(model)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<ReportShopsViewModel> GetShops()
|
||||
{
|
||||
return _shopStorage.GetFullList().Select(x => new ReportShopsViewModel
|
||||
{
|
||||
ShopName = x.StoreName,
|
||||
Jewels = x.Jewels.Select(x => (x.Value.Item1.JewelName, x.Value.Item2)).ToList(),
|
||||
TotalCount = x.Jewels.Select(x => x.Value.Item2).Sum()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<ReportGroupOrdersViewModel> GetGroupedOrders()
|
||||
{
|
||||
return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportGroupOrdersViewModel
|
||||
{
|
||||
Date = x.Key,
|
||||
OrdersCount = x.Count(),
|
||||
OrdersSum = x.Select(y => y.Sum).Sum()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public void SaveShopsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToWord.CreateShopsDoc(new WordShopInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список магазинов",
|
||||
Shops = _shopStorage.GetFullList()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveShopsToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateShopJewelsReport(new ExcelShop
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Наполненость магазинов",
|
||||
ShopJewels = GetShops()
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveGroupedOrdersToPdfFile(ReportBindingModel model)
|
||||
{
|
||||
_saveToPdf.CreateGroupedOrdersDoc(new PdfGroupedOrdersInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список заказов сгруппированных по дате заказов",
|
||||
GroupedOrders = GetGroupedOrders()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,187 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.StoragesContracts;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JewelryStoreContracts.StoragesModels;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class StoreLogic : IStoreLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStoreStorage _shopStorage;
|
||||
private readonly IJewelStorage _JewelStorage;
|
||||
|
||||
public StoreLogic(ILogger<StoreLogic> logger, IStoreStorage shopStorage, IJewelStorage JewelStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_shopStorage = shopStorage;
|
||||
_JewelStorage = JewelStorage;
|
||||
}
|
||||
|
||||
public List<StoreViewModel>? ReadList(StoreSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. ShopName:{ShopName}.Id:{ Id}", model?.StoreName, model?.Id);
|
||||
var list = model == null ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public StoreViewModel? ReadElement(StoreSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. ShopName:{ShopName}.Id:{ Id}", model.StoreName, model.Id);
|
||||
var element = _shopStorage.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(StoreBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_shopStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Update(StoreBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_shopStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Delete(StoreBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_shopStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MakeSupply(SupplyBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (model.Count <= 0)
|
||||
{
|
||||
throw new ArgumentException("Количество изделий должно быть больше 0");
|
||||
}
|
||||
var shop = _shopStorage.GetElement(new StoreSearchModel
|
||||
{
|
||||
Id = model.ShopId
|
||||
});
|
||||
if (shop == null)
|
||||
{
|
||||
throw new ArgumentException("Магазина не существует");
|
||||
}
|
||||
if (shop.Jewels.ContainsKey(model.JewelId))
|
||||
{
|
||||
var oldValue = shop.Jewels[model.JewelId];
|
||||
oldValue.Item2 += model.Count;
|
||||
shop.Jewels[model.JewelId] = oldValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var Jewel = _JewelStorage.GetElement(new JewelSearchModel
|
||||
{
|
||||
Id = model.JewelId
|
||||
});
|
||||
if (Jewel == null)
|
||||
{
|
||||
throw new ArgumentException($"Поставка: Товар с id:{model.JewelId} не найден");
|
||||
}
|
||||
shop.Jewels.Add(model.JewelId, (Jewel, model.Count));
|
||||
}
|
||||
_shopStorage.Update(new StoreBindingModel()
|
||||
{
|
||||
Id = shop.Id,
|
||||
StoreName = shop.StoreName,
|
||||
StoreAdress = shop.StoreAdress,
|
||||
OpeningDate = shop.OpeningDate,
|
||||
Jewels = shop.Jewels,
|
||||
JewelMaxCount = shop.JewelMaxCount,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(StoreBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.StoreAdress))
|
||||
{
|
||||
throw new ArgumentException("Адрес магазина длжен быть заполнен", nameof(model.StoreAdress));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.StoreName))
|
||||
{
|
||||
throw new ArgumentException("Название магазина должно быть заполнено", nameof(model.StoreName));
|
||||
}
|
||||
_logger.LogInformation("Shop. ShopName:{ShopName}.Adres:{Adres}.OpeningDate:{OpeningDate}.Id:{ Id}", model.StoreName, model.StoreAdress, model.OpeningDate, model.Id);
|
||||
var element = _shopStorage.GetElement(new StoreSearchModel
|
||||
{
|
||||
StoreName = model.StoreName
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
|
||||
public bool Sale(SupplySearchModel model)
|
||||
{
|
||||
if (!model.JewelId.HasValue || !model.Count.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_logger.LogInformation("Check Jewel count in all shops");
|
||||
if (_shopStorage.Sale(model))
|
||||
{
|
||||
_logger.LogInformation("Selling sucsess");
|
||||
return true;
|
||||
}
|
||||
_logger.LogInformation("Selling failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,87 +17,149 @@ namespace JewelryStoreBusinessLogic.OfficePackage
|
||||
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 pc in info.JewelComponents)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.JewelName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var (Component, Count) in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = Component,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = Count.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Итого",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.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);
|
||||
}
|
||||
|
||||
}
|
||||
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 pc in info.JewelComponents)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.JewelName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
|
||||
foreach (var (Component, Count) in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = Component,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = Count.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Итого",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.TotalCount.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
public void CreateShopJewelsReport(ExcelShop 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 sr in info.ShopJewels)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = sr.ShopName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
|
||||
foreach (var (Jewel, Count) in sr.Jewels)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = Jewel,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = Count.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Итого",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = sr.TotalCount.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateExcel(IDocument info);
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||
protected abstract void SaveExcel(IDocument info);
|
||||
}
|
||||
}
|
@ -12,69 +12,66 @@ namespace JewelryStoreBusinessLogic.OfficePackage
|
||||
{
|
||||
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", "4cm", "3cm" });
|
||||
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.JewelName, order.Status.ToString(), order.Sum.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
CreateParagraph(new PdfParagraph
|
||||
{
|
||||
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\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);
|
||||
}
|
||||
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", "3cm" });
|
||||
|
||||
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.PizzaName, order.Status.ToString(), order.Sum.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth });
|
||||
|
||||
SavePdf(info);
|
||||
}
|
||||
|
||||
public void CreateGroupedOrdersDoc(PdfGroupedOrdersInfo info)
|
||||
{
|
||||
CreatePdf(info);
|
||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
|
||||
CreateTable(new List<string> { "4cm", "3cm", "2cm" });
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Дата заказа", "Кол-во", "Сумма" },
|
||||
Style = "NormalTitle",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
|
||||
|
||||
foreach (var groupedOrder in info.GroupedOrders)
|
||||
{
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { groupedOrder.Date.ToShortDateString(), groupedOrder.OrdersCount.ToString(), groupedOrder.OrdersSum.ToString() },
|
||||
Style = "Normal",
|
||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||
});
|
||||
}
|
||||
|
||||
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.GroupedOrders.Sum(x => x.OrdersSum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||
|
||||
SavePdf(info);
|
||||
}
|
||||
|
||||
protected abstract void CreatePdf(IDocument info);
|
||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||
protected abstract void CreateTable(List<string> columns);
|
||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||
protected abstract void SavePdf(IDocument info);
|
||||
}
|
||||
}
|
||||
|
@ -12,48 +12,82 @@ namespace JewelryStoreBusinessLogic.OfficePackage
|
||||
{
|
||||
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 jewel in info.Jewels)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(jewel.JewelName, new WordTextProperties { Size = "24", Bold = true}), ("\t"+jewel.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);
|
||||
}
|
||||
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 jewel in info.Jewels)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
(jewel.JewelName, new WordTextProperties { Size = "24", Bold = true}),
|
||||
("\t"+jewel.Price.ToString(), new WordTextProperties{Size = "24"})
|
||||
},
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
public void CreateShopsDoc(WordShopInfo 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
|
||||
}
|
||||
});
|
||||
|
||||
CreateTable(new List<string> { "3000", "3000", "3000" });
|
||||
CreateRow(new WordRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Название", "Адрес", "Дата открытия" },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
Bold = true,
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var shop in info.Shops)
|
||||
{
|
||||
CreateRow(new WordRowParameters
|
||||
{
|
||||
Texts = new List<string> { shop.ShopName, shop.Adress, shop.OpeningDate.ToString() },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "22",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
protected abstract void CreateWord(IDocument info);
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
protected abstract void SaveWord(IDocument info);
|
||||
protected abstract void CreateTable(List<string> colums);
|
||||
protected abstract void CreateRow(WordRowParameters rowParameters);
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelInfo
|
||||
{
|
||||
public class ExcelInfo : IDocument
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportJewelComponentViewModel> JewelComponents
|
||||
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class ExcelShop : IDocument
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportShopsViewModel> ShopJewels { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfGroupedOrdersInfo
|
||||
{
|
||||
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<ReportGroupOrdersViewModel> GroupedOrders { get; set; } = new();
|
||||
}
|
||||
}
|
@ -7,8 +7,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class PdfInfo
|
||||
{
|
||||
public class PdfInfo : IDocument
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public DateTime DateFrom { get; set; }
|
||||
|
@ -7,8 +7,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordInfo
|
||||
{
|
||||
public class WordInfo : IDocument
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<JewelViewModel> Jewels { get; set; } = new();
|
||||
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordRowParameters
|
||||
{
|
||||
public List<string> Texts { get; set; } = new();
|
||||
public WordTextProperties TextProperties { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordShopInfo : IDocument
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<StoreViewModel> Shops { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreBusinessLogic.OfficePackage
|
||||
{
|
||||
public interface IDocument
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public string Title { get; set; }
|
||||
}
|
||||
}
|
@ -19,10 +19,7 @@ namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
||||
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>();
|
||||
@ -198,7 +195,7 @@ namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
||||
_ => 0U,
|
||||
};
|
||||
}
|
||||
protected override void CreateExcel(ExcelInfo info)
|
||||
protected override void CreateExcel(IDocument info)
|
||||
{
|
||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
||||
SpreadsheetDocumentType.Workbook);
|
||||
@ -330,7 +327,7 @@ namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
||||
};
|
||||
mergeCells.Append(mergeCell);
|
||||
}
|
||||
protected override void SaveExcel(ExcelInfo info)
|
||||
protected override void SaveExcel(IDocument info)
|
||||
{
|
||||
if (_spreadsheetDocument == null)
|
||||
{
|
||||
|
@ -16,90 +16,97 @@ namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
||||
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);
|
||||
}
|
||||
}
|
||||
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
||||
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
||||
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
||||
_ => ParagraphAlignment.Justify,
|
||||
};
|
||||
}
|
||||
|
||||
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(IDocument 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(IDocument info)
|
||||
{
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(info.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,115 +15,183 @@ namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
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.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
WordJustificationType.Both => JustificationValues.Both,
|
||||
WordJustificationType.Center => JustificationValues.Center,
|
||||
_ => JustificationValues.Left,
|
||||
};
|
||||
}
|
||||
|
||||
private static SectionProperties CreateSectionProperties()
|
||||
{
|
||||
var properties = new SectionProperties();
|
||||
|
||||
var pageSize = new PageSize
|
||||
{
|
||||
Orient = PageOrientationValues.Portrait
|
||||
};
|
||||
|
||||
properties.AppendChild(pageSize);
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
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(IDocument 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(IDocument info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
|
||||
_wordDocument.Close();
|
||||
}
|
||||
|
||||
private Table? _lastTable;
|
||||
protected override void CreateTable(List<string> columns)
|
||||
{
|
||||
if (_docBody == null)
|
||||
return;
|
||||
|
||||
_lastTable = new Table();
|
||||
|
||||
var tableProp = new TableProperties();
|
||||
tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
|
||||
tableProp.AppendChild(new TableBorders(
|
||||
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
|
||||
));
|
||||
tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
|
||||
_lastTable.AppendChild(tableProp);
|
||||
|
||||
TableGrid tableGrid = new TableGrid();
|
||||
foreach (var column in columns)
|
||||
{
|
||||
tableGrid.AppendChild(new GridColumn() { Width = column });
|
||||
}
|
||||
_lastTable.AppendChild(tableGrid);
|
||||
|
||||
_docBody.AppendChild(_lastTable);
|
||||
}
|
||||
|
||||
protected override void CreateRow(WordRowParameters rowParameters)
|
||||
{
|
||||
if (_docBody == null || _lastTable == null)
|
||||
return;
|
||||
|
||||
TableRow docRow = new TableRow();
|
||||
foreach (var column in rowParameters.Texts)
|
||||
{
|
||||
var docParagraph = new Paragraph();
|
||||
WordParagraph paragraph = new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (column, rowParameters.TextProperties) },
|
||||
TextProperties = rowParameters.TextProperties
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
TableCell docCell = new TableCell();
|
||||
docCell.AppendChild(docParagraph);
|
||||
docRow.AppendChild(docCell);
|
||||
}
|
||||
_lastTable.AppendChild(docRow);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using JewelryStoreDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.BindingModels
|
||||
{
|
||||
public class StoreBindingModel : IStoreModel
|
||||
{
|
||||
public string StoreName { get; set; } = string.Empty;
|
||||
|
||||
public string StoreAdress { get; set; } = string.Empty;
|
||||
|
||||
public DateTime OpeningDate { get; set; } = DateTime.Now;
|
||||
|
||||
public Dictionary<int, (IJewelModel, int)> Jewels { get; set; } = new();
|
||||
|
||||
public int Id { get; set; }
|
||||
public int JewelMaxCount { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using JewelryStoreDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.BindingModels
|
||||
{
|
||||
public class SupplyBindingModel : ISupplyModel
|
||||
{
|
||||
public int ShopId { get; set; }
|
||||
public int JewelId { get; set; }
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
@ -10,32 +10,16 @@ namespace JewelryStoreContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IReportLogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<ReportJewelComponentViewModel> GetJewelComponent();
|
||||
/// <summary>
|
||||
/// Получение списка заказов за определенный период
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение изделий в файл-Word
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveJewelsToWordFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение компонент с указаеним продуктов в файл-Excel
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveJewelComponentToExcelFile(ReportBindingModel model);
|
||||
/// <summary>
|
||||
/// Сохранение заказов в файл-Pdf
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
List<ReportJewelComponentViewModel> GetJewelComponents();
|
||||
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||
List<ReportShopsViewModel> GetShops();
|
||||
List<ReportGroupOrdersViewModel> GetGroupedOrders();
|
||||
void SaveJewelsToWordFile(ReportBindingModel model);
|
||||
void SaveJewelComponentToExcelFile(ReportBindingModel model);
|
||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||
void SaveShopsToWordFile(ReportBindingModel model);
|
||||
void SaveShopsToExcelFile(ReportBindingModel model);
|
||||
void SaveGroupedOrdersToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IStoreLogic
|
||||
{
|
||||
List<StoreViewModel>? ReadList(StoreSearchModel? model);
|
||||
StoreViewModel? ReadElement(StoreSearchModel model);
|
||||
bool Create(StoreBindingModel model);
|
||||
bool Update(StoreBindingModel model);
|
||||
bool Delete(StoreBindingModel model);
|
||||
bool MakeSupply(SupplyBindingModel model);
|
||||
bool Sale(SupplySearchModel model);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.SearchModels
|
||||
{
|
||||
public class StoreSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? StoreName { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.SearchModels
|
||||
{
|
||||
public class SupplySearchModel
|
||||
{
|
||||
public int? JewelId { get; set; }
|
||||
public int? Count { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.StoragesModels
|
||||
{
|
||||
public interface IStoreStorage
|
||||
{
|
||||
List<StoreViewModel> GetFullList();
|
||||
List<StoreViewModel> GetFilteredList(StoreSearchModel model);
|
||||
StoreViewModel? GetElement(StoreSearchModel model);
|
||||
StoreViewModel? Insert(StoreBindingModel model);
|
||||
StoreViewModel? Update(StoreBindingModel model);
|
||||
StoreViewModel? Delete(StoreBindingModel model);
|
||||
bool Sale(SupplySearchModel model);
|
||||
bool RestockingShops(SupplyBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.ViewModels
|
||||
{
|
||||
public class JewelCount
|
||||
{
|
||||
public JewelViewModel Jewel { get; set; }
|
||||
public int Count { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.ViewModels
|
||||
{
|
||||
public class ReportGroupOrdersViewModel
|
||||
{
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
public int OrdersCount { get; set; }
|
||||
public double OrdersSum { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.ViewModels
|
||||
{
|
||||
public class ReportShopsViewModel
|
||||
{
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
public int TotalCount { get; set; }
|
||||
public List<(string Jewel, int count)> Jewels { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.ViewModels
|
||||
{
|
||||
public class ShopJewelViewModel
|
||||
{
|
||||
public StoreViewModel Shop { get; set; } = new();
|
||||
public Dictionary<int, JewelCount> ShopJewel { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using JewelryStoreDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreContracts.ViewModels
|
||||
{
|
||||
public class StoreViewModel : IStoreModel
|
||||
{
|
||||
public Dictionary<int, (IJewelModel, int)> Jewels { get; set; } = new();
|
||||
[DisplayName("Вместимость")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название магазина")]
|
||||
public string StoreName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Адрес магазина")]
|
||||
public string StoreAdress { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата открытия")]
|
||||
public DateTime OpeningDate { get; set; } = DateTime.Now;
|
||||
|
||||
public int JewelMaxCount { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -21,7 +21,7 @@ namespace JewelryStoreDatabaseImplement.Implements
|
||||
}
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (model.Id.HasValue)
|
||||
if (!model.DateFrom.HasValue || !model.DateTo.HasValue ||!model.Id.HasValue)
|
||||
{
|
||||
var result = GetElement(model);
|
||||
return result != null ? new() { result } : new();
|
||||
|
@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JewelryStoreContracts.StoragesModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreDatabaseImplement.Models;
|
||||
|
||||
namespace JewelryStoreDatabaseImplement.Implements
|
||||
{
|
||||
public class StoreStorage : IStoreStorage
|
||||
{
|
||||
public List<StoreViewModel> GetFullList()
|
||||
{
|
||||
using var context = new JewelryStoreDatabase();
|
||||
return context.Shops.Include(x => x.Jewels).ThenInclude(x => x.Jewel).ToList().
|
||||
Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
public List<StoreViewModel> GetFilteredList(StoreSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.StoreName))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new JewelryStoreDatabase();
|
||||
return context.Shops.Include(x => x.Jewels).ThenInclude(x => x.Jewel).Where(x => x.ShopName.Contains(model.StoreName)).
|
||||
ToList().Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
public StoreViewModel? GetElement(StoreSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.StoreName) && !model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new JewelryStoreDatabase();
|
||||
return context.Shops.Include(x => x.Jewels).ThenInclude(x => x.Jewel)
|
||||
.FirstOrDefault(x =>
|
||||
(!string.IsNullOrEmpty(model.StoreName) && x.ShopName == model.StoreName) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
public StoreViewModel? Insert(StoreBindingModel model)
|
||||
{
|
||||
using var context = new JewelryStoreDatabase();
|
||||
var newShop = Store.Create(context, model);
|
||||
if (newShop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Shops.Add(newShop);
|
||||
context.SaveChanges();
|
||||
return newShop.GetViewModel;
|
||||
}
|
||||
|
||||
public StoreViewModel? Update(StoreBindingModel model)
|
||||
{
|
||||
using var context = new JewelryStoreDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var shop = context.Shops.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (shop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
shop.Update(model);
|
||||
context.SaveChanges();
|
||||
shop.UpdateJewels(context, model);
|
||||
transaction.Commit();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public StoreViewModel? Delete(StoreBindingModel model)
|
||||
{
|
||||
using var context = new JewelryStoreDatabase();
|
||||
var shop = context.Shops.Include(x => x.Jewels).FirstOrDefault(x => x.Id == model.Id);
|
||||
if (shop != null)
|
||||
{
|
||||
context.Shops.Remove(shop);
|
||||
context.SaveChanges();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool RestockingShops(SupplyBindingModel model)
|
||||
{
|
||||
using var context = new JewelryStoreDatabase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
var Shops = context.Shops.Include(x => x.Jewels).ThenInclude(x => x.Jewel).ToList().
|
||||
Where(x => x.JewelMaxCount > x.ShopJewels.Select(x => x.Value.Item2).Sum()).ToList();
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
foreach (Store shop in Shops)
|
||||
{
|
||||
int difference = shop.JewelMaxCount - shop.ShopJewels.Select(x => x.Value.Item2).Sum();
|
||||
int refill = Math.Min(difference, model.Count);
|
||||
model.Count -= refill;
|
||||
if (shop.ShopJewels.ContainsKey(model.JewelId))
|
||||
{
|
||||
var datePair = shop.ShopJewels[model.JewelId];
|
||||
datePair.Item2 += refill;
|
||||
shop.ShopJewels[model.JewelId] = datePair;
|
||||
}
|
||||
else
|
||||
{
|
||||
var Jewel = context.Jewels.First(x => x.Id == model.JewelId);
|
||||
shop.ShopJewels.Add(model.JewelId, (jewel, refill));
|
||||
}
|
||||
shop.JewelsDictionatyUpdate(context);
|
||||
if (model.Count == 0)
|
||||
{
|
||||
transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Sale(SupplySearchModel model)
|
||||
{
|
||||
using var context = new JewelryStoreDatabase();
|
||||
var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var shops = context.Shops.Include(x => x.Jewels).ThenInclude(x => x.Jewel).ToList().
|
||||
Where(x => x.ShopJewels.ContainsKey(model.JewelId.Value)).OrderByDescending(x => x.ShopJewels[model.JewelId.Value].Item2).ToList();
|
||||
|
||||
foreach (var shop in shops)
|
||||
{
|
||||
int residue = model.Count.Value - shop.ShopJewels[model.JewelId.Value].Item2;
|
||||
if (residue > 0)
|
||||
{
|
||||
shop.ShopJewels.Remove(model.JewelId.Value);
|
||||
shop.JewelsDictionatyUpdate(context);
|
||||
context.SaveChanges();
|
||||
model.Count = residue;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (residue == 0)
|
||||
shop.ShopJewels.Remove(model.JewelId.Value);
|
||||
else
|
||||
{
|
||||
var dataPair = shop.ShopJewels[model.JewelId.Value];
|
||||
dataPair.Item2 = -residue;
|
||||
shop.ShopJewels[model.JewelId.Value] = dataPair;
|
||||
}
|
||||
|
||||
shop.JewelsDictionatyUpdate(context);
|
||||
transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -23,8 +23,8 @@ namespace JewelryStoreDatabaseImplement
|
||||
public virtual DbSet<Jewel> Jewels { set; get; }
|
||||
public virtual DbSet<JewelComponent> JewelComponents { set; get; }
|
||||
public virtual DbSet<Order> Orders { set; get; }
|
||||
public virtual DbSet<Client> Clients { set; get; }
|
||||
public virtual DbSet<Implementer> Implementers { set; get; }
|
||||
}
|
||||
public virtual DbSet<Store> Shops { get; set; }
|
||||
public virtual DbSet<StoreJewels> ShopJewels { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,121 +5,75 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace JewelryStoreDatabaseImplement.Migrations
|
||||
{
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Components",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Cost = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Components", x => x.Id);
|
||||
});
|
||||
public partial class Hard_init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Shops",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Adress = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
OpeningDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
JewelMaxCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Jewels",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
JewelName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Jewels", x => x.Id);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShopJewels",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
JewelId = table.Column<int>(type: "int", nullable: false),
|
||||
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShopJewels", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopJewels_Jewels_JewelId",
|
||||
column: x => x.JewelId,
|
||||
principalTable: "Jewels",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopJewels_Shops_ShopId",
|
||||
column: x => x.ShopId,
|
||||
principalTable: "Shops",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "JewelComponents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
JewelId = table.Column<int>(type: "int", nullable: false),
|
||||
ComponentId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_JewelComponents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_JewelComponents_Components_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Components",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_JewelComponents_Jewels_JewelId",
|
||||
column: x => x.JewelId,
|
||||
principalTable: "Jewels",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopJewels_JewelId",
|
||||
table: "ShopJewels",
|
||||
column: "JewelId");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
JewelId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Orders", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Orders_Jewels_JewelId",
|
||||
column: x => x.JewelId,
|
||||
principalTable: "Jewels",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopJewels_ShopId",
|
||||
table: "ShopJewels",
|
||||
column: "ShopId");
|
||||
}
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_JewelComponents_ComponentId",
|
||||
table: "JewelComponents",
|
||||
column: "ComponentId");
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShopJewels");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_JewelComponents_JewelId",
|
||||
table: "JewelComponents",
|
||||
column: "JewelId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_JewelId",
|
||||
table: "Orders",
|
||||
column: "JewelId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "JewelComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Components");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Jewels");
|
||||
}
|
||||
}
|
||||
}
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shops");
|
||||
}
|
||||
}
|
||||
}
|
@ -10,245 +10,279 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace JewelryStoreDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(JewelryStoreDatabase))]
|
||||
partial class JewelryStoreDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
[DbContext(typeof(JewelryStoreDatabase))]
|
||||
partial class JewelryStoreDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ImplementerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Qualification")
|
||||
.HasColumnType("int");
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("WorkExperience")
|
||||
.HasColumnType("int");
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
b.Property<int>("JewelId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.ToTable("Implementers");
|
||||
});
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Jewel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
b.HasKey("Id");
|
||||
|
||||
b.Property<string>("JewelName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
b.HasIndex("JewelId");
|
||||
|
||||
b.HasKey("Id");
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
b.ToTable("Jewels");
|
||||
});
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Jewel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.JewelComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
b.Property<string>("JewelName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.Property<int>("JewelId")
|
||||
.HasColumnType("int");
|
||||
b.ToTable("Jewels");
|
||||
});
|
||||
|
||||
b.HasKey("Id");
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.JewelComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.HasIndex("JewelId");
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.ToTable("JewelComponents");
|
||||
});
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
b.Property<int>("JewelId")
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
b.HasKey("Id");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
b.HasIndex("JewelId");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
b.ToTable("JewelComponents");
|
||||
});
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("ImplementerId")
|
||||
.HasColumnType("int");
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("JewelId")
|
||||
.HasColumnType("int");
|
||||
b.Property<string>("Adress")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
b.Property<DateTime>("OpeningDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
b.Property<int>("JewelMaxCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ImplementerId");
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
b.HasIndex("JewelId");
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.ShopJewels", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.JewelComponent", b =>
|
||||
{
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("JewelComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Jewel", "Jewel")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("JewelId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("JewelId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Navigation("Component");
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Navigation("Jewel");
|
||||
});
|
||||
b.HasKey("Id");
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.HasIndex("JewelId");
|
||||
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Implementer", "Implementer")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ImplementerId");
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Jewel", "Jewel")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("JewelId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.ToTable("ShopJewels");
|
||||
});
|
||||
|
||||
b.Navigation("Client");
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Implementer");
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Jewel", "Jewel")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("JewelId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Jewel");
|
||||
});
|
||||
b.Navigation("Client");
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
b.Navigation("Jewel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("JewelComponents");
|
||||
});
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.JewelComponent", b =>
|
||||
{
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("JewelComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Jewel", "Jewel")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("JewelId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Jewel", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
b.Navigation("Jewel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.ShopJewels", b =>
|
||||
{
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Jewel", "Jewel")
|
||||
.WithMany("ShopJewels")
|
||||
.HasForeignKey("JewelId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("JewelryStoreDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Jewels")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Jewel");
|
||||
|
||||
b.Navigation("Shop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("JewelComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Jewel", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("JewelryStoreDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Jewels");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,9 +34,12 @@ namespace JewelryStoreDatabaseImplement.Models
|
||||
[ForeignKey("JewelId")]
|
||||
public virtual List<JewelComponent> Components { get; set; } = new();
|
||||
[ForeignKey("JewelId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
public static Jewel Create(JewelryStoreDatabase context, JewelBindingModel model)
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
[ForeignKey("JewelId")]
|
||||
public virtual List<StoreJewels> ShopJewels { get; set; } = new();
|
||||
|
||||
public static Jewel Create(JewelryStoreDatabase context, JewelBindingModel model)
|
||||
{
|
||||
return new Jewel()
|
||||
{
|
||||
|
@ -0,0 +1,116 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace JewelryStoreDatabaseImplement.Models
|
||||
{
|
||||
public class Store : IStoreModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string StoreName { get; set; } = string.Empty;
|
||||
|
||||
public string StoreAdress { get; set; } = string.Empty;
|
||||
|
||||
public DateTime OpeningDate { get; set; }
|
||||
|
||||
public int JewelMaxCount { get; set; }
|
||||
|
||||
|
||||
private Dictionary<int, (IJewelModel, int)>? _shopJewels = null;
|
||||
|
||||
|
||||
public Dictionary<int, (IJewelModel, int)> ShopJewels
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_shopJewels == null)
|
||||
{
|
||||
if (_shopJewels == null)
|
||||
{
|
||||
_shopJewels = Jewels
|
||||
.ToDictionary(recSP => recSP.JewelId, recSP => (recSP.Jewel as IJewelModel, recSP.Count));
|
||||
}
|
||||
return _shopJewels;
|
||||
}
|
||||
return _shopJewels;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("ShopId")]
|
||||
public List<StoreJewels> Jewels { get; set; } = new();
|
||||
|
||||
public static Store Create(JewelryStoreDatabase context, StoreBindingModel model)
|
||||
{
|
||||
return new Store()
|
||||
{
|
||||
Id = model.Id,
|
||||
StoreName = model.StoreName,
|
||||
StoreAdress = model.StoreAdress,
|
||||
OpeningDate = model.OpeningDate,
|
||||
Jewels = model.Jewels.Select(x => new StoreJewels
|
||||
{
|
||||
Jewel = context.Jewels.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
}).ToList(),
|
||||
JewelMaxCount = model.JewelMaxCount
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(StoreBindingModel model)
|
||||
{
|
||||
StoreName = model.StoreName;
|
||||
StoreAdress = model.StoreAdress;
|
||||
OpeningDate = model.OpeningDate;
|
||||
JewelMaxCount = model.JewelMaxCount;
|
||||
}
|
||||
|
||||
public StoreViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
StoreName = StoreName,
|
||||
StoreAdress = StoreAdress,
|
||||
OpeningDate = OpeningDate,
|
||||
Jewels = Jewels,
|
||||
JewelMaxCount = JewelMaxCount
|
||||
};
|
||||
|
||||
public void UpdateJewels(JewelryStoreDatabase context, StoreBindingModel model)
|
||||
{
|
||||
var ShopJewels = context.ShopJewels.Where(rec => rec.ShopId == model.Id).ToList();
|
||||
if (ShopJewels != null && ShopJewels.Count > 0)
|
||||
{
|
||||
context.ShopJewels.RemoveRange(ShopJewels.Where(rec => !model.Jewels.ContainsKey(rec.JewelId)));
|
||||
context.SaveChanges();
|
||||
ShopJewels = context.ShopJewels.Where(rec => rec.ShopId == model.Id).ToList();
|
||||
foreach (var updateJewel in ShopJewels)
|
||||
{
|
||||
updateJewel.Count = model.Jewels[updateJewel.JewelId].Item2;
|
||||
model.Jewels.Remove(updateJewel.JewelId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
var shop = context.Shops.First(x => x.Id == Id);
|
||||
foreach (var ar in model.Jewels)
|
||||
{
|
||||
context.ShopJewels.Add(new Jewels
|
||||
{
|
||||
Shop = shop,
|
||||
Jewel = context.Jewels.First(x => x.Id == ar.Key),
|
||||
Count = ar.Value.Item2
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_shopJewels = null;
|
||||
}
|
||||
|
||||
public void JewelsDictionatyUpdate(JewelryStoreDatabase context)
|
||||
{
|
||||
UpdateJewels(context, new StoreBindingModel
|
||||
{
|
||||
Id = Id,
|
||||
Jewels = Jewels,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreDatabaseImplement.Models
|
||||
{
|
||||
public class StoreJewels
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int JewelId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ShopId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
|
||||
public virtual Store Shop { get; set; } = new();
|
||||
|
||||
public virtual Jewel Jewel { get; set; } = new();
|
||||
}
|
||||
}
|
@ -10,15 +10,14 @@ namespace JewelryStoreFileImplement
|
||||
private readonly string OrderFileName = "Order.xml";
|
||||
private readonly string JewelFileName = "Jewel.xml";
|
||||
private readonly string ClientFileName = "Client.xml";
|
||||
private readonly string ImplementerFileName = "Implementer.xml";
|
||||
public List<Component> Components { get; private set; }
|
||||
private readonly string ShopFileName = "Shop.xml";
|
||||
public List<Component> Components { get; private set; }
|
||||
public List<Order> Orders { get; private set; }
|
||||
public List<Jewel> Jewels { get; private set; }
|
||||
public List<Client> Clients { get; private set; }
|
||||
public List<Implementer> Implementers { get; private set; }
|
||||
public List<Store> Shops { get; private set; }
|
||||
|
||||
|
||||
public static DataFileSingleton GetInstance()
|
||||
public static DataFileSingleton GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
@ -34,19 +33,16 @@ namespace JewelryStoreFileImplement
|
||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||
|
||||
public void SaveClients() => SaveData(Clients, OrderFileName, "Clients", x => x.GetXElement);
|
||||
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
|
||||
|
||||
public void SaveImplementers() => SaveData(Implementers, OrderFileName, "Implementers", x => x.GetXElement);
|
||||
|
||||
|
||||
private DataFileSingleton()
|
||||
private DataFileSingleton()
|
||||
{
|
||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||
Jewels = LoadData(JewelFileName, "Jewel", x => Jewel.Create(x)!)!;
|
||||
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
|
||||
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
|
||||
Implementers = LoadData(ImplementerFileName, "Implementer", x => Implementer.Create(x)!)!;
|
||||
|
||||
}
|
||||
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
|
||||
}
|
||||
|
||||
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
|
||||
{
|
||||
|
@ -8,16 +8,14 @@ namespace JewelryStoreListImplement
|
||||
public List<Component> Components { get; set; }
|
||||
public List<Order> Orders { get; set; }
|
||||
public List<Jewel> Jewels { get; set; }
|
||||
public List<Client> Clients { get; set; }
|
||||
public List<Implementer> Implementers { get; set; }
|
||||
public List<Store> Stores { get; set; }
|
||||
|
||||
private DataListSingleton()
|
||||
{
|
||||
Components = new List<Component>();
|
||||
Orders = new List<Order>();
|
||||
Jewels = new List<Jewel>();
|
||||
Clients = new List<Client>();
|
||||
Implementers = new List<Implementer>();
|
||||
Stores = new List<Store>();
|
||||
}
|
||||
|
||||
public static DataListSingleton GetInstance()
|
||||
|
@ -0,0 +1,126 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreListImplement;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.StoragesContracts;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreListImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JewelryStoreContracts.StoragesModels;
|
||||
|
||||
namespace JewelryStoreListImplement.Implements
|
||||
{
|
||||
public class StoreStorage : IStoreStorage
|
||||
{
|
||||
private readonly DataListSingleton _source;
|
||||
|
||||
public StoreStorage()
|
||||
{
|
||||
_source = DataListSingleton.GetInstance();
|
||||
}
|
||||
|
||||
public List<StoreViewModel> GetFullList()
|
||||
{
|
||||
var result = new List<StoreViewModel>();
|
||||
foreach (var shop in _source.Stores)
|
||||
{
|
||||
result.Add(shop.GetViewModel);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<StoreViewModel> GetFilteredList(StoreSearchModel model)
|
||||
{
|
||||
var result = new List<StoreViewModel>();
|
||||
if (string.IsNullOrEmpty(model.StoreName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var shop in _source.Stores)
|
||||
{
|
||||
if (shop.StoreName.Contains(model.StoreName))
|
||||
{
|
||||
result.Add(shop.GetViewModel);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public StoreViewModel? GetElement(StoreSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.StoreName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var shop in _source.Stores)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.StoreName) && shop.StoreName == model.StoreName) ||
|
||||
(model.Id.HasValue && shop.Id == model.Id))
|
||||
{
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public StoreViewModel? Insert(StoreBindingModel model)
|
||||
{
|
||||
model.Id = 1;
|
||||
foreach (var shop in _source.Stores)
|
||||
{
|
||||
if (model.Id <= shop.Id)
|
||||
{
|
||||
model.Id = shop.Id + 1;
|
||||
}
|
||||
}
|
||||
var newShop = Store.Create(model);
|
||||
if (newShop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_source.Stores.Add(newShop);
|
||||
return newShop.GetViewModel;
|
||||
}
|
||||
|
||||
public StoreViewModel? Update(StoreBindingModel model)
|
||||
{
|
||||
foreach (var shop in _source.Stores)
|
||||
{
|
||||
if (shop.Id == model.Id)
|
||||
{
|
||||
shop.Update(model);
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public StoreViewModel? Delete(StoreBindingModel model)
|
||||
{
|
||||
for (int i = 0; i < _source.Stores.Count; ++i)
|
||||
{
|
||||
if (_source.Stores[i].Id == model.Id)
|
||||
{
|
||||
var element = _source.Stores[i];
|
||||
_source.Stores.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Sale(SupplySearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool RestockingShops(SupplyBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JewelryStoreListImplement.Models
|
||||
{
|
||||
public class Store : IStoreModel
|
||||
{
|
||||
public string StoreName { get; private set; } = string.Empty;
|
||||
public string StoreAdress { get; private set; } = string.Empty;
|
||||
|
||||
public DateTime OpeningDate { get; private set; }
|
||||
|
||||
public Dictionary<int, (IJewelModel, int)> Jewels { get; private set; } = new();
|
||||
|
||||
public int Id { get; private set; }
|
||||
public int JewelMaxCount { get; private set; }
|
||||
|
||||
public static Store? Create(StoreBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Store()
|
||||
{
|
||||
Id = model.Id,
|
||||
StoreName = model.StoreName,
|
||||
StoreAdress = model.StoreAdress,
|
||||
OpeningDate = model.OpeningDate,
|
||||
JewelMaxCount = model.JewelMaxCount,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(StoreBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StoreName = model.StoreName;
|
||||
StoreAdress = model.StoreAdress;
|
||||
OpeningDate = model.OpeningDate;
|
||||
JewelMaxCount = model.JewelMaxCount;
|
||||
}
|
||||
|
||||
public StoreViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
StoreName = StoreName,
|
||||
StoreAdress = StoreAdress,
|
||||
OpeningDate = OpeningDate,
|
||||
Jewels = Jewels,
|
||||
JewelMaxCount = JewelMaxCount,
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace JewelryStoreRestApi
|
||||
{
|
||||
public class APIConfig
|
||||
{
|
||||
public static string? ShopPassword;
|
||||
|
||||
public static void LoadData(IConfiguration configuration)
|
||||
{
|
||||
ShopPassword = configuration["ShopAPIPassword"];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,157 @@
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
||||
using JewelryStoreContracts.SearchModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace JewelryStoreRestApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ShopController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStoreLogic _shopLogic;
|
||||
|
||||
public ShopController(ILogger<ShopController> logger, IStoreLogic shopLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_shopLogic = shopLogic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public bool Authentication(string password)
|
||||
{
|
||||
return CheckPassword(password);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<StoreViewModel>? GetShopList(string password)
|
||||
{
|
||||
if (!CheckPassword(password))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
return _shopLogic.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка магазинов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ShopJewelViewModel? GetShop(int shopId, string password)
|
||||
{
|
||||
if (!CheckPassword(password))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
var shop = _shopLogic.ReadElement(new StoreSearchModel { Id = shopId });
|
||||
return new ShopJewelViewModel
|
||||
{
|
||||
Shop = shop,
|
||||
ShopJewel = shop.ShopJewels.ToDictionary(x => x.Key, x => new JewelCount
|
||||
{
|
||||
Jewel = new JewelViewModel()
|
||||
{
|
||||
Id = x.Value.Item1.Id,
|
||||
JewelName = x.Value.Item1.PizzaName,
|
||||
JewelComponents = x.Value.Item1.JewelComponents,
|
||||
Price = x.Value.Item1.Price,
|
||||
},
|
||||
Count = x.Value.Item2
|
||||
})
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения магазина");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateShop(StoreBindingModel model, string password)
|
||||
{
|
||||
if (!CheckPassword(password))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_shopLogic.Create(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания магазина");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateShop(StoreBindingModel model, string password)
|
||||
{
|
||||
if (!CheckPassword(password))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_shopLogic.Update(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления магазина");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public void DeleteShop(int shopId, string password)
|
||||
{
|
||||
if (!CheckPassword(password))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_shopLogic.Delete(new StoreBindingModel { Id = shopId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления магазина");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void MakeSypply(SupplyBindingModel model, string password)
|
||||
{
|
||||
if (!CheckPassword(password))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_shopLogic.MakeSupply(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания поставки в магазин");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckPassword(string password)
|
||||
{
|
||||
return APIConfig.ShopPassword == password;
|
||||
}
|
||||
}
|
||||
}
|
@ -15,10 +15,11 @@ builder.Logging.AddLog4Net("log4net.config");
|
||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
builder.Services.AddTransient<IJewelStorage, JewelStorage>();
|
||||
|
||||
builder.Services.AddTransient<IStoreStorage, StoreStorage>();
|
||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<IJewelLogic, JewelLogic>();
|
||||
builder.Services.AddTransient<IStoreLogic, StoreLogic>();
|
||||
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
@ -5,5 +5,6 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"ShopAPIPassword": "123456"
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace JewelryStoreShopApp
|
||||
{
|
||||
public class APIClient
|
||||
{
|
||||
private static readonly HttpClient _client = new();
|
||||
|
||||
public static string? Password { get; set; }
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteRequest(string requestUrl)
|
||||
{
|
||||
var response = _client.DeleteAsync(requestUrl);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (!response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using JewelryStoreContracts.BindingModels;
|
||||
using JewelryStoreContracts.ViewModels;
|
||||
using JewelryStoreShopApp.Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace JewelryStoreShopApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (APIClient.Password == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ShopViewModel>>($"api/shop/getshoplist?password={APIClient.Password}"));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Enter(string password)
|
||||
{
|
||||
bool resout = APIClient.GetRequest<bool>($"/api/shop/authentication?password={password}");
|
||||
if (!resout)
|
||||
{
|
||||
Response.Redirect("../Home/Enter");
|
||||
return;
|
||||
}
|
||||
APIClient.Password = password;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
if (APIClient.Password == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View("Shop");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Create(int id, string shopname, string adress, DateTime openingdate, int maxcount)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shopname) || string.IsNullOrEmpty(adress))
|
||||
{
|
||||
throw new Exception("Название или адрес не может быть пустым");
|
||||
}
|
||||
if (openingdate == default(DateTime))
|
||||
{
|
||||
throw new Exception("Дата открытия не может быть пустой");
|
||||
}
|
||||
|
||||
APIClient.PostRequest($"api/shop/createshop?password={APIClient.Password}", new ShopBindingModel
|
||||
{
|
||||
Id = id,
|
||||
ShopName = shopname,
|
||||
Adress = adress,
|
||||
OpeningDate = openingdate,
|
||||
JewelMaxCount = maxcount
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Update(int Id)
|
||||
{
|
||||
if (APIClient.Password == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View("Shop", APIClient.GetRequest<ShopJewelViewModel>($"api/shop/getshop?shopId={Id}&password={APIClient.Password}"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Update(int id, string shopname, string adress, DateTime openingdate, int maxcount)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shopname) || string.IsNullOrEmpty(adress))
|
||||
{
|
||||
throw new Exception("Название или адрес не может быть пустым");
|
||||
}
|
||||
if (openingdate == default(DateTime))
|
||||
{
|
||||
throw new Exception("Дата открытия не может быть пустой");
|
||||
}
|
||||
APIClient.PostRequest($"api/shop/updateshop?password={APIClient.Password}", new ShopBindingModel
|
||||
{
|
||||
Id = id,
|
||||
ShopName = shopname,
|
||||
Adress = adress,
|
||||
OpeningDate = openingdate,
|
||||
JewelMaxCount = maxcount
|
||||
});
|
||||
Response.Redirect("../Index");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Delete(int Id)
|
||||
{
|
||||
APIClient.DeleteRequest($"api/shop/deleteshop?shopId={Id}&password={APIClient.Password}");
|
||||
Response.Redirect("../Index");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Supply()
|
||||
{
|
||||
if (APIClient.Password == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.Shops = APIClient.GetRequest<List<ShopViewModel>>($"api/shop/getshoplist?password={APIClient.Password}");
|
||||
ViewBag.Jewels = APIClient.GetRequest<List<JewelViewModel>>($"api/main/getJewellist");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Supply(int shop, int Jewel, int count)
|
||||
{
|
||||
APIClient.PostRequest($"api/shop/makesypply?password={APIClient.Password}", new SupplyBindingModel
|
||||
{
|
||||
ShopId = shop,
|
||||
JewelId = Jewel,
|
||||
Count = count
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\JewelryStoreContracts\JewelryStoreContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,9 @@
|
||||
namespace JewelryStoreShopApp.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
@{
|
||||
ViewData["Title"] = "Enter";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Вход в систему</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Пароль</label>
|
||||
<input class="form-control" type="password" name="password">
|
||||
</div>
|
||||
<input type="submit" value="Вход" class="btn btn-primary" />
|
||||
</form>
|
@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace JewelryStoreShopApp.Pages
|
||||
{
|
||||
public class PrivacyModel : PageModel
|
||||
{
|
||||
private readonly ILogger<PrivacyModel> _logger;
|
||||
|
||||
public PrivacyModel(ILogger<PrivacyModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
@using JewelryStoreContracts.ViewModels
|
||||
|
||||
@model List<ShopViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Магазины</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center ">
|
||||
<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.ShopName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Adress)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.OpeningDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.PizzaMaxCount)
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-primary" asp-action="Update" asp-route-Id="@(item.Id)" role="button">Изменить</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace JewelryStoreShopApp.Pages
|
||||
{
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
|
||||
public IndexModel(ILogger<IndexModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
@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>
|
@ -0,0 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace JewelryStoreShopApp.Pages.Shared
|
||||
{
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - JewelryStoreShopApp</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/JewelryStoreShopApp.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">JewelryStoreShopsApi</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Supply">Поставка</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 - JewelryStoreShopApp - <a asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,49 @@
|
||||
/* 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;
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
@ -0,0 +1,75 @@
|
||||
@using JewelryStoreDataModels.Models;
|
||||
@using JewelryStoreContracts.ViewModels;
|
||||
|
||||
@model ShopJewelViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Shop";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h2 class="display-4">Создание магазина</h2>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h2 class="display-4">Изменение магазина</h2>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Название</label>
|
||||
<input type="text" class="form-control" name="shopname" id="shopname" value="@(Model==null ? "" : Model.Shop?.ShopName)" />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Адрес</label>
|
||||
<input type="text" class="form-control" name="adress" id="adress" value="@(Model==null ? "" : Model.Shop?.Adress)" />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="startDate">Дата открытия</label>
|
||||
<input class="form-control" type="date" name="openingdate" id="openingdate" value="@(Model==null ? "" : Model.Shop?.OpeningDate.ToString("yyyy-MM-dd"))" />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Вместимость</label>
|
||||
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="maxcount" id="maxcount" value="@(Model==null ? "" : Model.Shop?.PizzaMaxCount)" />
|
||||
</div>
|
||||
<div class="mb-3 ">
|
||||
<input class="btn btn-primary" type="submit" value="Сохранить">
|
||||
@{
|
||||
if (Model != null && Model.Shop != null)
|
||||
{
|
||||
<input class="btn btn-danger" asp-action="Delete" type="submit" value="Удалить" asp-route-Id="@(Model==null ? 0 : Model.Shop.Id.ToString())">
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
@{
|
||||
if (Model != null && Model.Shop != null)
|
||||
{
|
||||
<div>
|
||||
<h6>Содержимое магазина</h6>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Количество</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.ShopJewels)
|
||||
{
|
||||
<tr>
|
||||
<td>@Html.DisplayFor(modelItem => item.Value.Jewel.JewelName)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.Value.Count)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace JewelryStoreShopApp.Pages
|
||||
{
|
||||
public class ShopModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
@{
|
||||
ViewData["Title"] = "Supply";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание поставки</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Магазин</label>
|
||||
<select class="form-select form-select-lg" id="shop" name="shop" asp-items="@(new SelectList(@ViewBag.Shops,"Id", "ShopName"))"></select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Украшения</label>
|
||||
<select class="form-select form-select-lg" id="pizza" name="pizza" asp-items="@(new SelectList(@ViewBag.Pizzas,"Id", "PizzaName"))"></select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Колличество</label>
|
||||
<input type="number" min="0" step="1" pattern="[0-9]" class="form-control" name="count" id="count">
|
||||
</div>
|
||||
<input class="btn btn-success" type="submit" value="Создать поставку">
|
||||
<a class="btn btn-primary" href="./Index" role="button">Отмена</a>
|
||||
</form>
|
@ -0,0 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace JewelryStoreShopApp.Pages
|
||||
{
|
||||
public class SuuplyModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
@using JewelryStoreShopApp
|
||||
@namespace JewelryStoreShopApp.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using JewelryStoreShopApp;
|
||||
|
||||
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.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:9856",
|
||||
"sslPort": 44377
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"PizzeriaShopApp": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7002;http://localhost:5279",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"DetailedErrors": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"IPAddress": "http://localhost:5175/"
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
@ -0,0 +1,4 @@
|
||||
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
|
||||
// Write your JavaScript code.
|
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2011-2021 Twitter, Inc.
|
||||
Copyright (c) 2011-2021 The Bootstrap Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
4997
PIbd-23_Panina.A.D_JewelryStore/JewelryStoreShopApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
4997
PIbd-23_Panina.A.D_JewelryStore/JewelryStoreShopApp/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user