From a007842ab005d8af7243de33824b3881f29f8721 Mon Sep 17 00:00:00 2001 From: OlgunR Date: Mon, 11 May 2026 16:28:55 +0200 Subject: [PATCH] Refactor Amount field to use decimal and DxSpinEdit Replaced string-based Amount handling with a decimal property in the edit model. Switched input from DxTextBox to DxSpinEdit, removing manual parsing and validation logic for Amount. This improves data binding, input reliability, and code clarity. --- DbFirst.BlazorWebApp/Components/MassDataGrid.razor | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/DbFirst.BlazorWebApp/Components/MassDataGrid.razor b/DbFirst.BlazorWebApp/Components/MassDataGrid.razor index 2be4a6b..60aecd4 100644 --- a/DbFirst.BlazorWebApp/Components/MassDataGrid.razor +++ b/DbFirst.BlazorWebApp/Components/MassDataGrid.razor @@ -137,7 +137,7 @@ else - + @@ -285,7 +285,7 @@ else { Id = item.Id, CustomerName = item.CustomerName, - AmountText = item.Amount.ToString("0.00"), + Amount = item.Amount, Category = item.Category, StatusFlag = item.StatusFlag, UpdateProcedure = procedureOptions[0].Value, @@ -302,12 +302,6 @@ else validationMessageStore?.Clear(); editContext?.NotifyValidationStateChanged(); var editModel = (MassDataEditModel)e.EditModel; - if (!decimal.TryParse(editModel.AmountText, out var amount)) - { - AddValidationError(editModel, nameof(MassDataEditModel.AmountText), "Amount ist ungültig."); - e.Cancel = true; - return; - } if (editModel.IsNew) { var existing = await Api.GetByCustomerNameAsync(editModel.CustomerName); @@ -321,7 +315,7 @@ else var dto = new MassDataWriteDto { CustomerName = editModel.CustomerName, - Amount = amount, + Amount = editModel.Amount, Category = editModel.Category, StatusFlag = editModel.StatusFlag }; @@ -357,7 +351,7 @@ else { public int Id { get; set; } public string CustomerName { get; set; } = string.Empty; - public string AmountText { get; set; } = string.Empty; + public decimal Amount { get; set; } public string Category { get; set; } = string.Empty; public bool StatusFlag { get; set; } public int UpdateProcedure { get; set; }