diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/MessageInfoLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/MessageInfoLogic.cs new file mode 100644 index 0000000..2ed4022 --- /dev/null +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/MessageInfoLogic.cs @@ -0,0 +1,25 @@ +using ElectronicsShopContracts.BindingModels; +using ElectronicsShopContracts.BusinessLogicContracts; +using ElectronicsShopContracts.SearchModels; +using ElectronicsShopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicsShopBusinessLogic.BusinessLogic +{ + public class MessageInfoLogic : IMessageInfoLogic + { + public bool Create(MessageInfoBindingModel model) + { + throw new NotImplementedException(); + } + + public List? ReadList(MessageInfoSearchModel? model) + { + throw new NotImplementedException(); + } + } +} diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs index e6bb4c3..97ef1c7 100644 --- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs +++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportClientLogic.cs @@ -18,7 +18,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic public ReportClientLogic(AbstractSaveToExcelClient abstractSaveToExcelClient, AbstractSaveToWordClient abstractSaveToWordClient, IPaymeantStorage paymeantStorage) { _saveToExcel = abstractSaveToExcelClient; _saveToWord= abstractSaveToWordClient; - _paymeantstorage= paymeantStorage; + _paymeantstorage = paymeantStorage; } public List GetPaymeants(ReportBindingModel model) { diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs index 2830f99..247925f 100644 --- a/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs +++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs @@ -12,7 +12,7 @@ namespace ElectronicsShopDataBaseImplement optionsBuilder) { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-O0N00SH\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); } diff --git a/ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopRestAPI.csproj b/ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopRestAPI.csproj index ddb68ec..3b42d88 100644 --- a/ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopRestAPI.csproj +++ b/ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopRestAPI.csproj @@ -9,6 +9,11 @@ + + + + + diff --git a/ElectronicsShop/ElectronicsShopRestAPI/Program.cs b/ElectronicsShop/ElectronicsShopRestAPI/Program.cs index 1b0f4c2..2228ccc 100644 --- a/ElectronicsShop/ElectronicsShopRestAPI/Program.cs +++ b/ElectronicsShop/ElectronicsShopRestAPI/Program.cs @@ -1,12 +1,19 @@ using ElectronicsShopBusinessLogic.BusinessLogic; +using ElectronicsShopBusinessLogic.MailWorker; +using ElectronicsShopBusinessLogic.OfficePackage; +using ElectronicsShopBusinessLogic.OfficePackage.Implements; +using ElectronicsShopContracts.BindingModels; using ElectronicsShopContracts.BusinessLogicContracts; using ElectronicsShopContracts.StorageContracts; using ElectronicsShopDataBaseImplement.Implements; using Microsoft.OpenApi.Models; +using Serilog; var builder = WebApplication.CreateBuilder(args); //todo logger!!! +builder.Services.AddControllersWithViews(); +builder.Services.AddSession(); // Äîáàâëÿåì ñåññèþ äëÿ àâòîðèçàöèè // Add services to the container. @@ -14,32 +21,85 @@ builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +builder.Services.AddSingleton(); + +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 = "ElectronicsShopRestAPI", Version = "v1" })); +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo + { + Title = "JurasicZooRestApi", + Version = "v1" + }); +}); + var app = builder.Build(); +var mailSender = app.Services.GetService(); + +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", "ElectronicsShopRestAPI v1")); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "JurasicZooRestApi v1")); } app.UseHttpsRedirection(); +app.UseRouting(); +app.UseStaticFiles(); +app.UseSession(); // Äîáàâëÿåì ñåññèþ äëÿ àâòîðèçàöèè + +app.UseRouting(); app.UseAuthorization(); -app.MapControllers(); +app.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}"); app.Run(); diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml index 5db8fa9..de5ba1e 100644 --- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml +++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Report.cshtml @@ -18,11 +18,16 @@
-
- -
-
- +
+ + + + + + + + +
\ No newline at end of file diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/log4net.config b/ElectronicsShop/ElectronicsShopShopClientApp/log4net.config new file mode 100644 index 0000000..d1a1da7 --- /dev/null +++ b/ElectronicsShop/ElectronicsShopShopClientApp/log4net.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file