Added a puce listing so listings sent to puce can be checked

for any updates.
This commit is contained in:
Cameron Taylor 2026-04-22 15:05:21 -04:00
parent cc90e7f682
commit 334a8e95bc
5 changed files with 148 additions and 1 deletions

View File

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

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,6 +44,8 @@ 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;
@ -88,6 +90,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

@ -21,6 +21,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="AppData\Puce\" />
</ItemGroup>
<Choose> <Choose>
<When Condition=" '$(Configuration)'=='Debug' "> <When Condition=" '$(Configuration)'=='Debug' ">
<ItemGroup> <ItemGroup>