Обновлена базовая часть с учетом сущности магазин

This commit is contained in:
Данияр Аглиуллов 2023-03-19 15:14:01 +04:00
parent c086a7267c
commit a296ec399b
6 changed files with 28 additions and 0 deletions

View File

@ -16,6 +16,7 @@ namespace ConfectioneryFileImplement
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>(); DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>(); DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>(); DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>(); DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
} }

View File

@ -2,23 +2,30 @@
using ConfectioneryContracts.ViewModels; using ConfectioneryContracts.ViewModels;
using ConfectioneryDataModels; using ConfectioneryDataModels;
using ConfectioneryDataModels.Models; using ConfectioneryDataModels.Models;
using System.Runtime.Serialization;
using System.Xml.Linq; using System.Xml.Linq;
namespace ConfectioneryFileImplement namespace ConfectioneryFileImplement
{ {
[DataContract]
public class Shop : IShopModel public class Shop : IShopModel
{ {
[DataMember]
public string Name { get; private set; } = string.Empty; public string Name { get; private set; } = string.Empty;
[DataMember]
public string Address { get; private set; } = string.Empty; public string Address { get; private set; } = string.Empty;
[DataMember]
public int MaxCountPastries { get; private set; } public int MaxCountPastries { get; private set; }
[DataMember]
public DateTime DateOpening { get; private set; } public DateTime DateOpening { get; private set; }
public Dictionary<int, int> CountPastries { get; private set; } = new(); public Dictionary<int, int> CountPastries { get; private set; } = new();
private Dictionary<int, (IPastryModel, int)>? _cachedPastries = null; private Dictionary<int, (IPastryModel, int)>? _cachedPastries = null;
[DataMember]
public Dictionary<int, (IPastryModel, int)> Pastries public Dictionary<int, (IPastryModel, int)> Pastries
{ {
get get
@ -34,6 +41,7 @@ namespace ConfectioneryFileImplement
} }
} }
[DataMember]
public int Id { get; private set; } public int Id { get; private set; }
public static Shop? Create(ShopBindingModel? model) public static Shop? Create(ShopBindingModel? model)

View File

@ -21,6 +21,7 @@ namespace ConfectioneryListImplement
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>(); DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>(); DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>(); DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>(); DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
} }

View File

@ -69,6 +69,7 @@ namespace ConfectioneryView
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>(); DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>(); DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>(); DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
DependencyManager.Instance.RegisterType<IShopLogic, ShopLogic>();
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true); DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
@ -89,6 +90,14 @@ namespace ConfectioneryView
DependencyManager.Instance.RegisterType<FormViewImplementers>(); DependencyManager.Instance.RegisterType<FormViewImplementers>();
DependencyManager.Instance.RegisterType<FormImplementer>(); DependencyManager.Instance.RegisterType<FormImplementer>();
DependencyManager.Instance.RegisterType<FormViewMail>(); DependencyManager.Instance.RegisterType<FormViewMail>();
DependencyManager.Instance.RegisterType<FormReportShopPastries>();
DependencyManager.Instance.RegisterType<FormReportGroupOrders>();
DependencyManager.Instance.RegisterType<FormShop>();
DependencyManager.Instance.RegisterType<FormViewShops>();
DependencyManager.Instance.RegisterType<FormSellPastry>();
DependencyManager.Instance.RegisterType<FormReplyMail>();
DependencyManager.Instance.RegisterType<FormAddPastryInShop>();
} }
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck(); private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();

View File

@ -16,6 +16,7 @@ namespace ConfectioneryDatabaseImplement
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>(); DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>(); DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>(); DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>(); DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
} }

View File

@ -7,25 +7,32 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using System.Xml.Linq; using System.Xml.Linq;
namespace ConfectioneryDatabaseImplement.Models namespace ConfectioneryDatabaseImplement.Models
{ {
[DataContract]
public class Shop : IShopModel public class Shop : IShopModel
{ {
[Required] [Required]
[DataMember]
public string Name { get; private set; } = string.Empty; public string Name { 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 int MaxCountPastries { get; private set; } public int MaxCountPastries { get; private set; }
[DataMember]
public DateTime DateOpening { get; private set; } public DateTime DateOpening { get; private set; }
private Dictionary<int, (IPastryModel, int)>? _cachedPastries = null; private Dictionary<int, (IPastryModel, int)>? _cachedPastries = null;
[NotMapped] [NotMapped]
[DataMember]
public Dictionary<int, (IPastryModel, int)> Pastries public Dictionary<int, (IPastryModel, int)> Pastries
{ {
get get
@ -41,6 +48,7 @@ namespace ConfectioneryDatabaseImplement.Models
} }
} }
[DataMember]
public int Id { get; private set; } public int Id { get; private set; }
[ForeignKey("ShopId")] [ForeignKey("ShopId")]