From e95650bfdfa87f332da855a32e1e46c9e367acd6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 3 May 2023 18:10:50 +0200 Subject: [PATCH] Fix display testo in obj svg --- .../Components/DoorMan/DoorList.razor | 2 +- .../Components/DoorMan/DoorList.razor.cs | 52 +++-- .../Components/SvgComp/DoorSvgObj.razor | 25 +-- .../Components/SvgComp/DoorSvgObj.razor.cs | 194 ++++++++++-------- 4 files changed, 150 insertions(+), 123 deletions(-) diff --git a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor index e1ff8ac..5c2ff14 100644 --- a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor +++ b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor @@ -15,7 +15,7 @@ imgPath = $"images/LogoEgw{idxCount % 5:00}.png"; idxCount++;
- +
} } diff --git a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs index e632a31..5f65dc1 100644 --- a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs +++ b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs @@ -20,8 +20,6 @@ namespace WebDoorCreator.UI.Components.DoorMan #region Protected Properties protected List? DoorsList { get; set; } = null; - protected int orderStatus { get; set; } = 10; - protected bool IsChanged { get; set; } = false; [Inject] @@ -30,6 +28,8 @@ namespace WebDoorCreator.UI.Components.DoorMan [Inject] protected NavigationManager NavManager { get; set; } = null!; + protected int orderStatus { get; set; } = 10; + [Inject] protected WebDoorCreatorService WDService { get; set; } = null!; @@ -64,11 +64,31 @@ namespace WebDoorCreator.UI.Components.DoorMan NavManager.NavigateTo($"/DoorDefinition?idOrd={currOrderId}&idDoor={doorId}"); } + protected async Task getBackStatus() + { + await Task.Delay(1); + if (orderStatus > 10 && orderStatus <= 70) + { + await WDService.OrderUpdate(currOrderId, (orderStatus - 10)); + } + await ReloadData(); + } + protected override async Task OnParametersSetAsync() { await ReloadData(); } + protected async Task proceedStatus() + { + await Task.Delay(1); + if (orderStatus >= 10 && orderStatus < 70) + { + await WDService.OrderUpdate(currOrderId, (orderStatus + 10)); + } + await ReloadData(); + } + protected async Task ReloadData() { if (currOrderId != -1) @@ -86,24 +106,18 @@ namespace WebDoorCreator.UI.Components.DoorMan } } - protected async Task proceedStatus() + /// + /// Prepara il dictionary dei testi da riportare nell'oggetto ordine + /// + /// + /// + protected Dictionary textDictSetup(DoorModel door) { - await Task.Delay(1); - if (orderStatus >= 10 && orderStatus < 70) - { - await WDService.OrderUpdate(currOrderId, (orderStatus + 10)); - } - await ReloadData(); - } - - protected async Task getBackStatus() - { - await Task.Delay(1); - if (orderStatus > 10 && orderStatus <= 70) - { - await WDService.OrderUpdate(currOrderId, (orderStatus - 10)); - } - await ReloadData(); + Dictionary answ = new Dictionary(); + answ.Add("Doors N°:", $"{door.Quantity}"); + answ.Add("Model N°:", $"{door.TypeNav?.TypeId}"); + answ.Add("DoorPrice:", $"{(door.Quantity * door.UnitCost):C2}"); + return answ; } #endregion Protected Methods diff --git a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor index e20fce8..c9f8e91 100644 --- a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor +++ b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor @@ -5,35 +5,14 @@ @foreach (var item in TextData) {
- @item.Key + @item.Key
-
+
@item.Value
} - @*
- 01 -
-
- @Text01 -
-
- 02 -
-
- @Text02 -
-
- 03 -
-
- @Text03 -
*@
- @* @Text01 - @Text02 - @Text03*@ diff --git a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs index f2cda92..e348d7a 100644 --- a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs +++ b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs @@ -1,5 +1,4 @@ using Microsoft.AspNetCore.Components; -using System.Data.SqlTypes; namespace WebDoorCreator.UI.Components.SvgComp { @@ -7,38 +6,130 @@ namespace WebDoorCreator.UI.Components.SvgComp { #region Public Properties - - [Parameter] - public int ObjId { get; set; } = 0; - - [Parameter] - public string Text01 { get; set; } = "Example Text 01"; - [Parameter] - public string Text02 { get; set; } = "Example Text 02"; - [Parameter] - public string Text03 { get; set; } = "Example Text 03"; - - - [Parameter] - public Dictionary TextData { get; set; } = new Dictionary(); - [Parameter] public string ImagePath { get; set; } = "images/LogoEgw.png"; [Parameter] public string LineColor { get; set; } = "#00838F"; - [Parameter] - public int ObjH { get; set; } = 204; - - [Parameter] - public int ObjW { get; set; } = 450; [Parameter] public int LineWidth { get; set; } = 8; [Parameter] - public string TextStyle { get; set; } = "font-size: 1.5em; font-weight:bold; fill: #000;"; + public int ObjH { get; set; } = 204; + [Parameter] + public int ObjId { get; set; } = 0; + + [Parameter] + public int ObjW { get; set; } = 450; + + [Parameter] + public Dictionary TextData { get; set; } = new Dictionary(); + + [Parameter] + public string TextStyle { get; set; } = "font-size: 1.5em; fill: #000;"; + + #endregion Public Properties + + #region Protected Properties + + protected LineData BaseLine { get; set; } = null!; + + protected CircleData CircleImg { get; set; } = null!; + + protected CircleData CircleLine { get; set; } = null!; + + protected int LineDist { get; set; } = 20; + + protected int TextAreaHeight + { + get => (ObjH * 96 / 100); + } + + protected int TextAreaWidth + { + get => ObjW - (ObjH * 120 / 100); + } + + #endregion Protected Properties + + #region Protected Methods + + protected override void OnParametersSet() + { + setupGraphParams(); + } + + #endregion Protected Methods + + #region Protected Classes + + protected class CircleData + { + #region Public Constructors + + public CircleData(int px, int py, int radius) + { + cx = px; + cy = py; + rad = radius; + } + + #endregion Public Constructors + + #region Public Properties + + public int cx { get; set; } = 0; + public int cy { get; set; } = 0; + public int rad { get; set; } = 100; + + #endregion Public Properties + } + + protected class LineData + { + #region Public Constructors + + public LineData(PointData pA, PointData pB) + { + p1 = pA; + p2 = pB; + } + + #endregion Public Constructors + + #region Public Properties + + public PointData p1 { get; set; } + public PointData p2 { get; set; } + + #endregion Public Properties + } + + protected class PointData + { + #region Public Constructors + + public PointData(int valx, int valy) + { + px = valx; + py = valy; + } + + #endregion Public Constructors + + #region Public Properties + + public int px { get; set; } = 0; + public int py { get; set; } = 0; + + #endregion Public Properties + } + + #endregion Protected Classes + + #region Private Methods private void setupGraphParams() { @@ -49,63 +140,6 @@ namespace WebDoorCreator.UI.Components.SvgComp LineDist = ObjH / 4; } - protected override void OnParametersSet() - { - // fixme: togliere auto-compilazione text-data... - TextData.Add("riga01", "valore riga 01"); - TextData.Add("riga02", "valore riga 02"); - TextData.Add("riga03", "valore riga 03"); - setupGraphParams(); - } - - #endregion Public Properties - - protected CircleData CircleLine { get; set; } = null!; - protected CircleData CircleImg { get; set; } = null!; - protected LineData BaseLine { get; set; } = null!; - protected int LineDist { get; set; } = 20; - - protected int TextAreaWidth - { - get => ObjW - (ObjH * 120 / 100); - } - protected int TextAreaHeight - { - get => (ObjH * 96 / 100); - } - - protected class CircleData - { - public CircleData(int px, int py, int radius) - { - cx = px; - cy = py; - rad = radius; - } - public int cx { get; set; } = 0; - public int cy { get; set; } = 0; - public int rad { get; set; } = 100; - } - - protected class PointData - { - public PointData(int valx, int valy) - { - px = valx; - py = valy; - } - public int px { get; set; } = 0; - public int py { get; set; } = 0; - } - protected class LineData - { - public LineData(PointData pA, PointData pB) - { - p1 = pA; - p2 = pB; - } - public PointData p1 { get; set; } - public PointData p2 { get; set; } - } + #endregion Private Methods } } \ No newline at end of file