1.1.033 Fényképek beküldése javítása

This commit is contained in:
2025-07-01 08:30:34 +02:00
parent 4f149f4eef
commit 8208b31d08
13 changed files with 34 additions and 13 deletions
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -9,6 +10,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListHeader public class CheckListHeader
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public int CheckListTemplateHeaderId { get; set; } public int CheckListTemplateHeaderId { get; set; }
public virtual CheckListTemplateHeader? CheckListTemplateHeader { get; set; } public virtual CheckListTemplateHeader? CheckListTemplateHeader { get; set; }
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListRow public class CheckListRow
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public int CheckListHeaderId { get; set; } public int CheckListHeaderId { get; set; }
public virtual CheckListHeader CheckListHeader { get; set; } = null!; public virtual CheckListHeader CheckListHeader { get; set; } = null!;
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListTemplateHeader public class CheckListTemplateHeader
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string Description { get; set; } = null!; public string Description { get; set; } = null!;
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckListTemplateRow public class CheckListTemplateRow
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public int RowIndex { get; set; } public int RowIndex { get; set; }
public int CheckListTemplateHeaderId { get; set; } public int CheckListTemplateHeaderId { get; set; }
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class CheckPoint public class CheckPoint
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string Code { get; set; } = null!; public string Code { get; set; } = null!;
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class Equipment public class Equipment
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
public string EquipmentNumber { get; set; } = null!; public string EquipmentNumber { get; set; } = null!;
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class Location public class Location
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string FullName { get; set; } = null!; public string FullName { get; set; } = null!;
} }
@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -8,6 +9,7 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{ {
public class MobileUser public class MobileUser
{ {
[Key]
public int Id { get; set; } public int Id { get; set; }
public string? UserName { get; set; } public string? UserName { get; set; }
@@ -19,7 +19,7 @@ namespace WorkFlowCheck.MAUI.Helper
public static string DatabaseName = ""; public static string DatabaseName = "";
public static bool Syncronised = false; public static bool Syncronised = false;
public static UserDTO SystemUserDTO; public static UserDTO SystemUserDTO;
public static string ProgramVersion = "v1.1.030"; public static string ProgramVersion = "v1.1.033";
#if DEBUG #if DEBUG
//public static string ApiBaseUrl = $"http://10.0.2.2:59027/"; //public static string ApiBaseUrl = $"http://10.0.2.2:59027/";
+1
View File
@@ -32,6 +32,7 @@ namespace WorkFlowCheck.MAUI
builder.Services.AddAutoMapper(typeof(MapperProfile)); builder.Services.AddAutoMapper(typeof(MapperProfile));
builder.Services.AddHttpClient(); builder.Services.AddHttpClient();
builder.Services.AddDbContext<AppDbContext>(); builder.Services.AddDbContext<AppDbContext>();
//builder.Services.AddSingleton<AppDbContext>();
builder.Services.AddSingleton<IUserService, UserService>(); builder.Services.AddSingleton<IUserService, UserService>();
@@ -109,7 +109,7 @@ public partial class CheckListWorkPage : ContentPage
} }
} }
private async Task OnSave() private async Task OnSave(bool withReload = true)
{ {
IsLoading = true; IsLoading = true;
try try
@@ -126,9 +126,9 @@ public partial class CheckListWorkPage : ContentPage
{ {
checkListRow.Answer = "Nem"; checkListRow.Answer = "Nem";
} }
await _checkListService.UpdateCheckListRow(checkListRow); await _checkListService.UpdateCheckListRow(checkListRow, withReload);
} }
await LoadCheckPointCheckListRows(); if (withReload) await LoadCheckPointCheckListRows();
}); });
} }
catch (Exception) catch (Exception)
@@ -175,14 +175,14 @@ public partial class CheckListWorkPage : ContentPage
{ {
if (MediaPicker.IsCaptureSupported) if (MediaPicker.IsCaptureSupported)
{ {
//await OnSave(); await OnSave(false);
var photo = await MediaPicker.CapturePhotoAsync(); var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null) if (photo != null)
{ {
checkListRowDTO.Photo = await ResizePicture(photo, 500); checkListRowDTO.Photo = await ResizePicture(photo, 500);
checkListRowDTO.Answer = "Igen"; checkListRowDTO.Answer = "Igen";
await _checkListService.UpdateCheckListRow(checkListRowDTO); await _checkListService.UpdateCheckListRow(checkListRowDTO, true);
await LoadCheckPointCheckListRows(); await LoadCheckPointCheckListRows();
} }
} }
@@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Diagnostics;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
@@ -156,24 +157,27 @@ namespace WorkFlowCheck.MAUI.Services
return retVal; return retVal;
} }
public async Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO) public async Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO, bool withPhoto = true)
{ {
var retVal = checkListRowDTO; var retVal = checkListRowDTO;
try 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) if (checkListRow != null)
{ {
checkListRow.Answer = checkListRowDTO.Answer; 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; checkListRow.Photo = checkListRowDTO.Photo;
} }
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
} }
} }
catch (Exception) catch (Exception ex)
{ {
Debug.WriteLine(ex.Message);
} }
return retVal; return retVal;
} }
@@ -17,12 +17,12 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
Task<List<CheckListHeaderDTO>> GetCheckLists(int userId); Task<List<CheckListHeaderDTO>> GetCheckLists(int userId);
Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId); Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId);
Task<List<CheckListRowDTO>> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode); Task<List<CheckListRowDTO>> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode);
Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO); Task<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO, bool withPhoto = true);
Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> CloseCheckListHeader(CheckListHeaderCloseDTO checkListHeaderCloseDTO); Task<bool> CloseCheckListHeader(CheckListHeaderCloseDTO checkListHeaderCloseDTO);
Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO); Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO);
} }
} }