Initial commit
This commit is contained in:
parent
02a197e535
commit
881a42b709
6
EnvelopeGenerator.Application/DTOs/SignInDto.cs
Normal file
6
EnvelopeGenerator.Application/DTOs/SignInDto.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
public record SignInDto(
|
||||
string Password
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
80
EnvelopeGenerator.Domain/Entities/Envelope.cs
Normal file
80
EnvelopeGenerator.Domain/Entities/Envelope.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EnvelopeGenerator.Domain.Entities
|
||||
{
|
||||
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
|
||||
public class Envelope
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column("GUID")]
|
||||
public int Guid { get; set; }
|
||||
|
||||
[Column("DOCUMENT_ID")]
|
||||
[Required]
|
||||
public int DocumentId { get; set; }
|
||||
|
||||
[Column("RECEIVER_ID")]
|
||||
[Required]
|
||||
public int ReceiverId { get; set; }
|
||||
|
||||
[Column("ELEMENT_TYPE")]
|
||||
[Required]
|
||||
[DefaultValue(0)] // This requires using System.ComponentModel
|
||||
public int ElementType { get; set; }
|
||||
|
||||
[Column("POSITION_X")]
|
||||
[Required]
|
||||
[DefaultValue(0f)]
|
||||
public float PositionX { get; set; }
|
||||
|
||||
[Column("POSITION_Y")]
|
||||
[Required]
|
||||
[DefaultValue(0f)]
|
||||
public float PositionY { get; set; }
|
||||
|
||||
[Column("WIDTH")]
|
||||
[Required]
|
||||
[DefaultValue(0f)]
|
||||
public float Width { get; set; }
|
||||
|
||||
[Column("HEIGHT")]
|
||||
[Required]
|
||||
[DefaultValue(0f)]
|
||||
public float Height { get; set; }
|
||||
|
||||
[Column("PAGE")]
|
||||
[Required]
|
||||
[DefaultValue(1)]
|
||||
public int Page { get; set; }
|
||||
|
||||
[Column("REQUIRED")]
|
||||
[Required]
|
||||
[DefaultValue(false)]
|
||||
public bool Required { get; set; }
|
||||
|
||||
[Column("TOOLTIP")]
|
||||
public string Tooltip { get; set; }
|
||||
|
||||
[Column("READ_ONLY")]
|
||||
[Required]
|
||||
[DefaultValue(false)]
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
[Column("ANNOTATION_INDEX")]
|
||||
[Required]
|
||||
[DefaultValue(0)]
|
||||
public int AnnotationIndex { get; set; }
|
||||
|
||||
[Column("ADDED_WHEN")]
|
||||
[Required]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)] // Assuming getdate() is meant for default value on insert
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
[Column("CHANGED_WHEN")]
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
}
|
||||
}
|
||||
9
EnvelopeGenerator.Domain/EnvelopeGenerator.Domain.csproj
Normal file
9
EnvelopeGenerator.Domain/EnvelopeGenerator.Domain.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@ -0,0 +1,9 @@
|
||||
using DigitalData.Common.CleanArchitecture.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
{
|
||||
public class EnvelopeRepository
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -8,13 +8,16 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
public class BaseController : Controller
|
||||
{
|
||||
protected readonly IConfiguration _configuration;
|
||||
|
||||
internal DatabaseService database;
|
||||
internal LogConfig logConfig;
|
||||
internal State state;
|
||||
public Logger logger;
|
||||
|
||||
public BaseController(DatabaseService database, LoggingService logging)
|
||||
public BaseController(DatabaseService database, LoggingService logging, IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
this.database = database;
|
||||
this.logConfig = logging.LogConfig;
|
||||
this.logger = logging.LogConfig.GetLogger();
|
||||
|
||||
@ -10,7 +10,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
private readonly EnvelopeService envelopeService;
|
||||
private readonly ActionService? actionService;
|
||||
|
||||
public DocumentController(DatabaseService database, LoggingService logging, EnvelopeService envelope) : base(database, logging)
|
||||
public DocumentController(DatabaseService database, LoggingService logging, EnvelopeService envelope, IConfiguration configuration) : base(database, logging, configuration)
|
||||
{
|
||||
envelopeService = envelope;
|
||||
actionService = database.Services?.actionService;
|
||||
|
||||
@ -9,7 +9,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
private readonly EnvelopeService envelopeService;
|
||||
private readonly ActionService actionService;
|
||||
|
||||
public EnvelopeController(DatabaseService database, LoggingService logging, EnvelopeService envelope) : base(database, logging)
|
||||
public EnvelopeController(DatabaseService database, LoggingService logging, EnvelopeService envelope, IConfiguration configuration) : base(database, logging, configuration)
|
||||
{
|
||||
envelopeService = envelope;
|
||||
actionService = database.Services?.actionService;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using EnvelopeGenerator.Common;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Common;
|
||||
using EnvelopeGenerator.Web.Models;
|
||||
using EnvelopeGenerator.Web.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -11,7 +12,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
private readonly EnvelopeService _envelopeService;
|
||||
|
||||
public HomeController(DatabaseService databaseService, LoggingService loggingService, EnvelopeService envelopeService): base(databaseService, loggingService)
|
||||
public HomeController(DatabaseService databaseService, LoggingService loggingService, EnvelopeService envelopeService, IConfiguration configuration): base(databaseService, loggingService, configuration)
|
||||
{
|
||||
_envelopeService = envelopeService;
|
||||
}
|
||||
@ -25,34 +26,23 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
|
||||
[HttpPost]
|
||||
[Route("/")]
|
||||
public IActionResult DebugEnvelopes()
|
||||
public IActionResult DebugEnvelopes([FromForm]SignInDto signInDto)
|
||||
{
|
||||
try
|
||||
{
|
||||
StringValues passwordFromForm = HttpContext.Request.Form["password"];
|
||||
string passwordFromConfig = database.GetAppSetting("Config:AdminPassword");
|
||||
string? adminPassword = _configuration["Config:AdminPassword"];
|
||||
|
||||
if (passwordFromConfig == null)
|
||||
if (adminPassword == null)
|
||||
{
|
||||
ViewData["error"] = "No admin password configured!";
|
||||
return View("Index");
|
||||
}
|
||||
|
||||
if (passwordFromForm.Count != 1)
|
||||
{
|
||||
ViewData["error"] = "No admin password configured!";
|
||||
return View("Index");
|
||||
}
|
||||
|
||||
string password = passwordFromForm[0];
|
||||
|
||||
if (password == null)
|
||||
else if (signInDto.Password is null)
|
||||
{
|
||||
ViewData["error"] = "No password supplied!";
|
||||
return View("Index");
|
||||
}
|
||||
|
||||
if (password != passwordFromConfig)
|
||||
else if (signInDto.Password != adminPassword)
|
||||
{
|
||||
ViewData["error"] = "Wrong Password!";
|
||||
return View("Index");
|
||||
@ -97,56 +87,51 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("/EnvelopeKey/{EnvelopeReceiverId}/Locked")]
|
||||
public IActionResult ShowEnvelopePost()
|
||||
[Route("/EnvelopeKey/{envelopeReceiverId}/Locked")]
|
||||
public IActionResult ShowEnvelopePost([FromRoute] string envelopeReceiverId)
|
||||
{
|
||||
string envelopeKey = (string)HttpContext.Request.RouteValues["EnvelopeReceiverId"];
|
||||
|
||||
StringValues accessCodeFromForm = HttpContext.Request.Form["access_code"];
|
||||
|
||||
if (accessCodeFromForm.Count == 0)
|
||||
{
|
||||
return Redirect($"/EnvelopeKey/{envelopeKey}/Locked");
|
||||
return Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
||||
}
|
||||
|
||||
if (accessCodeFromForm.Count > 1)
|
||||
{
|
||||
return Redirect($"/EnvelopeKey/{envelopeKey}/Locked");
|
||||
return Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
||||
}
|
||||
|
||||
EnvelopeResponse response = _envelopeService.LoadEnvelope(envelopeKey);
|
||||
EnvelopeResponse response = _envelopeService.LoadEnvelope(envelopeReceiverId);
|
||||
string accessCode = response.Receiver.AccessCode;
|
||||
|
||||
if (string.IsNullOrEmpty(accessCodeFromForm[0]))
|
||||
{
|
||||
return Redirect($"/EnvelopeKey/{envelopeKey}/Locked");
|
||||
return Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
||||
}
|
||||
|
||||
if (accessCode.Equals(accessCodeFromForm[0], StringComparison.Ordinal))
|
||||
{
|
||||
bool actionResult = database.Services.actionService.EnterCorrectAccessCode(response.Envelope, response.Receiver);
|
||||
ViewData["EnvelopeKey"] = envelopeKey;
|
||||
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||
return View("ShowEnvelope");
|
||||
}
|
||||
else
|
||||
{
|
||||
bool actionResult = database.Services.actionService.EnterIncorrectAccessCode(response.Envelope, response.Receiver);
|
||||
return Redirect($"/EnvelopeKey/{envelopeKey}/Locked");
|
||||
return Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("/EnvelopeKey/{EnvelopeReceiverId}/Locked")]
|
||||
public IActionResult EnvelopeLocked()
|
||||
[Route("/EnvelopeKey/{envelopeReceiverId}/Locked")]
|
||||
public IActionResult EnvelopeLocked([FromRoute] string envelopeReceiverId)
|
||||
{
|
||||
ViewData["EnvelopeKey"] = HttpContext.Request.RouteValues["EnvelopeReceiverId"];
|
||||
|
||||
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[Route("/EnvelopeKey/{EnvelopeReceiverId}/Success")]
|
||||
public IActionResult EnvelopeSigned()
|
||||
@ -156,7 +141,6 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EnvelopeGenerator.Application\EnvelopeGenerator.Application.csproj" />
|
||||
<ProjectReference Include="..\EnvelopeGenerator.Common\EnvelopeGenerator.Common.vbproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
using DigitalData.Modules.Logging;
|
||||
using EnvelopeGenerator.Common;
|
||||
using EnvelopeGenerator.Web.Services;
|
||||
using Quartz;
|
||||
|
||||
namespace EnvelopeGenerator.Web
|
||||
{
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
<summary>Show envelopes</summary>
|
||||
@foreach (Envelope envelope in @group)
|
||||
{
|
||||
|
||||
<section>
|
||||
<article class="envelope">
|
||||
<strong><a href="/EnvelopeKey/@encodeEnvelopeKey(envelope)">@envelope.Title</a></strong>
|
||||
@ -36,7 +35,6 @@
|
||||
<div><strong>Datum</strong> @envelope.AddedWhen</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
}
|
||||
</details>
|
||||
|
||||
@ -44,5 +42,4 @@
|
||||
</section>
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
4
EnvelopeGenerator.Web/wwwroot/img/coffee.svg
Normal file
4
EnvelopeGenerator.Web/wwwroot/img/coffee.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" fill="currentColor" class="bi bi-cup-hot" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M.5 6a.5.5 0 0 0-.488.608l1.652 7.434A2.5 2.5 0 0 0 4.104 16h5.792a2.5 2.5 0 0 0 2.44-1.958l.131-.59a3 3 0 0 0 1.3-5.854l.221-.99A.5.5 0 0 0 13.5 6zM13 12.5a2 2 0 0 1-.316-.025l.867-3.898A2.001 2.001 0 0 1 13 12.5M2.64 13.825 1.123 7h11.754l-1.517 6.825A1.5 1.5 0 0 1 9.896 15H4.104a1.5 1.5 0 0 1-1.464-1.175" />
|
||||
<path d="m4.4.8-.003.004-.014.019a4 4 0 0 0-.204.31 2 2 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.6.6 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3 3 0 0 1-.202.388 5 5 0 0 1-.253.382l-.018.025-.005.008-.002.002A.5.5 0 0 1 3.6 4.2l.003-.004.014-.019a4 4 0 0 0 .204-.31 2 2 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.6.6 0 0 0-.09-.252A4 4 0 0 0 3.6 2.8l-.01-.012a5 5 0 0 1-.37-.543A1.53 1.53 0 0 1 3 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a6 6 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 4.4.8m3 0-.003.004-.014.019a4 4 0 0 0-.204.31 2 2 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.6.6 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3 3 0 0 1-.202.388 5 5 0 0 1-.253.382l-.018.025-.005.008-.002.002A.5.5 0 0 1 6.6 4.2l.003-.004.014-.019a4 4 0 0 0 .204-.31 2 2 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.6.6 0 0 0-.09-.252A4 4 0 0 0 6.6 2.8l-.01-.012a5 5 0 0 1-.37-.543A1.53 1.53 0 0 1 6 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a6 6 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 7.4.8m3 0-.003.004-.014.019a4 4 0 0 0-.204.31 2 2 0 0 0-.141.267c-.026.06-.034.092-.037.103v.004a.6.6 0 0 0 .091.248c.075.133.178.272.308.445l.01.012c.118.158.26.347.37.543.112.2.22.455.22.745 0 .188-.065.368-.119.494a3 3 0 0 1-.202.388 5 5 0 0 1-.252.382l-.019.025-.005.008-.002.002A.5.5 0 0 1 9.6 4.2l.003-.004.014-.019a4 4 0 0 0 .204-.31 2 2 0 0 0 .141-.267c.026-.06.034-.092.037-.103a.6.6 0 0 0-.09-.252A4 4 0 0 0 9.6 2.8l-.01-.012a5 5 0 0 1-.37-.543A1.53 1.53 0 0 1 9 1.5c0-.188.065-.368.119-.494.059-.138.134-.274.202-.388a6 6 0 0 1 .253-.382l.025-.035A.5.5 0 0 1 10.4.8" />
|
||||
</svg>
|
||||
@ -13,6 +13,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EnvelopeGenerator.Web", "En
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EnvelopeGenerator.Service", "EnvelopeGenerator.Service\EnvelopeGenerator.Service.vbproj", "{83ED2617-B398-4859-8F59-B38F8807E83E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvelopeGenerator.Domain", "EnvelopeGenerator.Domain\EnvelopeGenerator.Domain.csproj", "{A9E30AAC-A755-44E9-8707-1EC41A9075D4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvelopeGenerator.Application", "EnvelopeGenerator.Application\EnvelopeGenerator.Application.csproj", "{6C95C338-83A8-43D5-85DD-10A50F7E15D5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvelopeGenerator.Infrastructure", "EnvelopeGenerator.Infrastructure\EnvelopeGenerator.Infrastructure.csproj", "{1B5D99A2-F00D-4CED-A4F1-1FE03C423EF6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -39,6 +45,18 @@ Global
|
||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A9E30AAC-A755-44E9-8707-1EC41A9075D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A9E30AAC-A755-44E9-8707-1EC41A9075D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A9E30AAC-A755-44E9-8707-1EC41A9075D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A9E30AAC-A755-44E9-8707-1EC41A9075D4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6C95C338-83A8-43D5-85DD-10A50F7E15D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6C95C338-83A8-43D5-85DD-10A50F7E15D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6C95C338-83A8-43D5-85DD-10A50F7E15D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6C95C338-83A8-43D5-85DD-10A50F7E15D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1B5D99A2-F00D-4CED-A4F1-1FE03C423EF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1B5D99A2-F00D-4CED-A4F1-1FE03C423EF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1B5D99A2-F00D-4CED-A4F1-1FE03C423EF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1B5D99A2-F00D-4CED-A4F1-1FE03C423EF6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user