additions

This commit is contained in:
Arklightning 2023-04-08 22:43:54 +04:00
parent 8ad8b44a23
commit d7597ea67b
58 changed files with 249 additions and 249 deletions

View File

@ -7,17 +7,17 @@ using Microsoft.Extensions.Logging;
namespace BankBusinessLogic.BusinessLogics
{
public class MealPlanLogic : IMealPlanLogic
public class AdditionsLogic : IAdditionsLogic
{
private readonly ILogger _logger;
private readonly IMealPlanStorage _mealPlanStorage;
private readonly IAdditionsPlanStorage _mealPlanStorage;
public MealPlanLogic(ILogger<MealPlanLogic> logger, IMealPlanStorage mealPlanStorage)
public AdditionsLogic(ILogger<AdditionsLogic> logger, IAdditionsPlanStorage mealPlanStorage)
{
_logger = logger;
_mealPlanStorage = mealPlanStorage;
}
public bool Create(MealPlanBindingModel model)
public bool Create(AdditionsBindingModel model)
{
CheckModel(model);
@ -30,7 +30,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
public bool Delete(MealPlanBindingModel model)
public bool Delete(AdditionsBindingModel model)
{
CheckModel(model, false);
@ -45,7 +45,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
public MealPlanViewModel? ReadElement(MealPlanSearchModel model)
public AdditionsPlanViewModel? ReadElement(AdditionsSearchModel model)
{
if (model == null)
{
@ -67,7 +67,7 @@ namespace BankBusinessLogic.BusinessLogics
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);
@ -84,7 +84,7 @@ namespace BankBusinessLogic.BusinessLogics
return list;
}
public bool Update(MealPlanBindingModel model)
public bool Update(AdditionsBindingModel model)
{
CheckModel(model);
@ -97,7 +97,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
private void CheckModel(MealPlanBindingModel model, bool withParams = true)
private void CheckModel(AdditionsBindingModel model, bool withParams = true)
{
if (model == null)
{
@ -121,7 +121,7 @@ namespace BankBusinessLogic.BusinessLogics
_logger.LogInformation("MealPlan. MealPlanName:{MealPlanName}.MealPlanPrice:{ MealPlanPrice}. Id: { Id}", model.MealPlanName, model.MealPlanPrice, model.Id);
var element = _mealPlanStorage.GetElement(new MealPlanSearchModel
var element = _mealPlanStorage.GetElement(new AdditionsSearchModel
{
MealPlanName = model.MealPlanName
});

View File

@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.BusinessLogics
{
public class HeadwaiterLogic : IHeadwaiterLogic
public class ClientLogic : IClientLogic
{
private readonly int _loginMaxLength = 50;
private readonly int _passwordMaxLength = 50;
@ -21,13 +21,13 @@ namespace BankBusinessLogic.BusinessLogics
private readonly ILogger _logger;
private readonly IHeadwaiterStorage _headwaiterStorage;
public HeadwaiterLogic(ILogger<HeadwaiterLogic> logger, IHeadwaiterStorage headwaiterStorage)
public ClientLogic(ILogger<ClientLogic> logger, IHeadwaiterStorage headwaiterStorage)
{
_logger = logger;
_headwaiterStorage = headwaiterStorage;
}
public bool Create(HeadwaiterBindingModel model)
public bool Create(ClientBindingModel model)
{
CheckModel(model);
@ -41,7 +41,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
public bool Delete(HeadwaiterBindingModel model)
public bool Delete(ClientBindingModel model)
{
CheckModel(model, false);
@ -57,7 +57,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
public HeadwaiterViewModel? ReadElement(HeadwaiterSearchModel model)
public ClientViewModel? ReadElement(ClientSearchModel model)
{
if (model == null)
{
@ -79,7 +79,7 @@ namespace BankBusinessLogic.BusinessLogics
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);
@ -96,7 +96,7 @@ namespace BankBusinessLogic.BusinessLogics
return list;
}
public bool Update(HeadwaiterBindingModel model)
public bool Update(ClientBindingModel model)
{
CheckModel(model);
@ -108,7 +108,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
private void CheckModel(HeadwaiterBindingModel model, bool withParams = true)
private void CheckModel(ClientBindingModel model, bool withParams = true)
{
if (model == null)
{
@ -162,7 +162,7 @@ namespace BankBusinessLogic.BusinessLogics
_logger.LogInformation("Headwaiter. HeadwaiterFIO: {HeadwaiterFIO}. HeadwaiterLogin: {HeadwaiterLogin}. Id: {Id}", model.HeadwaiterFIO, model.HeadwaiterLogin, model.Id);
var element = _headwaiterStorage.GetElement(new HeadwaiterSearchModel
var element = _headwaiterStorage.GetElement(new ClientSearchModel
{
HeadwaiterLogin = model.HeadwaiterLogin
});

View File

@ -12,18 +12,18 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.BusinessLogics
{
public class DinnerLogic : IDinnerLogic
public class CreditLogic : ICreditLogic
{
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;
_dinnerStorage = dinnerStorage;
}
public bool Create(DinnerBindingModel model)
public bool Create(CreditBindingModel model)
{
CheckModel(model);
@ -36,7 +36,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
public bool Delete(DinnerBindingModel model)
public bool Delete(CreditBindingModel model)
{
CheckModel(model, false);
@ -51,7 +51,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
public DinnerViewModel? ReadElement(DinnerSearchModel model)
public CreditViewModel? ReadElement(CreditSearchModel model)
{
if (model == null)
{
@ -73,7 +73,7 @@ namespace BankBusinessLogic.BusinessLogics
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);
@ -90,7 +90,7 @@ namespace BankBusinessLogic.BusinessLogics
return list;
}
public bool Update(DinnerBindingModel model)
public bool Update(CreditBindingModel model)
{
CheckModel(model);
@ -102,7 +102,7 @@ namespace BankBusinessLogic.BusinessLogics
return true;
}
private void CheckModel(DinnerBindingModel model, bool withParams = true)
private void CheckModel(CreditBindingModel model, bool withParams = true)
{
if (model == null)
{

View File

@ -16,13 +16,13 @@ namespace BankBusinessLogic.BusinessLogics
public class ReportLogicHeadwaiter : IReportHeadwaiterLogic
{
private readonly IRoomStorage _roomStorage;
private readonly IDinnerStorage _dinnerStorage;
private readonly IMealPlanStorage _mealPlansStorage;
private readonly ICreditStorage _dinnerStorage;
private readonly IAdditionsPlanStorage _mealPlansStorage;
private readonly IConferenceBookingStorage _conferenceBookingStorage;
private readonly AbstractSaveToExcelHeadwaiter _saveToExcel;
private readonly AbstractSaveToExcelClient _saveToExcel;
private readonly AbstractSaveToWordHeadwaitre _saveToWord;
private readonly AbstractSaveToPdfHeadwaiter _saveToPdf;
public ReportLogicHeadwaiter(IRoomStorage roomStorage, IDinnerStorage dinnerStorage, IMealPlanStorage mealPlansStorage, IConferenceBookingStorage conferenceBookingStorage, AbstractSaveToExcelHeadwaiter saveToExcel, AbstractSaveToWordHeadwaitre saveToWord, AbstractSaveToPdfHeadwaiter saveToPdf)
private readonly AbstractSaveToPdfClient _saveToPdf;
public ReportLogicHeadwaiter(IRoomStorage roomStorage, ICreditStorage dinnerStorage, IAdditionsPlanStorage mealPlansStorage, IConferenceBookingStorage conferenceBookingStorage, AbstractSaveToExcelClient saveToExcel, AbstractSaveToWordHeadwaitre saveToWord, AbstractSaveToPdfClient saveToPdf)
{
_roomStorage = roomStorage;
_dinnerStorage = dinnerStorage;
@ -85,7 +85,7 @@ namespace BankBusinessLogic.BusinessLogics
public void SaveMealPlanDinnerToExcelFile(ReportHeadwaiterBindingModel model)
{
_saveToExcel.CreateReport(new ExcelInfoHeadwaiter
_saveToExcel.CreateReport(new ExcelInfoClient
{
FileName = model.FileName,
Title = "Список изделий",
@ -95,7 +95,7 @@ namespace BankBusinessLogic.BusinessLogics
public void SaveMealPlanDinnerToWordFile(ReportHeadwaiterBindingModel model)
{
_saveToWord.CreateDoc(new WordInfoHeadwaiter
_saveToWord.CreateDoc(new WordInfoClient
{
FileName = model.FileName,
Title = "Список участников",
@ -105,7 +105,7 @@ namespace BankBusinessLogic.BusinessLogics
public void SaveConferenceBindingRoomsToPdfFile(ReportHeadwaiterBindingModel model)
{
_saveToPdf.CreateDoc(new PdfInfoHeadwaiter
_saveToPdf.CreateDoc(new PdfInfoClient
{
FileName = model.FileName,
Title = "Список участников",

View File

@ -12,13 +12,13 @@ namespace BankBusinessLogic.BusinessLogics
{
public class ReportLogicOrganiser : IReportOrganiserLogic
{
private readonly IMealPlanStorage _mealPlanStorage;
private readonly IAdditionsPlanStorage _mealPlanStorage;
private readonly IMemberStorage _memberStorage;
private readonly IConferenceStorage _conferenceStorage;
private readonly AbstractSaveToExcelOrganiser _saveToExcel;
private readonly AbstractSaveToWordClerc _saveToWord;
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;
_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)
{

View File

@ -8,9 +8,9 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToExcelHeadwaiter
public abstract class AbstractSaveToExcelClient
{
public void CreateReport(ExcelInfoHeadwaiter info)
public void CreateReport(ExcelInfoClient info)
{
CreateExcel(info);
@ -69,12 +69,12 @@ namespace BankBusinessLogic.OfficePackage
SaveExcel(info);
}
protected abstract void CreateExcel(ExcelInfoHeadwaiter info);
protected abstract void CreateExcel(ExcelInfoClient info);
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
protected abstract void MergeCells(ExcelMergeParameters excelParams);
protected abstract void SaveExcel(ExcelInfoHeadwaiter info);
protected abstract void SaveExcel(ExcelInfoClient info);
}
}

View File

@ -8,9 +8,9 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToPdfHeadwaiter
public abstract class AbstractSaveToPdfClient
{
public void CreateDoc(PdfInfoHeadwaiter info)
public void CreateDoc(PdfInfoClient info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph
@ -49,10 +49,10 @@ namespace BankBusinessLogic.OfficePackage
});
SavePdf(info);
}
protected abstract void CreatePdf(PdfInfoHeadwaiter info);
protected abstract void CreatePdf(PdfInfoClient info);
protected abstract void CreateParagraph(PdfParagraph paragraph);
protected abstract void CreateTable(List<string> columns);
protected abstract void CreateRow(PdfRowParameters rowParameters);
protected abstract void SavePdf(PdfInfoHeadwaiter info);
protected abstract void SavePdf(PdfInfoClient info);
}
}

View File

@ -10,7 +10,7 @@ namespace BankBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWordHeadwaitre
{
public void CreateDoc(WordInfoHeadwaiter info)
public void CreateDoc(WordInfoClient info)
{
CreateWord(info);
@ -55,8 +55,8 @@ namespace BankBusinessLogic.OfficePackage
SaveWord(info);
}
protected abstract void CreateWord(WordInfoHeadwaiter info);
protected abstract void CreateWord(WordInfoClient info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfoHeadwaiter info);
protected abstract void SaveWord(WordInfoClient info);
}
}

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage.HelperModels
{
public class ExcelInfoHeadwaiter
public class ExcelInfoClient
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage.HelperModels
{
public class PdfInfoHeadwaiter
public class PdfInfoClient
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage.HelperModels
{
public class WordInfoHeadwaiter
public class WordInfoClient
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;

View File

@ -13,7 +13,7 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage.Implements
{
public class SaveToExcelHeadwaiter : AbstractSaveToExcelHeadwaiter
public class SaveToExcelClient : AbstractSaveToExcelClient
{
private SpreadsheetDocument? _spreadsheetDocument;
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);
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
@ -320,7 +320,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
mergeCells.Append(mergeCell);
}
protected override void SaveExcel(ExcelInfoHeadwaiter info)
protected override void SaveExcel(ExcelInfoClient info)
{
if (_spreadsheetDocument == null)
{

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage.Implements
{
internal class SaveToPdfHeadwaiter : AbstractSaveToPdfHeadwaiter
internal class SaveToPdfClient : AbstractSaveToPdfClient
{
private Document? _document;
private Section? _section;
@ -46,7 +46,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
paragraph.Style = pdfParagraph.Style;
}
protected override void CreatePdf(PdfInfoHeadwaiter info)
protected override void CreatePdf(PdfInfoClient info)
{
_document = new 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)
{

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace BankBusinessLogic.OfficePackage.Implements
{
public class SaveToWordHeadwaiter : AbstractSaveToWordHeadwaitre
public class SaveToWordClient : AbstractSaveToWordHeadwaitre
{
private WordprocessingDocument? _wordDocument;
private Body? _docBody;
@ -105,7 +105,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
_docBody.AppendChild(docParagraph);
}
protected override void CreateWord(WordInfoHeadwaiter info)
protected override void CreateWord(WordInfoClient info)
{
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
@ -113,7 +113,7 @@ namespace BankBusinessLogic.OfficePackage.Implements
_docBody = mainPart.Document.AppendChild(new Body());
}
protected override void SaveWord(WordInfoHeadwaiter info)
protected override void SaveWord(WordInfoClient info)
{
if (_docBody == null || _wordDocument == null)
{

View File

@ -2,7 +2,7 @@
namespace BankContracts.BindingModels
{
public class MealPlanBindingModel : IMealPlanModel
public class AdditionsBindingModel : IAdditionsModel
{
public string MealPlanName { get; set; } = string.Empty;

View File

@ -2,7 +2,7 @@
namespace BankContracts.BindingModels
{
public class HeadwaiterBindingModel : IHeadwaiterModel
public class ClientBindingModel : IClientModel
{
public string HeadwaiterFIO { get; set; } = string.Empty;

View File

@ -9,6 +9,6 @@ namespace BankContracts.BindingModels
public int ConferenceId { get; set; }
public int Id { get; set; }
public Dictionary<int, IDinnerModel> ConferenceBookingDinners { get; set; }
public Dictionary<int, ICreditModel> ConferenceBookingDinners { get; set; }
}
}

View File

@ -2,7 +2,7 @@
namespace BankContracts.BindingModels
{
public class DinnerBindingModel : IDinnerModel
public class CreditBindingModel : ICreditModel
{
public string DinnerName { get; set; } = string.Empty;

View File

@ -15,6 +15,6 @@ namespace BankContracts.BindingModels
public int MealPlanId { get; set; }
public int Id { get; set; }
public Dictionary<int, IDinnerModel> RoomDinners { get; set; }
public Dictionary<int, ICreditModel> RoomDinners { get; set; }
}
}

View File

@ -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);
}
}

View 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);
}
}

View 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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -1,6 +1,6 @@
namespace BankContracts.SearchModels
{
public class MealPlanSearchModel
public class AdditionsSearchModel
{
public int? Id { get; set; }
public string? MealPlanName { get; set; }

View File

@ -1,7 +1,7 @@

namespace BankContracts.SearchModels
{
public class HeadwaiterSearchModel
public class ClientSearchModel
{
public string? HeadwaiterFIO { get; set; }

View File

@ -1,7 +1,7 @@

namespace BankContracts.SearchModels
{
public class DinnerSearchModel
public class CreditSearchModel
{
public string? DinnerName { get; set; }
public int? Id { get; set; }

View File

@ -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);
}
}

View 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);
}
}

View File

@ -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);
}
}

View File

@ -6,16 +6,16 @@ namespace BankContracts.StoragesContracts
{
public interface IHeadwaiterStorage
{
List<HeadwaiterViewModel> GetFullList();
List<ClientViewModel> GetFullList();
List<HeadwaiterViewModel> GetFilteredList(HeadwaiterSearchModel model);
List<ClientViewModel> GetFilteredList(ClientSearchModel model);
HeadwaiterViewModel? GetElement(HeadwaiterSearchModel model);
ClientViewModel? GetElement(ClientSearchModel model);
HeadwaiterViewModel? Insert(HeadwaiterBindingModel model);
ClientViewModel? Insert(ClientBindingModel model);
HeadwaiterViewModel? Update(HeadwaiterBindingModel model);
ClientViewModel? Update(ClientBindingModel model);
HeadwaiterViewModel? Delete(HeadwaiterBindingModel model);
ClientViewModel? Delete(ClientBindingModel model);
}
}

View File

@ -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);
}
}

View File

@ -3,7 +3,7 @@ using System.ComponentModel;
namespace BankContracts.ViewModels
{
public class MealPlanViewModel : IMealPlanModel
public class AdditionsPlanViewModel : IAdditionsModel
{
[DisplayName("Название плана питания")]
public string MealPlanName { get; set; } = string.Empty;

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace BankContracts.ViewModels
{
public class HeadwaiterViewModel : IHeadwaiterModel
public class ClientViewModel : IClientModel
{
public int Id { get; set; }

View File

@ -14,6 +14,6 @@ namespace BankContracts.ViewModels
public int ConferenceId { get; set; }
public int Id { get; set; }
public Dictionary<int, IDinnerModel> ConferenceBookingDinners { get; set; }
public Dictionary<int, ICreditModel> ConferenceBookingDinners { get; set; }
}
}

View File

@ -4,7 +4,7 @@ using System.ComponentModel;
namespace BankContracts.ViewModels
{
public class DinnerViewModel : IDinnerModel
public class CreditViewModel : ICreditModel
{
public int Id { get; set; }
public int HeadwaiterId { get; set; }

View File

@ -20,7 +20,7 @@ namespace BankContracts.ViewModels
[DisplayName("Стоимость комнаты")]
public double RoomPrice { get; set; }
public Dictionary<int, IDinnerModel> RoomDinners { get; set; }
public Dictionary<int, ICreditModel> RoomDinners { get; set; }
}
}

View File

@ -16,15 +16,15 @@ namespace BankDataBaseImplement
}
public virtual DbSet<Conference> Conferences { set; get; }
public virtual DbSet<Room> Rooms { set; get; }
public virtual DbSet<MealPlan> MealPlans { set; get; }
public virtual DbSet<Additions> MealPlans { set; get; }
public virtual DbSet<ConferenceBooking> ConferenceBookings { set; get; }
public virtual DbSet<Member> Members { set; get; }
public virtual DbSet<Dinner> Dinners { set; get; }
public virtual DbSet<Credit> Dinners { set; get; }
public virtual DbSet<Clerc> Organisers { set; get; }
public virtual DbSet<Headwaiter> Headwaiters { set; get; }
public virtual DbSet<Client> Headwaiters { set; get; }
public virtual DbSet<ConferenceMember> ConferenceMembers { set; get; }
public virtual DbSet<RoomDinner> RoomDinners { set; get; }
public virtual DbSet<MealPlanMember> MealPlanMembers { set; get; }
public virtual DbSet<RoomCredit> RoomDinners { set; get; }
public virtual DbSet<AdditionsMember> MealPlanMembers { set; get; }
public virtual DbSet<ConferenceBookingDinner> ConferenceBookingDinners { set; get; }
}

View File

@ -7,9 +7,9 @@ using Microsoft.EntityFrameworkCore;
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();
@ -27,7 +27,7 @@ namespace BankDataBaseImplement.Implemets
return null;
}
public MealPlanViewModel? GetElement(MealPlanSearchModel model)
public AdditionsPlanViewModel? GetElement(AdditionsSearchModel model)
{
if (!model.Id.HasValue)
{
@ -47,7 +47,7 @@ namespace BankDataBaseImplement.Implemets
.GetViewModel;
}
public List<MealPlanViewModel> GetFilteredList(MealPlanSearchModel model)
public List<AdditionsPlanViewModel> GetFilteredList(AdditionsSearchModel model)
{
if (string.IsNullOrEmpty(model.MealPlanName))
{
@ -68,7 +68,7 @@ namespace BankDataBaseImplement.Implemets
.ToList();
}
public List<MealPlanViewModel> GetFullList()
public List<AdditionsPlanViewModel> GetFullList()
{
using var context = new BankDataBase();
return context.MealPlans
@ -82,10 +82,10 @@ namespace BankDataBaseImplement.Implemets
.ToList();
}
public MealPlanViewModel? Insert(MealPlanBindingModel model)
public AdditionsPlanViewModel? Insert(AdditionsBindingModel model)
{
using var context = new BankDataBase();
var newMealPlan = MealPlan.Create(context,model);
var newMealPlan = Additions.Create(context,model);
if (newMealPlan == null)
{
@ -97,7 +97,7 @@ namespace BankDataBaseImplement.Implemets
return newMealPlan.GetViewModel;
}
public MealPlanViewModel? Update(MealPlanBindingModel model)
public AdditionsPlanViewModel? Update(AdditionsBindingModel model)
{
using var context = new BankDataBase();
var mealPlan = context.MealPlans.FirstOrDefault(x => x.Id == model.Id);

View File

@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore;
namespace BankDataBaseImplement.Implemets
{
public class OrganiserStorage : IClercStorage
public class ClercStorage : IClercStorage
{
public ClercViewModel? Delete(ClercBindingModel model)
{

View File

@ -12,9 +12,9 @@ using System.Threading.Tasks;
namespace BankDataBaseImplement.Implemets
{
public class HeadwaiterStorage : IHeadwaiterStorage
public class ClientStorage : IHeadwaiterStorage
{
public HeadwaiterViewModel? Delete(HeadwaiterBindingModel model)
public ClientViewModel? Delete(ClientBindingModel model)
{
using var context = new BankDataBase();
@ -31,7 +31,7 @@ namespace BankDataBaseImplement.Implemets
return null;
}
public HeadwaiterViewModel? GetElement(HeadwaiterSearchModel model)
public ClientViewModel? GetElement(ClientSearchModel model)
{
using var context = new BankDataBase();
@ -62,7 +62,7 @@ namespace BankDataBaseImplement.Implemets
return null;
}
public List<HeadwaiterViewModel> GetFilteredList(HeadwaiterSearchModel model)
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
{
if (string.IsNullOrEmpty(model.HeadwaiterFIO))
{
@ -80,7 +80,7 @@ namespace BankDataBaseImplement.Implemets
.ToList();
}
public List<HeadwaiterViewModel> GetFullList()
public List<ClientViewModel> GetFullList()
{
using var context = new BankDataBase();
@ -89,9 +89,9 @@ namespace BankDataBaseImplement.Implemets
.ToList();
}
public HeadwaiterViewModel? Insert(HeadwaiterBindingModel model)
public ClientViewModel? Insert(ClientBindingModel model)
{
var newHeadwaiter = Headwaiter.Create(model);
var newHeadwaiter = Client.Create(model);
if (newHeadwaiter == null)
{
@ -106,7 +106,7 @@ namespace BankDataBaseImplement.Implemets
return newHeadwaiter.GetViewModel;
}
public HeadwaiterViewModel? Update(HeadwaiterBindingModel model)
public ClientViewModel? Update(ClientBindingModel model)
{
using var context = new BankDataBase();

View File

@ -12,9 +12,9 @@ using System.Threading.Tasks;
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();
@ -31,7 +31,7 @@ namespace BankDataBaseImplement.Implemets
return null;
}
public DinnerViewModel? GetElement(DinnerSearchModel model)
public CreditViewModel? GetElement(CreditSearchModel model)
{
if (string.IsNullOrEmpty(model.DinnerName) && !model.Id.HasValue)
{
@ -49,7 +49,7 @@ namespace BankDataBaseImplement.Implemets
.GetViewModel;
}
public List<DinnerViewModel> GetFilteredList(DinnerSearchModel model)
public List<CreditViewModel> GetFilteredList(CreditSearchModel model)
{
if (string.IsNullOrEmpty(model.DinnerName))
{
@ -69,7 +69,7 @@ namespace BankDataBaseImplement.Implemets
.ToList();
}
public List<DinnerViewModel> GetFullList()
public List<CreditViewModel> GetFullList()
{
using var context = new BankDataBase();
@ -83,11 +83,11 @@ namespace BankDataBaseImplement.Implemets
.ToList();
}
public DinnerViewModel? Insert(DinnerBindingModel model)
public CreditViewModel? Insert(CreditBindingModel model)
{
using var context = new BankDataBase();
var newDinner = Dinner.Create(model);
var newDinner = Credit.Create(model);
if (newDinner == null)
{
@ -100,7 +100,7 @@ namespace BankDataBaseImplement.Implemets
return newDinner.GetViewModel;
}
public DinnerViewModel? Update(DinnerBindingModel model)
public CreditViewModel? Update(CreditBindingModel model)
{
using var context = new BankDataBase();

View File

@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace BankDataBaseImplement.Models
{
public class MealPlan : IMealPlanModel
public class Additions : IAdditionsModel
{
[Required]
public string MealPlanName { get; set; } = string.Empty;
@ -24,7 +24,7 @@ namespace BankDataBaseImplement.Models
public virtual List<Room> Rooms { get; set; }
[ForeignKey("MealPlanId")]
public virtual List<MealPlanMember> Members { get; set; }
public virtual List<AdditionsMember> Members { get; set; }
private Dictionary<int, IMemberModel> _mealPlanMembers = null;
@ -39,27 +39,27 @@ namespace BankDataBaseImplement.Models
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,
MealPlanName = model.MealPlanName,
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),
}).ToList()
};
}
public void Update(MealPlanBindingModel model)
public void Update(AdditionsBindingModel model)
{
MealPlanName = model.MealPlanName;
MealPlanPrice = model.MealPlanPrice;
}
public MealPlanViewModel GetViewModel => new()
public AdditionsPlanViewModel GetViewModel => new()
{
Id = Id,
MealPlanName = MealPlanName,
@ -67,7 +67,7 @@ namespace BankDataBaseImplement.Models
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();
@ -81,7 +81,7 @@ namespace BankDataBaseImplement.Models
foreach (var cm in model.MealPlanMembers)
{
context.MealPlanMembers.Add(new MealPlanMember
context.MealPlanMembers.Add(new AdditionsMember
{
MealPlan = mealPlan,
Member = context.Members.First(x => x.Id == cm.Key)

View File

@ -2,7 +2,7 @@
namespace BankDataBaseImplement.Models
{
public class MealPlanMember
public class AdditionsMember
{
public int Id { get; set; }
@ -12,7 +12,7 @@ namespace BankDataBaseImplement.Models
[Required]
public int MealPlanId { get; set; }
public virtual MealPlan MealPlan { get; set; }
public virtual Additions MealPlan { get; set; }
public virtual Member Member { get; set; }
}
}

View File

@ -24,7 +24,7 @@ namespace BankDataBaseImplement.Models
[ForeignKey("OrganiserId")]
public virtual List<Conference> Conferences { get; set; } = new();
[ForeignKey("OrganiserId")]
public virtual List<MealPlan> MealPlans { get; set; } = new();
public virtual List<Additions> MealPlans { get; set; } = new();
[ForeignKey("OrganiserId")]
public virtual List<Member> Members { get; set; } = new();

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace BankDataBaseImplement.Models
{
public class Headwaiter : IHeadwaiterModel
public class Client : IClientModel
{
public int Id { get; private set; }
@ -35,17 +35,17 @@ namespace BankDataBaseImplement.Models
public virtual List<Room> Rooms { get; set; } = new();
[ForeignKey("HeadwaiterId")]
public virtual List<Dinner> Dinners { get; set; } = new();
public virtual List<Credit> Dinners { get; set; } = new();
[ForeignKey("HeadwaiterId")]
public virtual List<ConferenceBooking> ConferenceBookings { get; set; } = new();
public static Headwaiter? Create(HeadwaiterBindingModel model)
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new Headwaiter()
return new Client()
{
Id = model.Id,
HeadwaiterFIO = model.HeadwaiterFIO,
@ -55,9 +55,9 @@ namespace BankDataBaseImplement.Models
HeadwaiterNumber = model.HeadwaiterNumber
};
}
public static Headwaiter Create(HeadwaiterViewModel model)
public static Client Create(ClientViewModel model)
{
return new Headwaiter
return new Client
{
Id = model.Id,
HeadwaiterFIO = model.HeadwaiterFIO,
@ -67,7 +67,7 @@ namespace BankDataBaseImplement.Models
HeadwaiterNumber = model.HeadwaiterNumber
};
}
public void Update(HeadwaiterBindingModel model)
public void Update(ClientBindingModel model)
{
if (model == null)
{
@ -79,7 +79,7 @@ namespace BankDataBaseImplement.Models
HeadwaiterLogin = model.HeadwaiterLogin;
HeadwaiterNumber = model.HeadwaiterNumber;
}
public HeadwaiterViewModel GetViewModel => new()
public ClientViewModel GetViewModel => new()
{
Id = Id,
HeadwaiterFIO = HeadwaiterFIO,

View File

@ -16,21 +16,21 @@ namespace BankDataBaseImplement.Models
public int HeadwaiterId { get; private set; }
public int ConferenceId { 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; }
[ForeignKey("ConferenceBookingId")]
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
{
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;
}

View File

@ -16,6 +16,6 @@ namespace BankDataBaseImplement.Models
[Required]
public int Count { get; set; }
public virtual ConferenceBooking ConferenceBooking { get; set; }
public virtual Dinner Dinner { get; set; }
public virtual Credit Dinner { get; set; }
}
}

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace BankDataBaseImplement.Models
{
public class Dinner : IDinnerModel
public class Credit : ICreditModel
{
public int Id { get; set; }
public int HeadwaiterId { get; set; }
@ -22,36 +22,36 @@ namespace BankDataBaseImplement.Models
[Required]
public double DinnerPrice { get; set; }
public virtual Headwaiter Headwaiters { get; set; }
public virtual Client Headwaiters { get; set; }
[ForeignKey("DinnerId")]
public virtual List<RoomDinner> RoomDinners { get; set; }
public virtual List<RoomCredit> RoomDinners { get; set; }
[ForeignKey("DinnercId")]
public virtual List<ConferenceBookingDinner> ConferenceBookingDinners { get; set; }
public static Dinner? Create(DinnerBindingModel model)
public static Credit? Create(CreditBindingModel model)
{
if (model == null)
{
return null;
}
return new Dinner()
return new Credit()
{
Id = model.Id,
DinnerName = model.DinnerName,
DinnerPrice = model.DinnerPrice
};
}
public static Dinner Create(DinnerViewModel model)
public static Credit Create(CreditViewModel model)
{
return new Dinner
return new Credit
{
Id = model.Id,
DinnerName = model.DinnerName,
DinnerPrice = model.DinnerPrice
};
}
public void Update(DinnerBindingModel model)
public void Update(CreditBindingModel model)
{
if (model == null)
{
@ -60,7 +60,7 @@ namespace BankDataBaseImplement.Models
DinnerName = model.DinnerName;
DinnerPrice = model.DinnerPrice;
}
public DinnerViewModel GetViewModel => new()
public CreditViewModel GetViewModel => new()
{
Id = Id,
DinnerName = DinnerName,

View File

@ -21,7 +21,7 @@ namespace BankDataBaseImplement.Models
public virtual Clerc Organiser { get; set; }
[ForeignKey("MemberId")]
public virtual List<MealPlanMember> MealPlanMember { get; set; }
public virtual List<AdditionsMember> MealPlanMember { get; set; }
[ForeignKey("MemberId")]
public virtual List<ConferenceMember> ConferenceMember { get; set; }

View File

@ -23,20 +23,20 @@ namespace BankDataBaseImplement.Models
public int MealPlanId { get; private set; }
public int Id { get; private set; }
public virtual Headwaiter Headwaiter { get; set; }
public virtual MealPlan MealPlan { get; set; }
public virtual Client Headwaiter { get; set; }
public virtual Additions MealPlan { get; set; }
[ForeignKey("RoomId")]
public virtual List<RoomDinner> Dinners { get; set; }
public virtual List<RoomCredit> Dinners { get; set; }
private Dictionary<int, IDinnerModel> _roomDinners = null;
public Dictionary<int, IDinnerModel> RoomDinners
private Dictionary<int, ICreditModel> _roomDinners = null;
public Dictionary<int, ICreditModel> RoomDinners
{
get
{
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;
}
@ -50,7 +50,7 @@ namespace BankDataBaseImplement.Models
RoomName = model.RoomName,
RoomFrame = model.RoomFrame,
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),
}).ToList()
@ -87,7 +87,7 @@ namespace BankDataBaseImplement.Models
foreach (var cm in model.RoomDinners)
{
context.RoomDinners.Add(new RoomDinner
context.RoomDinners.Add(new RoomCredit
{
Room = room,
Dinner = context.Dinners.First(x => x.Id == cm.Key)

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BankDataBaseImplement.Models
{
public class RoomDinner
public class RoomCredit
{
public int Id { get; set; }
public int RoomId { get; set; }
@ -16,6 +16,6 @@ namespace BankDataBaseImplement.Models
[Required]
public int Count { get; set; }
public virtual Room Room { get; set; }
public virtual Dinner Dinner { get; set; }
public virtual Credit Dinner { get; set; }
}
}

View File

@ -1,6 +1,6 @@
namespace BankDataModels.Models
{
public interface IMealPlanModel : IId
public interface IAdditionsModel : IId
{
string MealPlanName { get; }
double MealPlanPrice { get; }

View File

@ -1,7 +1,7 @@

namespace BankDataModels.Models
{
public interface IHeadwaiterModel : IId
public interface IClientModel : IId
{
string HeadwaiterFIO { get; }
string HeadwaiterPassword { get; }

View File

@ -4,6 +4,6 @@
{
int HeadwaiterId { get;}
int ConferenceId { get; }
public Dictionary<int, IDinnerModel> ConferenceBookingDinners { get; }
public Dictionary<int, ICreditModel> ConferenceBookingDinners { get; }
}
}

View File

@ -1,6 +1,6 @@
namespace BankDataModels.Models
{
public interface IDinnerModel : IId
public interface ICreditModel : IId
{
string DinnerName { get; }
double DinnerPrice { get; }

View File

@ -8,6 +8,6 @@ namespace BankDataModels.Models
double RoomPrice { get; }
int HeadwaiterId { get; }
int MealPlanId { get; }
public Dictionary<int, IDinnerModel> RoomDinners { get; }
public Dictionary<int, ICreditModel> RoomDinners { get; }
}
}