diff --git a/.vs/uWine/CopilotIndices/0.2.1634.3922/CodeChunks.db b/.vs/uWine/CopilotIndices/0.2.1634.3922/CodeChunks.db index 9cdaca6..a5c3e46 100644 Binary files a/.vs/uWine/CopilotIndices/0.2.1634.3922/CodeChunks.db and b/.vs/uWine/CopilotIndices/0.2.1634.3922/CodeChunks.db differ diff --git a/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db b/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db index 527188c..1aca709 100644 Binary files a/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db and b/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db differ diff --git a/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db-wal b/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db-wal index 87e0199..eeb78c5 100644 Binary files a/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db-wal and b/.vs/uWine/CopilotIndices/0.2.1634.3922/SemanticSymbols.db-wal differ diff --git a/.vs/uWine/DesignTimeBuild/.dtbcache.v2 b/.vs/uWine/DesignTimeBuild/.dtbcache.v2 index c2d572d..98c008e 100644 Binary files a/.vs/uWine/DesignTimeBuild/.dtbcache.v2 and b/.vs/uWine/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/uWine/v17/.suo b/.vs/uWine/v17/.suo index 2a76947..6947385 100644 Binary files a/.vs/uWine/v17/.suo and b/.vs/uWine/v17/.suo differ diff --git a/.vs/uWine/v17/DocumentLayout.backup.json b/.vs/uWine/v17/DocumentLayout.backup.json index a503e9d..6c1528a 100644 --- a/.vs/uWine/v17/DocumentLayout.backup.json +++ b/.vs/uWine/v17/DocumentLayout.backup.json @@ -3,13 +3,41 @@ "WorkspaceRootPath": "M:\\uv\\uWine\\", "Documents": [ { - "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\repositories\\iaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\repositories\\iaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\repositories\\iownerrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\repositories\\iownerrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|m:\\uv\\uwine\\uwine.core.infrastructure\\repository\\mariadbownerrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|solutionrelative:uwine.core.infrastructure\\repository\\mariadbownerrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\entities\\owner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\entities\\owner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|m:\\uv\\uwine\\uwine.core.infrastructure\\repository\\mariadbcontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|solutionrelative:uwine.core.infrastructure\\repository\\mariadbcontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\entities\\contact.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\entities\\contact.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\entities\\contacttype.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\entities\\contacttype.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\repositories\\icontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\repositories\\icontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { "AbsoluteMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|m:\\uv\\uwine\\uwine.core.infrastructure\\repository\\mariadbaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|solutionrelative:uwine.core.infrastructure\\repository\\mariadbaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\repositories\\iaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\repositories\\iaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, { "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\entities\\address.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\entities\\address.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" @@ -54,8 +82,86 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 7, + "SelectedChildIndex": 0, "Children": [ + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "IOwnerRepository.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IOwnerRepository.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Repositories\\IOwnerRepository.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IOwnerRepository.cs", + "RelativeToolTip": "uWine.Core.Domain\\Repositories\\IOwnerRepository.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAFAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T17:10:26.437Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "Owner.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Owner.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Owner.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Owner.cs", + "RelativeToolTip": "uWine.Core.Domain\\Entities\\Owner.cs", + "ViewState": "AgIAAAYAAAAAAAAAAAAYwBUAAAA1AAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T16:46:21.353Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "MariadbOwnerRepository.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "RelativeDocumentMoniker": "uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "RelativeToolTip": "uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAsAAAAEAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T16:34:58.143Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "IContactRepository.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "RelativeToolTip": "uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAFAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T14:39:37.619Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "ContactType.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\ContactType.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\ContactType.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\ContactType.cs", + "RelativeToolTip": "uWine.Core.Domain\\Entities\\ContactType.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAuwAIAAAARAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T14:33:37.163Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "Contact.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Contact.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Contact.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Contact.cs", + "RelativeToolTip": "uWine.Core.Domain\\Entities\\Contact.cs", + "ViewState": "AgIAAAcAAAAAAAAAAAAQwBEAAAATAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T13:19:18.889Z", + "EditorCaption": "" + }, { "$type": "Bookmark", "Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}" @@ -86,20 +192,33 @@ }, { "$type": "Document", - "DocumentIndex": 0, + "DocumentIndex": 3, + "Title": "MariaDbContactRepository.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "RelativeDocumentMoniker": "uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "RelativeToolTip": "uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAABbAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T13:32:59.307Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 8, "Title": "IAddressRepository.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IAddressRepository.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Repositories\\IAddressRepository.cs", "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IAddressRepository.cs", "RelativeToolTip": "uWine.Core.Domain\\Repositories\\IAddressRepository.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAFAAAAAAAAAA==", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2025-07-04T13:30:13.643Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 2, + "DocumentIndex": 9, "Title": "Address.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Address.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Address.cs", @@ -112,20 +231,20 @@ }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 7, "Title": "MariaDbAddressRepository.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", "RelativeDocumentMoniker": "uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", "ToolTip": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", "RelativeToolTip": "uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAA==", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAAbAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2025-07-04T12:25:22.151Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 10, "Title": "RowWork.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\RowWork.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\RowWork.cs", @@ -138,7 +257,7 @@ }, { "$type": "Document", - "DocumentIndex": 5, + "DocumentIndex": 12, "Title": "WarehouseProduct.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\WarehouseProduct.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\WarehouseProduct.cs", @@ -151,7 +270,7 @@ }, { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 11, "Title": "ProductUsage.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\ProductUsage.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\ProductUsage.cs", @@ -164,7 +283,7 @@ }, { "$type": "Document", - "DocumentIndex": 6, + "DocumentIndex": 13, "Title": "Worker.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Worker.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Worker.cs", @@ -177,7 +296,7 @@ }, { "$type": "Document", - "DocumentIndex": 10, + "DocumentIndex": 17, "Title": "PlantVariety.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\PlantVariety.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\PlantVariety.cs", @@ -190,7 +309,7 @@ }, { "$type": "Document", - "DocumentIndex": 9, + "DocumentIndex": 16, "Title": "VinePlant.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\VinePlant.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\VinePlant.cs", @@ -202,7 +321,7 @@ }, { "$type": "Document", - "DocumentIndex": 8, + "DocumentIndex": 15, "Title": "Vineyard.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Vineyard.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Vineyard.cs", @@ -214,7 +333,7 @@ }, { "$type": "Document", - "DocumentIndex": 7, + "DocumentIndex": 14, "Title": "Row.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Row.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Row.cs", diff --git a/.vs/uWine/v17/DocumentLayout.json b/.vs/uWine/v17/DocumentLayout.json index c687106..1a3e0ad 100644 --- a/.vs/uWine/v17/DocumentLayout.json +++ b/.vs/uWine/v17/DocumentLayout.json @@ -2,6 +2,30 @@ "Version": 1, "WorkspaceRootPath": "M:\\uv\\uWine\\", "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|m:\\uv\\uwine\\uwine.core.infrastructure\\repository\\mariadbownerrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|solutionrelative:uwine.core.infrastructure\\repository\\mariadbownerrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\entities\\owner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\entities\\owner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|m:\\uv\\uwine\\uwine.core.infrastructure\\repository\\mariadbcontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|solutionrelative:uwine.core.infrastructure\\repository\\mariadbcontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\entities\\contact.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\entities\\contact.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\entities\\contacttype.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\entities\\contacttype.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|m:\\uv\\uwine\\uwine.core.domain\\repositories\\icontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{1DCFCDC3-C4A6-4864-8868-94AAB81C3DBA}|uWine.Core.Domain\\uWine.Core.Domain.csproj|solutionrelative:uwine.core.domain\\repositories\\icontactrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, { "AbsoluteMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|m:\\uv\\uwine\\uwine.core.infrastructure\\repository\\mariadbaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{50360CEE-B38B-4729-ACA3-ABC3ED3538E9}|uWine.Core.Infrastructure\\uWine.Core.Infrastructure.csproj|solutionrelative:uwine.core.infrastructure\\repository\\mariadbaddressrepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" @@ -54,8 +78,73 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 9, + "SelectedChildIndex": 1, "Children": [ + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "Owner.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Owner.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Owner.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Owner.cs", + "RelativeToolTip": "uWine.Core.Domain\\Entities\\Owner.cs", + "ViewState": "AgIAAAYAAAAAAAAAAAAYwBUAAAA1AAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T16:46:21.353Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "MariadbOwnerRepository.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "RelativeDocumentMoniker": "uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "RelativeToolTip": "uWine.Core.Infrastructure\\Repository\\MariadbOwnerRepository.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAEAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T16:34:58.143Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "IContactRepository.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "RelativeToolTip": "uWine.Core.Domain\\Repositories\\IContactRepository.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAFAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T14:39:37.619Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "ContactType.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\ContactType.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\ContactType.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\ContactType.cs", + "RelativeToolTip": "uWine.Core.Domain\\Entities\\ContactType.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAuwAIAAAARAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T14:33:37.163Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "Contact.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Contact.cs", + "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Contact.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Contact.cs", + "RelativeToolTip": "uWine.Core.Domain\\Entities\\Contact.cs", + "ViewState": "AgIAAAcAAAAAAAAAAAAQwBEAAAATAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T13:19:18.889Z", + "EditorCaption": "" + }, { "$type": "Bookmark", "Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}" @@ -86,7 +175,20 @@ }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 2, + "Title": "MariaDbContactRepository.cs", + "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "RelativeDocumentMoniker": "uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "ToolTip": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "RelativeToolTip": "uWine.Core.Infrastructure\\Repository\\MariaDbContactRepository.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAABbAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-07-04T13:32:59.307Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, "Title": "IAddressRepository.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Repositories\\IAddressRepository.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Repositories\\IAddressRepository.cs", @@ -99,7 +201,7 @@ }, { "$type": "Document", - "DocumentIndex": 2, + "DocumentIndex": 8, "Title": "Address.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Address.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Address.cs", @@ -112,20 +214,20 @@ }, { "$type": "Document", - "DocumentIndex": 0, + "DocumentIndex": 6, "Title": "MariaDbAddressRepository.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", "RelativeDocumentMoniker": "uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", "ToolTip": "M:\\uv\\uWine\\uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", "RelativeToolTip": "uWine.Core.Infrastructure\\Repository\\MariaDbAddressRepository.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAA==", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAAbAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2025-07-04T12:25:22.151Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 9, "Title": "RowWork.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\RowWork.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\RowWork.cs", @@ -138,7 +240,7 @@ }, { "$type": "Document", - "DocumentIndex": 5, + "DocumentIndex": 11, "Title": "WarehouseProduct.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\WarehouseProduct.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\WarehouseProduct.cs", @@ -151,7 +253,7 @@ }, { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 10, "Title": "ProductUsage.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\ProductUsage.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\ProductUsage.cs", @@ -164,7 +266,7 @@ }, { "$type": "Document", - "DocumentIndex": 6, + "DocumentIndex": 12, "Title": "Worker.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Worker.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Worker.cs", @@ -177,7 +279,7 @@ }, { "$type": "Document", - "DocumentIndex": 10, + "DocumentIndex": 16, "Title": "PlantVariety.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\PlantVariety.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\PlantVariety.cs", @@ -190,7 +292,7 @@ }, { "$type": "Document", - "DocumentIndex": 9, + "DocumentIndex": 15, "Title": "VinePlant.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\VinePlant.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\VinePlant.cs", @@ -202,7 +304,7 @@ }, { "$type": "Document", - "DocumentIndex": 8, + "DocumentIndex": 14, "Title": "Vineyard.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Vineyard.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Vineyard.cs", @@ -214,7 +316,7 @@ }, { "$type": "Document", - "DocumentIndex": 7, + "DocumentIndex": 13, "Title": "Row.cs", "DocumentMoniker": "M:\\uv\\uWine\\uWine.Core.Domain\\Entities\\Row.cs", "RelativeDocumentMoniker": "uWine.Core.Domain\\Entities\\Row.cs", diff --git a/uWine.Core.Domain/Entities/Contact.cs b/uWine.Core.Domain/Entities/Contact.cs index d6d203c..5a061cb 100644 --- a/uWine.Core.Domain/Entities/Contact.cs +++ b/uWine.Core.Domain/Entities/Contact.cs @@ -1,4 +1,6 @@ -namespace uWine.Core.Domain.Entities +using MySqlConnector; + +namespace uWine.Core.Domain.Entities { public class Contact { @@ -8,8 +10,20 @@ public int Priority { get; set; } public string Notes { get; set; } public DateTime CreationDate { get; set; } - public DateTime? UpdatedDate { get; set; } + public DateTime? UpdateDate { get; set; } public bool Active { get; set; } + public static Contact FromRecord(MySqlDataReader reader) + { + return new Contact + { + Id = reader.GetInt32("id"), + Value = reader.GetString("contact"), + Priority = reader.GetInt32("priority"), + Notes = reader.GetString("note"), + CreationDate = reader.GetDateTime("creation_date"), + UpdateDate = reader.GetDateTime("update_date"), + }; + } } } diff --git a/uWine.Core.Domain/Entities/ContactType.cs b/uWine.Core.Domain/Entities/ContactType.cs index 341715b..aa05cdc 100644 --- a/uWine.Core.Domain/Entities/ContactType.cs +++ b/uWine.Core.Domain/Entities/ContactType.cs @@ -6,5 +6,16 @@ public string Type { get; set; } public string Description { get; set; } public bool Active { get; set; } + + public static ContactType FromRecord(MySqlConnector.MySqlDataReader reader) + { + return new ContactType + { + Id = reader.GetInt32("id"), + Type = reader.GetString("type"), + Description = reader.GetString("description"), + Active = reader.GetBoolean("active") + }; + } } } diff --git a/uWine.Core.Domain/Entities/Owner.cs b/uWine.Core.Domain/Entities/Owner.cs index 87c2788..e4b9c65 100644 --- a/uWine.Core.Domain/Entities/Owner.cs +++ b/uWine.Core.Domain/Entities/Owner.cs @@ -12,5 +12,18 @@ public List Contacts { get; set; } public List Vineyards { get; set; } public List
Addresses { get; set; } - } + + public static Owner FromRecord(MySqlConnector.MySqlDataReader reader) + { + return new Owner + { + Id = reader.GetInt32("id"), + Name = reader.GetString("first_name"), + Surname = reader.GetString("last_name"), + CompanyName = reader.GetString("company_name"), + IsActive = reader.GetBoolean("active"), + CreationDate = reader.GetDateTime("creation_date"), + Note = reader.GetString("note") + }; + } } diff --git a/uWine.Core.Domain/Repositories/IContactRepository.cs b/uWine.Core.Domain/Repositories/IContactRepository.cs new file mode 100644 index 0000000..1a798d5 --- /dev/null +++ b/uWine.Core.Domain/Repositories/IContactRepository.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using uWine.Core.Domain.Entities; + +namespace uWine.Core.Domain.Repositories +{ + public interface IContactRepository + { + ContactType GetContactType(int contactTypeId); + void InsertContactType(ContactType contactType); + void InsertOwnerContact(Contact contact, int ownerId); + List OwnerContacts(int ownerId); + } +} diff --git a/uWine.Core.Domain/Repositories/IOwnerRepository.cs b/uWine.Core.Domain/Repositories/IOwnerRepository.cs new file mode 100644 index 0000000..016c35a --- /dev/null +++ b/uWine.Core.Domain/Repositories/IOwnerRepository.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using uWine.Core.Domain.Entities; + +namespace uWine.Core.Domain.Repositories +{ + public interface IOwnerRepository + { + void AddAddress(int ownerId, Address address); + void Insert(Owner owner); + Owner Simple(int ownerId); + } +} diff --git a/uWine.Core.Domain/Repositories/IVineyardRepository.cs b/uWine.Core.Domain/Repositories/IVineyardRepository.cs new file mode 100644 index 0000000..1299892 --- /dev/null +++ b/uWine.Core.Domain/Repositories/IVineyardRepository.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using uWine.Core.Domain.Entities; + +namespace uWine.Core.Domain.Repositories +{ + public interface IVineyardRepository + { + List GetOwnerVineyards(int ownerId); + void Insert(Vineyard vineyard, int ownerId); + } +} diff --git a/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfo.cs b/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfo.cs index ac94dba..3989788 100644 --- a/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfo.cs +++ b/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("uWine.Core.Domain")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9036616a5922f1fdddd933a21ff41597a22b9d12")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b7983dae8eb41b8762561f39a8983964d6b51642")] [assembly: System.Reflection.AssemblyProductAttribute("uWine.Core.Domain")] [assembly: System.Reflection.AssemblyTitleAttribute("uWine.Core.Domain")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfoInputs.cache b/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfoInputs.cache index 4fcf865..25d57c8 100644 --- a/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfoInputs.cache +++ b/uWine.Core.Domain/obj/Debug/net8.0/uWine.Core.Domain.AssemblyInfoInputs.cache @@ -1 +1 @@ -f4881d9a83679f0090798624563523a1b20e755faf7a53ce3f3323358a12e49b +2938b75c4e5ef3e81cc5a8d84e687c6e2754a5a72fb2fca8be69fe3f8ccc7d39 diff --git a/uWine.Core.Infrastructure/Repository/MariaDbAddressRepository.cs b/uWine.Core.Infrastructure/Repository/MariaDbAddressRepository.cs index 941aa9a..26df6d6 100644 --- a/uWine.Core.Infrastructure/Repository/MariaDbAddressRepository.cs +++ b/uWine.Core.Infrastructure/Repository/MariaDbAddressRepository.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Configuration; +using MySqlConnector; using uWine.Core.Domain.Entities; using uWine.Core.Domain.Repositories; @@ -15,8 +16,7 @@ namespace uWine.Core.Infrastructure.Repository using (var connection = Connection()) { connection.Open(); - var command = connection.CreateCommand(); - command.CommandText = $@"INSERT INTO t_addresses ( + var query = $@"INSERT INTO t_addresses ( country, postal_code, county, @@ -39,6 +39,8 @@ namespace uWine.Core.Infrastructure.Repository @longitude, @active )"; + using var command = new MySqlCommand(query, connection); //connection.CreateCommand(); + command.Parameters.AddWithValue("@country", address.Country); command.Parameters.AddWithValue("@postal_code", address.PostalCode); command.Parameters.AddWithValue("@county", address.County); @@ -58,11 +60,12 @@ namespace uWine.Core.Infrastructure.Repository var addresses = new List
(); using (var connection = Connection()) { - connection.Open(); - var command = connection.CreateCommand(); - command.CommandText = $@"SELECT a.* FROM t_addresses a + connection.Open(); + var query = $@"SELECT a.* FROM t_addresses a JOIN t_owners_addresses oa ON a.id = oa.address_id WHERE oa.owner_id = @OwnerId"; + + using var command = new MySqlCommand(query, connection); command.Parameters.AddWithValue("@OwnerId", OwnerId); using (var reader = command.ExecuteReader()) { diff --git a/uWine.Core.Infrastructure/Repository/MariaDbContactRepository.cs b/uWine.Core.Infrastructure/Repository/MariaDbContactRepository.cs new file mode 100644 index 0000000..22e9a4f --- /dev/null +++ b/uWine.Core.Infrastructure/Repository/MariaDbContactRepository.cs @@ -0,0 +1,88 @@ +using Microsoft.Extensions.Configuration; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using uWine.Core.Domain.Entities; +using uWine.Core.Domain.Repositories; + +namespace uWine.Core.Infrastructure.Repository +{ + public class MariaDbContactRepository : MariaDbServerRepository, IContactRepository + { + public MariaDbContactRepository(IConfiguration configuration) : base(configuration) + { + } + + public void InsertOwnerContact(Contact contact, int ownerId) + { + using (var connection = Connection()) + { + connection.Open(); + var cmd = new MySqlCommand("sp_insert_owner_contact", connection); + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@OwnerId", ownerId); + cmd.Parameters.AddWithValue("@ContactTypeId", contact.ContactType.Id); + cmd.Parameters.AddWithValue("@Contact", contact.Value); + cmd.Parameters.AddWithValue("@Priority", contact.Priority); + cmd.Parameters.AddWithValue("@Note", contact.Notes); + } + } + + public ContactType GetContactType(int contactTypeId) + { + using (var connection = Connection()) + { + connection.Open(); + var cmd = new MySqlCommand("SELECT * FROM t_contact_type WHERE id = @id", connection); + cmd.Parameters.AddWithValue("@id", contactTypeId); + + using (var reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + return ContactType.FromRecord(reader); + } + } + } + return new ContactType(); + } + + public void InsertContactType(ContactType contactType) + { + using (var connection = Connection()) + { + connection.Open(); + using var cmd = new MySqlCommand("INSERT INTO t_contact_types(type, description) VALUES (@type, @description)", connection); + cmd.Parameters.AddWithValue("@type", contactType.Type); + cmd.Parameters.AddWithValue("@description", contactType.Description); + cmd.ExecuteNonQuery(); + } + } + + public List OwnerContacts(int ownerId) + { + var contacts = new List(); + using (var connection = Connection()) + { + connection.Open(); + using var cmd = new MySqlCommand("sp_get_owner_contacts", connection); + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@OwnerId", ownerId); + using (var reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var contact = Contact.FromRecord(reader); + contact.ContactType = GetContactType(reader.GetInt32("contact_type_id")); + contacts.Add(contact); + } + } + return contacts; + } + } + } +} diff --git a/uWine.Core.Infrastructure/Repository/MariaDbVineyardRepository.cs b/uWine.Core.Infrastructure/Repository/MariaDbVineyardRepository.cs new file mode 100644 index 0000000..f6d071d --- /dev/null +++ b/uWine.Core.Infrastructure/Repository/MariaDbVineyardRepository.cs @@ -0,0 +1,90 @@ +using Microsoft.Extensions.Configuration; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using uWine.Core.Domain.Entities; +using uWine.Core.Domain.Repositories; + +namespace uWine.Core.Infrastructure.Repository +{ + public class MariaDbVineyardRepository : MariaDbServerRepository, IVineyardRepository + { + public MariaDbVineyardRepository(IConfiguration configuration) : base(configuration) + { + + } + + public void Insert(Vineyard vineyard, int ownerId) + { + using (var connection = Connection()) + { + connection.Open(); + var command = new MySqlCommand(@$"INSERT INTO t_vineyard ( + name, + location, + hectares, + latitude, + longitude + ) VALUES ( + @name, + @location, + @hectares, + @latitude, + @longitude + ); LAST_INSERT_ID();", connection); + command.Parameters.AddWithValue("@name", vineyard.Name); + command.Parameters.AddWithValue("@location", vineyard.Location); + command.Parameters.AddWithValue("@hectares", vineyard.Hectares); + command.Parameters.AddWithValue("@latitude", vineyard.Latitude); + command.Parameters.AddWithValue("@longitude", vineyard.Longitude); + + using (var reader = command.ExecuteReader()) + { + if (reader.Read()) + { + vineyard.Id = reader.GetInt32(0); + } + } + var command2 = new MySqlCommand("INSERT INTO t_owners_vineyards (owner_id, vineyard_id) VALUES (@ownerId, @vineyardId)", connection); + command2.Parameters.AddWithValue("@ownerId", ownerId); + command2.Parameters.AddWithValue("@vineyardId", vineyard.Id); + command2.ExecuteNonQuery(); + } + } + + public List GetOwnerVineyards(int ownerId) + { + var vineyards = new List(); + using (var connection = Connection()) + { + connection.Open(); + var command = new MySqlCommand("SELECT v.id, v.name, v.location, v.hectares, v.latitude, v.longitude " + + "FROM t_vineyard v " + + "JOIN t_owners_vineyards ov ON v.id = ov.vineyard_id " + + "WHERE ov.owner_id = @ownerId", connection); + command.Parameters.AddWithValue("@ownerId", ownerId); + + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + var vineyard = new Vineyard + { + Id = reader.GetInt32(0), + Name = reader.GetString(1), + Location = reader.GetString(2), + Hectares = reader.GetDouble(3), + Latitude = reader.GetDouble(4), + Longitude = reader.GetDouble(5) + }; + vineyards.Add(vineyard); + } + } + } + return vineyards; + } + } +} diff --git a/uWine.Core.Infrastructure/Repository/MariadbOwnerRepository.cs b/uWine.Core.Infrastructure/Repository/MariadbOwnerRepository.cs new file mode 100644 index 0000000..bee4afe --- /dev/null +++ b/uWine.Core.Infrastructure/Repository/MariadbOwnerRepository.cs @@ -0,0 +1,117 @@ +using Microsoft.Extensions.Configuration; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using uWine.Core.Domain.Entities; +using uWine.Core.Domain.Repositories; + +namespace uWine.Core.Infrastructure.Repository +{ + public class MariadbOwnerRepository : MariaDbServerRepository, IOwnerRepository + { + public MariadbOwnerRepository(IConfiguration configuration) : base(configuration) + { + + } + + public void Insert(Owner owner) + { + using (var connection = Connection()) + { + connection.Open(); + var cmd = new MySqlCommand($@"INSERT INTO t_owners ( + first_name, + last_name, + company_name, + note + ) VALUES ( + @firstName, + @lastName, + @companyName, + @note )", connection); + cmd.Parameters.AddWithValue("@firstName", owner.Name); + cmd.Parameters.AddWithValue("@lastName", owner.Surname); + cmd.Parameters.AddWithValue("@companyName", owner.CompanyName); + cmd.Parameters.AddWithValue("@note", owner.Note); + cmd.ExecuteNonQuery(); + } + } + + public void AddAddress(int ownerId, Address address) + { + using (var connection = Connection()) + { + connection.Open(); + using var cmd = new MySqlCommand($@"INSERT INTO t_addresses ( + owner_id, + country, + postal_code, + county, + province, + city, + street, + house_number, + latitude, + longitude, + active + ) VALUES ( + @ownerId, + @country, + @postal_code, + @county, + @province, + @city, + @street, + @house_number, + @latitude, + @longitude, + @active ); LAST_INSERT_ID();", connection); + cmd.Parameters.AddWithValue("@ownerId", ownerId); + cmd.Parameters.AddWithValue("@country", address.Country); + cmd.Parameters.AddWithValue("@postal_code", address.PostalCode); + cmd.Parameters.AddWithValue("@county", address.County); + cmd.Parameters.AddWithValue("@province", address.Province); + cmd.Parameters.AddWithValue("@city", address.City); + cmd.Parameters.AddWithValue("@street", address.Street); + cmd.Parameters.AddWithValue("@house_number", address.HouseNumber); + cmd.Parameters.AddWithValue("@latitude", address.Latitude); + cmd.Parameters.AddWithValue("@longitude", address.Longitude); + cmd.Parameters.AddWithValue("@active", address.Active ? 1 : 0); + using (var reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + address.Id = reader.GetInt32(0); + } + } + + using var cmd2 = new MySqlCommand("INSERT INTO t_owners_addresses (owner_id, address_id) VALUES (@ownerId, @addressId)", connection); + cmd2.Parameters.AddWithValue("@ownerId", ownerId); + cmd2.Parameters.AddWithValue("@addressId", address.Id); + cmd2.ExecuteNonQuery(); + } + } + + public Owner Simple(int ownerId) + { + using (var connection = Connection()) + { + connection.Open(); + using var cmd = new MySqlCommand("SELECT * FROM t_owners WHERE id = @id", connection); + cmd.Parameters.AddWithValue("@id", ownerId); + using (var reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + var owner = Owner.FromRecord(reader); + } + } + + } + return new Owner(); + } + } +}