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.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; }
@@ -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!;
@@ -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!;
@@ -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; }
@@ -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!;
@@ -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!;
@@ -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!;
}
@@ -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; }
@@ -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/";
+1
View File
@@ -32,6 +32,7 @@ namespace WorkFlowCheck.MAUI
builder.Services.AddAutoMapper(typeof(MapperProfile));
builder.Services.AddHttpClient();
builder.Services.AddDbContext<AppDbContext>();
//builder.Services.AddSingleton<AppDbContext>();
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;
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();
}
}
@@ -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<CheckListRowDTO> UpdateCheckListRow(CheckListRowDTO checkListRowDTO)
public async Task<CheckListRowDTO> 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;
}
@@ -17,12 +17,12 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
Task<List<CheckListHeaderDTO>> GetCheckLists(int userId);
Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId);
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> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> CloseCheckListHeader(CheckListHeaderCloseDTO checkListHeaderCloseDTO);
Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO);
Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
Task<CheckPointDTO> GetNextCheckpointNotSend(CheckListHeaderDTO checkListHeaderDTO);
}
}