Compare commits
No commits in common. "laba_5_hard" and "main" have entirely different histories.
laba_5_har
...
main
1
.gitignore
vendored
1
.gitignore
vendored
@ -398,4 +398,3 @@ FodyWeavers.xsd
|
|||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
/PIbd-23_Panina.A.D_JewelryStore/JewelryStoreClientApp/JewelryStoreClientApp.csproj
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
namespace JewelryStoreDataModels.Enums
|
|
||||||
{
|
|
||||||
public enum OrderStatus
|
|
||||||
{
|
|
||||||
Неизвестен = -1,
|
|
||||||
Принят = 0,
|
|
||||||
Выполняется = 1,
|
|
||||||
Готов = 2,
|
|
||||||
Выдан = 3
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
namespace JewelryShopDataModels
|
|
||||||
{
|
|
||||||
public interface IId
|
|
||||||
{
|
|
||||||
int Id { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,16 +0,0 @@
|
|||||||
using JewelryShopDataModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IClientModel : IId
|
|
||||||
{
|
|
||||||
string ClientFIO { get; }
|
|
||||||
string Email { get; }
|
|
||||||
string Password { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
using JewelryShopDataModels;
|
|
||||||
|
|
||||||
namespace JewelryStoreDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IComponentModel : IId
|
|
||||||
{
|
|
||||||
string ComponentName { get; }
|
|
||||||
double Cost { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using JewelryShopDataModels;
|
|
||||||
|
|
||||||
namespace JewelryStoreDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IJewelModel : IId
|
|
||||||
{
|
|
||||||
string JewelName { get; }
|
|
||||||
double Price { get; }
|
|
||||||
Dictionary<int, (IComponentModel, int)> JewelComponents { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using JewelryShopDataModels;
|
|
||||||
using JewelryStoreDataModels.Enums;
|
|
||||||
|
|
||||||
namespace JewelryStoreDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IOrderModel : IId
|
|
||||||
{
|
|
||||||
int JewelId { get; }
|
|
||||||
int Count { get; }
|
|
||||||
double Sum { get; }
|
|
||||||
OrderStatus Status { get; }
|
|
||||||
DateTime DateCreate { get; }
|
|
||||||
DateTime? DateImplement { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using JewelryShopDataModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IStoreModel : IId
|
|
||||||
{
|
|
||||||
public string StoreName { get; }
|
|
||||||
public string StoreAdress { get; }
|
|
||||||
DateTime OpeningDate { get; }
|
|
||||||
Dictionary<int, (IJewelModel, int)> Jewels { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreDataModels.Models
|
|
||||||
{
|
|
||||||
public interface ISupplyModel
|
|
||||||
{
|
|
||||||
int ShopId { get; }
|
|
||||||
int JewelId { get; }
|
|
||||||
int Count { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.3.32819.101
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStore", "JewelryStore\JewelryStore.csproj", "{187BBC53-52AA-4C47-B98B-E119AE64ADA4}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreDataModels", "JewelryShopDataModels\JewelryStoreDataModels.csproj", "{C6D79969-6DC9-4F60-BCC4-A679CB472595}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreContracts", "JewelryStoreContracts\JewelryStoreContracts.csproj", "{F7C956E1-26FC-4914-9ABC-71A16F88B7E8}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreBusinessLogic", "JewelryStoreBusinessLogic\JewelryStoreBusinessLogic.csproj", "{B4D1E829-A99F-47D2-B06D-5042CE058CA9}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreListImplement", "JewelryStoreListImplement\JewelryStoreListImplement.csproj", "{12C6B5CD-CE5C-4095-91B8-53A5CB08E780}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreFileImplement", "JewelryStoreFileImplement\JewelryStoreFileImplement.csproj", "{12AA98A9-D1DA-4DC3-B98C-105004B8498A}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreDatabaseImplement", "JewelryStoreDatabaseImplement\JewelryStoreDatabaseImplement.csproj", "{8AA20901-3D23-4622-A0E8-1FC830923335}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreRestApi", "JewelryStoreRestApi\JewelryStoreRestApi.csproj", "{26DBFC2C-876E-47B7-B1BF-43873B807C6E}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JewelryStoreShopApp", "JewelryStoreShopApp\JewelryStoreShopApp.csproj", "{784174AD-62FD-4777-99D8-26ED43CBF2C9}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{187BBC53-52AA-4C47-B98B-E119AE64ADA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{187BBC53-52AA-4C47-B98B-E119AE64ADA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{187BBC53-52AA-4C47-B98B-E119AE64ADA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{187BBC53-52AA-4C47-B98B-E119AE64ADA4}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{C6D79969-6DC9-4F60-BCC4-A679CB472595}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C6D79969-6DC9-4F60-BCC4-A679CB472595}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{C6D79969-6DC9-4F60-BCC4-A679CB472595}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C6D79969-6DC9-4F60-BCC4-A679CB472595}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{F7C956E1-26FC-4914-9ABC-71A16F88B7E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{F7C956E1-26FC-4914-9ABC-71A16F88B7E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{F7C956E1-26FC-4914-9ABC-71A16F88B7E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{F7C956E1-26FC-4914-9ABC-71A16F88B7E8}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{B4D1E829-A99F-47D2-B06D-5042CE058CA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{B4D1E829-A99F-47D2-B06D-5042CE058CA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{B4D1E829-A99F-47D2-B06D-5042CE058CA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{B4D1E829-A99F-47D2-B06D-5042CE058CA9}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{12C6B5CD-CE5C-4095-91B8-53A5CB08E780}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{12C6B5CD-CE5C-4095-91B8-53A5CB08E780}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{12C6B5CD-CE5C-4095-91B8-53A5CB08E780}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{12C6B5CD-CE5C-4095-91B8-53A5CB08E780}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{12AA98A9-D1DA-4DC3-B98C-105004B8498A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{12AA98A9-D1DA-4DC3-B98C-105004B8498A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{12AA98A9-D1DA-4DC3-B98C-105004B8498A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{12AA98A9-D1DA-4DC3-B98C-105004B8498A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{8AA20901-3D23-4622-A0E8-1FC830923335}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{8AA20901-3D23-4622-A0E8-1FC830923335}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{8AA20901-3D23-4622-A0E8-1FC830923335}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{8AA20901-3D23-4622-A0E8-1FC830923335}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{26DBFC2C-876E-47B7-B1BF-43873B807C6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{26DBFC2C-876E-47B7-B1BF-43873B807C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{26DBFC2C-876E-47B7-B1BF-43873B807C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{26DBFC2C-876E-47B7-B1BF-43873B807C6E}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{784174AD-62FD-4777-99D8-26ED43CBF2C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {1BFFF75E-EFBE-4748-817D-DF837DAC2E23}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This file is automatically generated by Visual Studio .Net. It is
|
|
||||||
used to store generic object data source configuration information.
|
|
||||||
Renaming the file extension or editing the content of this file may
|
|
||||||
cause the file to be unrecognizable by the program.
|
|
||||||
-->
|
|
||||||
<GenericObjectDataSource DisplayName="IComponentLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
|
||||||
<TypeInfo>JewelryStoreContracts.BusinessLogicsContracts.IComponentLogic, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
|
||||||
</GenericObjectDataSource>
|
|
@ -1,89 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormClients
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDelete = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowHeadersWidth = 62;
|
|
||||||
this.dataGridView.RowTemplate.Height = 33;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(621, 433);
|
|
||||||
this.dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
this.buttonUpdate.Location = new System.Drawing.Point(662, 71);
|
|
||||||
this.buttonUpdate.Name = "buttonUpdate";
|
|
||||||
this.buttonUpdate.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonUpdate.TabIndex = 1;
|
|
||||||
this.buttonUpdate.Text = "Обновить";
|
|
||||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
|
||||||
//
|
|
||||||
// buttonDelete
|
|
||||||
//
|
|
||||||
this.buttonDelete.Location = new System.Drawing.Point(662, 130);
|
|
||||||
this.buttonDelete.Name = "buttonDelete";
|
|
||||||
this.buttonDelete.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonDelete.TabIndex = 2;
|
|
||||||
this.buttonDelete.Text = "Удалить";
|
|
||||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDelete.Click += new System.EventHandler(this.ButtonDelete_Click);
|
|
||||||
//
|
|
||||||
// FormClients
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Controls.Add(this.buttonDelete);
|
|
||||||
this.Controls.Add(this.buttonUpdate);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormClients";
|
|
||||||
this.Text = "Клиенты";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonDelete;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
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 JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormClients : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
private readonly IClientLogic _logic;
|
|
||||||
public FormClients(ILogger<FormClients> logger, IClientLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ClientBindingModel { Id = id }))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Удаление клиента");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления клиента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormClients_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка клиентов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки клиентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,119 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormComponent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.labelName = new System.Windows.Forms.Label();
|
|
||||||
this.labelCost = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBoxCost = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelName
|
|
||||||
//
|
|
||||||
this.labelName.AutoSize = true;
|
|
||||||
this.labelName.Location = new System.Drawing.Point(20, 21);
|
|
||||||
this.labelName.Name = "labelName";
|
|
||||||
this.labelName.Size = new System.Drawing.Size(94, 25);
|
|
||||||
this.labelName.TabIndex = 0;
|
|
||||||
this.labelName.Text = "Название:";
|
|
||||||
//
|
|
||||||
// labelCost
|
|
||||||
//
|
|
||||||
this.labelCost.AutoSize = true;
|
|
||||||
this.labelCost.Location = new System.Drawing.Point(20, 67);
|
|
||||||
this.labelCost.Name = "labelCost";
|
|
||||||
this.labelCost.Size = new System.Drawing.Size(57, 25);
|
|
||||||
this.labelCost.TabIndex = 1;
|
|
||||||
this.labelCost.Text = "Цена:";
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
this.textBoxName.Location = new System.Drawing.Point(132, 18);
|
|
||||||
this.textBoxName.Name = "textBoxName";
|
|
||||||
this.textBoxName.Size = new System.Drawing.Size(298, 31);
|
|
||||||
this.textBoxName.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// textBoxCost
|
|
||||||
//
|
|
||||||
this.textBoxCost.Location = new System.Drawing.Point(132, 64);
|
|
||||||
this.textBoxCost.Name = "textBoxCost";
|
|
||||||
this.textBoxCost.Size = new System.Drawing.Size(298, 31);
|
|
||||||
this.textBoxCost.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(132, 113);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonSave.TabIndex = 4;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(318, 113);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonCancel.TabIndex = 5;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// FormComponent
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(463, 172);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.textBoxCost);
|
|
||||||
this.Controls.Add(this.textBoxName);
|
|
||||||
this.Controls.Add(this.labelCost);
|
|
||||||
this.Controls.Add(this.labelName);
|
|
||||||
this.Name = "FormComponent";
|
|
||||||
this.Text = "Компонент";
|
|
||||||
this.Load += new System.EventHandler(this.FormComponent_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelName;
|
|
||||||
private Label labelCost;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private TextBox textBoxCost;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Button buttonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
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 JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormComponent : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
|
|
||||||
public FormComponent(ILogger<FormComponent> logger, IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormComponent_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Получение компонента");
|
|
||||||
var view = _logic.ReadElement(new ComponentSearchModel
|
|
||||||
{
|
|
||||||
Id = _id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
textBoxName.Text = view.ComponentName;
|
|
||||||
textBoxCost.Text = view.Cost.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка получения компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new ComponentBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
ComponentName = textBoxName.Text,
|
|
||||||
Cost = Convert.ToDouble(textBoxCost.Text)
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,123 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormComponents
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.buttonAdd = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRefresh = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDelete = new System.Windows.Forms.Button();
|
|
||||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.AllowUserToAddRows = false;
|
|
||||||
this.dataGridView.AllowUserToDeleteRows = false;
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Left;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.dataGridView.MultiSelect = false;
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.ReadOnly = true;
|
|
||||||
this.dataGridView.RowHeadersVisible = false;
|
|
||||||
this.dataGridView.RowHeadersWidth = 62;
|
|
||||||
this.dataGridView.RowTemplate.Height = 33;
|
|
||||||
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(525, 450);
|
|
||||||
this.dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(569, 38);
|
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonAdd.TabIndex = 1;
|
|
||||||
this.buttonAdd.Text = "Добавить";
|
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
this.buttonRefresh.Location = new System.Drawing.Point(569, 107);
|
|
||||||
this.buttonRefresh.Name = "buttonRefresh";
|
|
||||||
this.buttonRefresh.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonRefresh.TabIndex = 2;
|
|
||||||
this.buttonRefresh.Text = "Изменить";
|
|
||||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
|
||||||
//
|
|
||||||
// buttonDelete
|
|
||||||
//
|
|
||||||
this.buttonDelete.Location = new System.Drawing.Point(569, 178);
|
|
||||||
this.buttonDelete.Name = "buttonDelete";
|
|
||||||
this.buttonDelete.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonDelete.TabIndex = 3;
|
|
||||||
this.buttonDelete.Text = "Удалить";
|
|
||||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDelete.Click += new System.EventHandler(this.ButtonDelete_Click);
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
this.buttonUpdate.Location = new System.Drawing.Point(569, 249);
|
|
||||||
this.buttonUpdate.Name = "buttonUpdate";
|
|
||||||
this.buttonUpdate.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonUpdate.TabIndex = 4;
|
|
||||||
this.buttonUpdate.Text = "Обновить";
|
|
||||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
|
||||||
//
|
|
||||||
// FormComponents
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(756, 450);
|
|
||||||
this.Controls.Add(this.buttonUpdate);
|
|
||||||
this.Controls.Add(this.buttonDelete);
|
|
||||||
this.Controls.Add(this.buttonRefresh);
|
|
||||||
this.Controls.Add(this.buttonAdd);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormComponents";
|
|
||||||
this.Text = "Компоненты";
|
|
||||||
this.Load += new System.EventHandler(this.FormComponents_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private Button buttonRefresh;
|
|
||||||
private Button buttonDelete;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormComponents : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentLogic _logic;
|
|
||||||
|
|
||||||
public FormComponents(ILogger<FormComponents> logger, IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormComponents_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
|
||||||
if (service is FormComponent form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
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("Удаление компонента");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new ComponentBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления компонента");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
|
||||||
if (service is FormComponent form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,169 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormCreateOrder
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.labelJewel = new System.Windows.Forms.Label();
|
|
||||||
this.labelCount = new System.Windows.Forms.Label();
|
|
||||||
this.labelSum = new System.Windows.Forms.Label();
|
|
||||||
this.comboBoxJewel = new System.Windows.Forms.ComboBox();
|
|
||||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBoxSum = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.labelClient = new System.Windows.Forms.Label();
|
|
||||||
this.comboBoxClient = new System.Windows.Forms.ComboBox();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelJewel
|
|
||||||
//
|
|
||||||
this.labelJewel.AutoSize = true;
|
|
||||||
this.labelJewel.Location = new System.Drawing.Point(17, 64);
|
|
||||||
this.labelJewel.Name = "labelJewel";
|
|
||||||
this.labelJewel.Size = new System.Drawing.Size(84, 25);
|
|
||||||
this.labelJewel.TabIndex = 0;
|
|
||||||
this.labelJewel.Text = "Изделие:";
|
|
||||||
//
|
|
||||||
// labelCount
|
|
||||||
//
|
|
||||||
this.labelCount.AutoSize = true;
|
|
||||||
this.labelCount.Location = new System.Drawing.Point(17, 109);
|
|
||||||
this.labelCount.Name = "labelCount";
|
|
||||||
this.labelCount.Size = new System.Drawing.Size(111, 25);
|
|
||||||
this.labelCount.TabIndex = 1;
|
|
||||||
this.labelCount.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// labelSum
|
|
||||||
//
|
|
||||||
this.labelSum.AutoSize = true;
|
|
||||||
this.labelSum.Location = new System.Drawing.Point(17, 152);
|
|
||||||
this.labelSum.Name = "labelSum";
|
|
||||||
this.labelSum.Size = new System.Drawing.Size(71, 25);
|
|
||||||
this.labelSum.TabIndex = 2;
|
|
||||||
this.labelSum.Text = "Сумма:";
|
|
||||||
//
|
|
||||||
// comboBoxJewel
|
|
||||||
//
|
|
||||||
this.comboBoxJewel.FormattingEnabled = true;
|
|
||||||
this.comboBoxJewel.Location = new System.Drawing.Point(134, 61);
|
|
||||||
this.comboBoxJewel.MaxDropDownItems = 100;
|
|
||||||
this.comboBoxJewel.Name = "comboBoxJewel";
|
|
||||||
this.comboBoxJewel.Size = new System.Drawing.Size(291, 33);
|
|
||||||
this.comboBoxJewel.TabIndex = 3;
|
|
||||||
this.comboBoxJewel.SelectedIndexChanged += new System.EventHandler(this.ComboBoxJewel_SelectedIndexChanged);
|
|
||||||
//
|
|
||||||
// textBoxCount
|
|
||||||
//
|
|
||||||
this.textBoxCount.Location = new System.Drawing.Point(134, 106);
|
|
||||||
this.textBoxCount.Name = "textBoxCount";
|
|
||||||
this.textBoxCount.Size = new System.Drawing.Size(291, 31);
|
|
||||||
this.textBoxCount.TabIndex = 4;
|
|
||||||
this.textBoxCount.TextChanged += new System.EventHandler(this.TextBoxCount_TextChanged);
|
|
||||||
//
|
|
||||||
// textBoxSum
|
|
||||||
//
|
|
||||||
this.textBoxSum.Location = new System.Drawing.Point(134, 149);
|
|
||||||
this.textBoxSum.Name = "textBoxSum";
|
|
||||||
this.textBoxSum.ReadOnly = true;
|
|
||||||
this.textBoxSum.Size = new System.Drawing.Size(291, 31);
|
|
||||||
this.textBoxSum.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(134, 199);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonSave.TabIndex = 6;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(313, 199);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonCancel.TabIndex = 7;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// labelClient
|
|
||||||
//
|
|
||||||
this.labelClient.AutoSize = true;
|
|
||||||
this.labelClient.Location = new System.Drawing.Point(17, 17);
|
|
||||||
this.labelClient.Name = "labelClient";
|
|
||||||
this.labelClient.Size = new System.Drawing.Size(71, 25);
|
|
||||||
this.labelClient.TabIndex = 8;
|
|
||||||
this.labelClient.Text = "Клиент:";
|
|
||||||
//
|
|
||||||
// comboBoxClient
|
|
||||||
//
|
|
||||||
this.comboBoxClient.FormattingEnabled = true;
|
|
||||||
this.comboBoxClient.Location = new System.Drawing.Point(134, 14);
|
|
||||||
this.comboBoxClient.Name = "comboBoxClient";
|
|
||||||
this.comboBoxClient.Size = new System.Drawing.Size(291, 33);
|
|
||||||
this.comboBoxClient.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// FormCreateOrder
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(441, 245);
|
|
||||||
this.Controls.Add(this.comboBoxClient);
|
|
||||||
this.Controls.Add(this.labelClient);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.textBoxSum);
|
|
||||||
this.Controls.Add(this.textBoxCount);
|
|
||||||
this.Controls.Add(this.comboBoxJewel);
|
|
||||||
this.Controls.Add(this.labelSum);
|
|
||||||
this.Controls.Add(this.labelCount);
|
|
||||||
this.Controls.Add(this.labelJewel);
|
|
||||||
this.Name = "FormCreateOrder";
|
|
||||||
this.Text = "Заказ";
|
|
||||||
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelJewel;
|
|
||||||
private Label labelCount;
|
|
||||||
private Label labelSum;
|
|
||||||
private ComboBox comboBoxJewel;
|
|
||||||
private TextBox textBoxCount;
|
|
||||||
private TextBox textBoxSum;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Label labelClient;
|
|
||||||
private ComboBox comboBoxClient;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,163 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using JewelryStoreDataModels.Models;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormCreateOrder : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IJewelLogic _logicJ;
|
|
||||||
private readonly IOrderLogic _logicO;
|
|
||||||
private readonly IClientLogic _logicC;
|
|
||||||
|
|
||||||
private List<JewelViewModel>? _list;
|
|
||||||
|
|
||||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IClientLogic logicC, IJewelLogic logicJ, IOrderLogic logicO)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logicJ = logicJ;
|
|
||||||
_logicO = logicO;
|
|
||||||
_logicC = logicC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Id { get { return Convert.ToInt32(comboBoxJewel.SelectedValue); } set { comboBoxJewel.SelectedValue = value; } }
|
|
||||||
|
|
||||||
public IJewelModel? JewelModel
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_list == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var elem in _list)
|
|
||||||
{
|
|
||||||
if (elem.Id == Id)
|
|
||||||
{
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка изделий для заказа");
|
|
||||||
_list = _logicJ.ReadList(null);
|
|
||||||
if (_list != null)
|
|
||||||
{
|
|
||||||
comboBoxJewel.DisplayMember = "JewelName";
|
|
||||||
comboBoxJewel.ValueMember = "Id";
|
|
||||||
comboBoxJewel.DataSource = _list;
|
|
||||||
comboBoxJewel.SelectedItem = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка пользователей для заказа");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logicC.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
comboBoxClient.DisplayMember = "ClientFIO";
|
|
||||||
comboBoxClient.ValueMember = "Id";
|
|
||||||
comboBoxClient.DataSource = list;
|
|
||||||
comboBoxClient.SelectedItem = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка клиентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private void CalcSum()
|
|
||||||
{
|
|
||||||
if (comboBoxJewel.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(comboBoxJewel.SelectedIndex) + 1;
|
|
||||||
var Jewel = _logicJ.ReadElement(new JewelSearchModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
});
|
|
||||||
int count = Convert.ToInt32(textBoxCount.Text);
|
|
||||||
textBoxSum.Text = Math.Round(count * (Jewel?.Price ?? 0), 2).ToString();
|
|
||||||
_logger.LogInformation("Расчет суммы заказа");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка расчета суммы заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextBoxCount_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CalcSum();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxJewel.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите драгоценность", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxClient.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите клиента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Создание заказа");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
|
||||||
{
|
|
||||||
JewelId = Convert.ToInt32(comboBoxJewel.SelectedIndex) + 1,
|
|
||||||
Count = Convert.ToInt32(textBoxCount.Text),
|
|
||||||
Sum = Convert.ToDouble(textBoxSum.Text),
|
|
||||||
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue)
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка создания заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ComboBoxJewel_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CalcSum();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,143 +0,0 @@
|
|||||||
namespace JewelryStoreView
|
|
||||||
{
|
|
||||||
partial class FormCreateSupply
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.comboBoxShop = new System.Windows.Forms.ComboBox();
|
|
||||||
this.labelShop = new System.Windows.Forms.Label();
|
|
||||||
this.labelJewel = new System.Windows.Forms.Label();
|
|
||||||
this.comboBoxJewel = new System.Windows.Forms.ComboBox();
|
|
||||||
this.labelCount = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// comboBoxShop
|
|
||||||
//
|
|
||||||
this.comboBoxShop.FormattingEnabled = true;
|
|
||||||
this.comboBoxShop.Location = new System.Drawing.Point(115, 12);
|
|
||||||
this.comboBoxShop.Name = "comboBoxShop";
|
|
||||||
this.comboBoxShop.Size = new System.Drawing.Size(344, 28);
|
|
||||||
this.comboBoxShop.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// labelShop
|
|
||||||
//
|
|
||||||
this.labelShop.AutoSize = true;
|
|
||||||
this.labelShop.Location = new System.Drawing.Point(12, 15);
|
|
||||||
this.labelShop.Name = "labelShop";
|
|
||||||
this.labelShop.Size = new System.Drawing.Size(76, 20);
|
|
||||||
this.labelShop.TabIndex = 1;
|
|
||||||
this.labelShop.Text = "Магазин: ";
|
|
||||||
//
|
|
||||||
// labelJewel
|
|
||||||
//
|
|
||||||
this.labelJewel.AutoSize = true;
|
|
||||||
this.labelJewel.Location = new System.Drawing.Point(12, 49);
|
|
||||||
this.labelJewel.Name = "labelJewel";
|
|
||||||
this.labelJewel.Size = new System.Drawing.Size(75, 20);
|
|
||||||
this.labelJewel.TabIndex = 2;
|
|
||||||
this.labelJewel.Text = "Изделие: ";
|
|
||||||
//
|
|
||||||
// comboBoxJewel
|
|
||||||
//
|
|
||||||
this.comboBoxJewel.FormattingEnabled = true;
|
|
||||||
this.comboBoxJewel.Location = new System.Drawing.Point(115, 46);
|
|
||||||
this.comboBoxJewel.Name = "comboBoxJewel";
|
|
||||||
this.comboBoxJewel.Size = new System.Drawing.Size(344, 28);
|
|
||||||
this.comboBoxJewel.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// labelCount
|
|
||||||
//
|
|
||||||
this.labelCount.AutoSize = true;
|
|
||||||
this.labelCount.Location = new System.Drawing.Point(12, 83);
|
|
||||||
this.labelCount.Name = "labelCount";
|
|
||||||
this.labelCount.Size = new System.Drawing.Size(97, 20);
|
|
||||||
this.labelCount.TabIndex = 4;
|
|
||||||
this.labelCount.Text = "Количество: ";
|
|
||||||
//
|
|
||||||
// textBoxCount
|
|
||||||
//
|
|
||||||
this.textBoxCount.Location = new System.Drawing.Point(115, 80);
|
|
||||||
this.textBoxCount.Name = "textBoxCount";
|
|
||||||
this.textBoxCount.Size = new System.Drawing.Size(344, 27);
|
|
||||||
this.textBoxCount.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(300, 113);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(116, 39);
|
|
||||||
this.buttonCancel.TabIndex = 6;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(168, 113);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(116, 39);
|
|
||||||
this.buttonSave.TabIndex = 7;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// FormCreateSupply
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(471, 164);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.textBoxCount);
|
|
||||||
this.Controls.Add(this.labelCount);
|
|
||||||
this.Controls.Add(this.comboBoxJewel);
|
|
||||||
this.Controls.Add(this.labelJewel);
|
|
||||||
this.Controls.Add(this.labelShop);
|
|
||||||
this.Controls.Add(this.comboBoxShop);
|
|
||||||
this.Name = "FormCreateSupply";
|
|
||||||
this.Text = "Создание поставки";
|
|
||||||
this.Load += new System.EventHandler(this.FormCreateSupply_Load);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private ComboBox comboBoxShop;
|
|
||||||
private Label labelShop;
|
|
||||||
private Label labelJewel;
|
|
||||||
private ComboBox comboBoxJewel;
|
|
||||||
private Label labelCount;
|
|
||||||
private TextBox textBoxCount;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Button buttonSave;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
|
|
||||||
namespace JewelryStoreView
|
|
||||||
{
|
|
||||||
public partial class FormCreateSupply : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IJewelLogic _logicP;
|
|
||||||
private readonly IStoreLogic _logicS;
|
|
||||||
private List<StoreViewModel> _shopList = new List<StoreViewModel>();
|
|
||||||
private List<JewelViewModel> _jewelList = new List<JewelViewModel>();
|
|
||||||
|
|
||||||
public FormCreateSupply(ILogger<FormCreateSupply> logger, IJewelLogic logicP, IStoreLogic logicS)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logicP = logicP;
|
|
||||||
_logicS = logicS;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormCreateSupply_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_shopList = _logicS.ReadList(null);
|
|
||||||
_jewelList = _logicP.ReadList(null);
|
|
||||||
if (_shopList != null)
|
|
||||||
{
|
|
||||||
comboBoxShop.DisplayMember = "ShopName";
|
|
||||||
comboBoxShop.ValueMember = "Id";
|
|
||||||
comboBoxShop.DataSource = _shopList;
|
|
||||||
comboBoxShop.SelectedItem = null;
|
|
||||||
_logger.LogInformation("Загрузка магазинов для поставок");
|
|
||||||
}
|
|
||||||
if (_jewelList != null)
|
|
||||||
{
|
|
||||||
comboBoxJewel.DisplayMember = "JewelName";
|
|
||||||
comboBoxJewel.ValueMember = "Id";
|
|
||||||
comboBoxJewel.DataSource = _jewelList;
|
|
||||||
comboBoxJewel.SelectedItem = null;
|
|
||||||
_logger.LogInformation("Загрузка изделий для поставок");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (comboBoxShop.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxJewel.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Создание поставки");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _logicS.MakeSupply(new SupplyBindingModel
|
|
||||||
{
|
|
||||||
ShopId = Convert.ToInt32(comboBoxShop.SelectedValue),
|
|
||||||
JewelId = Convert.ToInt32(comboBoxJewel.SelectedValue),
|
|
||||||
Count = Convert.ToInt32(textBoxCount.Text)
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при создании поставки. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка создания поставки");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,236 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormJewel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.JewelId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.ComponentName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.labelName = new System.Windows.Forms.Label();
|
|
||||||
this.labelPrice = new System.Windows.Forms.Label();
|
|
||||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
|
||||||
this.textBoxPrice = new System.Windows.Forms.TextBox();
|
|
||||||
this.groupBox = new System.Windows.Forms.GroupBox();
|
|
||||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDelete = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRefresh = new System.Windows.Forms.Button();
|
|
||||||
this.buttonAdd = new System.Windows.Forms.Button();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.groupBox.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
|
||||||
this.JewelId,
|
|
||||||
this.ComponentName,
|
|
||||||
this.Count});
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(6, 25);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowHeadersVisible = false;
|
|
||||||
this.dataGridView.RowHeadersWidth = 62;
|
|
||||||
this.dataGridView.RowTemplate.Height = 33;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(468, 325);
|
|
||||||
this.dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// JewelId
|
|
||||||
//
|
|
||||||
this.JewelId.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
|
||||||
this.JewelId.HeaderText = "Id";
|
|
||||||
this.JewelId.MinimumWidth = 8;
|
|
||||||
this.JewelId.Name = "JewelId";
|
|
||||||
this.JewelId.Visible = false;
|
|
||||||
this.JewelId.Width = 8;
|
|
||||||
//
|
|
||||||
// ComponentName
|
|
||||||
//
|
|
||||||
this.ComponentName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
this.ComponentName.HeaderText = "Компонент";
|
|
||||||
this.ComponentName.MinimumWidth = 8;
|
|
||||||
this.ComponentName.Name = "ComponentName";
|
|
||||||
//
|
|
||||||
// Count
|
|
||||||
//
|
|
||||||
this.Count.HeaderText = "Количество";
|
|
||||||
this.Count.MinimumWidth = 8;
|
|
||||||
this.Count.Name = "Count";
|
|
||||||
this.Count.Width = 150;
|
|
||||||
//
|
|
||||||
// labelName
|
|
||||||
//
|
|
||||||
this.labelName.AutoSize = true;
|
|
||||||
this.labelName.Location = new System.Drawing.Point(15, 17);
|
|
||||||
this.labelName.Name = "labelName";
|
|
||||||
this.labelName.Size = new System.Drawing.Size(94, 25);
|
|
||||||
this.labelName.TabIndex = 1;
|
|
||||||
this.labelName.Text = "Название:";
|
|
||||||
//
|
|
||||||
// labelPrice
|
|
||||||
//
|
|
||||||
this.labelPrice.AutoSize = true;
|
|
||||||
this.labelPrice.Location = new System.Drawing.Point(12, 60);
|
|
||||||
this.labelPrice.Name = "labelPrice";
|
|
||||||
this.labelPrice.Size = new System.Drawing.Size(103, 25);
|
|
||||||
this.labelPrice.TabIndex = 2;
|
|
||||||
this.labelPrice.Text = "Стоимость:";
|
|
||||||
//
|
|
||||||
// textBoxName
|
|
||||||
//
|
|
||||||
this.textBoxName.Location = new System.Drawing.Point(124, 14);
|
|
||||||
this.textBoxName.Name = "textBoxName";
|
|
||||||
this.textBoxName.Size = new System.Drawing.Size(267, 31);
|
|
||||||
this.textBoxName.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// textBoxPrice
|
|
||||||
//
|
|
||||||
this.textBoxPrice.Enabled = false;
|
|
||||||
this.textBoxPrice.Location = new System.Drawing.Point(124, 57);
|
|
||||||
this.textBoxPrice.Name = "textBoxPrice";
|
|
||||||
this.textBoxPrice.Size = new System.Drawing.Size(267, 31);
|
|
||||||
this.textBoxPrice.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// groupBox
|
|
||||||
//
|
|
||||||
this.groupBox.Controls.Add(this.buttonUpdate);
|
|
||||||
this.groupBox.Controls.Add(this.buttonDelete);
|
|
||||||
this.groupBox.Controls.Add(this.buttonRefresh);
|
|
||||||
this.groupBox.Controls.Add(this.buttonAdd);
|
|
||||||
this.groupBox.Controls.Add(this.dataGridView);
|
|
||||||
this.groupBox.Location = new System.Drawing.Point(15, 94);
|
|
||||||
this.groupBox.Name = "groupBox";
|
|
||||||
this.groupBox.Size = new System.Drawing.Size(676, 356);
|
|
||||||
this.groupBox.TabIndex = 5;
|
|
||||||
this.groupBox.TabStop = false;
|
|
||||||
this.groupBox.Text = "Компоненты";
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
this.buttonUpdate.Location = new System.Drawing.Point(505, 242);
|
|
||||||
this.buttonUpdate.Name = "buttonUpdate";
|
|
||||||
this.buttonUpdate.Size = new System.Drawing.Size(141, 34);
|
|
||||||
this.buttonUpdate.TabIndex = 4;
|
|
||||||
this.buttonUpdate.Text = "Обновить";
|
|
||||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
|
||||||
//
|
|
||||||
// buttonDelete
|
|
||||||
//
|
|
||||||
this.buttonDelete.Location = new System.Drawing.Point(505, 181);
|
|
||||||
this.buttonDelete.Name = "buttonDelete";
|
|
||||||
this.buttonDelete.Size = new System.Drawing.Size(141, 34);
|
|
||||||
this.buttonDelete.TabIndex = 3;
|
|
||||||
this.buttonDelete.Text = "Удалить";
|
|
||||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDelete.Click += new System.EventHandler(this.ButtonDelete_Click);
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
this.buttonRefresh.Location = new System.Drawing.Point(505, 118);
|
|
||||||
this.buttonRefresh.Name = "buttonRefresh";
|
|
||||||
this.buttonRefresh.Size = new System.Drawing.Size(141, 34);
|
|
||||||
this.buttonRefresh.TabIndex = 2;
|
|
||||||
this.buttonRefresh.Text = "Изменить";
|
|
||||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(505, 56);
|
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(141, 34);
|
|
||||||
this.buttonAdd.TabIndex = 1;
|
|
||||||
this.buttonAdd.Text = "Добавить";
|
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(377, 456);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonSave.TabIndex = 6;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(549, 456);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonCancel.TabIndex = 7;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// FormJewel
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(708, 500);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.textBoxPrice);
|
|
||||||
this.Controls.Add(this.textBoxName);
|
|
||||||
this.Controls.Add(this.labelPrice);
|
|
||||||
this.Controls.Add(this.labelName);
|
|
||||||
this.Controls.Add(this.groupBox);
|
|
||||||
this.Name = "FormJewel";
|
|
||||||
this.Text = "Изделие";
|
|
||||||
this.Load += new System.EventHandler(this.FormJewel_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.groupBox.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Label labelName;
|
|
||||||
private Label labelPrice;
|
|
||||||
private TextBox textBoxName;
|
|
||||||
private TextBox textBoxPrice;
|
|
||||||
private GroupBox groupBox;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonDelete;
|
|
||||||
private Button buttonRefresh;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private DataGridViewTextBoxColumn JewelId;
|
|
||||||
private DataGridViewTextBoxColumn ComponentName;
|
|
||||||
private DataGridViewTextBoxColumn Count;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,208 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreDataModels.Models;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormJewel : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IJewelLogic _logic;
|
|
||||||
private int? _id;
|
|
||||||
private Dictionary<int, (IComponentModel, int)> _JewelComponents;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
|
|
||||||
public FormJewel(ILogger<FormJewel> logger, IJewelLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
_JewelComponents = new Dictionary<int, (IComponentModel, int)>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormJewel_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var view = _logic.ReadElement(new JewelSearchModel
|
|
||||||
{
|
|
||||||
Id = _id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
textBoxName.Text = view.JewelName;
|
|
||||||
textBoxPrice.Text = view.Price.ToString();
|
|
||||||
_JewelComponents = view.JewelComponents ?? new Dictionary<int, (IComponentModel, int)>();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка компонентов изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_JewelComponents != null)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Clear();
|
|
||||||
foreach (var jc in _JewelComponents)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { jc.Key, jc.Value.Item1.ComponentName, jc.Value.Item2 });
|
|
||||||
}
|
|
||||||
textBoxPrice.Text = CalcPrice().ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонентов изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormJewelComponent));
|
|
||||||
if (service is FormJewelComponent form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (form.ComponentModel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Добавление нового компонента:{ ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
|
|
||||||
if (_JewelComponents.ContainsKey(form.Id))
|
|
||||||
{
|
|
||||||
_JewelComponents[form.Id] = (form.ComponentModel, form.Count);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_JewelComponents.Add(form.Id, (form.ComponentModel, form.Count));
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormJewelComponent));
|
|
||||||
if (service is FormJewelComponent form)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
|
||||||
form.Id = id;
|
|
||||||
form.Count = _JewelComponents[id].Item2;
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (form.ComponentModel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
|
|
||||||
_JewelComponents[form.Id] = (form.ComponentModel, form.Count);
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Удаление компонента: { ComponentName} - { Count}", dataGridView.SelectedRows[0].Cells[1].Value);
|
|
||||||
_JewelComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(textBoxPrice.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_JewelComponents == null || _JewelComponents.Count == 0)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new JewelBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
JewelName = textBoxName.Text,
|
|
||||||
Price = Convert.ToDouble(textBoxPrice.Text),
|
|
||||||
JewelComponents = _JewelComponents
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private double CalcPrice()
|
|
||||||
{
|
|
||||||
double price = 0;
|
|
||||||
foreach (var elem in _JewelComponents)
|
|
||||||
{
|
|
||||||
price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
|
|
||||||
}
|
|
||||||
return Math.Round(price * 1.1, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="JewelId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="ComponentName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,120 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormJewelComponent
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.labelComponent = new System.Windows.Forms.Label();
|
|
||||||
this.labelCount = new System.Windows.Forms.Label();
|
|
||||||
this.comboBoxComponent = new System.Windows.Forms.ComboBox();
|
|
||||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
|
||||||
this.buttonSave = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelComponent
|
|
||||||
//
|
|
||||||
this.labelComponent.AutoSize = true;
|
|
||||||
this.labelComponent.Location = new System.Drawing.Point(16, 21);
|
|
||||||
this.labelComponent.Name = "labelComponent";
|
|
||||||
this.labelComponent.Size = new System.Drawing.Size(107, 25);
|
|
||||||
this.labelComponent.TabIndex = 0;
|
|
||||||
this.labelComponent.Text = "Компонент:";
|
|
||||||
//
|
|
||||||
// labelCount
|
|
||||||
//
|
|
||||||
this.labelCount.AutoSize = true;
|
|
||||||
this.labelCount.Location = new System.Drawing.Point(16, 70);
|
|
||||||
this.labelCount.Name = "labelCount";
|
|
||||||
this.labelCount.Size = new System.Drawing.Size(111, 25);
|
|
||||||
this.labelCount.TabIndex = 1;
|
|
||||||
this.labelCount.Text = "Количество:";
|
|
||||||
//
|
|
||||||
// comboBoxComponent
|
|
||||||
//
|
|
||||||
this.comboBoxComponent.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.comboBoxComponent.FormattingEnabled = true;
|
|
||||||
this.comboBoxComponent.Location = new System.Drawing.Point(148, 18);
|
|
||||||
this.comboBoxComponent.Name = "comboBoxComponent";
|
|
||||||
this.comboBoxComponent.Size = new System.Drawing.Size(288, 33);
|
|
||||||
this.comboBoxComponent.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// textBoxCount
|
|
||||||
//
|
|
||||||
this.textBoxCount.Location = new System.Drawing.Point(148, 67);
|
|
||||||
this.textBoxCount.Name = "textBoxCount";
|
|
||||||
this.textBoxCount.Size = new System.Drawing.Size(288, 31);
|
|
||||||
this.textBoxCount.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// buttonSave
|
|
||||||
//
|
|
||||||
this.buttonSave.Location = new System.Drawing.Point(148, 115);
|
|
||||||
this.buttonSave.Name = "buttonSave";
|
|
||||||
this.buttonSave.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonSave.TabIndex = 4;
|
|
||||||
this.buttonSave.Text = "Сохранить";
|
|
||||||
this.buttonSave.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(324, 115);
|
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(112, 34);
|
|
||||||
this.buttonCancel.TabIndex = 5;
|
|
||||||
this.buttonCancel.Text = "Отмена";
|
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// FormJewelComponent
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(461, 173);
|
|
||||||
this.Controls.Add(this.buttonCancel);
|
|
||||||
this.Controls.Add(this.buttonSave);
|
|
||||||
this.Controls.Add(this.textBoxCount);
|
|
||||||
this.Controls.Add(this.comboBoxComponent);
|
|
||||||
this.Controls.Add(this.labelCount);
|
|
||||||
this.Controls.Add(this.labelComponent);
|
|
||||||
this.Name = "FormJewelComponent";
|
|
||||||
this.Text = "Компонент изделия";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label labelComponent;
|
|
||||||
private Label labelCount;
|
|
||||||
private ComboBox comboBoxComponent;
|
|
||||||
private TextBox textBoxCount;
|
|
||||||
private Button buttonSave;
|
|
||||||
private Button buttonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using JewelryStoreDataModels.Models;
|
|
||||||
|
|
||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormJewelComponent : Form
|
|
||||||
{
|
|
||||||
private readonly List<ComponentViewModel>? _list;
|
|
||||||
|
|
||||||
public int Id
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Convert.ToInt32(comboBoxComponent.SelectedValue);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
comboBoxComponent.SelectedValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IComponentModel? ComponentModel
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_list == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach (var elem in _list)
|
|
||||||
{
|
|
||||||
if (elem.Id == Id)
|
|
||||||
{
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { return Convert.ToInt32(textBoxCount.Text); }
|
|
||||||
set { textBoxCount.Text = value.ToString(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormJewelComponent(IComponentLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_list = logic.ReadList(null);
|
|
||||||
if (_list != null)
|
|
||||||
{
|
|
||||||
comboBoxComponent.DisplayMember = "ComponentName";
|
|
||||||
comboBoxComponent.ValueMember = "Id";
|
|
||||||
comboBoxComponent.DataSource = _list;
|
|
||||||
comboBoxComponent.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxComponent.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите компонент", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,117 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormJewels
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDelete = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRefresh = new System.Windows.Forms.Button();
|
|
||||||
this.buttonAdd = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.GridColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(17, 18);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowHeadersWidth = 62;
|
|
||||||
this.dataGridView.RowTemplate.Height = 33;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(467, 333);
|
|
||||||
this.dataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonUpdate
|
|
||||||
//
|
|
||||||
this.buttonUpdate.Location = new System.Drawing.Point(516, 262);
|
|
||||||
this.buttonUpdate.Name = "buttonUpdate";
|
|
||||||
this.buttonUpdate.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonUpdate.TabIndex = 8;
|
|
||||||
this.buttonUpdate.Text = "Обновить";
|
|
||||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click);
|
|
||||||
//
|
|
||||||
// buttonDelete
|
|
||||||
//
|
|
||||||
this.buttonDelete.Location = new System.Drawing.Point(516, 191);
|
|
||||||
this.buttonDelete.Name = "buttonDelete";
|
|
||||||
this.buttonDelete.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonDelete.TabIndex = 7;
|
|
||||||
this.buttonDelete.Text = "Удалить";
|
|
||||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDelete.Click += new System.EventHandler(this.ButtonDelete_Click);
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
this.buttonRefresh.Location = new System.Drawing.Point(516, 120);
|
|
||||||
this.buttonRefresh.Name = "buttonRefresh";
|
|
||||||
this.buttonRefresh.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonRefresh.TabIndex = 6;
|
|
||||||
this.buttonRefresh.Text = "Изменить";
|
|
||||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(516, 51);
|
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(164, 34);
|
|
||||||
this.buttonAdd.TabIndex = 5;
|
|
||||||
this.buttonAdd.Text = "Добавить";
|
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
|
||||||
//
|
|
||||||
// FormJewels
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(709, 364);
|
|
||||||
this.Controls.Add(this.buttonUpdate);
|
|
||||||
this.Controls.Add(this.buttonDelete);
|
|
||||||
this.Controls.Add(this.buttonRefresh);
|
|
||||||
this.Controls.Add(this.buttonAdd);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormJewels";
|
|
||||||
this.Text = "Изделия";
|
|
||||||
this.Load += new System.EventHandler(this.FormJewels_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button buttonUpdate;
|
|
||||||
private Button buttonDelete;
|
|
||||||
private Button buttonRefresh;
|
|
||||||
private Button buttonAdd;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormJewels : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IJewelLogic _logic;
|
|
||||||
|
|
||||||
public FormJewels(ILogger<FormJewels> logger, IJewelLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["JewelName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка изделий");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки изделий");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormJewel));
|
|
||||||
if (service is FormJewel form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormJewel));
|
|
||||||
if (service is FormJewel form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
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("Удаление изделия");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new JewelBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpdate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormJewels_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,228 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormMain
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
|
||||||
this.СправочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.КомпонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.ИзделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.списокИзделийToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
|
||||||
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
|
|
||||||
this.buttonOrderReady = new System.Windows.Forms.Button();
|
|
||||||
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRefresh = new System.Windows.Forms.Button();
|
|
||||||
this.пополнениеМагазинаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.menuStrip.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// menuStrip
|
|
||||||
//
|
|
||||||
this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
|
|
||||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.СправочникиToolStripMenuItem,
|
|
||||||
this.отчетыToolStripMenuItem,
|
|
||||||
this.клиентыToolStripMenuItem});
|
|
||||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.menuStrip.Name = "menuStrip";
|
|
||||||
this.menuStrip.Size = new System.Drawing.Size(1121, 33);
|
|
||||||
this.menuStrip.TabIndex = 0;
|
|
||||||
this.menuStrip.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// СправочникиToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.СправочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.КомпонентыToolStripMenuItem,
|
|
||||||
this.ИзделияToolStripMenuItem,
|
|
||||||
this.магазиныToolStripMenuItem});
|
|
||||||
this.СправочникиToolStripMenuItem.Name = "СправочникиToolStripMenuItem";
|
|
||||||
this.СправочникиToolStripMenuItem.Size = new System.Drawing.Size(139, 29);
|
|
||||||
this.СправочникиToolStripMenuItem.Text = "Справочники";
|
|
||||||
//
|
|
||||||
// КомпонентыToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem";
|
|
||||||
this.КомпонентыToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
|
|
||||||
this.КомпонентыToolStripMenuItem.Text = "Компоненты";
|
|
||||||
this.КомпонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// ИзделияToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.ИзделияToolStripMenuItem.Name = "ИзделияToolStripMenuItem";
|
|
||||||
this.ИзделияToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
|
|
||||||
this.ИзделияToolStripMenuItem.Text = "Изделия";
|
|
||||||
this.ИзделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// отчетыToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.списокИзделийToolStripMenuItem,
|
|
||||||
this.компонентыПоИзделиямToolStripMenuItem,
|
|
||||||
this.списокЗаказовToolStripMenuItem});
|
|
||||||
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
|
||||||
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(88, 29);
|
|
||||||
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
|
||||||
//
|
|
||||||
// списокИзделийToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.списокИзделийToolStripMenuItem.Name = "списокИзделийToolStripMenuItem";
|
|
||||||
this.списокИзделийToolStripMenuItem.Size = new System.Drawing.Size(327, 34);
|
|
||||||
this.списокИзделийToolStripMenuItem.Text = "Список изделий";
|
|
||||||
this.списокИзделийToolStripMenuItem.Click += new System.EventHandler(this.СписокИзделийToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// компонентыПоИзделиямToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
|
|
||||||
this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(327, 34);
|
|
||||||
this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
|
|
||||||
this.компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыПоИзделиямToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// списокЗаказовToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
|
|
||||||
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(327, 34);
|
|
||||||
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
|
||||||
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.СписокЗаказовToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 36);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowHeadersWidth = 62;
|
|
||||||
this.dataGridView.RowTemplate.Height = 33;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(851, 402);
|
|
||||||
this.dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// buttonCreateOrder
|
|
||||||
//
|
|
||||||
this.buttonCreateOrder.Location = new System.Drawing.Point(884, 78);
|
|
||||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
|
||||||
this.buttonCreateOrder.Size = new System.Drawing.Size(210, 34);
|
|
||||||
this.buttonCreateOrder.TabIndex = 2;
|
|
||||||
this.buttonCreateOrder.Text = "Создать заказ";
|
|
||||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
|
|
||||||
//
|
|
||||||
// buttonTakeOrderInWork
|
|
||||||
//
|
|
||||||
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(884, 150);
|
|
||||||
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
|
||||||
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(210, 34);
|
|
||||||
this.buttonTakeOrderInWork.TabIndex = 3;
|
|
||||||
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
|
||||||
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
|
|
||||||
//
|
|
||||||
// buttonOrderReady
|
|
||||||
//
|
|
||||||
this.buttonOrderReady.Location = new System.Drawing.Point(884, 221);
|
|
||||||
this.buttonOrderReady.Name = "buttonOrderReady";
|
|
||||||
this.buttonOrderReady.Size = new System.Drawing.Size(210, 34);
|
|
||||||
this.buttonOrderReady.TabIndex = 4;
|
|
||||||
this.buttonOrderReady.Text = "Заказ готов";
|
|
||||||
this.buttonOrderReady.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
|
|
||||||
//
|
|
||||||
// buttonIssuedOrder
|
|
||||||
//
|
|
||||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(884, 292);
|
|
||||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
|
||||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(210, 34);
|
|
||||||
this.buttonIssuedOrder.TabIndex = 5;
|
|
||||||
this.buttonIssuedOrder.Text = "Заказ выдан";
|
|
||||||
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
this.buttonRefresh.Location = new System.Drawing.Point(884, 361);
|
|
||||||
this.buttonRefresh.Name = "buttonRefresh";
|
|
||||||
this.buttonRefresh.Size = new System.Drawing.Size(210, 34);
|
|
||||||
this.buttonRefresh.TabIndex = 6;
|
|
||||||
this.buttonRefresh.Text = "Обновить список";
|
|
||||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
|
|
||||||
//
|
|
||||||
// пополнениеМагазинаToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.пополнениеМагазинаToolStripMenuItem.Name = "пополнениеМагазинаToolStripMenuItem";
|
|
||||||
this.пополнениеМагазинаToolStripMenuItem.Size = new System.Drawing.Size(210, 29);
|
|
||||||
this.пополнениеМагазинаToolStripMenuItem.Text = "Пополнение магазина";
|
|
||||||
this.пополнениеМагазинаToolStripMenuItem.Click += new System.EventHandler(this.ПополнениеМагазинаToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// FormMain
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(1121, 450);
|
|
||||||
this.Controls.Add(this.buttonRefresh);
|
|
||||||
this.Controls.Add(this.buttonIssuedOrder);
|
|
||||||
this.Controls.Add(this.buttonOrderReady);
|
|
||||||
this.Controls.Add(this.buttonTakeOrderInWork);
|
|
||||||
this.Controls.Add(this.buttonCreateOrder);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Controls.Add(this.menuStrip);
|
|
||||||
this.MainMenuStrip = this.menuStrip;
|
|
||||||
this.Name = "FormMain";
|
|
||||||
this.Text = "Ювелирная лавка";
|
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
|
||||||
this.menuStrip.ResumeLayout(false);
|
|
||||||
this.menuStrip.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private MenuStrip menuStrip;
|
|
||||||
private ToolStripMenuItem СправочникиToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem КомпонентыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem ИзделияToolStripMenuItem;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private Button buttonCreateOrder;
|
|
||||||
private Button buttonTakeOrderInWork;
|
|
||||||
private Button buttonOrderReady;
|
|
||||||
private Button buttonIssuedOrder;
|
|
||||||
private Button buttonRefresh;
|
|
||||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem списокИзделийToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,228 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.BusinessLogics;
|
|
||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreDataModels.Enums;
|
|
||||||
using JewelryStoreView;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using PizzeriaView;
|
|
||||||
|
|
||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormMain : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IOrderLogic _orderLogic;
|
|
||||||
private readonly IReportLogic _reportLogic;
|
|
||||||
|
|
||||||
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_orderLogic = orderLogic;
|
|
||||||
_reportLogic = reportLogic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _orderLogic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["JewelId"].Visible = false;
|
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки заказов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
|
||||||
if (service is FormComponents form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormJewels));
|
|
||||||
if (service is FormJewels form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
|
||||||
if (service is FormCreateOrder form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel {
|
|
||||||
Id = id,
|
|
||||||
ClientId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ClientId"].Value),
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void shopsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormStores));
|
|
||||||
if (service is FormStores form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void transactionToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateSupply));
|
|
||||||
if (service is FormCreateSupply form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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("Заказ №{id}. Меняется статус на 'Готов'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel {
|
|
||||||
Id = id,
|
|
||||||
ClientId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ClientId"].Value),
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
|
||||||
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel {
|
|
||||||
Id = id,
|
|
||||||
ClientId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ClientId"].Value),
|
|
||||||
});
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BusyShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportShop));
|
|
||||||
if (service is FormReportShop form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ПополнениеМагазинаToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormStoreReplenishment));
|
|
||||||
|
|
||||||
if (service is FormStoreReplenishment form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
_reportLogic.SaveJewelsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void InfoToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
_reportLogic.SaveShopsToWordFile(new ReportBindingModel { FileName = dialog.FileName });
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void GroupOrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders));
|
|
||||||
if (service is FormReportGroupedOrders form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,86 +0,0 @@
|
|||||||
namespace PizzeriaView
|
|
||||||
{
|
|
||||||
partial class FormReportGroupedOrders
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.panel = new System.Windows.Forms.Panel();
|
|
||||||
this.buttonToPDF = new System.Windows.Forms.Button();
|
|
||||||
this.buttonMake = new System.Windows.Forms.Button();
|
|
||||||
this.panel.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel
|
|
||||||
//
|
|
||||||
this.panel.Controls.Add(this.buttonToPDF);
|
|
||||||
this.panel.Controls.Add(this.buttonMake);
|
|
||||||
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
|
||||||
this.panel.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.panel.Name = "panel";
|
|
||||||
this.panel.Size = new System.Drawing.Size(970, 52);
|
|
||||||
this.panel.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// buttonToPDF
|
|
||||||
//
|
|
||||||
this.buttonToPDF.Location = new System.Drawing.Point(486, 12);
|
|
||||||
this.buttonToPDF.Name = "buttonToPDF";
|
|
||||||
this.buttonToPDF.Size = new System.Drawing.Size(411, 29);
|
|
||||||
this.buttonToPDF.TabIndex = 5;
|
|
||||||
this.buttonToPDF.Text = "В PDF";
|
|
||||||
this.buttonToPDF.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonToPDF.Click += new System.EventHandler(this.buttonToPDF_Click);
|
|
||||||
//
|
|
||||||
// buttonMake
|
|
||||||
//
|
|
||||||
this.buttonMake.Location = new System.Drawing.Point(49, 12);
|
|
||||||
this.buttonMake.Name = "buttonMake";
|
|
||||||
this.buttonMake.Size = new System.Drawing.Size(377, 29);
|
|
||||||
this.buttonMake.TabIndex = 4;
|
|
||||||
this.buttonMake.Text = "Сформировать";
|
|
||||||
this.buttonMake.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
|
||||||
//
|
|
||||||
// FormReportGroupedOrders
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(970, 450);
|
|
||||||
this.Controls.Add(this.panel);
|
|
||||||
this.Name = "FormReportGroupedOrders";
|
|
||||||
this.Text = "Отчёт по группированным заказам ";
|
|
||||||
this.panel.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel;
|
|
||||||
private Button buttonToPDF;
|
|
||||||
private Button buttonMake;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Reporting.WinForms;
|
|
||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.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 PizzeriaView
|
|
||||||
{
|
|
||||||
public partial class FormReportGroupedOrders : Form
|
|
||||||
{
|
|
||||||
private readonly ReportViewer reportViewer;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
|
|
||||||
public FormReportGroupedOrders(ILogger<FormReportGroupedOrders> logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
reportViewer = new ReportViewer
|
|
||||||
{
|
|
||||||
Dock = DockStyle.Fill
|
|
||||||
};
|
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportGroupedOrders.rdlc", FileMode.Open));
|
|
||||||
Controls.Clear();
|
|
||||||
Controls.Add(reportViewer);
|
|
||||||
Controls.Add(panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonMake_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dataSource = _logic.GetGroupedOrders();
|
|
||||||
var source = new ReportDataSource("DataSetGroupedOrders", dataSource);
|
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
|
||||||
|
|
||||||
reportViewer.RefreshReport();
|
|
||||||
_logger.LogInformation("Загрузка списка группированных заказов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка группированных заказов на период");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonToPDF_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logic.SaveGroupedOrdersToPdfFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName,
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка группированных заказов");
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка группированных заказов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,108 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormReportJewelComponents
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.buttonSaveToExcel = new System.Windows.Forms.Button();
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.ColumnComponent = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.ColumnJewel = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonSaveToExcel
|
|
||||||
//
|
|
||||||
this.buttonSaveToExcel.Location = new System.Drawing.Point(22, 21);
|
|
||||||
this.buttonSaveToExcel.Name = "buttonSaveToExcel";
|
|
||||||
this.buttonSaveToExcel.Size = new System.Drawing.Size(193, 34);
|
|
||||||
this.buttonSaveToExcel.TabIndex = 0;
|
|
||||||
this.buttonSaveToExcel.Text = "Сохранить в Excel";
|
|
||||||
this.buttonSaveToExcel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
|
||||||
this.ColumnComponent,
|
|
||||||
this.ColumnJewel,
|
|
||||||
this.ColumnCount});
|
|
||||||
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(0, 77);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.RowHeadersVisible = false;
|
|
||||||
this.dataGridView.RowHeadersWidth = 62;
|
|
||||||
this.dataGridView.RowTemplate.Height = 33;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(800, 373);
|
|
||||||
this.dataGridView.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// ColumnComponent
|
|
||||||
//
|
|
||||||
this.ColumnComponent.HeaderText = "Компонент";
|
|
||||||
this.ColumnComponent.MinimumWidth = 8;
|
|
||||||
this.ColumnComponent.Name = "ColumnComponent";
|
|
||||||
//
|
|
||||||
// ColumnJewel
|
|
||||||
//
|
|
||||||
this.ColumnJewel.HeaderText = "Изделие";
|
|
||||||
this.ColumnJewel.MinimumWidth = 8;
|
|
||||||
this.ColumnJewel.Name = "ColumnJewel";
|
|
||||||
//
|
|
||||||
// ColumnCount
|
|
||||||
//
|
|
||||||
this.ColumnCount.HeaderText = "Количество";
|
|
||||||
this.ColumnCount.MinimumWidth = 8;
|
|
||||||
this.ColumnCount.Name = "ColumnCount";
|
|
||||||
//
|
|
||||||
// FormReportJewelComponents
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Controls.Add(this.buttonSaveToExcel);
|
|
||||||
this.Name = "FormReportJewelComponents";
|
|
||||||
this.Text = "Компоненты по изделиям";
|
|
||||||
this.Load += new System.EventHandler(this.FormReportJewelComponents_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button buttonSaveToExcel;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private DataGridViewTextBoxColumn ColumnComponent;
|
|
||||||
private DataGridViewTextBoxColumn ColumnJewel;
|
|
||||||
private DataGridViewTextBoxColumn ColumnCount;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
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 JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormReportJewelComponents : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
public FormReportJewelComponents(ILogger<FormReportJewelComponents> logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
private void FormReportJewelComponents_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dict = _logic.GetJewelComponent();
|
|
||||||
if (dict != null)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Clear();
|
|
||||||
foreach (var elem in dict)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { elem.JewelName, "", "" });
|
|
||||||
foreach (var listElem in elem.Components)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
|
||||||
}
|
|
||||||
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
|
||||||
dataGridView.Rows.Add(Array.Empty<object>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка списка изделий по компонентам");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logic.SaveJewelComponentToExcelFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка изделий по компонентам");
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="ColumnComponent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="ColumnJewel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,138 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormReportOrders
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.panel = new System.Windows.Forms.Panel();
|
|
||||||
this.buttonToPdf = new System.Windows.Forms.Button();
|
|
||||||
this.buttonMake = new System.Windows.Forms.Button();
|
|
||||||
this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
|
||||||
this.labelTo = new System.Windows.Forms.Label();
|
|
||||||
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
|
||||||
this.labelFrom = new System.Windows.Forms.Label();
|
|
||||||
this.panel.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel
|
|
||||||
//
|
|
||||||
this.panel.Controls.Add(this.buttonToPdf);
|
|
||||||
this.panel.Controls.Add(this.buttonMake);
|
|
||||||
this.panel.Controls.Add(this.dateTimePickerTo);
|
|
||||||
this.panel.Controls.Add(this.labelTo);
|
|
||||||
this.panel.Controls.Add(this.dateTimePickerFrom);
|
|
||||||
this.panel.Controls.Add(this.labelFrom);
|
|
||||||
this.panel.Dock = System.Windows.Forms.DockStyle.Top;
|
|
||||||
this.panel.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.panel.Name = "panel";
|
|
||||||
this.panel.Size = new System.Drawing.Size(1141, 71);
|
|
||||||
this.panel.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonToPdf
|
|
||||||
//
|
|
||||||
this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonToPdf.Location = new System.Drawing.Point(904, 14);
|
|
||||||
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
|
||||||
this.buttonToPdf.Name = "buttonToPdf";
|
|
||||||
this.buttonToPdf.Size = new System.Drawing.Size(199, 45);
|
|
||||||
this.buttonToPdf.TabIndex = 10;
|
|
||||||
this.buttonToPdf.Text = "В Pdf";
|
|
||||||
this.buttonToPdf.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
|
|
||||||
//
|
|
||||||
// buttonMake
|
|
||||||
//
|
|
||||||
this.buttonMake.Location = new System.Drawing.Point(600, 14);
|
|
||||||
this.buttonMake.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
|
||||||
this.buttonMake.Name = "buttonMake";
|
|
||||||
this.buttonMake.Size = new System.Drawing.Size(199, 45);
|
|
||||||
this.buttonMake.TabIndex = 8;
|
|
||||||
this.buttonMake.Text = "Сформировать";
|
|
||||||
this.buttonMake.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
|
||||||
//
|
|
||||||
// dateTimePickerTo
|
|
||||||
//
|
|
||||||
this.dateTimePickerTo.Location = new System.Drawing.Point(338, 19);
|
|
||||||
this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
|
||||||
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
|
||||||
this.dateTimePickerTo.Size = new System.Drawing.Size(231, 31);
|
|
||||||
this.dateTimePickerTo.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// labelTo
|
|
||||||
//
|
|
||||||
this.labelTo.AutoSize = true;
|
|
||||||
this.labelTo.Location = new System.Drawing.Point(293, 24);
|
|
||||||
this.labelTo.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
|
||||||
this.labelTo.Name = "labelTo";
|
|
||||||
this.labelTo.Size = new System.Drawing.Size(33, 25);
|
|
||||||
this.labelTo.TabIndex = 6;
|
|
||||||
this.labelTo.Text = "по";
|
|
||||||
//
|
|
||||||
// dateTimePickerFrom
|
|
||||||
//
|
|
||||||
this.dateTimePickerFrom.Location = new System.Drawing.Point(50, 19);
|
|
||||||
this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5);
|
|
||||||
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
|
||||||
this.dateTimePickerFrom.Size = new System.Drawing.Size(231, 31);
|
|
||||||
this.dateTimePickerFrom.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// labelFrom
|
|
||||||
//
|
|
||||||
this.labelFrom.AutoSize = true;
|
|
||||||
this.labelFrom.Location = new System.Drawing.Point(15, 24);
|
|
||||||
this.labelFrom.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
|
||||||
this.labelFrom.Name = "labelFrom";
|
|
||||||
this.labelFrom.Size = new System.Drawing.Size(23, 25);
|
|
||||||
this.labelFrom.TabIndex = 1;
|
|
||||||
this.labelFrom.Text = "С";
|
|
||||||
//
|
|
||||||
// FormReportOrders
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(1141, 450);
|
|
||||||
this.Controls.Add(this.panel);
|
|
||||||
this.Name = "FormReportOrders";
|
|
||||||
this.Text = "Заказы";
|
|
||||||
this.panel.ResumeLayout(false);
|
|
||||||
this.panel.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel;
|
|
||||||
private Button buttonMake;
|
|
||||||
private DateTimePicker dateTimePickerTo;
|
|
||||||
private Label labelTo;
|
|
||||||
private DateTimePicker dateTimePickerFrom;
|
|
||||||
private Label labelFrom;
|
|
||||||
private Button buttonToPdf;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Reporting.WinForms;
|
|
||||||
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 JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormReportOrders : Form
|
|
||||||
{
|
|
||||||
private readonly ReportViewer reportViewer;
|
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
|
|
||||||
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
reportViewer = new ReportViewer
|
|
||||||
{
|
|
||||||
Dock = DockStyle.Fill
|
|
||||||
};
|
|
||||||
reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportOrders.rdlc", FileMode.Open));
|
|
||||||
Controls.Clear();
|
|
||||||
Controls.Add(reportViewer);
|
|
||||||
Controls.Add(panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonMake_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dataSource = _logic.GetOrders(new ReportBindingModel
|
|
||||||
{
|
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
|
||||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
|
||||||
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
|
||||||
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
|
||||||
|
|
||||||
reportViewer.RefreshReport();
|
|
||||||
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка заказов на период");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonToPdf_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName,
|
|
||||||
DateFrom = dateTimePickerFrom.Value,
|
|
||||||
DateTo = dateTimePickerTo.Value
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,115 +0,0 @@
|
|||||||
namespace PizzeriaView
|
|
||||||
{
|
|
||||||
partial class FormReportShop
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.buttonSaveToExcel = new System.Windows.Forms.Button();
|
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.ColumnShop = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.ColumnJewel = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonSaveToExcel
|
|
||||||
//
|
|
||||||
this.buttonSaveToExcel.Location = new System.Drawing.Point(0, 6);
|
|
||||||
this.buttonSaveToExcel.Name = "buttonSaveToExcel";
|
|
||||||
this.buttonSaveToExcel.Size = new System.Drawing.Size(223, 29);
|
|
||||||
this.buttonSaveToExcel.TabIndex = 3;
|
|
||||||
this.buttonSaveToExcel.Text = "Сохранить в Excel";
|
|
||||||
this.buttonSaveToExcel.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
|
|
||||||
//
|
|
||||||
// dataGridView
|
|
||||||
//
|
|
||||||
this.dataGridView.AllowUserToAddRows = false;
|
|
||||||
this.dataGridView.AllowUserToDeleteRows = false;
|
|
||||||
this.dataGridView.AllowUserToOrderColumns = true;
|
|
||||||
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
|
||||||
this.ColumnShop,
|
|
||||||
this.ColumnJewel,
|
|
||||||
this.ColumnCount});
|
|
||||||
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
|
|
||||||
this.dataGridView.Location = new System.Drawing.Point(0, 47);
|
|
||||||
this.dataGridView.Name = "dataGridView";
|
|
||||||
this.dataGridView.ReadOnly = true;
|
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
|
||||||
this.dataGridView.Size = new System.Drawing.Size(598, 403);
|
|
||||||
this.dataGridView.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// ColumnShop
|
|
||||||
//
|
|
||||||
this.ColumnShop.FillWeight = 130F;
|
|
||||||
this.ColumnShop.HeaderText = "Магазин";
|
|
||||||
this.ColumnShop.MinimumWidth = 6;
|
|
||||||
this.ColumnShop.Name = "ColumnShop";
|
|
||||||
this.ColumnShop.ReadOnly = true;
|
|
||||||
|
|
||||||
//
|
|
||||||
this.ColumnJewel.FillWeight = 140F;
|
|
||||||
this.ColumnJewel.HeaderText = "Украшения";
|
|
||||||
this.ColumnJewel.MinimumWidth = 6;
|
|
||||||
this.ColumnJewel.Name = "ColumnJewel";
|
|
||||||
this.ColumnJewel.ReadOnly = true;
|
|
||||||
//
|
|
||||||
// ColumnCount
|
|
||||||
//
|
|
||||||
this.ColumnCount.FillWeight = 90F;
|
|
||||||
this.ColumnCount.HeaderText = "Количество";
|
|
||||||
this.ColumnCount.MinimumWidth = 6;
|
|
||||||
this.ColumnCount.Name = "ColumnCount";
|
|
||||||
this.ColumnCount.ReadOnly = true;
|
|
||||||
//
|
|
||||||
// FormReportShop
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(598, 450);
|
|
||||||
this.Controls.Add(this.buttonSaveToExcel);
|
|
||||||
this.Controls.Add(this.dataGridView);
|
|
||||||
this.Name = "FormReportShop";
|
|
||||||
this.Text = "Наполненость магазинов";
|
|
||||||
this.Load += new System.EventHandler(this.FormReportShop_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Button buttonSaveToExcel;
|
|
||||||
private DataGridView dataGridView;
|
|
||||||
private DataGridViewTextBoxColumn ColumnShop;
|
|
||||||
private DataGridViewTextBoxColumn ColumnJewel;
|
|
||||||
private DataGridViewTextBoxColumn ColumnCount;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.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 PizzeriaView
|
|
||||||
{
|
|
||||||
public partial class FormReportShop : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IReportLogic _logic;
|
|
||||||
|
|
||||||
public FormReportShop(ILogger<FormReportShop> logger, IReportLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormReportShop_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dict = _logic.GetShops();
|
|
||||||
if (dict != null)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Clear();
|
|
||||||
foreach (var elem in dict)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
|
|
||||||
foreach (var listElem in elem.Jewels)
|
|
||||||
{
|
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
|
||||||
}
|
|
||||||
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
|
|
||||||
dataGridView.Rows.Add(Array.Empty<object>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка списка пицц по магазинам");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки списка пицц по магазинам");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logic.SaveShopsToExcelFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName
|
|
||||||
});
|
|
||||||
_logger.LogInformation("Сохранение списка пицц по магазинам");
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения списка пицц по магазинам");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,200 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormStore
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.StoreNameLabel = new System.Windows.Forms.Label();
|
|
||||||
this.StoreAdressLabel = new System.Windows.Forms.Label();
|
|
||||||
this.OpeningDateLabel = new System.Windows.Forms.Label();
|
|
||||||
this.NameTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.AdressTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.DataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.JewelName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.JewelPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.JewelCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.SaveButton = new System.Windows.Forms.Button();
|
|
||||||
|
|
||||||
this.OpeningDatePicker = new System.Windows.Forms.DateTimePicker();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpJewelMaxCount)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// StoreNameLabel
|
|
||||||
//
|
|
||||||
this.StoreNameLabel.AutoSize = true;
|
|
||||||
this.StoreNameLabel.Location = new System.Drawing.Point(17, 13);
|
|
||||||
this.StoreNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.StoreNameLabel.Name = "StoreNameLabel";
|
|
||||||
this.StoreNameLabel.Size = new System.Drawing.Size(179, 25);
|
|
||||||
this.StoreNameLabel.TabIndex = 0;
|
|
||||||
this.StoreNameLabel.Text = "Название магазина: ";
|
|
||||||
//
|
|
||||||
// StoreAdressLabel
|
|
||||||
//
|
|
||||||
this.StoreAdressLabel.AutoSize = true;
|
|
||||||
this.StoreAdressLabel.Location = new System.Drawing.Point(17, 54);
|
|
||||||
this.StoreAdressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.StoreAdressLabel.Name = "StoreAdressLabel";
|
|
||||||
this.StoreAdressLabel.Size = new System.Drawing.Size(151, 25);
|
|
||||||
this.StoreAdressLabel.TabIndex = 1;
|
|
||||||
this.StoreAdressLabel.Text = "Адрес магазина: ";
|
|
||||||
//
|
|
||||||
// OpeningDateLabel
|
|
||||||
//
|
|
||||||
this.OpeningDateLabel.AutoSize = true;
|
|
||||||
this.OpeningDateLabel.Location = new System.Drawing.Point(17, 99);
|
|
||||||
this.OpeningDateLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.OpeningDateLabel.Name = "OpeningDateLabel";
|
|
||||||
this.OpeningDateLabel.Size = new System.Drawing.Size(140, 25);
|
|
||||||
this.OpeningDateLabel.TabIndex = 2;
|
|
||||||
this.OpeningDateLabel.Text = "Дата открытия: ";
|
|
||||||
//
|
|
||||||
// NameTextBox
|
|
||||||
//
|
|
||||||
this.NameTextBox.Location = new System.Drawing.Point(204, 10);
|
|
||||||
this.NameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.NameTextBox.Name = "NameTextBox";
|
|
||||||
this.NameTextBox.Size = new System.Drawing.Size(247, 31);
|
|
||||||
this.NameTextBox.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// AdressTextBox
|
|
||||||
//
|
|
||||||
this.AdressTextBox.Location = new System.Drawing.Point(204, 51);
|
|
||||||
this.AdressTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.AdressTextBox.Name = "AdressTextBox";
|
|
||||||
this.AdressTextBox.Size = new System.Drawing.Size(247, 31);
|
|
||||||
this.AdressTextBox.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// DataGridView
|
|
||||||
//
|
|
||||||
this.DataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
|
||||||
this.JewelName,
|
|
||||||
this.JewelPrice,
|
|
||||||
this.JewelCount});
|
|
||||||
this.DataGridView.Location = new System.Drawing.Point(13, 135);
|
|
||||||
this.DataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.DataGridView.Name = "DataGridView";
|
|
||||||
this.DataGridView.RowHeadersWidth = 62;
|
|
||||||
this.DataGridView.RowTemplate.Height = 25;
|
|
||||||
this.DataGridView.Size = new System.Drawing.Size(802, 365);
|
|
||||||
this.DataGridView.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// JewelName
|
|
||||||
//
|
|
||||||
this.JewelName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
this.JewelName.HeaderText = "Название изделия";
|
|
||||||
this.JewelName.MinimumWidth = 8;
|
|
||||||
this.JewelName.Name = "JewelName";
|
|
||||||
//
|
|
||||||
// JewelPrice
|
|
||||||
//
|
|
||||||
this.JewelPrice.HeaderText = "Цена";
|
|
||||||
this.JewelPrice.MinimumWidth = 8;
|
|
||||||
this.JewelPrice.Name = "JewelPrice";
|
|
||||||
this.JewelPrice.Width = 150;
|
|
||||||
//
|
|
||||||
// JewelCount
|
|
||||||
//
|
|
||||||
this.JewelCount.HeaderText = "Количество";
|
|
||||||
this.JewelCount.MinimumWidth = 8;
|
|
||||||
this.JewelCount.Name = "JewelCount";
|
|
||||||
this.JewelCount.Width = 150;
|
|
||||||
//
|
|
||||||
// SaveButton
|
|
||||||
//
|
|
||||||
this.SaveButton.Location = new System.Drawing.Point(531, 510);
|
|
||||||
this.SaveButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.SaveButton.Name = "SaveButton";
|
|
||||||
this.SaveButton.Size = new System.Drawing.Size(138, 35);
|
|
||||||
this.SaveButton.TabIndex = 7;
|
|
||||||
this.SaveButton.Text = "Сохранить";
|
|
||||||
this.SaveButton.UseVisualStyleBackColor = true;
|
|
||||||
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(677, 510);
|
|
||||||
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(138, 35);
|
|
||||||
this.ButtonCancel.TabIndex = 8;
|
|
||||||
this.ButtonCancel.Text = "Отменить";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// OpeningDatePicker
|
|
||||||
//
|
|
||||||
this.OpeningDatePicker.Location = new System.Drawing.Point(204, 94);
|
|
||||||
this.OpeningDatePicker.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.OpeningDatePicker.Name = "OpeningDatePicker";
|
|
||||||
this.OpeningDatePicker.Size = new System.Drawing.Size(247, 31);
|
|
||||||
this.OpeningDatePicker.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// FormStore
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(867, 560);
|
|
||||||
this.Controls.Add(this.OpeningDatePicker);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.SaveButton);
|
|
||||||
this.Controls.Add(this.DataGridView);
|
|
||||||
this.Controls.Add(this.AdressTextBox);
|
|
||||||
this.Controls.Add(this.NameTextBox);
|
|
||||||
this.Controls.Add(this.OpeningDateLabel);
|
|
||||||
this.Controls.Add(this.StoreAdressLabel);
|
|
||||||
this.Controls.Add(this.StoreNameLabel);
|
|
||||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.Name = "FormStore";
|
|
||||||
this.Text = "Изделия магазина";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label StoreNameLabel;
|
|
||||||
private Label StoreAdressLabel;
|
|
||||||
private Label OpeningDateLabel;
|
|
||||||
private TextBox NameTextBox;
|
|
||||||
private TextBox AdressTextBox;
|
|
||||||
private DataGridView DataGridView;
|
|
||||||
private Button SaveButton;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
private DataGridViewTextBoxColumn JewelName;
|
|
||||||
private DataGridViewTextBoxColumn JewelPrice;
|
|
||||||
private DataGridViewTextBoxColumn JewelCount;
|
|
||||||
private DateTimePicker OpeningDatePicker;
|
|
||||||
private DateTimePicker dateTimeOpen;
|
|
||||||
private NumericUpDown numericUpJewelMaxCount;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,136 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using JewelryStoreDataModels.Models;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
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 JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormStore : Form
|
|
||||||
{
|
|
||||||
private int? _id;
|
|
||||||
public int Id { set { _id = value; } }
|
|
||||||
private Dictionary<int, (IJewelModel, int)> _Jewels;
|
|
||||||
private DateTime? _openingDate = null;
|
|
||||||
private readonly IStoreLogic _logic;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
public FormStore(ILogger<FormStore> logger, IStoreLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_Jewels = new Dictionary<int, (IJewelModel, int)>();
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
private void FormShop_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_id.HasValue)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка магазина");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var view = _logic.ReadElement(new StoreSearchModel
|
|
||||||
{
|
|
||||||
Id = _id.Value
|
|
||||||
});
|
|
||||||
if (view != null)
|
|
||||||
{
|
|
||||||
NameTextBox.Text = view.StoreName;
|
|
||||||
AdressTextBox.Text = view.StoreAdress;
|
|
||||||
dateTimeOpen.Value = view.OpeningDate;
|
|
||||||
numericUpJewelMaxCount.Value = view.JewelMaxCount;
|
|
||||||
_Jewels = view.Jewels ?? new Dictionary<int, (IJewelModel, int)>();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки магазина");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void SaveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(NameTextBox.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(AdressTextBox.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Заполните адрес", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Сохранение магазина");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var model = new StoreBindingModel
|
|
||||||
{
|
|
||||||
Id = _id ?? 0,
|
|
||||||
StoreName = NameTextBox.Text,
|
|
||||||
StoreAdress = AdressTextBox.Text,
|
|
||||||
OpeningDate = dateTimeOpen.Value,
|
|
||||||
JewelMaxCount = (int)numericUpJewelMaxCount.Value
|
|
||||||
};
|
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка сохранения магазина");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Загрузка изделий в магазине");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_Jewels != null)
|
|
||||||
{
|
|
||||||
DataGridView.Rows.Clear();
|
|
||||||
foreach (var sr in _Jewels)
|
|
||||||
{
|
|
||||||
DataGridView.Rows.Add(new object[] { sr.Key, sr.Value.Item1.JewelName, sr.Value.Item2 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки изделий магазина");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,151 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormStoreReplenishment
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.StoreNameLabel = new System.Windows.Forms.Label();
|
|
||||||
this.JewelNameLabel = new System.Windows.Forms.Label();
|
|
||||||
this.CountLabel = new System.Windows.Forms.Label();
|
|
||||||
this.StoreNameComboBox = new System.Windows.Forms.ComboBox();
|
|
||||||
this.JewelNameComboBox = new System.Windows.Forms.ComboBox();
|
|
||||||
this.CountTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.SaveButton = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// StoreNameLabel
|
|
||||||
//
|
|
||||||
this.StoreNameLabel.AutoSize = true;
|
|
||||||
this.StoreNameLabel.Location = new System.Drawing.Point(9, 9);
|
|
||||||
this.StoreNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.StoreNameLabel.Name = "StoreNameLabel";
|
|
||||||
this.StoreNameLabel.Size = new System.Drawing.Size(179, 25);
|
|
||||||
this.StoreNameLabel.TabIndex = 0;
|
|
||||||
this.StoreNameLabel.Text = "Название магазина: ";
|
|
||||||
//
|
|
||||||
// JewelNameLabel
|
|
||||||
//
|
|
||||||
this.JewelNameLabel.AutoSize = true;
|
|
||||||
this.JewelNameLabel.Location = new System.Drawing.Point(9, 58);
|
|
||||||
this.JewelNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.JewelNameLabel.Name = "JewelNameLabel";
|
|
||||||
this.JewelNameLabel.Size = new System.Drawing.Size(169, 25);
|
|
||||||
this.JewelNameLabel.TabIndex = 1;
|
|
||||||
this.JewelNameLabel.Text = "Название изделия: ";
|
|
||||||
//
|
|
||||||
// CountLabel
|
|
||||||
//
|
|
||||||
this.CountLabel.AutoSize = true;
|
|
||||||
this.CountLabel.Location = new System.Drawing.Point(9, 107);
|
|
||||||
this.CountLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.CountLabel.Name = "CountLabel";
|
|
||||||
this.CountLabel.Size = new System.Drawing.Size(116, 25);
|
|
||||||
this.CountLabel.TabIndex = 2;
|
|
||||||
this.CountLabel.Text = "Количество: ";
|
|
||||||
//
|
|
||||||
// StoreNameComboBox
|
|
||||||
//
|
|
||||||
this.StoreNameComboBox.FormattingEnabled = true;
|
|
||||||
this.StoreNameComboBox.Location = new System.Drawing.Point(196, 6);
|
|
||||||
this.StoreNameComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.StoreNameComboBox.Name = "StoreNameComboBox";
|
|
||||||
this.StoreNameComboBox.Size = new System.Drawing.Size(272, 33);
|
|
||||||
this.StoreNameComboBox.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// JewelNameComboBox
|
|
||||||
//
|
|
||||||
this.JewelNameComboBox.FormattingEnabled = true;
|
|
||||||
this.JewelNameComboBox.Location = new System.Drawing.Point(196, 55);
|
|
||||||
this.JewelNameComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.JewelNameComboBox.Name = "JewelNameComboBox";
|
|
||||||
this.JewelNameComboBox.Size = new System.Drawing.Size(272, 33);
|
|
||||||
this.JewelNameComboBox.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// CountTextBox
|
|
||||||
//
|
|
||||||
this.CountTextBox.Location = new System.Drawing.Point(196, 104);
|
|
||||||
this.CountTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.CountTextBox.Name = "CountTextBox";
|
|
||||||
this.CountTextBox.Size = new System.Drawing.Size(272, 31);
|
|
||||||
this.CountTextBox.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// SaveButton
|
|
||||||
//
|
|
||||||
this.SaveButton.Location = new System.Drawing.Point(234, 145);
|
|
||||||
this.SaveButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.SaveButton.Name = "SaveButton";
|
|
||||||
this.SaveButton.Size = new System.Drawing.Size(107, 38);
|
|
||||||
this.SaveButton.TabIndex = 6;
|
|
||||||
this.SaveButton.Text = "Сохранить";
|
|
||||||
this.SaveButton.UseVisualStyleBackColor = true;
|
|
||||||
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
|
||||||
//
|
|
||||||
// ButtonCancel
|
|
||||||
//
|
|
||||||
this.ButtonCancel.Location = new System.Drawing.Point(361, 145);
|
|
||||||
this.ButtonCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.ButtonCancel.Name = "ButtonCancel";
|
|
||||||
this.ButtonCancel.Size = new System.Drawing.Size(107, 38);
|
|
||||||
this.ButtonCancel.TabIndex = 7;
|
|
||||||
this.ButtonCancel.Text = "Отмена";
|
|
||||||
this.ButtonCancel.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
|
||||||
//
|
|
||||||
// FormStoreReplenishment
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(481, 200);
|
|
||||||
this.Controls.Add(this.ButtonCancel);
|
|
||||||
this.Controls.Add(this.SaveButton);
|
|
||||||
this.Controls.Add(this.CountTextBox);
|
|
||||||
this.Controls.Add(this.JewelNameComboBox);
|
|
||||||
this.Controls.Add(this.StoreNameComboBox);
|
|
||||||
this.Controls.Add(this.CountLabel);
|
|
||||||
this.Controls.Add(this.JewelNameLabel);
|
|
||||||
this.Controls.Add(this.StoreNameLabel);
|
|
||||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.Name = "FormStoreReplenishment";
|
|
||||||
this.Text = "Пополнение магазина";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Label StoreNameLabel;
|
|
||||||
private Label JewelNameLabel;
|
|
||||||
private Label CountLabel;
|
|
||||||
private ComboBox StoreNameComboBox;
|
|
||||||
private ComboBox JewelNameComboBox;
|
|
||||||
private TextBox CountTextBox;
|
|
||||||
private Button SaveButton;
|
|
||||||
private Button ButtonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
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 JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormStoreReplenishment : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IStoreLogic _storeLogic;
|
|
||||||
private readonly IJewelLogic _jewelLogic;
|
|
||||||
private readonly List<StoreViewModel>? _listStores;
|
|
||||||
private readonly List<JewelViewModel>? _listJewels;
|
|
||||||
public FormStoreReplenishment(ILogger<FormStoreReplenishment> logger, IStoreLogic storeLogic, IJewelLogic jewelLogic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_storeLogic = storeLogic;
|
|
||||||
_jewelLogic = jewelLogic;
|
|
||||||
_logger = logger;
|
|
||||||
_listStores = storeLogic.ReadList(null);
|
|
||||||
if (_listStores != null)
|
|
||||||
{
|
|
||||||
StoreNameComboBox.DisplayMember = "StoreName";
|
|
||||||
StoreNameComboBox.ValueMember = "Id";
|
|
||||||
StoreNameComboBox.DataSource = _listStores;
|
|
||||||
StoreNameComboBox.SelectedItem = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
_listJewels = jewelLogic.ReadList(null);
|
|
||||||
if (_listJewels != null)
|
|
||||||
{
|
|
||||||
JewelNameComboBox.DisplayMember = "JewelName";
|
|
||||||
JewelNameComboBox.ValueMember = "Id";
|
|
||||||
JewelNameComboBox.DataSource = _listJewels;
|
|
||||||
JewelNameComboBox.SelectedItem = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (JewelNameComboBox.SelectedValue == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Создание покупки");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bool resout = _storeLogic.Sale(new SupplySearchModel
|
|
||||||
{
|
|
||||||
JewelId = Convert.ToInt32(JewelNameComboBox.SelectedValue),
|
|
||||||
Count = Convert.ToInt32(CountTextBox.Text)
|
|
||||||
});
|
|
||||||
if (resout)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Проверка пройдена, продажа проведена");
|
|
||||||
MessageBox.Show("Продажа проведена", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Проверка не пройдена");
|
|
||||||
MessageBox.Show("Продажа не может быть создана.", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка создания покупки");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,122 +0,0 @@
|
|||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
partial class FormStores
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.DataGridView = new System.Windows.Forms.DataGridView();
|
|
||||||
this.AddButton = new System.Windows.Forms.Button();
|
|
||||||
this.ChangeButton = new System.Windows.Forms.Button();
|
|
||||||
this.DeleteButton = new System.Windows.Forms.Button();
|
|
||||||
this.UpdateButton = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// DataGridView
|
|
||||||
//
|
|
||||||
this.DataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
|
||||||
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
this.DataGridView.Location = new System.Drawing.Point(1, 2);
|
|
||||||
this.DataGridView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.DataGridView.Name = "DataGridView";
|
|
||||||
this.DataGridView.RowHeadersWidth = 62;
|
|
||||||
this.DataGridView.RowTemplate.Height = 25;
|
|
||||||
this.DataGridView.Size = new System.Drawing.Size(768, 452);
|
|
||||||
this.DataGridView.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// AddButton
|
|
||||||
//
|
|
||||||
this.AddButton.Location = new System.Drawing.Point(807, 52);
|
|
||||||
this.AddButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.AddButton.Name = "AddButton";
|
|
||||||
this.AddButton.Size = new System.Drawing.Size(151, 38);
|
|
||||||
this.AddButton.TabIndex = 1;
|
|
||||||
this.AddButton.Text = "Добавить";
|
|
||||||
this.AddButton.UseVisualStyleBackColor = true;
|
|
||||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
|
||||||
//
|
|
||||||
// ChangeButton
|
|
||||||
//
|
|
||||||
this.ChangeButton.Location = new System.Drawing.Point(807, 129);
|
|
||||||
this.ChangeButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.ChangeButton.Name = "ChangeButton";
|
|
||||||
this.ChangeButton.Size = new System.Drawing.Size(151, 38);
|
|
||||||
this.ChangeButton.TabIndex = 2;
|
|
||||||
this.ChangeButton.Text = "Изменить";
|
|
||||||
this.ChangeButton.UseVisualStyleBackColor = true;
|
|
||||||
this.ChangeButton.Click += new System.EventHandler(this.ChangeButton_Click);
|
|
||||||
//
|
|
||||||
// DeleteButton
|
|
||||||
//
|
|
||||||
this.DeleteButton.Location = new System.Drawing.Point(807, 203);
|
|
||||||
this.DeleteButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.DeleteButton.Name = "DeleteButton";
|
|
||||||
this.DeleteButton.Size = new System.Drawing.Size(151, 38);
|
|
||||||
this.DeleteButton.TabIndex = 3;
|
|
||||||
this.DeleteButton.Text = "Удалить";
|
|
||||||
this.DeleteButton.UseVisualStyleBackColor = true;
|
|
||||||
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
|
|
||||||
//
|
|
||||||
// UpdateButton
|
|
||||||
//
|
|
||||||
this.UpdateButton.Location = new System.Drawing.Point(807, 277);
|
|
||||||
this.UpdateButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.UpdateButton.Name = "UpdateButton";
|
|
||||||
this.UpdateButton.Size = new System.Drawing.Size(151, 35);
|
|
||||||
this.UpdateButton.TabIndex = 4;
|
|
||||||
this.UpdateButton.Text = "Обновить";
|
|
||||||
this.UpdateButton.UseVisualStyleBackColor = true;
|
|
||||||
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
|
|
||||||
//
|
|
||||||
// FormStores
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(988, 457);
|
|
||||||
this.Controls.Add(this.UpdateButton);
|
|
||||||
this.Controls.Add(this.DeleteButton);
|
|
||||||
this.Controls.Add(this.ChangeButton);
|
|
||||||
this.Controls.Add(this.AddButton);
|
|
||||||
this.Controls.Add(this.DataGridView);
|
|
||||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
|
||||||
this.Name = "FormStores";
|
|
||||||
this.Text = "Магазины";
|
|
||||||
this.Load += new System.EventHandler(this.FormStores_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private DataGridView DataGridView;
|
|
||||||
private Button AddButton;
|
|
||||||
private Button ChangeButton;
|
|
||||||
private Button DeleteButton;
|
|
||||||
private Button UpdateButton;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
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 JewelryStore
|
|
||||||
{
|
|
||||||
public partial class FormStores : Form
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IStoreLogic _logic;
|
|
||||||
public FormStores(ILogger<FormStores> logger, IStoreLogic logic)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_logic = logic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormStores_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _logic.ReadList(null);
|
|
||||||
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
DataGridView.DataSource = list;
|
|
||||||
DataGridView.Columns["Id"].Visible = false;
|
|
||||||
DataGridView.Columns["StoreName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
DataGridView.Columns["Jewels"].Visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogInformation("Загрузка магазинов");
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки магазинов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteButton_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("Удаление магазина");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_logic.Delete(new StoreBindingModel
|
|
||||||
{
|
|
||||||
Id = id
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка удаления изделия");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ChangeButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormStore));
|
|
||||||
|
|
||||||
if (service is FormStore form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormStore));
|
|
||||||
|
|
||||||
if (service is FormStore form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,43 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<AnalysisLevel>6.0-all</AnalysisLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="C:\Users\Black\.nuget\packages\nlog.config\4.7.15\contentFiles\any\any\NLog.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
|
||||||
<PackageReference Include="NLog" Version="5.1.2" />
|
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.2" />
|
|
||||||
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\JewelryShopDataModels\JewelryStoreDataModels.csproj" />
|
|
||||||
<ProjectReference Include="..\JewelryStoreBusinessLogic\JewelryStoreBusinessLogic.csproj" />
|
|
||||||
<ProjectReference Include="..\JewelryStoreContracts\JewelryStoreContracts.csproj" />
|
|
||||||
<ProjectReference Include="..\JewelryStoreDatabaseImplement\JewelryStoreDatabaseImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\JewelryStoreFileImplement\JewelryStoreFileImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\JewelryStoreListImplement\JewelryStoreListImplement.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="nlog.config">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,67 +0,0 @@
|
|||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.StoragesContracts;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using NLog.Extensions.Logging;
|
|
||||||
using JewelryStoreBusinessLogic.BusinessLogics;
|
|
||||||
using JewelryStoreContracts.StoragesModels;
|
|
||||||
using JewelryStoreListImplement.Implements;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.Implements;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage;
|
|
||||||
using PizzeriaView;
|
|
||||||
|
|
||||||
namespace JewelryStore
|
|
||||||
{
|
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
private static ServiceProvider? _serviceProvider;
|
|
||||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
||||||
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
ApplicationConfiguration.Initialize();
|
|
||||||
var services = new ServiceCollection();
|
|
||||||
ConfigureServices(services);
|
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddLogging(option =>
|
|
||||||
{
|
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
|
||||||
option.AddNLog("nlog.config");
|
|
||||||
});
|
|
||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
|
||||||
services.AddTransient<IJewelStorage, JewelStorage>();
|
|
||||||
services.AddTransient<IStoreStorage, StoreStorage>();
|
|
||||||
services.AddTransient<IStoreStorage, StoreStorage>();
|
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
|
||||||
services.AddTransient<IJewelLogic, JewelLogic>();
|
|
||||||
services.AddTransient<IStoreLogic, StoreLogic>();
|
|
||||||
services.AddTransient<FormMain>();
|
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
|
||||||
services.AddTransient<FormComponent>();
|
|
||||||
services.AddTransient<FormComponents>();
|
|
||||||
services.AddTransient<FormCreateOrder>();
|
|
||||||
services.AddTransient<FormJewel>();
|
|
||||||
services.AddTransient<FormJewelComponent>();
|
|
||||||
services.AddTransient<FormJewels>();
|
|
||||||
services.AddTransient<FormStores>();
|
|
||||||
services.AddTransient<FormStore>();
|
|
||||||
services.AddTransient<FormReportJewelComponents>();
|
|
||||||
services.AddTransient<FormReportOrders>();
|
|
||||||
services.AddTransient<FormReportShop>();
|
|
||||||
services.AddTransient<FormReportGroupedOrders>();
|
|
||||||
services.AddTransient<FormStoreReplenishment>();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This file is automatically generated by Visual Studio .Net. It is
|
|
||||||
used to store generic object data source configuration information.
|
|
||||||
Renaming the file extension or editing the content of this file may
|
|
||||||
cause the file to be unrecognizable by the program.
|
|
||||||
-->
|
|
||||||
<GenericObjectDataSource DisplayName="IJewelLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
|
||||||
<TypeInfo>JewelryStoreContracts.BusinessLogicsContracts.IJewelLogic, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
|
||||||
</GenericObjectDataSource>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This file is automatically generated by Visual Studio .Net. It is
|
|
||||||
used to store generic object data source configuration information.
|
|
||||||
Renaming the file extension or editing the content of this file may
|
|
||||||
cause the file to be unrecognizable by the program.
|
|
||||||
-->
|
|
||||||
<GenericObjectDataSource DisplayName="IOrderLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
|
||||||
<TypeInfo>JewelryStoreContracts.BusinessLogicsContracts.IOrderLogic, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
|
||||||
</GenericObjectDataSource>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This file is automatically generated by Visual Studio .Net. It is
|
|
||||||
used to store generic object data source configuration information.
|
|
||||||
Renaming the file extension or editing the content of this file may
|
|
||||||
cause the file to be unrecognizable by the program.
|
|
||||||
-->
|
|
||||||
<GenericObjectDataSource DisplayName="IReportLogic" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
|
||||||
<TypeInfo>JewelryStoreContracts.BusinessLogicsContracts.IReportLogic, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
|
||||||
</GenericObjectDataSource>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This file is automatically generated by Visual Studio .Net. It is
|
|
||||||
used to store generic object data source configuration information.
|
|
||||||
Renaming the file extension or editing the content of this file may
|
|
||||||
cause the file to be unrecognizable by the program.
|
|
||||||
-->
|
|
||||||
<GenericObjectDataSource DisplayName="IComponentStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
|
||||||
<TypeInfo>JewelryStoreContracts.StoragesContracts.IComponentStorage, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
|
||||||
</GenericObjectDataSource>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This file is automatically generated by Visual Studio .Net. It is
|
|
||||||
used to store generic object data source configuration information.
|
|
||||||
Renaming the file extension or editing the content of this file may
|
|
||||||
cause the file to be unrecognizable by the program.
|
|
||||||
-->
|
|
||||||
<GenericObjectDataSource DisplayName="IJewelStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
|
||||||
<TypeInfo>JewelryStoreContracts.StoragesContracts.IJewelStorage, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
|
||||||
</GenericObjectDataSource>
|
|
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
This file is automatically generated by Visual Studio .Net. It is
|
|
||||||
used to store generic object data source configuration information.
|
|
||||||
Renaming the file extension or editing the content of this file may
|
|
||||||
cause the file to be unrecognizable by the program.
|
|
||||||
-->
|
|
||||||
<GenericObjectDataSource DisplayName="IOrderStorage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
|
||||||
<TypeInfo>JewelryStoreContracts.StoragesContracts.IOrderStorage, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
|
||||||
</GenericObjectDataSource>
|
|
@ -1,441 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
|
||||||
<AutoRefresh>0</AutoRefresh>
|
|
||||||
<DataSources>
|
|
||||||
<DataSource Name="PrecastConcretePlantContractsViewModels">
|
|
||||||
<ConnectionProperties>
|
|
||||||
<DataProvider>System.Data.DataSet</DataProvider>
|
|
||||||
<ConnectString>/* Local Connection */</ConnectString>
|
|
||||||
</ConnectionProperties>
|
|
||||||
<rd:DataSourceID>20791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
|
||||||
</DataSource>
|
|
||||||
</DataSources>
|
|
||||||
<DataSets>
|
|
||||||
<DataSet Name="DataSetGroupedOrders">
|
|
||||||
<Query>
|
|
||||||
<DataSourceName>PrecastConcretePlantContractsViewModels</DataSourceName>
|
|
||||||
<CommandText>/* Local Query */</CommandText>
|
|
||||||
</Query>
|
|
||||||
<Fields>
|
|
||||||
<Field Name="Date">
|
|
||||||
<DataField>Date</DataField>
|
|
||||||
<rd:TypeName>System.DateTime</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="OrdersCount">
|
|
||||||
<DataField>OrdersCount</DataField>
|
|
||||||
<rd:TypeName>System.Int32</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="OrdersSum">
|
|
||||||
<DataField>OrdersSum</DataField>
|
|
||||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
</Fields>
|
|
||||||
<rd:DataSetInfo>
|
|
||||||
<rd:DataSetName>PrecastConcretePlantContracts.ViewModels</rd:DataSetName>
|
|
||||||
<rd:TableName>ReportGroupOrdersViewModel</rd:TableName>
|
|
||||||
<rd:ObjectDataSourceType>PrecastConcretePlantContracts.ViewModels.ReportGroupOrdersViewModel, PrecastConcretePlantContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
|
||||||
</rd:DataSetInfo>
|
|
||||||
</DataSet>
|
|
||||||
</DataSets>
|
|
||||||
<ReportSections>
|
|
||||||
<ReportSection>
|
|
||||||
<Body>
|
|
||||||
<ReportItems>
|
|
||||||
<Textbox Name="TextboxTitle">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Отчёт по заказам</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>16.51cm</Width>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<VerticalAlign>Middle</VerticalAlign>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="ReportParameterPeriod">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
|
||||||
<Style>
|
|
||||||
<Format>d</Format>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
|
||||||
<Top>0.6cm</Top>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>16.51cm</Width>
|
|
||||||
<ZIndex>1</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Tablix Name="Tablix1">
|
|
||||||
<TablixBody>
|
|
||||||
<TablixColumns>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>3.90406cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>3.97461cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>3.65711cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
</TablixColumns>
|
|
||||||
<TablixRows>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="TextboxDate">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Дата создания</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="TextboxCount">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Количество заказов</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="TextboxSum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Общая сумма заказов</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Date">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Date.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Date</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="OrdersCount">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!OrdersCount.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>OrdersCount</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="OrdersSum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!OrdersSum.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>OrdersSum</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
</TablixRows>
|
|
||||||
</TablixBody>
|
|
||||||
<TablixColumnHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixColumnHierarchy>
|
|
||||||
<TablixRowHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember>
|
|
||||||
<KeepWithGroup>After</KeepWithGroup>
|
|
||||||
</TablixMember>
|
|
||||||
<TablixMember>
|
|
||||||
<Group Name="Подробности" />
|
|
||||||
</TablixMember>
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixRowHierarchy>
|
|
||||||
<DataSetName>DataSetGroupedOrders</DataSetName>
|
|
||||||
<Top>1.88242cm</Top>
|
|
||||||
<Left>2.68676cm</Left>
|
|
||||||
<Height>1.2cm</Height>
|
|
||||||
<Width>11.53578cm</Width>
|
|
||||||
<ZIndex>2</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
</Style>
|
|
||||||
</Tablix>
|
|
||||||
<Textbox Name="TextboxResout">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Итого:</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Right</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Top>3.29409cm</Top>
|
|
||||||
<Left>8.06542cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
<ZIndex>3</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="TextboxFullSum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Sum(Fields!OrdersSum.Value, "DataSetGroupedOrders")</Value>
|
|
||||||
<Style>
|
|
||||||
<Format>0.00;(0.00)</Format>
|
|
||||||
</Style>
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Right</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Top>3.29409cm</Top>
|
|
||||||
<Left>10.70653cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>3.48072cm</Width>
|
|
||||||
<ZIndex>4</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</ReportItems>
|
|
||||||
<Height>2in</Height>
|
|
||||||
<Style />
|
|
||||||
</Body>
|
|
||||||
<Width>6.5in</Width>
|
|
||||||
<Page>
|
|
||||||
<PageHeight>29.7cm</PageHeight>
|
|
||||||
<PageWidth>21cm</PageWidth>
|
|
||||||
<LeftMargin>2cm</LeftMargin>
|
|
||||||
<RightMargin>2cm</RightMargin>
|
|
||||||
<TopMargin>2cm</TopMargin>
|
|
||||||
<BottomMargin>2cm</BottomMargin>
|
|
||||||
<ColumnSpacing>0.13cm</ColumnSpacing>
|
|
||||||
<Style />
|
|
||||||
</Page>
|
|
||||||
</ReportSection>
|
|
||||||
</ReportSections>
|
|
||||||
<ReportParameters>
|
|
||||||
<ReportParameter Name="ReportParameterPeriod">
|
|
||||||
<DataType>String</DataType>
|
|
||||||
<Nullable>true</Nullable>
|
|
||||||
<Prompt>ReportParameter1</Prompt>
|
|
||||||
</ReportParameter>
|
|
||||||
</ReportParameters>
|
|
||||||
<ReportParametersLayout>
|
|
||||||
<GridLayoutDefinition>
|
|
||||||
<NumberOfColumns>4</NumberOfColumns>
|
|
||||||
<NumberOfRows>2</NumberOfRows>
|
|
||||||
<CellDefinitions>
|
|
||||||
<CellDefinition>
|
|
||||||
<ColumnIndex>0</ColumnIndex>
|
|
||||||
<RowIndex>0</RowIndex>
|
|
||||||
<ParameterName>ReportParameterPeriod</ParameterName>
|
|
||||||
</CellDefinition>
|
|
||||||
</CellDefinitions>
|
|
||||||
</GridLayoutDefinition>
|
|
||||||
</ReportParametersLayout>
|
|
||||||
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
|
||||||
<rd:ReportID>b5a8ad5e-1151-4687-8576-a5270295c079</rd:ReportID>
|
|
||||||
</Report>
|
|
@ -1,572 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
|
|
||||||
<AutoRefresh>0</AutoRefresh>
|
|
||||||
<DataSources>
|
|
||||||
<DataSource Name="JewelryStoreContractsViewModels">
|
|
||||||
<ConnectionProperties>
|
|
||||||
<DataProvider>System.Data.DataSet</DataProvider>
|
|
||||||
<ConnectString>/* Local Connection */</ConnectString>
|
|
||||||
</ConnectionProperties>
|
|
||||||
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
|
|
||||||
</DataSource>
|
|
||||||
</DataSources>
|
|
||||||
<DataSets>
|
|
||||||
<DataSet Name="DataSetOrders">
|
|
||||||
<Query>
|
|
||||||
<DataSourceName>JewelryStoreContractsViewModels</DataSourceName>
|
|
||||||
<CommandText>/* Local Query */</CommandText>
|
|
||||||
</Query>
|
|
||||||
<Fields>
|
|
||||||
<Field Name="Id">
|
|
||||||
<DataField>Id</DataField>
|
|
||||||
<rd:TypeName>System.Int32</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="DateCreate">
|
|
||||||
<DataField>DateCreate</DataField>
|
|
||||||
<rd:TypeName>System.DateTime</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="JewelName">
|
|
||||||
<DataField>JewelName</DataField>
|
|
||||||
<rd:TypeName>System.String</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="Sum">
|
|
||||||
<DataField>Sum</DataField>
|
|
||||||
<rd:TypeName>System.Decimal</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
<Field Name="Status">
|
|
||||||
<DataField>Status</DataField>
|
|
||||||
<rd:TypeName>System.String</rd:TypeName>
|
|
||||||
</Field>
|
|
||||||
</Fields>
|
|
||||||
<rd:DataSetInfo>
|
|
||||||
<rd:DataSetName>JewelryStoreContracts.ViewModels</rd:DataSetName>
|
|
||||||
<rd:TableName>ReportOrdersViewModel</rd:TableName>
|
|
||||||
<rd:ObjectDataSourceType>JewelryStoreContracts.ViewModels.ReportOrdersViewModel, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
|
|
||||||
</rd:DataSetInfo>
|
|
||||||
</DataSet>
|
|
||||||
</DataSets>
|
|
||||||
<ReportSections>
|
|
||||||
<ReportSection>
|
|
||||||
<Body>
|
|
||||||
<ReportItems>
|
|
||||||
<Textbox Name="TextboxTitle">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Заказы</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>16.51cm</Width>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<VerticalAlign>Middle</VerticalAlign>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="ReportParameterPeriod">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Parameters!ReportParameterPeriod.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Center</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
|
|
||||||
<Top>0.6cm</Top>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>16.51cm</Width>
|
|
||||||
<ZIndex>1</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<VerticalAlign>Middle</VerticalAlign>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Tablix Name="Tablix">
|
|
||||||
<TablixBody>
|
|
||||||
<TablixColumns>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.60583cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>3.262cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>4.8495cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
<TablixColumn>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
</TablixColumn>
|
|
||||||
</TablixColumns>
|
|
||||||
<TablixRows>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="TextboxId">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Номер</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="TextboxDateCreate">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Дата создания</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="TextboxJewelName">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Изделие</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Textbox2">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Статус</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox2</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="TextboxSum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Сумма</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
<TablixRow>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<TablixCells>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Id">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Id.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Id</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="DateCreate">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!DateCreate.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>DateCreate</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="JewelName">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!JewelName.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>JewelName</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Status1">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Status.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Status1</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
<TablixCell>
|
|
||||||
<CellContents>
|
|
||||||
<Textbox Name="Sum">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Fields!Sum.Value</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Sum</rd:DefaultName>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Color>LightGrey</Color>
|
|
||||||
<Style>Solid</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</CellContents>
|
|
||||||
</TablixCell>
|
|
||||||
</TablixCells>
|
|
||||||
</TablixRow>
|
|
||||||
</TablixRows>
|
|
||||||
</TablixBody>
|
|
||||||
<TablixColumnHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
<TablixMember />
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixColumnHierarchy>
|
|
||||||
<TablixRowHierarchy>
|
|
||||||
<TablixMembers>
|
|
||||||
<TablixMember>
|
|
||||||
<KeepWithGroup>After</KeepWithGroup>
|
|
||||||
</TablixMember>
|
|
||||||
<TablixMember>
|
|
||||||
<Group Name="Подробности" />
|
|
||||||
</TablixMember>
|
|
||||||
</TablixMembers>
|
|
||||||
</TablixRowHierarchy>
|
|
||||||
<DataSetName>DataSetOrders</DataSetName>
|
|
||||||
<Top>1.9177cm</Top>
|
|
||||||
<Left>0.79267cm</Left>
|
|
||||||
<Height>1.2cm</Height>
|
|
||||||
<Width>15.71733cm</Width>
|
|
||||||
<ZIndex>2</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
</Style>
|
|
||||||
</Tablix>
|
|
||||||
<Textbox Name="TextboxResout">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>Итого:</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style>
|
|
||||||
<TextAlign>Right</TextAlign>
|
|
||||||
</Style>
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<Top>3.46287cm</Top>
|
|
||||||
<Left>11.51cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
<ZIndex>3</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
<Textbox Name="Textbox10">
|
|
||||||
<CanGrow>true</CanGrow>
|
|
||||||
<KeepTogether>true</KeepTogether>
|
|
||||||
<Paragraphs>
|
|
||||||
<Paragraph>
|
|
||||||
<TextRuns>
|
|
||||||
<TextRun>
|
|
||||||
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
|
|
||||||
<Style />
|
|
||||||
</TextRun>
|
|
||||||
</TextRuns>
|
|
||||||
<Style />
|
|
||||||
</Paragraph>
|
|
||||||
</Paragraphs>
|
|
||||||
<rd:DefaultName>Textbox10</rd:DefaultName>
|
|
||||||
<Top>3.46287cm</Top>
|
|
||||||
<Left>14.01cm</Left>
|
|
||||||
<Height>0.6cm</Height>
|
|
||||||
<Width>2.5cm</Width>
|
|
||||||
<ZIndex>4</ZIndex>
|
|
||||||
<Style>
|
|
||||||
<Border>
|
|
||||||
<Style>None</Style>
|
|
||||||
</Border>
|
|
||||||
<PaddingLeft>2pt</PaddingLeft>
|
|
||||||
<PaddingRight>2pt</PaddingRight>
|
|
||||||
<PaddingTop>2pt</PaddingTop>
|
|
||||||
<PaddingBottom>2pt</PaddingBottom>
|
|
||||||
</Style>
|
|
||||||
</Textbox>
|
|
||||||
</ReportItems>
|
|
||||||
<Height>2in</Height>
|
|
||||||
<Style />
|
|
||||||
</Body>
|
|
||||||
<Width>7.48425in</Width>
|
|
||||||
<Page>
|
|
||||||
<PageHeight>29.7cm</PageHeight>
|
|
||||||
<PageWidth>21cm</PageWidth>
|
|
||||||
<LeftMargin>2cm</LeftMargin>
|
|
||||||
<RightMargin>2cm</RightMargin>
|
|
||||||
<TopMargin>2cm</TopMargin>
|
|
||||||
<BottomMargin>2cm</BottomMargin>
|
|
||||||
<ColumnSpacing>0.13cm</ColumnSpacing>
|
|
||||||
<Style />
|
|
||||||
</Page>
|
|
||||||
</ReportSection>
|
|
||||||
</ReportSections>
|
|
||||||
<ReportParameters>
|
|
||||||
<ReportParameter Name="ReportParameterPeriod">
|
|
||||||
<DataType>String</DataType>
|
|
||||||
<Nullable>true</Nullable>
|
|
||||||
<Prompt>ReportParameter1</Prompt>
|
|
||||||
</ReportParameter>
|
|
||||||
</ReportParameters>
|
|
||||||
<ReportParametersLayout>
|
|
||||||
<GridLayoutDefinition>
|
|
||||||
<NumberOfColumns>4</NumberOfColumns>
|
|
||||||
<NumberOfRows>2</NumberOfRows>
|
|
||||||
<CellDefinitions>
|
|
||||||
<CellDefinition>
|
|
||||||
<ColumnIndex>0</ColumnIndex>
|
|
||||||
<RowIndex>0</RowIndex>
|
|
||||||
<ParameterName>ReportParameterPeriod</ParameterName>
|
|
||||||
</CellDefinition>
|
|
||||||
</CellDefinitions>
|
|
||||||
</GridLayoutDefinition>
|
|
||||||
</ReportParametersLayout>
|
|
||||||
<rd:ReportUnitType>Cm</rd:ReportUnitType>
|
|
||||||
<rd:ReportID>cadca082-0be4-4ce1-9d0a-d27437fef7c1</rd:ReportID>
|
|
||||||
</Report>
|
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<configuration>
|
|
||||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
autoReload="true" internalLogLevel="Info">
|
|
||||||
|
|
||||||
<targets>
|
|
||||||
<target xsi:type="File" name="tofile" fileName="log-${shortdate}.log" />
|
|
||||||
</targets>
|
|
||||||
|
|
||||||
<rules>
|
|
||||||
<logger name="*" minlevel="Debug" writeTo="tofile" />
|
|
||||||
</rules>
|
|
||||||
</nlog>
|
|
||||||
</configuration>
|
|
@ -1,122 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.StoragesModels;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ClientLogic : IClientLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IClientStorage _clientStorage;
|
|
||||||
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage clientStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_clientStorage = clientStorage;
|
|
||||||
}
|
|
||||||
public bool Create(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_clientStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id: {Id}", model.Id);
|
|
||||||
if (_clientStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientViewModel? ReadElement(ClientSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ClientFIO: {ClientFIO}. Email: {Email}. Id: {Id}.", model.ClientFIO, model.Email, model.Id);
|
|
||||||
var element = _clientStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id: {Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ClientViewModel>? ReadList(ClientSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ClientFIO: {ClientName}. Email: {Email}. Id: {Id}.", model?.ClientFIO, model?.Email, model?.Id);
|
|
||||||
var list = model == null ? _clientStorage.GetFullList() : _clientStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count: {Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(ClientBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_clientStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(ClientBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.ClientFIO))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет ФИО клиента", nameof(model.ClientFIO));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Email))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет почты клиента", nameof(model.Email));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.Password))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет пароля клиента", nameof(model.Password));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Client. ClientFIO: {ClientFIO}. Email: {Email}. Id: {Id}", model.ClientFIO, model.Email, model.Id);
|
|
||||||
var element = _clientStorage.GetElement(new ClientSearchModel
|
|
||||||
{
|
|
||||||
Email = model.Email
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Клиент с такой почтой уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,113 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.StoragesContracts;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ComponentLogic : IComponentLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IComponentStorage _componentStorage;
|
|
||||||
|
|
||||||
public ComponentLogic(ILogger<ComponentLogic> logger, IComponentStorage componentStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_componentStorage = componentStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ComponentViewModel>? ReadList(ComponentSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ComponentName:{ComponentName}. Id:{Id}", model?.ComponentName, model?.Id);
|
|
||||||
var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComponentViewModel? ReadElement(ComponentSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ComponentName:{ComponentName}. Id:{Id}", model.ComponentName, model.Id);
|
|
||||||
var element = _componentStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_componentStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_componentStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool Delete(ComponentBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_componentStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(ComponentBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.ComponentName))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет названия компонента", nameof(model.ComponentName));
|
|
||||||
}
|
|
||||||
if (model.Cost <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Component. ComponentName:{ComponentName}. Cost:{Cost}. Id:{Id}", model.ComponentName, model.Cost, model.Id);
|
|
||||||
var element = _componentStorage.GetElement(new ComponentSearchModel
|
|
||||||
{
|
|
||||||
ComponentName = model.ComponentName
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.StoragesContracts;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class JewelLogic : IJewelLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IJewelStorage _jewelStorage;
|
|
||||||
|
|
||||||
public JewelLogic(ILogger<JewelLogic> logger, IJewelStorage jewelStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_jewelStorage = jewelStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<JewelViewModel>? ReadList(JewelSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. JewelName:{JewelName}. Id:{Id}", model?.JewelName, model?.Id);
|
|
||||||
var list = model == null ? _jewelStorage.GetFullList() : _jewelStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public JewelViewModel? ReadElement(JewelSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. JewelName:{JewelName}. Id:{Id}", model.JewelName, model.Id);
|
|
||||||
var element = _jewelStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(JewelBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_jewelStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(JewelBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_jewelStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(JewelBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_jewelStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(JewelBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.JewelName))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет названия изделия", nameof(model.JewelName));
|
|
||||||
}
|
|
||||||
if (model.Price <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Цена изделия должна быть больше 0", nameof(model.Price));
|
|
||||||
}
|
|
||||||
if (model.JewelComponents == null || model.JewelComponents.Count == 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Нет компонентов изделия", nameof(model.JewelComponents));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Jewel. JewelName:{JewelName}. Cost:{Cost}. Id:{Id}", model.JewelName, model.Price, model.Id);
|
|
||||||
var element = _jewelStorage.GetElement(new JewelSearchModel
|
|
||||||
{
|
|
||||||
JewelName = model.JewelName
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Изделие с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,149 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.StoragesContracts;
|
|
||||||
using JewelryStoreContracts.StoragesModels;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using JewelryStoreDataModels.Enums;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class OrderLogic : IOrderLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
|
||||||
private readonly IStoreStorage _shopStorage;
|
|
||||||
|
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IStoreStorage shopStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_orderStorage = orderStorage;
|
|
||||||
_shopStorage = shopStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (model.Status != OrderStatus.Неизвестен) return false;
|
|
||||||
model.Status = OrderStatus.Принят;
|
|
||||||
if (_orderStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeliveryOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
var order = _orderStorage.GetElement(new OrderSearchModel
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
});
|
|
||||||
if (order == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(order));
|
|
||||||
}
|
|
||||||
if (!_shopStorage.RestockingShops(new SupplyBindingModel
|
|
||||||
{
|
|
||||||
JewelId = order.JewelId,
|
|
||||||
Count = order.Count
|
|
||||||
}))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Недостаточно места");
|
|
||||||
}
|
|
||||||
|
|
||||||
model.Status = OrderStatus.Выдан;
|
|
||||||
model.DateImplement = DateTime.Now;
|
|
||||||
_orderStorage.Update(model);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
var element = _orderStorage.GetElement(new OrderSearchModel
|
|
||||||
{
|
|
||||||
Id = model.Id
|
|
||||||
});
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Read operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (element.Status != OrderStatus.Выполняется)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Status change operation failed");
|
|
||||||
throw new InvalidOperationException("Заказ должен быть переведен в статус выполнения перед готовностью!");
|
|
||||||
}
|
|
||||||
model.Status = OrderStatus.Готов;
|
|
||||||
_orderStorage.Update(model);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. Id:{Id}", model?.Id);
|
|
||||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
var element = _orderStorage.GetElement(new OrderSearchModel
|
|
||||||
{
|
|
||||||
Id = model.Id
|
|
||||||
});
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Read operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (element.Status != OrderStatus.Принят)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Status change operation failed");
|
|
||||||
throw new InvalidOperationException("Заказ должен быть переведен в статус принятого перед его выполнением!");
|
|
||||||
}
|
|
||||||
model.Status = OrderStatus.Выполняется;
|
|
||||||
_orderStorage.Update(model);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (model.Sum <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Сумма заказа должна быть больше 0", nameof(model.Sum));
|
|
||||||
}
|
|
||||||
if (model.Count <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Количество изделий должно быть больше 0", nameof(model.Count));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Order. Sum:{Sum}. Id:{Id}", model.Sum, model.Id);
|
|
||||||
var element = _orderStorage.GetElement(new OrderSearchModel
|
|
||||||
{
|
|
||||||
Id = model.Id
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Заказ с таким ID уже существует");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,146 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage;
|
|
||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.StoragesContracts;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JewelryStoreContracts.StoragesModels;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class ReportLogic : IReportLogic
|
|
||||||
{
|
|
||||||
private readonly IComponentStorage _componentStorage;
|
|
||||||
private readonly IJewelStorage _jewelStorage;
|
|
||||||
private readonly IOrderStorage _orderStorage;
|
|
||||||
private readonly IStoreStorage _shopStorage;
|
|
||||||
private readonly AbstractSaveToExcel _saveToExcel;
|
|
||||||
private readonly AbstractSaveToWord _saveToWord;
|
|
||||||
private readonly AbstractSaveToPdf _saveToPdf;
|
|
||||||
public ReportLogic(IJewelStorage jewelStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
|
|
||||||
IStoreStorage shopStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
|
||||||
{
|
|
||||||
_jewelStorage = jewelStorage;
|
|
||||||
_componentStorage = componentStorage;
|
|
||||||
_orderStorage = orderStorage;
|
|
||||||
_shopStorage = shopStorage;
|
|
||||||
_saveToExcel = saveToExcel;
|
|
||||||
_saveToWord = saveToWord;
|
|
||||||
_saveToPdf = saveToPdf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReportJewelComponentViewModel> GetJewelComponent()
|
|
||||||
{
|
|
||||||
return _jewelStorage.GetFullList().Select(x => new ReportJewelComponentViewModel
|
|
||||||
{
|
|
||||||
JewelName = x.JewelName,
|
|
||||||
Components = x.JewelComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
|
|
||||||
TotalCount = x.JewelComponents.Select(x => x.Value.Item2).Sum()
|
|
||||||
}).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
return _orderStorage.GetFilteredList(new OrderSearchModel
|
|
||||||
{
|
|
||||||
DateFrom = model.DateFrom,
|
|
||||||
DateTo = model.DateTo
|
|
||||||
}).Select(x => new ReportOrdersViewModel
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
DateCreate = x.DateCreate,
|
|
||||||
JewelName = x.JewelName,
|
|
||||||
Sum = x.Sum,
|
|
||||||
Status = x.Status.ToString()
|
|
||||||
|
|
||||||
}).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveJewelsToWordFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToWord.CreateDoc(new WordInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список изделий",
|
|
||||||
Jewels = _jewelStorage.GetFullList()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveJewelComponentToExcelFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToExcel.CreateReport(new ExcelInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список компонентов",
|
|
||||||
JewelComponents = GetJewelComponent()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToPdf.CreateDoc(new PdfInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список заказов",
|
|
||||||
DateFrom = model.DateFrom!.Value,
|
|
||||||
DateTo = model.DateTo!.Value,
|
|
||||||
Orders = GetOrders(model)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public List<ReportShopsViewModel> GetShops()
|
|
||||||
{
|
|
||||||
return _shopStorage.GetFullList().Select(x => new ReportShopsViewModel
|
|
||||||
{
|
|
||||||
ShopName = x.StoreName,
|
|
||||||
Jewels = x.Jewels.Select(x => (x.Value.Item1.JewelName, x.Value.Item2)).ToList(),
|
|
||||||
TotalCount = x.Jewels.Select(x => x.Value.Item2).Sum()
|
|
||||||
}).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ReportGroupOrdersViewModel> GetGroupedOrders()
|
|
||||||
{
|
|
||||||
return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportGroupOrdersViewModel
|
|
||||||
{
|
|
||||||
Date = x.Key,
|
|
||||||
OrdersCount = x.Count(),
|
|
||||||
OrdersSum = x.Select(y => y.Sum).Sum()
|
|
||||||
}).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveShopsToWordFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToWord.CreateShopsDoc(new WordShopInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список магазинов",
|
|
||||||
Shops = _shopStorage.GetFullList()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveShopsToExcelFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToExcel.CreateShopJewelsReport(new ExcelShop
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Наполненость магазинов",
|
|
||||||
ShopJewels = GetShops()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveGroupedOrdersToPdfFile(ReportBindingModel model)
|
|
||||||
{
|
|
||||||
_saveToPdf.CreateGroupedOrdersDoc(new PdfGroupedOrdersInfo
|
|
||||||
{
|
|
||||||
FileName = model.FileName,
|
|
||||||
Title = "Список заказов сгруппированных по дате заказов",
|
|
||||||
GroupedOrders = GetGroupedOrders()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,187 +0,0 @@
|
|||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using JewelryStoreContracts.BindingModels;
|
|
||||||
using JewelryStoreContracts.BusinessLogicsContracts;
|
|
||||||
using JewelryStoreContracts.SearchModels;
|
|
||||||
using JewelryStoreContracts.StoragesContracts;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JewelryStoreContracts.StoragesModels;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class StoreLogic : IStoreLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
private readonly IStoreStorage _shopStorage;
|
|
||||||
private readonly IJewelStorage _JewelStorage;
|
|
||||||
|
|
||||||
public StoreLogic(ILogger<StoreLogic> logger, IStoreStorage shopStorage, IJewelStorage JewelStorage)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_shopStorage = shopStorage;
|
|
||||||
_JewelStorage = JewelStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StoreViewModel>? ReadList(StoreSearchModel? model)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("ReadList. ShopName:{ShopName}.Id:{ Id}", model?.StoreName, model?.Id);
|
|
||||||
var list = model == null ? _shopStorage.GetFullList() : _shopStorage.GetFilteredList(model);
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadList return null list");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StoreViewModel? ReadElement(StoreSearchModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement. ShopName:{ShopName}.Id:{ Id}", model.StoreName, model.Id);
|
|
||||||
var element = _shopStorage.GetElement(model);
|
|
||||||
if (element == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("ReadElement element not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Create(StoreBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_shopStorage.Insert(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Insert operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Update(StoreBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model);
|
|
||||||
if (_shopStorage.Update(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Update operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(StoreBindingModel model)
|
|
||||||
{
|
|
||||||
CheckModel(model, false);
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
|
||||||
if (_shopStorage.Delete(model) == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Delete operation failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MakeSupply(SupplyBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (model.Count <= 0)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Количество изделий должно быть больше 0");
|
|
||||||
}
|
|
||||||
var shop = _shopStorage.GetElement(new StoreSearchModel
|
|
||||||
{
|
|
||||||
Id = model.ShopId
|
|
||||||
});
|
|
||||||
if (shop == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Магазина не существует");
|
|
||||||
}
|
|
||||||
if (shop.Jewels.ContainsKey(model.JewelId))
|
|
||||||
{
|
|
||||||
var oldValue = shop.Jewels[model.JewelId];
|
|
||||||
oldValue.Item2 += model.Count;
|
|
||||||
shop.Jewels[model.JewelId] = oldValue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var Jewel = _JewelStorage.GetElement(new JewelSearchModel
|
|
||||||
{
|
|
||||||
Id = model.JewelId
|
|
||||||
});
|
|
||||||
if (Jewel == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentException($"Поставка: Товар с id:{model.JewelId} не найден");
|
|
||||||
}
|
|
||||||
shop.Jewels.Add(model.JewelId, (Jewel, model.Count));
|
|
||||||
}
|
|
||||||
_shopStorage.Update(new StoreBindingModel()
|
|
||||||
{
|
|
||||||
Id = shop.Id,
|
|
||||||
StoreName = shop.StoreName,
|
|
||||||
StoreAdress = shop.StoreAdress,
|
|
||||||
OpeningDate = shop.OpeningDate,
|
|
||||||
Jewels = shop.Jewels,
|
|
||||||
JewelMaxCount = shop.JewelMaxCount,
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckModel(StoreBindingModel model, bool withParams = true)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(model));
|
|
||||||
}
|
|
||||||
if (!withParams)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.StoreAdress))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Адрес магазина длжен быть заполнен", nameof(model.StoreAdress));
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(model.StoreName))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Название магазина должно быть заполнено", nameof(model.StoreName));
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Shop. ShopName:{ShopName}.Adres:{Adres}.OpeningDate:{OpeningDate}.Id:{ Id}", model.StoreName, model.StoreAdress, model.OpeningDate, model.Id);
|
|
||||||
var element = _shopStorage.GetElement(new StoreSearchModel
|
|
||||||
{
|
|
||||||
StoreName = model.StoreName
|
|
||||||
});
|
|
||||||
if (element != null && element.Id != model.Id)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Магазин с таким названием уже есть");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Sale(SupplySearchModel model)
|
|
||||||
{
|
|
||||||
if (!model.JewelId.HasValue || !model.Count.HasValue)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Check Jewel count in all shops");
|
|
||||||
if (_shopStorage.Sale(model))
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Selling sucsess");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Selling failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
|
||||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\JewelryStoreContracts\JewelryStoreContracts.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,165 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToExcel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Создание отчета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
public void CreateReport(ExcelInfo info)
|
|
||||||
{
|
|
||||||
CreateExcel(info);
|
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = 1,
|
|
||||||
Text = info.Title,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
|
||||||
});
|
|
||||||
|
|
||||||
MergeCells(new ExcelMergeParameters
|
|
||||||
{
|
|
||||||
CellFromName = "A1",
|
|
||||||
CellToName = "C1"
|
|
||||||
});
|
|
||||||
|
|
||||||
uint rowIndex = 2;
|
|
||||||
foreach (var pc in info.JewelComponents)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = pc.JewelName,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
rowIndex++;
|
|
||||||
|
|
||||||
foreach (var (Component, Count) in pc.Components)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "B",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = Component,
|
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = Count.ToString(),
|
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = "Итого",
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = pc.TotalCount.ToString(),
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveExcel(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateShopJewelsReport(ExcelShop info)
|
|
||||||
{
|
|
||||||
CreateExcel(info);
|
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = 1,
|
|
||||||
Text = info.Title,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
|
||||||
});
|
|
||||||
|
|
||||||
MergeCells(new ExcelMergeParameters
|
|
||||||
{
|
|
||||||
CellFromName = "A1",
|
|
||||||
CellToName = "C1"
|
|
||||||
});
|
|
||||||
|
|
||||||
uint rowIndex = 2;
|
|
||||||
foreach (var sr in info.ShopJewels)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = sr.ShopName,
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
rowIndex++;
|
|
||||||
|
|
||||||
foreach (var (Jewel, Count) in sr.Jewels)
|
|
||||||
{
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "B",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = Jewel,
|
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = Count.ToString(),
|
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
||||||
});
|
|
||||||
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "A",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = "Итого",
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
|
||||||
{
|
|
||||||
ColumnName = "C",
|
|
||||||
RowIndex = rowIndex,
|
|
||||||
Text = sr.TotalCount.ToString(),
|
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
|
||||||
});
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveExcel(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void CreateExcel(IDocument info);
|
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
|
||||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
||||||
protected abstract void SaveExcel(IDocument info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToPdf
|
|
||||||
{
|
|
||||||
public void CreateDoc(PdfInfo info)
|
|
||||||
{
|
|
||||||
CreatePdf(info);
|
|
||||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
|
||||||
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
|
||||||
|
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
|
||||||
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { "Номер", "Дата заказа", "Пицца", "Статус", "Сумма" },
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var order in info.Orders)
|
|
||||||
{
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PizzaName, order.Status.ToString(), order.Sum.ToString() },
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
|
||||||
});
|
|
||||||
}
|
|
||||||
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth });
|
|
||||||
|
|
||||||
SavePdf(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateGroupedOrdersDoc(PdfGroupedOrdersInfo info)
|
|
||||||
{
|
|
||||||
CreatePdf(info);
|
|
||||||
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
|
||||||
|
|
||||||
CreateTable(new List<string> { "4cm", "3cm", "2cm" });
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { "Дата заказа", "Кол-во", "Сумма" },
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var groupedOrder in info.GroupedOrders)
|
|
||||||
{
|
|
||||||
CreateRow(new PdfRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { groupedOrder.Date.ToShortDateString(), groupedOrder.OrdersCount.ToString(), groupedOrder.OrdersSum.ToString() },
|
|
||||||
Style = "Normal",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.GroupedOrders.Sum(x => x.OrdersSum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
|
||||||
|
|
||||||
SavePdf(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void CreatePdf(IDocument info);
|
|
||||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
|
||||||
protected abstract void CreateTable(List<string> columns);
|
|
||||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
|
||||||
protected abstract void SavePdf(IDocument info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public abstract class AbstractSaveToWord
|
|
||||||
{
|
|
||||||
public void CreateDoc(WordInfo info)
|
|
||||||
{
|
|
||||||
CreateWord(info);
|
|
||||||
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Center
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var jewel in info.Jewels)
|
|
||||||
{
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
|
||||||
(jewel.JewelName, new WordTextProperties { Size = "24", Bold = true}),
|
|
||||||
("\t"+jewel.Price.ToString(), new WordTextProperties{Size = "24"})
|
|
||||||
},
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Both
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveWord(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateShopsDoc(WordShopInfo info)
|
|
||||||
{
|
|
||||||
CreateWord(info);
|
|
||||||
CreateParagraph(new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
JustificationType = WordJustificationType.Center
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
CreateTable(new List<string> { "3000", "3000", "3000" });
|
|
||||||
CreateRow(new WordRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { "Название", "Адрес", "Дата открытия" },
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "24",
|
|
||||||
Bold = true,
|
|
||||||
JustificationType = WordJustificationType.Center
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var shop in info.Shops)
|
|
||||||
{
|
|
||||||
CreateRow(new WordRowParameters
|
|
||||||
{
|
|
||||||
Texts = new List<string> { shop.ShopName, shop.Adress, shop.OpeningDate.ToString() },
|
|
||||||
TextProperties = new WordTextProperties
|
|
||||||
{
|
|
||||||
Size = "22",
|
|
||||||
JustificationType = WordJustificationType.Both
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveWord(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void CreateWord(IDocument info);
|
|
||||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
|
||||||
protected abstract void SaveWord(IDocument info);
|
|
||||||
protected abstract void CreateTable(List<string> colums);
|
|
||||||
protected abstract void CreateRow(WordRowParameters rowParameters);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum ExcelStyleInfoType
|
|
||||||
{
|
|
||||||
Title,
|
|
||||||
Text,
|
|
||||||
TextWithBroder
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum PdfParagraphAlignmentType
|
|
||||||
{
|
|
||||||
Center,
|
|
||||||
Left,
|
|
||||||
Rigth
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperEnums
|
|
||||||
{
|
|
||||||
public enum WordJustificationType
|
|
||||||
{
|
|
||||||
Center,
|
|
||||||
Both
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelCellParameters
|
|
||||||
{
|
|
||||||
public string ColumnName { get; set; } = string.Empty;
|
|
||||||
public uint RowIndex { get; set; }
|
|
||||||
public string Text { get; set; } = string.Empty;
|
|
||||||
public string CellReference => $"{ColumnName}{RowIndex}";
|
|
||||||
public ExcelStyleInfoType StyleInfo { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelInfo : IDocument
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<ReportJewelComponentViewModel> JewelComponents
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
} = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelMergeParameters
|
|
||||||
{
|
|
||||||
public string CellFromName { get; set; } = string.Empty;
|
|
||||||
public string CellToName { get; set; } = string.Empty;
|
|
||||||
public string Merge => $"{CellFromName}:{CellToName}";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class ExcelShop : IDocument
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<ReportShopsViewModel> ShopJewels { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfGroupedOrdersInfo
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public DateTime DateFrom { get; set; }
|
|
||||||
public DateTime DateTo { get; set; }
|
|
||||||
public List<ReportGroupOrdersViewModel> GroupedOrders { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfInfo : IDocument
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public DateTime DateFrom { get; set; }
|
|
||||||
public DateTime DateTo { get; set; }
|
|
||||||
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfParagraph
|
|
||||||
{
|
|
||||||
public string Text { get; set; } = string.Empty;
|
|
||||||
public string Style { get; set; } = string.Empty;
|
|
||||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class PdfRowParameters
|
|
||||||
{
|
|
||||||
public List<string> Texts { get; set; } = new();
|
|
||||||
public string Style { get; set; } = string.Empty;
|
|
||||||
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordInfo : IDocument
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<JewelViewModel> Jewels { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordParagraph
|
|
||||||
{
|
|
||||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
|
||||||
public WordTextProperties? TextProperties { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordRowParameters
|
|
||||||
{
|
|
||||||
public List<string> Texts { get; set; } = new();
|
|
||||||
public WordTextProperties TextProperties { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using JewelryStoreContracts.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordShopInfo : IDocument
|
|
||||||
{
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
|
||||||
public string Title { get; set; } = string.Empty;
|
|
||||||
public List<StoreViewModel> Shops { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
|
|
||||||
{
|
|
||||||
public class WordTextProperties
|
|
||||||
{
|
|
||||||
public string Size { get; set; } = string.Empty;
|
|
||||||
public bool Bold { get; set; }
|
|
||||||
public WordJustificationType JustificationType { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage
|
|
||||||
{
|
|
||||||
public interface IDocument
|
|
||||||
{
|
|
||||||
public string FileName { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,340 +0,0 @@
|
|||||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
||||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
|
||||||
using DocumentFormat.OpenXml.Office2016.Excel;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
|
||||||
using DocumentFormat.OpenXml;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToExcel : AbstractSaveToExcel
|
|
||||||
{
|
|
||||||
private SpreadsheetDocument? _spreadsheetDocument;
|
|
||||||
private SharedStringTablePart? _shareStringPart;
|
|
||||||
private Worksheet? _worksheet;
|
|
||||||
|
|
||||||
private static void CreateStyles(WorkbookPart workbookpart)
|
|
||||||
{
|
|
||||||
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
|
|
||||||
sp.Stylesheet = new Stylesheet();
|
|
||||||
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
|
|
||||||
var fontUsual = new Font();
|
|
||||||
fontUsual.Append(new FontSize() { Val = 12D });
|
|
||||||
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Theme = 1U });
|
|
||||||
fontUsual.Append(new FontName() { Val = "Times New Roman" });
|
|
||||||
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
|
|
||||||
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
|
||||||
var fontTitle = new Font();
|
|
||||||
fontTitle.Append(new Bold());
|
|
||||||
fontTitle.Append(new FontSize() { Val = 14D });
|
|
||||||
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Theme = 1U });
|
|
||||||
fontTitle.Append(new FontName() { Val = "Times New Roman" });
|
|
||||||
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
|
|
||||||
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
|
|
||||||
fonts.Append(fontUsual);
|
|
||||||
fonts.Append(fontTitle);
|
|
||||||
var fills = new Fills() { Count = 2U };
|
|
||||||
var fill1 = new Fill();
|
|
||||||
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
|
|
||||||
var fill2 = new Fill();
|
|
||||||
fill2.Append(new PatternFill()
|
|
||||||
{
|
|
||||||
PatternType = PatternValues.Gray125
|
|
||||||
});
|
|
||||||
fills.Append(fill1);
|
|
||||||
fills.Append(fill2);
|
|
||||||
var borders = new Borders() { Count = 2U };
|
|
||||||
var borderNoBorder = new Border();
|
|
||||||
borderNoBorder.Append(new LeftBorder());
|
|
||||||
borderNoBorder.Append(new RightBorder());
|
|
||||||
borderNoBorder.Append(new TopBorder());
|
|
||||||
borderNoBorder.Append(new BottomBorder());
|
|
||||||
borderNoBorder.Append(new DiagonalBorder());
|
|
||||||
var borderThin = new Border();
|
|
||||||
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
|
|
||||||
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var rightBorder = new RightBorder()
|
|
||||||
{
|
|
||||||
Style = BorderStyleValues.Thin
|
|
||||||
};
|
|
||||||
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
|
|
||||||
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
var bottomBorder = new BottomBorder()
|
|
||||||
{
|
|
||||||
Style = BorderStyleValues.Thin
|
|
||||||
};
|
|
||||||
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
|
|
||||||
{ Indexed = 64U });
|
|
||||||
borderThin.Append(leftBorder);
|
|
||||||
borderThin.Append(rightBorder);
|
|
||||||
borderThin.Append(topBorder);
|
|
||||||
borderThin.Append(bottomBorder);
|
|
||||||
borderThin.Append(new DiagonalBorder());
|
|
||||||
borders.Append(borderNoBorder);
|
|
||||||
borders.Append(borderThin);
|
|
||||||
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
|
|
||||||
var cellFormatStyle = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U
|
|
||||||
};
|
|
||||||
cellStyleFormats.Append(cellFormatStyle);
|
|
||||||
var cellFormats = new CellFormats() { Count = 3U };
|
|
||||||
var cellFormatFont = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U,
|
|
||||||
FormatId = 0U,
|
|
||||||
ApplyFont = true
|
|
||||||
};
|
|
||||||
var cellFormatFontAndBorder = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 0U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 1U,
|
|
||||||
FormatId = 0U,
|
|
||||||
ApplyFont = true,
|
|
||||||
ApplyBorder = true
|
|
||||||
};
|
|
||||||
var cellFormatTitle = new CellFormat()
|
|
||||||
{
|
|
||||||
NumberFormatId = 0U,
|
|
||||||
FontId = 1U,
|
|
||||||
FillId = 0U,
|
|
||||||
BorderId = 0U,
|
|
||||||
FormatId = 0U,
|
|
||||||
Alignment = new Alignment()
|
|
||||||
{
|
|
||||||
Vertical = VerticalAlignmentValues.Center,
|
|
||||||
WrapText = true,
|
|
||||||
Horizontal = HorizontalAlignmentValues.Center
|
|
||||||
},
|
|
||||||
ApplyFont = true
|
|
||||||
};
|
|
||||||
cellFormats.Append(cellFormatFont);
|
|
||||||
cellFormats.Append(cellFormatFontAndBorder);
|
|
||||||
cellFormats.Append(cellFormatTitle);
|
|
||||||
var cellStyles = new CellStyles() { Count = 1U };
|
|
||||||
cellStyles.Append(new CellStyle()
|
|
||||||
{
|
|
||||||
Name = "Normal",
|
|
||||||
FormatId = 0U,
|
|
||||||
BuiltinId = 0U
|
|
||||||
});
|
|
||||||
var differentialFormats = new
|
|
||||||
DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
|
|
||||||
{ Count = 0U };
|
|
||||||
|
|
||||||
var tableStyles = new TableStyles()
|
|
||||||
{
|
|
||||||
Count = 0U,
|
|
||||||
DefaultTableStyle = "TableStyleMedium2",
|
|
||||||
DefaultPivotStyle = "PivotStyleLight16"
|
|
||||||
};
|
|
||||||
var stylesheetExtensionList = new StylesheetExtensionList();
|
|
||||||
var stylesheetExtension1 = new StylesheetExtension()
|
|
||||||
{
|
|
||||||
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
|
|
||||||
};
|
|
||||||
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
|
||||||
stylesheetExtension1.Append(new SlicerStyles()
|
|
||||||
{
|
|
||||||
DefaultSlicerStyle = "SlicerStyleLight1"
|
|
||||||
});
|
|
||||||
var stylesheetExtension2 = new StylesheetExtension()
|
|
||||||
{
|
|
||||||
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
|
|
||||||
};
|
|
||||||
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
|
||||||
stylesheetExtension2.Append(new TimelineStyles()
|
|
||||||
{
|
|
||||||
DefaultTimelineStyle = "TimeSlicerStyleLight1"
|
|
||||||
});
|
|
||||||
stylesheetExtensionList.Append(stylesheetExtension1);
|
|
||||||
stylesheetExtensionList.Append(stylesheetExtension2);
|
|
||||||
sp.Stylesheet.Append(fonts);
|
|
||||||
sp.Stylesheet.Append(fills);
|
|
||||||
sp.Stylesheet.Append(borders);
|
|
||||||
sp.Stylesheet.Append(cellStyleFormats);
|
|
||||||
sp.Stylesheet.Append(cellFormats);
|
|
||||||
sp.Stylesheet.Append(cellStyles);
|
|
||||||
sp.Stylesheet.Append(differentialFormats);
|
|
||||||
sp.Stylesheet.Append(tableStyles);
|
|
||||||
sp.Stylesheet.Append(stylesheetExtensionList);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение номера стиля из типа
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="styleInfo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
|
|
||||||
{
|
|
||||||
return styleInfo switch
|
|
||||||
{
|
|
||||||
ExcelStyleInfoType.Title => 2U,
|
|
||||||
ExcelStyleInfoType.TextWithBroder => 1U,
|
|
||||||
ExcelStyleInfoType.Text => 0U,
|
|
||||||
_ => 0U,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
protected override void CreateExcel(IDocument info)
|
|
||||||
{
|
|
||||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName,
|
|
||||||
SpreadsheetDocumentType.Workbook);
|
|
||||||
// Создаем книгу (в ней хранятся листы)
|
|
||||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
|
||||||
workbookpart.Workbook = new Workbook();
|
|
||||||
CreateStyles(workbookpart);
|
|
||||||
// Получаем/создаем хранилище текстов для книги
|
|
||||||
_shareStringPart =
|
|
||||||
_spreadsheetDocument.WorkbookPart!.GetPartsOfType<SharedStringTablePart>().Any()
|
|
||||||
?
|
|
||||||
_spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First()
|
|
||||||
:
|
|
||||||
_spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
|
|
||||||
// Создаем SharedStringTable, если его нет
|
|
||||||
if (_shareStringPart.SharedStringTable == null)
|
|
||||||
{
|
|
||||||
_shareStringPart.SharedStringTable = new SharedStringTable();
|
|
||||||
}
|
|
||||||
// Создаем лист в книгу
|
|
||||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
|
||||||
worksheetPart.Worksheet = new Worksheet(new SheetData());
|
|
||||||
// Добавляем лист в книгу
|
|
||||||
var sheets =
|
|
||||||
_spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
|
|
||||||
var sheet = new Sheet()
|
|
||||||
{
|
|
||||||
Id =
|
|
||||||
_spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
|
||||||
SheetId = 1,
|
|
||||||
Name = "Лист"
|
|
||||||
};
|
|
||||||
sheets.Append(sheet);
|
|
||||||
_worksheet = worksheetPart.Worksheet;
|
|
||||||
}
|
|
||||||
protected override void InsertCellInWorksheet(ExcelCellParameters
|
|
||||||
excelParams)
|
|
||||||
{
|
|
||||||
if (_worksheet == null || _shareStringPart == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var sheetData = _worksheet.GetFirstChild<SheetData>();
|
|
||||||
if (sheetData == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Ищем строку, либо добавляем ее
|
|
||||||
Row row;
|
|
||||||
if (sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
|
||||||
excelParams.RowIndex).Any())
|
|
||||||
{
|
|
||||||
row = sheetData.Elements<Row>().Where(r => r.RowIndex! ==
|
|
||||||
excelParams.RowIndex).First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
row = new Row() { RowIndex = excelParams.RowIndex };
|
|
||||||
sheetData.Append(row);
|
|
||||||
}
|
|
||||||
// Ищем нужную ячейку
|
|
||||||
Cell cell;
|
|
||||||
if (row.Elements<Cell>().Where(c => c.CellReference!.Value ==
|
|
||||||
excelParams.CellReference).Any())
|
|
||||||
{
|
|
||||||
cell = row.Elements<Cell>().Where(c => c.CellReference!.Value ==
|
|
||||||
excelParams.CellReference).First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Все ячейки должны быть последовательно друг за другом расположены
|
|
||||||
// нужно определить, после какой вставлять
|
|
||||||
Cell? refCell = null;
|
|
||||||
foreach (Cell rowCell in row.Elements<Cell>())
|
|
||||||
{
|
|
||||||
if (string.Compare(rowCell.CellReference!.Value,
|
|
||||||
excelParams.CellReference, true) > 0)
|
|
||||||
{
|
|
||||||
refCell = rowCell;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var newCell = new Cell()
|
|
||||||
{
|
|
||||||
CellReference =
|
|
||||||
excelParams.CellReference
|
|
||||||
};
|
|
||||||
row.InsertBefore(newCell, refCell);
|
|
||||||
cell = newCell;
|
|
||||||
}
|
|
||||||
// вставляем новый текст
|
|
||||||
_shareStringPart.SharedStringTable.AppendChild(new
|
|
||||||
SharedStringItem(new Text(excelParams.Text)));
|
|
||||||
_shareStringPart.SharedStringTable.Save();
|
|
||||||
cell.CellValue = new
|
|
||||||
CellValue((_shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count(
|
|
||||||
) - 1).ToString());
|
|
||||||
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
|
|
||||||
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
|
|
||||||
}
|
|
||||||
protected override void MergeCells(ExcelMergeParameters excelParams)
|
|
||||||
{
|
|
||||||
if (_worksheet == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MergeCells mergeCells;
|
|
||||||
if (_worksheet.Elements<MergeCells>().Any())
|
|
||||||
{
|
|
||||||
mergeCells = _worksheet.Elements<MergeCells>().First();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mergeCells = new MergeCells();
|
|
||||||
if (_worksheet.Elements<CustomSheetView>().Any())
|
|
||||||
{
|
|
||||||
_worksheet.InsertAfter(mergeCells,
|
|
||||||
_worksheet.Elements<CustomSheetView>().First());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_worksheet.InsertAfter(mergeCells,
|
|
||||||
_worksheet.Elements<SheetData>().First());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var mergeCell = new MergeCell()
|
|
||||||
{
|
|
||||||
Reference = new StringValue(excelParams.Merge)
|
|
||||||
};
|
|
||||||
mergeCells.Append(mergeCell);
|
|
||||||
}
|
|
||||||
protected override void SaveExcel(IDocument info)
|
|
||||||
{
|
|
||||||
if (_spreadsheetDocument == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_spreadsheetDocument.WorkbookPart!.Workbook.Save();
|
|
||||||
_spreadsheetDocument.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using MigraDoc.DocumentObjectModel;
|
|
||||||
using MigraDoc.DocumentObjectModel.Tables;
|
|
||||||
using MigraDoc.Rendering;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToPdf : AbstractSaveToPdf
|
|
||||||
{
|
|
||||||
private Document? _document;
|
|
||||||
private Section? _section;
|
|
||||||
private Table? _table;
|
|
||||||
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
|
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
|
||||||
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
|
|
||||||
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
|
|
||||||
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right,
|
|
||||||
_ => ParagraphAlignment.Justify,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DefineStyles(Document document)
|
|
||||||
{
|
|
||||||
var style = document.Styles["Normal"];
|
|
||||||
style.Font.Name = "Times New Roman";
|
|
||||||
style.Font.Size = 14;
|
|
||||||
|
|
||||||
style = document.Styles.AddStyle("NormalTitle", "Normal");
|
|
||||||
style.Font.Bold = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreatePdf(IDocument info)
|
|
||||||
{
|
|
||||||
_document = new Document();
|
|
||||||
DefineStyles(_document);
|
|
||||||
|
|
||||||
_section = _document.AddSection();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateParagraph(PdfParagraph pdfParagraph)
|
|
||||||
{
|
|
||||||
if (_section == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var paragraph = _section.AddParagraph(pdfParagraph.Text);
|
|
||||||
paragraph.Format.SpaceAfter = "1cm";
|
|
||||||
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
|
|
||||||
paragraph.Style = pdfParagraph.Style;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateTable(List<string> columns)
|
|
||||||
{
|
|
||||||
if (_document == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_table = _document.LastSection.AddTable();
|
|
||||||
|
|
||||||
foreach (var elem in columns)
|
|
||||||
{
|
|
||||||
_table.AddColumn(elem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateRow(PdfRowParameters rowParameters)
|
|
||||||
{
|
|
||||||
if (_table == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var row = _table.AddRow();
|
|
||||||
for (int i = 0; i < rowParameters.Texts.Count; ++i)
|
|
||||||
{
|
|
||||||
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(rowParameters.Style))
|
|
||||||
{
|
|
||||||
row.Cells[i].Style = rowParameters.Style;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unit borderWidth = 0.5;
|
|
||||||
|
|
||||||
row.Cells[i].Borders.Left.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Right.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Top.Width = borderWidth;
|
|
||||||
row.Cells[i].Borders.Bottom.Width = borderWidth;
|
|
||||||
|
|
||||||
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
|
|
||||||
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SavePdf(IDocument info)
|
|
||||||
{
|
|
||||||
var renderer = new PdfDocumentRenderer(true)
|
|
||||||
{
|
|
||||||
Document = _document
|
|
||||||
};
|
|
||||||
renderer.RenderDocument();
|
|
||||||
renderer.PdfDocument.Save(info.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,197 +0,0 @@
|
|||||||
using DocumentFormat.OpenXml;
|
|
||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperEnums;
|
|
||||||
using JewelryStoreBusinessLogic.OfficePackage.HelperModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JewelryStoreBusinessLogic.OfficePackage.Implements
|
|
||||||
{
|
|
||||||
public class SaveToWord : AbstractSaveToWord
|
|
||||||
{
|
|
||||||
private WordprocessingDocument? _wordDocument;
|
|
||||||
private Body? _docBody;
|
|
||||||
|
|
||||||
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
|
||||||
WordJustificationType.Both => JustificationValues.Both,
|
|
||||||
WordJustificationType.Center => JustificationValues.Center,
|
|
||||||
_ => JustificationValues.Left,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SectionProperties CreateSectionProperties()
|
|
||||||
{
|
|
||||||
var properties = new SectionProperties();
|
|
||||||
|
|
||||||
var pageSize = new PageSize
|
|
||||||
{
|
|
||||||
Orient = PageOrientationValues.Portrait
|
|
||||||
};
|
|
||||||
|
|
||||||
properties.AppendChild(pageSize);
|
|
||||||
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
|
||||||
{
|
|
||||||
if (paragraphProperties == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var properties = new ParagraphProperties();
|
|
||||||
|
|
||||||
properties.AppendChild(new Justification()
|
|
||||||
{
|
|
||||||
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
|
||||||
});
|
|
||||||
|
|
||||||
properties.AppendChild(new SpacingBetweenLines
|
|
||||||
{
|
|
||||||
LineRule = LineSpacingRuleValues.Auto
|
|
||||||
});
|
|
||||||
|
|
||||||
properties.AppendChild(new Indentation());
|
|
||||||
|
|
||||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
|
||||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
|
||||||
{
|
|
||||||
paragraphMarkRunProperties.AppendChild(new FontSize { Val = paragraphProperties.Size });
|
|
||||||
}
|
|
||||||
properties.AppendChild(paragraphMarkRunProperties);
|
|
||||||
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateWord(IDocument info)
|
|
||||||
{
|
|
||||||
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
|
||||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
|
||||||
mainPart.Document = new Document();
|
|
||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateParagraph(WordParagraph paragraph)
|
|
||||||
{
|
|
||||||
if (_docBody == null || paragraph == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var docParagraph = new Paragraph();
|
|
||||||
|
|
||||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
|
||||||
|
|
||||||
foreach (var run in paragraph.Texts)
|
|
||||||
{
|
|
||||||
var docRun = new Run();
|
|
||||||
|
|
||||||
var properties = new RunProperties();
|
|
||||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
|
||||||
if (run.Item2.Bold)
|
|
||||||
{
|
|
||||||
properties.AppendChild(new Bold());
|
|
||||||
}
|
|
||||||
docRun.AppendChild(properties);
|
|
||||||
|
|
||||||
docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve });
|
|
||||||
|
|
||||||
docParagraph.AppendChild(docRun);
|
|
||||||
}
|
|
||||||
|
|
||||||
_docBody.AppendChild(docParagraph);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SaveWord(IDocument info)
|
|
||||||
{
|
|
||||||
if (_docBody == null || _wordDocument == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_docBody.AppendChild(CreateSectionProperties());
|
|
||||||
|
|
||||||
_wordDocument.MainDocumentPart!.Document.Save();
|
|
||||||
|
|
||||||
_wordDocument.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Table? _lastTable;
|
|
||||||
protected override void CreateTable(List<string> columns)
|
|
||||||
{
|
|
||||||
if (_docBody == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_lastTable = new Table();
|
|
||||||
|
|
||||||
var tableProp = new TableProperties();
|
|
||||||
tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
|
|
||||||
tableProp.AppendChild(new TableBorders(
|
|
||||||
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
|
||||||
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
|
||||||
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
|
||||||
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
|
||||||
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
|
||||||
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
|
|
||||||
));
|
|
||||||
tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
|
|
||||||
_lastTable.AppendChild(tableProp);
|
|
||||||
|
|
||||||
TableGrid tableGrid = new TableGrid();
|
|
||||||
foreach (var column in columns)
|
|
||||||
{
|
|
||||||
tableGrid.AppendChild(new GridColumn() { Width = column });
|
|
||||||
}
|
|
||||||
_lastTable.AppendChild(tableGrid);
|
|
||||||
|
|
||||||
_docBody.AppendChild(_lastTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateRow(WordRowParameters rowParameters)
|
|
||||||
{
|
|
||||||
if (_docBody == null || _lastTable == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TableRow docRow = new TableRow();
|
|
||||||
foreach (var column in rowParameters.Texts)
|
|
||||||
{
|
|
||||||
var docParagraph = new Paragraph();
|
|
||||||
WordParagraph paragraph = new WordParagraph
|
|
||||||
{
|
|
||||||
Texts = new List<(string, WordTextProperties)> { (column, rowParameters.TextProperties) },
|
|
||||||
TextProperties = rowParameters.TextProperties
|
|
||||||
};
|
|
||||||
|
|
||||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
|
||||||
|
|
||||||
foreach (var run in paragraph.Texts)
|
|
||||||
{
|
|
||||||
var docRun = new Run();
|
|
||||||
|
|
||||||
var properties = new RunProperties();
|
|
||||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
|
||||||
if (run.Item2.Bold)
|
|
||||||
{
|
|
||||||
properties.AppendChild(new Bold());
|
|
||||||
}
|
|
||||||
docRun.AppendChild(properties);
|
|
||||||
|
|
||||||
docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve });
|
|
||||||
|
|
||||||
docParagraph.AppendChild(docRun);
|
|
||||||
}
|
|
||||||
|
|
||||||
TableCell docCell = new TableCell();
|
|
||||||
docCell.AppendChild(docParagraph);
|
|
||||||
docRow.AppendChild(docCell);
|
|
||||||
}
|
|
||||||
_lastTable.AppendChild(docRow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user