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
*.sln.iml
# dll файлы
*.dll

View File

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

View File

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

View File

@ -28,24 +28,24 @@
/// </summary>
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.buttonChange = 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();
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
this.SuspendLayout();
//
// dataGridView
//
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.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 62;
this.dataGridView.RowTemplate.Height = 33;
this.dataGridView.Size = new System.Drawing.Size(459, 488);
this.dataGridView.TabIndex = 0;
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.Name = "dataGridView";
this.DataGridView.RowHeadersWidth = 62;
this.DataGridView.RowTemplate.Height = 33;
this.DataGridView.Size = new System.Drawing.Size(459, 488);
this.DataGridView.TabIndex = 0;
//
// buttonAdd
//
@ -96,18 +96,18 @@
this.Controls.Add(this.buttonDelete);
this.Controls.Add(this.buttonChange);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.DataGridView);
this.Name = "FormComponents";
this.Text = "Компоненты";
this.Load += new System.EventHandler(this.FormComponents_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private DataGridView dataGridView;
private DataGridView DataGridView;
private Button buttonAdd;
private Button buttonChange;
private Button buttonDelete;

View File

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

View File

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

View File

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

View File

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

View File

@ -23,5 +23,7 @@ namespace JewelryStoreContracts.ViewModels
public string Subject { get; set; } = string.Empty;
[Column("Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
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
{
public interface IMessageInfoModel
public interface IMessageInfoModel : IId
{
string MessageId { get; }
int? ClientId { get; }

View File

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

View File

@ -56,5 +56,7 @@ namespace JewelryStoreDatabaseImplement.Models
SenderName = SenderName,
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>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
@ -15,4 +16,8 @@
<ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" />
</ItemGroup>
<!--<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>-->
</Project>

View File

@ -78,5 +78,7 @@ namespace JewelryStoreFileImplement.Models
new XAttribute("SenderName", SenderName),
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>
<TargetFramework>net6.0</TargetFramework>
@ -15,4 +15,8 @@
<ProjectReference Include="..\JewelryStoreDataModels\JewelryStoreDataModels.csproj" />
</ItemGroup>
<!--<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>-->
</Project>

View File

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