lab7 base full
This commit is contained in:
parent
f2230a898e
commit
6fc83d48a5
@ -5,7 +5,7 @@
|
|||||||
<add key="SmtpClientPort" value="587" />
|
<add key="SmtpClientPort" value="587" />
|
||||||
<add key="PopHost" value="pop.gmail.com" />
|
<add key="PopHost" value="pop.gmail.com" />
|
||||||
<add key="PopPort" value="995" />
|
<add key="PopPort" value="995" />
|
||||||
<add key="MailLogin" value="labwork15kafis@gmail.com" />
|
<add key="MailLogin" value="7labmaxkarme@gmail.com" />
|
||||||
<add key="MailPassword" value="passlab15" />
|
<add key="MailPassword" value="tpbp digc rlzk bcbd" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
64
Pizzeria/Pizzeria/FormMails.Designer.cs
generated
Normal file
64
Pizzeria/Pizzeria/FormMails.Designer.cs
generated
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
namespace Pizzeria
|
||||||
|
{
|
||||||
|
partial class FormMails
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(12, 12);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.Size = new Size(694, 362);
|
||||||
|
dataGridView.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FormMails
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(718, 386);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormMails";
|
||||||
|
Text = "Письма";
|
||||||
|
Load += FormMails_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
54
Pizzeria/Pizzeria/FormMails.cs
Normal file
54
Pizzeria/Pizzeria/FormMails.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PizzeriaContracts.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 Pizzeria
|
||||||
|
{
|
||||||
|
public partial class FormMails : Form
|
||||||
|
{
|
||||||
|
ILogger _logger;
|
||||||
|
IMessageInfoLogic _logic;
|
||||||
|
|
||||||
|
public FormMails(ILogger<FormMails> logger, IMessageInfoLogic logic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = logic;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void FormMails_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["MessageId"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка писем");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Pizzeria/Pizzeria/FormMails.resx
Normal file
60
Pizzeria/Pizzeria/FormMails.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>
|
262
Pizzeria/Pizzeria/FormMain.Designer.cs
generated
262
Pizzeria/Pizzeria/FormMain.Designer.cs
generated
@ -28,190 +28,185 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
components = new System.ComponentModel.Container();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
dataGridView = new DataGridView();
|
||||||
this.button4 = new System.Windows.Forms.Button();
|
button4 = new Button();
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
button1 = new Button();
|
||||||
this.button3 = new System.Windows.Forms.Button();
|
button3 = new Button();
|
||||||
this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
contextMenuStrip = new ContextMenuStrip(components);
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
menuStrip1 = new MenuStrip();
|
||||||
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
изделияToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
клиентыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.исполнителиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
исполнителиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
списокКомпонентовToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.компонентовПоПиццамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
компонентовПоПиццамToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.запускРаботToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
запускРаботToolStripMenuItem = new ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
письмаToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
this.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
|
dataGridView.Location = new Point(0, 31);
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.Name = "dataGridView";
|
||||||
this.dataGridView.Location = new System.Drawing.Point(0, 31);
|
dataGridView.RowHeadersWidth = 51;
|
||||||
this.dataGridView.Name = "dataGridView";
|
dataGridView.RowTemplate.Height = 29;
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
dataGridView.Size = new Size(1203, 383);
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
dataGridView.TabIndex = 0;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(1203, 383);
|
|
||||||
this.dataGridView.TabIndex = 0;
|
|
||||||
//
|
//
|
||||||
// button4
|
// button4
|
||||||
//
|
//
|
||||||
this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
button4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.button4.Location = new System.Drawing.Point(1255, 100);
|
button4.Location = new Point(1255, 100);
|
||||||
this.button4.Name = "button4";
|
button4.Name = "button4";
|
||||||
this.button4.Size = new System.Drawing.Size(209, 29);
|
button4.Size = new Size(209, 29);
|
||||||
this.button4.TabIndex = 8;
|
button4.TabIndex = 8;
|
||||||
this.button4.Text = "Заказ выдан";
|
button4.Text = "Заказ выдан";
|
||||||
this.button4.UseVisualStyleBackColor = true;
|
button4.UseVisualStyleBackColor = true;
|
||||||
this.button4.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
button4.Click += ButtonIssuedOrder_Click;
|
||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
//
|
//
|
||||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
button1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.button1.Location = new System.Drawing.Point(1255, 49);
|
button1.Location = new Point(1255, 49);
|
||||||
this.button1.Name = "button1";
|
button1.Name = "button1";
|
||||||
this.button1.Size = new System.Drawing.Size(209, 29);
|
button1.Size = new Size(209, 29);
|
||||||
this.button1.TabIndex = 6;
|
button1.TabIndex = 6;
|
||||||
this.button1.Text = "Создать заказ";
|
button1.Text = "Создать заказ";
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
button1.UseVisualStyleBackColor = true;
|
||||||
this.button1.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
|
button1.Click += ButtonCreateOrder_Click;
|
||||||
//
|
//
|
||||||
// button3
|
// button3
|
||||||
//
|
//
|
||||||
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
button3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.button3.Location = new System.Drawing.Point(1255, 146);
|
button3.Location = new Point(1255, 146);
|
||||||
this.button3.Name = "button3";
|
button3.Name = "button3";
|
||||||
this.button3.Size = new System.Drawing.Size(209, 29);
|
button3.Size = new Size(209, 29);
|
||||||
this.button3.TabIndex = 10;
|
button3.TabIndex = 10;
|
||||||
this.button3.Text = "Обновить список";
|
button3.Text = "Обновить список";
|
||||||
this.button3.UseVisualStyleBackColor = true;
|
button3.UseVisualStyleBackColor = true;
|
||||||
this.button3.Click += new System.EventHandler(this.ButtonRef_Click);
|
button3.Click += ButtonRef_Click;
|
||||||
//
|
//
|
||||||
// contextMenuStrip
|
// contextMenuStrip
|
||||||
//
|
//
|
||||||
this.contextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
|
contextMenuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
this.contextMenuStrip.Name = "contextMenuStrip";
|
contextMenuStrip.Name = "contextMenuStrip";
|
||||||
this.contextMenuStrip.Size = new System.Drawing.Size(61, 4);
|
contextMenuStrip.Size = new Size(61, 4);
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
//
|
//
|
||||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, запускРаботToolStripMenuItem, письмаToolStripMenuItem });
|
||||||
this.справочникиToolStripMenuItem,
|
menuStrip1.Location = new Point(0, 0);
|
||||||
this.отчетыToolStripMenuItem,
|
menuStrip1.Name = "menuStrip1";
|
||||||
this.запускРаботToolStripMenuItem});
|
menuStrip1.Size = new Size(1501, 28);
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
menuStrip1.TabIndex = 11;
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
menuStrip1.Text = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1501, 28);
|
|
||||||
this.menuStrip1.TabIndex = 11;
|
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
|
||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// справочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделияToolStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem });
|
||||||
this.компонентыToolStripMenuItem,
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
this.изделияToolStripMenuItem,
|
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||||
this.клиентыToolStripMenuItem,
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
this.исполнителиToolStripMenuItem});
|
|
||||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
|
||||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
|
||||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
|
||||||
//
|
//
|
||||||
// компонентыToolStripMenuItem
|
// компонентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||||
this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
|
компонентыToolStripMenuItem.Size = new Size(185, 26);
|
||||||
this.компонентыToolStripMenuItem.Text = "Компоненты";
|
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||||
this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// изделияToolStripMenuItem
|
// изделияToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||||
this.изделияToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
|
изделияToolStripMenuItem.Size = new Size(185, 26);
|
||||||
this.изделияToolStripMenuItem.Text = "Пиццы";
|
изделияToolStripMenuItem.Text = "Пиццы";
|
||||||
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.ПиццыToolStripMenuItem_Click);
|
изделияToolStripMenuItem.Click += ПиццыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// клиентыToolStripMenuItem
|
// клиентыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||||
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
|
клиентыToolStripMenuItem.Size = new Size(185, 26);
|
||||||
this.клиентыToolStripMenuItem.Text = "Клиенты";
|
клиентыToolStripMenuItem.Text = "Клиенты";
|
||||||
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
|
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// исполнителиToolStripMenuItem
|
// исполнителиToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem";
|
||||||
this.исполнителиToolStripMenuItem.Size = new System.Drawing.Size(185, 26);
|
исполнителиToolStripMenuItem.Size = new Size(185, 26);
|
||||||
this.исполнителиToolStripMenuItem.Text = "Исполнители";
|
исполнителиToolStripMenuItem.Text = "Исполнители";
|
||||||
this.исполнителиToolStripMenuItem.Click += new System.EventHandler(this.исполнителиToolStripMenuItem_Click);
|
исполнителиToolStripMenuItem.Click += исполнителиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// отчетыToolStripMenuItem
|
// отчетыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентовПоПиццамToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
||||||
this.списокКомпонентовToolStripMenuItem,
|
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||||
this.компонентовПоПиццамToolStripMenuItem,
|
отчетыToolStripMenuItem.Size = new Size(73, 24);
|
||||||
this.списокЗаказовToolStripMenuItem});
|
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||||
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
|
||||||
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
|
|
||||||
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
|
||||||
//
|
//
|
||||||
// списокКомпонентовToolStripMenuItem
|
// списокКомпонентовToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
|
||||||
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(269, 26);
|
списокКомпонентовToolStripMenuItem.Size = new Size(269, 26);
|
||||||
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
|
||||||
this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
|
списокКомпонентовToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// компонентовПоПиццамToolStripMenuItem
|
// компонентовПоПиццамToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.компонентовПоПиццамToolStripMenuItem.Name = "компонентовПоПиццамToolStripMenuItem";
|
компонентовПоПиццамToolStripMenuItem.Name = "компонентовПоПиццамToolStripMenuItem";
|
||||||
this.компонентовПоПиццамToolStripMenuItem.Size = new System.Drawing.Size(269, 26);
|
компонентовПоПиццамToolStripMenuItem.Size = new Size(269, 26);
|
||||||
this.компонентовПоПиццамToolStripMenuItem.Text = "Компонентов по пиццам";
|
компонентовПоПиццамToolStripMenuItem.Text = "Компонентов по пиццам";
|
||||||
this.компонентовПоПиццамToolStripMenuItem.Click += new System.EventHandler(this.ComponentPizzasToolStripMenuItem_Click);
|
компонентовПоПиццамToolStripMenuItem.Click += ComponentPizzasToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// списокЗаказовToolStripMenuItem
|
// списокЗаказовToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||||
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(269, 26);
|
списокЗаказовToolStripMenuItem.Size = new Size(269, 26);
|
||||||
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||||
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
|
списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// запускРаботToolStripMenuItem
|
// запускРаботToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem";
|
запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem";
|
||||||
this.запускРаботToolStripMenuItem.Size = new System.Drawing.Size(114, 24);
|
запускРаботToolStripMenuItem.Size = new Size(114, 24);
|
||||||
this.запускРаботToolStripMenuItem.Text = "Запуск работ";
|
запускРаботToolStripMenuItem.Text = "Запуск работ";
|
||||||
this.запускРаботToolStripMenuItem.Click += new System.EventHandler(this.запускРаботToolStripMenuItem_Click);
|
запускРаботToolStripMenuItem.Click += запускРаботToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// письмаToolStripMenuItem
|
||||||
|
//
|
||||||
|
письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
|
||||||
|
письмаToolStripMenuItem.Size = new Size(77, 24);
|
||||||
|
письмаToolStripMenuItem.Text = "Письма";
|
||||||
|
письмаToolStripMenuItem.Click += письмаToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1501, 414);
|
ClientSize = new Size(1501, 414);
|
||||||
this.Controls.Add(this.menuStrip1);
|
Controls.Add(menuStrip1);
|
||||||
this.Controls.Add(this.button3);
|
Controls.Add(button3);
|
||||||
this.Controls.Add(this.button4);
|
Controls.Add(button4);
|
||||||
this.Controls.Add(this.button1);
|
Controls.Add(button1);
|
||||||
this.Controls.Add(this.dataGridView);
|
Controls.Add(dataGridView);
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
MainMenuStrip = menuStrip1;
|
||||||
this.Name = "FormMain";
|
Name = "FormMain";
|
||||||
this.Text = "Абстрактный магазин";
|
Text = "Абстрактный магазин";
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
Load += FormMain_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
this.menuStrip1.ResumeLayout(false);
|
menuStrip1.ResumeLayout(false);
|
||||||
this.menuStrip1.PerformLayout();
|
menuStrip1.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
this.PerformLayout();
|
PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -232,5 +227,6 @@
|
|||||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||||
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
||||||
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem письмаToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -167,5 +167,14 @@ e)
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ïèñüìàToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormMails));
|
||||||
|
if (service is FormMails form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -37,7 +37,7 @@ namespace Pizzeria
|
|||||||
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
||||||
MailPassword = System.Configuration.ConfigurationManager.AppSettings["MailPassword"] ?? string.Empty,
|
MailPassword = System.Configuration.ConfigurationManager.AppSettings["MailPassword"] ?? string.Empty,
|
||||||
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ?? string.Empty,
|
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ?? string.Empty,
|
||||||
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClient Port"]),
|
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
||||||
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
||||||
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ using PizzeriaContracts.BusinessLogicsContracts;
|
|||||||
using PizzeriaContracts.SearchModels;
|
using PizzeriaContracts.SearchModels;
|
||||||
using PizzeriaContracts.StoragesContracts;
|
using PizzeriaContracts.StoragesContracts;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|
||||||
@ -98,6 +99,14 @@ namespace PizzeriaBusinessLogic
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет пароля у клиента", nameof(model.ClientFIO));
|
throw new ArgumentNullException("Нет пароля у клиента", nameof(model.ClientFIO));
|
||||||
}
|
}
|
||||||
|
if (!Regex.IsMatch(model.Email, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Некорретно введен email клиента", nameof(model.Email));
|
||||||
|
}
|
||||||
|
if (!Regex.IsMatch(model.Password, @"^(?=.*\d)(?=.*\W)(?=.*[^\d\s]).+$"))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Некорректно введен пароль клиента", nameof(model.Password));
|
||||||
|
}
|
||||||
_logger.LogInformation("Client. ClientFIO:{ClientFIO}. Email:{Email}. Id: {id}", model.ClientFIO, model.Email, model.Id);
|
_logger.LogInformation("Client. ClientFIO:{ClientFIO}. Email:{Email}. Id: {id}", model.ClientFIO, model.Email, model.Id);
|
||||||
var element = _clientStorage.GetElement(new ClientSearchModel
|
var element = _clientStorage.GetElement(new ClientSearchModel
|
||||||
{
|
{
|
||||||
|
@ -13,12 +13,13 @@ namespace PizzeriaBusinessLogic.MailWorker
|
|||||||
protected string _popHost = string.Empty;
|
protected string _popHost = string.Empty;
|
||||||
protected int _popPort;
|
protected int _popPort;
|
||||||
private readonly IMessageInfoLogic _messageInfoLogic;
|
private readonly IMessageInfoLogic _messageInfoLogic;
|
||||||
|
private readonly IClientLogic _clientLogic;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger,
|
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic clientLogic)
|
||||||
IMessageInfoLogic messageInfoLogic)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_messageInfoLogic = messageInfoLogic;
|
_messageInfoLogic = messageInfoLogic;
|
||||||
|
_clientLogic = clientLogic;
|
||||||
}
|
}
|
||||||
public void MailConfig(MailConfigBindingModel config)
|
public void MailConfig(MailConfigBindingModel config)
|
||||||
{
|
{
|
||||||
@ -66,6 +67,7 @@ namespace PizzeriaBusinessLogic.MailWorker
|
|||||||
_logger.LogDebug("Check Mail: {Count} new mails", list.Count);
|
_logger.LogDebug("Check Mail: {Count} new mails", list.Count);
|
||||||
foreach (var mail in list)
|
foreach (var mail in list)
|
||||||
{
|
{
|
||||||
|
mail.ClientId = _clientLogic.ReadElement(new() { Email = mail.SenderName })?.Id;
|
||||||
_messageInfoLogic.Create(mail);
|
_messageInfoLogic.Create(mail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace PizzeriaBusinessLogic.MailWorker
|
|||||||
{
|
{
|
||||||
public class MailKitWorker : AbstractMailWorker
|
public class MailKitWorker : AbstractMailWorker
|
||||||
{
|
{
|
||||||
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic) : base(logger, messageInfoLogic) { }
|
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic clientLogic) : base(logger, messageInfoLogic, clientLogic) { }
|
||||||
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
||||||
{
|
{
|
||||||
using var objMailMessage = new MailMessage();
|
using var objMailMessage = new MailMessage();
|
||||||
|
48
Pizzeria/PizzeriaBusinessLogic/MessageInfoLogic .cs
Normal file
48
Pizzeria/PizzeriaBusinessLogic/MessageInfoLogic .cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PizzeriaContracts.BindingModels;
|
||||||
|
using PizzeriaContracts.BusinessLogicsContracts;
|
||||||
|
using PizzeriaContracts.SearchModels;
|
||||||
|
using PizzeriaContracts.StoragesContracts;
|
||||||
|
using PizzeriaContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace PizzeriaBusinessLogic
|
||||||
|
{
|
||||||
|
public class MessageInfoLogic : IMessageInfoLogic
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IMessageInfoStorage _messageInfoStorage;
|
||||||
|
|
||||||
|
public MessageInfoLogic(ILogger<MessageInfoLogic> logger, IMessageInfoStorage MessageInfoStorage)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
_messageInfoStorage = MessageInfoStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Create(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
if (_messageInfoStorage.Insert(model) == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("ReadList. MessageId:{MessageId}.ClientId:{ClientId} ", model?.MessageId, model?.ClientId);
|
||||||
|
|
||||||
|
var list = (model == null) ? _messageInfoStorage.GetFullList() : _messageInfoStorage.GetFilteredList(model);
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadList return null list");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,8 @@ using PizzeriaContracts.StoragesContracts;
|
|||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
using PizzeriaDataModels;
|
using PizzeriaDataModels;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PizzeriaBusinessLogic.MailWorker;
|
||||||
|
using DocumentFormat.OpenXml.Validation;
|
||||||
|
|
||||||
namespace PizzeriaBusinessLogic
|
namespace PizzeriaBusinessLogic
|
||||||
{
|
{
|
||||||
@ -12,10 +14,14 @@ namespace PizzeriaBusinessLogic
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
private readonly IClientStorage _clientStorage;
|
||||||
|
private readonly AbstractMailWorker _mailWorker;
|
||||||
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IClientStorage clientStorage, AbstractMailWorker mailWorker)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
|
_clientStorage = clientStorage;
|
||||||
|
_mailWorker = mailWorker;
|
||||||
}
|
}
|
||||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||||
{
|
{
|
||||||
@ -55,11 +61,22 @@ namespace PizzeriaBusinessLogic
|
|||||||
|
|
||||||
model.Status = OrderStatus.Принят;
|
model.Status = OrderStatus.Принят;
|
||||||
|
|
||||||
if (_orderStorage.Insert(model) == null)
|
var result = _orderStorage.Insert(model);
|
||||||
|
if(result == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Insert operation failed");
|
_logger.LogWarning("Insert operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var client = _clientStorage.GetElement(new ClientSearchModel { Id = model.ClientId });
|
||||||
|
|
||||||
|
_mailWorker.MailSendAsync(new MailSendInfoBindingModel()
|
||||||
|
{
|
||||||
|
MailAddress = client.Email,
|
||||||
|
Subject = $"Создан новый заказ {result.Id}",
|
||||||
|
Text = $"Заказ {result.Id} от {result.DateCreate} на сумму {result.Sum:0.00} принят"
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public bool UpdateStatus(OrderBindingModel model, OrderStatus newStatus)
|
public bool UpdateStatus(OrderBindingModel model, OrderStatus newStatus)
|
||||||
@ -77,6 +94,7 @@ namespace PizzeriaBusinessLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
model.Status = order.Status;
|
model.Status = order.Status;
|
||||||
|
model.ClientId = order.ClientId;
|
||||||
if(!model.ImplementerId.HasValue) model.ImplementerId = order.ImplementerId;
|
if(!model.ImplementerId.HasValue) model.ImplementerId = order.ImplementerId;
|
||||||
|
|
||||||
if(model.Status + 1 != newStatus)
|
if(model.Status + 1 != newStatus)
|
||||||
@ -97,6 +115,16 @@ namespace PizzeriaBusinessLogic
|
|||||||
_logger.LogWarning("Update operation failed");
|
_logger.LogWarning("Update operation failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var client = _clientStorage.GetElement(new ClientSearchModel { Id = model.ClientId });
|
||||||
|
|
||||||
|
_mailWorker.MailSendAsync(new MailSendInfoBindingModel()
|
||||||
|
{
|
||||||
|
MailAddress = client.Email,
|
||||||
|
Subject = $"Изменен статус заказа {model.Id}",
|
||||||
|
Text = $"Статус заказа {model.Id} изменен на {newStatus}"
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
|
@ -156,7 +156,7 @@ namespace PizzeriaClientApp.Controllers
|
|||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId ={ APIClient.Client.Id}"));
|
View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
<footer class="border-top footer text-muted">
|
<footer class="border-top footer text-muted">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
© 2023 - PrecastConcretePlantClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
© 2023 - PizzeriaClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
using PizzeriaContracts.BindingModels;
|
||||||
|
using PizzeriaContracts.SearchModels;
|
||||||
|
using PizzeriaContracts.StoragesContracts;
|
||||||
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using PizzeriaDatabaseImplement.models;
|
||||||
|
|
||||||
|
namespace PizzeriaDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class MessageInfoStorage : IMessageInfoStorage
|
||||||
|
{
|
||||||
|
public MessageInfoViewModel? GetElement(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
|
||||||
|
if (model.MessageId != null)
|
||||||
|
{
|
||||||
|
return context.Messages.FirstOrDefault(x => x.MessageId == model.MessageId)?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFilteredList(MessageInfoSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
return context.Messages
|
||||||
|
.Where(x => x.ClientId == model.ClientId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MessageInfoViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
return context.Messages
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel? Insert(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
using var context = new PizzeriaDatabase();
|
||||||
|
|
||||||
|
var newMessage = MessageInfo.Create(model);
|
||||||
|
if (newMessage == null || context.Messages.Any(x => x.MessageId.Equals(model.MessageId)))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Messages.Add(newMessage);
|
||||||
|
context.SaveChanges();
|
||||||
|
|
||||||
|
return newMessage.GetViewModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
285
Pizzeria/PizzeriaDatabaseImplement/Migrations/20230424134053_AddMails.Designer.cs
generated
Normal file
285
Pizzeria/PizzeriaDatabaseImplement/Migrations/20230424134053_AddMails.Designer.cs
generated
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using PizzeriaDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PizzeriaDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(PizzeriaDatabase))]
|
||||||
|
[Migration("20230424134053_AddMails")]
|
||||||
|
partial class AddMails
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.3")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClientFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ImplementerFIO")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Password")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Qualification")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("WorkExperience")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Implementers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.MessageInfo", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("MessageId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Body")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ClientId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateDelivery")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("SenderName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Subject")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("MessageId");
|
||||||
|
|
||||||
|
b.ToTable("Messages");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PizzaId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
|
b.HasIndex("PizzaId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Pizza", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("PizzaName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Pizzas");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.PizzaComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PizzaId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("PizzaId");
|
||||||
|
|
||||||
|
b.ToTable("PizzaComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.models.Implementer", "Implementer")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.models.Pizza", "Pizza")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("PizzaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
|
b.Navigation("Pizza");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.PizzaComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.models.Component", "Component")
|
||||||
|
.WithMany("PizzaComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PizzeriaDatabaseImplement.models.Pizza", "Pizza")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("PizzaId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Pizza");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PizzaComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Pizza", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PizzeriaDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddMails : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Messages",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
MessageId = table.Column<string>(type: "text", nullable: false),
|
||||||
|
ClientId = table.Column<int>(type: "integer", nullable: true),
|
||||||
|
SenderName = table.Column<string>(type: "text", nullable: false),
|
||||||
|
DateDelivery = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
Subject = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Body = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Messages", x => x.MessageId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Messages");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -94,6 +94,34 @@ namespace PizzeriaDatabaseImplement.Migrations
|
|||||||
b.ToTable("Implementers");
|
b.ToTable("Implementers");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.MessageInfo", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("MessageId")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Body")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ClientId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateDelivery")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("SenderName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Subject")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("MessageId");
|
||||||
|
|
||||||
|
b.ToTable("Messages");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Order", b =>
|
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Order", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
@ -17,6 +17,7 @@ namespace PizzeriaDatabaseImplement
|
|||||||
public virtual DbSet<Pizza> Pizzas { set; get; }
|
public virtual DbSet<Pizza> Pizzas { set; get; }
|
||||||
public virtual DbSet<Client> Clients { set; get; }
|
public virtual DbSet<Client> Clients { set; get; }
|
||||||
public virtual DbSet<Implementer> Implementers { set; get; }
|
public virtual DbSet<Implementer> Implementers { set; get; }
|
||||||
|
public virtual DbSet<MessageInfo> Messages { set; get; }
|
||||||
public virtual DbSet<PizzaComponent> PizzaComponents { set; get; }
|
public virtual DbSet<PizzaComponent> PizzaComponents { set; get; }
|
||||||
public virtual DbSet<Order> Orders { set; get; }
|
public virtual DbSet<Order> Orders { set; get; }
|
||||||
}
|
}
|
||||||
|
48
Pizzeria/PizzeriaDatabaseImplement/models/MessageInfo.cs
Normal file
48
Pizzeria/PizzeriaDatabaseImplement/models/MessageInfo.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using PizzeriaContracts.BindingModels;
|
||||||
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using PizzeriaDataModels.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PizzeriaDatabaseImplement.models
|
||||||
|
{
|
||||||
|
public class MessageInfo : IMessageInfoModel
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public string MessageId { get; set; } = string.Empty;
|
||||||
|
public int? ClientId { get; set; }
|
||||||
|
[Required]
|
||||||
|
public string SenderName { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public DateTime DateDelivery { get; set; }
|
||||||
|
[Required]
|
||||||
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Body { get; set; } = string.Empty;
|
||||||
|
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
MessageId = model.MessageId,
|
||||||
|
SenderName = model.SenderName,
|
||||||
|
ClientId = model.ClientId,
|
||||||
|
DateDelivery = DateTime.SpecifyKind(model.DateDelivery, DateTimeKind.Utc),
|
||||||
|
Subject = model.Subject,
|
||||||
|
Body = model.Body
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageInfoViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
MessageId = MessageId,
|
||||||
|
SenderName = SenderName,
|
||||||
|
DateDelivery = DateDelivery,
|
||||||
|
Subject = Subject,
|
||||||
|
Body = Body
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,8 @@ using PizzeriaContracts.BusinessLogicsContracts;
|
|||||||
using PizzeriaContracts.SearchModels;
|
using PizzeriaContracts.SearchModels;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace AbstractShopRestApi.Controllers
|
namespace AbstractShopRestApi.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]/[action]")]
|
[Route("api/[controller]/[action]")]
|
||||||
@ -61,6 +63,7 @@ namespace AbstractShopRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
public List<MessageInfoViewModel>? GetMessages(int clientId)
|
public List<MessageInfoViewModel>? GetMessages(int clientId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -14,10 +14,13 @@ builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
|||||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
builder.Services.AddTransient<IPizzaStorage, PizzaStorage>();
|
builder.Services.AddTransient<IPizzaStorage, PizzaStorage>();
|
||||||
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
builder.Services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
builder.Services.AddTransient<IPizzaLogic, PizzaLogic>();
|
builder.Services.AddTransient<IPizzaLogic, PizzaLogic>();
|
||||||
|
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at
|
// Learn more about configuring Swagger/OpenAPI at
|
||||||
https://aka.ms/aspnetcore/swashbuckle
|
https://aka.ms/aspnetcore/swashbuckle
|
||||||
@ -26,9 +29,8 @@ builder.Services.AddSwaggerGen(c =>
|
|||||||
{
|
{
|
||||||
c.SwaggerDoc("v1", new OpenApiInfo
|
c.SwaggerDoc("v1", new OpenApiInfo
|
||||||
{
|
{
|
||||||
Title = "AbstractShopRestApi",
|
Title = "PizzeriaRestApi",
|
||||||
Version
|
Version = "v1"
|
||||||
= "v1"
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
@ -47,8 +49,7 @@ mailSender?.MailConfig(new MailConfigBindingModel
|
|||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "PizzeriaRestApi v1"));
|
||||||
"AbstractShopRestApi v1"));
|
|
||||||
}
|
}
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
"SmtpClientPort": "587",
|
"SmtpClientPort": "587",
|
||||||
"PopHost": "pop.gmail.com",
|
"PopHost": "pop.gmail.com",
|
||||||
"PopPort": "995",
|
"PopPort": "995",
|
||||||
"MailLogin": "labwork15kafis@gmail.com",
|
"MailLogin": "7labmaxkarme@gmail.com",
|
||||||
"MailPassword": "passlab15"
|
"MailPassword": "tpbp digc rlzk bcbd"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user