From 8208b31d08ee9e41e3e4822cc1620f14dd411511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Szab=C3=B3?= Date: Tue, 1 Jul 2025 08:30:34 +0200 Subject: [PATCH] =?UTF-8?q?1.1.033=20F=C3=A9nyk=C3=A9pek=20bek=C3=BCld?= =?UTF-8?q?=C3=A9se=20jav=C3=ADt=C3=A1sa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataLayer/Entities/CheckListHeader.cs | 2 ++ .../DataLayer/Entities/CheckListRow.cs | 2 ++ .../DataLayer/Entities/CheckListTemplateHeader.cs | 2 ++ .../DataLayer/Entities/CheckListTemplateRow.cs | 2 ++ .../DataLayer/Entities/CheckPoint.cs | 2 ++ .../DataLayer/Entities/Equipment.cs | 2 ++ .../DataLayer/Entities/Location.cs | 2 ++ .../DataLayer/Entities/MobileUser.cs | 2 ++ src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs | 2 +- src/WorkFlowCheck.MAUI/MauiProgram.cs | 1 + .../Pages/CheckList/CheckListWorkPage.xaml.cs | 10 +++++----- src/WorkFlowCheck.MAUI/Services/CheckListService.cs | 12 ++++++++---- .../Services/Interfaces/ICheckListService.cs | 6 +++--- 13 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListHeader.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListHeader.cs index ec2e9d6..6a32b16 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListHeader.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListHeader.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,6 +10,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class CheckListHeader { + [Key] public int Id { get; set; } public int CheckListTemplateHeaderId { get; set; } public virtual CheckListTemplateHeader? CheckListTemplateHeader { get; set; } diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListRow.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListRow.cs index 0c8a0b6..8119d50 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListRow.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListRow.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class CheckListRow { + [Key] public int Id { get; set; } public int CheckListHeaderId { get; set; } public virtual CheckListHeader CheckListHeader { get; set; } = null!; diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateHeader.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateHeader.cs index 9f9dcb2..a85d409 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateHeader.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateHeader.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class CheckListTemplateHeader { + [Key] public int Id { get; set; } public string ShortName { get; set; } = null!; public string Description { get; set; } = null!; diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateRow.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateRow.cs index 7b43cf2..cc948a2 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateRow.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckListTemplateRow.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class CheckListTemplateRow { + [Key] public int Id { get; set; } public int RowIndex { get; set; } public int CheckListTemplateHeaderId { get; set; } diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckPoint.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckPoint.cs index b12f94f..a226c8e 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckPoint.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/CheckPoint.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class CheckPoint { + [Key] public int Id { get; set; } public string ShortName { get; set; } = null!; public string Code { get; set; } = null!; diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/Equipment.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/Equipment.cs index 5f954bc..98b70bc 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/Equipment.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/Equipment.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class Equipment { + [Key] public int Id { get; set; } public string ShortName { get; set; } = null!; public string EquipmentNumber { get; set; } = null!; diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/Location.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/Location.cs index a9eb60b..4d782b5 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/Location.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/Location.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class Location { + [Key] public int Id { get; set; } public string FullName { get; set; } = null!; } diff --git a/src/WorkFlowCheck.MAUI/DataLayer/Entities/MobileUser.cs b/src/WorkFlowCheck.MAUI/DataLayer/Entities/MobileUser.cs index 9800c5f..906efc0 100644 --- a/src/WorkFlowCheck.MAUI/DataLayer/Entities/MobileUser.cs +++ b/src/WorkFlowCheck.MAUI/DataLayer/Entities/MobileUser.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities { public class MobileUser { + [Key] public int Id { get; set; } public string? UserName { get; set; } diff --git a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs index 93923ae..444266a 100644 --- a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs +++ b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs @@ -19,7 +19,7 @@ namespace WorkFlowCheck.MAUI.Helper public static string DatabaseName = ""; public static bool Syncronised = false; public static UserDTO SystemUserDTO; - public static string ProgramVersion = "v1.1.030"; + public static string ProgramVersion = "v1.1.033"; #if DEBUG //public static string ApiBaseUrl = $"http://10.0.2.2:59027/"; diff --git a/src/WorkFlowCheck.MAUI/MauiProgram.cs b/src/WorkFlowCheck.MAUI/MauiProgram.cs index 43a7989..d82358d 100644 --- a/src/WorkFlowCheck.MAUI/MauiProgram.cs +++ b/src/WorkFlowCheck.MAUI/MauiProgram.cs @@ -32,6 +32,7 @@ namespace WorkFlowCheck.MAUI builder.Services.AddAutoMapper(typeof(MapperProfile)); builder.Services.AddHttpClient(); builder.Services.AddDbContext(); + //builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs index e4bed54..d26043c 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs @@ -109,7 +109,7 @@ public partial class CheckListWorkPage : ContentPage } } - private async Task OnSave() + private async Task OnSave(bool withReload = true) { IsLoading = true; try @@ -126,9 +126,9 @@ public partial class CheckListWorkPage : ContentPage { checkListRow.Answer = "Nem"; } - await _checkListService.UpdateCheckListRow(checkListRow); + await _checkListService.UpdateCheckListRow(checkListRow, withReload); } - await LoadCheckPointCheckListRows(); + if (withReload) await LoadCheckPointCheckListRows(); }); } catch (Exception) @@ -175,14 +175,14 @@ public partial class CheckListWorkPage : ContentPage { if (MediaPicker.IsCaptureSupported) { - //await OnSave(); + await OnSave(false); var photo = await MediaPicker.CapturePhotoAsync(); if (photo != null) { checkListRowDTO.Photo = await ResizePicture(photo, 500); checkListRowDTO.Answer = "Igen"; - await _checkListService.UpdateCheckListRow(checkListRowDTO); + await _checkListService.UpdateCheckListRow(checkListRowDTO, true); await LoadCheckPointCheckListRows(); } } diff --git a/src/WorkFlowCheck.MAUI/Services/CheckListService.cs b/src/WorkFlowCheck.MAUI/Services/CheckListService.cs index 762dcc6..16d40eb 100644 --- a/src/WorkFlowCheck.MAUI/Services/CheckListService.cs +++ b/src/WorkFlowCheck.MAUI/Services/CheckListService.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; +using System.Diagnostics; using System.Net.Http.Json; using System.Runtime.CompilerServices; using WorkFlowCheck.Common.DTO; @@ -156,24 +157,27 @@ namespace WorkFlowCheck.MAUI.Services return retVal; } - public async Task UpdateCheckListRow(CheckListRowDTO checkListRowDTO) + public async Task UpdateCheckListRow(CheckListRowDTO checkListRowDTO, bool withPhoto = true) { var retVal = checkListRowDTO; try { - var checkListRow = await _dbContext.CheckListRows.Where(w => w.Id == checkListRowDTO.Id).FirstOrDefaultAsync(); + var checkListRow = await _dbContext.CheckListRows + //.AsNoTracking() + .Where(w => w.Id == checkListRowDTO.Id).FirstOrDefaultAsync(); if (checkListRow != null) { checkListRow.Answer = checkListRowDTO.Answer; - if (checkListRowDTO.Photo != null && checkListRowDTO.Photo.Length > 0) + if (checkListRowDTO.Photo != null && checkListRowDTO.Photo.Length > 0 && withPhoto) { checkListRow.Photo = checkListRowDTO.Photo; } await _dbContext.SaveChangesAsync(); } } - catch (Exception) + catch (Exception ex) { + Debug.WriteLine(ex.Message); } return retVal; } diff --git a/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs b/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs index 2e58968..b8d06be 100644 --- a/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs +++ b/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs @@ -17,12 +17,12 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces Task> GetCheckLists(int userId); Task> GetCheckListTemplates(int userId); Task> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode); - Task UpdateCheckListRow(CheckListRowDTO checkListRowDTO); + Task UpdateCheckListRow(CheckListRowDTO checkListRowDTO, bool withPhoto = true); Task UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task CloseCheckListHeader(CheckListHeaderCloseDTO checkListHeaderCloseDTO); - Task AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); - Task GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO); + Task AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); + Task GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO); } }