lab 8 almost completed
This commit is contained in:
parent
0372fbc989
commit
30a495b84d
@ -10,5 +10,7 @@ namespace PizzeriaContracts.BindingModels
|
|||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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<IClientStorage, ClientStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IPizzaStorage, PizzaStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -44,5 +44,7 @@ namespace PizzeriaDatabaseImplement.models
|
|||||||
Subject = Subject,
|
Subject = Subject,
|
||||||
Body = Body
|
Body = Body
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
Pizzeria/PizzeriaListImplement/Implements/BackUpInfo.cs
Normal file
17
Pizzeria/PizzeriaListImplement/Implements/BackUpInfo.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using PizzeriaContracts.StoragesContracts;
|
||||||
|
|
||||||
|
namespace PizzeriaListImplement.Implements
|
||||||
|
{
|
||||||
|
internal class BackUpInfo : IBackUpInfo
|
||||||
|
{
|
||||||
|
public List<T>? GetList<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type? GetTypeByModelInterface(string modelInterfaceName)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -45,5 +45,7 @@ namespace PizzeriaListImplement.Models
|
|||||||
SenderName = SenderName,
|
SenderName = SenderName,
|
||||||
DateDelivery = DateDelivery,
|
DateDelivery = DateDelivery,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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<IClientStorage, ClientStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IPizzaStorage, PizzaStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
Pizzeria/PizzeriaShopFileImplement/Implements/BackUpInfo.cs
Normal file
32
Pizzeria/PizzeriaShopFileImplement/Implements/BackUpInfo.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using PizzeriaContracts.StoragesContracts;
|
||||||
|
|
||||||
|
namespace PizzeriaFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class BackUpInfo : IBackUpInfo
|
||||||
|
{
|
||||||
|
public List<T>? GetList<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
var source = DataFileSingleton.GetInstance();
|
||||||
|
|
||||||
|
return (List<T>?)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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
using PizzeriaContracts.SearchModels;
|
using PizzeriaContracts.SearchModels;
|
||||||
using PizzeriaContracts.StoragesContracts;
|
using PizzeriaContracts.StoragesContracts;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using PizzeriaFileImplement.models;
|
||||||
|
|
||||||
namespace PizzeriaFileImplement.Implements
|
namespace PizzeriaFileImplement.Implements
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using PizzeriaContracts.SearchModels;
|
using PizzeriaContracts.SearchModels;
|
||||||
using PizzeriaContracts.StoragesContracts;
|
using PizzeriaContracts.StoragesContracts;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using PizzeriaFileImplement.models;
|
||||||
|
|
||||||
namespace PizzeriaFileImplement.Implements
|
namespace PizzeriaFileImplement.Implements
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using PizzeriaContracts.SearchModels;
|
using PizzeriaContracts.SearchModels;
|
||||||
using PizzeriaContracts.StoragesContracts;
|
using PizzeriaContracts.StoragesContracts;
|
||||||
using PizzeriaContracts.ViewModels;
|
using PizzeriaContracts.ViewModels;
|
||||||
|
using PizzeriaFileImplement.models;
|
||||||
|
|
||||||
namespace PizzeriaFileImplement.Implements
|
namespace PizzeriaFileImplement.Implements
|
||||||
{
|
{
|
||||||
|
@ -73,5 +73,7 @@ namespace PizzeriaFileImplement.models
|
|||||||
new XAttribute("SenderName", SenderName),
|
new XAttribute("SenderName", SenderName),
|
||||||
new XAttribute("DateDelivery", DateDelivery)
|
new XAttribute("DateDelivery", DateDelivery)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user