готово всё

This commit is contained in:
dex_moth 2024-06-19 13:54:56 +04:00
parent 66238fe6f2
commit 48cbed7bab
14 changed files with 32 additions and 31 deletions

View File

@ -64,8 +64,7 @@ namespace FishFactory.Forms
{ {
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) if (MessageBox.Show("Удалить запись?", "Вопрос", 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

@ -38,15 +38,12 @@ namespace FishFactory.Forms
private void buttonAdd_Click(object sender, EventArgs e) private void buttonAdd_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer)); var form = DependencyManager.Instance.Resolve<FormImplementer>();
if (service is FormImplementer form) if (form.ShowDialog() == DialogResult.OK)
{ {
if (form.ShowDialog() == DialogResult.OK) LoadData();
{ }
LoadData(); }
}
}
}
private void buttonUpd_Click(object sender, EventArgs e) private void buttonUpd_Click(object sender, EventArgs e)
{ {

View File

@ -39,6 +39,7 @@ namespace FishFactory.Forms
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка загрузки заказов"); _logger.LogError(ex, "Ошибка загрузки заказов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
private void компонентыToolStripMenuItem_Click(object sender, EventArgs e) private void компонентыToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -1,8 +1,6 @@
using FishFactory.Forms; using FishFactory.Forms;
using FishFactoryContracts.BusinessLogicsContracts; using FishFactoryContracts.BusinessLogicsContracts;
using FishFactoryBusinessLogic.BusinessLogic; using FishFactoryBusinessLogic.BusinessLogic;
using FishFactoryContracts.StoragesContracts;
using FishFactoryDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;

View File

@ -106,7 +106,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
throw new ArgumentNullException(nameof(element)); throw new ArgumentNullException(nameof(element));
} }
model.CannedId = element.CannedId; model.CannedId = element.CannedId;
model.ClientId = element.ClientId; model.ClientId = element.ClientId;
model.DateCreate = element.DateCreate; model.DateCreate = element.DateCreate;
model.DateImplement = element.DateImplement; model.DateImplement = element.DateImplement;

View File

@ -9,7 +9,7 @@ namespace FishFactoryContracts.ViewModels
public int Id { get; set; } public int Id { get; set; }
[Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] [Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string ComponentName { get; set; } = string.Empty; public string ComponentName { get; set; } = string.Empty;
[Column(title: "Цена", width: 150)] [Column(title: "Цена", width: 130)]
public double Cost { get; set; } public double Cost { get; set; }
} }
} }

View File

@ -1,13 +1,13 @@
using FishFactoryContracts.Attributes; using FishFactoryContracts.Attributes;
using FishFactoryDataModel.Enums; using FishFactoryDataModel.Enums;
using System.ComponentModel; using FishFactoryDataModel.Models;
namespace FishFactoryContracts.ViewModels namespace FishFactoryContracts.ViewModels
{ {
public class OrderViewModel public class OrderViewModel : IOrderModel
{ {
[DisplayName("Номер")] [Column(title: "Номер", width: 30)]
public int Id { get; set; } public int Id { get; set; }
[Column(visible: false)] [Column(visible: false)]
public int ClientId { get; set; } public int ClientId { get; set; }

View File

@ -22,7 +22,7 @@
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)\..\ImplementationExtensions\*.dll&quot;" /> <Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)\ImplementationExtensions\*.dll&quot;" />
</Target> </Target>
</Project> </Project>

View File

@ -3,7 +3,7 @@ using FishFactoryContracts.StoragesContracts;
namespace FishFactoryDatabaseImplement.Implements namespace FishFactoryDatabaseImplement.Implements
{ {
public class ImplementationExtension public class ImplementationExtension : IImplementationExtension
{ {
public int Priority => 2; public int Priority => 2;

View File

@ -1,15 +1,21 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace FishFactoryDatabaseImplement.Models namespace FishFactoryDatabaseImplement.Models
{ {
public class CannedComponent [DataContract]
public class CannedComponent
{ {
public int Id { get; set; } [DataMember]
[Required] public int Id { get; set; }
[DataMember]
[Required]
public int CannedId { get; set; } public int CannedId { get; set; }
[Required] [DataMember]
[Required]
public int ComponentId { get; set; } public int ComponentId { get; set; }
[Required] [DataMember]
[Required]
public int Count { get; set; } public int Count { get; set; }
public virtual Component Component { get; set; } = new(); public virtual Component Component { get; set; } = new();
public virtual Canned Canned { get; set; } = new(); public virtual Canned Canned { get; set; } = new();

View File

@ -12,7 +12,7 @@
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)\..\ImplementationExtensions\*.dll&quot;" /> <Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)\ImplementationExtensions\*.dll&quot;" />
</Target> </Target>
</Project> </Project>

View File

@ -5,7 +5,7 @@ namespace FishFactoryFileImplement.Implements
{ {
public class ImplementationExtension : IImplementationExtension public class ImplementationExtension : IImplementationExtension
{ {
public int Priority => 1; public int Priority => 0;
public void RegisterServices() public void RegisterServices()
{ {

View File

@ -13,6 +13,6 @@
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)\..\ImplementationExtensions\*.dll&quot;" /> <Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)\ImplementationExtensions\*.dll&quot;" />
</Target> </Target>
</Project> </Project>

View File

@ -12,7 +12,7 @@
"http": { "http": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": false, "launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
"applicationUrl": "http://localhost:5284", "applicationUrl": "http://localhost:5284",
"environmentVariables": { "environmentVariables": {
@ -22,7 +22,7 @@
"https": { "https": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": false, "launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
"applicationUrl": "https://localhost:7012;http://localhost:5284", "applicationUrl": "https://localhost:7012;http://localhost:5284",
"environmentVariables": { "environmentVariables": {