Compare commits
2 Commits
8ad8b44a23
...
5c6db64994
Author | SHA1 | Date | |
---|---|---|---|
5c6db64994 | |||
d7597ea67b |
@ -7,21 +7,21 @@ using Microsoft.Extensions.Logging;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.BusinessLogics
|
namespace BankBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
public class MealPlanLogic : IMealPlanLogic
|
public class AdditionsLogic : IAdditionsLogic
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IMealPlanStorage _mealPlanStorage;
|
private readonly IAdditionsPlanStorage _additionsStorage;
|
||||||
|
|
||||||
public MealPlanLogic(ILogger<MealPlanLogic> logger, IMealPlanStorage mealPlanStorage)
|
public AdditionsLogic(ILogger<AdditionsLogic> logger, IAdditionsPlanStorage mealPlanStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_mealPlanStorage = mealPlanStorage;
|
_additionsStorage = mealPlanStorage;
|
||||||
}
|
}
|
||||||
public bool Create(MealPlanBindingModel model)
|
public bool Create(AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
if (_mealPlanStorage.Insert(model) == null)
|
if (_additionsStorage.Insert(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Insert operation failed");
|
_logger.LogWarning("Insert operation failed");
|
||||||
return false;
|
return false;
|
||||||
@ -30,13 +30,13 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(MealPlanBindingModel model)
|
public bool Delete(AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
CheckModel(model, false);
|
||||||
|
|
||||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||||
|
|
||||||
if (_mealPlanStorage.Delete(model) == null)
|
if (_additionsStorage.Delete(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Delete operation failed");
|
_logger.LogWarning("Delete operation failed");
|
||||||
return false;
|
return false;
|
||||||
@ -45,16 +45,16 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MealPlanViewModel? ReadElement(MealPlanSearchModel model)
|
public AdditionsPlanViewModel? ReadElement(AdditionsSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
throw new ArgumentNullException(nameof(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("ReadElement. MealPlanName:{MealPlanName}.Id:{Id}", model.MealPlanName, model.Id);
|
_logger.LogInformation("ReadElement. MealPlanName:{MealPlanName}.Id:{Id}", model.AdditionsName, model.Id);
|
||||||
|
|
||||||
var element = _mealPlanStorage.GetElement(model);
|
var element = _additionsStorage.GetElement(model);
|
||||||
|
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
@ -67,11 +67,11 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MealPlanViewModel>? ReadList(MealPlanSearchModel? model)
|
public List<AdditionsPlanViewModel>? ReadList(AdditionsSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. MealPlanName:{MealPlanName}.Id:{ Id}", model?.MealPlanName, model?.Id);
|
_logger.LogInformation("ReadList. MealPlanName:{MealPlanName}.Id:{ Id}", model?.AdditionsName, model?.Id);
|
||||||
|
|
||||||
var list = model == null ? _mealPlanStorage.GetFullList() : _mealPlanStorage.GetFilteredList(model);
|
var list = model == null ? _additionsStorage.GetFullList() : _additionsStorage.GetFilteredList(model);
|
||||||
|
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
@ -84,11 +84,11 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Update(MealPlanBindingModel model)
|
public bool Update(AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
if (_mealPlanStorage.Update(model) == null)
|
if (_additionsStorage.Update(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Update operation failed");
|
_logger.LogWarning("Update operation failed");
|
||||||
return false;
|
return false;
|
||||||
@ -97,7 +97,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckModel(MealPlanBindingModel model, bool withParams = true)
|
private void CheckModel(AdditionsBindingModel model, bool withParams = true)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -121,9 +121,9 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
_logger.LogInformation("MealPlan. MealPlanName:{MealPlanName}.MealPlanPrice:{ MealPlanPrice}. Id: { Id}", model.MealPlanName, model.MealPlanPrice, model.Id);
|
_logger.LogInformation("MealPlan. MealPlanName:{MealPlanName}.MealPlanPrice:{ MealPlanPrice}. Id: { Id}", model.MealPlanName, model.MealPlanPrice, model.Id);
|
||||||
|
|
||||||
var element = _mealPlanStorage.GetElement(new MealPlanSearchModel
|
var element = _additionsStorage.GetElement(new AdditionsSearchModel
|
||||||
{
|
{
|
||||||
MealPlanName = model.MealPlanName
|
AdditionsName = model.MealPlanName
|
||||||
});
|
});
|
||||||
|
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
@ -14,7 +14,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
private readonly int _passwordMinLength = 10;
|
private readonly int _passwordMinLength = 10;
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IClercStorage _ClercStorage;
|
private readonly IClercStorage _clercStorage;
|
||||||
|
|
||||||
public ClercLogic(ILogger<ClercLogic> logger, IClercStorage clercStorage)
|
public ClercLogic(ILogger<ClercLogic> logger, IClercStorage clercStorage)
|
||||||
{
|
{
|
||||||
|
@ -12,26 +12,26 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.BusinessLogics
|
namespace BankBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
public class HeadwaiterLogic : IHeadwaiterLogic
|
public class ClientLogic : IClientLogic
|
||||||
{
|
{
|
||||||
private readonly int _loginMaxLength = 50;
|
private readonly int _loginMaxLength = 50;
|
||||||
private readonly int _passwordMaxLength = 50;
|
private readonly int _passwordMaxLength = 50;
|
||||||
private readonly int _passwordMinLength = 10;
|
private readonly int _passwordMinLength = 10;
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IHeadwaiterStorage _headwaiterStorage;
|
private readonly IClientStorage _clientStorage;
|
||||||
|
|
||||||
public HeadwaiterLogic(ILogger<HeadwaiterLogic> logger, IHeadwaiterStorage headwaiterStorage)
|
public ClientLogic(ILogger<ClientLogic> logger, IClientStorage headwaiterStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_headwaiterStorage = headwaiterStorage;
|
_clientStorage = headwaiterStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Create(HeadwaiterBindingModel model)
|
public bool Create(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
if (_headwaiterStorage.Insert(model) == null)
|
if (_clientStorage.Insert(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Insert operation failed");
|
_logger.LogWarning("Insert operation failed");
|
||||||
|
|
||||||
@ -41,13 +41,13 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(HeadwaiterBindingModel model)
|
public bool Delete(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
CheckModel(model, false);
|
||||||
|
|
||||||
_logger.LogInformation("Delete. Id: {Id}", model.Id);
|
_logger.LogInformation("Delete. Id: {Id}", model.Id);
|
||||||
|
|
||||||
if (_headwaiterStorage.Delete(model) == null)
|
if (_clientStorage.Delete(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Delete operation failed");
|
_logger.LogWarning("Delete operation failed");
|
||||||
|
|
||||||
@ -57,16 +57,16 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeadwaiterViewModel? ReadElement(HeadwaiterSearchModel model)
|
public ClientViewModel? ReadElement(ClientSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
throw new ArgumentNullException(nameof(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("ReadElement. HeadwaiterFIO: {HeadwaiterFIO}. HeadwaiterLogin: {HeadwaiterLogin}. Id: {Id}.", model.HeadwaiterFIO, model.HeadwaiterLogin, model.Id);
|
_logger.LogInformation("ReadElement. HeadwaiterFIO: {HeadwaiterFIO}. HeadwaiterLogin: {HeadwaiterLogin}. Id: {Id}.", model.ClientFIO, model.ClientLogin, model.Id);
|
||||||
|
|
||||||
var element = _headwaiterStorage.GetElement(model);
|
var element = _clientStorage.GetElement(model);
|
||||||
|
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
@ -79,11 +79,11 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HeadwaiterViewModel>? ReadList(HeadwaiterSearchModel? model)
|
public List<ClientViewModel>? ReadList(ClientSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. HeadwaiterFIO: {HeadwaiterFIO}. HeadwaiterLogin: {HeadwaiterLogin}. Id: {Id}.", model?.HeadwaiterFIO, model?.HeadwaiterLogin, model?.Id);
|
_logger.LogInformation("ReadList. HeadwaiterFIO: {HeadwaiterFIO}. HeadwaiterLogin: {HeadwaiterLogin}. Id: {Id}.", model?.ClientFIO, model?.ClientLogin, model?.Id);
|
||||||
|
|
||||||
var list = model == null ? _headwaiterStorage.GetFullList() : _headwaiterStorage.GetFilteredList(model);
|
var list = model == null ? _clientStorage.GetFullList() : _clientStorage.GetFilteredList(model);
|
||||||
|
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
@ -96,11 +96,11 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Update(HeadwaiterBindingModel model)
|
public bool Update(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
if (_headwaiterStorage.Update(model) == null)
|
if (_clientStorage.Update(model) == null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Update operation failed");
|
_logger.LogWarning("Update operation failed");
|
||||||
return false;
|
return false;
|
||||||
@ -108,7 +108,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckModel(HeadwaiterBindingModel model, bool withParams = true)
|
private void CheckModel(ClientBindingModel model, bool withParams = true)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -120,51 +120,51 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.HeadwaiterFIO))
|
if (string.IsNullOrEmpty(model.ClientFIO))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет ФИО метродотеля", nameof(model.HeadwaiterFIO));
|
throw new ArgumentNullException("Нет ФИО метродотеля", nameof(model.ClientFIO));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.HeadwaiterLogin))
|
if (string.IsNullOrEmpty(model.ClientLogin))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет логина метродотеля", nameof(model.HeadwaiterLogin));
|
throw new ArgumentNullException("Нет логина метродотеля", nameof(model.ClientLogin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.HeadwaiterLogin.Length > _loginMaxLength)
|
if (model.ClientLogin.Length > _loginMaxLength)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Логин слишком длинный", nameof(model.HeadwaiterLogin));
|
throw new ArgumentNullException("Логин слишком длинный", nameof(model.ClientLogin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.HeadwaiterNumber))
|
if (string.IsNullOrEmpty(model.ClientNumber))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет номера телефона метродотеля", nameof(model.HeadwaiterNumber));
|
throw new ArgumentNullException("Нет номера телефона метродотеля", nameof(model.ClientNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.HeadwaiterEmail))
|
if (string.IsNullOrEmpty(model.ClientEmail))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет почты метродотеля", nameof(model.HeadwaiterEmail));
|
throw new ArgumentNullException("Нет почты метродотеля", nameof(model.ClientEmail));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(model.HeadwaiterPassword))
|
if (string.IsNullOrEmpty(model.ClientPassword))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет пароля метродотеля", nameof(model.HeadwaiterPassword));
|
throw new ArgumentNullException("Нет пароля метродотеля", nameof(model.ClientPassword));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.HeadwaiterPassword.Length < _passwordMinLength)
|
if (model.ClientPassword.Length < _passwordMinLength)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Пароль слишком короткий", nameof(model.HeadwaiterPassword));
|
throw new ArgumentNullException("Пароль слишком короткий", nameof(model.ClientPassword));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.HeadwaiterPassword.Length > _passwordMaxLength)
|
if (model.ClientPassword.Length > _passwordMaxLength)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Пароль слишком длинный", nameof(model.HeadwaiterPassword));
|
throw new ArgumentNullException("Пароль слишком длинный", nameof(model.ClientPassword));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Headwaiter. HeadwaiterFIO: {HeadwaiterFIO}. HeadwaiterLogin: {HeadwaiterLogin}. Id: {Id}", model.HeadwaiterFIO, model.HeadwaiterLogin, model.Id);
|
_logger.LogInformation("Headwaiter. HeadwaiterFIO: {HeadwaiterFIO}. HeadwaiterLogin: {HeadwaiterLogin}. Id: {Id}", model.ClientFIO, model.ClientLogin, model.Id);
|
||||||
|
|
||||||
var element = _headwaiterStorage.GetElement(new HeadwaiterSearchModel
|
var element = _clientStorage.GetElement(new ClientSearchModel
|
||||||
{
|
{
|
||||||
HeadwaiterLogin = model.HeadwaiterLogin
|
ClientLogin = model.ClientLogin
|
||||||
});
|
});
|
||||||
|
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
@ -12,18 +12,18 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.BusinessLogics
|
namespace BankBusinessLogic.BusinessLogics
|
||||||
{
|
{
|
||||||
public class DinnerLogic : IDinnerLogic
|
public class CreditLogic : ICreditLogic
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IDinnerStorage _dinnerStorage;
|
private readonly ICreditStorage _dinnerStorage;
|
||||||
|
|
||||||
public DinnerLogic(ILogger<DinnerLogic> logger, IDinnerStorage dinnerStorage)
|
public CreditLogic(ILogger<CreditLogic> logger, ICreditStorage dinnerStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_dinnerStorage = dinnerStorage;
|
_dinnerStorage = dinnerStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Create(DinnerBindingModel model)
|
public bool Create(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(DinnerBindingModel model)
|
public bool Delete(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
CheckModel(model, false);
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DinnerViewModel? ReadElement(DinnerSearchModel model)
|
public CreditViewModel? ReadElement(CreditSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DinnerViewModel>? ReadList(DinnerSearchModel? model)
|
public List<CreditViewModel>? ReadList(CreditSearchModel? model)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("ReadList. DinnerName:{DinnerName}.Id:{ Id}", model?.DinnerName, model?.Id);
|
_logger.LogInformation("ReadList. DinnerName:{DinnerName}.Id:{ Id}", model?.DinnerName, model?.Id);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Update(DinnerBindingModel model)
|
public bool Update(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
CheckModel(model);
|
CheckModel(model);
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
private void CheckModel(DinnerBindingModel model, bool withParams = true)
|
private void CheckModel(CreditBindingModel model, bool withParams = true)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
@ -16,13 +16,13 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
public class ReportLogicHeadwaiter : IReportHeadwaiterLogic
|
public class ReportLogicHeadwaiter : IReportHeadwaiterLogic
|
||||||
{
|
{
|
||||||
private readonly IRoomStorage _roomStorage;
|
private readonly IRoomStorage _roomStorage;
|
||||||
private readonly IDinnerStorage _dinnerStorage;
|
private readonly ICreditStorage _dinnerStorage;
|
||||||
private readonly IMealPlanStorage _mealPlansStorage;
|
private readonly IAdditionsPlanStorage _mealPlansStorage;
|
||||||
private readonly IConferenceBookingStorage _conferenceBookingStorage;
|
private readonly IConferenceBookingStorage _conferenceBookingStorage;
|
||||||
private readonly AbstractSaveToExcelHeadwaiter _saveToExcel;
|
private readonly AbstractSaveToExcelClient _saveToExcel;
|
||||||
private readonly AbstractSaveToWordHeadwaitre _saveToWord;
|
private readonly AbstractSaveToWordHeadwaitre _saveToWord;
|
||||||
private readonly AbstractSaveToPdfHeadwaiter _saveToPdf;
|
private readonly AbstractSaveToPdfClient _saveToPdf;
|
||||||
public ReportLogicHeadwaiter(IRoomStorage roomStorage, IDinnerStorage dinnerStorage, IMealPlanStorage mealPlansStorage, IConferenceBookingStorage conferenceBookingStorage, AbstractSaveToExcelHeadwaiter saveToExcel, AbstractSaveToWordHeadwaitre saveToWord, AbstractSaveToPdfHeadwaiter saveToPdf)
|
public ReportLogicHeadwaiter(IRoomStorage roomStorage, ICreditStorage dinnerStorage, IAdditionsPlanStorage mealPlansStorage, IConferenceBookingStorage conferenceBookingStorage, AbstractSaveToExcelClient saveToExcel, AbstractSaveToWordHeadwaitre saveToWord, AbstractSaveToPdfClient saveToPdf)
|
||||||
{
|
{
|
||||||
_roomStorage = roomStorage;
|
_roomStorage = roomStorage;
|
||||||
_dinnerStorage = dinnerStorage;
|
_dinnerStorage = dinnerStorage;
|
||||||
@ -85,7 +85,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public void SaveMealPlanDinnerToExcelFile(ReportHeadwaiterBindingModel model)
|
public void SaveMealPlanDinnerToExcelFile(ReportHeadwaiterBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToExcel.CreateReport(new ExcelInfoHeadwaiter
|
_saveToExcel.CreateReport(new ExcelInfoClient
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список изделий",
|
Title = "Список изделий",
|
||||||
@ -95,7 +95,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public void SaveMealPlanDinnerToWordFile(ReportHeadwaiterBindingModel model)
|
public void SaveMealPlanDinnerToWordFile(ReportHeadwaiterBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToWord.CreateDoc(new WordInfoHeadwaiter
|
_saveToWord.CreateDoc(new WordInfoClient
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список участников",
|
Title = "Список участников",
|
||||||
@ -105,7 +105,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public void SaveConferenceBindingRoomsToPdfFile(ReportHeadwaiterBindingModel model)
|
public void SaveConferenceBindingRoomsToPdfFile(ReportHeadwaiterBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToPdf.CreateDoc(new PdfInfoHeadwaiter
|
_saveToPdf.CreateDoc(new PdfInfoClient
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список участников",
|
Title = "Список участников",
|
||||||
|
@ -12,13 +12,13 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
public class ReportLogicOrganiser : IReportOrganiserLogic
|
public class ReportLogicOrganiser : IReportOrganiserLogic
|
||||||
{
|
{
|
||||||
private readonly IMealPlanStorage _mealPlanStorage;
|
private readonly IAdditionsPlanStorage _mealPlanStorage;
|
||||||
private readonly IMemberStorage _memberStorage;
|
private readonly IMemberStorage _memberStorage;
|
||||||
private readonly IConferenceStorage _conferenceStorage;
|
private readonly IConferenceStorage _conferenceStorage;
|
||||||
private readonly AbstractSaveToExcelOrganiser _saveToExcel;
|
private readonly AbstractSaveToExcelOrganiser _saveToExcel;
|
||||||
private readonly AbstractSaveToWordClerc _saveToWord;
|
private readonly AbstractSaveToWordClerc _saveToWord;
|
||||||
private readonly AbstractSaveToPdfClerc _saveToPdf;
|
private readonly AbstractSaveToPdfClerc _saveToPdf;
|
||||||
public ReportLogicOrganiser(IMealPlanStorage mealPlanStorage, IMemberStorage memberStorage, IConferenceStorage conferenceStorage, AbstractSaveToExcelOrganiser saveToExcel, AbstractSaveToWordClerc saveToWord, AbstractSaveToPdfClerc saveToPdf)
|
public ReportLogicOrganiser(IAdditionsPlanStorage mealPlanStorage, IMemberStorage memberStorage, IConferenceStorage conferenceStorage, AbstractSaveToExcelOrganiser saveToExcel, AbstractSaveToWordClerc saveToWord, AbstractSaveToPdfClerc saveToPdf)
|
||||||
{
|
{
|
||||||
_mealPlanStorage = mealPlanStorage;
|
_mealPlanStorage = mealPlanStorage;
|
||||||
_memberStorage = memberStorage;
|
_memberStorage = memberStorage;
|
||||||
@ -74,7 +74,7 @@ namespace BankBusinessLogic.BusinessLogics
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var listMealPlans = _mealPlanStorage.GetFilteredList(new MealPlanSearchModel());
|
var listMealPlans = _mealPlanStorage.GetFilteredList(new AdditionsSearchModel());
|
||||||
|
|
||||||
foreach (var mealPlan in listMealPlans)
|
foreach (var mealPlan in listMealPlans)
|
||||||
{
|
{
|
||||||
|
@ -8,9 +8,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage
|
namespace BankBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
public abstract class AbstractSaveToExcelHeadwaiter
|
public abstract class AbstractSaveToExcelClient
|
||||||
{
|
{
|
||||||
public void CreateReport(ExcelInfoHeadwaiter info)
|
public void CreateReport(ExcelInfoClient info)
|
||||||
{
|
{
|
||||||
CreateExcel(info);
|
CreateExcel(info);
|
||||||
|
|
||||||
@ -69,12 +69,12 @@ namespace BankBusinessLogic.OfficePackage
|
|||||||
SaveExcel(info);
|
SaveExcel(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void CreateExcel(ExcelInfoHeadwaiter info);
|
protected abstract void CreateExcel(ExcelInfoClient info);
|
||||||
|
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||||
|
|
||||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||||
|
|
||||||
protected abstract void SaveExcel(ExcelInfoHeadwaiter info);
|
protected abstract void SaveExcel(ExcelInfoClient info);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,9 +8,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage
|
namespace BankBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
public abstract class AbstractSaveToPdfHeadwaiter
|
public abstract class AbstractSaveToPdfClient
|
||||||
{
|
{
|
||||||
public void CreateDoc(PdfInfoHeadwaiter info)
|
public void CreateDoc(PdfInfoClient info)
|
||||||
{
|
{
|
||||||
CreatePdf(info);
|
CreatePdf(info);
|
||||||
CreateParagraph(new PdfParagraph
|
CreateParagraph(new PdfParagraph
|
||||||
@ -49,10 +49,10 @@ namespace BankBusinessLogic.OfficePackage
|
|||||||
});
|
});
|
||||||
SavePdf(info);
|
SavePdf(info);
|
||||||
}
|
}
|
||||||
protected abstract void CreatePdf(PdfInfoHeadwaiter info);
|
protected abstract void CreatePdf(PdfInfoClient info);
|
||||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||||
protected abstract void CreateTable(List<string> columns);
|
protected abstract void CreateTable(List<string> columns);
|
||||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||||
protected abstract void SavePdf(PdfInfoHeadwaiter info);
|
protected abstract void SavePdf(PdfInfoClient info);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ namespace BankBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
public abstract class AbstractSaveToWordHeadwaitre
|
public abstract class AbstractSaveToWordHeadwaitre
|
||||||
{
|
{
|
||||||
public void CreateDoc(WordInfoHeadwaiter info)
|
public void CreateDoc(WordInfoClient info)
|
||||||
{
|
{
|
||||||
CreateWord(info);
|
CreateWord(info);
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ namespace BankBusinessLogic.OfficePackage
|
|||||||
SaveWord(info);
|
SaveWord(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void CreateWord(WordInfoHeadwaiter info);
|
protected abstract void CreateWord(WordInfoClient info);
|
||||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||||
protected abstract void SaveWord(WordInfoHeadwaiter info);
|
protected abstract void SaveWord(WordInfoClient info);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage.HelperModels
|
namespace BankBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class ExcelInfoHeadwaiter
|
public class ExcelInfoClient
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage.HelperModels
|
namespace BankBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class PdfInfoHeadwaiter
|
public class PdfInfoClient
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage.HelperModels
|
namespace BankBusinessLogic.OfficePackage.HelperModels
|
||||||
{
|
{
|
||||||
public class WordInfoHeadwaiter
|
public class WordInfoClient
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage.Implements
|
namespace BankBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
public class SaveToExcelHeadwaiter : AbstractSaveToExcelHeadwaiter
|
public class SaveToExcelClient : AbstractSaveToExcelClient
|
||||||
{
|
{
|
||||||
private SpreadsheetDocument? _spreadsheetDocument;
|
private SpreadsheetDocument? _spreadsheetDocument;
|
||||||
private SharedStringTablePart? _shareStringPart;
|
private SharedStringTablePart? _shareStringPart;
|
||||||
@ -205,7 +205,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateExcel(ExcelInfoHeadwaiter info)
|
protected override void CreateExcel(ExcelInfoClient info)
|
||||||
{
|
{
|
||||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
||||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||||
@ -320,7 +320,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
|||||||
mergeCells.Append(mergeCell);
|
mergeCells.Append(mergeCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SaveExcel(ExcelInfoHeadwaiter info)
|
protected override void SaveExcel(ExcelInfoClient info)
|
||||||
{
|
{
|
||||||
if (_spreadsheetDocument == null)
|
if (_spreadsheetDocument == null)
|
||||||
{
|
{
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage.Implements
|
namespace BankBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
internal class SaveToPdfHeadwaiter : AbstractSaveToPdfHeadwaiter
|
internal class SaveToPdfClient : AbstractSaveToPdfClient
|
||||||
{
|
{
|
||||||
private Document? _document;
|
private Document? _document;
|
||||||
private Section? _section;
|
private Section? _section;
|
||||||
@ -46,7 +46,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
|||||||
paragraph.Style = pdfParagraph.Style;
|
paragraph.Style = pdfParagraph.Style;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreatePdf(PdfInfoHeadwaiter info)
|
protected override void CreatePdf(PdfInfoClient info)
|
||||||
{
|
{
|
||||||
_document = new Document();
|
_document = new Document();
|
||||||
DefineStyles(_document);
|
DefineStyles(_document);
|
||||||
@ -90,7 +90,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SavePdf(PdfInfoHeadwaiter info)
|
protected override void SavePdf(PdfInfoClient info)
|
||||||
{
|
{
|
||||||
var renderer = new PdfDocumentRenderer(true)
|
var renderer = new PdfDocumentRenderer(true)
|
||||||
{
|
{
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankBusinessLogic.OfficePackage.Implements
|
namespace BankBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
public class SaveToWordHeadwaiter : AbstractSaveToWordHeadwaitre
|
public class SaveToWordClient : AbstractSaveToWordHeadwaitre
|
||||||
{
|
{
|
||||||
private WordprocessingDocument? _wordDocument;
|
private WordprocessingDocument? _wordDocument;
|
||||||
private Body? _docBody;
|
private Body? _docBody;
|
||||||
@ -105,7 +105,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
|||||||
_docBody.AppendChild(docParagraph);
|
_docBody.AppendChild(docParagraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateWord(WordInfoHeadwaiter info)
|
protected override void CreateWord(WordInfoClient info)
|
||||||
{
|
{
|
||||||
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
||||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||||
@ -113,7 +113,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
|
|||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SaveWord(WordInfoHeadwaiter info)
|
protected override void SaveWord(WordInfoClient info)
|
||||||
{
|
{
|
||||||
if (_docBody == null || _wordDocument == null)
|
if (_docBody == null || _wordDocument == null)
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace BankContracts.BindingModels
|
namespace BankContracts.BindingModels
|
||||||
{
|
{
|
||||||
public class MealPlanBindingModel : IMealPlanModel
|
public class AdditionsBindingModel : IAdditionsModel
|
||||||
{
|
{
|
||||||
public string MealPlanName { get; set; } = string.Empty;
|
public string MealPlanName { get; set; } = string.Empty;
|
||||||
|
|
@ -4,15 +4,15 @@ namespace BankContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public class ClercBindingModel : IClercModel
|
public class ClercBindingModel : IClercModel
|
||||||
{
|
{
|
||||||
public string OrganiserFIO { get; set; } = string.Empty;
|
public string ClercFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string OrganiserPassword { get; set; } = string.Empty;
|
public string ClercPassword { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string OrganiserLogin { get; set; } = string.Empty;
|
public string ClercLogin { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string OrganiserEmail { get; set; } = string.Empty;
|
public string ClercEmail { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string OrganiserNumber { get; set; } = string.Empty;
|
public string ClercNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
19
Bank/BankContracts/BindingModels/ClientBindingModel.cs
Normal file
19
Bank/BankContracts/BindingModels/ClientBindingModel.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using BankDataModels.Models;
|
||||||
|
|
||||||
|
namespace BankContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class ClientBindingModel : IClientModel
|
||||||
|
{
|
||||||
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string ClientPassword { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string ClientLogin { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string ClientEmail { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string ClientNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,6 @@ namespace BankContracts.BindingModels
|
|||||||
public int ConferenceId { get; set; }
|
public int ConferenceId { get; set; }
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public Dictionary<int, IDinnerModel> ConferenceBookingDinners { get; set; }
|
public Dictionary<int, ICreditModel> ConferenceBookingDinners { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
Bank/BankContracts/BindingModels/CreditBindingModel.cs
Normal file
15
Bank/BankContracts/BindingModels/CreditBindingModel.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using BankDataModels.Models;
|
||||||
|
|
||||||
|
namespace BankContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class CreditBindingModel : ICreditModel
|
||||||
|
{
|
||||||
|
public string CreditName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public double CreditPrice { get; set; }
|
||||||
|
|
||||||
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +0,0 @@
|
|||||||
using BankDataModels.Models;
|
|
||||||
|
|
||||||
namespace BankContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class DinnerBindingModel : IDinnerModel
|
|
||||||
{
|
|
||||||
public string DinnerName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public double DinnerPrice { get; set; }
|
|
||||||
|
|
||||||
public int HeadwaiterId { get; set; }
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using BankDataModels.Models;
|
|
||||||
|
|
||||||
namespace BankContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class HeadwaiterBindingModel : IHeadwaiterModel
|
|
||||||
{
|
|
||||||
public string HeadwaiterFIO { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string HeadwaiterPassword { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string HeadwaiterLogin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string HeadwaiterEmail { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string HeadwaiterNumber { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,6 +15,6 @@ namespace BankContracts.BindingModels
|
|||||||
public int MealPlanId { get; set; }
|
public int MealPlanId { get; set; }
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public Dictionary<int, IDinnerModel> RoomDinners { get; set; }
|
public Dictionary<int, ICreditModel> RoomDinners { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BankContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IAdditionsLogic
|
||||||
|
{
|
||||||
|
List<AdditionsPlanViewModel>? ReadList(AdditionsSearchModel? model);
|
||||||
|
AdditionsPlanViewModel? ReadElement(AdditionsSearchModel model);
|
||||||
|
bool Create(AdditionsBindingModel model);
|
||||||
|
bool Update(AdditionsBindingModel model);
|
||||||
|
bool Delete(AdditionsBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
15
Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs
Normal file
15
Bank/BankContracts/BusinessLogicsContracts/IClientLogic.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BankContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IClientLogic
|
||||||
|
{
|
||||||
|
List<ClientViewModel>? ReadList(ClientSearchModel? model);
|
||||||
|
ClientViewModel? ReadElement(ClientSearchModel model);
|
||||||
|
bool Create(ClientBindingModel model);
|
||||||
|
bool Update(ClientBindingModel model);
|
||||||
|
bool Delete(ClientBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
16
Bank/BankContracts/BusinessLogicsContracts/ICreditLogic.cs
Normal file
16
Bank/BankContracts/BusinessLogicsContracts/ICreditLogic.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BankContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface ICreditLogic
|
||||||
|
{
|
||||||
|
List<CreditViewModel>? ReadList(CreditSearchModel? model);
|
||||||
|
CreditViewModel? ReadElement(CreditSearchModel model);
|
||||||
|
bool Create(CreditBindingModel model);
|
||||||
|
bool Update(CreditBindingModel model);
|
||||||
|
bool Delete(CreditBindingModel model);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
using BankContracts.BindingModels;
|
|
||||||
using BankContracts.SearchModels;
|
|
||||||
using BankContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace BankContracts.BusinessLogicsContracts
|
|
||||||
{
|
|
||||||
public interface IDinnerLogic
|
|
||||||
{
|
|
||||||
List<DinnerViewModel>? ReadList(DinnerSearchModel? model);
|
|
||||||
DinnerViewModel? ReadElement(DinnerSearchModel model);
|
|
||||||
bool Create(DinnerBindingModel model);
|
|
||||||
bool Update(DinnerBindingModel model);
|
|
||||||
bool Delete(DinnerBindingModel model);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using BankContracts.BindingModels;
|
|
||||||
using BankContracts.SearchModels;
|
|
||||||
using BankContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace BankContracts.BusinessLogicsContracts
|
|
||||||
{
|
|
||||||
public interface IHeadwaiterLogic
|
|
||||||
{
|
|
||||||
List<HeadwaiterViewModel>? ReadList(HeadwaiterSearchModel? model);
|
|
||||||
HeadwaiterViewModel? ReadElement(HeadwaiterSearchModel model);
|
|
||||||
bool Create(HeadwaiterBindingModel model);
|
|
||||||
bool Update(HeadwaiterBindingModel model);
|
|
||||||
bool Delete(HeadwaiterBindingModel model);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using BankContracts.BindingModels;
|
|
||||||
using BankContracts.SearchModels;
|
|
||||||
using BankContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace BankContracts.BusinessLogicsContracts
|
|
||||||
{
|
|
||||||
public interface IMealPlanLogic
|
|
||||||
{
|
|
||||||
List<MealPlanViewModel>? ReadList(MealPlanSearchModel? model);
|
|
||||||
MealPlanViewModel? ReadElement(MealPlanSearchModel model);
|
|
||||||
bool Create(MealPlanBindingModel model);
|
|
||||||
bool Update(MealPlanBindingModel model);
|
|
||||||
bool Delete(MealPlanBindingModel model);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
namespace BankContracts.SearchModels
|
namespace BankContracts.SearchModels
|
||||||
{
|
{
|
||||||
public class MealPlanSearchModel
|
public class AdditionsSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? MealPlanName { get; set; }
|
public string? AdditionsName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,8 +3,8 @@
|
|||||||
public class ClercSearchModel
|
public class ClercSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? OrganiserFIO { get; set; }
|
public string? ClercFIO { get; set; }
|
||||||
public string? OrganiserLogin { get; set; }
|
public string? ClercLogin { get; set; }
|
||||||
public string? OrganiserPassword { get; set; }
|
public string? ClercPassword { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
Bank/BankContracts/SearchModels/ClientSearchModel.cs
Normal file
13
Bank/BankContracts/SearchModels/ClientSearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
namespace BankContracts.SearchModels
|
||||||
|
{
|
||||||
|
public class ClientSearchModel
|
||||||
|
{
|
||||||
|
public string? ClientFIO { get; set; }
|
||||||
|
|
||||||
|
public string? ClientPassword { get; set; }
|
||||||
|
|
||||||
|
public string? ClientLogin { get; set; }
|
||||||
|
public int? Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
namespace BankContracts.SearchModels
|
namespace BankContracts.SearchModels
|
||||||
{
|
{
|
||||||
public class DinnerSearchModel
|
public class CreditSearchModel
|
||||||
{
|
{
|
||||||
public string? DinnerName { get; set; }
|
public string? CreditName { get; set; }
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
namespace BankContracts.SearchModels
|
|
||||||
{
|
|
||||||
public class HeadwaiterSearchModel
|
|
||||||
{
|
|
||||||
public string? HeadwaiterFIO { get; set; }
|
|
||||||
|
|
||||||
public string? HeadwaiterPassword { get; set; }
|
|
||||||
|
|
||||||
public string? HeadwaiterLogin { get; set; }
|
|
||||||
public int? Id { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,21 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BankContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IAdditionsPlanStorage
|
||||||
|
{
|
||||||
|
List<AdditionsPlanViewModel> GetFullList();
|
||||||
|
|
||||||
|
List<AdditionsPlanViewModel> GetFilteredList(AdditionsSearchModel model);
|
||||||
|
|
||||||
|
AdditionsPlanViewModel? GetElement(AdditionsSearchModel model);
|
||||||
|
|
||||||
|
AdditionsPlanViewModel? Insert(AdditionsBindingModel model);
|
||||||
|
|
||||||
|
AdditionsPlanViewModel? Update(AdditionsBindingModel model);
|
||||||
|
|
||||||
|
AdditionsPlanViewModel? Delete(AdditionsBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
21
Bank/BankContracts/StoragesContracts/IClientStorage.cs
Normal file
21
Bank/BankContracts/StoragesContracts/IClientStorage.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BankContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IClientStorage
|
||||||
|
{
|
||||||
|
List<ClientViewModel> GetFullList();
|
||||||
|
|
||||||
|
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
|
||||||
|
|
||||||
|
ClientViewModel? GetElement(ClientSearchModel model);
|
||||||
|
|
||||||
|
ClientViewModel? Insert(ClientBindingModel model);
|
||||||
|
|
||||||
|
ClientViewModel? Update(ClientBindingModel model);
|
||||||
|
|
||||||
|
ClientViewModel? Delete(ClientBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
21
Bank/BankContracts/StoragesContracts/ICreditStorage.cs
Normal file
21
Bank/BankContracts/StoragesContracts/ICreditStorage.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.SearchModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
|
||||||
|
namespace BankContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface ICreditStorage
|
||||||
|
{
|
||||||
|
List<CreditViewModel> GetFullList();
|
||||||
|
|
||||||
|
List<CreditViewModel> GetFilteredList(CreditSearchModel model);
|
||||||
|
|
||||||
|
CreditViewModel? GetElement(CreditSearchModel model);
|
||||||
|
|
||||||
|
CreditViewModel? Insert(CreditBindingModel model);
|
||||||
|
|
||||||
|
CreditViewModel? Update(CreditBindingModel model);
|
||||||
|
|
||||||
|
CreditViewModel? Delete(CreditBindingModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +0,0 @@
|
|||||||
using BankContracts.BindingModels;
|
|
||||||
using BankContracts.SearchModels;
|
|
||||||
using BankContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace BankContracts.StoragesContracts
|
|
||||||
{
|
|
||||||
public interface IDinnerStorage
|
|
||||||
{
|
|
||||||
List<DinnerViewModel> GetFullList();
|
|
||||||
|
|
||||||
List<DinnerViewModel> GetFilteredList(DinnerSearchModel model);
|
|
||||||
|
|
||||||
DinnerViewModel? GetElement(DinnerSearchModel model);
|
|
||||||
|
|
||||||
DinnerViewModel? Insert(DinnerBindingModel model);
|
|
||||||
|
|
||||||
DinnerViewModel? Update(DinnerBindingModel model);
|
|
||||||
|
|
||||||
DinnerViewModel? Delete(DinnerBindingModel model);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
using BankContracts.BindingModels;
|
|
||||||
using BankContracts.SearchModels;
|
|
||||||
using BankContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace BankContracts.StoragesContracts
|
|
||||||
{
|
|
||||||
public interface IHeadwaiterStorage
|
|
||||||
{
|
|
||||||
List<HeadwaiterViewModel> GetFullList();
|
|
||||||
|
|
||||||
List<HeadwaiterViewModel> GetFilteredList(HeadwaiterSearchModel model);
|
|
||||||
|
|
||||||
HeadwaiterViewModel? GetElement(HeadwaiterSearchModel model);
|
|
||||||
|
|
||||||
HeadwaiterViewModel? Insert(HeadwaiterBindingModel model);
|
|
||||||
|
|
||||||
HeadwaiterViewModel? Update(HeadwaiterBindingModel model);
|
|
||||||
|
|
||||||
HeadwaiterViewModel? Delete(HeadwaiterBindingModel model);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
using BankContracts.BindingModels;
|
|
||||||
using BankContracts.SearchModels;
|
|
||||||
using BankContracts.ViewModels;
|
|
||||||
|
|
||||||
namespace BankContracts.StoragesContracts
|
|
||||||
{
|
|
||||||
public interface IMealPlanStorage
|
|
||||||
{
|
|
||||||
List<MealPlanViewModel> GetFullList();
|
|
||||||
|
|
||||||
List<MealPlanViewModel> GetFilteredList(MealPlanSearchModel model);
|
|
||||||
|
|
||||||
MealPlanViewModel? GetElement(MealPlanSearchModel model);
|
|
||||||
|
|
||||||
MealPlanViewModel? Insert(MealPlanBindingModel model);
|
|
||||||
|
|
||||||
MealPlanViewModel? Update(MealPlanBindingModel model);
|
|
||||||
|
|
||||||
MealPlanViewModel? Delete(MealPlanBindingModel model);
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,7 @@ using System.ComponentModel;
|
|||||||
|
|
||||||
namespace BankContracts.ViewModels
|
namespace BankContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class MealPlanViewModel : IMealPlanModel
|
public class AdditionsPlanViewModel : IAdditionsModel
|
||||||
{
|
{
|
||||||
[DisplayName("Название плана питания")]
|
[DisplayName("Название плана питания")]
|
||||||
public string MealPlanName { get; set; } = string.Empty;
|
public string MealPlanName { get; set; } = string.Empty;
|
@ -6,19 +6,19 @@ namespace BankContracts.ViewModels
|
|||||||
public class ClercViewModel : IClercModel
|
public class ClercViewModel : IClercModel
|
||||||
{
|
{
|
||||||
[DisplayName("ФИО организатора")]
|
[DisplayName("ФИО организатора")]
|
||||||
public string OrganiserFIO { get; set; } = string.Empty;
|
public string ClercFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Пароль организатора")]
|
[DisplayName("Пароль организатора")]
|
||||||
public string OrganiserPassword { get; set; } = string.Empty;
|
public string ClercPassword { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Логин организатора")]
|
[DisplayName("Логин организатора")]
|
||||||
public string OrganiserLogin { get; set; } = string.Empty;
|
public string ClercLogin { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Эл. почта организатора")]
|
[DisplayName("Эл. почта организатора")]
|
||||||
public string OrganiserEmail { get; set; } = string.Empty;
|
public string ClercEmail { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Номер телефона организатора")]
|
[DisplayName("Номер телефона организатора")]
|
||||||
public string OrganiserNumber { get; set; } = string.Empty;
|
public string ClercNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -8,24 +8,24 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankContracts.ViewModels
|
namespace BankContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class HeadwaiterViewModel : IHeadwaiterModel
|
public class ClientViewModel : IClientModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[DisplayName("ФИО метрдотеля")]
|
[DisplayName("ФИО метрдотеля")]
|
||||||
public string HeadwaiterFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Пароль метрдотеля")]
|
[DisplayName("Пароль метрдотеля")]
|
||||||
public string HeadwaiterPassword { get; set; } = string.Empty;
|
public string ClientPassword { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Логин метрдотеля")]
|
[DisplayName("Логин метрдотеля")]
|
||||||
public string HeadwaiterLogin { get; set; } = string.Empty;
|
public string ClientLogin { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Mail метрдотеля")]
|
[DisplayName("Mail метрдотеля")]
|
||||||
public string HeadwaiterEmail { get; set; } = string.Empty;
|
public string ClientEmail { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Телефон метрдотеля")]
|
[DisplayName("Телефон метрдотеля")]
|
||||||
public string HeadwaiterNumber { get; set; } = string.Empty;
|
public string ClientNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@ namespace BankContracts.ViewModels
|
|||||||
public int ConferenceId { get; set; }
|
public int ConferenceId { get; set; }
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public Dictionary<int, IDinnerModel> ConferenceBookingDinners { get; set; }
|
public Dictionary<int, ICreditModel> ConferenceBookingDinners { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,16 @@ using System.ComponentModel;
|
|||||||
|
|
||||||
namespace BankContracts.ViewModels
|
namespace BankContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class DinnerViewModel : IDinnerModel
|
public class CreditViewModel : ICreditModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int HeadwaiterId { get; set; }
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
[DisplayName("Название обеда")]
|
[DisplayName("Название обеда")]
|
||||||
public string DinnerName { get; set; } = string.Empty;
|
public string CreditName { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Цена обеда")]
|
[DisplayName("Цена обеда")]
|
||||||
public double DinnerPrice { get; set; }
|
public double CreditPrice { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ namespace BankContracts.ViewModels
|
|||||||
|
|
||||||
[DisplayName("Стоимость комнаты")]
|
[DisplayName("Стоимость комнаты")]
|
||||||
public double RoomPrice { get; set; }
|
public double RoomPrice { get; set; }
|
||||||
public Dictionary<int, IDinnerModel> RoomDinners { get; set; }
|
public Dictionary<int, ICreditModel> RoomDinners { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,15 @@ namespace BankDataBaseImplement
|
|||||||
}
|
}
|
||||||
public virtual DbSet<Conference> Conferences { set; get; }
|
public virtual DbSet<Conference> Conferences { set; get; }
|
||||||
public virtual DbSet<Room> Rooms { set; get; }
|
public virtual DbSet<Room> Rooms { set; get; }
|
||||||
public virtual DbSet<MealPlan> MealPlans { set; get; }
|
public virtual DbSet<Additions> Additions { set; get; }
|
||||||
public virtual DbSet<ConferenceBooking> ConferenceBookings { set; get; }
|
public virtual DbSet<ConferenceBooking> ConferenceBookings { set; get; }
|
||||||
public virtual DbSet<Member> Members { set; get; }
|
public virtual DbSet<Member> Members { set; get; }
|
||||||
public virtual DbSet<Dinner> Dinners { set; get; }
|
public virtual DbSet<Credit> Credits { set; get; }
|
||||||
public virtual DbSet<Clerc> Organisers { set; get; }
|
public virtual DbSet<Clerc> Clercs { set; get; }
|
||||||
public virtual DbSet<Headwaiter> Headwaiters { set; get; }
|
public virtual DbSet<Client> Clients { set; get; }
|
||||||
public virtual DbSet<ConferenceMember> ConferenceMembers { set; get; }
|
public virtual DbSet<ConferenceMember> ConferenceMembers { set; get; }
|
||||||
public virtual DbSet<RoomDinner> RoomDinners { set; get; }
|
public virtual DbSet<RoomCredit> RoomCredits { set; get; }
|
||||||
public virtual DbSet<MealPlanMember> MealPlanMembers { set; get; }
|
public virtual DbSet<AdditionsMember> MealPlanMembers { set; get; }
|
||||||
public virtual DbSet<ConferenceBookingDinner> ConferenceBookingDinners { set; get; }
|
public virtual DbSet<ConferenceBookingDinner> ConferenceBookingDinners { set; get; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,18 +7,18 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Implemets
|
namespace BankDataBaseImplement.Implemets
|
||||||
{
|
{
|
||||||
public class MealPlanStorage : IMealPlanStorage
|
public class AdditionsStorage : IAdditionsPlanStorage
|
||||||
{
|
{
|
||||||
public MealPlanViewModel? Delete(MealPlanBindingModel model)
|
public AdditionsPlanViewModel? Delete(AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
var element = context.MealPlans
|
var element = context.Additions
|
||||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
context.MealPlans.Remove(element);
|
context.Additions.Remove(element);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
return element.GetViewModel;
|
return element.GetViewModel;
|
||||||
@ -27,7 +27,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MealPlanViewModel? GetElement(MealPlanSearchModel model)
|
public AdditionsPlanViewModel? GetElement(AdditionsSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue)
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
|
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
return context.MealPlans
|
return context.Additions
|
||||||
.Include(x => x.Members)
|
.Include(x => x.Members)
|
||||||
.ThenInclude(x => x.Member)
|
.ThenInclude(x => x.Member)
|
||||||
.ThenInclude(x => x.ConferenceMember)
|
.ThenInclude(x => x.ConferenceMember)
|
||||||
@ -47,31 +47,31 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MealPlanViewModel> GetFilteredList(MealPlanSearchModel model)
|
public List<AdditionsPlanViewModel> GetFilteredList(AdditionsSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.MealPlanName))
|
if (string.IsNullOrEmpty(model.AdditionsName))
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
return context.MealPlans
|
return context.Additions
|
||||||
.Include(x => x.Members)
|
.Include(x => x.Members)
|
||||||
.ThenInclude(x => x.Member)
|
.ThenInclude(x => x.Member)
|
||||||
.ThenInclude(x => x.ConferenceMember)
|
.ThenInclude(x => x.ConferenceMember)
|
||||||
.ThenInclude(x => x.Conference)
|
.ThenInclude(x => x.Conference)
|
||||||
.Include(x => x.Rooms)
|
.Include(x => x.Rooms)
|
||||||
.Include(x => x.Organiser)
|
.Include(x => x.Organiser)
|
||||||
.Where(x => x.MealPlanName.Contains(model.MealPlanName))
|
.Where(x => x.MealPlanName.Contains(model.AdditionsName))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MealPlanViewModel> GetFullList()
|
public List<AdditionsPlanViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
return context.MealPlans
|
return context.Additions
|
||||||
.Include(x => x.Members)
|
.Include(x => x.Members)
|
||||||
.ThenInclude(x => x.Member)
|
.ThenInclude(x => x.Member)
|
||||||
.ThenInclude(x => x.ConferenceMember)
|
.ThenInclude(x => x.ConferenceMember)
|
||||||
@ -82,25 +82,25 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MealPlanViewModel? Insert(MealPlanBindingModel model)
|
public AdditionsPlanViewModel? Insert(AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
var newMealPlan = MealPlan.Create(context,model);
|
var newMealPlan = Additions.Create(context,model);
|
||||||
|
|
||||||
if (newMealPlan == null)
|
if (newMealPlan == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.MealPlans.Add(newMealPlan);
|
context.Additions.Add(newMealPlan);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return newMealPlan.GetViewModel;
|
return newMealPlan.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MealPlanViewModel? Update(MealPlanBindingModel model)
|
public AdditionsPlanViewModel? Update(AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
var mealPlan = context.MealPlans.FirstOrDefault(x => x.Id == model.Id);
|
var mealPlan = context.Additions.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (mealPlan == null)
|
if (mealPlan == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
@ -7,17 +7,17 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Implemets
|
namespace BankDataBaseImplement.Implemets
|
||||||
{
|
{
|
||||||
public class OrganiserStorage : IClercStorage
|
public class ClercStorage : IClercStorage
|
||||||
{
|
{
|
||||||
public ClercViewModel? Delete(ClercBindingModel model)
|
public ClercViewModel? Delete(ClercBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
var element = context.Organisers.FirstOrDefault(rec => rec.Id == model.Id);
|
var element = context.Clercs.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
context.Organisers.Remove(element);
|
context.Clercs.Remove(element);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
return element.GetViewModel;
|
return element.GetViewModel;
|
||||||
@ -31,27 +31,27 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
if (model.Id.HasValue)
|
if (model.Id.HasValue)
|
||||||
return context.Organisers
|
return context.Clercs
|
||||||
.Include(x => x.MealPlans)
|
.Include(x => x.Additions)
|
||||||
.Include(x => x.Members)
|
.Include(x => x.Members)
|
||||||
.Include(x => x.Conferences)
|
.Include(x => x.Conferences)
|
||||||
.FirstOrDefault(x => x.Id == model.Id)?
|
.FirstOrDefault(x => x.Id == model.Id)?
|
||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.OrganiserLogin) && !string.IsNullOrEmpty(model.OrganiserPassword))
|
if (!string.IsNullOrEmpty(model.ClercLogin) && !string.IsNullOrEmpty(model.ClercPassword))
|
||||||
return context.Organisers
|
return context.Clercs
|
||||||
.Include(x => x.MealPlans)
|
.Include(x => x.Additions)
|
||||||
.Include(x => x.Members)
|
.Include(x => x.Members)
|
||||||
.Include(x => x.Conferences)
|
.Include(x => x.Conferences)
|
||||||
.FirstOrDefault(x => x.OrganiserLogin.Equals(model.OrganiserLogin) && x.OrganiserPassword.Equals(model.OrganiserPassword))?
|
.FirstOrDefault(x => x.ClercLogin.Equals(model.ClercLogin) && x.ClercPassword.Equals(model.ClercPassword))?
|
||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.OrganiserLogin))
|
if (!string.IsNullOrEmpty(model.ClercLogin))
|
||||||
return context.Organisers
|
return context.Clercs
|
||||||
.Include(x => x.MealPlans)
|
.Include(x => x.Additions)
|
||||||
.Include(x => x.Members)
|
.Include(x => x.Members)
|
||||||
.Include(x => x.Conferences)
|
.Include(x => x.Conferences)
|
||||||
.FirstOrDefault(x => x.OrganiserLogin.Equals(model.OrganiserLogin))?
|
.FirstOrDefault(x => x.ClercLogin.Equals(model.ClercLogin))?
|
||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -59,18 +59,18 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
|
|
||||||
public List<ClercViewModel> GetFilteredList(ClercSearchModel model)
|
public List<ClercViewModel> GetFilteredList(ClercSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.OrganiserFIO))
|
if (string.IsNullOrEmpty(model.ClercFIO))
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
return context.Organisers
|
return context.Clercs
|
||||||
.Include(x => x.MealPlans)
|
.Include(x => x.Additions)
|
||||||
.Include(x => x.Members)
|
.Include(x => x.Members)
|
||||||
.Include(x => x.Conferences)
|
.Include(x => x.Conferences)
|
||||||
.Where(x => x.OrganiserLogin.Contains(model.OrganiserLogin) && x.OrganiserPassword == model.OrganiserPassword)
|
.Where(x => x.ClercLogin.Contains(model.ClercLogin) && x.ClercPassword == model.ClercPassword)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
return context.Organisers
|
return context.Clercs
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
|
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
context.Organisers.Add(newOrganiser);
|
context.Clercs.Add(newOrganiser);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
return newOrganiser.GetViewModel;
|
return newOrganiser.GetViewModel;
|
||||||
@ -105,7 +105,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
var organiser = context.Organisers
|
var organiser = context.Clercs
|
||||||
.FirstOrDefault(x => x.Id == model.Id);
|
.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
|
||||||
if (organiser == null)
|
if (organiser == null)
|
@ -12,17 +12,17 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Implemets
|
namespace BankDataBaseImplement.Implemets
|
||||||
{
|
{
|
||||||
public class HeadwaiterStorage : IHeadwaiterStorage
|
public class ClientStorage : IClientStorage
|
||||||
{
|
{
|
||||||
public HeadwaiterViewModel? Delete(HeadwaiterBindingModel model)
|
public ClientViewModel? Delete(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
var element = context.Headwaiters.FirstOrDefault(rec => rec.Id == model.Id);
|
var element = context.Clients.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
|
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
context.Headwaiters.Remove(element);
|
context.Clients.Remove(element);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
return element.GetViewModel;
|
return element.GetViewModel;
|
||||||
@ -31,67 +31,67 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeadwaiterViewModel? GetElement(HeadwaiterSearchModel model)
|
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
if (model.Id.HasValue)
|
if (model.Id.HasValue)
|
||||||
return context.Headwaiters
|
return context.Clients
|
||||||
.Include(x => x.ConferenceBookings)
|
.Include(x => x.ConferenceBookings)
|
||||||
.Include(x => x.Dinners)
|
.Include(x => x.Dinners)
|
||||||
.Include(x => x.Rooms)
|
.Include(x => x.Rooms)
|
||||||
.FirstOrDefault(x => x.Id == model.Id)?
|
.FirstOrDefault(x => x.Id == model.Id)?
|
||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.HeadwaiterLogin) && !string.IsNullOrEmpty(model.HeadwaiterPassword))
|
if (!string.IsNullOrEmpty(model.ClientLogin) && !string.IsNullOrEmpty(model.ClientPassword))
|
||||||
return context.Headwaiters
|
return context.Clients
|
||||||
.Include(x => x.ConferenceBookings)
|
.Include(x => x.ConferenceBookings)
|
||||||
.Include(x => x.Dinners)
|
.Include(x => x.Dinners)
|
||||||
.Include(x => x.Rooms)
|
.Include(x => x.Rooms)
|
||||||
.FirstOrDefault(x => x.HeadwaiterLogin.Equals(model.HeadwaiterLogin) && x.HeadwaiterPassword.Equals(model.HeadwaiterPassword))?
|
.FirstOrDefault(x => x.ClientLogin.Equals(model.ClientLogin) && x.ClientPassword.Equals(model.ClientPassword))?
|
||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.HeadwaiterLogin))
|
if (!string.IsNullOrEmpty(model.ClientLogin))
|
||||||
return context.Headwaiters
|
return context.Clients
|
||||||
.Include(x => x.ConferenceBookings)
|
.Include(x => x.ConferenceBookings)
|
||||||
.Include(x => x.Dinners)
|
.Include(x => x.Dinners)
|
||||||
.Include(x => x.Rooms)
|
.Include(x => x.Rooms)
|
||||||
.FirstOrDefault(x => x.HeadwaiterLogin.Equals(model.HeadwaiterLogin))?
|
.FirstOrDefault(x => x.ClientLogin.Equals(model.ClientLogin))?
|
||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HeadwaiterViewModel> GetFilteredList(HeadwaiterSearchModel model)
|
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.HeadwaiterFIO))
|
if (string.IsNullOrEmpty(model.ClientFIO))
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
return context.Headwaiters
|
return context.Clients
|
||||||
.Include(x => x.ConferenceBookings)
|
.Include(x => x.ConferenceBookings)
|
||||||
.Include(x => x.Dinners)
|
.Include(x => x.Dinners)
|
||||||
.Include(x => x.Rooms)
|
.Include(x => x.Rooms)
|
||||||
.Where(x => x.HeadwaiterLogin.Contains(model.HeadwaiterLogin) && x.HeadwaiterPassword == model.HeadwaiterPassword)
|
.Where(x => x.ClientLogin.Contains(model.ClientLogin) && x.ClientPassword == model.ClientPassword)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HeadwaiterViewModel> GetFullList()
|
public List<ClientViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
return context.Headwaiters
|
return context.Clients
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeadwaiterViewModel? Insert(HeadwaiterBindingModel model)
|
public ClientViewModel? Insert(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
var newHeadwaiter = Headwaiter.Create(model);
|
var newHeadwaiter = Client.Create(model);
|
||||||
|
|
||||||
if (newHeadwaiter == null)
|
if (newHeadwaiter == null)
|
||||||
{
|
{
|
||||||
@ -100,17 +100,17 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
|
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
context.Headwaiters.Add(newHeadwaiter);
|
context.Clients.Add(newHeadwaiter);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
return newHeadwaiter.GetViewModel;
|
return newHeadwaiter.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeadwaiterViewModel? Update(HeadwaiterBindingModel model)
|
public ClientViewModel? Update(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
var headwaiter = context.Headwaiters
|
var headwaiter = context.Clients
|
||||||
.FirstOrDefault(x => x.Id == model.Id);
|
.FirstOrDefault(x => x.Id == model.Id);
|
||||||
|
|
||||||
if (headwaiter == null)
|
if (headwaiter == null)
|
@ -12,9 +12,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Implemets
|
namespace BankDataBaseImplement.Implemets
|
||||||
{
|
{
|
||||||
public class DinnerStorage : IDinnerStorage
|
public class CreditStorage : ICreditStorage
|
||||||
{
|
{
|
||||||
public DinnerViewModel? Delete(DinnerBindingModel model)
|
public CreditViewModel? Delete(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DinnerViewModel? GetElement(DinnerSearchModel model)
|
public CreditViewModel? GetElement(CreditSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.DinnerName) && !model.Id.HasValue)
|
if (string.IsNullOrEmpty(model.DinnerName) && !model.Id.HasValue)
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
.GetViewModel;
|
.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DinnerViewModel> GetFilteredList(DinnerSearchModel model)
|
public List<CreditViewModel> GetFilteredList(CreditSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.DinnerName))
|
if (string.IsNullOrEmpty(model.DinnerName))
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DinnerViewModel> GetFullList()
|
public List<CreditViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
@ -83,11 +83,11 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DinnerViewModel? Insert(DinnerBindingModel model)
|
public CreditViewModel? Insert(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
||||||
var newDinner = Dinner.Create(model);
|
var newDinner = Credit.Create(model);
|
||||||
|
|
||||||
if (newDinner == null)
|
if (newDinner == null)
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ namespace BankDataBaseImplement.Implemets
|
|||||||
return newDinner.GetViewModel;
|
return newDinner.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DinnerViewModel? Update(DinnerBindingModel model)
|
public CreditViewModel? Update(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new BankDataBase();
|
using var context = new BankDataBase();
|
||||||
|
|
@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Models
|
namespace BankDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
public class MealPlan : IMealPlanModel
|
public class Additions : IAdditionsModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string MealPlanName { get; set; } = string.Empty;
|
public string MealPlanName { get; set; } = string.Empty;
|
||||||
@ -24,7 +24,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
public virtual List<Room> Rooms { get; set; }
|
public virtual List<Room> Rooms { get; set; }
|
||||||
|
|
||||||
[ForeignKey("MealPlanId")]
|
[ForeignKey("MealPlanId")]
|
||||||
public virtual List<MealPlanMember> Members { get; set; }
|
public virtual List<AdditionsMember> Members { get; set; }
|
||||||
|
|
||||||
private Dictionary<int, IMemberModel> _mealPlanMembers = null;
|
private Dictionary<int, IMemberModel> _mealPlanMembers = null;
|
||||||
|
|
||||||
@ -39,27 +39,27 @@ namespace BankDataBaseImplement.Models
|
|||||||
return _mealPlanMembers;
|
return _mealPlanMembers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static MealPlan Create(BankDataBase context, MealPlanBindingModel model)
|
public static Additions Create(BankDataBase context, AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
return new MealPlan()
|
return new Additions()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
MealPlanName = model.MealPlanName,
|
MealPlanName = model.MealPlanName,
|
||||||
MealPlanPrice = model.MealPlanPrice,
|
MealPlanPrice = model.MealPlanPrice,
|
||||||
Members = model.MealPlanMembers.Select(x => new MealPlanMember
|
Members = model.MealPlanMembers.Select(x => new AdditionsMember
|
||||||
{
|
{
|
||||||
Member = context.Members.First(y => y.Id == x.Key),
|
Member = context.Members.First(y => y.Id == x.Key),
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(MealPlanBindingModel model)
|
public void Update(AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
MealPlanName = model.MealPlanName;
|
MealPlanName = model.MealPlanName;
|
||||||
MealPlanPrice = model.MealPlanPrice;
|
MealPlanPrice = model.MealPlanPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MealPlanViewModel GetViewModel => new()
|
public AdditionsPlanViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
MealPlanName = MealPlanName,
|
MealPlanName = MealPlanName,
|
||||||
@ -67,7 +67,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
MealPlanMembers = MealPlanMembers
|
MealPlanMembers = MealPlanMembers
|
||||||
};
|
};
|
||||||
|
|
||||||
public void UpdateMembers(BankDataBase context, MealPlanBindingModel model)
|
public void UpdateMembers(BankDataBase context, AdditionsBindingModel model)
|
||||||
{
|
{
|
||||||
var mealPlanMembers = context.MealPlanMembers.Where(rec => rec.MealPlanId == model.Id).ToList();
|
var mealPlanMembers = context.MealPlanMembers.Where(rec => rec.MealPlanId == model.Id).ToList();
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
|
|
||||||
foreach (var cm in model.MealPlanMembers)
|
foreach (var cm in model.MealPlanMembers)
|
||||||
{
|
{
|
||||||
context.MealPlanMembers.Add(new MealPlanMember
|
context.MealPlanMembers.Add(new AdditionsMember
|
||||||
{
|
{
|
||||||
MealPlan = mealPlan,
|
MealPlan = mealPlan,
|
||||||
Member = context.Members.First(x => x.Id == cm.Key)
|
Member = context.Members.First(x => x.Id == cm.Key)
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Models
|
namespace BankDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
public class MealPlanMember
|
public class AdditionsMember
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int MealPlanId { get; set; }
|
public int MealPlanId { get; set; }
|
||||||
|
|
||||||
public virtual MealPlan MealPlan { get; set; }
|
public virtual Additions MealPlan { get; set; }
|
||||||
public virtual Member Member { get; set; }
|
public virtual Member Member { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,22 +9,22 @@ namespace BankDataBaseImplement.Models
|
|||||||
public class Clerc : IClercModel
|
public class Clerc : IClercModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string OrganiserFIO { get; set; } = string.Empty;
|
public string ClercFIO { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public string OrganiserPassword { get; set; } = string.Empty;
|
public string ClercPassword { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public string OrganiserLogin { get; set; } = string.Empty;
|
public string ClercLogin { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public string OrganiserEmail { get; set; } = string.Empty;
|
public string ClercEmail { get; set; } = string.Empty;
|
||||||
[Required]
|
[Required]
|
||||||
public string OrganiserNumber { get; set; } = string.Empty;
|
public string ClercNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
[ForeignKey("OrganiserId")]
|
[ForeignKey("OrganiserId")]
|
||||||
public virtual List<Conference> Conferences { get; set; } = new();
|
public virtual List<Conference> Conferences { get; set; } = new();
|
||||||
[ForeignKey("OrganiserId")]
|
[ForeignKey("OrganiserId")]
|
||||||
public virtual List<MealPlan> MealPlans { get; set; } = new();
|
public virtual List<Additions> Additions { get; set; } = new();
|
||||||
[ForeignKey("OrganiserId")]
|
[ForeignKey("OrganiserId")]
|
||||||
public virtual List<Member> Members { get; set; } = new();
|
public virtual List<Member> Members { get; set; } = new();
|
||||||
|
|
||||||
@ -37,11 +37,11 @@ namespace BankDataBaseImplement.Models
|
|||||||
return new Clerc()
|
return new Clerc()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
OrganiserFIO = model.OrganiserFIO,
|
ClercFIO = model.ClercFIO,
|
||||||
OrganiserEmail = model.OrganiserEmail,
|
ClercEmail = model.ClercEmail,
|
||||||
OrganiserPassword = model.OrganiserPassword,
|
ClercPassword = model.ClercPassword,
|
||||||
OrganiserLogin = model.OrganiserLogin,
|
ClercLogin = model.ClercLogin,
|
||||||
OrganiserNumber = model.OrganiserNumber
|
ClercNumber = model.ClercNumber
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static Clerc Create(ClercViewModel model)
|
public static Clerc Create(ClercViewModel model)
|
||||||
@ -49,11 +49,11 @@ namespace BankDataBaseImplement.Models
|
|||||||
return new Clerc
|
return new Clerc
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
OrganiserFIO = model.OrganiserFIO,
|
ClercFIO = model.ClercFIO,
|
||||||
OrganiserEmail = model.OrganiserEmail,
|
ClercEmail = model.ClercEmail,
|
||||||
OrganiserPassword = model.OrganiserPassword,
|
ClercPassword = model.ClercPassword,
|
||||||
OrganiserLogin= model.OrganiserLogin,
|
ClercLogin = model.ClercLogin,
|
||||||
OrganiserNumber= model.OrganiserNumber
|
ClercNumber = model.ClercNumber
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(ClercBindingModel model)
|
public void Update(ClercBindingModel model)
|
||||||
@ -62,20 +62,20 @@ namespace BankDataBaseImplement.Models
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OrganiserFIO = model.OrganiserFIO;
|
ClercFIO = model.ClercFIO;
|
||||||
OrganiserEmail = model.OrganiserEmail;
|
ClercEmail = model.ClercEmail;
|
||||||
OrganiserPassword = model.OrganiserPassword;
|
ClercPassword = model.ClercPassword;
|
||||||
OrganiserLogin = model.OrganiserLogin;
|
ClercLogin = model.ClercLogin;
|
||||||
OrganiserNumber = model.OrganiserNumber;
|
ClercNumber = model.ClercNumber;
|
||||||
}
|
}
|
||||||
public ClercViewModel GetViewModel => new()
|
public ClercViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
OrganiserFIO = OrganiserFIO,
|
ClercFIO = ClercFIO,
|
||||||
OrganiserEmail = OrganiserEmail,
|
ClercEmail = ClercEmail,
|
||||||
OrganiserPassword = OrganiserPassword,
|
ClercPassword = ClercPassword,
|
||||||
OrganiserNumber = OrganiserNumber,
|
ClercNumber = ClercNumber,
|
||||||
OrganiserLogin = OrganiserLogin
|
ClercLogin = ClercLogin
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
93
Bank/BankDataBaseImplement/Models/Client.cs
Normal file
93
Bank/BankDataBaseImplement/Models/Client.cs
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
using BankContracts.BindingModels;
|
||||||
|
using BankContracts.ViewModels;
|
||||||
|
using BankDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BankDataBaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Client : IClientModel
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ClientEmail { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ClientPassword { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ClientLogin { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string ClientNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
[ForeignKey("HeadwaiterId")]
|
||||||
|
public virtual List<Room> Rooms { get; set; } = new();
|
||||||
|
|
||||||
|
[ForeignKey("HeadwaiterId")]
|
||||||
|
public virtual List<Credit> Dinners { get; set; } = new();
|
||||||
|
|
||||||
|
[ForeignKey("HeadwaiterId")]
|
||||||
|
public virtual List<ConferenceBooking> ConferenceBookings { get; set; } = new();
|
||||||
|
public static Client? Create(ClientBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Client()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ClientFIO = model.ClientFIO,
|
||||||
|
ClientEmail = model.ClientEmail,
|
||||||
|
ClientPassword = model.ClientPassword,
|
||||||
|
ClientLogin = model.ClientLogin,
|
||||||
|
ClientNumber = model.ClientNumber
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static Client Create(ClientViewModel model)
|
||||||
|
{
|
||||||
|
return new Client
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
ClientFIO = model.ClientFIO,
|
||||||
|
ClientEmail = model.ClientEmail,
|
||||||
|
ClientPassword = model.ClientPassword,
|
||||||
|
ClientLogin = model.ClientLogin,
|
||||||
|
ClientNumber = model.ClientNumber
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(ClientBindingModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ClientFIO = model.ClientFIO;
|
||||||
|
ClientEmail = model.ClientEmail;
|
||||||
|
ClientPassword = model.ClientPassword;
|
||||||
|
ClientLogin = model.ClientLogin;
|
||||||
|
ClientNumber = model.ClientNumber;
|
||||||
|
}
|
||||||
|
public ClientViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ClientFIO = ClientFIO,
|
||||||
|
ClientEmail = ClientEmail,
|
||||||
|
ClientPassword = ClientPassword,
|
||||||
|
ClientLogin = ClientLogin,
|
||||||
|
ClientNumber = ClientNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -16,21 +16,21 @@ namespace BankDataBaseImplement.Models
|
|||||||
public int HeadwaiterId { get; private set; }
|
public int HeadwaiterId { get; private set; }
|
||||||
public int ConferenceId { get; private set; }
|
public int ConferenceId { get; private set; }
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public virtual Headwaiter Headwaiter { get; set; }
|
public virtual Client Headwaiter { get; set; }
|
||||||
public virtual Conference Conference { get; set; }
|
public virtual Conference Conference { get; set; }
|
||||||
|
|
||||||
[ForeignKey("ConferenceBookingId")]
|
[ForeignKey("ConferenceBookingId")]
|
||||||
public virtual List<ConferenceBookingDinner> Dinners { get; set; }
|
public virtual List<ConferenceBookingDinner> Dinners { get; set; }
|
||||||
|
|
||||||
private Dictionary<int, IDinnerModel> _conferenceBookingDinners = null;
|
private Dictionary<int, ICreditModel> _conferenceBookingDinners = null;
|
||||||
|
|
||||||
public Dictionary<int, IDinnerModel> ConferenceBookingDinners
|
public Dictionary<int, ICreditModel> ConferenceBookingDinners
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_conferenceBookingDinners == null)
|
if (_conferenceBookingDinners == null)
|
||||||
{
|
{
|
||||||
_conferenceBookingDinners = Dinners.ToDictionary(recPC => recPC.DinnerId, recPC => (recPC.Dinner as IDinnerModel));
|
_conferenceBookingDinners = Dinners.ToDictionary(recPC => recPC.DinnerId, recPC => (recPC.Dinner as ICreditModel));
|
||||||
}
|
}
|
||||||
return _conferenceBookingDinners;
|
return _conferenceBookingDinners;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ namespace BankDataBaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public virtual ConferenceBooking ConferenceBooking { get; set; }
|
public virtual ConferenceBooking ConferenceBooking { get; set; }
|
||||||
public virtual Dinner Dinner { get; set; }
|
public virtual Credit Dinner { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Models
|
namespace BankDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
public class Dinner : IDinnerModel
|
public class Credit : ICreditModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int HeadwaiterId { get; set; }
|
public int HeadwaiterId { get; set; }
|
||||||
@ -22,36 +22,36 @@ namespace BankDataBaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public double DinnerPrice { get; set; }
|
public double DinnerPrice { get; set; }
|
||||||
|
|
||||||
public virtual Headwaiter Headwaiters { get; set; }
|
public virtual Client Headwaiters { get; set; }
|
||||||
|
|
||||||
[ForeignKey("DinnerId")]
|
[ForeignKey("DinnerId")]
|
||||||
public virtual List<RoomDinner> RoomDinners { get; set; }
|
public virtual List<RoomCredit> RoomDinners { get; set; }
|
||||||
|
|
||||||
[ForeignKey("DinnercId")]
|
[ForeignKey("DinnercId")]
|
||||||
public virtual List<ConferenceBookingDinner> ConferenceBookingDinners { get; set; }
|
public virtual List<ConferenceBookingDinner> ConferenceBookingDinners { get; set; }
|
||||||
public static Dinner? Create(DinnerBindingModel model)
|
public static Credit? Create(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new Dinner()
|
return new Credit()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
DinnerName = model.DinnerName,
|
DinnerName = model.DinnerName,
|
||||||
DinnerPrice = model.DinnerPrice
|
DinnerPrice = model.DinnerPrice
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static Dinner Create(DinnerViewModel model)
|
public static Credit Create(CreditViewModel model)
|
||||||
{
|
{
|
||||||
return new Dinner
|
return new Credit
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
DinnerName = model.DinnerName,
|
DinnerName = model.DinnerName,
|
||||||
DinnerPrice = model.DinnerPrice
|
DinnerPrice = model.DinnerPrice
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(DinnerBindingModel model)
|
public void Update(CreditBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
@ -60,7 +60,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
DinnerName = model.DinnerName;
|
DinnerName = model.DinnerName;
|
||||||
DinnerPrice = model.DinnerPrice;
|
DinnerPrice = model.DinnerPrice;
|
||||||
}
|
}
|
||||||
public DinnerViewModel GetViewModel => new()
|
public CreditViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
DinnerName = DinnerName,
|
DinnerName = DinnerName,
|
@ -1,93 +0,0 @@
|
|||||||
using BankContracts.BindingModels;
|
|
||||||
using BankContracts.ViewModels;
|
|
||||||
using BankDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BankDataBaseImplement.Models
|
|
||||||
{
|
|
||||||
public class Headwaiter : IHeadwaiterModel
|
|
||||||
{
|
|
||||||
public int Id { get; private set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string HeadwaiterFIO { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string HeadwaiterEmail { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string HeadwaiterPassword { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string HeadwaiterLogin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string HeadwaiterNumber { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
|
|
||||||
[ForeignKey("HeadwaiterId")]
|
|
||||||
public virtual List<Room> Rooms { get; set; } = new();
|
|
||||||
|
|
||||||
[ForeignKey("HeadwaiterId")]
|
|
||||||
public virtual List<Dinner> Dinners { get; set; } = new();
|
|
||||||
|
|
||||||
[ForeignKey("HeadwaiterId")]
|
|
||||||
public virtual List<ConferenceBooking> ConferenceBookings { get; set; } = new();
|
|
||||||
public static Headwaiter? Create(HeadwaiterBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Headwaiter()
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
HeadwaiterFIO = model.HeadwaiterFIO,
|
|
||||||
HeadwaiterEmail = model.HeadwaiterEmail,
|
|
||||||
HeadwaiterPassword = model.HeadwaiterPassword,
|
|
||||||
HeadwaiterLogin = model.HeadwaiterLogin,
|
|
||||||
HeadwaiterNumber = model.HeadwaiterNumber
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public static Headwaiter Create(HeadwaiterViewModel model)
|
|
||||||
{
|
|
||||||
return new Headwaiter
|
|
||||||
{
|
|
||||||
Id = model.Id,
|
|
||||||
HeadwaiterFIO = model.HeadwaiterFIO,
|
|
||||||
HeadwaiterEmail = model.HeadwaiterEmail,
|
|
||||||
HeadwaiterPassword = model.HeadwaiterPassword,
|
|
||||||
HeadwaiterLogin = model.HeadwaiterLogin,
|
|
||||||
HeadwaiterNumber = model.HeadwaiterNumber
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public void Update(HeadwaiterBindingModel model)
|
|
||||||
{
|
|
||||||
if (model == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
HeadwaiterFIO = model.HeadwaiterFIO;
|
|
||||||
HeadwaiterEmail = model.HeadwaiterEmail;
|
|
||||||
HeadwaiterPassword = model.HeadwaiterPassword;
|
|
||||||
HeadwaiterLogin = model.HeadwaiterLogin;
|
|
||||||
HeadwaiterNumber = model.HeadwaiterNumber;
|
|
||||||
}
|
|
||||||
public HeadwaiterViewModel GetViewModel => new()
|
|
||||||
{
|
|
||||||
Id = Id,
|
|
||||||
HeadwaiterFIO = HeadwaiterFIO,
|
|
||||||
HeadwaiterEmail = HeadwaiterEmail,
|
|
||||||
HeadwaiterPassword = HeadwaiterPassword,
|
|
||||||
HeadwaiterLogin = HeadwaiterLogin,
|
|
||||||
HeadwaiterNumber = HeadwaiterNumber
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,7 +21,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
public virtual Clerc Organiser { get; set; }
|
public virtual Clerc Organiser { get; set; }
|
||||||
|
|
||||||
[ForeignKey("MemberId")]
|
[ForeignKey("MemberId")]
|
||||||
public virtual List<MealPlanMember> MealPlanMember { get; set; }
|
public virtual List<AdditionsMember> MealPlanMember { get; set; }
|
||||||
|
|
||||||
[ForeignKey("MemberId")]
|
[ForeignKey("MemberId")]
|
||||||
public virtual List<ConferenceMember> ConferenceMember { get; set; }
|
public virtual List<ConferenceMember> ConferenceMember { get; set; }
|
||||||
|
@ -23,20 +23,20 @@ namespace BankDataBaseImplement.Models
|
|||||||
public int MealPlanId { get; private set; }
|
public int MealPlanId { get; private set; }
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
public virtual Headwaiter Headwaiter { get; set; }
|
public virtual Client Headwaiter { get; set; }
|
||||||
public virtual MealPlan MealPlan { get; set; }
|
public virtual Additions MealPlan { get; set; }
|
||||||
|
|
||||||
[ForeignKey("RoomId")]
|
[ForeignKey("RoomId")]
|
||||||
public virtual List<RoomDinner> Dinners { get; set; }
|
public virtual List<RoomCredit> Dinners { get; set; }
|
||||||
|
|
||||||
private Dictionary<int, IDinnerModel> _roomDinners = null;
|
private Dictionary<int, ICreditModel> _roomDinners = null;
|
||||||
public Dictionary<int, IDinnerModel> RoomDinners
|
public Dictionary<int, ICreditModel> RoomDinners
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_roomDinners == null)
|
if (_roomDinners == null)
|
||||||
{
|
{
|
||||||
_roomDinners = Dinners.ToDictionary(recPC => recPC.DinnerId, recPC => (recPC.Dinner as IDinnerModel));
|
_roomDinners = Dinners.ToDictionary(recPC => recPC.DinnerId, recPC => (recPC.Dinner as ICreditModel));
|
||||||
}
|
}
|
||||||
return _roomDinners;
|
return _roomDinners;
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
RoomName = model.RoomName,
|
RoomName = model.RoomName,
|
||||||
RoomFrame = model.RoomFrame,
|
RoomFrame = model.RoomFrame,
|
||||||
RoomPrice = model.RoomPrice,
|
RoomPrice = model.RoomPrice,
|
||||||
Dinners = model.RoomDinners.Select(x => new RoomDinner
|
Dinners = model.RoomDinners.Select(x => new RoomCredit
|
||||||
{
|
{
|
||||||
Dinner = context.Dinners.First(y => y.Id == x.Key),
|
Dinner = context.Dinners.First(y => y.Id == x.Key),
|
||||||
}).ToList()
|
}).ToList()
|
||||||
@ -87,7 +87,7 @@ namespace BankDataBaseImplement.Models
|
|||||||
|
|
||||||
foreach (var cm in model.RoomDinners)
|
foreach (var cm in model.RoomDinners)
|
||||||
{
|
{
|
||||||
context.RoomDinners.Add(new RoomDinner
|
context.RoomDinners.Add(new RoomCredit
|
||||||
{
|
{
|
||||||
Room = room,
|
Room = room,
|
||||||
Dinner = context.Dinners.First(x => x.Id == cm.Key)
|
Dinner = context.Dinners.First(x => x.Id == cm.Key)
|
||||||
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace BankDataBaseImplement.Models
|
namespace BankDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
public class RoomDinner
|
public class RoomCredit
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int RoomId { get; set; }
|
public int RoomId { get; set; }
|
||||||
@ -16,6 +16,6 @@ namespace BankDataBaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public virtual Room Room { get; set; }
|
public virtual Room Room { get; set; }
|
||||||
public virtual Dinner Dinner { get; set; }
|
public virtual Credit Dinner { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
10
Bank/BankDataModels/DataModels/IAdditionsModel.cs
Normal file
10
Bank/BankDataModels/DataModels/IAdditionsModel.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace BankDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IAdditionsModel : IId
|
||||||
|
{
|
||||||
|
string AdditionsName { get; }
|
||||||
|
double AdditionsPrice { get; }
|
||||||
|
int ClercId { get; }
|
||||||
|
public Dictionary<int, IMemberModel> AdditionsMembers { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,10 @@
|
|||||||
{
|
{
|
||||||
public interface IClercModel : IId
|
public interface IClercModel : IId
|
||||||
{
|
{
|
||||||
string OrganiserFIO { get; }
|
string ClercFIO { get; }
|
||||||
string OrganiserPassword { get; }
|
string ClercPassword { get; }
|
||||||
string OrganiserLogin { get; }
|
string ClercLogin { get; }
|
||||||
string OrganiserEmail { get; }
|
string ClercEmail { get; }
|
||||||
string OrganiserNumber { get; }
|
string ClercNumber { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
Bank/BankDataModels/DataModels/IClientModel.cs
Normal file
12
Bank/BankDataModels/DataModels/IClientModel.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
namespace BankDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IClientModel : IId
|
||||||
|
{
|
||||||
|
string ClientFIO { get; }
|
||||||
|
string ClientPassword { get; }
|
||||||
|
string ClientLogin { get; }
|
||||||
|
string ClientEmail { get; }
|
||||||
|
string ClientNumber { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,6 @@
|
|||||||
{
|
{
|
||||||
int HeadwaiterId { get;}
|
int HeadwaiterId { get;}
|
||||||
int ConferenceId { get; }
|
int ConferenceId { get; }
|
||||||
public Dictionary<int, IDinnerModel> ConferenceBookingDinners { get; }
|
public Dictionary<int, ICreditModel> ConferenceBookingDinners { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
Bank/BankDataModels/DataModels/ICreditModel.cs
Normal file
9
Bank/BankDataModels/DataModels/ICreditModel.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace BankDataModels.Models
|
||||||
|
{
|
||||||
|
public interface ICreditModel : IId
|
||||||
|
{
|
||||||
|
string CreditName { get; }
|
||||||
|
double CreditPrice { get; }
|
||||||
|
int ClientId { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
namespace BankDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IDinnerModel : IId
|
|
||||||
{
|
|
||||||
string DinnerName { get; }
|
|
||||||
double DinnerPrice { get; }
|
|
||||||
int HeadwaiterId { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
namespace BankDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IHeadwaiterModel : IId
|
|
||||||
{
|
|
||||||
string HeadwaiterFIO { get; }
|
|
||||||
string HeadwaiterPassword { get; }
|
|
||||||
string HeadwaiterLogin { get; }
|
|
||||||
string HeadwaiterEmail { get; }
|
|
||||||
string HeadwaiterNumber { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace BankDataModels.Models
|
|
||||||
{
|
|
||||||
public interface IMealPlanModel : IId
|
|
||||||
{
|
|
||||||
string MealPlanName { get; }
|
|
||||||
double MealPlanPrice { get; }
|
|
||||||
int OrganiserId { get; }
|
|
||||||
public Dictionary<int, IMemberModel> MealPlanMembers { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,6 +8,6 @@ namespace BankDataModels.Models
|
|||||||
double RoomPrice { get; }
|
double RoomPrice { get; }
|
||||||
int HeadwaiterId { get; }
|
int HeadwaiterId { get; }
|
||||||
int MealPlanId { get; }
|
int MealPlanId { get; }
|
||||||
public Dictionary<int, IDinnerModel> RoomDinners { get; }
|
public Dictionary<int, ICreditModel> RoomDinners { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user