SHA256
GuestDocument Versions - Part 1:
- Changed GuestDocument PK from `DocumentType`+`DocumentNumber` to to `ID`+`Version` for future versioning. - Added DB field "IsLastVersion" to simplify queries where only last/current version is allowed. - Updated GuestDocument DB fields type for `CreateTime` & `UpdateTime` to add precision. - Updated usages of GuestDocument PK to new PK. - Limit delete of a GuestDocument when it's currently used in a StayEntry. Note: DB changes require recreating db tables, so all data is lost and migration "rollback" is not allowed.
This commit is contained in:
@@ -82,6 +82,7 @@
|
||||
|
||||
ePageMode currentPageMode = ePageMode.selectDocId;
|
||||
GuestDocIdDTO currentDocId = new() { DocumentNum = "", DocumentType = "" };
|
||||
long? alreadyExistDocId = null;
|
||||
GuestDocumentDTO newDocumentModel = new();
|
||||
|
||||
bool loadingDocId = false;
|
||||
@@ -100,7 +101,8 @@
|
||||
}
|
||||
|
||||
loadingDocId = true;
|
||||
GuestDocumentDTO? dto = await guestDocService.GetDtoByIdAsync(currentDocId.DocumentType, currentDocId.DocumentNum);
|
||||
GuestDocumentDTO? dto =
|
||||
await guestDocService.GetLastVersionDtoByDocumentAsync(currentDocId.DocumentType, currentDocId.DocumentNum);
|
||||
loadingDocId = false;
|
||||
|
||||
if (dto is null)
|
||||
@@ -117,6 +119,7 @@
|
||||
|
||||
//GuestDoc already exists!
|
||||
currentPageMode = ePageMode.alreadyExistDoc;
|
||||
alreadyExistDocId = dto.Id;
|
||||
}
|
||||
|
||||
private void BtnReturn()
|
||||
@@ -153,14 +156,15 @@
|
||||
|
||||
private void BtnGoToDocument()
|
||||
{
|
||||
if (currentPageMode != ePageMode.alreadyExistDoc)
|
||||
if (currentPageMode != ePageMode.alreadyExistDoc || alreadyExistDocId is null)
|
||||
{
|
||||
userMessage.ShowMessage("Invalid operation!", MessageKind.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
string docId = GuestDocIdDTO.EncodeAsString(currentDocId);
|
||||
string uri = GuestConsts.Page_GuestDocs_Detail.Replace("{docId}", docId);
|
||||
|
||||
string strId = alreadyExistDocId.Value.ToString();
|
||||
string uri = GuestConsts.Page_GuestDocs_Detail.Replace(GuestConsts.Page_GuestDocs_Detail_Param_DocId, strId);
|
||||
Navigation.NavigateTo(uri);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user