diff --git a/Pizzeria/PizzeriaContracts/BindingModels/MessageInfoBindingModel.cs b/Pizzeria/PizzeriaContracts/BindingModels/MessageInfoBindingModel.cs index f950171..3e33880 100644 --- a/Pizzeria/PizzeriaContracts/BindingModels/MessageInfoBindingModel.cs +++ b/Pizzeria/PizzeriaContracts/BindingModels/MessageInfoBindingModel.cs @@ -10,5 +10,7 @@ namespace PizzeriaContracts.BindingModels public DateTime DateDelivery { get; set; } public string Subject { get; set; } = string.Empty; public string Body { get; set; } = string.Empty; + + public int Id => throw new NotImplementedException(); } } \ No newline at end of file diff --git a/Pizzeria/PizzeriaDatabaseImplement/DatabaseImplementationExtension.cs b/Pizzeria/PizzeriaDatabaseImplement/DatabaseImplementationExtension.cs new file mode 100644 index 0000000..f6f9e2b --- /dev/null +++ b/Pizzeria/PizzeriaDatabaseImplement/DatabaseImplementationExtension.cs @@ -0,0 +1,22 @@ +using PizzeriaContracts.DI; +using PizzeriaContracts.StoragesContracts; +using PizzeriaDatabaseImplement.Implements; + +namespace PizzeriaDatabaseImplement +{ + public class DatabaseImplementationExtension : IImplementationExtension + { + public int Priority => 2; + + public void RegisterServices() + { + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + } +} diff --git a/Pizzeria/PizzeriaDatabaseImplement/models/MessageInfo.cs b/Pizzeria/PizzeriaDatabaseImplement/models/MessageInfo.cs index 72ac7ef..81d334c 100644 --- a/Pizzeria/PizzeriaDatabaseImplement/models/MessageInfo.cs +++ b/Pizzeria/PizzeriaDatabaseImplement/models/MessageInfo.cs @@ -44,5 +44,7 @@ namespace PizzeriaDatabaseImplement.models Subject = Subject, Body = Body }; + + public int Id => throw new NotImplementedException(); } } diff --git a/Pizzeria/PizzeriaListImplement/Implements/BackUpInfo.cs b/Pizzeria/PizzeriaListImplement/Implements/BackUpInfo.cs new file mode 100644 index 0000000..4c44032 --- /dev/null +++ b/Pizzeria/PizzeriaListImplement/Implements/BackUpInfo.cs @@ -0,0 +1,17 @@ +using PizzeriaContracts.StoragesContracts; + +namespace PizzeriaListImplement.Implements +{ + internal class BackUpInfo : IBackUpInfo + { + public List? GetList() where T : class, new() + { + throw new NotImplementedException(); + } + + public Type? GetTypeByModelInterface(string modelInterfaceName) + { + throw new NotImplementedException(); + } + } +} diff --git a/Pizzeria/PizzeriaListImplement/Models/MessageInfo.cs b/Pizzeria/PizzeriaListImplement/Models/MessageInfo.cs index 123817f..a48142a 100644 --- a/Pizzeria/PizzeriaListImplement/Models/MessageInfo.cs +++ b/Pizzeria/PizzeriaListImplement/Models/MessageInfo.cs @@ -45,5 +45,7 @@ namespace PizzeriaListImplement.Models SenderName = SenderName, DateDelivery = DateDelivery, }; + + public int Id => throw new NotImplementedException(); } } diff --git a/Pizzeria/PizzeriaShopFileImplement/FileImplementationExtension.cs b/Pizzeria/PizzeriaShopFileImplement/FileImplementationExtension.cs new file mode 100644 index 0000000..ed001b4 --- /dev/null +++ b/Pizzeria/PizzeriaShopFileImplement/FileImplementationExtension.cs @@ -0,0 +1,22 @@ +using PizzeriaContracts.DI; +using PizzeriaContracts.StoragesContracts; +using PizzeriaFileImplement.Implements; + +namespace PizzeriaFileImplement +{ + public class FileImplementationExtension : IImplementationExtension + { + public int Priority => 1; + + public void RegisterServices() + { + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); + } + } +} diff --git a/Pizzeria/PizzeriaShopFileImplement/Implements/BackUpInfo.cs b/Pizzeria/PizzeriaShopFileImplement/Implements/BackUpInfo.cs new file mode 100644 index 0000000..3ccce2f --- /dev/null +++ b/Pizzeria/PizzeriaShopFileImplement/Implements/BackUpInfo.cs @@ -0,0 +1,32 @@ +using PizzeriaContracts.StoragesContracts; + +namespace PizzeriaFileImplement.Implements +{ + public class BackUpInfo : IBackUpInfo + { + public List? GetList() where T : class, new() + { + var source = DataFileSingleton.GetInstance(); + + return (List?)source.GetType().GetProperties() + .FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments()[0] == typeof(T)) + ?.GetValue(source); + } + + public Type? GetTypeByModelInterface(string modelInterfaceName) + { + var assembly = typeof(BackUpInfo).Assembly; + var types = assembly.GetTypes(); + + foreach (var type in types) + { + if (type.IsClass && type.GetInterface(modelInterfaceName) != null) + { + return type; + } + } + + return null; + } + } +} diff --git a/Pizzeria/PizzeriaShopFileImplement/Implements/ClientStorage .cs b/Pizzeria/PizzeriaShopFileImplement/Implements/ClientStorage .cs index bb05fcc..b7ee7ea 100644 --- a/Pizzeria/PizzeriaShopFileImplement/Implements/ClientStorage .cs +++ b/Pizzeria/PizzeriaShopFileImplement/Implements/ClientStorage .cs @@ -2,6 +2,7 @@ using PizzeriaContracts.SearchModels; using PizzeriaContracts.StoragesContracts; using PizzeriaContracts.ViewModels; +using PizzeriaFileImplement.models; namespace PizzeriaFileImplement.Implements { diff --git a/Pizzeria/PizzeriaShopFileImplement/Implements/ImplementerStorage.cs b/Pizzeria/PizzeriaShopFileImplement/Implements/ImplementerStorage.cs index d4c332b..3cb0c8e 100644 --- a/Pizzeria/PizzeriaShopFileImplement/Implements/ImplementerStorage.cs +++ b/Pizzeria/PizzeriaShopFileImplement/Implements/ImplementerStorage.cs @@ -2,6 +2,7 @@ using PizzeriaContracts.SearchModels; using PizzeriaContracts.StoragesContracts; using PizzeriaContracts.ViewModels; +using PizzeriaFileImplement.models; namespace PizzeriaFileImplement.Implements { diff --git a/Pizzeria/PizzeriaShopFileImplement/Implements/MessageInfoStorage.cs b/Pizzeria/PizzeriaShopFileImplement/Implements/MessageInfoStorage.cs index ce7318b..ceb6b97 100644 --- a/Pizzeria/PizzeriaShopFileImplement/Implements/MessageInfoStorage.cs +++ b/Pizzeria/PizzeriaShopFileImplement/Implements/MessageInfoStorage.cs @@ -2,6 +2,7 @@ using PizzeriaContracts.SearchModels; using PizzeriaContracts.StoragesContracts; using PizzeriaContracts.ViewModels; +using PizzeriaFileImplement.models; namespace PizzeriaFileImplement.Implements { diff --git a/Pizzeria/PizzeriaShopFileImplement/models/MessageInfo.cs b/Pizzeria/PizzeriaShopFileImplement/models/MessageInfo.cs index 50252b7..a76bfba 100644 --- a/Pizzeria/PizzeriaShopFileImplement/models/MessageInfo.cs +++ b/Pizzeria/PizzeriaShopFileImplement/models/MessageInfo.cs @@ -73,5 +73,7 @@ namespace PizzeriaFileImplement.models new XAttribute("SenderName", SenderName), new XAttribute("DateDelivery", DateDelivery) ); + + public int Id => throw new NotImplementedException(); } }