Compare commits

...

23 Commits

Author SHA1 Message Date
Kate
39ecbd7fc3 конец 2023-06-24 04:08:10 +03:00
Kate
eb7c8c93b1 Изменение архитектуры загрузки 2023-06-23 16:24:53 +03:00
Kate
b9c94a426f отчеты есть 2023-06-23 12:49:58 +03:00
Kate
c2143fc676 fix 2023-06-22 03:39:54 +03:00
Kate
13c761e9ba нет репортсов,но начинаю загружать 2023-06-22 03:39:37 +03:00
Kate
d840395ab6 полный круд) 2023-06-21 18:10:21 +03:00
Kate
456f0e83c4 fix 2023-06-21 16:18:23 +03:00
Kate
00e37e4ebc круд 1 сущности 2023-06-21 15:02:10 +03:00
Kate
6669e7ef01 начало crud для 1 сущности 2023-06-18 14:42:11 +03:00
c30fbc815e crud для экскурсий 2023-05-19 20:40:12 +03:00
2e0d5cff9b crud для экскурсий 2023-05-19 20:39:47 +03:00
822a89c308 настройка бд 2023-05-18 19:13:48 +03:00
Катя Ихонкина
edbab2bebf fix 2023-04-08 23:26:34 +04:00
Катя Ихонкина
2948322ba9 fix 2023-04-08 23:10:36 +04:00
Катя Ихонкина
e5b8d3c18f fix 2023-04-08 22:25:47 +04:00
Катя Ихонкина
5648b83db6 fix 2023-04-08 20:54:16 +04:00
Катя Ихонкина
472ab0164b РЕАЛИЗАЦИЯ ПРОТОТИПА ИНТЕРФЕЙСА ПОЛЬЗОВАТЕЛЯ 2023-04-08 20:50:52 +04:00
Катя Ихонкина
e991366625 конец изменений business logic 2023-04-08 10:46:21 +04:00
Катя Ихонкина
698b5e8727 Добавление ролей 2023-04-07 14:33:45 +04:00
Катя Ихонкина
7e259e227c CRUD 2023-03-19 20:50:59 +04:00
Катя Ихонкина
a58c282c6a Слой хранения 2023-03-19 18:18:27 +04:00
Катя Ихонкина
b0110227d9 Слой контрактов 2023-03-19 17:09:00 +04:00
Катя Ихонкина
ed680d11b8 Слой моделей 2023-03-19 15:37:17 +04:00
232 changed files with 84676 additions and 187 deletions

View File

@ -3,7 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32505.173
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TravelCompanyView", "TravelCompanyView\TravelCompanyView.csproj", "{A20AB5B4-A8A8-4934-9DA9-E9B9403EE53E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TravelCompany", "TravelCompanyView\TravelCompany.csproj", "{A20AB5B4-A8A8-4934-9DA9-E9B9403EE53E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TravelCompanyDataModels", "TravelCompanyDataModels\TravelCompanyDataModels.csproj", "{05666C23-CE01-45A7-AF44-F047A6E5D865}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TravelCompanyContracts", "TravelCompanyContracts\TravelCompanyContracts.csproj", "{B754C301-AA36-4AB0-B34D-E1E10238BEA0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TravelCompanyDatabaseImplement", "TravelCompanyDatabaseImplement\TravelCompanyDatabaseImplement.csproj", "{80ED2012-3D82-441E-A9A4-C636786386C3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TravelCompanyBusinessLogic", "TravelCompanyBusinessLogic\TravelCompanyBusinessLogic.csproj", "{B127A6FD-3368-490C-84B1-E0272F7C2A0A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TravelCompanyClientApp", "TravelCompanyClientApp\TravelCompanyClientApp.csproj", "{5E0F144C-A9BC-4C0D-9A6B-4B10769B142F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +25,26 @@ Global
{A20AB5B4-A8A8-4934-9DA9-E9B9403EE53E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A20AB5B4-A8A8-4934-9DA9-E9B9403EE53E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A20AB5B4-A8A8-4934-9DA9-E9B9403EE53E}.Release|Any CPU.Build.0 = Release|Any CPU
{05666C23-CE01-45A7-AF44-F047A6E5D865}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05666C23-CE01-45A7-AF44-F047A6E5D865}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05666C23-CE01-45A7-AF44-F047A6E5D865}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05666C23-CE01-45A7-AF44-F047A6E5D865}.Release|Any CPU.Build.0 = Release|Any CPU
{B754C301-AA36-4AB0-B34D-E1E10238BEA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B754C301-AA36-4AB0-B34D-E1E10238BEA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B754C301-AA36-4AB0-B34D-E1E10238BEA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B754C301-AA36-4AB0-B34D-E1E10238BEA0}.Release|Any CPU.Build.0 = Release|Any CPU
{80ED2012-3D82-441E-A9A4-C636786386C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80ED2012-3D82-441E-A9A4-C636786386C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80ED2012-3D82-441E-A9A4-C636786386C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80ED2012-3D82-441E-A9A4-C636786386C3}.Release|Any CPU.Build.0 = Release|Any CPU
{B127A6FD-3368-490C-84B1-E0272F7C2A0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B127A6FD-3368-490C-84B1-E0272F7C2A0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B127A6FD-3368-490C-84B1-E0272F7C2A0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B127A6FD-3368-490C-84B1-E0272F7C2A0A}.Release|Any CPU.Build.0 = Release|Any CPU
{5E0F144C-A9BC-4C0D-9A6B-4B10769B142F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E0F144C-A9BC-4C0D-9A6B-4B10769B142F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E0F144C-A9BC-4C0D-9A6B-4B10769B142F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E0F144C-A9BC-4C0D-9A6B-4B10769B142F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,126 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.BindingModels.OperatorBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
using TravelCompanyContracts.StoragesContracts.OperatorStoragesContracts;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.OperatorLogics
{
public class GuideLogic:IGuideLogic
{
private readonly ILogger _logger;
private readonly IGuideStorage _guideStorage;
public GuideLogic(ILogger<GuideLogic> logger, IGuideStorage guideStorage)
{
_logger = logger;
_guideStorage = guideStorage;
}
public bool Create(GuideBindingModel model)
{
CheckModel(model);
if (_guideStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(GuideBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_guideStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public GuideViewModel? ReadElement(GuideSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Surname:{Surname}.Id:{ Id}", model.Surname, model.Id);
var element = _guideStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public List<GuideViewModel>? ReadList(GuideSearchModel? model)
{
_logger.LogInformation("ReadList. Surname:{Surname}.Id:{ Id}", model?.Surname, model?.Id);
var list = model == null ? _guideStorage.GetFullList() : _guideStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
private void CheckModel(GuideBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет имени гида", nameof(model.Name));
}
if (string.IsNullOrEmpty(model.Surname))
{
throw new ArgumentNullException("Нет фамилии гида", nameof(model.Surname));
}
_logger.LogInformation("Guide. Id:{Id}.Surname:{Surname}.Name:{Name}.Patronymic:{Patronymic}.OperatorId:{OperatorId}.",
model.Id, model.Surname, model.Name, model.Patronymic, model.OperatorId);
var element = _guideStorage.GetElement(new GuideSearchModel
{
Surname = model.Surname
});
if (element != null && element.Id != model.Id && element.OperatorId == model.OperatorId)
{
throw new InvalidOperationException("Этот гид уже добавлен");
}
}
}
}

View File

@ -0,0 +1,76 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.BindingModels.OperatorBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.OperatorLogics
{
public class LoadLogic:ILoadLogic
{
private readonly IOperatorLogic _operatorLogic;
private readonly IGuideLogic _guidelogic;
private readonly ITourLogic _tourLogic;
public LoadLogic(IOperatorLogic operatorLogic, IGuideLogic guidelogic, ITourLogic tourLogic)
{
_operatorLogic = operatorLogic;
_guidelogic = guidelogic;
_tourLogic = tourLogic;
}
public List<TourBindingModel> LoadToursFromJson(string jsonFilePath)
{
string jsonData = File.ReadAllText(jsonFilePath);
var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, List<TourBindingModel>>>(jsonData);
var tours = jsonObject["tour"];
return tours;
}
public List<GuideBindingModel> LoadGuidesFromJson(string jsonFilePath)
{
string jsonData = File.ReadAllText(jsonFilePath);
var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, List<GuideBindingModel>>>(jsonData);
var guides = jsonObject["guide"];
return guides;
}
public List<OperatorBindingModel> LoadOperatorsFromJson(string jsonFilePath)
{
string jsonData = File.ReadAllText(jsonFilePath);
var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, List<OperatorBindingModel>>>(jsonData);
var operators = jsonObject["operator"];
return operators;
}
public void LoadFromJson()
{
if (_operatorLogic.ReadList(null).Count == 0)
{
string jsonFilePath = "automatic.json";
List<TourBindingModel> tours = LoadToursFromJson(jsonFilePath);
List<GuideBindingModel> guides = LoadGuidesFromJson(jsonFilePath);
List<OperatorBindingModel> operators = LoadOperatorsFromJson(jsonFilePath);
int b = 0;
foreach (var o in operators)
{
_operatorLogic.Create(o);
b = _operatorLogic.ReadElement(new OperatorSearchModel { Login = o.Login }).Id;
}
foreach (var t in tours)
{
t.OperatorId = b;
_tourLogic.Create(t);
}
foreach (var g in guides)
{
g.OperatorId = b;
_guidelogic.Create(g);
}
}
}
}
}

View File

@ -0,0 +1,118 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.BindingModels.OperatorBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
using TravelCompanyContracts.StoragesContracts.OperatorStoragesContracts;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.OperatorLogics
{
public class OperatorLogic:IOperatorLogic
{
private readonly ILogger _logger;
private readonly IOperatorStorage _operatorStorage;
public OperatorLogic(ILogger<OperatorLogic> logger, IOperatorStorage operatorStorage)
{
_logger = logger;
_operatorStorage = operatorStorage;
}
public List<OperatorViewModel>? ReadList(OperatorSearchModel? model)
{
_logger.LogInformation("ReadList. Login:{Login}.Id:{ Id}", model?.Login, model?.Id);
var list = model == null ? _operatorStorage.GetFullList() : _operatorStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public OperatorViewModel? ReadElement(OperatorSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Login:{Login}.Id:{ Id}", model?.Login, model?.Id);
var element = _operatorStorage.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(OperatorBindingModel model)
{
CheckModel(model);
if (_operatorStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(OperatorBindingModel model)
{
CheckModel(model);
if (_operatorStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(OperatorBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Login))
{
throw new ArgumentNullException("Нет логина оператора", nameof(model.Login));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет почты оператора", nameof(model.Email));
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет имени оператора", nameof(model.Name));
}
if (string.IsNullOrEmpty(model.Surname))
{
throw new ArgumentNullException("Нет фамилии оператора", nameof(model.Surname));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля оператора", nameof(model.Password));
}
if (model.BirthDay == default)
{
throw new ArgumentNullException("Нет даты рождения оператора", nameof(model.BirthDay));
}
_logger.LogInformation("Operator. Id:{Id}.Surname:{Surname}.Name:{Name}.Patronomic:{Patronomic}.BirthDay:{BirthDay}.Email:{Email}.Login:{Login}.Password:{ Password}.",
model.Id, model.Surname, model.Name, model.Patronymic, model.BirthDay, model.Email, model.Login, new string('*', model.Password.Length));
var element = _operatorStorage.GetElement(new OperatorSearchModel
{
Login = model.Login
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Оператор с таким логином уже есть");
}
}
}
}

View File

@ -0,0 +1,123 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.BindingModels.OperatorBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
using TravelCompanyContracts.StoragesContracts.OperatorStoragesContracts;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.OperatorLogics
{
public class TourLogic:ITourLogic
{
private readonly ILogger _logger;
private readonly ITourStorage _tourStorage;
public TourLogic(ILogger<TourLogic> logger, ITourStorage tourStorage)
{
_logger = logger;
_tourStorage = tourStorage;
}
public bool Create(TourBindingModel model)
{
CheckModel(model);
if (_tourStorage.Insert(model) == null)
{
_logger.LogWarning("Insert 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;
}
public TourViewModel? ReadElement(TourSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. TourName:{TourName}.Id:{ Id}", model.TourName, 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 List<TourViewModel>? ReadList(TourSearchModel? model)
{
_logger.LogInformation("ReadList. TourName:{TourName}.Id:{ Id}", model?.TourName, 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;
}
private void CheckModel(TourBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.TourName))
{
throw new ArgumentNullException("Нет названия тура", nameof(model.TourName));
}
_logger.LogInformation("Tour. Id:{Id}.TourName:{TourName}.OperatorId:{OperatorId}.",
model.Id, model.TourName, model.OperatorId);
var element = _tourStorage.GetElement(new TourSearchModel
{
TourName = model.TourName
});
if (element != null && element.Id != model.Id && element.OperatorId == model.OperatorId)
{
throw new InvalidOperationException("Тур с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,181 @@
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Charts;
using DocumentFormat.OpenXml.Presentation;
using DocumentFormat.OpenXml.Wordprocessing;
using System.Linq;
using TravelCompanyBusinessLogic.OfficePackage;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;
using TravelCompanyContracts.BindingModels;
using TravelCompanyContracts.BusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.StoragesContracts.OperatorStoragesContracts;
using TravelCompanyContracts.StoragesContracts.TouristStoragesContracts;
using TravelCompanyContracts.ViewModels;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
using TravelCompanyContracts.ViewModels.TouristViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogics
{
public class ReportLogic : IReportLogic
{
private readonly ITravelStorage travelStorage;
private readonly IExcursionStorage excursionStorage;
private readonly IGuideStorage guideStorage;
private readonly AbstractSaveToPdf saveToPdf;
private readonly AbstractSaveToWord saveToWord;
private readonly AbstractSaveToExcel saveToExcel;
public ReportLogic(ITravelStorage travelStorage, IExcursionStorage excursionStorage,
IGuideStorage guideStorage,
AbstractSaveToPdf saveToPdf, AbstractSaveToWord saveToWord, AbstractSaveToExcel saveToExcel)
{
this.travelStorage = travelStorage;
this.guideStorage = guideStorage;
this.excursionStorage = excursionStorage;
this.saveToPdf = saveToPdf;
this.saveToWord = saveToWord;
this.saveToExcel = saveToExcel;
}
public List<ReportTravelsPCView> GetTravelsPCView(ReportBindingModel model)
{
var list = new List<ReportTravelsPCView>();
var travels = travelStorage.GetFilteredList(new TravelSearchModel
{
DateFrom =model.DateAfter,
DateTo = model.DateBefore,
TouristId = model.TouristId
});
foreach (var travel in travels)
{
var record = new ReportTravelsPCView
{
DateCreate = travel.DateStart,
Excursions = new List<ExcursionViewModel>(),
Guids = new List<GuideViewModel>()
};
var excursions = travel.ExcursionTravels.Keys.ToList();
foreach (var excrsionId in excursions)
{
var excursion = excursionStorage.GetElement(new ExcursionSearchModel { Id = excrsionId });
record.Excursions.Add(excursion);
var excursionguide = excursion.GuideExcursions.Keys.ToList();
foreach (var guideId in excursionguide)
{
var guide = guideStorage.GetElement(new GuideSearchModel { Id = guideId });
record.Guids.Add(guide);
}
}
list.Add(record);
}
return list;
}
public List<ReportGuidesPCView> GetGuidesPCView(ReportBindingModel model)
{
var list = new List<ReportGuidesPCView>();
var guides = guideStorage.GetFullList();
var travels = travelStorage.GetFilteredList(new TravelSearchModel
{
TouristId= model.TouristId,
DateFrom = model.DateAfter,
DateTo = model.DateBefore,
});
foreach (var guide in guides)
{
var record = new ReportGuidesPCView
{
GuideId = guide.Id,
FIO = guide.Surname+" "+guide.Name,
Travels = new List<TravelViewModel>()
};
foreach (var travel in travels)
{
foreach(var excursion in travel.ExcursionTravels)
{
var findExcursion = excursionStorage.GetElement(new ExcursionSearchModel { Id = excursion.Key });
if (findExcursion.GuideExcursions.ContainsKey(guide.Id))
{
record.Travels.Add(travel);
break;
}
}
}
if (record.Travels.Count > 0) list.Add(record);
}
return list;
}
public List<ReportGuideView> GetGuidesByTravels(ReportBindingModel model)
{
var list = new List<ReportGuideView>();
var traveles = travelStorage.GetFilteredList(new TravelSearchModel
{
TouristId = model.TouristId
})
foreach (var travel in traveles)
{
var record = new ReportGuideView
{
Travel = travel,
Guides = new List<GuideViewModel>()
};
var travelExcursions = travel.ExcursionTravels.Keys.ToList();
foreach (var excursionId in travelExcursions)
{
var excursion = excursionStorage.GetElement(new ExcursionSearchModel { Id = excursionId });
var excursionGuides = excursion.GuideExcursions.Keys.ToList();
foreach (var guideId in excursionGuides)
{
if (record.Guides.Where(guide => guide.Id == guideId).ToList().Count == 0)
{
var guide = guideStorage.GetElement(new GuideSearchModel { Id = guideId });
record.Guides.Add(guide);
}
}
}
list.Add(record);
}
return list;
}
public void saveGuidesToPdfFile(ReportBindingModel model)
{
saveToPdf.CreateGuideDoc(new PdfInfo
{
Title = "Список гидов",
DateAfter = model.DateAfter.Value,
DateBefore = model.DateBefore.Value,
FileName = (model.FileName != null) ? model.FileName : $"C:\\Users\\Public\\Documents\\{DateTime.Now.ToString("HH.mm.ss_dd.MM.yyyy")}.pdf",
Guides = GetGuidesPCView(model)
});
}
public void saveGuidesToExcel(ReportBindingModel model)
{
saveToExcel.CreateGuidesReport(new ExcelInfo()
{
Title = "Список гидов:",
Guides = GetGuidesByTravels(model)
});
}
public void saveGuidesToWord(ReportBindingModel model)
{
saveToWord.CreateGuidesDoc(new WordInfo()
{
Title = "Список гидов",
Guides = GetGuidesByTravels(model)
});
}
}
}

View File

@ -0,0 +1,143 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.StoragesContracts.TouristStoragesContracts;
using TravelCompanyContracts.ViewModels.TouristViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.TouristLogics
{
public class ExcursionLogic : IExcursionLogic
{
private readonly ILogger _logger;
private readonly IExcursionStorage _excursionStorage;
public ExcursionLogic(ILogger<ExcursionLogic> logger, IExcursionStorage excursionStorage)
{
_logger = logger;
_excursionStorage = excursionStorage;
}
public bool Create(ExcursionBindingModel model)
{
CheckModel(model);
if (_excursionStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(ExcursionBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_excursionStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public ExcursionViewModel? ReadElement(ExcursionSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. ExcursionName:{ExcursionName}.Id:{ Id}", model.ExcursionName, model.Id);
var element = _excursionStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public List<ExcursionViewModel>? ReadList(ExcursionSearchModel? model)
{
_logger.LogInformation("ReadList. ExcursionName:{ExcursionName}.Id:{ Id}", model?.ExcursionName, model?.Id);
var list = model == null ? _excursionStorage.GetFullList() : _excursionStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Update(ExcursionBindingModel model)
{
CheckModel(model);
if (_excursionStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(ExcursionBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.ExcursionName))
{
throw new ArgumentNullException("Нет названия экскурсии", nameof(model.ExcursionName));
}
if (string.IsNullOrEmpty(model.ExcursionDescrition))
{
throw new ArgumentNullException("Нет описания экскурсии", nameof(model.ExcursionDescrition));
}
if (model.Duration <=0)
{
throw new ArgumentNullException("Недопустимая длительность экскурсии", nameof(model.Duration));
}
_logger.LogInformation("Excursion. Id:{Id}.ExcursionName:{ExcursionName}.ExcursionDescrition:{ExcursionDescrition}.Duration:{Duration}.TouristId:{TouristId}.",
model.Id, model.ExcursionName, model.ExcursionDescrition, model.Duration, model.TouristId);
var element = _excursionStorage.GetElement(new ExcursionSearchModel
{
ExcursionName = model.ExcursionName
});
if (element != null && element.Id != model.Id && element.TouristId == model.TouristId)
{
throw new InvalidOperationException("Экскурсия с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,143 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.StoragesContracts.TouristStoragesContracts;
using TravelCompanyContracts.ViewModels.TouristViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.TouristLogics
{
public class PlaceLogic : IPlaceLogic
{
private readonly ILogger _logger;
private readonly IPlaceStorage _placeStorage;
public PlaceLogic(ILogger<PlaceLogic> logger, IPlaceStorage placeStorage)
{
_logger = logger;
_placeStorage = placeStorage;
}
public bool Create(PlaceBindingModel model)
{
CheckModel(model);
if (_placeStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(PlaceBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_placeStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public PlaceViewModel? ReadElement(PlaceSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. PlaceName:{PlaceName}.Id:{ Id}", model.PlaceName, model.Id);
var element = _placeStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public List<PlaceViewModel>? ReadList(PlaceSearchModel? model)
{
_logger.LogInformation("ReadList. PlaceName:{PlaceName}.Id:{ Id}", model?.PlaceName, model?.Id);
var list = model == null ? _placeStorage.GetFullList() : _placeStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Update(PlaceBindingModel model)
{
CheckModel(model);
if (_placeStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(PlaceBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.PlaceName))
{
throw new ArgumentNullException("Нет названия места", nameof(model.PlaceName));
}
if (string.IsNullOrEmpty(model.PlaceAddress))
{
throw new ArgumentNullException("Нет адрес места", nameof(model.PlaceAddress));
}
if(model.ExcursionId < 0)
{
throw new ArgumentNullException("Нет экскурсии места", nameof(model.PlaceAddress));
}
_logger.LogInformation("Place. Id:{Id}.PlaceName:{PlaceName}.PlaceAddress:{PlaceAddress}.ExcursionId:{ExcursionId}.TouristId:{TouristId}.",
model.Id, model.PlaceName, model.PlaceAddress, model.ExcursionId, model.TouristId);
var element = _placeStorage.GetElement(new PlaceSearchModel
{
PlaceName = model.PlaceName
});
if (element != null && element.Id != model.Id && element.TouristId == model.TouristId)
{
throw new InvalidOperationException("Место с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,133 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyBusinessLogic.MailWorker;
using TravelCompanyContracts.BindingModels;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.StoragesContracts.TouristStoragesContracts;
using TravelCompanyContracts.ViewModels.TouristViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.TouristLogics
{
public class TouristLogic:ITouristLogic
{
private readonly ILogger _logger;
private readonly ITouristStorage _touristStorage;
private readonly AbstractMailWorker _mailWorker;
public TouristLogic(ILogger<TouristLogic> logger, ITouristStorage touristStorage, AbstractMailWorker mailWorker)
{
_logger = logger;
_touristStorage = touristStorage;
_mailWorker = mailWorker;
}
public List<TouristViewModel>? ReadList(TouristSearchModel? model)
{
_logger.LogInformation("ReadList. Login:{Login}.Id:{ Id}", model?.Login, model?.Id);
var list = model == null ? _touristStorage.GetFullList() : _touristStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public TouristViewModel? ReadElement(TouristSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Login:{Login}.Id:{ Id}", model?.Login, model?.Id);
var element = _touristStorage.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(TouristBindingModel model)
{
CheckModel(model);
if (_touristStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Update(TouristBindingModel model)
{
CheckModel(model);
if (_touristStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
public bool SendMail(MailSendInfoBindingModel emailInfo)
{
_mailWorker.MailSendAsync(new()
{
MailAddress = emailInfo.MailAddress,
Subject = emailInfo.Subject,
Path = emailInfo.Path,
});
return true;
}
private void CheckModel(TouristBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.Login))
{
throw new ArgumentNullException("Нет логина туриста", nameof(model.Login));
}
if (string.IsNullOrEmpty(model.Email))
{
throw new ArgumentNullException("Нет почты туриста", nameof(model.Email));
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет имени туриста", nameof(model.Name));
}
if (string.IsNullOrEmpty(model.Surname))
{
throw new ArgumentNullException("Нет фамилии туриста", nameof(model.Surname));
}
if (string.IsNullOrEmpty(model.Password))
{
throw new ArgumentNullException("Нет пароля туриста", nameof(model.Password));
}
if ((DateTime.Now - model.BirthDay).Days/365<18)
{
throw new ArgumentNullException("Неверная дата рождения туриста", nameof(model.BirthDay));
}
_logger.LogInformation("Tourist. Id:{Id}.Surname:{Surname}.Name:{Name}.Patronomic:{Patronomic}.BirthDay:{BirthDay}.Email:{Email}.Login:{Login}.Password:{ Password}.",
model.Id, model.Surname, model.Name, model.Patronymic, model.BirthDay, model.Email, model.Login, new string('*', model.Password.Length));
var element = _touristStorage.GetElement(new TouristSearchModel
{
Login = model.Login
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Турист с таким логином уже есть");
}
}
}
}

View File

@ -0,0 +1,148 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.StoragesContracts.TouristStoragesContracts;
using TravelCompanyContracts.ViewModels.TouristViewModels;
namespace TravelCompanyBusinessLogic.BusinessLogic.TouristLogics
{
public class TravelLogic : ITravelLogic
{
private readonly ILogger _logger;
private readonly ITravelStorage _travelStorage;
public TravelLogic(ILogger<TravelLogic> logger, ITravelStorage travelStorage)
{
_logger = logger;
_travelStorage = travelStorage;
}
public bool Create(TravelBindingModel model)
{
CheckModel(model);
if (_travelStorage.Insert(model) == null)
{
_logger.LogWarning("Insert operation failed");
return false;
}
return true;
}
public bool Delete(TravelBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_travelStorage.Delete(model) == null)
{
_logger.LogWarning("Delete operation failed");
return false;
}
return true;
}
public TravelViewModel? ReadElement(TravelSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. TravelName:{TravelName}.Id:{ Id}", model.TravelName, model.Id);
var element = _travelStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public List<TravelViewModel>? ReadList(TravelSearchModel? model)
{
_logger.LogInformation("ReadList. TravelName:{TravelName}.Id:{ Id}", model?.TravelName, model?.Id);
var list = model == null ? _travelStorage.GetFullList() : _travelStorage.GetFilteredList(model);
if (list == null)
{
_logger.LogWarning("ReadList return null list");
return null;
}
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
public bool Update(TravelBindingModel model)
{
CheckModel(model);
if (_travelStorage.Update(model) == null)
{
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
private void CheckModel(TravelBindingModel model, bool withParams = true)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
if (!withParams)
{
return;
}
if (string.IsNullOrEmpty(model.TravelName))
{
throw new ArgumentNullException("Нет названия путешествия", nameof(model.TravelName));
}
if (string.IsNullOrEmpty(model.TravelDescription))
{
throw new ArgumentNullException("Нет описания путешествия", nameof(model.TravelDescription));
}
if (model.DateStart == default)
{
throw new ArgumentNullException("Нет даты начала путешествия", nameof(model.DateStart));
}
if (model.TourTravels == null || model.TourTravels.Count == 0)
{
throw new ArgumentException("Нет туров путешествия", nameof(model.TourTravels));
}
_logger.LogInformation("Travel. Id:{Id}.TravelName:{TravelName}.TravelDescription:{TravelDescription}.DateStart:{DateStart}.TouristId:{TouristId}.",
model.Id, model.TravelName, model.TravelDescription, model.DateStart, model.TouristId);
var element = _travelStorage.GetElement(new TravelSearchModel
{
TravelName = model.TravelName
});
if (element != null && element.Id != model.Id && element.TouristId == model.TouristId)
{
throw new InvalidOperationException("Путешествие с таким названием уже есть");
}
}
}
}

View File

@ -0,0 +1,51 @@
using Microsoft.Extensions.Logging;
using TravelCompanyContracts.BindingModels;
namespace TravelCompanyBusinessLogic.MailWorker
{
public abstract class AbstractMailWorker
{
protected string _mailLogin = string.Empty;
protected string _mailPassword = string.Empty;
protected string _smtpClientHost = string.Empty;
protected int _smtpClientPort;
protected string _popHost = string.Empty;
protected int _popPort;
public AbstractMailWorker()
{
}
public void MailConfig(MailConfigBindingModel config)
{
_mailLogin = config.MailLogin;
_mailPassword = config.MailPassword;
_smtpClientHost = config.SmtpClientHost;
_smtpClientPort = config.SmtpClientPort;
_popHost = config.PopHost;
_popPort = config.PopPort;
}
public async void MailSendAsync(MailSendInfoBindingModel info)
{
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
{
return;
}
if (string.IsNullOrEmpty(_smtpClientHost) || _smtpClientPort == 0)
{
return;
}
if (string.IsNullOrEmpty(info.MailAddress) || string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Path))
{
return;
}
await SendMailAsync(info);
}
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
}
}

View File

@ -0,0 +1,42 @@

using MailKit.Net.Pop3;
using MailKit.Security;
using Microsoft.Extensions.Logging;
using System.Net.Mail;
using System.Net;
using System.Text;
using TravelCompanyContracts.BindingModels;
namespace TravelCompanyBusinessLogic.MailWorker
{
public class MailKitWorker : AbstractMailWorker
{
public MailKitWorker() { }
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
{
using var objMailMessage = new MailMessage();
using var objSmtpClient = new SmtpClient(_smtpClientHost, _smtpClientPort);
try
{
objMailMessage.From = new MailAddress(_mailLogin);
objMailMessage.To.Add(new MailAddress(info.MailAddress));
objMailMessage.Subject = info.Subject;
objMailMessage.Attachments.Add(new Attachment(info.Path));
objMailMessage.SubjectEncoding = Encoding.UTF8;
objMailMessage.BodyEncoding = Encoding.UTF8;
objSmtpClient.UseDefaultCredentials = false;
objSmtpClient.EnableSsl = true;
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
await Task.Run(() => objSmtpClient.Send(objMailMessage));
}
catch (Exception)
{
throw;
}
}
}
}

View File

@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.EMMA;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;
namespace TravelCompanyBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToExcel
{
public void CreateGuidesReport(ExcelInfo info)
{
CreateExcel(info);
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = 1,
Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "A1",
CellToName = "C1"
});
uint rowIndex = 2;
foreach (var reportGuideView in info.Guides)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "Путешествие:",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "A" + rowIndex,
CellToName = "B" + rowIndex
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = $"{reportGuideView.Travel.TravelName}",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "D",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "C" + rowIndex,
CellToName = "D" + rowIndex
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "E",
RowIndex = rowIndex,
Text = $"{reportGuideView.Travel.DateStart}",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "F",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "E" + rowIndex,
CellToName = "F" + rowIndex
});
rowIndex++;
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "Гиды:",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
foreach (var guide in reportGuideView.Guides)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = $"{guide.Surname} {guide.Name} {guide.Patronymic}",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "D",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "E",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "F",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.TextWithBroder
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "B" + rowIndex,
CellToName = "F" + rowIndex
});
rowIndex++;
}
}
SaveExcel(info);
}
protected abstract void CreateExcel(ExcelInfo info);
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
protected abstract void MergeCells(ExcelMergeParameters excelParams);
protected abstract void SaveExcel(ExcelInfo info);
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;
namespace TravelCompanyBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToPdf
{
public void CreateGuideDoc(PdfInfo info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph
{
Text = info.Title,
Style = "NormalTitle"
});
CreateParagraph(new PdfParagraph
{
Text = $"с {info.DateAfter.ToShortDateString()} по {info.DateBefore.ToShortDateString()}",
Style = "Normal"
});
CreateTable(new List<string> { "2cm", "4cm", "2cm", "4cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "№", "Гид", "Номер","Путешествие", "Дата начала путешествия" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var guide in info.Guides)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { guide.GuideId.ToString(), guide.FIO.ToString() ,"", "", ""},
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
foreach (var travel in guide.Travels)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "", "", travel.Id.ToString(), travel.TravelName, travel.DateStart.ToShortDateString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
}
SavePdf(info);
}
protected abstract void CreatePdf(PdfInfo info);
protected abstract void CreateParagraph(PdfParagraph paragraph);
protected abstract void CreateTable(List<string> columns);
protected abstract void CreateRow(PdfRowParameters rowParameters);
protected abstract void SavePdf(PdfInfo info);
}
}

View File

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.EMMA;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;
namespace TravelCompanyBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
public void CreateGuidesDoc(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
foreach (var reportGuideView in info.Guides)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{
("Путешествие: ", new WordTextProperties { Bold = true, Size = "26" }),
(reportGuideView.Travel.TravelName, new WordTextProperties { Bold = false, Size = "24" }),
(" Дата начала путешествия: ", new WordTextProperties { Bold = true, Size = "24" }),
(reportGuideView.Travel.DateStart.ToString(), new WordTextProperties { Bold = false, Size = "24" })
},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{
("Гиды путешествия: ", new WordTextProperties { Bold = true, Size = "24" })
},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
foreach (var guide in reportGuideView.Guides)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{
($"{guide.Surname} {guide.Name} {guide.Patronymic}", new WordTextProperties { Bold = false, Size = "24" })
},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
}
}
SaveWord(info);
}
protected abstract void CreateWord(WordInfo info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfo info);
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperEnums
{
public enum ExcelStyleInfoType
{
Title,
Text,
TextWithBroder
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperEnums
{
public enum PdfParagraphAlignmentType
{
Center,
Left
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperEnums
{
public enum WordJustificationType
{
Center,
Both
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class ExcelCellParameters
{
public string ColumnName { get; set; }
public uint RowIndex { get; set; }
public string Text { get; set; }
public string CellReference => $"{ColumnName}{RowIndex}";
public ExcelStyleInfoType StyleInfo { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.ViewModels;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class ExcelInfo
{
public string FileName = $"C:\\Users\\Public\\Documents\\{DateTime.Now.ToString("HH.mm.ss_dd.MM.yyyy")}.xlsx";
public string Title { get; set; }
public List<ReportGuideView> Guides { get; set; }
public List<ReportExcursionView> Excursions { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class ExcelMergeParameters
{
public string CellFromName { get; set; }
public string CellToName { get; set; }
public string Merge => $"{CellFromName}:{CellToName}";
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.ViewModels;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class PdfInfo
{
public string FileName = $"C:\\Users\\Public\\Documents\\{DateTime.Now.ToString("HH.mm.ss_dd.MM.yyyy")}.pdf";
public string Title { get; set; }
public DateTime DateAfter { get; set; }
public DateTime DateBefore { get; set; }
public List<ReportTravelsPCView> Traveles { get; set; }
public List<ReportGuidesPCView> Guides { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class PdfParagraph
{
public string Text { get; set; }
public string Style { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class PdfRowParameters
{
public List<string> Texts { get; set; }
public string Style { get; set; }
public PdfParagraphAlignmentType ParagraphAlignment { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyContracts.ViewModels;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class WordInfo
{
public string FileName = $"C:\\Users\\Public\\Documents\\{DateTime.Now.ToString("HH.mm.ss_dd.MM.yyyy")}.docx";
public string Title { get; set; }
public List<ReportGuideView> Guides { get; set; }
public List<ReportExcursionView> Excursions { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class WordParagraph
{
public List<(string, WordTextProperties)> Texts { get; set; }
public WordTextProperties TextProperties { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
namespace TravelCompanyBusinessLogic.OfficePackage.HelperModels
{
public class WordTextProperties
{
public string Size { get; set; }
public bool Bold { get; set; }
public WordJustificationType JustificationType { get; set; }
}
}

View File

@ -0,0 +1,298 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Office2013.Excel;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;
namespace TravelCompanyBusinessLogic.OfficePackage.Implements
{
public class SaveToExcel : AbstractSaveToExcel
{
private SpreadsheetDocument spreadsheetDocument;
private SharedStringTablePart shareStringPart;
private Worksheet worksheet;
private static void CreateStyles(WorkbookPart workbookpart)
{
var sp = workbookpart.AddNewPart<WorkbookStylesPart>();
sp.Stylesheet = new Stylesheet();
var fonts = new Fonts() { Count = 2U, KnownFonts = true };
var fontUsual = new Font();
fontUsual.Append(new FontSize() { Val = 12D });
fontUsual.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{
Theme = 1U
});
fontUsual.Append(new FontName() { Val = "Times New Roman" });
fontUsual.Append(new FontFamilyNumbering() { Val = 2 });
fontUsual.Append(new FontScheme() { Val = FontSchemeValues.Minor });
var fontTitle = new Font();
fontTitle.Append(new Bold());
fontTitle.Append(new FontSize() { Val = 14D });
fontTitle.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{
Theme = 1U
});
fontTitle.Append(new FontName() { Val = "Times New Roman" });
fontTitle.Append(new FontFamilyNumbering() { Val = 2 });
fontTitle.Append(new FontScheme() { Val = FontSchemeValues.Minor });
fonts.Append(fontUsual);
fonts.Append(fontTitle);
var fills = new Fills() { Count = 2U };
var fill1 = new Fill();
fill1.Append(new PatternFill() { PatternType = PatternValues.None });
var fill2 = new Fill();
fill2.Append(new PatternFill() { PatternType = PatternValues.Gray125 });
fills.Append(fill1);
fills.Append(fill2);
var borders = new Borders() { Count = 2U };
var borderNoBorder = new Border();
borderNoBorder.Append(new LeftBorder());
borderNoBorder.Append(new RightBorder());
borderNoBorder.Append(new TopBorder());
borderNoBorder.Append(new BottomBorder());
borderNoBorder.Append(new DiagonalBorder());
var borderThin = new Border();
var leftBorder = new LeftBorder() { Style = BorderStyleValues.Thin };
leftBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{
Indexed = 64U
});
var rightBorder = new RightBorder() { Style = BorderStyleValues.Thin };
rightBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{
Indexed = 64U
});
var topBorder = new TopBorder() { Style = BorderStyleValues.Thin };
topBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{
Indexed = 64U
});
var bottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin };
bottomBorder.Append(new DocumentFormat.OpenXml.Office2010.Excel.Color()
{
Indexed = 64U
});
borderThin.Append(leftBorder);
borderThin.Append(rightBorder);
borderThin.Append(topBorder);
borderThin.Append(bottomBorder);
borderThin.Append(new DiagonalBorder());
borders.Append(borderNoBorder);
borders.Append(borderThin);
var cellStyleFormats = new CellStyleFormats() { Count = 1U };
var cellFormatStyle = new CellFormat()
{
NumberFormatId = 0U,
FontId = 0U,
FillId = 0U,
BorderId = 0U
};
cellStyleFormats.Append(cellFormatStyle);
var cellFormats = new CellFormats() { Count = 3U };
var cellFormatFont = new CellFormat()
{
NumberFormatId = 0U,
FontId = 0U,
FillId = 0U,
BorderId = 0U,
FormatId = 0U,
ApplyFont = true
};
var cellFormatFontAndBorder = new CellFormat()
{
NumberFormatId = 0U,
FontId = 0U,
FillId = 0U,
BorderId = 1U,
FormatId = 0U,
ApplyFont = true,
ApplyBorder = true
};
var cellFormatTitle = new CellFormat()
{
NumberFormatId = 0U,
FontId = 1U,
FillId = 0U,
BorderId = 0U,
FormatId = 0U,
Alignment = new Alignment()
{
Vertical = VerticalAlignmentValues.Center,
WrapText = true,
Horizontal = HorizontalAlignmentValues.Center
},
ApplyFont = true
};
cellFormats.Append(cellFormatFont);
cellFormats.Append(cellFormatFontAndBorder);
cellFormats.Append(cellFormatTitle);
var cellStyles = new CellStyles() { Count = 1U };
cellStyles.Append(new CellStyle()
{
Name = "Normal",
FormatId = 0U,
BuiltinId = 0U
});
var differentialFormats = new
DocumentFormat.OpenXml.Office2013.Excel.DifferentialFormats()
{ Count = 0U };
var tableStyles = new TableStyles()
{
Count = 0U,
DefaultTableStyle = "TableStyleMedium2",
DefaultPivotStyle = "PivotStyleLight16"
};
var stylesheetExtensionList = new StylesheetExtensionList();
var stylesheetExtension1 = new StylesheetExtension()
{
Uri = "{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}"
};
stylesheetExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
stylesheetExtension1.Append(new SlicerStyles()
{
DefaultSlicerStyle = "SlicerStyleLight1"
});
var stylesheetExtension2 = new StylesheetExtension()
{
Uri = "{9260A510-F301-46a8-8635-F512D64BE5F5}"
};
stylesheetExtension2.AddNamespaceDeclaration("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
stylesheetExtension2.Append(new TimelineStyles()
{
DefaultTimelineStyle = "TimeSlicerStyleLight1"
});
stylesheetExtensionList.Append(stylesheetExtension1);
stylesheetExtensionList.Append(stylesheetExtension2);
sp.Stylesheet.Append(fonts);
sp.Stylesheet.Append(fills);
sp.Stylesheet.Append(borders);
sp.Stylesheet.Append(cellStyleFormats);
sp.Stylesheet.Append(cellFormats);
sp.Stylesheet.Append(cellStyles);
sp.Stylesheet.Append(differentialFormats);
sp.Stylesheet.Append(tableStyles);
sp.Stylesheet.Append(stylesheetExtensionList);
}
private static uint GetStyleValue(ExcelStyleInfoType styleInfo)
{
return styleInfo switch
{
ExcelStyleInfoType.Title => 2U,
ExcelStyleInfoType.TextWithBroder => 1U,
ExcelStyleInfoType.Text => 0U,
_ => 0U,
};
}
protected override void CreateExcel(ExcelInfo info)
{
spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
// Создаем книгу (в ней хранятся листы)
var workbookpart = spreadsheetDocument.AddWorkbookPart();
workbookpart.Workbook = new Workbook();
CreateStyles(workbookpart);
// Получаем/создаем хранилище текстов для книги
shareStringPart = spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().Any()?
spreadsheetDocument.WorkbookPart.GetPartsOfType<SharedStringTablePart>().First() :
spreadsheetDocument.WorkbookPart.AddNewPart<SharedStringTablePart>();
// Создаем SharedStringTable, если его нет
if (shareStringPart.SharedStringTable == null)
{
shareStringPart.SharedStringTable = new SharedStringTable();
}
// Создаем лист в книгу
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
worksheetPart.Worksheet = new Worksheet(new SheetData());
// Добавляем лист в книгу
var sheets = spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
var sheet = new Sheet()
{
Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
SheetId = 1,
Name = "Лист"
};
sheets.Append(sheet);
worksheet = worksheetPart.Worksheet;
}
protected override void InsertCellInWorksheet(ExcelCellParameters excelParams)
{
var sheetData = worksheet.GetFirstChild<SheetData>();
// Ищем строку, либо добавляем ее
Row row;
if (sheetData.Elements<Row>().Where(r => r.RowIndex == excelParams.RowIndex).Any())
{
row = sheetData.Elements<Row>().Where(r => r.RowIndex == excelParams.RowIndex).First();
}
else
{
row = new Row() { RowIndex = excelParams.RowIndex };
sheetData.Append(row);
}
// Ищем нужную ячейку
Cell cell;
if (row.Elements<Cell>().Where(c => c.CellReference.Value == excelParams.CellReference).Any())
{
cell = row.Elements<Cell>().Where(c => c.CellReference.Value == excelParams.CellReference).First();
}
else
{
// Все ячейки должны быть последовательно друг за другом расположены
// нужно определить, после какой вставлять
Cell refCell = null;
foreach (Cell rowCell in row.Elements<Cell>())
{
if (string.Compare(rowCell.CellReference.Value, excelParams.CellReference, true) > 0)
{
refCell = rowCell;
break;
}
}
var newCell = new Cell() { CellReference = excelParams.CellReference };
row.InsertBefore(newCell, refCell);
cell = newCell;
}
// вставляем новый текст
shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new Text(excelParams.Text)));
shareStringPart.SharedStringTable.Save();
cell.CellValue = new CellValue((shareStringPart.SharedStringTable.Elements<SharedStringItem>().Count() - 1).ToString());
cell.DataType = new EnumValue<CellValues>(CellValues.SharedString);
cell.StyleIndex = GetStyleValue(excelParams.StyleInfo);
}
protected override void MergeCells(ExcelMergeParameters excelParams)
{
MergeCells mergeCells;
if (worksheet.Elements<MergeCells>().Any())
{
mergeCells = worksheet.Elements<MergeCells>().First();
}
else
{
mergeCells = new MergeCells();
if (worksheet.Elements<CustomSheetView>().Any())
{
worksheet.InsertAfter(mergeCells, worksheet.Elements<CustomSheetView>().First());
}
else
{
worksheet.InsertAfter(mergeCells, worksheet.Elements<SheetData>().First());
}
}
var mergeCell = new MergeCell()
{
Reference = new StringValue(excelParams.Merge)
};
mergeCells.Append(mergeCell);
}
protected override void SaveExcel(ExcelInfo info)
{
spreadsheetDocument.WorkbookPart.Workbook.Save();
spreadsheetDocument.Close();
}
}
}

View File

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;
namespace TravelCompanyBusinessLogic.OfficePackage.Implements
{
public class SaveToPdf : AbstractSaveToPdf
{
private Document document;
private Section section;
private Table table;
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
{
return type switch
{
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
_ => ParagraphAlignment.Justify,
};
}
private static void DefineStyles(Document document)
{
var style = document.Styles["Normal"];
style.Font.Name = "Times New Roman";
style.Font.Size = 10;
style = document.Styles.AddStyle("NormalTitle", "Normal");
style.Font.Bold = true;
}
protected override void CreatePdf(PdfInfo info)
{
document = new Document();
DefineStyles(document);
section = document.AddSection();
}
protected override void CreateParagraph(PdfParagraph pdfParagraph)
{
var paragraph = section.AddParagraph(pdfParagraph.Text);
paragraph.Format.SpaceAfter = "1cm";
paragraph.Format.Alignment = ParagraphAlignment.Center;
paragraph.Style = pdfParagraph.Style;
}
protected override void CreateTable(List<string> columns)
{
table = document.LastSection.AddTable();
foreach (var elem in columns)
{
table.AddColumn(elem);
}
}
protected override void CreateRow(PdfRowParameters rowParameters)
{
var row = table.AddRow();
for (int i = 0; i < rowParameters.Texts.Count; ++i)
{
row.Cells[i].AddParagraph(rowParameters.Texts[i]);
if (!string.IsNullOrEmpty(rowParameters.Style))
{
row.Cells[i].Style = rowParameters.Style;
}
Unit borderWidth = 0.5;
row.Cells[i].Borders.Left.Width = borderWidth;
row.Cells[i].Borders.Right.Width = borderWidth;
row.Cells[i].Borders.Top.Width = borderWidth;
row.Cells[i].Borders.Bottom.Width = borderWidth;
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment);
row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
}
}
protected override void SavePdf(PdfInfo info)
{
var renderer = new PdfDocumentRenderer(true)
{
Document = document
};
renderer.RenderDocument();
renderer.PdfDocument.Save(info.FileName);
}
}
}

View File

@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;
namespace TravelCompanyBusinessLogic.OfficePackage.Implements
{
public class SaveToWord : AbstractSaveToWord
{
private WordprocessingDocument wordDocument;
private Body docBody;
private static JustificationValues GetJustificationValues(WordJustificationType type)
{
return type switch
{
WordJustificationType.Both => JustificationValues.Both,
WordJustificationType.Center => JustificationValues.Center,
_ => JustificationValues.Left
};
}
private static SectionProperties CreateSectionProperties()
{
var properties = new SectionProperties();
var pageSize = new PageSize
{
Orient = PageOrientationValues.Portrait
};
properties.AppendChild(pageSize);
return properties;
}
private static ParagraphProperties CreateParagraphProperties(WordTextProperties paragraphProperites)
{
if (paragraphProperites != null)
{
var properites = new ParagraphProperties();
properites.AppendChild(new Justification() { Val = GetJustificationValues(paragraphProperites.JustificationType) });
properites.AppendChild(new SpacingBetweenLines { LineRule = LineSpacingRuleValues.Auto });
properites.AppendChild(new Indentation());
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
if (!string.IsNullOrEmpty(paragraphProperites.Size))
{
paragraphMarkRunProperties.AppendChild(new FontSize { Val = paragraphProperites.Size });
}
properites.AppendChild(paragraphMarkRunProperties);
return properites;
}
return null;
}
protected override void CreateWord(WordInfo info)
{
wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
MainDocumentPart mainPart = wordDocument.AddMainDocumentPart();
mainPart.Document = new Document();
docBody = mainPart.Document.AppendChild(new Body());
}
protected override void CreateParagraph(WordParagraph paragraph)
{
if (paragraph != null)
{
var docParagraph = new Paragraph();
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
foreach (var run in paragraph.Texts)
{
var docRun = new Run();
var properties = new RunProperties();
properties.AppendChild(new FontSize { Val = run.Item2.Size });
if (run.Item2.Bold)
{
properties.AppendChild(new Bold());
}
docRun.AppendChild(properties);
docRun.AppendChild(new Text
{
Text = run.Item1,
Space = SpaceProcessingModeValues.Preserve
});
docParagraph.AppendChild(docRun);
}
docBody.AppendChild(docParagraph);
}
}
protected override void SaveWord(WordInfo info)
{
docBody.AppendChild(CreateSectionProperties());
wordDocument.MainDocumentPart.Document.Save();
wordDocument.Close();
}
}
}

View File

@ -0,0 +1,18 @@
{
"profiles": {
"TravelCompanyBusinessLogic": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:50363;http://localhost:50364",
"SmtpClientHost": "smtp.gmail.com",
"SmtpClientPort": "587",
"PopHost": "pop.gmail.com",
"PopPort": "995",
"MailLogin": "rppprecastconcreteplant@gmail.com",
"MailPassword": "ywcf hsuz rnig pezh"
}
}
}

View File

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\TravelCompanyContracts\TravelCompanyContracts.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageReference Include="MailKit" Version="4.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text;
using TravelCompanyContracts.ViewModels.TouristViewModels;
namespace TravelCompanyClientApp
{
public class APIClient
{
private static readonly HttpClient _client = new();
public static TouristViewModel? Tourist { get; set; } = null;
}
}

View File

@ -0,0 +1,194 @@
using Azure;
using FluentNHibernate;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using TravelCompanyClientApp.Models;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
using TravelCompanyContracts.ViewModels.TouristViewModels;
using TravelCompanyDatabaseImplement.Models.TouristModel;
using TravelCompanyDataModels.Models.OperatorModels;
using TravelCompanyDataModels.Models.TouristModels;
namespace TravelCompanyClientApp.Controllers
{
public class ExcursionController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IExcursionLogic _logic;
private readonly ITravelLogic _travelLogic;
private readonly IGuideLogic _guideLogic;
public ExcursionController(ILogger<HomeController> logger, IExcursionLogic logic, ITravelLogic travelLogic, IGuideLogic guideLogic)
{
_logger = logger;
_logic = logic;
_travelLogic = travelLogic;
_guideLogic = guideLogic;
}
[HttpGet]
public IActionResult Excursion()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
return View(_logic.ReadList(new ExcursionSearchModel { TouristId = APIClient.Tourist.Id }));
}
[HttpGet]
public IActionResult CreateExcursion()
{
return View();
}
[HttpPost]
public void CreateExcursion(string excursionname, string description, int duration)
{
if (APIClient.Tourist == null)
{
throw new Exception("Доступно только авторизованным пользователям");
}
if (string.IsNullOrEmpty(excursionname) || string.IsNullOrEmpty(description) || duration <= 0)
{
throw new Exception("Неправильноо введенные данные");
}
_logic.Create(new ExcursionBindingModel
{
ExcursionName = excursionname,
ExcursionDescrition = description,
Duration = duration,
TouristId = APIClient.Tourist.Id
});
Response.Redirect("Excursion");
return;
}
[HttpGet("/excursion/updateexcursion/{id?}")]
public IActionResult UpdateExcursion(int id)
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
return View(_logic.ReadElement(new ExcursionSearchModel { TouristId = APIClient.Tourist.Id, Id = id }));
}
[HttpPost("/excursion/updateexcursion/{id?}")]
public void UpdateExcursion(int id, string excursionname, string description, int duration)
{
if (APIClient.Tourist == null)
{
throw new Exception("Доступно только авторизованным пользователям");
}
if (string.IsNullOrEmpty(excursionname) || string.IsNullOrEmpty(description) || duration <= 0)
{
throw new Exception("Неправильноо введенные данные");
}
var excursion = _logic.ReadElement(new ExcursionSearchModel { Id = id });
_logic.Update(new ExcursionBindingModel
{
Id = excursion.Id,
ExcursionName = excursionname,
ExcursionDescrition = description,
Duration = duration,
TouristId = excursion.TouristId,
GuideExcursions= excursion.GuideExcursions
});
Response.Redirect("/Excursion/Excursion");
return;
}
[HttpPost("/excursion/deleteexcursion/{id?}")]
public void DeleteExcursion(int id)
{
if (APIClient.Tourist == null)
{
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
}
_logic.Delete(new ExcursionBindingModel { Id = id });
Response.Redirect("/Excursion/Excursion");
}
[HttpGet]
public IActionResult CreateTravelExcursion()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Travels = _travelLogic.ReadList(new TravelSearchModel { TouristId = APIClient.Tourist.Id});
ViewBag.Excursions = _logic.ReadList(new ExcursionSearchModel { TouristId = APIClient.Tourist.Id });
return View();
}
[HttpPost]
public void CreateTravelExcursion(int travelselect, List<int> excursionselect)
{
if (APIClient.Tourist == null)
{
throw new Exception("Доступно только авторизованным пользователям");
}
if (travelselect <= 0 || excursionselect==null)
{
throw new Exception("Неправильноо введенные данные");
}
Dictionary<int, IExcursionModel> te = new Dictionary<int, IExcursionModel>();
foreach (int exc in excursionselect)
{
te.Add(exc, _logic.ReadElement(new ExcursionSearchModel { Id = exc }));
}
var travel=_travelLogic.ReadElement(new TravelSearchModel { Id=travelselect });
_travelLogic.Update(new TravelBindingModel
{
Id = travel.Id,
TravelName = travel.TravelName,
DateStart = travel.DateStart,
TravelDescription = travel.TravelDescription,
TourTravels=travel.TourTravels,
ExcursionTravels = te
});
Response.Redirect($"/Travel/UpdateTravel/{travel.Id}");
return;
}
[HttpGet]
public IActionResult CreateGuideExcursion()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Guides = _guideLogic.ReadList(null);
ViewBag.Excursions = _logic.ReadList(new ExcursionSearchModel { TouristId = APIClient.Tourist.Id });
return View();
}
[HttpPost]
public void CreateGuideExcursion(int excursionselect, List<int> guideselect)
{
if (APIClient.Tourist == null)
{
throw new Exception("Доступно только авторизованным пользователям");
}
if (excursionselect <= 0 || guideselect == null)
{
throw new Exception("Неправильноо введенные данные");
}
Dictionary<int, IGuideModel> te = new Dictionary<int, IGuideModel>();
foreach (int exc in guideselect)
{
te.Add(exc, _guideLogic.ReadElement(new GuideSearchModel { Id = exc }));
}
var excursion = _logic.ReadElement(new ExcursionSearchModel { Id = excursionselect });
_logic.Update(new ExcursionBindingModel
{
Id = excursion.Id,
ExcursionName= excursion.ExcursionName,
Duration = excursion.Duration,
ExcursionDescrition= excursion.ExcursionDescrition,
GuideExcursions = te
});
Response.Redirect($"/Excursion/UpdateExcursion/{excursion.Id}");
return;
}
}
}

View File

@ -0,0 +1,263 @@
using Azure;
using FluentNHibernate;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Diagnostics;
using TravelCompanyBusinessLogic.BusinessLogic.TouristLogics;
using TravelCompanyBusinessLogic.BusinessLogics;
using TravelCompanyClientApp.Models;
using TravelCompanyContracts.BindingModels;
using TravelCompanyContracts.BindingModels.OperatorBindingModels;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.ViewModels;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
using TravelCompanyContracts.ViewModels.TouristViewModels;
using TravelCompanyDatabaseImplement.Models.TouristModel;
using TravelCompanyDataModels.Models.OperatorModels;
using VisioForge.MediaFramework.Helpers;
namespace TravelCompanyClientApp.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly ITouristLogic _logic;
private readonly ITravelLogic _travellogic;
private readonly IReportLogic _reportlogic;
private readonly ITouristLogic _touristLogic;
public HomeController(ILogger<HomeController> logger, ITouristLogic logic,
ITravelLogic travelLogic, IReportLogic reportLogic, ITouristLogic touristLogic)
{
_logger = logger;
_logic = logic;
_travellogic = travelLogic;
_reportlogic = reportLogic;
_touristLogic = touristLogic;
}
[HttpGet]
public IActionResult MainPage()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.Tourist);
}
[HttpGet]
public IActionResult Privacy()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.Tourist);
}
[HttpPost]
public void Privacy(string login, string email, string password, string surname, string name, string patronymic, string birthday)
{
if (APIClient.Tourist == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email)
|| string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(patronymic) || string.IsNullOrEmpty(birthday))
{
throw new Exception("Неверно введены личные данные");
}
_logic.Update(new TouristBindingModel
{
Id = APIClient.Tourist.Id,
Surname = surname,
Name = name,
Patronymic = patronymic,
BirthDay = DateTime.Parse(birthday),
Login = login,
Email = login,
Password = password
});
APIClient.Tourist.Surname = surname;
APIClient.Tourist.Name = name;
APIClient.Tourist.Patronymic = patronymic;
APIClient.Tourist.BirthDay = DateTime.Parse(birthday);
APIClient.Tourist.Login = login;
APIClient.Tourist.Email = email;
APIClient.Tourist.Password = password;
Response.Redirect("Privacy");
}
[HttpGet]
public IActionResult Enter()
{
return View();
}
[HttpPost]
public void Enter(string login, string password)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{
throw new Exception("Введите логин и пароль");
}
APIClient.Tourist = _logic.ReadElement(new TouristSearchModel
{
Login = login,
Password = password
});
if (APIClient.Tourist == null)
{
throw new Exception("Неверный логин/пароль");
}
Response.Redirect("MainPage");
}
[HttpGet]
public IActionResult Report()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.TravelList = _travellogic.ReadList(new TravelSearchModel { TouristId = APIClient.Tourist.Id });
return View(new ReportBindingModel());
}
[HttpPost]
public IActionResult Report(ReportBindingModel model)
{
model.TouristId = APIClient.Tourist.Id;
List<ReportGuidesPCView> travels = _reportlogic.GetGuidesPCView(new ReportBindingModel()
{
DateAfter = model.DateAfter,
DateBefore = model.DateBefore,
TouristId = model.TouristId
});
ViewBag.TravelList = _travellogic.ReadList(new TravelSearchModel { TouristId = APIClient.Tourist.Id });
ViewBag.Travels = travels;
return View(new ReportBindingModel());
}
[HttpPost]
public void ReportPdf(ReportBindingModel model)
{
model.TouristId = APIClient.Tourist.Id;
_reportlogic.saveGuidesToPdfFile(new ReportBindingModel()
{
DateAfter = model.DateAfter,
DateBefore = model.DateBefore,
TouristId = model.TouristId
});
Response.Redirect("Report");
}
[HttpPost]
public void ReportXsl(ReportBindingModel model)
{
model.TouristId = APIClient.Tourist.Id;
_reportlogic.saveGuidesToExcel(new ReportBindingModel()
{
DateAfter = model.DateAfter,
DateBefore = model.DateBefore,
TouristId = model.TouristId,
TravelId = model.TravelId,
});
Response.Redirect("Report");
}
[HttpPost]
public void ReportWord(ReportBindingModel model)
{
model.TouristId = APIClient.Tourist.Id;
_reportlogic.saveGuidesToWord(new ReportBindingModel()
{
DateAfter = model.DateAfter,
DateBefore = model.DateBefore,
TouristId = model.TouristId,
TravelId = model.TravelId
});
Response.Redirect("Report");
}
[HttpPost]
public IActionResult ReportPdfView([FromBody] ReportBindingModel model)
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
model.TouristId = APIClient.Tourist.Id;
List<ReportTravelsPCView> travels = _reportlogic.GetTravelsPCView(new ReportBindingModel()
{
DateAfter = model.DateAfter,
DateBefore = model.DateBefore,
TouristId = model.TouristId
});
ViewBag.TravelList = _travellogic.ReadList(new TravelSearchModel { TouristId = APIClient.Tourist.Id });
ViewBag.Travels = travels;
return View(new ReportBindingModel());
}
[HttpPost]
public void ReportEmail(ReportBindingModel model)
{
model.TouristId = APIClient.Tourist.Id;
string path = $"C:\\Users\\Public\\Documents\\{DateTime.Now.ToString("HH.mm.ss_dd.MM.yyyy")}.pdf";
var sendermodel= new MailSendInfoBindingModel
{
MailAddress = APIClient.Tourist.Email,
Subject = "Отчет",
report = model,
Path = path
};
_reportlogic.saveGuidesToPdfFile(new ReportBindingModel
{
FileName = path,
TouristId = sendermodel.report.TouristId,
DateBefore = sendermodel.report.DateBefore,
DateAfter = sendermodel.report.DateAfter
});
_touristLogic.SendMail(sendermodel);
Response.Redirect("Report");
}
[HttpGet]
public IActionResult Register()
{
return View();
}
[HttpPost]
public void Register(string login, string email, string password, string surname, string name, string patronymic, string birthday)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email)
|| string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(patronymic) || string.IsNullOrEmpty(birthday))
{
throw new Exception("Неверно введены личные данные");
}
_logic.Create(new TouristBindingModel
{
Login = login,
Email = email,
Password = password,
Surname = surname,
Name = name,
Patronymic = patronymic,
BirthDay = DateTime.Parse(birthday)
});
Response.Redirect("Enter");
return;
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

View File

@ -0,0 +1,106 @@
using Azure;
using FluentNHibernate;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using TravelCompanyClientApp.Models;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
using TravelCompanyContracts.ViewModels.TouristViewModels;
using TravelCompanyDatabaseImplement.Models.TouristModel;
using TravelCompanyDataModels.Models.OperatorModels;
namespace TravelCompanyClientApp.Controllers
{
public class PlaceController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IPlaceLogic _logic;
private readonly IExcursionLogic _excursionLogic;
public PlaceController(ILogger<HomeController> logger, IPlaceLogic logic, IExcursionLogic excursionLogic)
{
_logger = logger;
_logic = logic;
_excursionLogic = excursionLogic;
}
[HttpGet]
public IActionResult Place()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
return View(_logic.ReadList(new PlaceSearchModel { TouristId = APIClient.Tourist.Id }));
}
[HttpGet]
public IActionResult CreatePlace()
{
ViewBag.Excursions = _excursionLogic.ReadList(new ExcursionSearchModel {TouristId= APIClient.Tourist.Id});
return View();
}
[HttpPost]
public void CreatePlace(string placename, string address, int excursion)
{
if (string.IsNullOrEmpty(placename) || string.IsNullOrEmpty(address) || excursion==null)
{
throw new Exception("Введите логин, пароль и ФИО");
}
_logic.Create( new PlaceBindingModel
{
PlaceName = placename,
PlaceAddress = address,
ExcursionId = excursion,
TouristId = APIClient.Tourist.Id
});
Response.Redirect("Place");
return;
}
[HttpGet("/place/updateplace/{id?}")]
public IActionResult UpdatePlace(int id)
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Excursions = _excursionLogic.ReadList(new ExcursionSearchModel { TouristId = APIClient.Tourist.Id });
return View(_logic.ReadElement(new PlaceSearchModel { TouristId = APIClient.Tourist.Id, Id=id})) ;
}
[HttpPost("/place/updateplace/{id?}")]
public void UpdatePlace(int id, string placename, string address, int excursion)
{
if (string.IsNullOrEmpty(placename) || string.IsNullOrEmpty(address) || excursion == null)
{
throw new Exception("Введите логин, пароль и ФИО");
}
_logic.Update( new PlaceBindingModel
{
Id = id,
PlaceName = placename,
PlaceAddress = address,
ExcursionId = excursion,
TouristId=APIClient.Tourist.Id
});
Response.Redirect("/Place/Place");
return;
}
[HttpPost("/place/deleteplace/{id?}")]
public void DeletePlace(int id)
{
if (APIClient.Tourist == null)
{
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
}
_logic.Delete( new PlaceBindingModel { Id = id });
Response.Redirect("/Place/Place");
}
}
}

View File

@ -0,0 +1,122 @@
using Azure;
using FluentNHibernate;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using TravelCompanyBusinessLogic.BusinessLogic.TouristLogics;
using TravelCompanyClientApp.Models;
using TravelCompanyContracts.BindingModels.TouristBindingModels;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.SearchModels.OperatorSearchModels;
using TravelCompanyContracts.SearchModels.TouristSearchModels;
using TravelCompanyContracts.ViewModels.OperatorViewModels;
using TravelCompanyContracts.ViewModels.TouristViewModels;
using TravelCompanyDatabaseImplement.Models.TouristModel;
using TravelCompanyDataModels.Models.OperatorModels;
namespace TravelCompanyClientApp.Controllers
{
public class TravelController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly ITravelLogic _logic;
private readonly ITourLogic _tourLogic;
public TravelController(ILogger<HomeController> logger, ITravelLogic logic, ITourLogic tourLogic)
{
_logger = logger;
_logic = logic;
_tourLogic = tourLogic;
}
[HttpGet]
public IActionResult Travel()
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
return View(_logic.ReadList(new TravelSearchModel { TouristId = APIClient.Tourist.Id }));
}
[HttpGet]
public IActionResult CreateTravel()
{
ViewBag.Tours = _tourLogic.ReadList(null);
return View();
}
[HttpPost]
public void CreateTravel(string travelname, DateTime datestart, string description, List<int> tourselect)
{
if (string.IsNullOrEmpty(travelname) || string.IsNullOrEmpty(description) || datestart==null || tourselect==null|| tourselect.Count<=0)
{
throw new Exception("Неверный ввод");
}
Dictionary<int,ITourModel> ts = new Dictionary<int, ITourModel>();
foreach (int tour in tourselect)
{
ts.Add(tour,_tourLogic.ReadElement(new TourSearchModel { Id = tour }));
}
_logic.Create( new TravelBindingModel
{
TravelName = travelname,
TravelDescription = description,
DateStart = datestart,
TouristId = APIClient.Tourist.Id,
TourTravels= ts
});
Response.Redirect("Travel");
return;
}
[HttpGet("/travel/updatetravel/{id?}")]
public IActionResult UpdateTravel(int id)
{
if (APIClient.Tourist == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Tours = _tourLogic.ReadList(null);
return View(_logic.ReadElement(new TravelSearchModel { TouristId = APIClient.Tourist.Id, Id=id})) ;
}
[HttpPost("/travel/updatetravel/{id?}")]
public void UpdateTravel(int id, string travelname, DateTime datestart, string description, List<int> tourselect)
{
if (string.IsNullOrEmpty(travelname) || string.IsNullOrEmpty(description) || datestart == null || tourselect == null || tourselect.Count <= 0)
{
throw new Exception("Неверный ввод");
}
Dictionary<int, ITourModel> ts = new Dictionary<int, ITourModel>();
foreach (int tour in tourselect)
{
ts.Add(tour, _tourLogic.ReadElement(new TourSearchModel { Id = tour }));
}
var travel = _logic.ReadElement(new TravelSearchModel { Id=id });
_logic.Update(new TravelBindingModel
{
Id = travel.Id,
TravelName = travelname,
TravelDescription = description,
DateStart = datestart,
TourTravels = ts,
ExcursionTravels= travel.ExcursionTravels,
TouristId = travel.TouristId
}); ;
Response.Redirect("/Travel/Travel");
return;
}
[HttpPost("/travel/deletetravel/{id?}")]
public void DeleteTravel(int id)
{
if (APIClient.Tourist == null)
{
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
}
_logic.Delete( new TravelBindingModel { Id = id });
Response.Redirect("/Travel/Travel");
}
}
}

View File

@ -0,0 +1,9 @@
namespace TravelCompanyClientApp.Models
{
public class ErrorViewModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}

View File

@ -0,0 +1,81 @@
using TravelCompanyBusinessLogic.BusinessLogic.OperatorLogics;
using TravelCompanyBusinessLogic.BusinessLogic.TouristLogics;
using TravelCompanyBusinessLogic.BusinessLogics;
using TravelCompanyBusinessLogic.OfficePackage.Implements;
using TravelCompanyBusinessLogic.OfficePackage;
using TravelCompanyClientApp;
using TravelCompanyContracts.BusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.StoragesContracts.OperatorStoragesContracts;
using TravelCompanyContracts.StoragesContracts.TouristStoragesContracts;
using TravelCompanyDatabaseImplement.Implements;
using TravelCompanyBusinessLogic.MailWorker;
using TravelCompanyContracts.BindingModels;
using TravelCompanyClientApp.Controllers;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddTransient<ITouristStorage, TouristStorage>();
builder.Services.AddTransient<ITravelStorage, TravelStorage>();
builder.Services.AddTransient<IExcursionStorage, ExcursionStorage>();
builder.Services.AddTransient<IPlaceStorage, PlaceStorage>();
builder.Services.AddTransient<ITourStorage, TourStorage>();
builder.Services.AddTransient<IGuideStorage, GuideStorage>();
builder.Services.AddTransient<IOperatorStorage, OperatorStorage>();
builder.Services.AddTransient<ITouristLogic, TouristLogic>();
builder.Services.AddTransient<IOperatorLogic, OperatorLogic>();
builder.Services.AddTransient<ITravelLogic, TravelLogic>();
builder.Services.AddTransient<IExcursionLogic, ExcursionLogic>();
builder.Services.AddTransient<IPlaceLogic, PlaceLogic>();
builder.Services.AddTransient<ITourLogic, TourLogic>();
builder.Services.AddTransient<IGuideLogic, GuideLogic>();
builder.Services.AddTransient<IReportLogic, ReportLogic>();
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
builder.Services.AddSingleton<ILoadLogic, LoadLogic>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
var app = builder.Build();
var mailSender = app.Services.GetService<AbstractMailWorker>();
mailSender?.MailConfig(new MailConfigBindingModel
{
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
});
var loadLogic = app.Services.GetService<ILoadLogic>();
loadLogic?.LoadFromJson();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Travel}/{action=Travel}/{id?}");
app.Run();

View File

@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:26346",
"sslPort": 44338
}
},
"profiles": {
"TravelCompanyClientApp": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7117;http://localhost:5117",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TravelCompanyBusinessLogic\TravelCompanyBusinessLogic.csproj" />
<ProjectReference Include="..\TravelCompanyContracts\TravelCompanyContracts.csproj" />
<ProjectReference Include="..\TravelCompanyDatabaseImplement\TravelCompanyDatabaseImplement.csproj" />
<ProjectReference Include="..\TravelCompanyDataModels\TravelCompanyDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="Views\Home\MainPage.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -0,0 +1,28 @@
@{
ViewData["Title"] = "CreateExcursion";
}
<div class="text-center">
<h2 class="display-4">Создание экскурсии</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Название:</div>
<div class="col-4"><input type="text" name="excursionname" id="excursionname" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Длительность:</div>
<div class="col-4"><input type="number" name="duration" id="duration" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Описание:</div>
<div class="col-4"><input type="text" name="description" id="descripntion" /></div>
</div>
<div class="row" style="margin-top:20px">
<div class="col-4"></div>
<div class="col-2"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,41 @@
@{
ViewData["Title"] = "CreateGuideExcursion";
}
<div class="text-center">
<h2 class="display-4">Привязка гидов к экскурсиям</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Экскурсия:</div>
<div class="col-4">
<select name="excursionselect" class="form-control" id="excursionselect">
@foreach (var excursion in ViewBag.Excursions)
{
<option value="@excursion.Id">@excursion.ExcursionName</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Гиды:</div>
<div class="col-4">
<select name="guideselect" class="form-control" multiple size="4" id="guideselect">
@foreach (var guide in ViewBag.Guides)
{
<option value="@guide.Id">@guide.Surname @guide.Name</option>
}
</select>
</div>
</div>
<div class="row" style="margin-top:20px">
<div class="col-4"></div>
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,41 @@
@{
ViewData["Title"] = "CreateTravelExcursion";
}
<div class="text-center">
<h2 class="display-4">Привязка экскурсий к путешествиям</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Путешествие:</div>
<div class="col-4">
<select name="travelselect" class="form-control" id="travelselect">
@foreach (var travel in ViewBag.Travels)
{
<option value="@travel.Id">@travel.TravelName</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Экскурсии:</div>
<div class="col-4">
<select name="excursionselect" class="form-control" multiple size="4" id="excursionselect">
@foreach (var excursion in ViewBag.Excursions)
{
<option value="@excursion.Id" >@excursion.ExcursionName</option>
}
</select>
</div>
</div>
<div class="row" style="margin-top:20px">
<div class="col-4"></div>
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,86 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels
@model List<ExcursionViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Экскурсии</h1>
</div>
<div class="text-center" style="margin-top:50px">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь как турист</h3>
return;
}
<p>
<a asp-area="" asp-controller="/Excursion" asp-action="CreateExcursion">Создать экскурсию</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Название экскурсии
</th>
<th>
Длительность экскурсии
</th>
<th>
Описание экскурсии
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.ExcursionName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Duration)
</td>
<td>
@Html.DisplayFor(modelItem => item.ExcursionDescrition)
</td>
<td>
<p>
<button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdateExcursion", "/Excursion", new { id = item.Id })'">Изменить</button>
</p>
</td>
<td>
<p>
<button type="button" class="btn btn-primary" onclick="deleteExcursion(@item.Id)">Удалить</button>
</p>
</td>
</tr>
}
</tbody>
</table>
}
</div>
@section scripts {
<script>
function deleteExcursion(id) {
if (confirm("Вы уверены, что хотите удалить эту экскурсию?")) {
$.post('@Url.Action("DeleteExcursion", "/Excursion")' + '/' + id, function () {
window.location.reload();
});
}
}
</script>
}

View File

@ -0,0 +1,42 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels
@model ExcursionViewModel
@{
ViewData["Title"] = "Privacy Policy";
}
<div class="text-center">
<h2 class="display-4">Экскурсия</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Название:</div>
<div class="col-4"><input type="text" name="excursionname" value="@Model.ExcursionName" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Длительность:</div>
<div class="col-4"><input type="text" name="duration" value="@Model.Duration" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Описание:</div>
<div class="col-4"><input type="text" name="description" value="@Model.ExcursionDescrition" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Гиды:</div>
<div class="col-4">
<ul>
@foreach (var exc in Model.GuideExcursions)
{
<li> @exc.Value.Surname @exc.Value.Name @exc.Value.Patronymic</li>
}
</ul>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" style="margin-top:20px" /></div>
</div>
</form>

View File

@ -0,0 +1,23 @@
@{
ViewData["Title"] = "Enter";
}
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"> </div>
<div class="col-2">Логин:</div>
<div class="col-4"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Пароль:</div>
<div class="col-4"><input type="password" name="password" /></div>
</div>
<div class="row" style="margin-top:30px">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,10 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels;
@model TouristViewModel
@{
ViewData["Title"] = "MainPage";
}
<div class="text-center">
<h2 class="display-4">Туристическая фирма "Иван Сусанин"</h2>
</div>

View File

@ -0,0 +1,63 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels;
@model TouristViewModel
@{
ViewData["Title"] = "Privacy Policy";
}
<div class="text-center">
<h2 class="display-4">Личные данные</h2>
</div>
<div class="text-center" style="margin-top:50px">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<form method="post">
<div class="row">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Фамилия:</div>
<div class="col-4"><input type="text" name="surname" value="@Model.Surname"/></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Имя:</div>
<div class="col-4"><input type="text" name="name" value="@Model.Name"/></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Отчество:</div>
<div class="col-4"><input type="text" name="patronymic" value="@Model.Patronymic" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Дата рождения:</div>
<div class="col-2"></div>
<div class="col-2">
<input type="date" class="form-control" name="birthday" value="@Model.BirthDay.ToString("yyyy-MM-dd")" />
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Логин:</div>
<div class="col-4"><input type="text" name="login" value="@Model.Login"/></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Email:</div>
<div class="col-4"><input type="text" name="email" value="@Model.Email" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Пароль:</div>
<div class="col-4"><input type="password" name="password" value="@Model.Password"/></div>
</div>
<div class="row" style="margin-top:30px">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>
}

View File

@ -0,0 +1,49 @@
@{
ViewData["Title"] = "Register";
}
<div class="text-center">
<h2 class="display-4">Регистрация</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Фамилия:</div>
<div class="col-4"><input type="text" name="surname" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Имя:</div>
<div class="col-4"><input type="text" name="name" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Отчество:</div>
<div class="col-4"><input type="text" name="patronymic" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Дата рождения:</div>
<div class="col-2"><input type="date" class="form-control" name="birthday" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Логин:</div>
<div class="col-4"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Email:</div>
<div class="col-4"><input type="text" name="email" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Пароль:</div>
<div class="col-4"><input type="password" name="password" /></div>
</div>
<div class="row" style="margin-top: 20px">
<div class="col-4"></div>
<div class="col-2"><input type="submit" value="Регистрация туриста" id="register" class="btn btn-primary" /></div>
<div class="col-7"></div>
</div>
</form>

View File

@ -0,0 +1,116 @@
@using TravelCompanyContracts.BindingModels;
@model ReportBindingModel
@{
ViewBag.Title = "Report";
}
<div class="text-center">
<h2 class="display-4">Отчеты</h2>
</div>
@using (Html.BeginForm("Report", "Home", FormMethod.Post))
{
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="form-group">
@Html.LabelFor(m => m.DateAfter, "От")
@Html.TextBoxFor(m => m.DateAfter, new { type = "date", @class = "form-control" })
</div>
</div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="form-group">
@Html.LabelFor(m => m.DateBefore, "До")
@Html.TextBoxFor(m => m.DateBefore, new { type = "date", @class = "form-control" })
</div>
</div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="form-group">
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportPdf", "Home")">Сохранить в pdf</button>
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportEmail", "Home")">Отправить pdf по почте</button>
<button type ="submit" class="btn btn-primary" formaction="@Url.Action("Report", "Home")">Показать</button>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="form-group">
@Html.LabelFor(m => m.TravelId, "Путешествия")
@Html.DropDownListFor(m => m.TravelId, new SelectList(ViewBag.TravelList, "Id", "TravelName"), new { @class = "form-control", multiple = "multiple" })
</div>
</div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportXsl", "Home")">Сохранить в excel</button>
<button type="submit" class="btn btn-primary" formaction="@Url.Action("ReportWord", "Home")">Сохранить в word</button>
</div>
</div>
<table id="cooks-table" class="table table-striped">
<thead>
<tr>
<th>№</th>
<th>Гид</th>
<th>Номер</th>
<th>Путешествие</th>
<th>Дата начала путешествия</th>
</tr>
</thead>
<tbody>
@if (ViewBag.Travels != null && ViewBag.Travels.Count != 0)
{
@foreach (var guide in ViewBag.Travels)
{
<tr>
<td>
@guide.GuideId
</td>
<td>
@guide.FIO <!-- Предположим, что у модели GuideViewModel есть свойство Name -->
</td>
</tr>
foreach (var travel in guide.Travels)
{
var dateStart = travel.DateStart.ToString("yyyy-MM-dd");
<tr>
<td>
</td>
<td>
</td>
<td>
@travel.Id
</td>
<td>
@travel.TravelName
</td>
<td>
@travel.DateStart.ToString("yyyy-MM-dd")
</td>
</tr>
}
}
}
else
{
<tr>
<td colspan="5">Нет доступных данных</td>
</tr>
}
</tbody>
</table>
}

View File

@ -0,0 +1,35 @@
@{
ViewData["Title"] = "CreatePlace";
}
<div class="text-center">
<h2 class="display-4">Создание места</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Название:</div>
<div class="col-4"><input type="text" name="placename" id="placename" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Адрес:</div>
<div class="col-4"><input type="text" name="address" id="address" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Экскурсия:</div>
<div class="col-4">
<select name="excursion" class="form-control" id="excursion">
@foreach (var excursion in ViewBag.Excursions)
{
<option value="@excursion.Id">@excursion.ExcursionName</option>
}
</select>
</div>
</div>
<div class="row" style="margin-top:20px">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,89 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels
@model List<PlaceViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Места</h1>
</div>
<div class="text-center" style="margin-top:50px">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь как турист</h3>
return;
}
<p>
<a asp-controller="/Place" asp-action="CreatePlace">Создать место</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Название места
</th>
<th>
Адрес места
</th>
<th>
Экскурсия
</th>
<th>
Логин туриста
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.PlaceName)
</td>
<td>
@Html.DisplayFor(modelItem => item.PlaceAddress)
</td>
<td>
@Html.DisplayFor(modelItem => item.ExcursionName)
</td>
<td>
<p>
<button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdatePlace", "/Place", new { id = item.Id })'">Изменить</button>
</p>
</td>
<td>
<p>
<button type="button" class="btn btn-primary" onclick="deletePlace(@item.Id)">Удалить</button>
</p>
</td>
</tr>
}
</tbody>
</table>
}
</div>
@section scripts {
<script>
function deletePlace(id) {
if (confirm("Вы уверены, что хотите удалить это место?")) {
$.post('@Url.Action("DeletePlace", "/Place")' + '/' + id, function () {
window.location.reload();
});
}
}
</script>
}

View File

@ -0,0 +1,38 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels
@model PlaceViewModel
@{
ViewData["Title"] = "Privacy Policy";
}
<div class="text-center" >
<h2 class="display-4">Место</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Название:</div>
<div class="col-4"><input type="text" name="placename" value="@Model.PlaceName" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Адрес:</div>
<div class="col-4"><input type="text" name="address" value="@Model.PlaceAddress" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Экскурсия:</div>
<div class="col-4">
<select name="excursion" class="form-control" id="excursion">
@foreach (var excursion in ViewBag.Excursions)
{
var isSelected = Model.ExcursionId == @excursion.Id;
<option value="@excursion.Id" selected="@isSelected">@excursion.ExcursionName</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" style="margin-top:20px"/></div>
</div>
</form>

View File

@ -0,0 +1,25 @@
@model ErrorViewModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - TravelCompanyClientApp</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/PrecastConcretePlantClientApp.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="MainPage">Турфирма</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Travel" asp-action="Travel">Путешествия</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Excursion" asp-action="Excursion">Экскурсии</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Place" asp-action="Place">Места</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Excursion" asp-action="CreateTravelExcursion">Привяка экскурсий к путешествиям</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Excursion" asp-action="CreateGuideExcursion">Привяка гидов к экскурсиям</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Report">Отчеты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2023 - TravelCompanyClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@ -0,0 +1,48 @@
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}

View File

@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@ -0,0 +1,41 @@
@{
ViewData["Title"] = "CreateTravel";
}
<div class="text-center">
<h2 class="display-4">Создание путешествия</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Название:</div>
<div class="col-4"><input type="text" name="travelname" id="travelname" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Дата начала:</div>
<div class="col-4"><input type="date" class="form-control" id="datestart" name="datestart" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Описание:</div>
<div class="col-4"><input type="text" id="description" name="description" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Туры:</div>
<div class="col-4">
<select name="tourselect" class="form-control" multiple size="4" id="tourselect">
@foreach (var tour in ViewBag.Tours)
{
<option value="@tour.Id">@tour.TourName</option>
}
</select>
</div>
</div>
<div class="row" style="margin-top:20px">
<div class="col-4"></div>
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,86 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels
@model List<TravelViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Путешествия</h1>
</div>
<div class="text-center" style="margin-top:50px">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь как турист</h3>
return;
}
<p>
<a asp-controller="/Travel" asp-action="CreateTravel">Создать путешествие</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Название путешествия
</th>
<th>
Дата начала путешествия
</th>
<th>
Описание путешествия
</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.TravelName)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateStart)
</td>
<td>
@Html.DisplayFor(modelItem => item.TravelDescription)
</td>
<td>
<p>
<button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdateTravel", "/Travel", new { id = item.Id })'">Изменить</button>
</p>
</td>
<td>
<p>
<button type="button" class="btn btn-primary" onclick="deleteTravel(@item.Id)">Удалить</button>
</p>
</td>
</tr>
}
</tbody>
</table>
}
</div>
@section scripts {
<script>
function deleteTravel(id) {
if (confirm("Вы уверены, что хотите удалить это место?")) {
$.post('@Url.Action("DeleteTravel", "/Travel")' + '/' + id, function () {
window.location.reload();
});
}
}
</script>
}

View File

@ -0,0 +1,58 @@
@using TravelCompanyContracts.ViewModels.TouristViewModels
@model TravelViewModel
@{
ViewData["Title"] = "Privacy Policy";
}
<div class="text-center">
<h2 class="display-4">Путешествие</h2>
</div>
<form method="post" style="margin-top:50px">
<div class="row">
<div class="col-4"></div>
<div class="col-2">Название:</div>
<div class="col-4"><input type="text" name="travelname" value="@Model.TravelName" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Начало путешествия:</div>
<div class="col-4">
<input type="date" class="form-control" name="datestart" value="@Model.DateStart.ToString("yyyy-MM-dd")" />
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Описание путешествия:</div>
<div class="col-4"><input type="text" name="description" value="@Model.TravelDescription" /></div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Туры:</div>
<div class="col-4">
<select name="tourselect" class="form-control" multiple size="4" id="tourselect">
@foreach (var tour in ViewBag.Tours)
{
var isSelected = Model.TourTravels.Any(x => x.Key == tour.Id);
<option value="@tour.Id" selected="@isSelected">@tour.TourName</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-2">Экскурсии:</div>
<div class="col-4">
<ul>
@foreach (var exc in Model.ExcursionTravels)
{
<li> @exc.Value.ExcursionName</li>
}
</ul>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" style="margin-top:20px"/></div>
</div>
</form>

View File

@ -0,0 +1,3 @@
@using TravelCompanyClientApp
@using TravelCompanyClientApp.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,16 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"IPAddress": "http://localhost:5253/",
"SmtpClientHost": "smtp.gmail.com",
"SmtpClientPort": "587",
"PopHost": "pop.gmail.com",
"PopPort": "995",
"MailLogin": "rppprecastconcreteplant@gmail.com",
"MailPassword": "ywcf hsuz rnig pezh"
}

View File

@ -0,0 +1,41 @@
{
"operator": [
{
"Surname": "Иванов",
"Name": "Иван",
"Patronymic": "Иванович",
"BirthDay": "01-01-2001",
"Login": "ivan",
"Email": "ivann@mail.ru",
"Password": "123456"
}
],
"tour": [
{
"TourName": "Тур 1"
},
{
"TourName": "Тур 2"
},
{
"TourName": "Тур 3"
}
],
"guide": [
{
"Name": "Сергей",
"Surname": "Пушкин",
"Patronymic": "Николаевич"
},
{
"Name": "Анна",
"Surname": "Сидоров",
"Patronymic": "Ивановна"
},
{
"Name": "Иван",
"Surname": "Бабушкин",
"Patronymic": "Петрович"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -0,0 +1,18 @@
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,4 @@
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2011-2021 Twitter, Inc.
Copyright (c) 2011-2021 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,427 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,424 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr ;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More