Compare commits

..
9 Commits
Author SHA1 Message Date
james262 67fa25e385 updated .net to .net 10.
updated libraries.
2026-04-22 15:07:43 -04:00
james262 9333386aa7 added async to long load time items. 2026-04-22 15:07:01 -04:00
james262 9cc04a6133 added check for old expiry upon date entry. 2026-04-22 15:06:04 -04:00
james262 334a8e95bc Added a puce listing so listings sent to puce can be checked
for any updates.
2026-04-22 15:05:21 -04:00
james262 cc90e7f682 Updated gitignore for appdata/puce folder. 2026-04-22 15:00:43 -04:00
james262 a57e3f48cf Updated Packages. 2024-08-08 13:21:11 -04:00
james262 8181f31d27 Added web order hard copy save to local hdd
from external server.
2023-11-10 15:14:17 -05:00
james262 ecb0873f7f Added file path references. 2023-11-09 14:29:28 -05:00
james262 de55203a12 Updated Libraries. 2023-11-09 14:28:50 -05:00
8 changed files with 333 additions and 54 deletions
+1
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
-1
View File
@@ -29,6 +29,5 @@ namespace VSERVERWS.Global {
} }
} }
} }
+95 -4
View File
@@ -1,16 +1,26 @@
using Microsoft.AspNetCore.Mvc; using System.Web;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using CVRLIB.CARTS; using CVRLIB.CARTS;
using static CVRLIB.CVSTRINGS.TextFuncs; using static CVRLIB.CVSTRINGS.TextFuncs;
using Newtonsoft.Json;
using CVRLIB; using CVRLIB;
using CVRLIB.Generic;
using ZXing;
using Newtonsoft.Json;
namespace VSERVERWS.Controllers;
namespace VSERVERWS.Controllers {
//https://vserverws.cvr.cvrco.ca/api/cart/CartStatus //https://vserverws.cvr.cvrco.ca/api/cart/CartStatus
@@ -29,6 +39,88 @@ namespace VSERVERWS.Controllers {
} }
//https://localhost:7210/api/Cart/SubmitCartHTML?id=1337&source=beta%2Ecvr%2Ecvrco%2Eca
[HttpPost]
[Consumes("text/plain")]
public async Task<IActionResult> SubmitCartHTML(string id, string source) {
var rTOR = new TryOperationResult();
var isEncrypted = false;
var tdata = "";
var data = "";
var HTML_PATH = Program.XDRIVE + "\\CVRCO\\BU\\Carts\\HTML";
var inSource = HttpUtility.UrlDecode(source);
if (!string.IsNullOrEmpty(inSource)) {
HTML_PATH = HTML_PATH + "\\" + inSource;
if (!Directory.Exists(HTML_PATH)) {
Directory.CreateDirectory(HTML_PATH);
}
} else {
rTOR.AddResult(false, "READ_SOURCE", "no source provided!");
return new JsonResult(rTOR);
}
using (var SR = new StreamReader(Request.Body)) {
data = await SR.ReadToEndAsync();
}
if (!Directory.Exists(HTML_PATH)) {
Directory.CreateDirectory(HTML_PATH);
}
if (!tdata.Contains("<html>")) { isEncrypted = true; }
try {
if (isEncrypted) {
tdata = NonSecureDecryptHexStringToString(data);
}
if (!tdata.Contains("<html>")) {
throw new Exception("Invalid html string");
}
using (var FS = new FileStream(HTML_PATH + "\\" + id + ".txt", FileMode.Create, FileAccess.Write, FileShare.None)) {
using (var SW = new StreamWriter(FS)) {
if (isEncrypted) {
await SW.WriteAsync(data);
} else {
await SW.WriteAsync(NonSecureEncryptStringToHexString(tdata));
}
};
};
rTOR.AddResult(true, "TRY_SAVE_HTML_CART");
} catch (Exception ex) {
rTOR.AddResult(false, "TRY_SAVE_HTML_CART", ex.Message, ex);
Debug.WriteLine(ex.Message);
Debug.WriteLine(ex.StackTrace);
}
return new JsonResult(rTOR);
}
[HttpPost] [HttpPost]
@@ -69,5 +161,4 @@ namespace VSERVERWS.Controllers {
}
} }
+9
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
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
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;
}
}
+31 -5
View File
@@ -38,13 +38,25 @@ if (!app.Environment.IsDevelopment()) {
} }
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
var env = builder.Environment;
//X:\CVRCO\C#\VSERVERWS\VSERVERWS\wwwroot
AppPath = env.WebRootPath;
AppData = env.ContentRootPath + @"\AppData";
//X:\CVRCO\C#\VSERVERWS\VSERVERWS\
HTTPROOT = env.ContentRootPath;
VSERVERWS.Global.Globals.LoadPrinters();
//VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
VSERVERWS.Global.Globals.IsDevelopment = false;
CVGlobal.TryGlobalPRELoadCVCollections(new[] { typeof(CVINVENTORY), typeof(CVCustomers) }); await Task.Run(() => VSERVERWS.Global.Globals.LoadPrinters());
await Task.Run(() => CVGlobal.TryGlobalPRELoadCVCollections(new[] { typeof(CVINVENTORY), typeof(CVCustomers) }));
@@ -61,9 +73,9 @@ app.UseAuthorization();
app.MapRazorPages(); app.MapRazorPages();
app.Run(); // app.Run();
await app.RunAsync();
@@ -77,6 +89,20 @@ 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;
public static string XDRIVE {
get {
if (Directory.Exists("X:\\Shares\\cvrdata")) {
return "X:\\Shares\\cvrdata";
} else {
return "X:";
}
}
}
} }
+24 -10
View File
@@ -1,25 +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> <ItemGroup>
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="11.3.0" /> <PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.12.0" />
<PackageReference Include="Magick.NET.Core" Version="11.3.0" /> <PackageReference Include="Magick.NET.Core" Version="14.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.6" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" /> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" /> <PackageReference Include="Microsoft.Windows.Compatibility" Version="10.0.6" />
<PackageReference Include="System.Text.Json" Version="7.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="System.Threading.RateLimiting" Version="7.0.0" /> <PackageReference Include="System.Drawing.Common" Version="10.0.6" />
<PackageReference Include="ZXing.Net" Version="0.16.8" /> <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>