ChartWindow/Billing: Misc improvements
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Elwig.Models.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
@ -6,7 +7,9 @@ namespace Elwig.Helpers.Billing {
|
||||
public class GraphEntry {
|
||||
|
||||
public int Id { get; set; }
|
||||
private readonly Season Season;
|
||||
public BillingData.CurveMode Mode { get; set; }
|
||||
public bool Abgewertet { get; set; }
|
||||
public Graph DataGraph { get; set; }
|
||||
public Graph? GebundenGraph { get; set; }
|
||||
public decimal? GebundenFlatBonus { get; set; }
|
||||
@ -14,36 +17,42 @@ namespace Elwig.Helpers.Billing {
|
||||
public string ContractsStringSimple => Contracts.Any() ? string.Join(", ", Contracts.Select(c => c.Listing)) : "-";
|
||||
public string ContractsString => Contracts.Any() ? string.Join("\n", Contracts.Select(c => c.FullName)) : "-";
|
||||
private int MinX { get; set; }
|
||||
private int MinXGebunden { get; set; }
|
||||
private int MaxX { get; set; }
|
||||
|
||||
public GraphEntry(int id, BillingData.CurveMode mode, int minX, int maxX) {
|
||||
public GraphEntry(int id, Season season, BillingData.CurveMode mode, int minX, int minXGebunden, int maxX) {
|
||||
Id = id;
|
||||
Season = season;
|
||||
Mode = mode;
|
||||
Abgewertet = false;
|
||||
MinX = minX;
|
||||
MinXGebunden = minXGebunden;
|
||||
MaxX = maxX;
|
||||
DataGraph = new Graph(minX, maxX);
|
||||
DataGraph = new Graph(season, minX, maxX);
|
||||
Contracts = [];
|
||||
}
|
||||
|
||||
public GraphEntry(int id, BillingData.CurveMode mode, Dictionary<double, decimal> data, Dictionary<double, decimal>? gebunden,
|
||||
int minX, int maxX) : this(id, mode, minX, maxX) {
|
||||
DataGraph = new Graph(data, minX, maxX);
|
||||
if (gebunden != null) GebundenGraph = new Graph(gebunden, minX, maxX);
|
||||
public GraphEntry(int id, Season season, BillingData.CurveMode mode, Dictionary<double, decimal> data, Dictionary<double, decimal>? gebunden,
|
||||
int minX, int minXGebunden, int maxX) : this(id, season, mode, minX, minXGebunden, maxX) {
|
||||
DataGraph = new Graph(data, season, minX, maxX);
|
||||
if (gebunden != null) GebundenGraph = new Graph(gebunden, season, minXGebunden, maxX);
|
||||
}
|
||||
|
||||
public GraphEntry(int id, BillingData.Curve curve, List<ContractSelection> contracts, int minX, int maxX) :
|
||||
this(id, curve.Mode, minX, maxX) {
|
||||
DataGraph = new Graph(curve.Normal, minX, maxX);
|
||||
public GraphEntry(int id, Season season, BillingData.Curve curve, List<ContractSelection> contracts, int minX, int minXGebunden, int maxX) :
|
||||
this(id, season, curve.Mode, minX, minXGebunden, maxX) {
|
||||
DataGraph = new Graph(curve.Normal, season, minX, maxX);
|
||||
if (curve.Gebunden != null)
|
||||
GebundenGraph = new Graph(curve.Gebunden, 73, maxX);
|
||||
GebundenGraph = new Graph(curve.Gebunden, season, minXGebunden, maxX);
|
||||
Contracts = contracts;
|
||||
}
|
||||
|
||||
private GraphEntry(int id, BillingData.CurveMode mode, Graph dataGraph, Graph? gebundenGraph,
|
||||
decimal? gebundenFlatPrice, List<ContractSelection> contracts, int minX, int maxX) {
|
||||
private GraphEntry(int id, Season season, BillingData.CurveMode mode, Graph dataGraph, Graph? gebundenGraph,
|
||||
decimal? gebundenFlatPrice, List<ContractSelection> contracts, int minX, int minXGebunden, int maxX) {
|
||||
Id = id;
|
||||
Season = season;
|
||||
Mode = mode;
|
||||
MinX = minX;
|
||||
MinXGebunden = minXGebunden;
|
||||
MaxX = maxX;
|
||||
DataGraph = dataGraph;
|
||||
GebundenGraph = gebundenGraph;
|
||||
@ -52,7 +61,7 @@ namespace Elwig.Helpers.Billing {
|
||||
}
|
||||
|
||||
public void AddGebundenGraph() {
|
||||
GebundenGraph ??= new Graph(MinX, MaxX);
|
||||
GebundenGraph ??= new Graph(Season, MinXGebunden, MaxX);
|
||||
}
|
||||
|
||||
public void RemoveGebundenGraph() {
|
||||
@ -81,7 +90,7 @@ namespace Elwig.Helpers.Billing {
|
||||
}
|
||||
|
||||
public GraphEntry Copy(int id) {
|
||||
return new GraphEntry(id, Mode, (Graph)DataGraph.Clone(), (Graph?)GebundenGraph?.Clone(), GebundenFlatBonus, [], MinX, MaxX);
|
||||
return new GraphEntry(id, Season, Mode, (Graph)DataGraph.Clone(), (Graph?)GebundenGraph?.Clone(), GebundenFlatBonus, [], MinX, MinXGebunden, MaxX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user