Initial Commit.

New site in .NET 6 replacing .net framwk 4.8
This commit is contained in:
Cameron Taylor 2022-07-27 16:02:36 -04:00
commit 6bc14b88c9
25 changed files with 1276 additions and 0 deletions

12
.config/dotnet-tools.json Normal file
View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.7",
"commands": [
"dotnet-ef"
]
}
}
}

454
.gitignore vendored Normal file
View File

@ -0,0 +1,454 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# JetBrains Rider
.idea/
*.sln.iml
##
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

View File

@ -0,0 +1,34 @@

using CVRLIB.Printing;
namespace VSERVERWS.Global {
public static class Globals {
public static CVRPRINTER_MF264dw? CVP_MF264dw = null;
public static CVRPRINTER_MFC_L8900CDW? CVP_MFC_L8900CDW = null;
public static bool IsDevelopment = false;
public static void LoadPrinters() {
if (IsDevelopment) {
CVP_MF264dw = new CVRPRINTER_MF264dw("10.10.20.147", CVRPRINTER.PrinterStatusSource.VSERVERWS);
CVP_MFC_L8900CDW = new CVRPRINTER_MFC_L8900CDW("10.10.20.111", CVRPRINTER.PrinterStatusSource.VSERVERWS);
} else {
CVP_MF264dw = new CVRPRINTER_MF264dw("10.10.20.147", CVRPRINTER.PrinterStatusSource.Printer);
CVP_MFC_L8900CDW = new CVRPRINTER_MFC_L8900CDW("10.10.20.111", CVRPRINTER.PrinterStatusSource.Printer);
}
}
}
}

View File

@ -0,0 +1,23 @@
using System.Net;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace VSERVERWS.Controllers {
[Route("api/Generic/[action]")]
[ApiController]
public class GenericController : ControllerBase {
public static IPAddress IP = IPAddress.Parse("64.56.232.217");
[HttpGet]
public IActionResult IsAlive() {
return new JsonResult(new { STATUS = "CVRCO ONLINE", TIME = DateTime.Now });
}
}
}

View File

@ -0,0 +1,352 @@
using System.Net.Mail;
using System.Printing;
using System.Text.Json;
using System.Reflection;
using System.Drawing.Printing;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using CVRLIB.CVR;
using CVRLIB.Printing;
using CVRLIB.External.Communications;
using CVRLIB.Customers;
using static CVRLIB.Customers.PFUNCS;
using CVRLIB_NF.Printing;
using CVRLIB_NF.Customers;
using static VSERVERWS.Global.Globals;
namespace VSERVERWS.Controllers {
[Route("api/Payment/[action]")]
[ApiController]
public class PaymentController : ControllerBase {
public const bool PAY_STATUS_FORCE_OFFLINE = false;
[HttpGet]
public IActionResult PaymentStatus() {
CVRPRINTER_MF264dw CVP2 = CVP_MF264dw;
CVRPRINTER_MFC_L8900CDW CVP3 = CVP_MFC_L8900CDW;
NF_CVRPrinterCollection CVPC = new NF_CVRPrinterCollection(new[] { (CVRPRINTER)CVP2, (CVRPRINTER)CVP3 });
object? robj = null;
switch (true) {
//case true when CVP2.IsOnline && !PAY_STATUS_FORCE_OFFLINE:
//case true when CVP2.IsPrintReady && !PAY_STATUS_FORCE_OFFLINE:
case true when CVPC.IsOnline && !PAY_STATUS_FORCE_OFFLINE:
case true when CVPC.IsPrintReady && !PAY_STATUS_FORCE_OFFLINE:
Console.WriteLine("CVP1 -> OK");
robj = new { PRINTER_NAME = CVPC.ToString(), STATUS = "OK" };
break;
case true when CVPC.IsInError:
Console.WriteLine("CVPC -> ERROR");
robj = new {PRINTER_NAME = CVPC.ToString(), STATUS = "ERROR"};
AlertCVRtoPrinterERROR();
break;
case true when PAY_STATUS_FORCE_OFFLINE:
#pragma warning disable CS0162 // Unreachable code detected
Console.WriteLine("CVP1 -> OFFLINE");
robj = new {PRINTER_NAME = CVPC.ToString(), STATUS = "OFFLINE"};
AlertCVRtoPrinterERROR();
#pragma warning restore CS0162 // Unreachable code detected
break;
default:
Console.WriteLine("CVP1 -> ELSE");
robj = new {PRINTER_NAME = CVPC.ToString(), STATUS = "UNK"};
break;
}
return new JsonResult(robj);
}
private void AlertCVRtoPrinterERROR() {
try {
CVRPrinterCollection CVRPC = new CVRPrinterCollection(new[] { (CVRPRINTER)CVP_MF264dw, (CVRPRINTER)CVP_MFC_L8900CDW });
foreach (ICVRPrinter CVRP in CVRPC) {
string tS = "";
tS = CVRP.LastRawStatus;
CVRCO.TryWriteToLog("Raw Printer Status (" + CVRP.PrinterName + ") is: " + tS, "PRINTERS", "PRINTER_STATUS");
}
} catch {}
try {
string[] SA = CVRCO.get_SYSPARAM("PayStatusLastError");
DateTime LastError = DateTime.MinValue;
if (!string.IsNullOrEmpty(SA[1])) {
LastError = DateTime.Parse(SA[1]);
}
if (DateTime.Now.Subtract(LastError).Hours > 2) {
Email E = new Email();
E.SEND_FROM = Email.SEND_FROM_ENUM.OFFICE365;
string B = "Payment System Printer error / offline: Check applicable printer(s) for error or offline!";
string S = "<cc> Payment System Printer Error: Check Printer(s)!";
var eV = new List<EmailImage>();
E.TrySendEmail(B, true, new MailAddressCollection() { new MailAddress("query@cvrco.ca")}, new MailAddress("info@cvrco.ca", "CVRBOT"), S, null, null, ref eV);
CVRCO.set_SYSPARAM("PayStatusLastError", null, new[] { DateTime.Now.ToString() });
}
} catch { }
}
[HttpGet]
public IActionResult PaymentInfo() {
JsonResult JR = new JsonResult(new { RESULT = "TEST OK!", PATH = Assembly.GetExecutingAssembly()?.FullName });
return JR;
}
[HttpPost]
public IActionResult PaymentInfo([FromForm] PayInfo inPI) {
CI_NF CI_N = inPI.ToCI();
object? rOBJ = null;
Email E = new Email();
E.SEND_FROM = Email.SEND_FROM_ENUM.OFFICE365;
bool DupRetry = false;
CI? tCI = null;
CCRETRY:
try {
CI_N.SaveToDB();
try {
CI_N.Print();
} catch (Exception ex) {
CVRPrinterCollection CVRPC = new CVRPrinterCollection(new[] { (CVRPRINTER)CVP_MF264dw, (CVRPRINTER)CVP_MFC_L8900CDW });
foreach (CVRPRINTER CVRP in CVRPC) {
string tS = "";
if (!CVRP.TryGetRawStatus(ref tS)) {
tS = "<unk>";
}
CVRCO.TryWriteToLog("Raw Printer Status (" + CVRP.PrinterName + ") is: " + tS, "PRINTERS", "PRINTER_STATUS");
}
var ev1 = new List<EmailImage>();
E.TrySendEmail("Web Credit Card printer error; check printer(s).",
false,
new MailAddressCollection() { new MailAddress("query@cvrco.ca")}, new MailAddress("info@cvrco.ca", "CVRBOT"),
"<cc> Web CC Printer Failure, Check Printer(s)",
null, null, ref ev1);
if (rOBJ == null) {
rOBJ = new { SUCCESS = false, DATA = "P" };
}
try {
CI_N.Delete();
} catch (Exception pex) {
throw;
}
throw;
}
string W = "Provided";
if (DupRetry) { W = "Updated"; }
string B = "CC Info " + W + ", Use: " + CI_N.UID + @" / LAST5: " + CI_N.LAST5 + " FOR: " + CI_N.REF_NUM;
string S = "<cc> CC Info " + W + ", Use: " + CI_N.UID + " for: " + CI_N.REF_NUM;
if (DupRetry) {
B += "<br>REPLACE CC SHEET!";
S += " & Replace Sheet!";
}
var ev = new List<EmailImage>();
E.TrySendEmail(B,
true,
new MailAddressCollection() { new MailAddress("query@cvrco.ca")},
new MailAddress("info@cvrco.ca", "CVRBOT"),
S,
null, null, ref ev);
if (rOBJ == null) {
rOBJ = new { SUCCESS = true, DATA = "N-" + CI_N.UID };
}
} catch (AttemptedToAddDuplicateCIException ex) {
//email to store with dup meta details ie ref num / name
CICollection CIC = new CICollection(CI_N.CHASH);
if (CIC.Count == 1) {
foreach (string K in CIC.Keys) {
tCI = CIC[K];
break;
}
}
string B = "";
string S = "";
string D = "S";
if (tCI != null) {
if ((!DupRetry && tCI.EXPIRY.Year != CI_N.EXPIRY.Year || tCI.EXPIRY.Month != CI_N.EXPIRY.Month) &&
(CI_N.FNAME.ToLower().Trim() == tCI.FNAME.ToLower().Trim() ||
CI_N.LNAME.ToLower().Trim() == tCI.LNAME.ToLower().Trim() ||
CI_N.PHONE.Trim() == tCI.PHONE.Trim() ||
CI_N.EMAIL.ToLower().Trim() == tCI.EMAIL.ToLower().Trim()
)) {
CI_N.UID = tCI.UID;
CI_N.LNAME = tCI.LNAME;
DupRetry = true;
goto CCRETRY;
}
D += "-" + tCI.UID;
B = "Attempted to Add duplicate Credit Card from WEB. <br><br><b>Details (OLD | NEW):</b><br> Ref: " + CI_N.REF_NUM + "<br> USE: " + tCI.UID + "<br>CVNUM: " + tCI.CUST_UID + " | " + CI_N.CUST_UID + "<br>FNAME: " + tCI.FNAME + " | " + CI_N.FNAME + "<br>LNAME: " + tCI.LNAME + " | " + CI_N.LNAME + "<br>PHONE: " + tCI.PHONE + " | " + CI_N.PHONE + "<br>EMAIL: " + tCI.EMAIL + " | " + CI_N.EMAIL + "<br>LAST5: " + tCI.LAST5 + " | " + CI_N.LAST5 + "<br>EXPIRY: " + tCI.EXPIRY.ToString("MM / yyyy") + " | " + CI_N.EXPIRY.ToString("MM / yyyy") + "<br>CVV (NEW ONLY): " + CI_N.SD;
S = "<cc> Duplicate CC received for Ref Num: " + CI_N.REF_NUM + " Use Card: " + tCI.UID;
} else {
B = "Attempted to Add duplicate Credit Card from WEB.<br><br><b>Details (OLD | NEW):</b><br> Ref: " + CI_N.REF_NUM + "<br><br>ERROR FETCHING EXISTING CARD DETAILS!";
S = "<cc> Duplicate CC received for Ref Num: " + CI_N.REF_NUM + "Use Card: UNK";
}
var ev = new List<EmailImage>();
E.TrySendEmail(B,
true,
new MailAddressCollection() { new MailAddress("query@cvrco.ca")},
new MailAddress("info@cvrco.ca", "CVRBOT"),
S,
null,null, ref ev);
if (rOBJ == null) { rOBJ = new { SUCCESS = true, DATA = D }; }
} catch (Exception ex) {
string B = "General Web CC add exception, MSG: " + ex.Message + "<br><br>STACK: " + ex.StackTrace;
string S = "<cc> Web CC General Failure";
var ev = new List<EmailImage>();
E.TrySendEmail(B,
true,
new MailAddressCollection() { new MailAddress("query@cvrco.ca")},
new MailAddress("info@cvrco.ca", "CVRBOT"),
S,
null, null, ref ev);
if (rOBJ == null) { rOBJ = new { SUCCESS = false, DATA = "F" }; }
}
var JR = new JsonResult(rOBJ);
return JR;
}
public class PayInfo {
public string RFNUM { get; set; } = "";
public string? CVNUM { get; set; } = "";
public string FNAME { get; set; } = "";
public string LNAME { get; set; } = "";
public string PHONE { get; set; } = "";
public string EMAIL { get; set; } = "";
public string CDNAM { get; set; } = "";
public string CDNUM { get; set; } = "";
public string EXPDT { get; set; } = "";
public string CVDIG { get; set; } = "";
public string CRDTY { get; set; } = "";
public string CDDLD { get; set; } = "";
public CI_NF ToCI() {
var rCI = new CI_NF();
rCI.CN = CDNUM;
rCI.EXPIRY = DateTime.Parse(EXPDT);
rCI.SD = CVDIG;
rCI.CT = StoCTE(CRDTY);
rCI.FNAME = FNAME;
rCI.LNAME = LNAME;
rCI.CUST_UID = CVNUM;
rCI.PHONE = PHONE;
rCI.EMAIL = EMAIL;
DateTime tDLD = DateTime.Now.AddDays(14);
if (!DateTime.TryParse(CDDLD, out tDLD)) {
tDLD = DateTime.Now.AddDays(14);
}
rCI.DELETE_DATE = tDLD;
rCI.REF_NUM = RFNUM;
return rCI;
}
}
}
}

View File

@ -0,0 +1,50 @@
using System.Printing;
using System.Drawing.Printing;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using CVRLIB.Printing;
using CVRLIB_NF.Printing;
using static VSERVERWS.Global.Globals;
namespace VSERVERWS.Controllers {
[Route("api/Printer/[action]")]
[ApiController]
public class PrinterController : ControllerBase {
[HttpGet("{id}")]
public IActionResult PrinterStatus(string id) {
//testing:
//https://localhost:7210/api/Printer/PrinterStatus/Canon%20MF260_10.10.20.147
//https://localhost:7210/api/Printer/PrinterStatus/Brother%20MFC-L8900CDW_10.10.20.111
var CVPC = new CVRPrinterCollection(new[] { (CVRPRINTER)CVP_MF264dw, (CVRPRINTER)CVP_MFC_L8900CDW });
var PSR = new PrinterStatusResponse();
foreach (CVRPRINTER CVP in CVPC) {
if (CVP.PrinterName.ToLower() == id.ToLower()) {
PSR.RawStatus = CVP.LastRawStatus;
PSR.STATUS = CVP.LastStatus.ToString();
PSR.PRINTER_NAME = CVP.PrinterName;
break;
}
}
return new JsonResult(PSR);
}
}
}

26
Pages/Error.cshtml Normal file
View File

@ -0,0 +1,26 @@
@page
@model ErrorModel
@{
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 the <strong>Development</strong> environment displays 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>

23
Pages/Error.cshtml.cs Normal file
View File

@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;
namespace VSERVERWS.Pages {
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel {
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger) {
_logger = logger;
}
public void OnGet() {
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}

10
Pages/Index.cshtml Normal file
View File

@ -0,0 +1,10 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

16
Pages/Index.cshtml.cs Normal file
View File

@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace VSERVERWS.Pages {
public class IndexModel : PageModel {
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger) {
_logger = logger;
}
public void OnGet() {
}
}
}

8
Pages/Privacy.cshtml Normal file
View File

@ -0,0 +1,8 @@
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

15
Pages/Privacy.cshtml.cs Normal file
View File

@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace VSERVERWS.Pages {
public class PrivacyModel : PageModel {
private readonly ILogger<PrivacyModel> _logger;
public PrivacyModel(ILogger<PrivacyModel> logger) {
_logger = logger;
}
public void OnGet() {
}
}
}

View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - VSERVERWS</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="~/VSERVERWS.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">
<a class="navbar-brand" asp-area="" asp-page="/Index">VSERVERWS</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-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 justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</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; 2022 - VSERVERWS - <a asp-area="" asp-page="/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,3 @@
@using VSERVERWS
@namespace VSERVERWS.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

3
Pages/_ViewStart.cshtml Normal file
View File

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

45
Program.cs Normal file
View File

@ -0,0 +1,45 @@
//ZXING.dll does not copy properly to publish folder, copy manually from another lib, ie cvrlib-nf.
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddControllers().AddJsonOptions((options => {
//was changing PRINTER_NAME to printeR_NAME (pascal Case: https://github.com/dotnet/runtime/issues/30887)
options.JsonSerializerOptions.PropertyNamingPolicy = null;
}));
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment()) {
app.UseExceptionHandler("/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();
}
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapControllers();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
VSERVERWS.Global.Globals.LoadPrinters();

View File

@ -0,0 +1,35 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:46330",
"sslPort": 44369
}
},
"profiles": {
"VSERVERWS": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:7210;http://localhost:5210",
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"VSERVER2": {
"commandName": "IIS",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

26
VSERVERWS.csproj Normal file
View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="11.3.0" />
<PackageReference Include="Magick.NET.Core" Version="11.3.0" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
<PackageReference Include="ZXing.Net" Version="0.16.8" />
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
</ItemGroup>
<ItemGroup>
<Reference Include="CVRLIB">
<HintPath>..\..\VB.NET\CVRLIB\CVRLIB\bin\Release\netstandard2.0\CVRLIB.dll</HintPath>
</Reference>
<Reference Include="CVRLIB-NF">
<HintPath>..\..\VB.NET\CVRLIB-NF\CVRLIB-NF\bin\Release\CVRLIB-NF.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

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

9
appsettings.json Normal file
View File

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

18
wwwroot/css/site.css Normal file
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;
}

BIN
wwwroot/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

4
wwwroot/js/site.js Normal file
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.