Rest api
This commit is contained in:
parent
23f4584b8a
commit
c48aa77d13
@ -1,236 +0,0 @@
|
||||
using DocumentFormat.OpenXml.Presentation;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceSourceBusinessLogic.MailKitWorker;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationContracts.SearchModels;
|
||||
using ServiceStationContracts.ViewModels;
|
||||
using ServiceStationDataModels.Models;
|
||||
|
||||
namespace ServiceSourceRestAPI.Controllers {
|
||||
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
|
||||
public class MainController : Controller {
|
||||
private readonly ILogger _logger;
|
||||
private readonly IClientLogic _clientLogic;
|
||||
private readonly IExecutorLogic _executorLogic;
|
||||
private readonly IReportLogic _reportLogic;
|
||||
private readonly ITaskLogic _taskLogic;
|
||||
private readonly IWorkLogic _workLogic;
|
||||
|
||||
private readonly AbstractMailWorker _mailWorker;
|
||||
|
||||
public MainController(ILogger<MainController> logger, IClientLogic clientLogic, IExecutorLogic executorLogic,
|
||||
IReportLogic reportLogic, ITaskLogic taskLogic, IWorkLogic workLogic, AbstractMailWorker mailWorker) {
|
||||
_logger = logger;
|
||||
_clientLogic = clientLogic;
|
||||
_executorLogic = executorLogic;
|
||||
_reportLogic = reportLogic;
|
||||
_taskLogic = taskLogic;
|
||||
_workLogic = workLogic;
|
||||
_mailWorker = mailWorker;
|
||||
}
|
||||
|
||||
public void Register(ExecutorBindingModel model) {
|
||||
try {
|
||||
_executorLogic.Create(model);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка регистрации");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ExecutorViewModel? Login (string email, string password) {
|
||||
try {
|
||||
return _executorLogic.ReadElement(new ExecutorSearchModel {
|
||||
Email = email,
|
||||
Password = password
|
||||
});
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateData(ExecutorBindingModel model) {
|
||||
try {
|
||||
_executorLogic.Update(model);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка обновления данных");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public WorkBindingModel Make_New_Record_Work(WorkFromWebBindingModel model) {
|
||||
var record = new WorkBindingModel {
|
||||
Id = model.Id,
|
||||
Date = model.Date,
|
||||
Price = model.Price,
|
||||
ExecutorId = model.ExecutorId,
|
||||
TaskId = model.TaskId,
|
||||
ClientList = new()
|
||||
};
|
||||
|
||||
foreach (char id in model.client_ids) {
|
||||
if (int.TryParse(id.ToString(), out int _id)) {
|
||||
var client = _clientLogic.ReadElement(new ClientSearchModel { Id = _id }) ?? throw new Exception("Ошибка получения данных");
|
||||
record.ClientList.Add(client.Id, (client));
|
||||
}
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateWork(WorkFromWebBindingModel model) {
|
||||
var record = Make_New_Record_Work(model);
|
||||
try {
|
||||
_workLogic.Create(record);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка создания работы");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateWork(WorkFromWebBindingModel model) {
|
||||
var record = Make_New_Record_Work(model);
|
||||
try {
|
||||
_workLogic.Update(record);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка обновления работы");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteWork(WorkBindingModel model) {
|
||||
try {
|
||||
_workLogic.Delete(model);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка удаления работы");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<WorkViewModel>? GetWorks(int _executorId) {
|
||||
try {
|
||||
return _workLogic.ReadList(new WorkSearchModel {
|
||||
ExecutorId = _executorId
|
||||
});
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, $"Ошибка получения работ исполнителя || id = {_executorId}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public WorkViewModel? GetWork(int _workId) {
|
||||
try {
|
||||
return _workLogic.ReadElement(new WorkSearchModel { Id = _workId });
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, $"Ошибка получения работы || work_id = {_workId}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<TaskViewModel>? GetTasks() {
|
||||
try {
|
||||
return _taskLogic.ReadList();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, $"Ошибка получения задач");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<ClientViewModel>? GetClients() {
|
||||
try {
|
||||
return _clientLogic.ReadList();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка получения клиентов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// todo Post method -- AddClientPoints
|
||||
|
||||
public List<int> Make_Report_Ids(string _ids) {
|
||||
var ids = new List<int>();
|
||||
foreach (char id in _ids) {
|
||||
if (int.TryParse(id.ToString(), out int _id)) {
|
||||
ids.Add(_id);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public byte[]? CreateWordReport(string _ids) {
|
||||
var ids_list = Make_Report_Ids(_ids);
|
||||
try {
|
||||
var document = _reportLogic.SaveToWordFile(new ReportBindeingModel {
|
||||
ids = ids_list
|
||||
});
|
||||
return document;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка создания документа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public byte[]? CreateXlsxReport(string _ids) {
|
||||
var ids_list = Make_Report_Ids(_ids);
|
||||
try {
|
||||
var document = _reportLogic.SaveToExcelFile(new ReportBindeingModel {
|
||||
ids = ids_list
|
||||
});
|
||||
return document;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка создания документа");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void SendReportPdfMail (ReportBindeingModel model) {
|
||||
try {
|
||||
var _document = _reportLogic.SaveToPdfFile(model);
|
||||
|
||||
MemoryStream stream = new();
|
||||
_document.Save(stream, true);
|
||||
byte[] data = stream.ToArray();
|
||||
|
||||
_mailWorker.MailSendAsync(new() {
|
||||
MailAddress = model.EmailAddress,
|
||||
Subject = "Отчет",
|
||||
Text = $"Отчет по работам с указания назначенных заданий за период с {model.DateFrom.ToLongDateString()} по " +
|
||||
$"{model.DateTo.ToShortDateString()}",
|
||||
document = data
|
||||
});
|
||||
}
|
||||
catch (Exception ex) {
|
||||
_logger.LogError(ex, "Ошибка создания/отправки отчета на почту");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Serilog;
|
||||
using ServiceSourceBusinessLogic.BusinessLogic;
|
||||
using ServiceSourceBusinessLogic.MailKitWorker;
|
||||
using ServiceSourceBusinessLogic.OfficePackage;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.Implements;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationsContracts.StorageContracts;
|
||||
using ServiceStationsDataBaseImplement.Implements;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddControllersWithViews();
|
||||
builder.Services.AddSession();
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
builder.Services.AddTransient<IExecutorStorage, ExecutorStorage>();
|
||||
builder.Services.AddTransient<ITaskStorage, TaskStorage>();
|
||||
builder.Services.AddTransient<IWorkStorage, WorkStorage>();
|
||||
|
||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<IExecutorLogic, ExecutorLogic>();
|
||||
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
||||
builder.Services.AddTransient<ITaskLogic, TaskLogic>();
|
||||
builder.Services.AddTransient<IWorkLogic, WorkLogic>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcek>();
|
||||
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
|
||||
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
|
||||
builder.Services.AddLogging(option => {
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
|
||||
.Build();
|
||||
|
||||
var logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.CreateLogger();
|
||||
|
||||
option.AddSerilog(logger);
|
||||
});
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(x => x.SwaggerDoc("v1", new OpenApiInfo { Title = "ServiceSourceRestAPI", Version = "v1" }));
|
||||
|
||||
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())
|
||||
});
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment()) {
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(x => x.SwaggerEndpoint("/swagger/v1/swagger.json", "ServiceSourceRestAPI v1"));
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseRouting();
|
||||
app.UseStaticFiles();
|
||||
app.UseSession();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
@ -1,6 +0,0 @@
|
||||
@ServiceSourceRestAPI_HostAddress = http://localhost:5047
|
||||
|
||||
GET {{ServiceSourceRestAPI_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"SmtpClientHost": "smtp.gmail.com",
|
||||
"SmtpClientPort": "587",
|
||||
"PopHost": "pop.gmail.com",
|
||||
"PopPort": "995",
|
||||
"MailLogin": "servicesource408@gmail.com",
|
||||
"MailPassword": "Service_source010234"
|
||||
}
|
@ -9,11 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationsDataBaseImpl
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationContracts", "ServiceStationContracts\ServiceStationContracts.csproj", "{6758A476-8AC7-4558-AC45-E2EDBAA71C59}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceSourceRestAPI", "ServiceSourceRestAPI\ServiceSourceRestAPI.csproj", "{B886DD9F-92FF-4D0D-B23D-8BCA9A95E092}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationBusinessLogic", "ServiceStationBusinessLogic\ServiceStationBusinessLogic.csproj", "{E3C21F43-152C-4770-88A9-0CF5B182E6AD}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceSourceExecutorApp", "ServiceSourceClientApp\ServiceSourceExecutorApp.csproj", "{809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceSourceBusinessLogic", "ServiceSourceBusinessLogic\ServiceSourceBusinessLogic.csproj", "{A114772E-80AB-43A2-9D00-AB19F309F6ED}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStationRestAPI", "ServiceStationRestAPI\ServiceStationRestAPI.csproj", "{6EA674DA-F458-4662-BBE5-7F5C45D5AE5C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -33,18 +31,14 @@ Global
|
||||
{6758A476-8AC7-4558-AC45-E2EDBAA71C59}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6758A476-8AC7-4558-AC45-E2EDBAA71C59}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6758A476-8AC7-4558-AC45-E2EDBAA71C59}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B886DD9F-92FF-4D0D-B23D-8BCA9A95E092}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B886DD9F-92FF-4D0D-B23D-8BCA9A95E092}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B886DD9F-92FF-4D0D-B23D-8BCA9A95E092}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B886DD9F-92FF-4D0D-B23D-8BCA9A95E092}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{809ECE9C-4CB6-4F44-BEFE-49ABC38151D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A114772E-80AB-43A2-9D00-AB19F309F6ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A114772E-80AB-43A2-9D00-AB19F309F6ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A114772E-80AB-43A2-9D00-AB19F309F6ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A114772E-80AB-43A2-9D00-AB19F309F6ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E3C21F43-152C-4770-88A9-0CF5B182E6AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E3C21F43-152C-4770-88A9-0CF5B182E6AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E3C21F43-152C-4770-88A9-0CF5B182E6AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E3C21F43-152C-4770-88A9-0CF5B182E6AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6EA674DA-F458-4662-BBE5-7F5C45D5AE5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6EA674DA-F458-4662-BBE5-7F5C45D5AE5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6EA674DA-F458-4662-BBE5-7F5C45D5AE5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6EA674DA-F458-4662-BBE5-7F5C45D5AE5C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,7 +0,0 @@
|
||||
namespace ServiceStation
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using ServiceStationContracts.SearchModels;
|
||||
using ServiceStationContracts.ViewModels;
|
||||
using ServiceStationsContracts.StorageContracts;
|
||||
using ServiceStationContracts.StorageContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -12,7 +12,7 @@ using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.BusinessLogic {
|
||||
namespace ServiceStationBusinessLogic.BusinessLogic {
|
||||
public class ClientLogic : IClientLogic {
|
||||
|
||||
private readonly ILogger _logger;
|
@ -1,16 +1,16 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using ServiceStationContracts.SearchModels;
|
||||
using ServiceStationContracts.ViewModels;
|
||||
using ServiceStationsContracts.StorageContracts;
|
||||
using ServiceStationContracts.StorageContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.BusinessLogic {
|
||||
namespace ServiceStationBusinessLogic.BusinessLogic {
|
||||
public class ExecutorLogic : IExecutorLogic {
|
||||
|
||||
private readonly ILogger _logger;
|
@ -1,19 +1,19 @@
|
||||
using DocumentFormat.OpenXml.Office.CustomUI;
|
||||
using PdfSharp.Pdf;
|
||||
using ServiceSourceBusinessLogic.OfficePackage;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperModels;
|
||||
using PdfSharp.Pdf;
|
||||
using ServiceStationBusinessLogic.OfficePackage;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperModels;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using ServiceStationContracts.SearchModels;
|
||||
using ServiceStationContracts.ViewModels;
|
||||
using ServiceStationsContracts.StorageContracts;
|
||||
using ServiceStationContracts.StorageContracts;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.BusinessLogic {
|
||||
|
||||
namespace ServiceStationBusinessLogic.BusinessLogic {
|
||||
public class ReportLogic : IReportLogic {
|
||||
|
||||
private readonly IWorkStorage _workStorage;
|
@ -1,16 +1,16 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using ServiceStationContracts.SearchModels;
|
||||
using ServiceStationContracts.ViewModels;
|
||||
using ServiceStationsContracts.StorageContracts;
|
||||
using ServiceStationContracts.StorageContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.BusinessLogic {
|
||||
namespace ServiceStationBusinessLogic.BusinessLogic {
|
||||
public class TaskLogic : ITaskLogic {
|
||||
|
||||
private readonly ILogger _logger;
|
@ -1,23 +1,23 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using ServiceStationContracts.SearchModels;
|
||||
using ServiceStationContracts.ViewModels;
|
||||
using ServiceStationsContracts.StorageContracts;
|
||||
using ServiceStationContracts.StorageContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.BusinessLogic
|
||||
namespace ServiceStationBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class WorkLogic : IWorkLogic {
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IWorkStorage _storage;
|
||||
|
||||
private WorkLogic(ILogger<IWorkLogic> logger, IWorkStorage storage) {
|
||||
public WorkLogic(ILogger<IWorkLogic> logger, IWorkStorage storage) {
|
||||
_logger = logger;
|
||||
_storage = storage;
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.MailKitWorker {
|
||||
namespace ServiceStationBusinessLogic.MailKitWorker {
|
||||
public abstract class AbstractMailWorker {
|
||||
protected string _mailLogin = string.Empty;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogicContracts;
|
||||
using ServiceStationContracts.BusinessLogic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,7 +9,7 @@ using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.MailKitWorker {
|
||||
namespace ServiceStationBusinessLogic.MailKitWorker {
|
||||
public class MailKitWorker :AbstractMailWorker {
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger,
|
||||
IClientLogic clientLogic) : base(logger, clientLogic) { }
|
@ -1,12 +1,12 @@
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperModels;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage
|
||||
namespace ServiceStationBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToExcel {
|
||||
public byte[]? CreateReport(ExcelInfo info) {
|
@ -1,13 +1,13 @@
|
||||
using PdfSharp.Pdf;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperModels;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage {
|
||||
public abstract class AbstractSaveToPdf {
|
||||
|
||||
public PdfDocument CreateDoc (PdfInfo info) {
|
@ -1,12 +1,12 @@
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperModels;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage {
|
||||
public abstract class AbstractSaveToWord {
|
||||
|
||||
public byte[]? CreateDoc(WordInfo info) {
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperEnums {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperEnums {
|
||||
public enum ExcelStyleInfoType {
|
||||
Title,
|
||||
Text,
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperEnums {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperEnums {
|
||||
public enum PdfParagraphAlignmentType {
|
||||
Center,
|
||||
Left,
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperEnums {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperEnums {
|
||||
public enum WordJustificationType {
|
||||
Center,
|
||||
Both
|
@ -1,11 +1,11 @@
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class ExcelCellParameters {
|
||||
public string ColumnName { get; set; } = string.Empty;
|
||||
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class ExcelInfo {
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportClientsInWorksViewModel> WorksClients { get; set; } = new();
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class ExcelMergeParameters {
|
||||
public string CellFromName { get; set; } = string.Empty;
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class PdfInfo {
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Date_From { get; set; } = string.Empty;
|
@ -1,11 +1,11 @@
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class PdfParagraph {
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public string Style { get; set; } = string.Empty;
|
@ -1,11 +1,11 @@
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class PdfRowParameters {
|
||||
public List<string> Text { get; set; } = new();
|
||||
public string Style { get; set; } = string.Empty;
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class WordInfo {
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public List<ReportClientsInWorksViewModel> WorksClients { get; set; } = new();
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class WordParagraph {
|
||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||
|
@ -1,6 +1,6 @@
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.HelperModels {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.HelperModels {
|
||||
public class WordTextProperties {
|
||||
public string Size { get; set; } = string.Empty;
|
||||
|
@ -3,16 +3,16 @@ using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using DocumentFormat.OpenXml.Office2013.Excel;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperModels;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.Implements {
|
||||
public class SaveToExcek : AbstractSaveToExcel {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.Implements {
|
||||
public class SaveToExcel : AbstractSaveToExcel {
|
||||
private SpreadsheetDocument? _spreadsheetDocument;
|
||||
|
||||
private SharedStringTablePart? _shareStringPart;
|
@ -2,15 +2,15 @@
|
||||
using MigraDoc.DocumentObjectModel.Tables;
|
||||
using MigraDoc.Rendering;
|
||||
using PdfSharp.Pdf;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperModels;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.Implements {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.Implements {
|
||||
public class SaveToPdf : AbstractSaveToPdf {
|
||||
|
||||
private Document? _document;
|
@ -1,15 +1,15 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using DocumentFormat.OpenXml;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceSourceBusinessLogic.OfficePackage.HelperModels;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperEnums;
|
||||
using ServiceStationBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServiceSourceBusinessLogic.OfficePackage.Implements {
|
||||
namespace ServiceStationBusinessLogic.OfficePackage.Implements {
|
||||
public class SaveToWord : AbstractSaveToWord {
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user