add implementer in FlowerShopContracts
This commit is contained in:
parent
8d16b12e86
commit
d0a85724da
@ -0,0 +1,13 @@
|
||||
using FlowerShopDataModels.Models;
|
||||
|
||||
namespace FlowerShopContracts.BindingModels
|
||||
{
|
||||
public class ImplementerBindingModel : IImplementerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public int WorkExperience { get; set; }
|
||||
public int Qualification { get; set; }
|
||||
}
|
||||
}
|
@ -8,7 +8,8 @@ namespace FlowerShopContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public int FlowerId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int ImplementerId { get; set; } = 0;
|
||||
public int Count { get; set; }
|
||||
public double Sum { get; set; }
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
@ -0,0 +1,15 @@
|
||||
using FlowerShopContracts.BindingModels;
|
||||
using FlowerShopContracts.SearchModels;
|
||||
using FlowerShopContracts.ViewModels;
|
||||
|
||||
namespace FlowerShopContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IImplementerLogic
|
||||
{
|
||||
List<ImplementerViewModel>? ReadList(ImplementerSearchModel? model);
|
||||
ImplementerViewModel? ReadElement(ImplementerSearchModel model);
|
||||
bool Create(ImplementerBindingModel model);
|
||||
bool Update(ImplementerBindingModel model);
|
||||
bool Delete(ImplementerBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace FlowerShopContracts.SearchModels
|
||||
{
|
||||
public class ImplementerSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? ImplementerFIO { get; set; }
|
||||
}
|
||||
}
|
@ -1,10 +1,14 @@
|
||||
namespace FlowerShopContracts.SearchModels
|
||||
using FlowerShopDataModels.Enums;
|
||||
|
||||
namespace FlowerShopContracts.SearchModels
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public int? ImplementerId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
using FlowerShopContracts.BindingModels;
|
||||
using FlowerShopContracts.SearchModels;
|
||||
using FlowerShopContracts.ViewModels;
|
||||
|
||||
namespace FlowerShopContracts.StoragesContracts
|
||||
{
|
||||
public interface IImplementerStorage
|
||||
{
|
||||
List<ImplementerViewModel> GetFullList();
|
||||
List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model);
|
||||
ImplementerViewModel? GetElement(ImplementerSearchModel model);
|
||||
ImplementerViewModel? Insert(ImplementerBindingModel model);
|
||||
ImplementerViewModel? Update(ImplementerBindingModel model);
|
||||
ImplementerViewModel? Delete(ImplementerBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using FlowerShopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace FlowerShopContracts.ViewModels
|
||||
{
|
||||
public class ImplementerViewModel : IImplementerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("ФИО исполнителя")]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("Опыт исполнителя")]
|
||||
public int WorkExperience { get; set; }
|
||||
[DisplayName("Квалификация исполнителя")]
|
||||
public int Qualification { get; set; }
|
||||
}
|
||||
}
|
@ -10,12 +10,15 @@ namespace FlowerShopContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public int FlowerId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int ImplementerId { get; set; } = 0;
|
||||
[DisplayName("Изделие")]
|
||||
public string FlowerName { get; set; } = string.Empty;
|
||||
[DisplayName("ФИО клиента")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
[DisplayName("ФИО исполнителя")]
|
||||
public string ImplementerFIO { get; set; }=string.Empty;
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
[DisplayName("Сумма")]
|
||||
public double Sum { get; set; }
|
||||
[DisplayName("Статус")]
|
||||
|
11
FlowerShop/FlowerShopDataModels/Models/IImplementerModel.cs
Normal file
11
FlowerShop/FlowerShopDataModels/Models/IImplementerModel.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace FlowerShopDataModels.Models
|
||||
{
|
||||
public interface IImplementerModel : IId
|
||||
{
|
||||
string ImplementerFIO { get; }
|
||||
string Password { get; }
|
||||
int WorkExperience { get; }
|
||||
int Qualification { get; }
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ namespace FlowerShopDataModels.Models
|
||||
{
|
||||
int FlowerId { get; }
|
||||
int ClientId { get; }
|
||||
int ImplementerId { get; }
|
||||
int Count { get; }
|
||||
double Sum { get; }
|
||||
OrderStatus Status { get; }
|
||||
|
@ -9,12 +9,14 @@ namespace FlowerShopListImplement
|
||||
public List<Order> Orders { get; set; }
|
||||
public List<Flower> Flowers { get; set; }
|
||||
public List<Client> Clients { get; set; }
|
||||
public List<Implementer> Implementers { get; set; }
|
||||
private DataListSingleton()
|
||||
{
|
||||
Components = new List<Component>();
|
||||
Orders = new List<Order>();
|
||||
Flowers = new List<Flower>();
|
||||
Clients = new List<Client>();
|
||||
Implementers = new List<Implementer>();
|
||||
}
|
||||
public static DataListSingleton GetInstance()
|
||||
{
|
||||
|
@ -40,6 +40,17 @@ namespace FlowerShopListImplement.Implements
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else if (model.ImplementerId.HasValue)
|
||||
{
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (order.Id == model.Id && order.ImplementerId == model.ImplementerId)
|
||||
{
|
||||
result.Add(AttachNames(order.GetViewModel));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
if (order.Id == model.Id && order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
|
||||
@ -125,7 +136,15 @@ namespace FlowerShopListImplement.Implements
|
||||
return model;
|
||||
}
|
||||
}
|
||||
return model;
|
||||
foreach (var implementer in _source.Implementers)
|
||||
{
|
||||
if (implementer.Id == model.ImplementerId)
|
||||
{
|
||||
model.ImplementerFIO = implementer.ImplementerFIO;
|
||||
return model;
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
49
FlowerShop/FlowerShopListImplement/Models/Implementer.cs
Normal file
49
FlowerShop/FlowerShopListImplement/Models/Implementer.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using FlowerShopContracts.BindingModels;
|
||||
using FlowerShopContracts.ViewModels;
|
||||
using FlowerShopDataModels.Models;
|
||||
|
||||
namespace FlowerShopListImplement.Models
|
||||
{
|
||||
public class Implementer : IImplementerModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string ImplementerFIO { get; private set; }
|
||||
public string Password { get; private set; }
|
||||
public int WorkExperience { get; private set; }
|
||||
public int Qualification { get; private set; }
|
||||
public static Implementer? Create(ImplementerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Implementer()
|
||||
{
|
||||
Id = model.Id,
|
||||
ImplementerFIO = model.ImplementerFIO,
|
||||
Password = model.Password,
|
||||
WorkExperience = model.WorkExperience,
|
||||
Qualification = model.Qualification,
|
||||
};
|
||||
}
|
||||
public void Update(ImplementerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ImplementerFIO = model.ImplementerFIO;
|
||||
Password = model.Password;
|
||||
WorkExperience = model.WorkExperience;
|
||||
Qualification = model.Qualification;
|
||||
}
|
||||
public ImplementerViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ImplementerFIO = ImplementerFIO,
|
||||
Password = Password,
|
||||
WorkExperience = WorkExperience,
|
||||
Qualification = Qualification,
|
||||
};
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ namespace FlowerShopListImplement.Models
|
||||
public int Id { get; private set; }
|
||||
public int FlowerId { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
public int ImplementerId { get; private set; }
|
||||
public int Count { get; set; }
|
||||
public double Sum { get; private set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
@ -26,6 +27,7 @@ namespace FlowerShopListImplement.Models
|
||||
Id = model.Id,
|
||||
FlowerId = model.FlowerId,
|
||||
ClientId = model.ClientId,
|
||||
ImplementerId = model.ImplementerId,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -42,6 +44,7 @@ namespace FlowerShopListImplement.Models
|
||||
Id = model.Id;
|
||||
FlowerId = model.FlowerId;
|
||||
ClientId = model.ClientId;
|
||||
ImplementerId = model.ImplementerId;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
@ -53,6 +56,7 @@ namespace FlowerShopListImplement.Models
|
||||
Id = Id,
|
||||
FlowerId = FlowerId,
|
||||
ClientId = ClientId,
|
||||
ImplementerId = ImplementerId,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
|
Loading…
Reference in New Issue
Block a user