Compare commits

...

5 Commits

7 changed files with 183 additions and 20 deletions

1
.gitignore vendored
View File

@ -452,3 +452,4 @@ $RECYCLE.BIN/
!.vscode/tasks.json !.vscode/tasks.json
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json
/AppData/Puce

View File

@ -29,6 +29,5 @@ namespace VSERVERWS.Global {
} }
} }
} }

View File

@ -249,6 +249,13 @@ CCRETRY:
CI_N.EMAIL.ToLower().Trim() == tCI.EMAIL.ToLower().Trim() CI_N.EMAIL.ToLower().Trim() == tCI.EMAIL.ToLower().Trim()
)) { )) {
if (tCI.EXPIRY.Ticks > CI_N.EXPIRY.Ticks) {
//had to be added in case they send a duplicate card #, but provide old expiry date.
//so skip saving if the current expiry is greater than the one provided.
goto SKIP_REENTER;
}
CI_N.UID = tCI.UID; CI_N.UID = tCI.UID;
CI_N.LNAME = tCI.LNAME; CI_N.LNAME = tCI.LNAME;
@ -256,6 +263,8 @@ CCRETRY:
goto CCRETRY; goto CCRETRY;
} }
SKIP_REENTER:
D += "-" + tCI.UID; 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; 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; S = "<cc> Duplicate CC received for Ref Num: " + CI_N.REF_NUM + " Use Card: " + tCI.UID;

67
Pages/Puce.cshtml Normal file
View File

@ -0,0 +1,67 @@
@page "/Puce"
@model PuceModel
@{
ViewData["Title"] = "Puce Listing";
Layout = "";
}
<h1>@ViewData["Title"]</h1>
<br />
<p>
Anything not listed in the table(s) below are out of stock and no longer available.
</p>
@{
List<string> prefixkeys = new();
if (Model.PuceCVINV.Count > 0)
{
prefixkeys = Model.PuceCVINV.Keys.ToList();
prefixkeys.Sort();
}
}
@foreach(var PREFIX in prefixkeys) {
var tCVINV = Model.PuceCVINV[PREFIX];
List<string> CVI_KEYS = tCVINV.Keys.ToList();
CVI_KEYS.Sort();
var firstCVI = tCVINV.ToListofCVITEMS().First();
<h3>@firstCVI.VENDOR_NAME - @firstCVI.SCALE</h3>
<table border="1" cellpadding="5">
<thead>
<tr>
<th>Item Code</th>
<th>Description</th>
<th>Quantity</th>
<th>Price</th>
</tr>
</thead>
<tbody>
@foreach (var CVI_KEY in CVI_KEYS) {
CVRLIB.Inventory.CVITEM CVI = tCVINV[CVI_KEY];
var PCOST = CVI.PRODUCT_COST == 0 ? CVI.PRICE : CVI.PRODUCT_COST * 1.05m;
<tr>
<td>@CVI.ITEM_UID</td>
<td>@CVI.PRODUCT_DESCRIPTION</td>
<td>@CVI.STOCK_RAW</td>
<td>@PCOST.ToString("c")</td>
</tr>
}
</tbody>
</table>
}

72
Pages/Puce.cshtml.cs Normal file
View File

@ -0,0 +1,72 @@

using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using CVRLIB.Inventory;
namespace VSERVERWS.Pages;
public class PuceModel : PageModel {
private readonly ILogger<PrivacyModel> _logger;
public Dictionary<string, CVINVENTORY> PuceCVINV = new Dictionary<string, CVINVENTORY>();
public PuceModel(ILogger<PrivacyModel> logger) {
_logger = logger;
}
public async Task OnGet() {
var tCVINV = await PuceListINV();
PuceCVINV = tCVINV.ParseByCodePrefix();
}
public async Task<CVINVENTORY> PuceListINV() {
CVINVENTORY rCVI;
var PCODES = new SortedSet<string>();
var pcodefiles = Directory.GetFiles(Program.AppData + @"\Puce", "*.csv");
foreach ( var filepath in pcodefiles ) {
var LINES = await System.IO.File.ReadAllLinesAsync(filepath);
foreach (var line in LINES) {
if (string.IsNullOrWhiteSpace(line)) continue;
string PCODE = line.Split(',')[0].Trim(['"']);
PCODES.Add(PCODE);
}
}
rCVI = await CVINVENTORY.LoadItemsAsync(PCODES);
rCVI.RemoveZeroQTY();
return rCVI;
}
}

View File

@ -44,18 +44,19 @@ var env = builder.Environment;
//X:\CVRCO\C#\VSERVERWS\VSERVERWS\wwwroot //X:\CVRCO\C#\VSERVERWS\VSERVERWS\wwwroot
AppPath = env.WebRootPath; AppPath = env.WebRootPath;
AppData = env.ContentRootPath + @"\AppData";
//X:\CVRCO\C#\VSERVERWS\VSERVERWS\ //X:\CVRCO\C#\VSERVERWS\VSERVERWS\
HTTPROOT = env.ContentRootPath; HTTPROOT = env.ContentRootPath;
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment(); //VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
//VSERVERWS.Global.Globals.IsDevelopment = false; VSERVERWS.Global.Globals.IsDevelopment = false;
VSERVERWS.Global.Globals.LoadPrinters(); await Task.Run(() => VSERVERWS.Global.Globals.LoadPrinters());
await Task.Run(() => CVGlobal.TryGlobalPRELoadCVCollections(new[] { typeof(CVINVENTORY), typeof(CVCustomers) }));
CVGlobal.TryGlobalPRELoadCVCollections(new[] { typeof(CVINVENTORY), typeof(CVCustomers) });
@ -72,9 +73,9 @@ app.UseAuthorization();
app.MapRazorPages(); app.MapRazorPages();
app.Run(); // app.Run();
await app.RunAsync();
@ -88,6 +89,7 @@ public partial class Program {
public static CVSECRETS? CVS { get; set; } = null; public static CVSECRETS? CVS { get; set; } = null;
public static string AppPath { get; set; } = ""; public static string AppPath { get; set; } = "";
public static string HTTPROOT { get; set; } = ""; public static string HTTPROOT { get; set; } = "";
public static string AppData { get; set; } = "";
public static bool IsDevMode { get; set; } = false; public static bool IsDevMode { get; set; } = false;

View File

@ -1,26 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net10.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<AssemblyVersion>1.0.17.1850</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.10.0" />
<PackageReference Include="Magick.NET.Core" Version="13.10.0" /> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" /> <PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.12.0" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.7" /> <PackageReference Include="Magick.NET.Core" Version="14.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.6" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" /> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.6" />
<PackageReference Include="System.Drawing.Common" Version="8.0.7" /> <PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" /> <PackageReference Include="Microsoft.Windows.Compatibility" Version="10.0.6" />
<PackageReference Include="System.Threading.RateLimiting" Version="8.0.0" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="ZXing.Net" Version="0.16.9" /> <PackageReference Include="System.Drawing.Common" Version="10.0.6" />
<PackageReference Include="System.Formats.Asn1" Version="10.0.6" />
<PackageReference Include="System.IO.Packaging" Version="10.0.6" />
<PackageReference Include="System.Text.Json" Version="10.0.6" />
<PackageReference Include="System.Threading.RateLimiting" Version="10.0.6" />
<PackageReference Include="ZXing.Net" Version="0.16.11" />
<FrameworkReference Include="Microsoft.WindowsDesktop.App" /> <FrameworkReference Include="Microsoft.WindowsDesktop.App" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="AppData\Puce\" />
</ItemGroup>
<Choose> <Choose>
<When Condition=" '$(Configuration)'=='Debug' "> <When Condition=" '$(Configuration)'=='Debug' ">
<ItemGroup> <ItemGroup>