Переделывание под новые требования
This commit is contained in:
parent
17a17a5403
commit
e7941ff84c
@ -17,6 +17,7 @@ namespace FurnitureAssemFileImplement
|
|||||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IFurnitureStorage, FurnitureStorage>();
|
DependencyManager.Instance.RegisterType<IFurnitureStorage, FurnitureStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,24 @@ using FurnitureAssemblyDataModels.Models;
|
|||||||
using FurnitureAssemblyContracts.ViewModels;
|
using FurnitureAssemblyContracts.ViewModels;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace FurnitureAssemFileImplement.Models
|
namespace FurnitureAssemFileImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Shop : IShopModel
|
public class Shop : IShopModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string ShopName { get; private set; } = string.Empty;
|
public string ShopName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public string Address { get; private set; } = string.Empty;
|
public string Address { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public DateTime DateOpening { get; private set; }
|
public DateTime DateOpening { get; private set; }
|
||||||
|
|
||||||
private Dictionary<int, (IFurnitureModel, int)>? _furnitures = null;
|
private Dictionary<int, (IFurnitureModel, int)>? _furnitures = null;
|
||||||
|
[DataMember]
|
||||||
public Dictionary<int, (IFurnitureModel, int)> Furnitures
|
public Dictionary<int, (IFurnitureModel, int)> Furnitures
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -32,6 +37,7 @@ namespace FurnitureAssemFileImplement.Models
|
|||||||
}
|
}
|
||||||
private set { }
|
private set { }
|
||||||
}
|
}
|
||||||
|
[DataMember]
|
||||||
public int MaxCount { get; private set; }
|
public int MaxCount { get; private set; }
|
||||||
|
|
||||||
public Dictionary<int, int> CurrentCount { get; private set; } = new();
|
public Dictionary<int, int> CurrentCount { get; private set; } = new();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using FurnitureAssemblyBusinessLogic;
|
using FurnitureAssemblyBusinessLogic;
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
||||||
|
using FurnitureAssemblyContracts.DI;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
@ -82,15 +83,14 @@ namespace FurnitureAssembly
|
|||||||
{
|
{
|
||||||
if (dataGridViewMail.SelectedRows.Count == 1)
|
if (dataGridViewMail.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormOneMail));
|
var form = DependencyManager.Instance.Resolve<FormOneMail>();
|
||||||
if (service is FormOneMail form)
|
|
||||||
|
form.MessageId = (string)dataGridViewMail.SelectedRows[0].Cells["MessageId"].Value;
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
form.MessageId = (string)dataGridViewMail.SelectedRows[0].Cells["MessageId"].Value;
|
LoadData();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,29 +157,26 @@ namespace FurnitureAssembly
|
|||||||
|
|
||||||
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
var form = DependencyManager.Instance.Resolve<FormShops>();
|
||||||
if (service is FormShops form)
|
|
||||||
{
|
form.ShowDialog();
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReplenishmentToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ReplenishmentToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReplenishmentShop));
|
var form = DependencyManager.Instance.Resolve<FormReplenishmentShop>();
|
||||||
if (service is FormReplenishmentShop form)
|
|
||||||
{
|
form.ShowDialog();
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSell_Click(object sender, EventArgs e)
|
private void buttonSell_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSell));
|
var form = DependencyManager.Instance.Resolve<FormSell>();
|
||||||
if (service is FormSell form)
|
|
||||||
{
|
form.ShowDialog();
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FurnituresToolStripMenuItem_Click(object sender, EventArgs
|
private void FurnituresToolStripMenuItem_Click(object sender, EventArgs
|
||||||
@ -227,20 +224,18 @@ namespace FurnitureAssembly
|
|||||||
|
|
||||||
private void ShopsFurnituresToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ShopsFurnituresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportShopFurnitures));
|
var form = DependencyManager.Instance.Resolve<FormReportShopFurnitures>();
|
||||||
if (service is FormReportShopFurnitures form)
|
|
||||||
{
|
form.ShowDialog();
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OrderDateToolStripMenuItem_Click(object sender, EventArgs e)
|
private void OrderDateToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportCountOrdersByPeriod));
|
var form = DependencyManager.Instance.Resolve<FormReportCountOrdersByPeriod>();
|
||||||
if (service is FormReportCountOrdersByPeriod form)
|
|
||||||
{
|
form.ShowDialog();
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClientsMenuItem_Click(object sender, EventArgs e)
|
private void ClientsMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using FurnitureAssemblyContracts.BindingModels;
|
using FurnitureAssemblyContracts.BindingModels;
|
||||||
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
using FurnitureAssemblyContracts.BusinessLogicsContarcts;
|
||||||
|
using FurnitureAssemblyContracts.DI;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|
||||||
@ -19,14 +20,13 @@ namespace FurnitureAssembly
|
|||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
var form = DependencyManager.Instance.Resolve<FormShop>();
|
||||||
if (service is FormShop form)
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
LoadData();
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormShops_Load(object sender, EventArgs e)
|
private void FormShops_Load(object sender, EventArgs e)
|
||||||
@ -38,14 +38,7 @@ namespace FurnitureAssembly
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["Furnitures"].Visible = false;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка магазинов");
|
_logger.LogInformation("Загрузка магазинов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -60,16 +53,14 @@ namespace FurnitureAssembly
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service =
|
var form = DependencyManager.Instance.Resolve<FormShop>();
|
||||||
Program.ServiceProvider?.GetService(typeof(FormShop));
|
|
||||||
if (service is FormShop form)
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
LoadData();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +1,21 @@
|
|||||||
using FurnitureAssemblyDataModels.Models;
|
using FurnitureAssemblyContracts.Attributes;
|
||||||
using System;
|
using FurnitureAssemblyDataModels.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FurnitureAssemblyContracts.ViewModels
|
namespace FurnitureAssemblyContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ShopViewModel : IShopModel
|
public class ShopViewModel : IShopModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DisplayName("Название магазина")]
|
[Column(title: "Название магазина", isUseAutoSize: true, gridViewAutoSize: GridViewAutoSize.Fill)]
|
||||||
public string ShopName { get; set; } = string.Empty;
|
public string ShopName { get; set; } = string.Empty;
|
||||||
[DisplayName("Адрес магазина")]
|
[Column(title: "Адрес магазина", isUseAutoSize: true, gridViewAutoSize: GridViewAutoSize.Fill)]
|
||||||
public string Address { get; set; } = string.Empty;
|
public string Address { get; set; } = string.Empty;
|
||||||
[DisplayName("Дата открытия")]
|
[Column(title: "Дата открытия", width: 100)]
|
||||||
public DateTime DateOpening { get; set; }
|
public DateTime DateOpening { get; set; }
|
||||||
|
|
||||||
public Dictionary<int, (IFurnitureModel, int)> Furnitures { get; set; } = new();
|
public Dictionary<int, (IFurnitureModel, int)> Furnitures { get; set; } = new();
|
||||||
[DisplayName("Вместимость")]
|
[Column(title: "Вместимость", isUseAutoSize: true, gridViewAutoSize: GridViewAutoSize.Fill)]
|
||||||
public int MaxCount { get; set; }
|
public int MaxCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ namespace FurnitureAssemblyDatabaseImplement
|
|||||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IFurnitureStorage, FurnitureStorage>();
|
DependencyManager.Instance.RegisterType<IFurnitureStorage, FurnitureStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,23 +7,30 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FurnitureAssemblyDatabaseImplement.Models
|
namespace FurnitureAssemblyDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Shop : IShopModel
|
public class Shop : IShopModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[DataMember]
|
||||||
public string ShopName { get; private set; } = string.Empty;
|
public string ShopName { get; private set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
|
[DataMember]
|
||||||
public string Address { get; private set; } = string.Empty;
|
public string Address { get; private set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
|
[DataMember]
|
||||||
public DateTime DateOpening { get; private set; }
|
public DateTime DateOpening { get; private set; }
|
||||||
|
|
||||||
private Dictionary<int, (IFurnitureModel, int)>? _furnitures = null;
|
private Dictionary<int, (IFurnitureModel, int)>? _furnitures = null;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
|
[DataMember]
|
||||||
public Dictionary<int, (IFurnitureModel, int)> Furnitures
|
public Dictionary<int, (IFurnitureModel, int)> Furnitures
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -39,7 +46,7 @@ namespace FurnitureAssemblyDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
private set { }
|
private set { }
|
||||||
}
|
}
|
||||||
|
[DataMember]
|
||||||
public int MaxCount { get; private set; }
|
public int MaxCount { get; private set; }
|
||||||
|
|
||||||
[ForeignKey("ShopId")]
|
[ForeignKey("ShopId")]
|
||||||
|
@ -17,6 +17,7 @@ namespace FurnitureAssemblyListImplement
|
|||||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IFurnitureStorage, FurnitureStorage>();
|
DependencyManager.Instance.RegisterType<IFurnitureStorage, FurnitureStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,22 +5,26 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FurnitureAssemblyListImplement.Models
|
namespace FurnitureAssemblyListImplement.Models
|
||||||
{
|
{
|
||||||
|
[DataContract]
|
||||||
public class Shop : IShopModel
|
public class Shop : IShopModel
|
||||||
{
|
{
|
||||||
|
[DataMember]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public string ShopName { get; private set; } = string.Empty;
|
public string ShopName { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public string Address { get; private set; } = string.Empty;
|
public string Address { get; private set; } = string.Empty;
|
||||||
|
[DataMember]
|
||||||
public DateTime DateOpening { get; private set; }
|
public DateTime DateOpening { get; private set; }
|
||||||
|
[DataMember]
|
||||||
public Dictionary<int, (IFurnitureModel, int)> Furnitures { get; private set; } = new();
|
public Dictionary<int, (IFurnitureModel, int)> Furnitures { get; private set; } = new();
|
||||||
|
[DataMember]
|
||||||
public int MaxCount { get; private set; }
|
public int MaxCount { get; private set; }
|
||||||
|
|
||||||
public static Shop? Create(ShopBindingModel? model)
|
public static Shop? Create(ShopBindingModel? model)
|
||||||
|
Loading…
Reference in New Issue
Block a user