Add data models, randomization, and report factory setup
Introduced several new classes in the `EnvelopeGenerator.WebUI.Client` namespace: - Added `Adjustment` class for financial adjustments with deterministic randomization. - Added `Customer` class to load customer data from a SQL data source with fallback. - Added `DataItem` class to represent detailed billing data, including adjustments. - Added `DataItemList` class implementing `IList` for dynamic `DataItem` generation. - Added `DeterministicRandom` class for reproducible random value generation. - Added `Term` struct to define payment terms. - Added `ReportsFactory` class to manage predefined reports. Updated `MIGRATION_CONTEXT.md` to document the completion of Phase 5 (Data & PredefinedReports Migration) and outline next steps for resolving DevExpress-related errors in Phase 7.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
namespace EnvelopeGenerator.WebUI.Client.Data {
|
||||
public class Adjustment
|
||||
{
|
||||
public static Adjustment CreateBalanceForward(DateTime dt, int random)
|
||||
{
|
||||
var rnd = new DeterministicRandom(random);
|
||||
Adjustment res = new Adjustment();
|
||||
res.currentDateTime = dt;
|
||||
res.currentDescription = "Balance Forward";
|
||||
res.currentAmount = rnd.Random(10, 300) * 10;
|
||||
return res;
|
||||
}
|
||||
public static Adjustment CreatePayment(DateTime dt, int random)
|
||||
{
|
||||
var rnd = new DeterministicRandom(random);
|
||||
Adjustment res = new Adjustment();
|
||||
res.currentDateTime = dt;
|
||||
res.currentDescription = "Payment";
|
||||
res.currentAmount = -rnd.Random(1, 40) * 10;
|
||||
return res;
|
||||
}
|
||||
public static Adjustment CreateCharge(DateTime dt, int random)
|
||||
{
|
||||
var rnd = new DeterministicRandom(random);
|
||||
Adjustment res = new Adjustment();
|
||||
res.currentDateTime = dt;
|
||||
res.currentDescription = rnd.GetRandomItem(bills);
|
||||
res.currentAmount = rnd.Random(10, 50) * 10;
|
||||
return res;
|
||||
}
|
||||
|
||||
DateTime currentDateTime;
|
||||
string currentDescription = "";
|
||||
double currentAmount = 0;
|
||||
static readonly string[] bills = new string[] { "Bill - Insurance", "Bill - Electricity", "Bill - Rent", "Bill - Phone", "Bill - Office Supplies" };
|
||||
public DateTime Date { get { return currentDateTime; } }
|
||||
public string Description { get { return currentDescription; } }
|
||||
public double Amount { get { return currentAmount; } }
|
||||
|
||||
public Adjustment()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user