Лови аптечку
This commit is contained in:
parent
e8749062be
commit
ad215334b3
@ -6,37 +6,39 @@ namespace SewingDressesClientApp
|
||||
{
|
||||
public static class APIClient
|
||||
{
|
||||
private static readonly HttpClient _client = new();
|
||||
public static ClientViewModel? Client { get; set; } = null;
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
_client.BaseAddress = new Uri(configuration["IPAddress"]!);
|
||||
_client.DefaultRequestHeaders.Accept.Clear();
|
||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
var response = _client.GetAsync(requestUrl);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response = _client.PostAsync(requestUrl, data);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (!response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static readonly HttpClient _client = new();
|
||||
public static ClientViewModel? Client { get; set; } = null;
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
||||
_client.DefaultRequestHeaders.Accept.Clear();
|
||||
_client.DefaultRequestHeaders.Accept.Add(new
|
||||
MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
var response = _client.GetAsync(requestUrl);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8,
|
||||
"application/json");
|
||||
var response = _client.PostAsync(requestUrl, data);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (!response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,17 +17,16 @@ namespace SewingDressesClientApp.Controllers
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return View("Enter");
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return
|
||||
View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
||||
return View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return View("Enter");
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.Client);
|
||||
}
|
||||
@ -78,8 +77,7 @@ namespace SewingDressesClientApp.Controllers
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.Client =
|
||||
APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
||||
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
@ -112,8 +110,7 @@ namespace SewingDressesClientApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.IceCreams =
|
||||
APIClient.GetRequest<List<DressViewModel>>("api/main/getdresslist");
|
||||
ViewBag.Dresses = APIClient.GetRequest<List<DressViewModel>>("api/main/getdresslist");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
@ -140,9 +137,7 @@ namespace SewingDressesClientApp.Controllers
|
||||
[HttpPost]
|
||||
public double Calc(int count, int dress)
|
||||
{
|
||||
var _dress =
|
||||
APIClient.GetRequest<DressViewModel>($"api/main/getdress?dressid={dress}"
|
||||
);
|
||||
var _dress = APIClient.GetRequest<DressViewModel>($"api/main/getdress?dressid={dress}");
|
||||
return Math.Round(count * (_dress?.Price ?? 1), 2);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,16 @@
|
||||
|
||||
<ItemGroup>
|
||||
<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>
|
||||
|
||||
</Project>
|
||||
|
@ -29,7 +29,7 @@
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Изделие
|
||||
Платье
|
||||
</th>
|
||||
<th>
|
||||
Дата создания
|
||||
|
@ -12,7 +12,7 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Абстрактный магазин</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"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
@ -6,5 +6,5 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"IPAddress": "http://localhost:7225/"
|
||||
"IPAddress": "http://localhost:5299/"
|
||||
}
|
@ -21,9 +21,11 @@ namespace SewingDressesDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new SewingDressesDatabase();
|
||||
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();
|
||||
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.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
|
||||
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)
|
||||
{
|
||||
|
@ -6,63 +6,59 @@ using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SewingDressesRestApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ClientController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IClientLogic _logic;
|
||||
public ClientController(IClientLogic logic, ILogger<ClientController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ClientViewModel? Login(string login, string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new ClientSearchModel
|
||||
{
|
||||
Email = login,
|
||||
Password = password
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(ClientBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Create(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка регистрации");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateData(ClientBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Update(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления данных");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ClientController : Controller
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IClientLogic _logic;
|
||||
public ClientController(IClientLogic logic, ILogger<ClientController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
[HttpGet]
|
||||
public ClientViewModel? Login(string login, string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new ClientSearchModel
|
||||
{
|
||||
Email = login,
|
||||
Password = password
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void Register(ClientBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Create(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка регистрации");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateData(ClientBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Update(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка обновления данных");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using SewingDressesContracts.BusinessLogicsContracts;
|
||||
using SewingDressesContracts.StoragesContracts;
|
||||
using SewingDressesDatabaseImplement.Implements;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using NLog.Extensions.Logging;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
90
SewingDresses/SewingDressesView/ClientsForm.Designer.cs
generated
Normal file
90
SewingDresses/SewingDressesView/ClientsForm.Designer.cs
generated
Normal 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;
|
||||
}
|
||||
}
|
83
SewingDresses/SewingDressesView/ClientsForm.cs
Normal file
83
SewingDresses/SewingDressesView/ClientsForm.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
120
SewingDresses/SewingDressesView/ClientsForm.resx
Normal file
120
SewingDresses/SewingDressesView/ClientsForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
409
SewingDresses/SewingDressesView/MainForm.Designer.cs
generated
409
SewingDresses/SewingDressesView/MainForm.Designer.cs
generated
@ -1,208 +1,217 @@
|
||||
namespace SewingDressesView
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
partial class MainForm
|
||||
{
|
||||
/// <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);
|
||||
}
|
||||
/// <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
|
||||
#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();
|
||||
buttonCreate = new Button();
|
||||
buttonDoOrder = new Button();
|
||||
buttonOrderReady = new Button();
|
||||
buttonOrderGive = new Button();
|
||||
buttonOrderUpdate = new Button();
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
платьяToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
DressesReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
||||
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(2, 39);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(804, 447);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Location = new Point(854, 62);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(194, 37);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать заказ";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// buttonDoOrder
|
||||
//
|
||||
buttonDoOrder.Location = new Point(854, 130);
|
||||
buttonDoOrder.Name = "buttonDoOrder";
|
||||
buttonDoOrder.Size = new Size(194, 37);
|
||||
buttonDoOrder.TabIndex = 2;
|
||||
buttonDoOrder.Text = "Отдать на выполнение";
|
||||
buttonDoOrder.UseVisualStyleBackColor = true;
|
||||
buttonDoOrder.Click += buttonDoOrder_Click;
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
buttonOrderReady.Location = new Point(854, 205);
|
||||
buttonOrderReady.Name = "buttonOrderReady";
|
||||
buttonOrderReady.Size = new Size(194, 37);
|
||||
buttonOrderReady.TabIndex = 3;
|
||||
buttonOrderReady.Text = "Заказ готов";
|
||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
buttonOrderReady.Click += buttonOrderReady_Click;
|
||||
//
|
||||
// buttonOrderGive
|
||||
//
|
||||
buttonOrderGive.Location = new Point(854, 280);
|
||||
buttonOrderGive.Name = "buttonOrderGive";
|
||||
buttonOrderGive.Size = new Size(194, 37);
|
||||
buttonOrderGive.TabIndex = 4;
|
||||
buttonOrderGive.Text = "Заказ выдан";
|
||||
buttonOrderGive.UseVisualStyleBackColor = true;
|
||||
buttonOrderGive.Click += buttonOrderGive_Click;
|
||||
//
|
||||
// buttonOrderUpdate
|
||||
//
|
||||
buttonOrderUpdate.Location = new Point(854, 357);
|
||||
buttonOrderUpdate.Name = "buttonOrderUpdate";
|
||||
buttonOrderUpdate.Size = new Size(194, 37);
|
||||
buttonOrderUpdate.TabIndex = 5;
|
||||
buttonOrderUpdate.Text = "Обновить список";
|
||||
buttonOrderUpdate.UseVisualStyleBackColor = true;
|
||||
buttonOrderUpdate.Click += buttonOrderUpdate_Click;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1096, 28);
|
||||
menuStrip1.TabIndex = 6;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, платьяToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// компонентыToolStripMenuItem
|
||||
//
|
||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||
компонентыToolStripMenuItem.Size = new Size(182, 26);
|
||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||
компонентыToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||
//
|
||||
// платьяToolStripMenuItem
|
||||
//
|
||||
платьяToolStripMenuItem.Name = "платьяToolStripMenuItem";
|
||||
платьяToolStripMenuItem.Size = new Size(182, 26);
|
||||
платьяToolStripMenuItem.Text = "Платья";
|
||||
платьяToolStripMenuItem.Click += DressesToolStripMenuItem_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DressesReportToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(73, 24);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// DressesReportToolStripMenuItem
|
||||
//
|
||||
DressesReportToolStripMenuItem.Name = "DressesReportToolStripMenuItem";
|
||||
DressesReportToolStripMenuItem.Size = new Size(276, 26);
|
||||
DressesReportToolStripMenuItem.Text = "Список платьев";
|
||||
DressesReportToolStripMenuItem.Click += DressesToolStripMenuItemReport_Click;
|
||||
//
|
||||
// компонентыПоИзделиямToolStripMenuItem
|
||||
//
|
||||
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
||||
компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26);
|
||||
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
||||
компонентыПоИзделиямToolStripMenuItem.Click += ComponentProductsToolStripMenuItemReport_Click;
|
||||
//
|
||||
// списокЗаказовToolStripMenuItem
|
||||
//
|
||||
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||
списокЗаказовToolStripMenuItem.Size = new Size(276, 26);
|
||||
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||
списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItemReport_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1096, 493);
|
||||
Controls.Add(buttonOrderUpdate);
|
||||
Controls.Add(buttonOrderGive);
|
||||
Controls.Add(buttonOrderReady);
|
||||
Controls.Add(buttonDoOrder);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "MainForm";
|
||||
Text = "Магазин пошива одежды";
|
||||
Load += MainForm_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
/// <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();
|
||||
buttonCreate = new Button();
|
||||
buttonDoOrder = new Button();
|
||||
buttonOrderReady = new Button();
|
||||
buttonOrderGive = new Button();
|
||||
buttonOrderUpdate = new Button();
|
||||
menuStrip1 = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
платьяToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
DressesReportToolStripMenuItem = new ToolStripMenuItem();
|
||||
компонентыПоИзделиямToolStripMenuItem = new ToolStripMenuItem();
|
||||
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
|
||||
clientsToolStripMenuItem = new ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(2, 39);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(804, 447);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Location = new Point(854, 62);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(194, 37);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать заказ";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// buttonDoOrder
|
||||
//
|
||||
buttonDoOrder.Location = new Point(854, 130);
|
||||
buttonDoOrder.Name = "buttonDoOrder";
|
||||
buttonDoOrder.Size = new Size(194, 37);
|
||||
buttonDoOrder.TabIndex = 2;
|
||||
buttonDoOrder.Text = "Отдать на выполнение";
|
||||
buttonDoOrder.UseVisualStyleBackColor = true;
|
||||
buttonDoOrder.Click += buttonDoOrder_Click;
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
buttonOrderReady.Location = new Point(854, 205);
|
||||
buttonOrderReady.Name = "buttonOrderReady";
|
||||
buttonOrderReady.Size = new Size(194, 37);
|
||||
buttonOrderReady.TabIndex = 3;
|
||||
buttonOrderReady.Text = "Заказ готов";
|
||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||
buttonOrderReady.Click += buttonOrderReady_Click;
|
||||
//
|
||||
// buttonOrderGive
|
||||
//
|
||||
buttonOrderGive.Location = new Point(854, 280);
|
||||
buttonOrderGive.Name = "buttonOrderGive";
|
||||
buttonOrderGive.Size = new Size(194, 37);
|
||||
buttonOrderGive.TabIndex = 4;
|
||||
buttonOrderGive.Text = "Заказ выдан";
|
||||
buttonOrderGive.UseVisualStyleBackColor = true;
|
||||
buttonOrderGive.Click += buttonOrderGive_Click;
|
||||
//
|
||||
// buttonOrderUpdate
|
||||
//
|
||||
buttonOrderUpdate.Location = new Point(854, 357);
|
||||
buttonOrderUpdate.Name = "buttonOrderUpdate";
|
||||
buttonOrderUpdate.Size = new Size(194, 37);
|
||||
buttonOrderUpdate.TabIndex = 5;
|
||||
buttonOrderUpdate.Text = "Обновить список";
|
||||
buttonOrderUpdate.UseVisualStyleBackColor = true;
|
||||
buttonOrderUpdate.Click += buttonOrderUpdate_Click;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1096, 28);
|
||||
menuStrip1.TabIndex = 6;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, платьяToolStripMenuItem, clientsToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// компонентыToolStripMenuItem
|
||||
//
|
||||
компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
|
||||
компонентыToolStripMenuItem.Size = new Size(224, 26);
|
||||
компонентыToolStripMenuItem.Text = "Компоненты";
|
||||
компонентыToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||
//
|
||||
// платьяToolStripMenuItem
|
||||
//
|
||||
платьяToolStripMenuItem.Name = "платьяToolStripMenuItem";
|
||||
платьяToolStripMenuItem.Size = new Size(224, 26);
|
||||
платьяToolStripMenuItem.Text = "Платья";
|
||||
платьяToolStripMenuItem.Click += DressesToolStripMenuItem_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { DressesReportToolStripMenuItem, компонентыПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem });
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(73, 24);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// DressesReportToolStripMenuItem
|
||||
//
|
||||
DressesReportToolStripMenuItem.Name = "DressesReportToolStripMenuItem";
|
||||
DressesReportToolStripMenuItem.Size = new Size(276, 26);
|
||||
DressesReportToolStripMenuItem.Text = "Список платьев";
|
||||
DressesReportToolStripMenuItem.Click += DressesToolStripMenuItemReport_Click;
|
||||
//
|
||||
// компонентыПоИзделиямToolStripMenuItem
|
||||
//
|
||||
компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
||||
компонентыПоИзделиямToolStripMenuItem.Size = new Size(276, 26);
|
||||
компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
||||
компонентыПоИзделиямToolStripMenuItem.Click += ComponentProductsToolStripMenuItemReport_Click;
|
||||
//
|
||||
// списокЗаказовToolStripMenuItem
|
||||
//
|
||||
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
||||
списокЗаказовToolStripMenuItem.Size = new Size(276, 26);
|
||||
списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||
списокЗаказовToolStripMenuItem.Click += OrdersToolStripMenuItemReport_Click;
|
||||
//
|
||||
// clientsToolStripMenuItem
|
||||
//
|
||||
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
|
||||
clientsToolStripMenuItem.Size = new Size(224, 26);
|
||||
clientsToolStripMenuItem.Text = "Клиенты";
|
||||
clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1096, 493);
|
||||
Controls.Add(buttonOrderUpdate);
|
||||
Controls.Add(buttonOrderGive);
|
||||
Controls.Add(buttonOrderReady);
|
||||
Controls.Add(buttonDoOrder);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(menuStrip1);
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "MainForm";
|
||||
Text = "Магазин пошива одежды";
|
||||
Load += MainForm_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCreate;
|
||||
private Button buttonDoOrder;
|
||||
private Button buttonOrderReady;
|
||||
private Button buttonOrderGive;
|
||||
private Button buttonOrderUpdate;
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private ToolStripMenuItem платьяToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem DressesReportToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||
}
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCreate;
|
||||
private Button buttonDoOrder;
|
||||
private Button buttonOrderReady;
|
||||
private Button buttonOrderGive;
|
||||
private Button buttonOrderUpdate;
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыToolStripMenuItem;
|
||||
private ToolStripMenuItem платьяToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem DressesReportToolStripMenuItem;
|
||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
||||
private ToolStripMenuItem clientsToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -6,177 +6,187 @@ using SewingDressesBusinessLogic.BusinessLogic;
|
||||
|
||||
namespace SewingDressesView
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
private readonly IReportLogic _reportLogic;
|
||||
public MainForm(ILogger<MainForm> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
_reportLogic = reportLogic;
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["DressId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Load orders");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Load orders error");
|
||||
}
|
||||
}
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
private readonly IReportLogic _reportLogic;
|
||||
public MainForm(ILogger<MainForm> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
_reportLogic = reportLogic;
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["DressId"].Visible = false;
|
||||
dataGridView.Columns["ClientId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Load orders");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Load orders error");
|
||||
}
|
||||
}
|
||||
|
||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ComponentsForm));
|
||||
if (service is ComponentsForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ComponentsForm));
|
||||
if (service is ComponentsForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void DressesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(DressesForm));
|
||||
if (service is DressesForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void DressesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(DressesForm));
|
||||
if (service is DressesForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(OrderForm));
|
||||
if (service is OrderForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(OrderForm));
|
||||
if (service is OrderForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDoOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Change Status on 'In work'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Change Status on 'In work' error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonDoOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Change Status on 'In work'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Change Status on 'In work' error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonOrderReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Change status on 'Ready'",
|
||||
id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new
|
||||
OrderBindingModel
|
||||
{ Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Change status on 'Ready' error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void buttonOrderReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Change status on 'Ready'",
|
||||
id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new
|
||||
OrderBindingModel
|
||||
{ Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Change status on 'Ready' error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonOrderGive_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Status change on 'Given'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
_logger.LogInformation("Order №{id} given", id);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Change status on 'Give' error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void buttonOrderGive_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Order №{id}. Status change on 'Given'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
_logger.LogInformation("Order №{id} given", id);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Change status on 'Give' error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonOrderUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void buttonOrderUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void ComponentProductsToolStripMenuItemReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ReportDressComponentsForm));
|
||||
if (service is ReportDressComponentsForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void OrdersToolStripMenuItemReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ReportOrdersForm));
|
||||
if (service is ReportOrdersForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void ComponentProductsToolStripMenuItemReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ReportDressComponentsForm));
|
||||
if (service is ReportDressComponentsForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void OrdersToolStripMenuItemReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(ReportOrdersForm));
|
||||
if (service is ReportOrdersForm form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void DressesToolStripMenuItemReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void DressesToolStripMenuItemReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_reportLogic.SaveComponentsToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = dialog.FileName
|
||||
});
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
293
SewingDresses/SewingDressesView/OrderForm.Designer.cs
generated
293
SewingDresses/SewingDressesView/OrderForm.Designer.cs
generated
@ -1,143 +1,166 @@
|
||||
namespace SewingDressesView
|
||||
{
|
||||
partial class OrderForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
partial class OrderForm
|
||||
{
|
||||
/// <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);
|
||||
}
|
||||
/// <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
|
||||
#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()
|
||||
{
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
comboBoxDress = new ComboBox();
|
||||
textBoxCount = new TextBox();
|
||||
textBoxSum = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(26, 21);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(61, 20);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Платье:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(26, 65);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(93, 20);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Количество:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(26, 107);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(55, 20);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "Сумма";
|
||||
//
|
||||
// comboBoxDress
|
||||
//
|
||||
comboBoxDress.FormattingEnabled = true;
|
||||
comboBoxDress.Location = new Point(142, 21);
|
||||
comboBoxDress.Name = "comboBoxDress";
|
||||
comboBoxDress.Size = new Size(288, 28);
|
||||
comboBoxDress.TabIndex = 3;
|
||||
comboBoxDress.SelectedIndexChanged += comboBoxDress_SelectedIndexChanged;
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(142, 62);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(288, 27);
|
||||
textBoxCount.TabIndex = 4;
|
||||
textBoxCount.TextChanged += textBoxCount_TextChanged;
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Location = new Point(142, 100);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.Size = new Size(288, 27);
|
||||
textBoxSum.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(222, 145);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(94, 29);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(336, 145);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(94, 29);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// OrderForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(484, 198);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxSum);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(comboBoxDress);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "OrderForm";
|
||||
Text = "Форма заказа";
|
||||
Load += OrderForm_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
comboBoxDress = new ComboBox();
|
||||
textBoxCount = new TextBox();
|
||||
textBoxSum = new TextBox();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
comboBoxClient = new ComboBox();
|
||||
label4 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(26, 21);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(61, 20);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Платье:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(26, 95);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(93, 20);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Количество:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(26, 137);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(55, 20);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "Сумма";
|
||||
//
|
||||
// comboBoxDress
|
||||
//
|
||||
comboBoxDress.FormattingEnabled = true;
|
||||
comboBoxDress.Location = new Point(142, 21);
|
||||
comboBoxDress.Name = "comboBoxDress";
|
||||
comboBoxDress.Size = new Size(288, 28);
|
||||
comboBoxDress.TabIndex = 3;
|
||||
comboBoxDress.SelectedIndexChanged += comboBoxDress_SelectedIndexChanged;
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(142, 92);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(288, 27);
|
||||
textBoxCount.TabIndex = 4;
|
||||
textBoxCount.TextChanged += textBoxCount_TextChanged;
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Location = new Point(142, 130);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.Size = new Size(288, 27);
|
||||
textBoxSum.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(222, 175);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(94, 29);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(336, 175);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(94, 29);
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
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
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(484, 235);
|
||||
Controls.Add(comboBoxClient);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(textBoxSum);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(comboBoxDress);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "OrderForm";
|
||||
Text = "Форма заказа";
|
||||
Load += OrderForm_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private ComboBox comboBoxDress;
|
||||
private TextBox textBoxCount;
|
||||
private TextBox textBoxSum;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private ComboBox comboBoxDress;
|
||||
private TextBox textBoxCount;
|
||||
private TextBox textBoxSum;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private ComboBox comboBoxClient;
|
||||
private Label label4;
|
||||
}
|
||||
}
|
@ -6,113 +6,122 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SewingDressesView
|
||||
{
|
||||
public partial class OrderForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDressLogic _logicD;
|
||||
private readonly IOrderLogic _logicO;
|
||||
public partial class OrderForm : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDressLogic _logicD;
|
||||
private readonly IOrderLogic _logicO;
|
||||
private readonly IClientLogic _logicC;
|
||||
|
||||
public OrderForm(ILogger<OrderForm> logger, IDressLogic logicD, IOrderLogic logicO)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicD = logicD;
|
||||
_logicO = logicO;
|
||||
}
|
||||
public OrderForm(ILogger<OrderForm> logger, IDressLogic logicD, IOrderLogic logicO, IClientLogic logicC)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicD = logicD;
|
||||
_logicO = logicO;
|
||||
_logicC = logicC;
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxDress.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||
{
|
||||
DressId = Convert.ToInt32(comboBoxDress.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Create order error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void CalcSum()
|
||||
{
|
||||
if (comboBoxDress.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
try
|
||||
{
|
||||
int id = Convert.ToInt32(comboBoxDress.SelectedValue);
|
||||
var dress = _logicD.ReadElement(new DressSearchModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
int count = Convert.ToInt32(textBoxCount.Text);
|
||||
textBoxSum.Text = Math.Round(count * dress?.Price ?? 0, 2).ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Calculate sum order error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxDress.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||
{
|
||||
DressId = Convert.ToInt32(comboBoxDress.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Create order error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void CalcSum()
|
||||
{
|
||||
if (comboBoxDress.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
try
|
||||
{
|
||||
int id = Convert.ToInt32(comboBoxDress.SelectedValue);
|
||||
var dress = _logicD.ReadElement(new DressSearchModel
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
int count = Convert.ToInt32(textBoxCount.Text);
|
||||
textBoxSum.Text = Math.Round(count * dress?.Price ?? 0, 2).ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Calculate sum order error");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxDress_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
private void comboBoxDress_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
|
||||
private void textBoxCount_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
private void textBoxCount_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
|
||||
private void OrderForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logicD.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxDress.DisplayMember = "DressName";
|
||||
comboBoxDress.ValueMember = "Id";
|
||||
comboBoxDress.DataSource = list;
|
||||
comboBoxDress.SelectedItem = null;
|
||||
_logger.LogInformation("Load dress for order");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Load dress for order error");
|
||||
private void OrderForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var listD = _logicD.ReadList(null);
|
||||
if (listD != null)
|
||||
{
|
||||
comboBoxDress.DisplayMember = "DressName";
|
||||
comboBoxDress.ValueMember = "Id";
|
||||
comboBoxDress.DataSource = listD;
|
||||
comboBoxDress.SelectedItem = null;
|
||||
_logger.LogInformation("Load dress for order");
|
||||
}
|
||||
var listC = _logicC.ReadList(null);
|
||||
if (listC != null )
|
||||
{
|
||||
comboBoxClient.DisplayMember = "ClientName";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Load dress for order error");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,10 +34,12 @@ namespace SewingDressesView
|
||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
services.AddTransient<IDressStorage, DressStorage>();
|
||||
services.AddTransient<IClientStorage, ClientStorage>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IDressLogic, DressLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
@ -47,6 +49,7 @@ namespace SewingDressesView
|
||||
services.AddTransient<OrderForm>();
|
||||
services.AddTransient<DressForm>();
|
||||
services.AddTransient<DressComponentForm>();
|
||||
services.AddTransient<ClientsForm>();
|
||||
services.AddTransient<DressesForm>();
|
||||
services.AddTransient<ReportDressComponentsForm>();
|
||||
services.AddTransient<ReportOrdersForm>();
|
||||
|
Loading…
Reference in New Issue
Block a user