Лови аптечку

This commit is contained in:
Sergey Kozyrev 2024-04-04 19:29:47 +04:00
parent e8749062be
commit ad215334b3
17 changed files with 1059 additions and 708 deletions

View File

@ -10,9 +10,10 @@ namespace SewingDressesClientApp
public static ClientViewModel? Client { get; set; } = null; public static ClientViewModel? Client { get; set; } = null;
public static void Connect(IConfiguration configuration) public static void Connect(IConfiguration configuration)
{ {
_client.BaseAddress = new Uri(configuration["IPAddress"]!); _client.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear(); _client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); _client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
} }
public static T? GetRequest<T>(string requestUrl) public static T? GetRequest<T>(string requestUrl)
{ {
@ -30,7 +31,8 @@ namespace SewingDressesClientApp
public static void PostRequest<T>(string requestUrl, T model) public static void PostRequest<T>(string requestUrl, T model)
{ {
var json = JsonConvert.SerializeObject(model); var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json"); var data = new StringContent(json, Encoding.UTF8,
"application/json");
var response = _client.PostAsync(requestUrl, data); var response = _client.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result; var result = response.Result.Content.ReadAsStringAsync().Result;
if (!response.Result.IsSuccessStatusCode) if (!response.Result.IsSuccessStatusCode)

View File

@ -17,17 +17,16 @@ namespace SewingDressesClientApp.Controllers
{ {
if (APIClient.Client == null) if (APIClient.Client == null)
{ {
return View("Enter"); return Redirect("~/Home/Enter");
} }
return return View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
} }
[HttpGet] [HttpGet]
public IActionResult Privacy() public IActionResult Privacy()
{ {
if (APIClient.Client == null) if (APIClient.Client == null)
{ {
return View("Enter"); return Redirect("~/Home/Enter");
} }
return View(APIClient.Client); return View(APIClient.Client);
} }
@ -78,8 +77,7 @@ namespace SewingDressesClientApp.Controllers
{ {
throw new Exception("Введите логин и пароль"); throw new Exception("Введите логин и пароль");
} }
APIClient.Client = APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
if (APIClient.Client == null) if (APIClient.Client == null)
{ {
throw new Exception("Неверный логин/пароль"); throw new Exception("Неверный логин/пароль");
@ -112,8 +110,7 @@ namespace SewingDressesClientApp.Controllers
[HttpGet] [HttpGet]
public IActionResult Create() public IActionResult Create()
{ {
ViewBag.IceCreams = ViewBag.Dresses = APIClient.GetRequest<List<DressViewModel>>("api/main/getdresslist");
APIClient.GetRequest<List<DressViewModel>>("api/main/getdresslist");
return View(); return View();
} }
[HttpPost] [HttpPost]
@ -140,9 +137,7 @@ namespace SewingDressesClientApp.Controllers
[HttpPost] [HttpPost]
public double Calc(int count, int dress) public double Calc(int count, int dress)
{ {
var _dress = var _dress = APIClient.GetRequest<DressViewModel>($"api/main/getdress?dressid={dress}");
APIClient.GetRequest<DressViewModel>($"api/main/getdress?dressid={dress}"
);
return Math.Round(count * (_dress?.Price ?? 1), 2); return Math.Round(count * (_dress?.Price ?? 1), 2);
} }
} }

View File

@ -13,6 +13,16 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SewingDressesContracts\SewingDressesContracts.csproj" /> <ProjectReference Include="..\SewingDressesContracts\SewingDressesContracts.csproj" />
<ProjectReference Include="..\SewingDressesRestApi\SewingDressesRestApi.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="Views\Home\Create.cshtml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="Views\Home\Enter.cshtml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -29,7 +29,7 @@
Номер Номер
</th> </th>
<th> <th>
Изделие Платье
</th> </th>
<th> <th>
Дата создания Дата создания

View File

@ -12,7 +12,7 @@
<header> <header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3"> <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Абстрактный магазин</a> <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Пошив платьев #БЕТА</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent" <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"> aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>

View File

@ -6,5 +6,5 @@
} }
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"IPAddress": "http://localhost:7225/" "IPAddress": "http://localhost:5299/"
} }

View File

@ -21,9 +21,11 @@ namespace SewingDressesDatabaseImplement.Implements
} }
using var context = new SewingDressesDatabase(); using var context = new SewingDressesDatabase();
if (model.Id.HasValue) if (model.Id.HasValue)
return context.Orders.Where(x => x.Id == model.Id).Where(x => x.ClientId == model.ClientId).Select(x => AcessDressesStorage(x.GetViewModel, context)).ToList(); return context.Orders.Where(x => x.Id == model.Id).Select(x => AcessDressesStorage(x.GetViewModel, context)).ToList();
else if (model.ClientId.HasValue)
return context.Orders.Where(x => x.ClientId == model.ClientId).Select(x => AcessDressesStorage(x.GetViewModel, context)).ToList();
else else
return context.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.ClientId == model.ClientId).Where(x => x.DateCreate <= model.DateTo).Select(x => AcessDressesStorage(x.GetViewModel, context)).ToList(); return context.Orders.Where(x => x.DateCreate >= model.DateFrom).Where(x => x.DateCreate <= model.DateTo).Select(x => AcessDressesStorage(x.GetViewModel, context)).ToList();
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)
{ {

View File

@ -17,7 +17,6 @@ namespace SewingDressesRestApi.Controllers
_logger = logger; _logger = logger;
_logic = logic; _logic = logic;
} }
[HttpGet] [HttpGet]
public ClientViewModel? Login(string login, string password) public ClientViewModel? Login(string login, string password)
{ {
@ -35,7 +34,6 @@ namespace SewingDressesRestApi.Controllers
throw; throw;
} }
} }
[HttpPost] [HttpPost]
public void Register(ClientBindingModel model) public void Register(ClientBindingModel model)
{ {
@ -49,7 +47,6 @@ namespace SewingDressesRestApi.Controllers
throw; throw;
} }
} }
[HttpPost] [HttpPost]
public void UpdateData(ClientBindingModel model) public void UpdateData(ClientBindingModel model)
{ {
@ -63,6 +60,5 @@ namespace SewingDressesRestApi.Controllers
throw; throw;
} }
} }
} }
} }

View File

@ -3,7 +3,6 @@ using SewingDressesContracts.BusinessLogicsContracts;
using SewingDressesContracts.StoragesContracts; using SewingDressesContracts.StoragesContracts;
using SewingDressesDatabaseImplement.Implements; using SewingDressesDatabaseImplement.Implements;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using NLog.Extensions.Logging;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);

View File

@ -0,0 +1,90 @@
namespace SewingDressesView
{
partial class ClientsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dataGridView = new DataGridView();
buttonDelete = new Button();
buttonUpdate = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(12, 12);
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(568, 358);
dataGridView.TabIndex = 0;
//
// buttonDelete
//
buttonDelete.Location = new Point(654, 46);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(94, 29);
buttonDelete.TabIndex = 1;
buttonDelete.Text = "Удалить";
buttonDelete.UseVisualStyleBackColor = true;
buttonDelete.Click += buttonDelete_Click;
//
// buttonUpdate
//
buttonUpdate.Location = new Point(654, 105);
buttonUpdate.Name = "buttonUpdate";
buttonUpdate.Size = new Size(94, 29);
buttonUpdate.TabIndex = 2;
buttonUpdate.Text = "Обновить";
buttonUpdate.UseVisualStyleBackColor = true;
buttonUpdate.Click += buttonUpdate_Click;
//
// ClientsForm
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 374);
Controls.Add(buttonUpdate);
Controls.Add(buttonDelete);
Controls.Add(dataGridView);
Name = "ClientsForm";
Text = "ClientsForm";
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private Button buttonDelete;
private Button buttonUpdate;
}
}

View File

@ -0,0 +1,83 @@
using Microsoft.Extensions.Logging;
using SewingDressesContracts.BindingModels;
using SewingDressesContracts.BusinessLogicsContracts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SewingDressesView
{
public partial class ClientsForm : Form
{
private readonly ILogger _logger;
private readonly IClientLogic _clientLogic;
public ClientsForm(ILogger<ClientsForm> logger, IClientLogic clientLogic)
{
InitializeComponent();
_logger = logger;
_clientLogic = clientLogic;
LoadData();
}
private void buttonDelete_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Delete client");
try
{
if (!_clientLogic.Delete(new ClientBindingModel
{
Id = id
}))
{
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Delete client error");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
private void LoadData()
{
try
{
var list = _clientLogic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["Password"].Visible = false;
}
_logger.LogInformation("Load clients");
}
catch (Exception ex)
{
_logger.LogError(ex, "Load clients error");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonUpdate_Click(object sender, EventArgs e)
{
LoadData();
}
}
}

View File

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

View File

@ -42,6 +42,7 @@
DressesReportToolStripMenuItem = new ToolStripMenuItem(); DressesReportToolStripMenuItem = new ToolStripMenuItem();
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
clientsToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
SuspendLayout(); SuspendLayout();
@ -118,7 +119,7 @@
// //
// справочникиToolStripMenuItem // справочникиToolStripMenuItem
// //
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, платьяToolStripMenuItem }); справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, платьяToolStripMenuItem, clientsToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24); справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники"; справочникиToolStripMenuItem.Text = "Справочники";
@ -126,14 +127,14 @@
// компонентыToolStripMenuItem // компонентыToolStripMenuItem
// //
компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem"; компонентыToolStripMenuItem.Name = омпонентыToolStripMenuItem";
компонентыToolStripMenuItem.Size = new Size(182, 26); компонентыToolStripMenuItem.Size = new Size(224, 26);
компонентыToolStripMenuItem.Text = "Компоненты"; компонентыToolStripMenuItem.Text = "Компоненты";
компонентыToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; компонентыToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
// //
// платьяToolStripMenuItem // платьяToolStripMenuItem
// //
платьяToolStripMenuItem.Name = "платьяToolStripMenuItem"; платьяToolStripMenuItem.Name = "платьяToolStripMenuItem";
платьяToolStripMenuItem.Size = new Size(182, 26); платьяToolStripMenuItem.Size = new Size(224, 26);
платьяToolStripMenuItem.Text = "Платья"; платьяToolStripMenuItem.Text = "Платья";
платьяToolStripMenuItem.Click += DressesToolStripMenuItem_Click; платьяToolStripMenuItem.Click += DressesToolStripMenuItem_Click;
// //
@ -165,6 +166,13 @@
списокЗаказовToolStripMenuItem.Text = "Список заказов"; списокЗаказовToolStripMenuItem.Text = "Список заказов";
списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItemReport_Click; списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItemReport_Click;
// //
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(224, 26);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
//
// MainForm // MainForm
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
@ -204,5 +212,6 @@
private ToolStripMenuItem DressesReportToolStripMenuItem; private ToolStripMenuItem DressesReportToolStripMenuItem;
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem; private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private ToolStripMenuItem clientsToolStripMenuItem;
} }
} }

View File

@ -27,6 +27,7 @@ namespace SewingDressesView
{ {
dataGridView.DataSource = list; dataGridView.DataSource = list;
dataGridView.Columns["DressId"].Visible = false; dataGridView.Columns["DressId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false;
} }
_logger.LogInformation("Load orders"); _logger.LogInformation("Load orders");
} }
@ -178,5 +179,14 @@ namespace SewingDressesView
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(ClientsForm));
if (service is ClientsForm form)
{
form.ShowDialog();
}
}
} }
} }

View File

@ -36,6 +36,8 @@
textBoxSum = new TextBox(); textBoxSum = new TextBox();
buttonSave = new Button(); buttonSave = new Button();
buttonCancel = new Button(); buttonCancel = new Button();
comboBoxClient = new ComboBox();
label4 = new Label();
SuspendLayout(); SuspendLayout();
// //
// label1 // label1
@ -50,7 +52,7 @@
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(26, 65); label2.Location = new Point(26, 95);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(93, 20); label2.Size = new Size(93, 20);
label2.TabIndex = 1; label2.TabIndex = 1;
@ -59,7 +61,7 @@
// label3 // label3
// //
label3.AutoSize = true; label3.AutoSize = true;
label3.Location = new Point(26, 107); label3.Location = new Point(26, 137);
label3.Name = "label3"; label3.Name = "label3";
label3.Size = new Size(55, 20); label3.Size = new Size(55, 20);
label3.TabIndex = 2; label3.TabIndex = 2;
@ -76,7 +78,7 @@
// //
// textBoxCount // textBoxCount
// //
textBoxCount.Location = new Point(142, 62); textBoxCount.Location = new Point(142, 92);
textBoxCount.Name = "textBoxCount"; textBoxCount.Name = "textBoxCount";
textBoxCount.Size = new Size(288, 27); textBoxCount.Size = new Size(288, 27);
textBoxCount.TabIndex = 4; textBoxCount.TabIndex = 4;
@ -84,14 +86,14 @@
// //
// textBoxSum // textBoxSum
// //
textBoxSum.Location = new Point(142, 100); textBoxSum.Location = new Point(142, 130);
textBoxSum.Name = "textBoxSum"; textBoxSum.Name = "textBoxSum";
textBoxSum.Size = new Size(288, 27); textBoxSum.Size = new Size(288, 27);
textBoxSum.TabIndex = 5; textBoxSum.TabIndex = 5;
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(222, 145); buttonSave.Location = new Point(222, 175);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(94, 29); buttonSave.Size = new Size(94, 29);
buttonSave.TabIndex = 6; buttonSave.TabIndex = 6;
@ -101,7 +103,7 @@
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(336, 145); buttonCancel.Location = new Point(336, 175);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 29); buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 7; buttonCancel.TabIndex = 7;
@ -109,11 +111,30 @@
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click; buttonCancel.Click += buttonCancel_Click;
// //
// comboBoxClient
//
comboBoxClient.FormattingEnabled = true;
comboBoxClient.Location = new Point(142, 58);
comboBoxClient.Name = "comboBoxClient";
comboBoxClient.Size = new Size(288, 28);
comboBoxClient.TabIndex = 9;
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(26, 58);
label4.Name = "label4";
label4.Size = new Size(61, 20);
label4.TabIndex = 8;
label4.Text = "Клиент:";
//
// OrderForm // OrderForm
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(484, 198); ClientSize = new Size(484, 235);
Controls.Add(comboBoxClient);
Controls.Add(label4);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Controls.Add(textBoxSum); Controls.Add(textBoxSum);
@ -139,5 +160,7 @@
private TextBox textBoxSum; private TextBox textBoxSum;
private Button buttonSave; private Button buttonSave;
private Button buttonCancel; private Button buttonCancel;
private ComboBox comboBoxClient;
private Label label4;
} }
} }

View File

@ -11,13 +11,15 @@ namespace SewingDressesView
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IDressLogic _logicD; private readonly IDressLogic _logicD;
private readonly IOrderLogic _logicO; private readonly IOrderLogic _logicO;
private readonly IClientLogic _logicC;
public OrderForm(ILogger<OrderForm> logger, IDressLogic logicD, IOrderLogic logicO) public OrderForm(ILogger<OrderForm> logger, IDressLogic logicD, IOrderLogic logicO, IClientLogic logicC)
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_logicD = logicD; _logicD = logicD;
_logicO = logicO; _logicO = logicO;
_logicC = logicC;
} }
private void buttonCancel_Click(object sender, EventArgs e) private void buttonCancel_Click(object sender, EventArgs e)
@ -98,15 +100,22 @@ namespace SewingDressesView
{ {
try try
{ {
var list = _logicD.ReadList(null); var listD = _logicD.ReadList(null);
if (list != null) if (listD != null)
{ {
comboBoxDress.DisplayMember = "DressName"; comboBoxDress.DisplayMember = "DressName";
comboBoxDress.ValueMember = "Id"; comboBoxDress.ValueMember = "Id";
comboBoxDress.DataSource = list; comboBoxDress.DataSource = listD;
comboBoxDress.SelectedItem = null; comboBoxDress.SelectedItem = null;
_logger.LogInformation("Load dress for order"); _logger.LogInformation("Load dress for order");
} }
var listC = _logicC.ReadList(null);
if (listC != null )
{
comboBoxClient.DisplayMember = "ClientName";
}
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -34,10 +34,12 @@ namespace SewingDressesView
services.AddTransient<IComponentStorage, ComponentStorage>(); services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>(); services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IDressStorage, DressStorage>(); services.AddTransient<IDressStorage, DressStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>(); services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>(); services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IDressLogic, DressLogic>(); services.AddTransient<IDressLogic, DressLogic>();
services.AddTransient<IReportLogic, ReportLogic>(); services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>(); services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>(); services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<AbstractSaveToWord, SaveToWord>(); services.AddTransient<AbstractSaveToWord, SaveToWord>();
@ -47,6 +49,7 @@ namespace SewingDressesView
services.AddTransient<OrderForm>(); services.AddTransient<OrderForm>();
services.AddTransient<DressForm>(); services.AddTransient<DressForm>();
services.AddTransient<DressComponentForm>(); services.AddTransient<DressComponentForm>();
services.AddTransient<ClientsForm>();
services.AddTransient<DressesForm>(); services.AddTransient<DressesForm>();
services.AddTransient<ReportDressComponentsForm>(); services.AddTransient<ReportDressComponentsForm>();
services.AddTransient<ReportOrdersForm>(); services.AddTransient<ReportOrdersForm>();