This commit is contained in:
nikitosPapirosss 2024-11-26 12:36:41 +04:00
parent 79887edefa
commit b5069c8ec3
52 changed files with 3456 additions and 69 deletions

View File

@ -0,0 +1,25 @@
using OpticStore.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities
{
public class Component
{
public int Id { get; private set; }
public string ComponentName { get; private set; } = string.Empty;
public ComponentCategory ComponentCategory { get; private set; }
public static Component CreateEntity(int id, string componentName, ComponentCategory componentCategory)
{
return new Component
{
Id = id,
ComponentName = componentName ?? string.Empty,
ComponentCategory = componentCategory
};
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities.Enums
{
public enum ComponentCategory
{
none = 0,
lenses = 1,
Case = 2,
frames = 3
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities.Enums
{
public enum OrderStatus
{
none = 0,
completed = 1,
inProgress = 2,
}
}

View File

@ -0,0 +1,31 @@
using Microsoft.VisualBasic.FileIO;
using OpticStore.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities
{
public class Order
{
public int Id { get; private set; }
public int StoreId { get; private set; }
public DateTime OrderDate { get; private set; }
public OrderStatus OrderStatus { get; private set; }
public IEnumerable <OrderComponent> OrderComponent {get;private set;} = new List<OrderComponent>();
public static Order CreateOperation(int id,int storeId,OrderStatus orderStatus, IEnumerable<OrderComponent> orderComponent)
{
return new Order
{
Id = id,
StoreId = storeId,
OrderDate = DateTime.Now,
OrderStatus = orderStatus,
OrderComponent = orderComponent
};
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities
{
public class OrderComponent
{
public int Id { get; private set; }
public int ComponentId { get; private set; }
public int Count { get; private set; }
public static OrderComponent CreateElement(int id, int componentId,int count)
{
return new OrderComponent
{
Id = id,
ComponentId = componentId,
Count = count
};
}
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities
{
public class Shipment
{
public int Id { get; private set; }
public int StoreId { get; private set; }
public DateTime ShipmentDate { get; private set; }
public int Amount { get; private set; }
public IEnumerable<ShipmentComponent> ShipmentComponent { get; private set; } = new List<ShipmentComponent>();
public static Shipment CreateOperation(int id,int storeId, int amount, IEnumerable<ShipmentComponent> shipmentComponent)
{
return new Shipment
{
Id = id,
StoreId = storeId,
ShipmentDate=DateTime.Now,
Amount = amount,
ShipmentComponent = shipmentComponent
};
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities
{
public class ShipmentComponent
{
public int Id { get; private set; }
public int ComponentId { get; private set; }
public int Count { get; private set; }
public static ShipmentComponent CreateElement(int id, int componentId,int count)
{
return new ShipmentComponent
{
Id = id,
ComponentId = componentId,
Count = count
};
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Entities
{
public class Store
{
public int Id { get; private set; }
public string storeName { get; private set; } = string.Empty;
public string storeAdress { get; private set; } = string.Empty;
public string phoneNumber { get; private set; } = string.Empty;
public static Store CreateEntity(int id, string name, string
adress, string phone)
{
return new Store
{
Id = id,
storeName = name ?? string.Empty,
storeAdress = adress ?? string.Empty,
phoneNumber = phone ?? string.Empty
};
}
}
}

View File

@ -1,6 +1,6 @@
namespace OpticStore
{
partial class Form1
partial class FormOptic
{
/// <summary>
/// Required designer variable.
@ -28,12 +28,112 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.CatalogsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.StoresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OperationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ShipmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.CatalogsToolStripMenuItem,
this.OperationsToolStripMenuItem,
this.отчётыToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(800, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// CatalogsToolStripMenuItem
//
this.CatalogsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.StoresToolStripMenuItem,
this.ComponentsToolStripMenuItem});
this.CatalogsToolStripMenuItem.Name = "CatalogsToolStripMenuItem";
this.CatalogsToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
this.CatalogsToolStripMenuItem.Text = "Справочники";
this.CatalogsToolStripMenuItem.Click += new System.EventHandler(this.CatalogsToolStripMenuItem_Click);
//
// StoresToolStripMenuItem
//
this.StoresToolStripMenuItem.Name = "StoresToolStripMenuItem";
this.StoresToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.StoresToolStripMenuItem.Text = "Магазины Оптики";
this.StoresToolStripMenuItem.Click += new System.EventHandler(this.StoresToolStripMenuItem_Click);
//
// ComponentsToolStripMenuItem
//
this.ComponentsToolStripMenuItem.Name = "ComponentsToolStripMenuItem";
this.ComponentsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.ComponentsToolStripMenuItem.Text = "Компоненты";
this.ComponentsToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
//
// OperationsToolStripMenuItem
//
this.OperationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.OrdersToolStripMenuItem,
this.ShipmentsToolStripMenuItem});
this.OperationsToolStripMenuItem.Name = "OperationsToolStripMenuItem";
this.OperationsToolStripMenuItem.Size = new System.Drawing.Size(75, 20);
this.OperationsToolStripMenuItem.Text = "Операции";
this.OperationsToolStripMenuItem.Click += new System.EventHandler(this.OperationsToolStripMenuItem_Click);
//
// OrdersToolStripMenuItem
//
this.OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
this.OrdersToolStripMenuItem.Size = new System.Drawing.Size(126, 22);
this.OrdersToolStripMenuItem.Text = "Заказы";
this.OrdersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// ShipmentsToolStripMenuItem
//
this.ShipmentsToolStripMenuItem.Name = "ShipmentsToolStripMenuItem";
this.ShipmentsToolStripMenuItem.Size = new System.Drawing.Size(126, 22);
this.ShipmentsToolStripMenuItem.Text = "Поставки";
this.ShipmentsToolStripMenuItem.Click += new System.EventHandler(this.ShipmentsToolStripMenuItem_Click);
//
// отчётыToolStripMenuItem
//
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчётыToolStripMenuItem.Text = "Отчёты";
this.отчётыToolStripMenuItem.Click += new System.EventHandler(this.отчётыToolStripMenuItem_Click);
//
// FormOptic
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::OpticStore.Properties.Resources.rainbow;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "FormOptic";
this.Text = "Оптика";
this.Load += new System.EventHandler(this.FormOptic_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem CatalogsToolStripMenuItem;
private ToolStripMenuItem StoresToolStripMenuItem;
private ToolStripMenuItem ComponentsToolStripMenuItem;
private ToolStripMenuItem OperationsToolStripMenuItem;
private ToolStripMenuItem OrdersToolStripMenuItem;
private ToolStripMenuItem ShipmentsToolStripMenuItem;
private ToolStripMenuItem отчётыToolStripMenuItem;
}
}

View File

@ -1,10 +1,108 @@
using OpticStore.Forms;
using Unity;
namespace OpticStore
{
public partial class Form1 : Form
public partial class FormOptic : Form
{
public Form1()
private readonly IUnityContainer _container;
public FormOptic(IUnityContainer container)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
}
private void StoresToolStripMenuItem_Click(object sender,
EventArgs e)
{
try
{
_container.Resolve<FormStores>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs
e)
{
try
{
_container.Resolve<FormComponents>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormOrders>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ShipmentsToolStripMenuItem_Click(object sender,
EventArgs e)
{
try
{
_container.Resolve<FormShipments>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormOptic_Load(object sender, EventArgs e)
{
}
private void îò÷¸òûToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void ComponentsToolStripMenuItem_Click_1(object sender, EventArgs e)
{
}
private void OrdersToolStripMenuItem_Click_1(object sender, EventArgs e)
{
}
private void ShipmentsToolStripMenuItem_Click_1(object sender, EventArgs e)
{
}
private void OperationsToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void CatalogsToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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">
@ -117,4 +57,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,125 @@
namespace OpticStore.Forms
{
partial class FormComponent
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBoxComponentName = new System.Windows.Forms.TextBox();
this.comboBoxCategory = new System.Windows.Forms.ComboBox();
this.ButtonSave = new System.Windows.Forms.Button();
this.ButtonCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(37, 46);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(129, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Название компонента";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(37, 110);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(63, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Категория";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// textBoxComponentName
//
this.textBoxComponentName.Location = new System.Drawing.Point(210, 46);
this.textBoxComponentName.Name = "textBoxComponentName";
this.textBoxComponentName.Size = new System.Drawing.Size(215, 23);
this.textBoxComponentName.TabIndex = 2;
this.textBoxComponentName.TextChanged += new System.EventHandler(this.textBoxComponentName_TextChanged);
//
// comboBoxCategory
//
this.comboBoxCategory.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxCategory.FormattingEnabled = true;
this.comboBoxCategory.Location = new System.Drawing.Point(210, 107);
this.comboBoxCategory.Name = "comboBoxCategory";
this.comboBoxCategory.Size = new System.Drawing.Size(215, 23);
this.comboBoxCategory.TabIndex = 3;
this.comboBoxCategory.SelectedIndexChanged += new System.EventHandler(this.comboBoxCategory_SelectedIndexChanged);
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(37, 182);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
this.ButtonSave.TabIndex = 4;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(350, 182);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
this.ButtonCancel.TabIndex = 5;
this.ButtonCancel.Text = "Отменить";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// FormComponent
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(478, 260);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.comboBoxCategory);
this.Controls.Add(this.textBoxComponentName);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "FormComponent";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Компонент";
this.Load += new System.EventHandler(this.FormComponent_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label label1;
private Label label2;
private TextBox textBoxComponentName;
private ComboBox comboBoxCategory;
private Button ButtonSave;
private Button ButtonCancel;
}
}

View File

@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpticStore.Repositories;
using OpticStore.Entities.Enums;
using OpticStore.Entities;
namespace OpticStore.Forms
{
public partial class FormComponent : Form
{
private readonly IComponentRepository _componentRepository;
private int? _componentId;
public int Id
{
set
{
try
{
var component =
_componentRepository.ReadComponentById(value);
if (component == null)
{
throw new
InvalidDataException(nameof(component));
}
textBoxComponentName.Text = component.ComponentName;
comboBoxCategory.SelectedItem =
component.ComponentCategory;
_componentId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при полученииданных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormComponent(IComponentRepository componentRepository)
{
InitializeComponent();
_componentRepository = componentRepository ??
throw new
ArgumentNullException(nameof(componentRepository));
comboBoxCategory.DataSource =
Enum.GetValues(typeof(ComponentCategory));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textBoxComponentName.Text)
||
comboBoxCategory.SelectedIndex < 1)
{
throw new Exception("Имеются незаполненные поля");
}
if (_componentId.HasValue)
{
_componentRepository.UpdateComponent(CreateComponent(_componentId.Value));
}
else
{
_componentRepository.CreateComponent(CreateComponent(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) =>Close();
private Component CreateComponent(int id) =>
Component.CreateEntity(id, textBoxComponentName.Text,
(ComponentCategory)comboBoxCategory.SelectedItem!);
private void label2_Click(object sender, EventArgs e)
{
}
private void FormComponent_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void ButtonCancel_Click_1(object sender, EventArgs e)
{
}
private void comboBoxCategory_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void textBoxComponentName_TextChanged(object sender, EventArgs e)
{
}
}
}

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

@ -0,0 +1,126 @@
namespace OpticStore.Forms
{
partial class FormComponents
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonUpd = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.dataGridViewData = new System.Windows.Forms.DataGridView();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.ButtonDel);
this.panel1.Controls.Add(this.ButtonUpd);
this.panel1.Controls.Add(this.ButtonAdd);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(711, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 507);
this.panel1.TabIndex = 0;
//
// ButtonDel
//
this.ButtonDel.BackgroundImage = global::OpticStore.Properties.Resources.f24a597c2792f7337cd6b93538de629b;
this.ButtonDel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonDel.Location = new System.Drawing.Point(29, 341);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(143, 97);
this.ButtonDel.TabIndex = 2;
this.ButtonDel.UseVisualStyleBackColor = true;
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
//
// ButtonUpd
//
this.ButtonUpd.BackgroundImage = global::OpticStore.Properties.Resources.Antu_qtdesigner_svg;
this.ButtonUpd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonUpd.Location = new System.Drawing.Point(29, 173);
this.ButtonUpd.Name = "ButtonUpd";
this.ButtonUpd.Size = new System.Drawing.Size(143, 97);
this.ButtonUpd.TabIndex = 1;
this.ButtonUpd.UseVisualStyleBackColor = true;
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
//
// ButtonAdd
//
this.ButtonAdd.BackgroundImage = global::OpticStore.Properties.Resources.Fairytale_button_add_svg__1_;
this.ButtonAdd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonAdd.Location = new System.Drawing.Point(27, 12);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(143, 97);
this.ButtonAdd.TabIndex = 0;
this.ButtonAdd.UseVisualStyleBackColor = true;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// dataGridViewData
//
this.dataGridViewData.AllowUserToAddRows = false;
this.dataGridViewData.AllowUserToDeleteRows = false;
this.dataGridViewData.AllowUserToResizeColumns = false;
this.dataGridViewData.AllowUserToResizeRows = false;
this.dataGridViewData.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridViewData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewData.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridViewData.Location = new System.Drawing.Point(0, 0);
this.dataGridViewData.MultiSelect = false;
this.dataGridViewData.Name = "dataGridViewData";
this.dataGridViewData.ReadOnly = true;
this.dataGridViewData.RowHeadersVisible = false;
this.dataGridViewData.RowTemplate.Height = 25;
this.dataGridViewData.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridViewData.Size = new System.Drawing.Size(711, 507);
this.dataGridViewData.TabIndex = 1;
//
// FormComponents
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(911, 507);
this.Controls.Add(this.dataGridViewData);
this.Controls.Add(this.panel1);
this.Name = "FormComponents";
this.Text = "Компоненты";
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button ButtonDel;
private Button ButtonUpd;
private Button ButtonAdd;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,126 @@
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;
using Unity;
using OpticStore.Repositories;
namespace OpticStore.Forms
{
public partial class FormComponents : Form
{
private readonly IUnityContainer _container;
private readonly IComponentRepository _componentRepository;
public FormComponents(IUnityContainer container, IComponentRepository
componentRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_componentRepository = componentRepository ??
throw new
ArgumentNullException(nameof(componentRepository));
}
private void FormComponents_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormComponent>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormComponent>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_componentRepository.DeleteComponent(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource =
_componentRepository.ReadComponents();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewData.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
return true;
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
}
}
}

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

@ -0,0 +1,199 @@
namespace OpticStore.Forms
{
partial class FormOrder
{
/// <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.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.comboBoxStatus = new System.Windows.Forms.ComboBox();
this.dateTimePickerOrderDate = new System.Windows.Forms.DateTimePicker();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dataGridViewComponents = new System.Windows.Forms.DataGridView();
this.ButtonSave = new System.Windows.Forms.Button();
this.ButtonCancel = new System.Windows.Forms.Button();
this.comboBoxStore = new System.Windows.Forms.ComboBox();
this.ColumnCategory = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewComponents)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(86, 44);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Магазин";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(86, 98);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Дата заказа";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(86, 152);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 15);
this.label3.TabIndex = 2;
this.label3.Text = "Статус заказа";
//
// comboBoxStatus
//
this.comboBoxStatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxStatus.FormattingEnabled = true;
this.comboBoxStatus.Location = new System.Drawing.Point(182, 149);
this.comboBoxStatus.Name = "comboBoxStatus";
this.comboBoxStatus.Size = new System.Drawing.Size(200, 23);
this.comboBoxStatus.TabIndex = 4;
this.comboBoxStatus.SelectedIndexChanged += new System.EventHandler(this.comboBoxStatus_SelectedIndexChanged);
//
// dateTimePickerOrderDate
//
this.dateTimePickerOrderDate.Enabled = false;
this.dateTimePickerOrderDate.Location = new System.Drawing.Point(182, 98);
this.dateTimePickerOrderDate.Name = "dateTimePickerOrderDate";
this.dateTimePickerOrderDate.Size = new System.Drawing.Size(200, 23);
this.dateTimePickerOrderDate.TabIndex = 5;
this.dateTimePickerOrderDate.ValueChanged += new System.EventHandler(this.dateTimePickerDateReceipt_ValueChanged);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.dataGridViewComponents);
this.groupBox1.Location = new System.Drawing.Point(118, 202);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(247, 185);
this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Компоненты";
//
// dataGridViewComponents
//
this.dataGridViewComponents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewComponents.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ColumnCategory,
this.ColumnCount});
this.dataGridViewComponents.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridViewComponents.Location = new System.Drawing.Point(3, 19);
this.dataGridViewComponents.Name = "dataGridViewComponents";
this.dataGridViewComponents.RowTemplate.Height = 25;
this.dataGridViewComponents.Size = new System.Drawing.Size(241, 163);
this.dataGridViewComponents.TabIndex = 0;
this.dataGridViewComponents.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(91, 426);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
this.ButtonSave.TabIndex = 7;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(304, 426);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
this.ButtonCancel.TabIndex = 8;
this.ButtonCancel.Text = "Отменить";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// comboBoxStore
//
this.comboBoxStore.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxStore.FormattingEnabled = true;
this.comboBoxStore.Location = new System.Drawing.Point(182, 44);
this.comboBoxStore.Name = "comboBoxStore";
this.comboBoxStore.Size = new System.Drawing.Size(197, 23);
this.comboBoxStore.TabIndex = 9;
this.comboBoxStore.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// ColumnCategory
//
this.ColumnCategory.HeaderText = "Категория";
this.ColumnCategory.Name = "ColumnCategory";
//
// ColumnCount
//
this.ColumnCount.HeaderText = "Количество";
this.ColumnCount.Name = "ColumnCount";
this.ColumnCount.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.ColumnCount.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// FormOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(479, 461);
this.Controls.Add(this.comboBoxStore);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.dateTimePickerOrderDate);
this.Controls.Add(this.comboBoxStatus);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "FormOrder";
this.Text = "Заказ";
this.Load += new System.EventHandler(this.FormOrder_Load_1);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridViewComponents)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label label1;
private Label label2;
private Label label3;
private ComboBox comboBoxStatus;
private DateTimePicker dateTimePickerOrderDate;
private GroupBox groupBox1;
private DataGridView dataGridViewComponents;
private Button ButtonSave;
private Button ButtonCancel;
private ComboBox comboBoxStore;
private DataGridViewComboBoxColumn ColumnCategory;
private DataGridViewTextBoxColumn ColumnCount;
}
}

View File

@ -0,0 +1,116 @@
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;
using OpticStore.Repositories;
using OpticStore.Entities;
using OpticStore.Repositories.Implementations;
using OpticStore.Entities.Enums;
namespace OpticStore.Forms
{
public partial class FormOrder : Form
{
private readonly IOrderRepository _orderRepository;
public FormOrder(IOrderRepository
orderRepository,
IStoreRepository storeRepository,
IComponentRepository componentRepository)
{
InitializeComponent();
_orderRepository = orderRepository ??
throw new
ArgumentNullException(nameof(orderRepository));
comboBoxStore.DataSource = storeRepository.ReadStores();
comboBoxStore.DisplayMember = "storeName";
comboBoxStore.ValueMember = "Id";
comboBoxStatus.DataSource = orderRepository.ReadOrder();
comboBoxStatus.DisplayMember = "OrderStatus";
comboBoxStatus.ValueMember = "Id";
ColumnCategory.DataSource = componentRepository.ReadComponents();
ColumnCategory.DisplayMember = "ComponentName";
ColumnCategory.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (dataGridViewComponents.RowCount < 1 ||
comboBoxStore.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненныеполя");
}
_orderRepository.CreateOrder(Order.CreateOperation(0,
(int)comboBoxStore.SelectedValue!, (OrderStatus)comboBoxStatus.SelectedValue!,
CreateListOrderComponentFromDataGrid()));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) =>
Close();
private List<OrderComponent>
CreateListOrderComponentFromDataGrid()
{
var list = new List<OrderComponent>();
foreach (DataGridViewRow row in dataGridViewComponents.Rows)
{
if (row.Cells["ColumnCategory"].Value == null ||
row.Cells["ColumnComponent"].Value == null)
{
continue;
}
list.Add(OrderComponent.CreateElement(0,
Convert.ToInt32(row.Cells["ColumnComponent"].Value), Convert.ToInt32(row.Cells["ColumnCount"].Value)));
}
return list;
}
private void label2_Click(object sender, EventArgs e)
{
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void FormOrder_Load(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void dateTimePickerDateReceipt_ValueChanged(object sender, EventArgs e)
{
}
private void comboBoxStatus_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void FormOrder_Load_1(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,66 @@
<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>
<metadata name="ColumnCategory.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,107 @@
namespace OpticStore.Forms
{
partial class FormOrders
{
/// <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.panel1 = new System.Windows.Forms.Panel();
this.ButtonAdd = new System.Windows.Forms.Button();
this.ButtonDel = new System.Windows.Forms.Button();
this.dataGridViewData = new System.Windows.Forms.DataGridView();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.ButtonAdd);
this.panel1.Controls.Add(this.ButtonDel);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(600, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 450);
this.panel1.TabIndex = 0;
//
// ButtonAdd
//
this.ButtonAdd.BackgroundImage = global::OpticStore.Properties.Resources.Fairytale_button_add_svg__1_;
this.ButtonAdd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonAdd.Location = new System.Drawing.Point(40, 74);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(148, 78);
this.ButtonAdd.TabIndex = 4;
this.ButtonAdd.UseVisualStyleBackColor = true;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// ButtonDel
//
this.ButtonDel.BackgroundImage = global::OpticStore.Properties.Resources.f24a597c2792f7337cd6b93538de629b;
this.ButtonDel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonDel.Location = new System.Drawing.Point(40, 267);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(148, 78);
this.ButtonDel.TabIndex = 3;
this.ButtonDel.UseVisualStyleBackColor = true;
this.ButtonDel.Click += new System.EventHandler(this.button2_Click);
//
// dataGridViewData
//
this.dataGridViewData.AllowUserToAddRows = false;
this.dataGridViewData.AllowUserToDeleteRows = false;
this.dataGridViewData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewData.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridViewData.Location = new System.Drawing.Point(0, 0);
this.dataGridViewData.Name = "dataGridViewData";
this.dataGridViewData.ReadOnly = true;
this.dataGridViewData.RowTemplate.Height = 25;
this.dataGridViewData.Size = new System.Drawing.Size(600, 450);
this.dataGridViewData.TabIndex = 1;
this.dataGridViewData.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewData_CellContentClick);
//
// FormOrders
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.dataGridViewData);
this.Controls.Add(this.panel1);
this.Name = "FormOrders";
this.Text = "Заказы";
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button ButtonAdd;
private Button ButtonDel;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,115 @@
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;
using Unity;
using OpticStore.Repositories;
namespace OpticStore.Forms
{
public partial class FormOrders : Form
{
private readonly IUnityContainer _container;
private readonly IOrderRepository
_orderRepository;
public FormOrders(IUnityContainer container,
IOrderRepository orderRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_orderRepository = orderRepository ??
throw new
ArgumentNullException(nameof(orderRepository));
}
private void FormOrders_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormOrder>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_orderRepository.DeleteOrder(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource =
_orderRepository.ReadOrder();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewData.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
return true;
}
private void button2_Click(object sender, EventArgs e)
{
}
private void FormOrders_Load_1(object sender, EventArgs e)
{
}
private void dataGridViewData_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}

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

@ -0,0 +1,196 @@
namespace OpticStore.Forms
{
partial class FormShipment
{
/// <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.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dataGridViewComponents = new System.Windows.Forms.DataGridView();
this.ColumnCategory = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ButtonSave = new System.Windows.Forms.Button();
this.ButtonCancel = new System.Windows.Forms.Button();
this.comboBoxStore = new System.Windows.Forms.ComboBox();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.numericUpDownCount = new System.Windows.Forms.NumericUpDown();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewComponents)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(121, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Магазин";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(121, 77);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(85, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Дата поставки";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(107, 127);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(95, 15);
this.label3.TabIndex = 2;
this.label3.Text = "Число поставок";
this.label3.Click += new System.EventHandler(this.label3_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.dataGridViewComponents);
this.groupBox1.Location = new System.Drawing.Point(161, 171);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(246, 173);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Компоненты";
//
// dataGridViewComponents
//
this.dataGridViewComponents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewComponents.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ColumnCategory,
this.ColumnCount});
this.dataGridViewComponents.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridViewComponents.Location = new System.Drawing.Point(3, 19);
this.dataGridViewComponents.Name = "dataGridViewComponents";
this.dataGridViewComponents.RowTemplate.Height = 25;
this.dataGridViewComponents.Size = new System.Drawing.Size(240, 151);
this.dataGridViewComponents.TabIndex = 0;
this.dataGridViewComponents.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewComponents_CellContentClick);
//
// ColumnCategory
//
this.ColumnCategory.HeaderText = "Категория";
this.ColumnCategory.Name = "ColumnCategory";
//
// ColumnCount
//
this.ColumnCount.HeaderText = "Количество";
this.ColumnCount.Name = "ColumnCount";
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(121, 383);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
this.ButtonSave.TabIndex = 0;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(358, 383);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
this.ButtonCancel.TabIndex = 4;
this.ButtonCancel.Text = "Отменить";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// comboBoxStore
//
this.comboBoxStore.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxStore.FormattingEnabled = true;
this.comboBoxStore.Location = new System.Drawing.Point(233, 25);
this.comboBoxStore.Name = "comboBoxStore";
this.comboBoxStore.Size = new System.Drawing.Size(200, 23);
this.comboBoxStore.TabIndex = 5;
//
// dateTimePicker1
//
this.dateTimePicker1.Enabled = false;
this.dateTimePicker1.Location = new System.Drawing.Point(233, 77);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(200, 23);
this.dateTimePicker1.TabIndex = 6;
this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
//
// numericUpDownCount
//
this.numericUpDownCount.Location = new System.Drawing.Point(233, 125);
this.numericUpDownCount.Name = "numericUpDownCount";
this.numericUpDownCount.Size = new System.Drawing.Size(200, 23);
this.numericUpDownCount.TabIndex = 8;
this.numericUpDownCount.ValueChanged += new System.EventHandler(this.numericUpDownCount_ValueChanged);
//
// FormShipment
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(605, 432);
this.Controls.Add(this.numericUpDownCount);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.comboBoxStore);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "FormShipment";
this.Text = "Поставка";
this.Load += new System.EventHandler(this.FormShipment_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridViewComponents)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label label1;
private Label label2;
private Label label3;
private GroupBox groupBox1;
private Button ButtonSave;
private Button ButtonCancel;
private ComboBox comboBoxStore;
private DateTimePicker dateTimePicker1;
private DataGridView dataGridViewComponents;
private NumericUpDown numericUpDownCount;
private DataGridViewComboBoxColumn ColumnCategory;
private DataGridViewTextBoxColumn ColumnCount;
}
}

View File

@ -0,0 +1,116 @@
using OpticStore.Entities.Enums;
using OpticStore.Entities;
using OpticStore.Repositories;
using OpticStore.Repositories.Implementations;
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;
using System.Windows.Forms.VisualStyles;
namespace OpticStore.Forms
{
public partial class FormShipment : Form
{
private readonly IShipmentRepository _shipmentRepository;
public FormShipment(IShipmentRepository
shipmentRepository,
IStoreRepository storeRepository,
IComponentRepository componentRepository)
{
InitializeComponent();
_shipmentRepository = shipmentRepository ??
throw new
ArgumentNullException(nameof(shipmentRepository));
comboBoxStore.DataSource = storeRepository.ReadStores();
comboBoxStore.DisplayMember = "storeName";
comboBoxStore.ValueMember = "Id";
ColumnCategory.DataSource = componentRepository.ReadComponents();
ColumnCategory.DisplayMember = "ComponentName";
ColumnCategory.ValueMember = "Id";
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (dataGridViewComponents.RowCount < 1 ||
comboBoxStore.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненныеполя");
}
_shipmentRepository.CreateShipment(Shipment.CreateOperation(0,
(int)comboBoxStore.SelectedValue!, Convert.ToInt32(numericUpDownCount.Value),
CreateListOrderComponentFromDataGrid()));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) =>
Close();
private List<ShipmentComponent>
CreateListOrderComponentFromDataGrid()
{
var list = new List<ShipmentComponent>();
foreach (DataGridViewRow row in dataGridViewComponents.Rows)
{
if (row.Cells["ColumnCategory"].Value == null ||
row.Cells["ColumnCount"].Value == null)
{
continue;
}
list.Add(ShipmentComponent.CreateElement(0, Convert.ToInt32(row.Cells["ColumnCategory"].Value),
Convert.ToInt32(row.Cells["ColumnCount"].Value)));
}
return list;
}
private void FormShipment_Load(object sender, EventArgs e)
{
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void numericUpDownCount_ValueChanged(object sender, EventArgs e)
{
}
private void ButtonSave_Click_1(object sender, EventArgs e)
{
}
private void ButtonCancel_Click_1(object sender, EventArgs e)
{
}
private void dataGridViewComponents_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,72 @@
<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>
<metadata name="ColumnCategory.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCategory.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,106 @@
namespace OpticStore.Forms
{
partial class FormShipments
{
/// <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.panel1 = new System.Windows.Forms.Panel();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.dataGridViewData = new System.Windows.Forms.DataGridView();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.ButtonDel);
this.panel1.Controls.Add(this.ButtonAdd);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(600, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 450);
this.panel1.TabIndex = 0;
//
// ButtonDel
//
this.ButtonDel.BackgroundImage = global::OpticStore.Properties.Resources.f24a597c2792f7337cd6b93538de629b;
this.ButtonDel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonDel.Location = new System.Drawing.Point(33, 256);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(155, 157);
this.ButtonDel.TabIndex = 4;
this.ButtonDel.UseVisualStyleBackColor = true;
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
//
// ButtonAdd
//
this.ButtonAdd.BackgroundImage = global::OpticStore.Properties.Resources.Fairytale_button_add_svg__1_;
this.ButtonAdd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonAdd.Location = new System.Drawing.Point(33, 47);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(155, 157);
this.ButtonAdd.TabIndex = 3;
this.ButtonAdd.UseVisualStyleBackColor = true;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// dataGridViewData
//
this.dataGridViewData.AllowUserToAddRows = false;
this.dataGridViewData.AllowUserToDeleteRows = false;
this.dataGridViewData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewData.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridViewData.Location = new System.Drawing.Point(0, 0);
this.dataGridViewData.Name = "dataGridViewData";
this.dataGridViewData.ReadOnly = true;
this.dataGridViewData.RowTemplate.Height = 25;
this.dataGridViewData.Size = new System.Drawing.Size(600, 450);
this.dataGridViewData.TabIndex = 1;
//
// FormShipments
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.dataGridViewData);
this.Controls.Add(this.panel1);
this.Name = "FormShipments";
this.Text = "Поставки";
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button ButtonDel;
private Button ButtonAdd;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,113 @@
using OpticStore.Repositories;
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;
using Unity;
namespace OpticStore.Forms
{
public partial class FormShipments : Form
{
private readonly IUnityContainer _container;
private readonly IShipmentRepository
_shipmentRepository;
public FormShipments(IUnityContainer container,
IShipmentRepository shipmentRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_shipmentRepository = shipmentRepository ??
throw new
ArgumentNullException(nameof(shipmentRepository));
}
private void FormShipments_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormShipment>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_shipmentRepository.DeleteShipment(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource =
_shipmentRepository.ReadShipment();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewData.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
return true;
}
private void flowLayoutPanel1_Paint(object sender, PaintEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void ButtonAdd_Click_1(object sender, EventArgs e)
{
}
private void ButtonDel_Click_1(object sender, EventArgs e)
{
}
}
}

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

@ -0,0 +1,147 @@
namespace OpticStore.Forms
{
partial class FormStore
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textStoreName = new System.Windows.Forms.TextBox();
this.textStoreAdress = new System.Windows.Forms.TextBox();
this.textPhoneNumber = new System.Windows.Forms.TextBox();
this.ButtonSave = new System.Windows.Forms.Button();
this.ButtonCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(43, 53);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(113, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Название магазина";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(43, 122);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(100, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Адресс магазина";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(43, 193);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 15);
this.label3.TabIndex = 2;
this.label3.Text = "Телефон магазина";
this.label3.Click += new System.EventHandler(this.label3_Click);
//
// textStoreName
//
this.textStoreName.Location = new System.Drawing.Point(157, 53);
this.textStoreName.Name = "textStoreName";
this.textStoreName.Size = new System.Drawing.Size(253, 23);
this.textStoreName.TabIndex = 3;
this.textStoreName.TextChanged += new System.EventHandler(this.textStoreName_TextChanged);
//
// textStoreAdress
//
this.textStoreAdress.Location = new System.Drawing.Point(157, 122);
this.textStoreAdress.Name = "textStoreAdress";
this.textStoreAdress.Size = new System.Drawing.Size(253, 23);
this.textStoreAdress.TabIndex = 4;
//
// textPhoneNumber
//
this.textPhoneNumber.Location = new System.Drawing.Point(158, 190);
this.textPhoneNumber.Name = "textPhoneNumber";
this.textPhoneNumber.Size = new System.Drawing.Size(252, 23);
this.textPhoneNumber.TabIndex = 5;
this.textPhoneNumber.TextChanged += new System.EventHandler(this.textPhoneNumber_TextChanged);
//
// ButtonSave
//
this.ButtonSave.Location = new System.Drawing.Point(43, 267);
this.ButtonSave.Name = "ButtonSave";
this.ButtonSave.Size = new System.Drawing.Size(75, 23);
this.ButtonSave.TabIndex = 6;
this.ButtonSave.Text = "Сохранить";
this.ButtonSave.UseVisualStyleBackColor = true;
this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
//
// ButtonCancel
//
this.ButtonCancel.Location = new System.Drawing.Point(335, 267);
this.ButtonCancel.Name = "ButtonCancel";
this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
this.ButtonCancel.TabIndex = 7;
this.ButtonCancel.Text = "Отмена";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// FormStore
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(467, 323);
this.Controls.Add(this.ButtonCancel);
this.Controls.Add(this.ButtonSave);
this.Controls.Add(this.textPhoneNumber);
this.Controls.Add(this.textStoreAdress);
this.Controls.Add(this.textStoreName);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "FormStore";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Магазин";
this.Load += new System.EventHandler(this.FormStore_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label label1;
private Label label2;
private Label label3;
private TextBox textStoreName;
private TextBox textStoreAdress;
private TextBox textPhoneNumber;
private Button ButtonSave;
private Button ButtonCancel;
}
}

View File

@ -0,0 +1,118 @@
using OpticStore.Repositories;
using OpticStore.Entities;
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 OpticStore.Forms
{
public partial class FormStore : Form
{
private readonly IStoreRepository _storeRepository;
private int? _storeId;
public int Id
{
set
{
try
{
var store =
_storeRepository.ReadStoreById(value);
if (store == null)
{
throw new
InvalidDataException(nameof(store));
}
textStoreName.Text = store.storeName;
textStoreAdress.Text = store.storeAdress;
textPhoneNumber.Text = store.phoneNumber;
_storeId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при полученииданных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormStore(IStoreRepository animalRepository)
{
InitializeComponent();
_storeRepository = animalRepository ??
throw new
ArgumentNullException(nameof(animalRepository));
}
private void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(textPhoneNumber.Text)
||
string.IsNullOrWhiteSpace(textStoreAdress.Text)
||
string.IsNullOrWhiteSpace(textStoreName.Text))
{
throw new Exception("Имеются незаполненные поля");
}
if (_storeId.HasValue)
{
_storeRepository.UpdateStore(CreateStore(_storeId.Value));
}
else
{
_storeRepository.CreateStore(CreateStore(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
private Store CreateStore(int id) => Store.CreateEntity(id, textStoreName.Text, textStoreAdress.Text, textPhoneNumber.Text);
private void label1_Click(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void FormStore_Load(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void textStoreName_TextChanged(object sender, EventArgs e)
{
}
private void FormStore_Load_1(object sender, EventArgs e)
{
}
private void textPhoneNumber_TextChanged(object sender, EventArgs e)
{
}
}
}

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

@ -0,0 +1,132 @@
namespace OpticStore.Forms
{
partial class FormStores
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.ButtonDel = new System.Windows.Forms.Button();
this.ButtonUpd = new System.Windows.Forms.Button();
this.ButtonAdd = new System.Windows.Forms.Button();
this.dataGridViewData = new System.Windows.Forms.DataGridView();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.ButtonDel);
this.panel1.Controls.Add(this.ButtonUpd);
this.panel1.Controls.Add(this.ButtonAdd);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(600, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 450);
this.panel1.TabIndex = 0;
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
//
// ButtonDel
//
this.ButtonDel.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.ButtonDel.BackgroundImage = global::OpticStore.Properties.Resources.f24a597c2792f7337cd6b93538de629b;
this.ButtonDel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonDel.Location = new System.Drawing.Point(50, 325);
this.ButtonDel.Name = "ButtonDel";
this.ButtonDel.Size = new System.Drawing.Size(101, 78);
this.ButtonDel.TabIndex = 2;
this.ButtonDel.UseVisualStyleBackColor = false;
this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
//
// ButtonUpd
//
this.ButtonUpd.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.ButtonUpd.BackgroundImage = global::OpticStore.Properties.Resources.Antu_qtdesigner_svg;
this.ButtonUpd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonUpd.Location = new System.Drawing.Point(50, 182);
this.ButtonUpd.Name = "ButtonUpd";
this.ButtonUpd.Size = new System.Drawing.Size(101, 78);
this.ButtonUpd.TabIndex = 1;
this.ButtonUpd.UseVisualStyleBackColor = false;
this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
//
// ButtonAdd
//
this.ButtonAdd.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.ButtonAdd.BackgroundImage = global::OpticStore.Properties.Resources.Fairytale_button_add_svg__1_;
this.ButtonAdd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonAdd.Location = new System.Drawing.Point(52, 49);
this.ButtonAdd.Name = "ButtonAdd";
this.ButtonAdd.Size = new System.Drawing.Size(101, 78);
this.ButtonAdd.TabIndex = 0;
this.ButtonAdd.UseVisualStyleBackColor = false;
this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
//
// dataGridViewData
//
this.dataGridViewData.AllowUserToAddRows = false;
this.dataGridViewData.AllowUserToDeleteRows = false;
this.dataGridViewData.AllowUserToResizeColumns = false;
this.dataGridViewData.AllowUserToResizeRows = false;
this.dataGridViewData.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridViewData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridViewData.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridViewData.Location = new System.Drawing.Point(0, 0);
this.dataGridViewData.MultiSelect = false;
this.dataGridViewData.Name = "dataGridViewData";
this.dataGridViewData.ReadOnly = true;
this.dataGridViewData.RowHeadersVisible = false;
this.dataGridViewData.RowTemplate.Height = 25;
this.dataGridViewData.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridViewData.Size = new System.Drawing.Size(600, 450);
this.dataGridViewData.TabIndex = 1;
this.dataGridViewData.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
//
// FormStores
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.dataGridViewData);
this.Controls.Add(this.panel1);
this.Name = "FormStores";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Магазины";
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridViewData)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Panel panel1;
private Button ButtonDel;
private Button ButtonUpd;
private Button ButtonAdd;
private DataGridView dataGridViewData;
}
}

View File

@ -0,0 +1,123 @@
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;
using static OpticStore.Forms.FormStores;
using Unity;
using OpticStore.Repositories;
namespace OpticStore.Forms
{
public partial class FormStores : Form
{
private readonly IUnityContainer _container;
private readonly IStoreRepository _storeRepository;
public FormStores(IUnityContainer container, IStoreRepository
storeRepository)
{
InitializeComponent();
_container = container ??
throw new ArgumentNullException(nameof(container));
_storeRepository = storeRepository ??
throw new
ArgumentNullException(nameof(storeRepository));
}
private void FormStores_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormStore>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormStore>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление",
MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_storeRepository.DeleteStore(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource =
_storeRepository.ReadStores();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewData.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
return true;
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
}
}

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

@ -8,4 +8,23 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -1,3 +1,10 @@
using System.Drawing;
using Unity;
using OpticStore.Repositories;
using OpticStore.Repositories.Implementations;
using Unity.Lifetime;
namespace OpticStore
{
internal static class Program
@ -11,7 +18,21 @@ namespace OpticStore
// To customize application configuration such as set high DPIsettings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(CreateContainer().Resolve<FormOptic>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IStoreRepository,
StoreRepository>(new TransientLifetimeManager());
container.RegisterType<IComponentRepository,
ComponentRepository>(new TransientLifetimeManager());
container.RegisterType<IOrderRepository, OrderRepository>(new
TransientLifetimeManager());
container.RegisterType<IShipmentRepository,
ShipmentRepository>(new TransientLifetimeManager());
return container;
}
}
}

View File

@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpticStore.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpticStore.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Antu_qtdesigner_svg {
get {
object obj = ResourceManager.GetObject("Antu_qtdesigner.svg", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap f24a597c2792f7337cd6b93538de629b {
get {
object obj = ResourceManager.GetObject("f24a597c2792f7337cd6b93538de629b", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Fairytale_button_add_svg__1_ {
get {
object obj = ResourceManager.GetObject("Fairytale_button_add.svg (1)", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap gratis_png_iconos_de_la_computadora_boton_de_cancelar {
get {
object obj = ResourceManager.GetObject("gratis-png-iconos-de-la-computadora-boton-de-cancelar", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap rainbow {
get {
object obj = ResourceManager.GetObject("rainbow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="gratis-png-iconos-de-la-computadora-boton-de-cancelar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\gratis-png-iconos-de-la-computadora-boton-de-cancelar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Fairytale_button_add.svg (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Fairytale_button_add.svg (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="f24a597c2792f7337cd6b93538de629b" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\f24a597c2792f7337cd6b93538de629b.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Antu_qtdesigner.svg" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Antu_qtdesigner.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="rainbow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\rainbow.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,18 @@
using OpticStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Repositories
{
public interface IComponentRepository
{
IEnumerable<Component> ReadComponents();
Component ReadComponentById(int id);
void CreateComponent(Component component);
void UpdateComponent(Component component);
void DeleteComponent(int id);
}
}

View File

@ -0,0 +1,17 @@
using OpticStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Repositories
{
public interface IOrderRepository
{
IEnumerable<Order> ReadOrder(DateTime? dateForm = null, DateTime? dateTo = null,
int? componentId = null, int? storeId = null);
void CreateOrder(Order order);
void DeleteOrder(int id);
}
}

View File

@ -0,0 +1,18 @@
using OpticStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Repositories
{
public interface IShipmentRepository
{
IEnumerable<Shipment> ReadShipment(DateTime? dateForm=null, DateTime? dateTo = null,
int? componentId = null, int? storeId = null, int? count = null);
void CreateShipment(Shipment shipment);
void DeleteShipment(int id);
}
}

View File

@ -0,0 +1,18 @@
using OpticStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Repositories
{
public interface IStoreRepository
{
IEnumerable<Store> ReadStores();
Store ReadStoreById(int id);
void CreateStore(Store store);
void UpdateStore(Store store);
void DeleteStore(int id);
}
}

View File

@ -0,0 +1,32 @@
using OpticStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpticStore.Entities.Enums;
namespace OpticStore.Repositories.Implementations
{
internal class ComponentRepository:IComponentRepository
{
private List<Component> components = new List<Component>();
public void CreateComponent(Component component)
{
}
public void DeleteComponent(int id)
{
}
public Component ReadComponentById(int id)
{
return Component.CreateEntity(0, string.Empty, ComponentCategory.none);
}
public IEnumerable<Component> ReadComponents()
{
return components;
}
public void UpdateComponent(Component component)
{
}
}
}

View File

@ -0,0 +1,25 @@
using OpticStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Repositories.Implementations
{
internal class OrderRepository:IOrderRepository
{
private List<Order> orders = new List<Order>();
public void CreateOrder(Order order)
{
}
public void DeleteOrder(int id)
{
}
public IEnumerable<Order> ReadOrder(DateTime? dateForm = null, DateTime? dateTo = null,
int? componentId = null, int? storeId = null)
{
return orders;
}
}
}

View File

@ -0,0 +1,25 @@
using OpticStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Repositories.Implementations
{
internal class ShipmentRepository:IShipmentRepository
{
private List<Shipment> shipments = new List<Shipment>();
public void CreateShipment(Shipment shipment)
{
}
public void DeleteShipment(int id)
{
}
public IEnumerable<Shipment> ReadShipment(DateTime? dateForm = null, DateTime? dateTo = null,
int? componentId = null, int? storeId = null, int? count = null)
{
return shipments;
}
}
}

View File

@ -0,0 +1,32 @@
using OpticStore.Entities;
using OpticStore.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpticStore.Repositories.Implementations
{
internal class StoreRepository:IStoreRepository
{
private List<Store> stores = new List<Store>();
public void CreateStore(Store store)
{
}
public void DeleteStore(int id)
{
}
public Store ReadStoreById(int id)
{
return Store.CreateEntity(0, string.Empty, string.Empty, string.Empty);
}
public IEnumerable<Store> ReadStores()
{
return stores;
}
public void UpdateStore(Store store)
{
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 KiB