This commit is contained in:
VictoriaPresnyakova 2023-05-15 16:42:48 +04:00
parent 9a55fa9c9f
commit deddf34e88
16 changed files with 74 additions and 37 deletions

5
.gitignore vendored
View File

@ -398,3 +398,8 @@ FodyWeavers.xsd
# JetBrains Rider # JetBrains Rider
*.sln.iml *.sln.iml
# dll файлы
*.dll

View File

@ -28,19 +28,19 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.dataGridView = new System.Windows.Forms.DataGridView(); this.DataGridView = new System.Windows.Forms.DataGridView();
this.ButtonDel = new System.Windows.Forms.Button(); this.ButtonDel = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// dataGridView // dataGridView
// //
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(12, 85); this.DataGridView.Location = new System.Drawing.Point(12, 85);
this.dataGridView.Name = "dataGridView"; this.DataGridView.Name = "dataGridView";
this.dataGridView.RowTemplate.Height = 25; this.DataGridView.RowTemplate.Height = 25;
this.dataGridView.Size = new System.Drawing.Size(559, 453); this.DataGridView.Size = new System.Drawing.Size(559, 453);
this.dataGridView.TabIndex = 6; this.DataGridView.TabIndex = 6;
// //
// ButtonDel // ButtonDel
// //
@ -58,18 +58,18 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(588, 549); this.ClientSize = new System.Drawing.Size(588, 549);
this.Controls.Add(this.ButtonDel); this.Controls.Add(this.ButtonDel);
this.Controls.Add(this.dataGridView); this.Controls.Add(this.DataGridView);
this.Name = "FormClients"; this.Name = "FormClients";
this.Text = "Клиенты"; this.Text = "Клиенты";
this.Load += new System.EventHandler(this.FormClients_Load); this.Load += new System.EventHandler(this.FormClients_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private DataGridView dataGridView; private DataGridView DataGridView;
private Button ButtonDel; private Button ButtonDel;
} }
} }

View File

@ -1,6 +1,4 @@
using JewelryStoreContracts.BindingModels; using Microsoft.Extensions.Logging;
using JewelryStoreContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -10,6 +8,10 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using JewelryStore;
using JewelryStoreContracts.BindingModels;
using JewelryStoreContracts.BusinessLogicsContracts;
using JewelryStoreContracts.DI;
namespace JewelryStore namespace JewelryStore
{ {
@ -45,13 +47,13 @@ namespace JewelryStore
private void ButtonDel_Click(object sender, EventArgs e) private void ButtonDel_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (DataGridView.SelectedRows.Count == 1)
{ {
if (MessageBox.Show("Удалить запись?", "Вопрос", if (MessageBox.Show("Удалить запись?", "Вопрос",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{ {
int id = int id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Удаление клиента"); _logger.LogInformation("Удаление клиента");
try try
{ {

View File

@ -28,24 +28,24 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.dataGridView = new System.Windows.Forms.DataGridView(); this.DataGridView = new System.Windows.Forms.DataGridView();
this.buttonAdd = new System.Windows.Forms.Button(); this.buttonAdd = new System.Windows.Forms.Button();
this.buttonChange = new System.Windows.Forms.Button(); this.buttonChange = new System.Windows.Forms.Button();
this.buttonDelete = new System.Windows.Forms.Button(); this.buttonDelete = new System.Windows.Forms.Button();
this.buttonUpdate = new System.Windows.Forms.Button(); this.buttonUpdate = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// dataGridView // dataGridView
// //
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Left; this.DataGridView.Dock = System.Windows.Forms.DockStyle.Left;
this.dataGridView.Location = new System.Drawing.Point(0, 0); this.DataGridView.Location = new System.Drawing.Point(0, 0);
this.dataGridView.Name = "dataGridView"; this.DataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 62; this.DataGridView.RowHeadersWidth = 62;
this.dataGridView.RowTemplate.Height = 33; this.DataGridView.RowTemplate.Height = 33;
this.dataGridView.Size = new System.Drawing.Size(459, 488); this.DataGridView.Size = new System.Drawing.Size(459, 488);
this.dataGridView.TabIndex = 0; this.DataGridView.TabIndex = 0;
// //
// buttonAdd // buttonAdd
// //
@ -96,18 +96,18 @@
this.Controls.Add(this.buttonDelete); this.Controls.Add(this.buttonDelete);
this.Controls.Add(this.buttonChange); this.Controls.Add(this.buttonChange);
this.Controls.Add(this.buttonAdd); this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.dataGridView); this.Controls.Add(this.DataGridView);
this.Name = "FormComponents"; this.Name = "FormComponents";
this.Text = "Компоненты"; this.Text = "Компоненты";
this.Load += new System.EventHandler(this.FormComponents_Load); this.Load += new System.EventHandler(this.FormComponents_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private DataGridView dataGridView; private DataGridView DataGridView;
private Button buttonAdd; private Button buttonAdd;
private Button buttonChange; private Button buttonChange;
private Button buttonDelete; private Button buttonDelete;

View File

@ -35,7 +35,7 @@ namespace JewelryStore
{ {
try try
{ {
DataGridView.FillandConfigGrid(_logic.ReadList(null)); DataGridView.FillandConfigGrid(_logic.ReadList(null));
_logger.LogInformation("Загрузка компонентов"); _logger.LogInformation("Загрузка компонентов");
} }
@ -62,13 +62,13 @@ namespace JewelryStore
private void buttonDelete_Click(object sender, EventArgs e) private void buttonDelete_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (DataGridView.SelectedRows.Count == 1)
{ {
if (MessageBox.Show("Удалить запись?", "Вопрос", if (MessageBox.Show("Удалить запись?", "Вопрос",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{ {
int id = int id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Удаление компонента"); _logger.LogInformation("Удаление компонента");
try try
{ {
@ -94,7 +94,7 @@ namespace JewelryStore
private void buttonChange_Click(object sender, EventArgs e) private void buttonChange_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (DataGridView.SelectedRows.Count == 1)
{ {
var form = DependencyManager.Instance.Resolve<FormComponent>(); var form = DependencyManager.Instance.Resolve<FormComponent>();
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)

View File

@ -1,7 +1,6 @@
using JewelryStoreContracts.BusinessLogicsContracts; using JewelryStoreContracts.BusinessLogicsContracts;
using JewelryStoreContracts.StoragesContracts; using JewelryStoreContracts.StoragesContracts;
using JewelryStoreBusinessLogic.BusinessLogics; using JewelryStoreBusinessLogic.BusinessLogics;
using JewelryStoreDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using System.Drawing; using System.Drawing;

View File

@ -15,5 +15,7 @@ namespace JewelryStoreContracts.BindingModels
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
public DateTime DateDelivery { get; set; } public DateTime DateDelivery { get; set; }
public int Id => throw new NotImplementedException();
} }
} }

View File

@ -20,9 +20,11 @@ namespace JewelryStoreContracts.DI
{ {
IImplementationExtension? source = null; IImplementationExtension? source = null;
var files = Directory.GetFiles(TryGetImplementationExtensionsFolder(), "*.dll", SearchOption.AllDirectories); var files = Directory.GetFiles(TryGetImplementationExtensionsFolder(), "*.dll", SearchOption.AllDirectories);
foreach (var file in files.Distinct()) foreach (var file in files.Distinct())
{ {
Assembly asm = Assembly.LoadFrom(file); Assembly asm = Assembly.LoadFrom(file);
foreach (var t in asm.GetExportedTypes()) foreach (var t in asm.GetExportedTypes())
{ {
if (t.IsClass && typeof(IImplementationExtension).IsAssignableFrom(t)) if (t.IsClass && typeof(IImplementationExtension).IsAssignableFrom(t))
@ -34,6 +36,7 @@ namespace JewelryStoreContracts.DI
else else
{ {
var newSource = (IImplementationExtension)Activator.CreateInstance(t)!; var newSource = (IImplementationExtension)Activator.CreateInstance(t)!;
if (newSource.Priority > source.Priority) if (newSource.Priority > source.Priority)
{ {
source = newSource; source = newSource;
@ -42,15 +45,19 @@ namespace JewelryStoreContracts.DI
} }
} }
} }
return source; return source;
} }
private static string TryGetImplementationExtensionsFolder() private static string TryGetImplementationExtensionsFolder()
{ {
var directory = new DirectoryInfo(Directory.GetCurrentDirectory()); var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
while (directory != null && !directory.GetDirectories("ImplementationExtensions", SearchOption.AllDirectories).Any(x => x.Name == "ImplementationExtensions")) while (directory != null && !directory.GetDirectories("ImplementationExtensions", SearchOption.AllDirectories).Any(x => x.Name == "ImplementationExtensions"))
{ {
directory = directory.Parent; directory = directory.Parent;
} }
return $"{directory?.FullName}\\ImplementationExtensions"; return $"{directory?.FullName}\\ImplementationExtensions";
} }
} }

View File

@ -23,5 +23,7 @@ namespace JewelryStoreContracts.ViewModels
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
[Column("Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] [Column("Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
public int Id => throw new NotImplementedException();
} }
} }

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace JewelryStoreDataModels.Models namespace JewelryStoreDataModels.Models
{ {
public interface IMessageInfoModel public interface IMessageInfoModel : IId
{ {
string MessageId { get; } string MessageId { get; }
int? ClientId { get; } int? ClientId { get; }

View File

@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -21,4 +22,8 @@
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" /> <PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup> </ItemGroup>
<!--<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>-->
</Project> </Project>

View File

@ -56,5 +56,7 @@ namespace JewelryStoreDatabaseImplement.Models
SenderName = SenderName, SenderName = SenderName,
DateDelivery = DateDelivery, DateDelivery = DateDelivery,
}; };
public int Id => throw new NotImplementedException();
} }
} }

View File

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -15,4 +16,8 @@
<ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" /> <ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" />
</ItemGroup> </ItemGroup>
<!--<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>-->
</Project> </Project>

View File

@ -78,5 +78,7 @@ namespace JewelryStoreFileImplement.Models
new XAttribute("SenderName", SenderName), new XAttribute("SenderName", SenderName),
new XAttribute("DateDelivery", DateDelivery) new XAttribute("DateDelivery", DateDelivery)
); );
public int Id => throw new NotImplementedException();
} }
} }

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@ -15,4 +15,8 @@
<ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" /> <ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" />
</ItemGroup> </ItemGroup>
<!--<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>-->
</Project> </Project>

View File

@ -49,5 +49,7 @@ namespace JewelryStoreListImplement.Models
ClientId = ClientId, ClientId = ClientId,
MessageId = MessageId MessageId = MessageId
}; };
public int Id => throw new NotImplementedException();
} }
} }