Дофига всего сделала, забыла уже что сделала(короче у меня был какой-то план и я его придерживалась)

This commit is contained in:
dasha 2023-03-04 10:34:01 +04:00
parent 186dab5087
commit 9d5759527e
30 changed files with 746 additions and 52 deletions

View File

@ -40,6 +40,7 @@
this.buttonCreateOrder = new System.Windows.Forms.Button(); this.buttonCreateOrder = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView(); this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonAddSushiInShop = new System.Windows.Forms.Button(); this.buttonAddSushiInShop = new System.Windows.Forms.Button();
this.buttonSellSushi = new System.Windows.Forms.Button();
this.menuStrip.SuspendLayout(); this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@ -87,10 +88,10 @@
// //
// buttonUpdate // buttonUpdate
// //
this.buttonUpdate.Location = new System.Drawing.Point(781, 299); this.buttonUpdate.Location = new System.Drawing.Point(778, 237);
this.buttonUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonUpdate.Name = "buttonUpdate"; this.buttonUpdate.Name = "buttonUpdate";
this.buttonUpdate.Size = new System.Drawing.Size(170, 58); this.buttonUpdate.Size = new System.Drawing.Size(170, 62);
this.buttonUpdate.TabIndex = 12; this.buttonUpdate.TabIndex = 12;
this.buttonUpdate.Text = "Обновить"; this.buttonUpdate.Text = "Обновить";
this.buttonUpdate.UseVisualStyleBackColor = true; this.buttonUpdate.UseVisualStyleBackColor = true;
@ -98,10 +99,10 @@
// //
// buttonSetToFinish // buttonSetToFinish
// //
this.buttonSetToFinish.Location = new System.Drawing.Point(781, 237); this.buttonSetToFinish.Location = new System.Drawing.Point(778, 171);
this.buttonSetToFinish.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonSetToFinish.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonSetToFinish.Name = "buttonSetToFinish"; this.buttonSetToFinish.Name = "buttonSetToFinish";
this.buttonSetToFinish.Size = new System.Drawing.Size(170, 58); this.buttonSetToFinish.Size = new System.Drawing.Size(170, 62);
this.buttonSetToFinish.TabIndex = 11; this.buttonSetToFinish.TabIndex = 11;
this.buttonSetToFinish.Text = "Заказ выдан"; this.buttonSetToFinish.Text = "Заказ выдан";
this.buttonSetToFinish.UseVisualStyleBackColor = true; this.buttonSetToFinish.UseVisualStyleBackColor = true;
@ -109,10 +110,10 @@
// //
// buttonSetToDone // buttonSetToDone
// //
this.buttonSetToDone.Location = new System.Drawing.Point(781, 175); this.buttonSetToDone.Location = new System.Drawing.Point(778, 179);
this.buttonSetToDone.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonSetToDone.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonSetToDone.Name = "buttonSetToDone"; this.buttonSetToDone.Name = "buttonSetToDone";
this.buttonSetToDone.Size = new System.Drawing.Size(170, 58); this.buttonSetToDone.Size = new System.Drawing.Size(170, 62);
this.buttonSetToDone.TabIndex = 10; this.buttonSetToDone.TabIndex = 10;
this.buttonSetToDone.Text = "Заказ готов"; this.buttonSetToDone.Text = "Заказ готов";
this.buttonSetToDone.UseVisualStyleBackColor = true; this.buttonSetToDone.UseVisualStyleBackColor = true;
@ -120,10 +121,10 @@
// //
// buttonSetToWork // buttonSetToWork
// //
this.buttonSetToWork.Location = new System.Drawing.Point(781, 113); this.buttonSetToWork.Location = new System.Drawing.Point(778, 104);
this.buttonSetToWork.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonSetToWork.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonSetToWork.Name = "buttonSetToWork"; this.buttonSetToWork.Name = "buttonSetToWork";
this.buttonSetToWork.Size = new System.Drawing.Size(170, 58); this.buttonSetToWork.Size = new System.Drawing.Size(170, 62);
this.buttonSetToWork.TabIndex = 9; this.buttonSetToWork.TabIndex = 9;
this.buttonSetToWork.Text = "Отдать на выполнение"; this.buttonSetToWork.Text = "Отдать на выполнение";
this.buttonSetToWork.UseVisualStyleBackColor = true; this.buttonSetToWork.UseVisualStyleBackColor = true;
@ -131,10 +132,10 @@
// //
// buttonCreateOrder // buttonCreateOrder
// //
this.buttonCreateOrder.Location = new System.Drawing.Point(781, 51); this.buttonCreateOrder.Location = new System.Drawing.Point(778, 38);
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonCreateOrder.Name = "buttonCreateOrder"; this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(170, 58); this.buttonCreateOrder.Size = new System.Drawing.Size(170, 62);
this.buttonCreateOrder.TabIndex = 8; this.buttonCreateOrder.TabIndex = 8;
this.buttonCreateOrder.Text = "Создать заказ"; this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true; this.buttonCreateOrder.UseVisualStyleBackColor = true;
@ -154,20 +155,32 @@
// //
// buttonAddSushiInShop // buttonAddSushiInShop
// //
this.buttonAddSushiInShop.Location = new System.Drawing.Point(781, 361); this.buttonAddSushiInShop.Location = new System.Drawing.Point(778, 302);
this.buttonAddSushiInShop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.buttonAddSushiInShop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonAddSushiInShop.Name = "buttonAddSushiInShop"; this.buttonAddSushiInShop.Name = "buttonAddSushiInShop";
this.buttonAddSushiInShop.Size = new System.Drawing.Size(170, 58); this.buttonAddSushiInShop.Size = new System.Drawing.Size(170, 62);
this.buttonAddSushiInShop.TabIndex = 13; this.buttonAddSushiInShop.TabIndex = 13;
this.buttonAddSushiInShop.Text = "Добавить суши в магазин"; this.buttonAddSushiInShop.Text = "Добавить суши в магазин";
this.buttonAddSushiInShop.UseVisualStyleBackColor = true; this.buttonAddSushiInShop.UseVisualStyleBackColor = true;
this.buttonAddSushiInShop.Click += new System.EventHandler(this.ButtonAddSushiInShop_Click); this.buttonAddSushiInShop.Click += new System.EventHandler(this.ButtonAddSushiInShop_Click);
// //
// buttonSellSushi
//
this.buttonSellSushi.Location = new System.Drawing.Point(778, 367);
this.buttonSellSushi.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonSellSushi.Name = "buttonSellSushi";
this.buttonSellSushi.Size = new System.Drawing.Size(170, 62);
this.buttonSellSushi.TabIndex = 14;
this.buttonSellSushi.Text = "Продать суши";
this.buttonSellSushi.UseVisualStyleBackColor = true;
this.buttonSellSushi.Click += new System.EventHandler(this.ButtonSellSushi_Click);
//
// FormMain // FormMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(975, 450); this.ClientSize = new System.Drawing.Size(975, 450);
this.Controls.Add(this.buttonSellSushi);
this.Controls.Add(this.buttonAddSushiInShop); this.Controls.Add(this.buttonAddSushiInShop);
this.Controls.Add(this.buttonUpdate); this.Controls.Add(this.buttonUpdate);
this.Controls.Add(this.buttonSetToFinish); this.Controls.Add(this.buttonSetToFinish);
@ -202,5 +215,6 @@
private DataGridView dataGridView; private DataGridView dataGridView;
private ToolStripMenuItem shopsToolStripMenuItem; private ToolStripMenuItem shopsToolStripMenuItem;
private Button buttonAddSushiInShop; private Button buttonAddSushiInShop;
private Button buttonSellSushi;
} }
} }

View File

@ -160,5 +160,15 @@ namespace SushiBarView
form.ShowDialog(); form.ShowDialog();
} }
} }
private void ButtonSellSushi_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSellSushi));
if (service is FormSellSushi form)
{
form.ShowDialog();
LoadData();
}
}
} }
} }

View File

@ -0,0 +1,126 @@
namespace SushiBarView
{
partial class FormSellSushi
{
/// <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.labelSushi = new System.Windows.Forms.Label();
this.labelCount = new System.Windows.Forms.Label();
this.comboBoxSushi = new System.Windows.Forms.ComboBox();
this.textBoxCount = new System.Windows.Forms.TextBox();
this.buttonSave = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// labelSushi
//
this.labelSushi.AutoSize = true;
this.labelSushi.Location = new System.Drawing.Point(9, 11);
this.labelSushi.Name = "labelSushi";
this.labelSushi.Size = new System.Drawing.Size(39, 15);
this.labelSushi.TabIndex = 0;
this.labelSushi.Text = "Суши";
//
// labelCount
//
this.labelCount.AutoSize = true;
this.labelCount.Location = new System.Drawing.Point(11, 51);
this.labelCount.Name = "labelCount";
this.labelCount.Size = new System.Drawing.Size(72, 15);
this.labelCount.TabIndex = 1;
this.labelCount.Text = "Количество";
//
// comboBoxSushi
//
this.comboBoxSushi.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSushi.FormattingEnabled = true;
this.comboBoxSushi.Location = new System.Drawing.Point(100, 11);
this.comboBoxSushi.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.comboBoxSushi.Name = "comboBoxSushi";
this.comboBoxSushi.Size = new System.Drawing.Size(230, 23);
this.comboBoxSushi.TabIndex = 3;
//
// textBoxCount
//
this.textBoxCount.Location = new System.Drawing.Point(100, 51);
this.textBoxCount.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBoxCount.Name = "textBoxCount";
this.textBoxCount.Size = new System.Drawing.Size(230, 23);
this.textBoxCount.TabIndex = 4;
//
// buttonSave
//
this.buttonSave.Location = new System.Drawing.Point(160, 78);
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(82, 22);
this.buttonSave.TabIndex = 6;
this.buttonSave.Text = "Сохранить";
this.buttonSave.UseVisualStyleBackColor = true;
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(248, 78);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(82, 22);
this.buttonCancel.TabIndex = 7;
this.buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// FormSellSushi
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(349, 119);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonSave);
this.Controls.Add(this.textBoxCount);
this.Controls.Add(this.comboBoxSushi);
this.Controls.Add(this.labelCount);
this.Controls.Add(this.labelSushi);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "FormSellSushi";
this.Text = "Продажа суши";
this.Load += new System.EventHandler(this.FormSellSushi_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label labelSushi;
private Label labelCount;
private ComboBox comboBoxSushi;
private TextBox textBoxCount;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,90 @@
using Microsoft.Extensions.Logging;
using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.SearchModels;
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 SushiBarView
{
public partial class FormSellSushi : Form
{
private readonly ILogger _logger;
private readonly ISushiLogic _logicSushi;
private readonly IShopLogic _logicShop;
public FormSellSushi(ILogger<FormSellSushi> logger, ISushiLogic logicI, IShopLogic logicS)
{
InitializeComponent();
_logger = logger;
_logicSushi = logicI;
_logicShop = logicS;
}
private void FormSellSushi_Load(object sender, EventArgs e)
{
_logger.LogInformation("Загрузка списка суши для продажи");
try
{
var list = _logicSushi.ReadList(null);
if (list != null)
{
comboBoxSushi.DisplayMember = "SushiName";
comboBoxSushi.ValueMember = "Id";
comboBoxSushi.DataSource = list;
comboBoxSushi.SelectedItem = null;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки списка суши");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxCount.Text))
{
MessageBox.Show("Заполните поле 'Количество'", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (comboBoxSushi.SelectedValue == null)
{
MessageBox.Show("Выберите суши", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_logger.LogInformation("Продажа суши");
try
{
var operationResult = _logicShop.SellSushi(_logicSushi.ReadElement(new SushiSearchModel()
{
Id = Convert.ToInt32(comboBoxSushi.SelectedValue)
})!, 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();
}
}
}

View 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>

View File

@ -34,13 +34,16 @@
this.labelTime = new System.Windows.Forms.Label(); this.labelTime = new System.Windows.Forms.Label();
this.labelAddress = new System.Windows.Forms.Label(); this.labelAddress = new System.Windows.Forms.Label();
this.dataGridView = new System.Windows.Forms.DataGridView(); this.dataGridView = new System.Windows.Forms.DataGridView();
this.labelShop = new System.Windows.Forms.Label();
this.textBoxShop = new System.Windows.Forms.TextBox();
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnSushiName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnSushiName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.labelShop = new System.Windows.Forms.Label();
this.textBoxShop = new System.Windows.Forms.TextBox();
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.labelCount = new System.Windows.Forms.Label();
this.numericUpDownCount = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// buttonSave // buttonSave
@ -69,13 +72,13 @@
// //
this.textBoxAddress.Location = new System.Drawing.Point(159, 27); this.textBoxAddress.Location = new System.Drawing.Point(159, 27);
this.textBoxAddress.Name = "textBoxAddress"; this.textBoxAddress.Name = "textBoxAddress";
this.textBoxAddress.Size = new System.Drawing.Size(221, 23); this.textBoxAddress.Size = new System.Drawing.Size(141, 23);
this.textBoxAddress.TabIndex = 14; this.textBoxAddress.TabIndex = 14;
// //
// labelTime // labelTime
// //
this.labelTime.AutoSize = true; this.labelTime.AutoSize = true;
this.labelTime.Location = new System.Drawing.Point(386, 9); this.labelTime.Location = new System.Drawing.Point(306, 9);
this.labelTime.Name = "labelTime"; this.labelTime.Name = "labelTime";
this.labelTime.Size = new System.Drawing.Size(87, 15); this.labelTime.Size = new System.Drawing.Size(87, 15);
this.labelTime.TabIndex = 13; this.labelTime.TabIndex = 13;
@ -106,6 +109,23 @@
this.dataGridView.Size = new System.Drawing.Size(581, 240); this.dataGridView.Size = new System.Drawing.Size(581, 240);
this.dataGridView.TabIndex = 11; this.dataGridView.TabIndex = 11;
// //
// ColumnID
//
this.ColumnID.HeaderText = "ID";
this.ColumnID.Name = "ColumnID";
this.ColumnID.Visible = false;
//
// ColumnSushiName
//
this.ColumnSushiName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ColumnSushiName.HeaderText = "Суши";
this.ColumnSushiName.Name = "ColumnSushiName";
//
// ColumnCount
//
this.ColumnCount.HeaderText = "Количество";
this.ColumnCount.Name = "ColumnCount";
//
// labelShop // labelShop
// //
this.labelShop.AutoSize = true; this.labelShop.AutoSize = true;
@ -124,33 +144,34 @@
// //
// dateTimePicker // dateTimePicker
// //
this.dateTimePicker.Location = new System.Drawing.Point(386, 27); this.dateTimePicker.Location = new System.Drawing.Point(306, 27);
this.dateTimePicker.Name = "dateTimePicker"; this.dateTimePicker.Name = "dateTimePicker";
this.dateTimePicker.Size = new System.Drawing.Size(207, 23); this.dateTimePicker.Size = new System.Drawing.Size(141, 23);
this.dateTimePicker.TabIndex = 19; this.dateTimePicker.TabIndex = 19;
// //
// ColumnID // labelCount
// //
this.ColumnID.HeaderText = "ID"; this.labelCount.AutoSize = true;
this.ColumnID.Name = "ColumnID"; this.labelCount.Location = new System.Drawing.Point(453, 9);
this.ColumnID.Visible = false; this.labelCount.Name = "labelCount";
this.labelCount.Size = new System.Drawing.Size(134, 15);
this.labelCount.TabIndex = 20;
this.labelCount.Text = "Вместимость магазина";
// //
// ColumnSushiName // numericUpDownCount
// //
this.ColumnSushiName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.numericUpDownCount.Location = new System.Drawing.Point(453, 27);
this.ColumnSushiName.HeaderText = "Суши"; this.numericUpDownCount.Name = "numericUpDownCount";
this.ColumnSushiName.Name = "ColumnSushiName"; this.numericUpDownCount.Size = new System.Drawing.Size(140, 23);
// this.numericUpDownCount.TabIndex = 21;
// ColumnCount
//
this.ColumnCount.HeaderText = "Количество";
this.ColumnCount.Name = "ColumnCount";
// //
// FormShop // FormShop
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(605, 337); this.ClientSize = new System.Drawing.Size(605, 337);
this.Controls.Add(this.numericUpDownCount);
this.Controls.Add(this.labelCount);
this.Controls.Add(this.dateTimePicker); this.Controls.Add(this.dateTimePicker);
this.Controls.Add(this.textBoxShop); this.Controls.Add(this.textBoxShop);
this.Controls.Add(this.buttonSave); this.Controls.Add(this.buttonSave);
@ -165,6 +186,7 @@
this.Load += new System.EventHandler(this.FormShop_Load); this.Load += new System.EventHandler(this.FormShop_Load);
this.Click += new System.EventHandler(this.FormShop_Load); this.Click += new System.EventHandler(this.FormShop_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -184,5 +206,7 @@
private DataGridViewTextBoxColumn ColumnID; private DataGridViewTextBoxColumn ColumnID;
private DataGridViewTextBoxColumn ColumnSushiName; private DataGridViewTextBoxColumn ColumnSushiName;
private DataGridViewTextBoxColumn ColumnCount; private DataGridViewTextBoxColumn ColumnCount;
private Label labelCount;
private NumericUpDown numericUpDownCount;
} }
} }

View File

@ -39,6 +39,7 @@ namespace SushiBarView
textBoxShop.Text = view.ShopName; textBoxShop.Text = view.ShopName;
textBoxAddress.Text = view.Address; textBoxAddress.Text = view.Address;
dateTimePicker.Text = view.DateOpening.ToString(); dateTimePicker.Text = view.DateOpening.ToString();
numericUpDownCount.Value = view.MaxCountSushi;
_shopListSushi = view.ListSushi ?? new Dictionary<int, (ISushiModel, int)>(); _shopListSushi = view.ListSushi ?? new Dictionary<int, (ISushiModel, int)>();
LoadData(); LoadData();
} }
@ -93,7 +94,8 @@ namespace SushiBarView
Id = _id ?? 0, Id = _id ?? 0,
ShopName = textBoxShop.Text, ShopName = textBoxShop.Text,
Address = textBoxAddress.Text, Address = textBoxAddress.Text,
DateOpening = dateTimePicker.Value.Date DateOpening = dateTimePicker.Value.Date,
MaxCountSushi = (int)numericUpDownCount.Value
}; };
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
if (!operationResult) if (!operationResult)

View File

@ -54,6 +54,7 @@ namespace SushiBarView
services.AddTransient<FormShopSushi>(); services.AddTransient<FormShopSushi>();
services.AddTransient<FormShops>(); services.AddTransient<FormShops>();
services.AddTransient<FormShop>(); services.AddTransient<FormShop>();
services.AddTransient<FormSellSushi>();
} }
} }

View File

@ -18,7 +18,6 @@
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" /> <ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" /> <ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
<ProjectReference Include="..\SushiBarFileImplement\SushiBarFileImplement.csproj" /> <ProjectReference Include="..\SushiBarFileImplement\SushiBarFileImplement.csproj" />
<ProjectReference Include="..\SushiBarListImplement\SushiBarListImplement.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -12,11 +12,15 @@ namespace SushiBarBusinessLogic.BusinessLogics
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IOrderStorage _orderStorage; private readonly IOrderStorage _orderStorage;
private readonly IShopLogic _shopLogic;
private readonly ISushiStorage _sushiStorage;
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage) public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IShopLogic shopLogic, ISushiStorage sushiStorage)
{ {
_logger = logger; _logger = logger;
_orderStorage = orderStorage; _orderStorage = orderStorage;
_shopLogic = shopLogic;
_sushiStorage = sushiStorage;
} }
public List<OrderViewModel>? ReadList(OrderSearchModel? model) public List<OrderViewModel>? ReadList(OrderSearchModel? model)
{ {
@ -86,7 +90,19 @@ namespace SushiBarBusinessLogic.BusinessLogics
return false; return false;
} }
model.Status = newStatus; model.Status = newStatus;
if (model.Status == OrderStatus.Готов) model.DateImplement = DateTime.Now; if (model.Status == OrderStatus.Готов)
{
model.DateImplement = DateTime.Now;
var sushi = _sushiStorage.GetElement(new() { Id = viewModel.SushiId });
if (sushi == null)
{
throw new ArgumentNullException(nameof(sushi));
}
if (!_shopLogic.AddSushi(sushi, viewModel.Count))
{
throw new Exception($"AddSushis operation failed. Shop is full.");
}
}
else else
{ {
model.DateImplement = viewModel.DateImplement; model.DateImplement = viewModel.DateImplement;

View File

@ -6,7 +6,7 @@ using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
namespace SushiBusinessLogic namespace SushiBarBusinessLogic.BusinessLogics
{ {
public class ShopLogic : IShopLogic public class ShopLogic : IShopLogic
{ {
@ -93,6 +93,12 @@ namespace SushiBusinessLogic
{ {
throw new ArgumentNullException("Нет названия магазина", nameof(model.ShopName)); throw new ArgumentNullException("Нет названия магазина", nameof(model.ShopName));
} }
if (model.MaxCountSushi < 0)
{
throw new ArgumentException(
"Максимальное количество суши в магазине не может быть меньше нуля",
nameof(model.MaxCountSushi));
}
_logger.LogInformation("Shop. ShopName:{0}.Address:{1}. Id: {2}", _logger.LogInformation("Shop. ShopName:{0}.Address:{1}. Id: {2}",
model.ShopName, model.Address, model.Id); model.ShopName, model.Address, model.Id);
var element = _shopStorage.GetElement(new ShopSearchModel var element = _shopStorage.GetElement(new ShopSearchModel
@ -123,6 +129,11 @@ namespace SushiBusinessLogic
_logger.LogWarning("AddSushiInShop element not found"); _logger.LogWarning("AddSushiInShop element not found");
return false; return false;
} }
if (element.MaxCountSushi -
element.ListSushi.Select(x => x.Value.Item2).Sum() < count)
{
throw new ArgumentNullException("Магазин переполнен", nameof(count));
}
_logger.LogInformation("AddSushiInShop find. Id:{Id}", element.Id); _logger.LogInformation("AddSushiInShop find. Id:{Id}", element.Id);
if (element.ListSushi.TryGetValue(sushi.Id, out var pair)) if (element.ListSushi.TryGetValue(sushi.Id, out var pair))
@ -144,9 +155,56 @@ namespace SushiBusinessLogic
Address = element.Address, Address = element.Address,
ShopName = element.ShopName, ShopName = element.ShopName,
DateOpening = element.DateOpening, DateOpening = element.DateOpening,
ListSushi = element.ListSushi MaxCountSushi = element.MaxCountSushi,
ListSushi = element.ListSushi,
}); });
return true; return true;
} }
public bool AddSushi(ISushiModel model, int count)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (count <= 0)
{
throw new ArgumentException("Количество суши должно быть больше 0", nameof(count));
}
_logger.LogInformation("AddSushi. ShopName:{ShopName}. Id:{Id}", model.SushiName, model.Id);
foreach (var shop in _shopStorage.GetFullList())
{
int free = shop.MaxCountSushi - shop.ListSushi.Select(x => x.Value.Item2).Sum();
if (free < count)
{
if (!AddSushiInShop(new() { Id = shop.Id }, model, free))
{
_logger.LogWarning("AddSushi operation failed.");
return false;
}
count -= free;
}
else
{
if (!AddSushiInShop(new() { Id = shop.Id }, model, count))
{
_logger.LogWarning("AddSushiInShop operation failed.");
return false;
}
count = 0;
}
if (count == 0)
{
return true;
}
}
_logger.LogWarning("AddSushi operation failed.");
return false;
}
public bool SellSushi(ISushiModel model, int count)
{
return _shopStorage.SellSushi(model, count);
}
} }
} }

View File

@ -16,5 +16,7 @@ namespace SushiBarContracts.BindingModels
get; get;
set; set;
} = new(); } = new();
public int MaxCountSushi { get; set; }
} }
} }

View File

@ -13,5 +13,7 @@ namespace SushiBarContracts.BusinessLogicsContracts
bool Update(ShopBindingModel model); bool Update(ShopBindingModel model);
bool Delete(ShopBindingModel model); bool Delete(ShopBindingModel model);
bool AddSushiInShop(ShopSearchModel model, ISushiModel sushi, int count); bool AddSushiInShop(ShopSearchModel model, ISushiModel sushi, int count);
bool AddSushi(ISushiModel sushi, int count);
bool SellSushi(ISushiModel sushi, int count);
} }
} }

View File

@ -1,6 +1,7 @@
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;
namespace SushiBarContracts.StoragesContracts namespace SushiBarContracts.StoragesContracts
{ {
@ -12,5 +13,7 @@ namespace SushiBarContracts.StoragesContracts
ShopViewModel? Insert(ShopBindingModel model); ShopViewModel? Insert(ShopBindingModel model);
ShopViewModel? Update(ShopBindingModel model); ShopViewModel? Update(ShopBindingModel model);
ShopViewModel? Delete(ShopBindingModel model); ShopViewModel? Delete(ShopBindingModel model);
bool IsEnoughSushi(ISushiModel model, int count);
bool SellSushi(ISushiModel model, int count);
} }
} }

View File

@ -1,6 +1,7 @@
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;
namespace SushiBarContracts.StoragesContracts namespace SushiBarContracts.StoragesContracts
{ {
@ -12,5 +13,7 @@ namespace SushiBarContracts.StoragesContracts
SushiViewModel? Insert(SushiBindingModel model); SushiViewModel? Insert(SushiBindingModel model);
SushiViewModel? Update(SushiBindingModel model); SushiViewModel? Update(SushiBindingModel model);
SushiViewModel? Delete(SushiBindingModel model); SushiViewModel? Delete(SushiBindingModel model);
bool HasSushi(ISushiModel model, int needCount);
bool SellSushi(ISushiModel model, int count);
} }
} }

View File

@ -14,6 +14,8 @@ namespace SushiBarContracts.ViewModels
[DisplayName("Дата открытия")] [DisplayName("Дата открытия")]
public DateTime DateOpening { get; set; } = DateTime.Now; public DateTime DateOpening { get; set; } = DateTime.Now;
[DisplayName("Максимальное количество суши")]
public int MaxCountSushi { get; set; }
public Dictionary<int, (ISushiModel, int)> ListSushi public Dictionary<int, (ISushiModel, int)> ListSushi
{ {

View File

@ -6,5 +6,6 @@
string Address { get; } string Address { get; }
DateTime DateOpening { get; } DateTime DateOpening { get; }
Dictionary<int, (ISushiModel, int)> ListSushi { get; } Dictionary<int, (ISushiModel, int)> ListSushi { get; }
int MaxCountSushi { get; }
} }
} }

View File

@ -9,9 +9,11 @@ namespace SushiBarFileImplement
private readonly string IngredientFileName = "Ingredient.xml"; private readonly string IngredientFileName = "Ingredient.xml";
private readonly string OrderFileName = "Order.xml"; private readonly string OrderFileName = "Order.xml";
private readonly string SushiFileName = "Sushi.xml"; private readonly string SushiFileName = "Sushi.xml";
private readonly string ShopFileName = "Shop.xml";
public List<Ingredient> Ingredients { get; private set; } public List<Ingredient> Ingredients { get; private set; }
public List<Order> Orders { get; private set; } public List<Order> Orders { get; private set; }
public List<Sushi> ListSushi { get; private set; } public List<Sushi> ListSushi { get; private set; }
public List<Shop> Shops { get; private set; }
public static DataFileSingleton GetInstance() public static DataFileSingleton GetInstance()
{ {
if (instance == null) if (instance == null)
@ -25,11 +27,13 @@ namespace SushiBarFileImplement
public void SaveListSushi() => SaveData(ListSushi, SushiFileName, public void SaveListSushi() => SaveData(ListSushi, SushiFileName,
"ListSushi", x => x.GetXElement); "ListSushi", x => x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
private DataFileSingleton() private DataFileSingleton()
{ {
Ingredients = LoadData(IngredientFileName, "Ingredient", x => Ingredient.Create(x)!)!; Ingredients = LoadData(IngredientFileName, "Ingredient", x => Ingredient.Create(x)!)!;
ListSushi = LoadData(SushiFileName, "Sushi", x => Sushi.Create(x)!)!; ListSushi = LoadData(SushiFileName, "Sushi", x => Sushi.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
} }
private static List<T>? LoadData<T>(string filename, string xmlNodeName, private static List<T>? LoadData<T>(string filename, string xmlNodeName,
Func<XElement, T> selectFunction) Func<XElement, T> selectFunction)

View File

@ -0,0 +1,109 @@
using SushiBarContracts.BindingModels;
using SushiBarContracts.SearchModels;
using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;
using SushiBarFileImplement.Models;
namespace SushiBarFileImplement.Implements
{
public class ShopStorage : IShopStorage
{
private readonly DataFileSingleton source;
public ShopStorage()
{
source = DataFileSingleton.GetInstance();
}
public List<ShopViewModel> GetFullList()
{
return source.Shops.Select(x => x.GetViewModel).ToList();
}
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
{
if (string.IsNullOrEmpty(model.ShopName))
{
return new();
}
return source.Shops.Where(x =>
x.ShopName.Contains(model.ShopName)).Select(x => x.GetViewModel).ToList();
}
public ShopViewModel? GetElement(ShopSearchModel model)
{
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
{
return null;
}
return source.Shops.FirstOrDefault(x =>
(!string.IsNullOrEmpty(model.ShopName) && x.ShopName ==
model.ShopName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
}
public ShopViewModel? Insert(ShopBindingModel model)
{
model.Id = source.Shops.Count > 0 ? source.Shops.Max(x => x.Id) + 1 : 1;
var newShop = Shop.Create(model);
if (newShop == null)
{
return null;
}
source.Shops.Add(newShop);
source.SaveShops();
return newShop.GetViewModel;
}
public ShopViewModel? Update(ShopBindingModel model)
{
var shop = source.Shops.FirstOrDefault(x => x.Id == model.Id);
if (shop == null)
{
return null;
}
shop.Update(model);
source.SaveShops();
return shop.GetViewModel;
}
public ShopViewModel? Delete(ShopBindingModel model)
{
var element = source.Shops.FirstOrDefault(x => x.Id == model.Id);
if (element != null)
{
source.Shops.Remove(element);
source.SaveShops();
return element.GetViewModel;
}
return null;
}
public bool IsEnoughSushi(ISushiModel model, int count)
{
int temp = source.Shops
.Select(x => x.ListSushi.FirstOrDefault(y => y.Key == model.Id).Value.Item2).Sum();
return temp >= count;
}
public bool SellSushi(ISushiModel model, int count)
{
if (!IsEnoughSushi(model, count))
{
return false;
}
foreach (var shop in source.Shops.Where(x => x.ListSushi.ContainsKey(model.Id)))
{
int countInCurrentShop = shop.ListSushi[model.Id].Item2;
if (countInCurrentShop <= count)
{
shop.ListSushi[model.Id] = (shop.ListSushi[model.Id].Item1, 0);
count -= countInCurrentShop;
}
else
{
shop.ListSushi[model.Id] = (shop.ListSushi[model.Id].Item1, countInCurrentShop - count);
count = 0;
}
if (count == 0)
{
return true;
}
}
return false;
}
}
}

View File

@ -2,7 +2,9 @@
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.StoragesContracts; using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;
using SushiBarFileImplement.Models; using SushiBarFileImplement.Models;
using System.Reflection;
namespace SushiBarFileImplement.Implements namespace SushiBarFileImplement.Implements
{ {
@ -70,5 +72,40 @@ namespace SushiBarFileImplement.Implements
} }
return null; return null;
} }
public bool HasSushi(ISushiModel sushi, int needCount)
{
var temp = source.Shops
.Select(x => x.ListSushi
.FirstOrDefault(x => x.Key == sushi.Id).Value.Item2).Sum();
return temp >= needCount;
}
public bool SellSushi(ISushiModel model, int count)
{
if (!HasSushi(model, count))
{
return false;
}
foreach (var shop in source.Shops.Where(x => x.ListSushi.ContainsKey(model.Id)))
{
if (shop.ListSushi[model.Id].Item2 < count)
{
shop.ListSushi[model.Id] = (shop.ListSushi[model.Id].Item1, 0);
count -= shop.ListSushi[model.Id].Item2;
}
else
{
shop.ListSushi[model.Id] = (shop.ListSushi[model.Id].Item1,
shop.ListSushi[model.Id].Item2 - count);
count -= count;
}
if (count <= 0)
{
return true;
}
}
return true;
}
} }
} }

View File

@ -0,0 +1,107 @@

using SushiBarContracts.BindingModels;
using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models;
using System.Reflection.Metadata;
using System.Xml.Linq;
namespace SushiBarFileImplement.Models
{
public class Shop : IShopModel
{
public int Id { get; private set; }
public string ShopName { get; private set; } = string.Empty;
public string Address { get; private set; } = string.Empty;
public DateTime DateOpening { get; private set; }
public int MaxCountSushi { get; private set; }
public Dictionary<int, int> CountSushi
{
get;
private set;
} = new();
private Dictionary<int, (ISushiModel, int)>? _shopSushi = null;
public Dictionary<int, (ISushiModel, int)> ListSushi
{
get
{
if (_shopSushi == null)
{
var source = DataFileSingleton.GetInstance();
_shopSushi =
CountSushi.ToDictionary(x => x.Key,
y => ((source.ListSushi.FirstOrDefault(z => z.Id == y.Key) as ISushiModel)!, y.Value));
}
return _shopSushi;
}
}
public static Shop? Create(ShopBindingModel? model)
{
if (model == null)
{
return null;
}
return new Shop()
{
Id = model.Id,
ShopName = model.ShopName,
Address = model.Address,
MaxCountSushi = model.MaxCountSushi,
DateOpening = model.DateOpening,
CountSushi = model.ListSushi.ToDictionary(x => x.Key, x => x.Value.Item2)
};
}
public static Shop? Create(XElement element)
{
if (element == null)
{
return null;
}
return new()
{
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
ShopName = element.Element("ShopName")!.Value,
Address = element.Element("Address")!.Value,
DateOpening = Convert.ToDateTime(element.Element("DateOpening")!.Value),
MaxCountSushi = Convert.ToInt32(element.Element("MaxCountSushi")!.Value),
CountSushi = element.Element("ListSushi")!.Elements("Sushi").ToDictionary(
x => Convert.ToInt32(x.Element("Key")?.Value),
x => Convert.ToInt32(x.Element("Value")?.Value))
};
}
public void Update(ShopBindingModel? model)
{
if (model == null)
{
return;
}
ShopName = model.ShopName;
Address = model.Address;
DateOpening = model.DateOpening;
MaxCountSushi = model.MaxCountSushi;
CountSushi = model.ListSushi.ToDictionary(x => x.Key, x => x.Value.Item2);
_shopSushi = null;
}
public ShopViewModel GetViewModel => new()
{
Id = Id,
ShopName = ShopName,
Address = Address,
ListSushi = ListSushi,
DateOpening = DateOpening,
MaxCountSushi = MaxCountSushi,
};
public XElement GetXElement => new("Shop",
new XAttribute("Id", Id),
new XElement("ShopName", ShopName),
new XElement("Address", Address),
new XElement("DateOpening", DateOpening),
new XElement("MaxCountSushi", MaxCountSushi),
new XElement("ListSushi", CountSushi
.Select(x => new XElement("Sushi",
new XElement("Key", x.Key),
new XElement("Value", x.Value))
).ToArray()));
}
}

View File

@ -1,6 +1,6 @@
using SushiBarListImplement.Models; using SushiBarFileImplement.Models;
namespace SushiBarListImplement namespace SushiBarFileImplement
{ {
public class DataListSingleton public class DataListSingleton
{ {

View File

@ -2,9 +2,9 @@
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.StoragesContracts; using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarListImplement.Models; using SushiBarFileImplement.Models;
namespace SushiBarListImplement.Implements namespace SushiBarFileImplement.Implements
{ {
public class IngredientStorage : IIngredientStorage public class IngredientStorage : IIngredientStorage
{ {

View File

@ -2,9 +2,9 @@
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.StoragesContracts; using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarListImplement.Models; using SushiBarFileImplement.Models;
namespace SushiBarListImplement.Implements namespace SushiBarFileImplement.Implements
{ {
public class OrderStorage : IOrderStorage public class OrderStorage : IOrderStorage
{ {

View File

@ -2,9 +2,10 @@
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.StoragesContracts; using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarListImplement.Models; using SushiBarDataModels.Models;
using SushiBarFileImplement.Models;
namespace SushiBarListImplement.Implements namespace SushiBarFileImplement.Implements
{ {
public class ShopStorage : IShopStorage public class ShopStorage : IShopStorage
{ {
@ -98,5 +99,15 @@ namespace SushiBarListImplement.Implements
} }
return null; return null;
} }
public bool IsEnoughSushi(ISushiModel model, int count)
{
throw new NotImplementedException();
}
public bool SellSushi(ISushiModel model, int count)
{
throw new NotImplementedException();
}
} }
} }

View File

@ -2,9 +2,10 @@
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarContracts.StoragesContracts; using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarListImplement.Models; using SushiBarDataModels.Models;
using SushiBarFileImplement.Models;
namespace SushiBarListImplement.Implements namespace SushiBarFileImplement.Implements
{ {
public class SushiStorage : ISushiStorage public class SushiStorage : ISushiStorage
{ {
@ -98,5 +99,15 @@ namespace SushiBarListImplement.Implements
} }
return null; return null;
} }
public bool HasSushi(ISushiModel model, int needCount)
{
throw new NotImplementedException();
}
public bool SellSushi(ISushiModel model, int count)
{
throw new NotImplementedException();
}
} }
} }

View File

@ -2,7 +2,7 @@
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
namespace SushiBarListImplement.Models namespace SushiBarFileImplement.Models
{ {
public class Ingredient : IIngredientModel public class Ingredient : IIngredientModel
{ {

View File

@ -3,7 +3,7 @@ using SushiBarContracts.ViewModels;
using SushiBarDataModels.Enums; using SushiBarDataModels.Enums;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
namespace SushiBarListImplement.Models namespace SushiBarFileImplement.Models
{ {
public class Order : IOrderModel public class Order : IOrderModel
{ {

View File

@ -2,7 +2,7 @@
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
namespace SushiBarListImplement.Models namespace SushiBarFileImplement.Models
{ {
public class Shop : IShopModel public class Shop : IShopModel
{ {
@ -49,5 +49,7 @@ namespace SushiBarListImplement.Models
ListSushi = ListSushi, ListSushi = ListSushi,
DateOpening = DateOpening, DateOpening = DateOpening,
}; };
public int MaxCountSushi => throw new NotImplementedException();
} }
} }

View File

@ -2,7 +2,7 @@
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
namespace SushiBarListImplement.Models namespace SushiBarFileImplement.Models
{ {
public class Sushi : ISushiModel public class Sushi : ISushiModel
{ {