Добавьте файлы проекта.
This commit is contained in:
parent
fc58b7617c
commit
258724652b
43
TourCompany.sln
Normal file
43
TourCompany.sln
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33516.290
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TourCompanyContracts", "TourCompanyContracts\TourCompanyContracts.csproj", "{1C9D15EE-1E71-459A-B41A-FEA3D8E54C09}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TourCompanyDataModels", "TourCompanyDataModels\TourCompanyDataModels.csproj", "{D207F1E7-0345-42EC-B132-22B02245EC8B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TourCompanyBusinessLogic", "TourCompanyBusinessLogic\TourCompanyBusinessLogic.csproj", "{BFE0F3CB-9786-4F6D-92FC-481FE679AD86}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TourCompanyDatabaseImplement", "TourCompanyDatabaseImplement\TourCompanyDatabaseImplement.csproj", "{A4E4547E-B6F7-467F-AB69-2BB335684BA2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1C9D15EE-1E71-459A-B41A-FEA3D8E54C09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1C9D15EE-1E71-459A-B41A-FEA3D8E54C09}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1C9D15EE-1E71-459A-B41A-FEA3D8E54C09}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1C9D15EE-1E71-459A-B41A-FEA3D8E54C09}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D207F1E7-0345-42EC-B132-22B02245EC8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D207F1E7-0345-42EC-B132-22B02245EC8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D207F1E7-0345-42EC-B132-22B02245EC8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D207F1E7-0345-42EC-B132-22B02245EC8B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BFE0F3CB-9786-4F6D-92FC-481FE679AD86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BFE0F3CB-9786-4F6D-92FC-481FE679AD86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BFE0F3CB-9786-4F6D-92FC-481FE679AD86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BFE0F3CB-9786-4F6D-92FC-481FE679AD86}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A4E4547E-B6F7-467F-AB69-2BB335684BA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A4E4547E-B6F7-467F-AB69-2BB335684BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A4E4547E-B6F7-467F-AB69-2BB335684BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A4E4547E-B6F7-467F-AB69-2BB335684BA2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4AD4809C-075B-453F-B1E2-A6EA4597F3B2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
109
TourCompanyBusinessLogic/BusinessLogics/ExecurtionLogic.cs
Normal file
109
TourCompanyBusinessLogic/BusinessLogics/ExecurtionLogic.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.StoragesContracts;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class ExecurtionLogic : IExecurtionLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IExecurtionStorage _execurtionStorage;
|
||||
public ExecurtionLogic(ILogger<ExecurtionLogic> logger, IExecurtionStorage execurtionStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_execurtionStorage = execurtionStorage;
|
||||
}
|
||||
public List<ExecurtionViewModel>? ReadList(ExecurtionSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Purpose:{Purpose}. Id:{ Id}", model?.Purpose, model?.Id);
|
||||
var list = model == null ? _execurtionStorage.GetFullList() : _execurtionStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public ExecurtionViewModel? ReadElement(ExecurtionSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. Purpose:{Purpose}. Id:{ Id}", model.Purpose, model.Id);
|
||||
var element = _execurtionStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(ExecurtionBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_execurtionStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(ExecurtionBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_execurtionStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(ExecurtionBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_execurtionStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(ExecurtionBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Purpose))
|
||||
{
|
||||
throw new ArgumentNullException("Нет цели экскурсии", nameof(model.Purpose));
|
||||
}
|
||||
_logger.LogInformation("Execurtion. Purpose:{Purpose}. Id: { Id}", model.Purpose, model.Id);
|
||||
var element = _execurtionStorage.GetElement(new ExecurtionSearchModel
|
||||
{
|
||||
Purpose = model.Purpose
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
119
TourCompanyBusinessLogic/BusinessLogics/GidLogic.cs
Normal file
119
TourCompanyBusinessLogic/BusinessLogics/GidLogic.cs
Normal file
@ -0,0 +1,119 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.StoragesContracts;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class GidLogic : IGidLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IGidStorage _gidStorage;
|
||||
public GidLogic(ILogger<GidLogic> logger, IGidStorage gidStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_gidStorage = gidStorage;
|
||||
}
|
||||
public List<GidViewModel>? ReadList(GidSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. UserId:{UserId}. ExecurtionId:{ExecurtionId}. TripId:{TripId}. Id: { Id}", model?.UserId, model?.ExecurtionId, model?.TripId, model?.Id);
|
||||
var list = model == null ? _gidStorage.GetFullList() : _gidStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public GidViewModel? ReadElement(GidSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.UserId:{UserId}. ExecurtionId:{ExecurtionId}. TripId:{TripId}. Id: { Id}", model.UserId, model.ExecurtionId, model.TripId, model.Id);
|
||||
var element = _gidStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(GidBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_gidStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(GidBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_gidStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(GidBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_gidStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(GidBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.TripId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа поездки", nameof(model.TripId));
|
||||
}
|
||||
if (model.UserId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа пользователя", nameof(model.UserId));
|
||||
}
|
||||
if (model.ExecurtionId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа экскурсии", nameof(model.ExecurtionId));
|
||||
}
|
||||
_logger.LogInformation("Gid. UserId:{UserId}. ExecurtionId:{ExecurtionId}. TripId:{TripId}. Id: { Id}", model.UserId, model.ExecurtionId, model.TripId, model.Id);
|
||||
var element = _gidStorage.GetElement(new GidSearchModel
|
||||
{
|
||||
TripId = model.TripId,
|
||||
UserId = model.UserId,
|
||||
ExecurtionId = model.ExecurtionId
|
||||
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
114
TourCompanyBusinessLogic/BusinessLogics/PlaceVisitLogic.cs
Normal file
114
TourCompanyBusinessLogic/BusinessLogics/PlaceVisitLogic.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.StoragesContracts;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class PlaceVisitLogic : IPlaceVisitLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPlaceVisitStorage _placeVisitStorage;
|
||||
public PlaceVisitLogic(ILogger<PlaceVisitLogic> logger, IPlaceVisitStorage placeVisitStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_placeVisitStorage = placeVisitStorage;
|
||||
}
|
||||
public List<PlaceVisitViewModel>? ReadList(PlaceVisitSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. UserId:{UserId}. TourGroupId:{TourGroupId}. Id: { Id}", model?.UserId, model?.TourGroupId, model?.Id);
|
||||
var list = model == null ? _placeVisitStorage.GetFullList() : _placeVisitStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public PlaceVisitViewModel? ReadElement(PlaceVisitSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.UserId:{UserId}. TourGroupId:{TourGroupId}. Id: { Id}", model.UserId, model.TourGroupId, model.Id);
|
||||
var element = _placeVisitStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(PlaceVisitBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_placeVisitStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(PlaceVisitBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_placeVisitStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(PlaceVisitBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_placeVisitStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(PlaceVisitBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.UserId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа пользователя", nameof(model.UserId));
|
||||
}
|
||||
if (model.TourGroupId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа тур группы", nameof(model.TourGroupId));
|
||||
}
|
||||
_logger.LogInformation("PlaceVisit. UserId:{UserId}. TourGroupId:{TourGroupId}. Id: { Id}", model.UserId, model.TourGroupId, model.Id);
|
||||
var element = _placeVisitStorage.GetElement(new PlaceVisitSearchModel
|
||||
{
|
||||
UserId = model.UserId,
|
||||
TourGroupId = model.TourGroupId
|
||||
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
TourCompanyBusinessLogic/BusinessLogics/ReportLogic.cs
Normal file
13
TourCompanyBusinessLogic/BusinessLogics/ReportLogic.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class ReportLogic //: IReportLogic
|
||||
{
|
||||
}
|
||||
}
|
110
TourCompanyBusinessLogic/BusinessLogics/TourGroupLogic.cs
Normal file
110
TourCompanyBusinessLogic/BusinessLogics/TourGroupLogic.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.StoragesContracts;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class TourGroupLogic : ITourGroupLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ITourGroupStorage _tourGroupStorage;
|
||||
public TourGroupLogic(ILogger<TourGroupLogic> logger, ITourGroupStorage tourGroupStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_tourGroupStorage = tourGroupStorage;
|
||||
}
|
||||
public List<TourGroupViewModel>? ReadList(TourGroupSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. UserId:{UserId}. Id: { Id}", model?.UserId, model?.Id);
|
||||
var list = model == null ? _tourGroupStorage.GetFullList() : _tourGroupStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public TourGroupViewModel? ReadElement(TourGroupSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.UserId:{UserId}. Id: { Id}", model.UserId, model.Id);
|
||||
var element = _tourGroupStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(TourGroupBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_tourGroupStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(TourGroupBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_tourGroupStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(TourGroupBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_tourGroupStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(TourGroupBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.UserId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа пользователя", nameof(model.UserId));
|
||||
}
|
||||
|
||||
_logger.LogInformation("TourGroup. UserId:{UserId}. Id: { Id}", model.UserId, model.Id);
|
||||
var element = _tourGroupStorage.GetElement(new TourGroupSearchModel
|
||||
{
|
||||
UserId = model.UserId
|
||||
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
110
TourCompanyBusinessLogic/BusinessLogics/TourLogic.cs
Normal file
110
TourCompanyBusinessLogic/BusinessLogics/TourLogic.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.StoragesContracts;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class TourLogic : ITourLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ITourStorage _tourStorage;
|
||||
public TourLogic(ILogger<TourLogic> logger, ITourStorage tourStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_tourStorage = tourStorage;
|
||||
}
|
||||
public List<TourViewModel>? ReadList(TourSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. UserId:{UserId}. Id: { Id}", model?.UserId, model?.Id);
|
||||
var list = model == null ? _tourStorage.GetFullList() : _tourStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public TourViewModel? ReadElement(TourSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.UserId:{UserId}. Id: { Id}", model.UserId, model.Id);
|
||||
var element = _tourStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(TourBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_tourStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(TourBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_tourStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(TourBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_tourStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(TourBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.UserId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа пользователя", nameof(model.UserId));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Tour. UserId:{UserId}. Id: { Id}", model.UserId, model.Id);
|
||||
var element = _tourStorage.GetElement(new TourSearchModel
|
||||
{
|
||||
UserId = model.UserId
|
||||
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
110
TourCompanyBusinessLogic/BusinessLogics/TripLogic.cs
Normal file
110
TourCompanyBusinessLogic/BusinessLogics/TripLogic.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.StoragesContracts;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class TripLogic : ITripLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ITripStorage _tripStorage;
|
||||
public TripLogic(ILogger<TripLogic> logger, ITripStorage tripStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_tripStorage = tripStorage;
|
||||
}
|
||||
public List<TripViewModel>? ReadList(TripSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. UserId:{UserId}. Id: { Id}", model?.UserId, model?.Id);
|
||||
var list = model == null ? _tripStorage.GetFullList() : _tripStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public TripViewModel? ReadElement(TripSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.UserId:{UserId}. Id: { Id}", model.UserId, model.Id);
|
||||
var element = _tripStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(TripBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_tripStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(TripBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_tripStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(TripBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_tripStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(TripBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.UserId == null)
|
||||
{
|
||||
throw new ArgumentNullException("нет внешнего ключа пользователя", nameof(model.UserId));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Trip. UserId:{UserId}. Id: { Id}", model.UserId, model.Id);
|
||||
var element = _tripStorage.GetElement(new TripSearchModel
|
||||
{
|
||||
UserId = model.UserId
|
||||
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Компонент с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
TourCompanyBusinessLogic/BusinessLogics/UserLogic.cs
Normal file
104
TourCompanyBusinessLogic/BusinessLogics/UserLogic.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.BusinessLogicsContracts;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.StoragesContracts;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyBusinessLogic.BusinessLogics
|
||||
{
|
||||
internal class UserLogic : IUserLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUserStorage _userStorage;
|
||||
public UserLogic(ILogger<UserLogic> logger, IUserStorage userStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_userStorage = userStorage;
|
||||
}
|
||||
public List<UserViewModel>? ReadList(UserSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. FIO:{FIO}. Id: { Id}", model?.FIO, model?.Id);
|
||||
var list = model == null ? _userStorage.GetFullList() : _userStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public UserViewModel? ReadElement(UserSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.FIO:{FIO}. Id: { Id}", model.FIO, model.Id);
|
||||
var element = _userStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_userStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_userStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. FIO:{FIO}. Id: { Id}", model.FIO, model.Id);
|
||||
if (_userStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(UserBindingModel model, bool withParams = true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("User. FIO:{FIO}. Id: { Id}", model.FIO, model.Id);
|
||||
var element = _userStorage.GetElement(new UserSearchModel
|
||||
{
|
||||
FIO = model.FIO
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Пользователь уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
TourCompanyBusinessLogic/Class1.cs
Normal file
7
TourCompanyBusinessLogic/Class1.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace TourCompanyBusinessLogic
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
17
TourCompanyBusinessLogic/TourCompanyBusinessLogic.csproj
Normal file
17
TourCompanyBusinessLogic/TourCompanyBusinessLogic.csproj
Normal file
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TourCompanyContracts\TourCompanyContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
26
TourCompanyContracts/BindingModels/ExecurtionBindingModel.cs
Normal file
26
TourCompanyContracts/BindingModels/ExecurtionBindingModel.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class ExecurtionBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Purpose { get; set; } = string.Empty;
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int GidId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public string TourName { get; set; } = string.Empty;
|
||||
|
||||
public Dictionary<int, (ITourModel, decimal)> ExecurtionTours { get; set; } = new();
|
||||
}
|
||||
}
|
25
TourCompanyContracts/BindingModels/GidBindingModel.cs
Normal file
25
TourCompanyContracts/BindingModels/GidBindingModel.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class GidBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
|
||||
public int Experion { get; set; }
|
||||
|
||||
public int TripId { get; set; }
|
||||
public string TripName { get; set; } = string.Empty;
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int ExecurtionId { get; set; }
|
||||
}
|
||||
}
|
25
TourCompanyContracts/BindingModels/PlaceVisitBindingModel.cs
Normal file
25
TourCompanyContracts/BindingModels/PlaceVisitBindingModel.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class PlaceVisitBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string PlaceVisitName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TourGroupId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
// Dictionary<ID, (Название, Цена)>
|
||||
public Dictionary<int, (ITripModel, decimal)> PlaceVisitTrips { get; set; } = new();
|
||||
}
|
||||
}
|
14
TourCompanyContracts/BindingModels/ReportBindingModel.cs
Normal file
14
TourCompanyContracts/BindingModels/ReportBindingModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class ReportBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
}
|
||||
}
|
24
TourCompanyContracts/BindingModels/TourBindingModel.cs
Normal file
24
TourCompanyContracts/BindingModels/TourBindingModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class TourBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string TourName { get; set; } = string.Empty;
|
||||
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public Dictionary<int, (IExecurtionModel, DateTime)> ExecurtionTours { get; set; } = new();
|
||||
|
||||
public Dictionary<ITourGroupModel, decimal> TourGroups { get; set; } = new();
|
||||
}
|
||||
}
|
22
TourCompanyContracts/BindingModels/TourGroupBindingModel.cs
Normal file
22
TourCompanyContracts/BindingModels/TourGroupBindingModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using TourCompanyDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class TourGroupBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Number { get; set; } = string.Empty;
|
||||
|
||||
public TourType Type { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
public Dictionary<int, (ITourModel, decimal)> TourGroupTours { get; set; } = new();
|
||||
}
|
||||
}
|
27
TourCompanyContracts/BindingModels/TripBindingModel.cs
Normal file
27
TourCompanyContracts/BindingModels/TripBindingModel.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class TripBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string TripName { get; set; } = string.Empty;
|
||||
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
public Dictionary<int, (IPlaceVisitModel, int)> TripPlaceVisits
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
20
TourCompanyContracts/BindingModels/UserBindingModel.cs
Normal file
20
TourCompanyContracts/BindingModels/UserBindingModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.BindingModels
|
||||
{
|
||||
public class UserBindingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IExecurtionLogic
|
||||
{
|
||||
List<ExecurtionViewModel>? ReadList(ExecurtionSearchModel? model);
|
||||
ExecurtionViewModel? ReadElement(ExecurtionSearchModel model);
|
||||
bool Create(ExecurtionBindingModel model);
|
||||
bool Update(ExecurtionBindingModel model);
|
||||
bool Delete(ExecurtionBindingModel model);
|
||||
}
|
||||
}
|
20
TourCompanyContracts/BusinessLogicsContracts/IGidLogic.cs
Normal file
20
TourCompanyContracts/BusinessLogicsContracts/IGidLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IGidLogic
|
||||
{
|
||||
List<GidViewModel>? ReadList(GidSearchModel? model);
|
||||
GidViewModel? ReadElement(GidSearchModel model);
|
||||
bool Create(GidBindingModel model);
|
||||
bool Update(GidBindingModel model);
|
||||
bool Delete(GidBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IPlaceVisitLogic
|
||||
{
|
||||
List<PlaceVisitViewModel>? ReadList(PlaceVisitSearchModel? model);
|
||||
PlaceVisitViewModel? ReadElement(PlaceVisitSearchModel model);
|
||||
bool Create(PlaceVisitBindingModel model);
|
||||
bool Update(PlaceVisitBindingModel model);
|
||||
bool Delete(PlaceVisitBindingModel model);
|
||||
}
|
||||
}
|
23
TourCompanyContracts/BusinessLogicsContracts/IReportLogic.cs
Normal file
23
TourCompanyContracts/BusinessLogicsContracts/IReportLogic.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IReportLogic
|
||||
{
|
||||
|
||||
List<ReportViewModel> GetTour(ReportBindingModel model);
|
||||
|
||||
void SavePlaceVisitsToWordFile(ReportBindingModel model);
|
||||
|
||||
void SavePlaceVisitToExcelFile(ReportBindingModel model);
|
||||
|
||||
void SaveTourToPdfFile(ReportBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ITourGroupLogic
|
||||
{
|
||||
List<TourGroupViewModel>? ReadList(TourGroupSearchModel? model);
|
||||
TourGroupViewModel? ReadElement(TourGroupSearchModel model);
|
||||
bool Create(TourGroupBindingModel model);
|
||||
bool Update(TourGroupBindingModel model);
|
||||
bool Delete(TourGroupBindingModel model);
|
||||
}
|
||||
}
|
20
TourCompanyContracts/BusinessLogicsContracts/ITourLogic.cs
Normal file
20
TourCompanyContracts/BusinessLogicsContracts/ITourLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ITourLogic
|
||||
{
|
||||
List<TourViewModel>? ReadList(TourSearchModel? model);
|
||||
TourViewModel? ReadElement(TourSearchModel model);
|
||||
bool Create(TourBindingModel model);
|
||||
bool Update(TourBindingModel model);
|
||||
bool Delete(TourBindingModel model);
|
||||
}
|
||||
}
|
20
TourCompanyContracts/BusinessLogicsContracts/ITripLogic.cs
Normal file
20
TourCompanyContracts/BusinessLogicsContracts/ITripLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ITripLogic
|
||||
{
|
||||
List<TripViewModel>? ReadList(TripSearchModel? model);
|
||||
TripViewModel? ReadElement(TripSearchModel model);
|
||||
bool Create(TripBindingModel model);
|
||||
bool Update(TripBindingModel model);
|
||||
bool Delete(TripBindingModel model);
|
||||
}
|
||||
}
|
20
TourCompanyContracts/BusinessLogicsContracts/IUserLogic.cs
Normal file
20
TourCompanyContracts/BusinessLogicsContracts/IUserLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IUserLogic
|
||||
{
|
||||
List<UserViewModel>? ReadList(UserSearchModel? model);
|
||||
UserViewModel? ReadElement(UserSearchModel model);
|
||||
bool Create(UserBindingModel model);
|
||||
bool Update(UserBindingModel model);
|
||||
bool Delete(UserBindingModel model);
|
||||
}
|
||||
}
|
7
TourCompanyContracts/Class1.cs
Normal file
7
TourCompanyContracts/Class1.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace TourCompanyContracts
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
21
TourCompanyContracts/SearchModels/ExecurtionSearchModel.cs
Normal file
21
TourCompanyContracts/SearchModels/ExecurtionSearchModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.SearchModels
|
||||
{
|
||||
public class ExecurtionSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Purpose { get; set; } = string.Empty;
|
||||
|
||||
public int? GidId { get; set; }
|
||||
|
||||
public int? UserId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
19
TourCompanyContracts/SearchModels/GidSearchModel.cs
Normal file
19
TourCompanyContracts/SearchModels/GidSearchModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.SearchModels
|
||||
{
|
||||
public class GidSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? TripId { get; set; }
|
||||
|
||||
public int? UserId { get; set; }
|
||||
|
||||
public int? ExecurtionId { get; set; }
|
||||
}
|
||||
}
|
20
TourCompanyContracts/SearchModels/PlaceVisitSearchModel.cs
Normal file
20
TourCompanyContracts/SearchModels/PlaceVisitSearchModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.SearchModels
|
||||
{
|
||||
public class PlaceVisitSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? TourGroupId { get; set; }
|
||||
|
||||
public int? UserId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? DateTo { get; set; }
|
||||
}
|
||||
}
|
14
TourCompanyContracts/SearchModels/TourGroupSearchModel.cs
Normal file
14
TourCompanyContracts/SearchModels/TourGroupSearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.SearchModels
|
||||
{
|
||||
public class TourGroupSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
}
|
||||
}
|
14
TourCompanyContracts/SearchModels/TourSearchModel.cs
Normal file
14
TourCompanyContracts/SearchModels/TourSearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.SearchModels
|
||||
{
|
||||
public class TourSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
}
|
||||
}
|
14
TourCompanyContracts/SearchModels/TripSearchModel.cs
Normal file
14
TourCompanyContracts/SearchModels/TripSearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.SearchModels
|
||||
{
|
||||
public class TripSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int? UserId { get; set; }
|
||||
}
|
||||
}
|
15
TourCompanyContracts/SearchModels/UserSearchModel.cs
Normal file
15
TourCompanyContracts/SearchModels/UserSearchModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.SearchModels
|
||||
{
|
||||
public class UserSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? FIO { get; set; } = string.Empty;
|
||||
public string? Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
21
TourCompanyContracts/StoragesContracts/IExecurtionStorage.cs
Normal file
21
TourCompanyContracts/StoragesContracts/IExecurtionStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.StoragesContracts
|
||||
{
|
||||
public interface IExecurtionStorage
|
||||
{
|
||||
List<ExecurtionViewModel> GetFullList();
|
||||
List<ExecurtionViewModel> GetFilteredList(ExecurtionSearchModel model);
|
||||
ExecurtionViewModel? GetElement(ExecurtionSearchModel model);
|
||||
ExecurtionViewModel? Insert(ExecurtionBindingModel model);
|
||||
ExecurtionViewModel? Update(ExecurtionBindingModel model);
|
||||
ExecurtionViewModel? Delete(ExecurtionBindingModel model);
|
||||
}
|
||||
}
|
21
TourCompanyContracts/StoragesContracts/IGidStorage.cs
Normal file
21
TourCompanyContracts/StoragesContracts/IGidStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.StoragesContracts
|
||||
{
|
||||
public interface IGidStorage
|
||||
{
|
||||
List<GidViewModel> GetFullList();
|
||||
List<GidViewModel> GetFilteredList(GidSearchModel model);
|
||||
GidViewModel? GetElement(GidSearchModel model);
|
||||
GidViewModel? Insert(GidBindingModel model);
|
||||
GidViewModel? Update(GidBindingModel model);
|
||||
GidViewModel? Delete(GidBindingModel model);
|
||||
}
|
||||
}
|
21
TourCompanyContracts/StoragesContracts/IPlaceVisitStorage.cs
Normal file
21
TourCompanyContracts/StoragesContracts/IPlaceVisitStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.StoragesContracts
|
||||
{
|
||||
public interface IPlaceVisitStorage
|
||||
{
|
||||
List<PlaceVisitViewModel> GetFullList();
|
||||
List<PlaceVisitViewModel> GetFilteredList(PlaceVisitSearchModel model);
|
||||
PlaceVisitViewModel? GetElement(PlaceVisitSearchModel model);
|
||||
PlaceVisitViewModel? Insert(PlaceVisitBindingModel model);
|
||||
PlaceVisitViewModel? Update(PlaceVisitBindingModel model);
|
||||
PlaceVisitViewModel? Delete(PlaceVisitBindingModel model);
|
||||
}
|
||||
}
|
21
TourCompanyContracts/StoragesContracts/ITourGroupStorage.cs
Normal file
21
TourCompanyContracts/StoragesContracts/ITourGroupStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.StoragesContracts
|
||||
{
|
||||
public interface ITourGroupStorage
|
||||
{
|
||||
List<TourGroupViewModel> GetFullList();
|
||||
List<TourGroupViewModel> GetFilteredList(TourGroupSearchModel model);
|
||||
TourGroupViewModel? GetElement(TourGroupSearchModel model);
|
||||
TourGroupViewModel? Insert(TourGroupBindingModel model);
|
||||
TourGroupViewModel? Update(TourGroupBindingModel model);
|
||||
TourGroupViewModel? Delete(TourGroupBindingModel model);
|
||||
}
|
||||
}
|
21
TourCompanyContracts/StoragesContracts/ITourStorage.cs
Normal file
21
TourCompanyContracts/StoragesContracts/ITourStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.StoragesContracts
|
||||
{
|
||||
public interface ITourStorage
|
||||
{
|
||||
List<TourViewModel> GetFullList();
|
||||
List<TourViewModel> GetFilteredList(TourSearchModel model);
|
||||
TourViewModel? GetElement(TourSearchModel model);
|
||||
TourViewModel? Insert(TourBindingModel model);
|
||||
TourViewModel? Update(TourBindingModel model);
|
||||
TourViewModel? Delete(TourBindingModel model);
|
||||
}
|
||||
}
|
21
TourCompanyContracts/StoragesContracts/ITripStorage.cs
Normal file
21
TourCompanyContracts/StoragesContracts/ITripStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.StoragesContracts
|
||||
{
|
||||
public interface ITripStorage
|
||||
{
|
||||
List<TripViewModel> GetFullList();
|
||||
List<TripViewModel> GetFilteredList(TripSearchModel model);
|
||||
TripViewModel? GetElement(TripSearchModel model);
|
||||
TripViewModel? Insert(TripBindingModel model);
|
||||
TripViewModel? Update(TripBindingModel model);
|
||||
TripViewModel? Delete(TripBindingModel model);
|
||||
}
|
||||
}
|
21
TourCompanyContracts/StoragesContracts/IUserStorage.cs
Normal file
21
TourCompanyContracts/StoragesContracts/IUserStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyContracts.BindingModels;
|
||||
using TourCompanyContracts.SearchModels;
|
||||
using TourCompanyContracts.ViewModels;
|
||||
|
||||
namespace TourCompanyContracts.StoragesContracts
|
||||
{
|
||||
public interface IUserStorage
|
||||
{
|
||||
List<UserViewModel> GetFullList();
|
||||
List<UserViewModel> GetFilteredList(UserSearchModel model);
|
||||
UserViewModel? GetElement(UserSearchModel model);
|
||||
UserViewModel? Insert(UserBindingModel model);
|
||||
UserViewModel? Update(UserBindingModel model);
|
||||
UserViewModel? Delete(UserBindingModel model);
|
||||
}
|
||||
}
|
13
TourCompanyContracts/TourCompanyContracts.csproj
Normal file
13
TourCompanyContracts/TourCompanyContracts.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TourCompanyDataModels\TourCompanyDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
26
TourCompanyContracts/ViewModels/ExecurtionViewModel.cs
Normal file
26
TourCompanyContracts/ViewModels/ExecurtionViewModel.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class ExecurtionViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Purpose { get; set; } = string.Empty;
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int Duration { get; set; }
|
||||
|
||||
public int GidId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public Dictionary<int, (ITourModel, decimal)> ExecurtionTours { get; set; } = new();
|
||||
}
|
||||
}
|
25
TourCompanyContracts/ViewModels/GidViewModel.cs
Normal file
25
TourCompanyContracts/ViewModels/GidViewModel.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class GidViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
|
||||
public int Experion { get; set; }
|
||||
|
||||
public int TripId { get; set; }
|
||||
public string TripName { get; set; } = string.Empty;
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int ExecurtionId { get; set; }
|
||||
}
|
||||
}
|
25
TourCompanyContracts/ViewModels/PlaceVisitViewModel.cs
Normal file
25
TourCompanyContracts/ViewModels/PlaceVisitViewModel.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class PlaceVisitViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string PlaceVisitName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TourGroupId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
// Dictionary<ID, (Название, Цена)>
|
||||
public Dictionary<int, (ITripModel, decimal)> PlaceVisitTrips { get; set; } = new();
|
||||
}
|
||||
}
|
14
TourCompanyContracts/ViewModels/ReportViewModel.cs
Normal file
14
TourCompanyContracts/ViewModels/ReportViewModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class ReportViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
22
TourCompanyContracts/ViewModels/TourGroupViewModel.cs
Normal file
22
TourCompanyContracts/ViewModels/TourGroupViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using TourCompanyDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class TourGroupViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Number { get; set; } = string.Empty;
|
||||
|
||||
public TourType Type { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
public Dictionary<int, (ITourModel, decimal)> TourGroupTours { get; set; } = new();
|
||||
}
|
||||
}
|
24
TourCompanyContracts/ViewModels/TourViewModel.cs
Normal file
24
TourCompanyContracts/ViewModels/TourViewModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class TourViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string TourName { get; set; } = string.Empty;
|
||||
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public Dictionary<int, (IExecurtionModel, DateTime)> ExecurtionTours { get; set; } = new();
|
||||
|
||||
public Dictionary<ITourGroupModel, decimal> TourGroups { get; set; } = new();
|
||||
}
|
||||
}
|
27
TourCompanyContracts/ViewModels/TripViewModel.cs
Normal file
27
TourCompanyContracts/ViewModels/TripViewModel.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Models;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class TripViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string TripName { get; set; }
|
||||
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
public Dictionary<int, (IPlaceVisitModel, int)> TripPlaceVisits
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
20
TourCompanyContracts/ViewModels/UserViewModel.cs
Normal file
20
TourCompanyContracts/ViewModels/UserViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyContracts.ViewModels
|
||||
{
|
||||
public class UserViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string FIO { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
|
||||
}
|
||||
}
|
15
TourCompanyDataModels/Enums/TourType.cs
Normal file
15
TourCompanyDataModels/Enums/TourType.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyDataModels.Enums
|
||||
{
|
||||
public enum TourType
|
||||
{
|
||||
Учебный = 0,
|
||||
Гражданский = 1
|
||||
|
||||
}
|
||||
}
|
7
TourCompanyDataModels/IId.cs
Normal file
7
TourCompanyDataModels/IId.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace TourCompanyDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
26
TourCompanyDataModels/Models/IExecurtionModel.cs
Normal file
26
TourCompanyDataModels/Models/IExecurtionModel.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyDataModels.Models
|
||||
{
|
||||
public interface IExecurtionModel : IId
|
||||
{
|
||||
public string Purpose { get;}
|
||||
|
||||
public DateTime Date { get; }
|
||||
|
||||
public int Duration { get; }
|
||||
|
||||
public int GidId { get; }
|
||||
|
||||
public int UserId { get; }
|
||||
|
||||
public string TourName { get; }
|
||||
|
||||
public Dictionary<int, (ITourModel, decimal)> Tours { get; }
|
||||
}
|
||||
}
|
23
TourCompanyDataModels/Models/IGidModel.cs
Normal file
23
TourCompanyDataModels/Models/IGidModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyDataModels.Models
|
||||
{
|
||||
public interface IGidModel : IId
|
||||
{
|
||||
public string FIO { get;}
|
||||
|
||||
public int Experion { get; }
|
||||
|
||||
public int TripId { get; }
|
||||
public string TripName { get; }
|
||||
|
||||
public int UserId { get; }
|
||||
|
||||
public int ExecurtionId { get; }
|
||||
}
|
||||
}
|
22
TourCompanyDataModels/Models/IPlaceVisitModel.cs
Normal file
22
TourCompanyDataModels/Models/IPlaceVisitModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyDataModels.Models
|
||||
{
|
||||
public interface IPlaceVisitModel : IId
|
||||
{
|
||||
public string PlaceVisitName { get; }
|
||||
|
||||
public DateTime Date { get;}
|
||||
|
||||
public int TourGroupId { get; }
|
||||
|
||||
public int UserId { get; }
|
||||
|
||||
public Dictionary<int, (ITripModel, decimal)> Trips { get; }
|
||||
}
|
||||
}
|
21
TourCompanyDataModels/Models/ITourGroupModel.cs
Normal file
21
TourCompanyDataModels/Models/ITourGroupModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TourCompanyDataModels.Enums;
|
||||
|
||||
namespace TourCompanyDataModels.Models
|
||||
{
|
||||
public interface ITourGroupModel : IId
|
||||
{
|
||||
|
||||
public string Number { get; }
|
||||
|
||||
public TourType Type { get; }
|
||||
|
||||
public int UserId { get; }
|
||||
public Dictionary<int, (ITourModel, decimal)> Tours { get; }
|
||||
}
|
||||
}
|
23
TourCompanyDataModels/Models/ITourModel.cs
Normal file
23
TourCompanyDataModels/Models/ITourModel.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyDataModels.Models
|
||||
{
|
||||
public interface ITourModel : IId
|
||||
{
|
||||
|
||||
public string TourName { get; }
|
||||
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public Dictionary<int, (IExecurtionModel, DateTime)> Execurtions { get; }
|
||||
|
||||
public Dictionary<ITourGroupModel, decimal> TourGroups { get; }
|
||||
}
|
||||
}
|
21
TourCompanyDataModels/Models/ITripModel.cs
Normal file
21
TourCompanyDataModels/Models/ITripModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyDataModels.Models
|
||||
{
|
||||
public interface ITripModel : IId
|
||||
{
|
||||
public string TripName { get; }
|
||||
|
||||
public decimal Price { get; }
|
||||
|
||||
public DateTime Date { get; }
|
||||
|
||||
public int UserId { get; }
|
||||
public Dictionary<int, (IPlaceVisitModel, int)> TripPlaceVisits{ get; }
|
||||
}
|
||||
}
|
18
TourCompanyDataModels/Models/IUserModel.cs
Normal file
18
TourCompanyDataModels/Models/IUserModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TourCompanyDataModels.Models
|
||||
{
|
||||
public interface IUserModel : IId
|
||||
{
|
||||
public string FIO { get; }
|
||||
|
||||
public string Email { get; }
|
||||
|
||||
public string Password { get; }
|
||||
}
|
||||
}
|
9
TourCompanyDataModels/TourCompanyDataModels.csproj
Normal file
9
TourCompanyDataModels/TourCompanyDataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
7
TourCompanyDatabaseImplement/Class1.cs
Normal file
7
TourCompanyDatabaseImplement/Class1.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace TourCompanyDatabaseImplement
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Implements\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TourCompanyContracts\TourCompanyContracts.csproj" />
|
||||
<ProjectReference Include="..\TourCompanyDataModels\TourCompanyDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user