лаба 8 готова не знаю работает или нет но у меня ноут сдох
This commit is contained in:
parent
46e9841ebd
commit
6cd3d8dd1d
@ -22,5 +22,5 @@ namespace ConfectioneryContracts.Attributes
|
|||||||
public int Width { get; private set; }
|
public int Width { get; private set; }
|
||||||
public GridViewAutoSize GridViewAutoSize { get; private set; }
|
public GridViewAutoSize GridViewAutoSize { get; private set; }
|
||||||
public bool IsUseAutoSize { get; private set; }
|
public bool IsUseAutoSize { get; private set; }
|
||||||
}s
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,34 +6,49 @@ using System.Threading.Tasks;
|
|||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using ConfectioneryDataModels.Enums;
|
using ConfectioneryDataModels.Enums;
|
||||||
|
using ConfectioneryContracts.Attributes;
|
||||||
|
|
||||||
namespace ConfectioneryContracts.ViewModels
|
namespace ConfectioneryContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class OrderViewModel : IOrderModel
|
public class OrderViewModel : IOrderModel
|
||||||
{
|
{
|
||||||
[DisplayName("Номер")]
|
[Column(title: "Номер", width: 100)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[Column(visible: false)]
|
||||||
public int PastryId { get; set; }
|
public int PastryId { get; set; }
|
||||||
[DisplayName("Выпечка")]
|
|
||||||
|
[Column(title: "Выпечка", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string PastryName { get; set; } = string.Empty;
|
public string PastryName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Column(visible: false)]
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
[DisplayName("ФИО клиента")]
|
[Column(title: "ФИО клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Column(visible: false)]
|
||||||
public string ClientEmail { get; set; } = string.Empty;
|
public string ClientEmail { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Column(visible: false)]
|
||||||
public int? ImplementerId { get; set; }
|
public int? ImplementerId { get; set; }
|
||||||
|
|
||||||
[DisplayName("ФИО исполнителя")]
|
[Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
[DisplayName("Количество")]
|
|
||||||
|
[Column(title: "Количество", width: 100)]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
[DisplayName("Сумма")]
|
|
||||||
|
[Column(title: "Сумма", width: 120)]
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
[DisplayName("Статус")]
|
|
||||||
|
[Column(title: "Статус", width: 100)]
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
[DisplayName("Дата создания")]
|
|
||||||
|
[Column(title: "Дата создания", width: 120)]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
[DisplayName("Дата выполнения")]
|
|
||||||
|
[Column(title: "Дата выполнения", width: 120)]
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
public string PastryName { get; set; } = string.Empty;
|
public string PastryName { get; set; } = string.Empty;
|
||||||
[Column(title: "Цена", width: 150)]
|
[Column(title: "Цена", width: 150)]
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
|
[Column(visible: false)]
|
||||||
public Dictionary<int, (IComponentModel, int)> PastryComponents
|
public Dictionary<int, (IComponentModel, int)> PastryComponents
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -106,8 +106,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("Некорректно введен пароль клиента", nameof(model.Password));
|
throw new ArgumentNullException("Некорректно введен пароль клиента", nameof(model.Password));
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Client. Id: {id}, FIO: {fio}, email: {email}, password: {password}", model.Id, model.ClientFIO, model.Email,
|
_logger.LogInformation("Client. Id: {id}, FIO: {fio}, email: {email}, password: {password}", model.Id, model.ClientFIO, model.Email, model.Password);
|
||||||
model.Password);
|
|
||||||
var element = _clientStorage.GetElement(new ClientSearchModel
|
var element = _clientStorage.GetElement(new ClientSearchModel
|
||||||
{
|
{
|
||||||
Email = model.Email
|
Email = model.Email
|
||||||
|
@ -14,7 +14,7 @@ namespace ConfectioneryDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-0CI5KVE\SQLEXPRESS;Initial Catalog=ConfectioneryDatabase4;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-0CI5KVE\SQLEXPRESS;Initial Catalog=ConfectioneryDatabase5;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,8 @@
|
|||||||
<ProjectReference Include="..\ConfectionaryDataModels\ConfectioneryDataModels.csproj" />
|
<ProjectReference Include="..\ConfectionaryDataModels\ConfectioneryDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace ConfectioneryDatabaseImplement.Migrations
|
namespace ConfectioneryDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ConfectioneryDatabase))]
|
[DbContext(typeof(ConfectioneryDatabase))]
|
||||||
[Migration("20240518134247_InitialCreate")]
|
[Migration("20240519124411_InitialCreate")]
|
||||||
partial class InitialCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
@ -11,4 +11,8 @@
|
|||||||
<ProjectReference Include="..\ConfectionaryDataModels\ConfectioneryDataModels.csproj" />
|
<ProjectReference Include="..\ConfectionaryDataModels\ConfectioneryDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -7,17 +7,23 @@ using ConfectioneryContracts.BindingModels;
|
|||||||
using ConfectioneryContracts.ViewModels;
|
using ConfectioneryContracts.ViewModels;
|
||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Client : IClientModel
|
public class Client : IClientModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public string ClientFIO { get; private set; } = string.Empty;
|
public string ClientFIO { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public string Email { get; private set; } = string.Empty;
|
public string Email { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public string Password { get; private set; } = string.Empty;
|
public string Password { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public static Client? Create(ClientBindingModel model)
|
public static Client? Create(ClientBindingModel model)
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.ViewModels;
|
using ConfectioneryContracts.ViewModels;
|
||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Component : IComponentModel
|
public class Component : IComponentModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string ComponentName { get; private set; } = string.Empty;
|
public string ComponentName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
|
|
||||||
public static Component? Create(ComponentBindingModel model)
|
public static Component? Create(ComponentBindingModel model)
|
||||||
|
@ -4,18 +4,25 @@ using ConfectioneryDataModels.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Implementer : IImplementerModel
|
public class Implementer : IImplementerModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
[DataMember]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public int WorkExperience { get; set; }
|
public int WorkExperience { get; set; }
|
||||||
|
[DataMember]
|
||||||
public int Qualification { get; set; }
|
public int Qualification { get; set; }
|
||||||
|
|
||||||
public static Implementer? Create(ImplementerBindingModel? model)
|
public static Implementer? Create(ImplementerBindingModel? model)
|
||||||
|
@ -4,25 +4,29 @@ using ConfectioneryDataModels.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class MessageInfo : IMessageInfoModel
|
public class MessageInfo : IMessageInfoModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string MessageId { get; private set; } = string.Empty;
|
public string MessageId { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public int? ClientId { get; private set; }
|
public int? ClientId { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string SenderName { get; private set; } = string.Empty;
|
public string SenderName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public DateTime DateDelivery { get; private set; } = DateTime.Now;
|
public DateTime DateDelivery { get; private set; } = DateTime.Now;
|
||||||
|
[DataMember]
|
||||||
public string Subject { get; private set; } = string.Empty;
|
public string Subject { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public string Body { get; private set; } = string.Empty;
|
public string Body { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||||
|
@ -2,28 +2,39 @@
|
|||||||
using ConfectioneryContracts.ViewModels;
|
using ConfectioneryContracts.ViewModels;
|
||||||
using ConfectioneryDataModels.Enums;
|
using ConfectioneryDataModels.Enums;
|
||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public int PastryId { get; private set; }
|
public int PastryId { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public int? ImplementerId { get; private set; }
|
public int? ImplementerId { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public OrderStatus Status { get; private set; }
|
public OrderStatus Status { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public DateTime DateCreate { get; private set; }
|
public DateTime DateCreate { get; private set; }
|
||||||
|
|
||||||
|
[DataMember]
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
|
@ -7,13 +7,18 @@ using ConfectioneryContracts.BindingModels;
|
|||||||
using ConfectioneryContracts.ViewModels;
|
using ConfectioneryContracts.ViewModels;
|
||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
internal class Pastry : IPastryModel
|
internal class Pastry : IPastryModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string PastryName { get; private set; } = string.Empty;
|
public string PastryName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public double Price { get; private set; }
|
public double Price { get; private set; }
|
||||||
public Dictionary<int, int> Components { get; private set; } = new();
|
public Dictionary<int, int> Components { get; private set; } = new();
|
||||||
private Dictionary<int, (IComponentModel, int)>? _pastryComponents = null;
|
private Dictionary<int, (IComponentModel, int)>? _pastryComponents = null;
|
||||||
|
@ -16,4 +16,8 @@
|
|||||||
<ProjectReference Include="..\ConfectionaryDataModels\ConfectioneryDataModels.csproj" />
|
<ProjectReference Include="..\ConfectionaryDataModels\ConfectioneryDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -11,6 +11,6 @@
|
|||||||
"SmtpClientPort": "587",
|
"SmtpClientPort": "587",
|
||||||
"PopHost": "pop.gmail.com",
|
"PopHost": "pop.gmail.com",
|
||||||
"PopPort": "995",
|
"PopPort": "995",
|
||||||
"MailLogin": "@gmail.com",
|
"MailLogin": "tsutsumonn@gmail.com",
|
||||||
"MailPassword": "ndbp ruep dfbl dnbg"
|
"MailPassword": "ndbp ruep dfbl dnbg"
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<add key="SmtpClientPort" value="587" />
|
<add key="SmtpClientPort" value="587" />
|
||||||
<add key="PopHost" value="pop.gmail.com" />
|
<add key="PopHost" value="pop.gmail.com" />
|
||||||
<add key="PopPort" value="995" />
|
<add key="PopPort" value="995" />
|
||||||
<add key="MailLogin" value="@gmail.com" />
|
<add key="MailLogin" value="tsutsumonn@gmail.com" />
|
||||||
<add key="MailPassword" value="ndbp ruep dfbl dnbg" />
|
<add key="MailPassword" value="ndbp ruep dfbl dnbg" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
@ -1,5 +1,6 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
|
using ConfectioneryContracts.DI;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.VisualBasic.Logging;
|
using Microsoft.VisualBasic.Logging;
|
||||||
using System;
|
using System;
|
||||||
@ -46,33 +47,25 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
var form = DependencyManager.Instance.Resolve<FormComponent>();
|
||||||
if (service is FormComponent 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)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service =
|
var form = DependencyManager.Instance.Resolve<FormComponent>();
|
||||||
Program.ServiceProvider?.GetService(typeof(FormComponent));
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
if (service is FormComponent form)
|
|
||||||
{
|
|
||||||
form.Id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
private void ButtonDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
|
using ConfectioneryContracts.DI;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -45,23 +46,18 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
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 ButtonEdit_Click(object sender, EventArgs e)
|
private void ButtonEdit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||||
if (service is FormImplementer form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@ -69,7 +65,6 @@ namespace ConfectioneryView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
private void ButtonDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ using System.Windows.Forms;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
|
using ConfectioneryContracts.DI;
|
||||||
|
|
||||||
namespace ConfectioneryView
|
namespace ConfectioneryView
|
||||||
{
|
{
|
||||||
@ -46,23 +47,18 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormPastry));
|
var form = DependencyManager.Instance.Resolve<FormPastry>();
|
||||||
if (service is FormPastry form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonEdit_Click(object sender, EventArgs e)
|
private void ButtonEdit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormPastry));
|
var form = DependencyManager.Instance.Resolve<FormPastry>();
|
||||||
if (service is FormPastry form)
|
|
||||||
{
|
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
@ -70,7 +66,6 @@ namespace ConfectioneryView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
private void ButtonDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ 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 ConfectioneryContracts.DI;
|
||||||
|
|
||||||
namespace ConfectioneryView
|
namespace ConfectioneryView
|
||||||
{
|
{
|
||||||
@ -85,42 +86,32 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service =
|
var form = DependencyManager.Instance.Resolve<FormPastryComponent>();
|
||||||
Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
|
|
||||||
if (service is FormPastryComponent form)
|
|
||||||
{
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (form.ComponentModel == null)
|
if (form.ComponentModel == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
|
_logger.LogInformation("Adding new component: {ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count);
|
||||||
if (_pastryComponents.ContainsKey(form.Id))
|
if (_pastryComponents.ContainsKey(form.Id))
|
||||||
{
|
{
|
||||||
_pastryComponents[form.Id] = (form.ComponentModel,
|
_pastryComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||||
form.Count);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_pastryComponents.Add(form.Id, (form.ComponentModel,
|
_pastryComponents.Add(form.Id, (form.ComponentModel, form.Count));
|
||||||
form.Count));
|
|
||||||
}
|
}
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service =
|
var form = DependencyManager.Instance.Resolve<FormPastryComponent>();
|
||||||
Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||||
if (service is FormPastryComponent form)
|
|
||||||
{
|
|
||||||
int id =
|
|
||||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
|
||||||
form.Id = id;
|
form.Id = id;
|
||||||
form.Count = _pastryComponents[id].Item2;
|
form.Count = _pastryComponents[id].Item2;
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
@ -129,13 +120,12 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
|
_logger.LogInformation("Component editing: {ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count);
|
||||||
_pastryComponents[form.Id] = (form.ComponentModel, form.Count);
|
_pastryComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
private void ButtonRef_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user