Преглед на файлове

Add Currency, Country and relationships to model. Missing service

Dalibor Votruba преди 3 години
родител
ревизия
21ae3b2c5d
променени са 26 файла, в които са добавени 996 реда и са изтрити 89 реда
  1. 263 57
      @Documentation/QLiberace.simp
  2. 2 1
      Common/qdr.app.qlbrc.common/Repositories/QlbrcRepository.cs
  3. 4 0
      Modules/qdr.app.qlbrc.base/Constants.cs
  4. 20 0
      Modules/qdr.app.qlbrc.base/Entities/Country.cs
  5. 21 0
      Modules/qdr.app.qlbrc.base/Entities/Currency.cs
  6. 51 0
      Modules/qdr.app.qlbrc.base/Entities/DaoMapper/CountryDm.cs
  7. 46 0
      Modules/qdr.app.qlbrc.base/Entities/DaoMapper/CurrencyDm.cs
  8. 42 0
      Modules/qdr.app.qlbrc.base/Entities/DaoMapper/TenantCountryDm.cs
  9. 42 0
      Modules/qdr.app.qlbrc.base/Entities/DaoMapper/TenantCurrencyDm.cs
  10. 8 0
      Modules/qdr.app.qlbrc.base/Entities/Interfaces/IStructCodeName.cs
  11. 1 3
      Modules/qdr.app.qlbrc.base/Entities/Interfaces/IStructTenant.cs
  12. 2 0
      Modules/qdr.app.qlbrc.base/Entities/Tenant.cs
  13. 19 0
      Modules/qdr.app.qlbrc.base/Entities/TenantCountry.cs
  14. 14 0
      Modules/qdr.app.qlbrc.base/Entities/TenantCurrency.cs
  15. 6 0
      Modules/qdr.app.qlbrc.base/QlbrcDbContext.cs
  16. 40 0
      Modules/qdr.app.qlbrc.base/Repositories/RepoCountry.cs
  17. 40 0
      Modules/qdr.app.qlbrc.base/Repositories/RepoCurrency.cs
  18. 43 0
      Workbench/Entity/Country.cs
  19. 44 0
      Workbench/Entity/Currency.cs
  20. 130 5
      Workbench/Entity/QLiberaceContext.cs
  21. 0 4
      Workbench/Entity/Setting.cs
  22. 5 9
      Workbench/Entity/Tenant.cs
  23. 20 0
      Workbench/Entity/TenantCountry.cs
  24. 20 0
      Workbench/Entity/TenantCurrency.cs
  25. 4 4
      Workbench/Entity/TenantUser.cs
  26. 109 6
      qdr.app.qlbrc.console/Commands/DbInitCmd.cs

+ 263 - 57
@Documentation/QLiberace.simp

@@ -13,13 +13,13 @@
       </counter>
       <counter>
         <item-type type-id="erd-entity" type="Entity" />
-        <value>4</value>
+        <value>8</value>
       </counter>
     </entity-names>
     <entity-ids>
       <counter>
         <item-type type-id="group" type="Group" />
-        <value>313</value>
+        <value>491</value>
       </counter>
       <counter>
         <item-type type-id="component" type="Component" />
@@ -43,11 +43,11 @@
       </counter>
       <counter>
         <item-type type-id="erd-entity" type="Entity" />
-        <value>5</value>
+        <value>9</value>
       </counter>
       <counter>
         <item-type type-id="erd-relationship" type="Relationship" />
-        <value>19</value>
+        <value>24</value>
       </counter>
     </entity-ids>
     <diagrams>
@@ -67,11 +67,11 @@
     <fields>
       <counter>
         <type>SoftwareIdeasModeler.Core.DiagramItems.Erd.ErdEntityAttribute</type>
-        <value>31</value>
+        <value>50</value>
       </counter>
       <counter>
         <type>SoftwareIdeasModeler.Core.DiagramItems.Erd.ErdEntityIndex</type>
-        <value>5</value>
+        <value>7</value>
       </counter>
     </fields>
   </counters>
@@ -174,8 +174,8 @@
             </stereotype-instances>
             <owned-items />
             <relation from="7546dafc2b0d406bb9cf489c5eeb4aff" to="2626a7fd504946ccaa1eb090b6d27d0d" derived="false">
-              <start-role id="umlar-514d049c-19c5-4f50-ba0b-3685153babdd" name="" navigability="" association-type="association" visibility="private" property-ref="de0957d8d7ac42eab57e579c2cefbf47" />
-              <end-role id="umlar-7007235f-0293-427f-8765-6c6222d43b2f" name="" navigability="yes" association-type="association" visibility="private" property-ref="49ad3ceea0bb4157b557e21e2eb7c0b9" />
+              <start-role id="umlar-b367650b-7fd0-43a4-bfd4-291c448770fc" name="" navigability="" association-type="association" visibility="private" property-ref="de0957d8d7ac42eab57e579c2cefbf47" />
+              <end-role id="umlar-c9e7644d-5ade-4df7-b923-5de4c231e015" name="" navigability="yes" association-type="association" visibility="private" property-ref="49ad3ceea0bb4157b557e21e2eb7c0b9" />
             </relation>
           </item>
           <item id="2626a7fd504946ccaa1eb090b6d27d0d" cid="CPT001" type="component" name="Base" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:39:10" visibility="undefined">
@@ -284,19 +284,6 @@
             </stereotype-instances>
             <component />
           </item>
-          <item id="7268ad1b0bd249218475144e6941ccdf" cid="REL001" type="relationship" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:42:51" from="cb92b4b50dc847aebfdbd90ce365a1eb" to="7546dafc2b0d406bb9cf489c5eeb4aff" visibility="package">
-            <stereotypes>
-              <stereotype name="use" />
-            </stereotypes>
-            <stereotype-instances>
-              <stereotype id="7268ad1b0bd249218475144e6941ccdf_use_c" type="use" ref="" />
-            </stereotype-instances>
-            <owned-items />
-            <relation from="cb92b4b50dc847aebfdbd90ce365a1eb" to="7546dafc2b0d406bb9cf489c5eeb4aff" derived="false">
-              <start-role id="umlar-b20fdfea-e1af-43b9-8888-03175954b812" name="" navigability="" association-type="association" visibility="private" property-ref="93016f98fae440bb88e27fe09172df66" />
-              <end-role id="umlar-e6208a74-7fa9-4cd5-9497-0dfaeaba3db1" name="" navigability="yes" association-type="association" visibility="private" property-ref="132ce45236e54d6da05ae53d64712729" />
-            </relation>
-          </item>
           <item id="7546dafc2b0d406bb9cf489c5eeb4aff" cid="CPT002" type="component" name="Customer" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:40:04" visibility="undefined">
             <stereotypes>
               <stereotype name="component" />
@@ -356,6 +343,19 @@
             </stereotype-instances>
             <component />
           </item>
+          <item id="7268ad1b0bd249218475144e6941ccdf" cid="REL001" type="relationship" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:42:51" from="cb92b4b50dc847aebfdbd90ce365a1eb" to="7546dafc2b0d406bb9cf489c5eeb4aff" visibility="package">
+            <stereotypes>
+              <stereotype name="use" />
+            </stereotypes>
+            <stereotype-instances>
+              <stereotype id="7268ad1b0bd249218475144e6941ccdf_use_c" type="use" ref="" />
+            </stereotype-instances>
+            <owned-items />
+            <relation from="cb92b4b50dc847aebfdbd90ce365a1eb" to="7546dafc2b0d406bb9cf489c5eeb4aff" derived="false">
+              <start-role id="umlar-8f5c10b5-2956-42f2-b344-c70bf1477336" name="" navigability="" association-type="association" visibility="private" property-ref="93016f98fae440bb88e27fe09172df66" />
+              <end-role id="umlar-cd9d0c01-2f8e-45f5-bedd-c532c1ee7c9d" name="" navigability="yes" association-type="association" visibility="private" property-ref="132ce45236e54d6da05ae53d64712729" />
+            </relation>
+          </item>
           <item id="2037f7bd032e4fa3a1d8d99f1cd1ea27" cid="REL002" type="relationship" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:43:08" from="cb92b4b50dc847aebfdbd90ce365a1eb" to="2626a7fd504946ccaa1eb090b6d27d0d" visibility="package">
             <stereotypes>
               <stereotype name="use" />
@@ -365,8 +365,8 @@
             </stereotype-instances>
             <owned-items />
             <relation from="cb92b4b50dc847aebfdbd90ce365a1eb" to="2626a7fd504946ccaa1eb090b6d27d0d" derived="false">
-              <start-role id="umlar-bc3f84aa-0b50-4c37-9ef5-cc10f9f0e631" name="" navigability="" association-type="association" visibility="private" property-ref="002883f71fbc4324bbd1efa19cdbd1a6" />
-              <end-role id="umlar-4705a859-41e6-4cbe-a2be-36baaa603479" name="" navigability="yes" association-type="association" visibility="private" property-ref="b531bae1520645b58761d8077cac7517" />
+              <start-role id="umlar-6711df01-51c3-4c7a-bcf8-078fc9b1c209" name="" navigability="" association-type="association" visibility="private" property-ref="002883f71fbc4324bbd1efa19cdbd1a6" />
+              <end-role id="umlar-242389be-1950-41e7-85e3-b1ea15d9369d" name="" navigability="yes" association-type="association" visibility="private" property-ref="b531bae1520645b58761d8077cac7517" />
             </relation>
           </item>
         </abstract-items>
@@ -489,8 +489,8 @@
           </item>
           <item id="c19c4449f012422dbba1ddec55021b44" cid="REL004" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:57:00" from="d3486fe91b1f476e8a3393099f04e99e" to="ba48530a7b5245a7b6efcf3d8e61f067" visibility="package">
             <relation from="d3486fe91b1f476e8a3393099f04e99e" to="ba48530a7b5245a7b6efcf3d8e61f067" derived="false">
-              <start-role id="umlar-09683eff-8cfe-486c-9425-c2bc6a352f1e" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-4be79653-dc74-4acf-a657-8ddfd6a642bd" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-0ac4316e-c9eb-4577-9391-88aa721acc9f" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-fb0410f9-fa42-462f-af68-e8414ef01445" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="c34f0bc111894b608624e52c0815c07a" cid="REQ007" type="requirement" name="RQ_TECH_SPEC_FE_4" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:02:23">
@@ -597,14 +597,14 @@
           </item>
           <item id="ce75414afc48414db34ec56233570770" cid="REL005" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:58:04" from="05792695378d4e0fa3cdd3681474e8f6" to="ba48530a7b5245a7b6efcf3d8e61f067" visibility="package">
             <relation from="05792695378d4e0fa3cdd3681474e8f6" to="ba48530a7b5245a7b6efcf3d8e61f067" derived="false">
-              <start-role id="umlar-2f5c9cc3-19e8-48c8-b0af-6ffb9171ff06" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-07568f38-457d-4c3c-bc68-71ca644eaef4" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-c9ce73dc-4d05-4240-ac29-76a96f965dcb" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-7ab05c3a-1ad9-48a9-ab4e-01bc7bb4c866" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="57b3095ce64f4492bf2b9b93738232bf" cid="REL007" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:02:23" from="c34f0bc111894b608624e52c0815c07a" to="ba48530a7b5245a7b6efcf3d8e61f067" visibility="package">
             <relation from="c34f0bc111894b608624e52c0815c07a" to="ba48530a7b5245a7b6efcf3d8e61f067" derived="false">
-              <start-role id="umlar-1d355ca4-6c96-4f5c-8388-68baa97d652c" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-8e571c81-4137-4657-a829-2c1890b7c8c5" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-7f7509c2-8321-4a22-a285-02905818f3e5" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-fe31b6f2-47cd-44d4-a53f-4d18a5b599bb" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="05792695378d4e0fa3cdd3681474e8f6" cid="REQ005" type="requirement" name="RQ_TECH_SPEC_FRAMEWORK_2" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:58:04">
@@ -765,26 +765,26 @@
           </item>
           <item id="b92a1d894874430fb846cd4ffebbe4e1" cid="REL014" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:09:33" from="f57cd7c78a5e483ebb3edb6a59957a97" to="c54c944000d84837bbb378cebd81a4e2" visibility="package">
             <relation from="f57cd7c78a5e483ebb3edb6a59957a97" to="c54c944000d84837bbb378cebd81a4e2" derived="false">
-              <start-role id="umlar-ae451a75-fb32-416b-90dc-a3e01f2d0838" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-db7f8c07-e73e-4dcb-81cd-ce840195b0d2" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-84895bbb-3239-4dc5-8050-df6f2a58c2c8" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-2381cd1a-99e5-4bd0-b909-4e1a6b981c30" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="2ffa044974b44d11a13593ba0173375b" cid="REL010" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:05:39" from="b2345a523c6b4b969a3fc4b92c2a427e" to="f3f58833e12d41adbad092d5fa821ae6" visibility="package">
             <relation from="b2345a523c6b4b969a3fc4b92c2a427e" to="f3f58833e12d41adbad092d5fa821ae6" derived="false">
-              <start-role id="umlar-d1e94e7f-c8d6-45d8-ae91-7f65047cb91a" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-95d604e8-26aa-4f4d-a069-43fd76e0081c" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-5eb9f44a-970f-4518-89bc-0672c4f94aa8" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-3f35c3fe-556c-457d-90a5-71e5d4e3dd12" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="b8f1b1ee8380442a9b9806bcaabd60e1" cid="REL009" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:04:56" from="c776555b542842099176f5d00fbd63e4" to="f3f58833e12d41adbad092d5fa821ae6" visibility="package">
             <relation from="c776555b542842099176f5d00fbd63e4" to="f3f58833e12d41adbad092d5fa821ae6" derived="false">
-              <start-role id="umlar-f8bb8b64-4d80-4e7a-8c48-c5c6ad085584" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-1da7debb-297e-4f8b-9649-75878b6f8960" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-84fe1aa8-440f-4b5c-a0be-69cfdc0afc7c" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-d3854884-af4d-4b56-9892-aed81ef41c0a" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="d31aa3cec9784517b6f38b38341c1799" cid="REL006" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:59:19" from="cc5e96719a7b4470b17001e1bc806b61" to="ba48530a7b5245a7b6efcf3d8e61f067" visibility="package">
             <relation from="cc5e96719a7b4470b17001e1bc806b61" to="ba48530a7b5245a7b6efcf3d8e61f067" derived="false">
-              <start-role id="umlar-80e450d6-5529-4bf5-8e57-d4576a4307e9" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-7267061c-2215-4b32-a93c-a3296f35e343" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-051139d1-5cc4-4890-bec9-497e0f16dd53" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-36e13935-774d-4aa0-9462-ac46c2fdf986" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="d3486fe91b1f476e8a3393099f04e99e" cid="REQ004" type="requirement" name="RQ_TECH_SPEC_PLATFORM_1" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 15:57:00">
@@ -887,8 +887,8 @@
           </item>
           <item id="6236eeabf4f94d1984205fd7fcb75b72" cid="REL008" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:04:52" from="c42a187a572a4c2c80d005bf4ea52f65" to="f3f58833e12d41adbad092d5fa821ae6" visibility="package">
             <relation from="c42a187a572a4c2c80d005bf4ea52f65" to="f3f58833e12d41adbad092d5fa821ae6" derived="false">
-              <start-role id="umlar-066f722a-3023-4684-a53c-7696dd51fa13" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-2f89e4ee-529b-4dd6-9dd7-99b910801ca4" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-63161223-20c6-4f34-9b09-ba8d7e1b60e3" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-a920ddc3-557a-4e54-b393-e2f9d0bc2b76" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="b2345a523c6b4b969a3fc4b92c2a427e" cid="REQ009" type="requirement" name="RQ_SUP_SETTINGS" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:05:39">
@@ -1006,14 +1006,14 @@
           </item>
           <item id="613bacfba1584c98951c8961e3c0cc5e" cid="REL011" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:07:27" from="c54c944000d84837bbb378cebd81a4e2" to="0a48454de005413c92e4a5cce0d2982c" visibility="package">
             <relation from="c54c944000d84837bbb378cebd81a4e2" to="0a48454de005413c92e4a5cce0d2982c" derived="false">
-              <start-role id="umlar-b5191386-5312-412a-9a2a-e5dab0bb1ee0" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-0a0ddf63-1b05-4d7a-8c85-b9ae67f171e1" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-fa4abb17-1716-4355-930a-602197537280" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-ad0e650f-e6ef-40a5-968e-abe5e5112b6b" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="4db2cc42f34c4caa94683e00c470b9da" cid="REL013" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:08:33" from="7888a9de9bb14ac0a6fadd2418d0d7a6" to="c54c944000d84837bbb378cebd81a4e2" visibility="package">
             <relation from="7888a9de9bb14ac0a6fadd2418d0d7a6" to="c54c944000d84837bbb378cebd81a4e2" derived="false">
-              <start-role id="umlar-9963dd2e-111f-497b-af92-413f99ddf628" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-5c6bfeaa-9f51-417b-9bf6-dff7a873a136" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-5847bae8-1f9d-44da-9e70-68af5abf8a3a" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-4cae0cf6-27e9-4e83-b57e-9546b1aa13d8" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
           <item id="f2c72e50f02843f08f5a7b84d1b0047f" cid="REQ012" type="requirement" name="RQ_CSTR_APP" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:07:51">
@@ -1241,8 +1241,8 @@
           </item>
           <item id="fbc97786a07c4aaa90c643ba77619c6e" cid="REL012" type="relationship" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="09/15/2022 16:07:51" from="f2c72e50f02843f08f5a7b84d1b0047f" to="0a48454de005413c92e4a5cce0d2982c" visibility="package">
             <relation from="f2c72e50f02843f08f5a7b84d1b0047f" to="0a48454de005413c92e4a5cce0d2982c" derived="false">
-              <start-role id="umlar-17f89034-a605-43fa-adfa-d7547b32d4c0" name="" navigability="" association-type="association" visibility="private" />
-              <end-role id="umlar-8e1cc8d6-9b3d-4e2c-b7e0-250ab55f5e2b" name="" navigability="" association-type="composition" visibility="private" />
+              <start-role id="umlar-26f42be0-6073-43a4-949f-3efe901aff3f" name="" navigability="" association-type="association" visibility="private" />
+              <end-role id="umlar-29f40263-b2ad-4e2a-9873-e9670f03f8ab" name="" navigability="" association-type="composition" visibility="private" />
             </relation>
           </item>
         </abstract-items>
@@ -1417,7 +1417,7 @@
           </meta>
           <abstract-items />
           <sub-models />
-          <diagram type="entity-relationship" id="p2d80210b075e4f5d8725460fac0df0c9_518455272" name="Base" order-index="0" uid="" name-style="" auto-routed-paths="false" default-line-style="default" view-location="0,-2">
+          <diagram type="entity-relationship" id="p2d80210b075e4f5d8725460fac0df0c9_518455272" name="Base" order-index="0" uid="" name-style="" auto-routed-paths="false" default-line-style="default" view-location="212,477">
             <style>
               <background-color index="1" color="#FFFFFFFF" />
               <background-color index="2" color="#FFFFFFFF" />
@@ -1429,11 +1429,24 @@
               </authors>
               <description />
               <creation-date>11/04/2022 05:59:30</creation-date>
-              <change-date>11/04/2022 06:48:42</change-date>
+              <change-date>11/05/2022 09:28:10</change-date>
               <revision-count>0</revision-count>
-              <version />
+              <version>1.0.0.0</version>
             </meta>
             <abstract-items>
+              <item id="7e382f0a73dd4e12b0db78aea55eb53b" cid="REL021" type="erd-relationship" name="REL_TENANTCOUNTRY_COUNTRY_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:25:51" from="979e2dd2651742e08af31f818c22bf4e" to="84a3ecb6b97b4e9cbcf5d8255039f80c">
+                <stereotypes>
+                  <stereotype name="relation" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="7e382f0a73dd4e12b0db78aea55eb53b_relation_c" type="relation" ref="" />
+                </stereotype-instances>
+                <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="1">
+                  <attribute-pairs>
+                    <attribute-pair from-attribute="ac565ef6d613e4ce395193ba85470dd24288" to-attribute="aeedb6cafa13c432289059d4aeee86fbf868" />
+                  </attribute-pairs>
+                </erd-relation>
+              </item>
               <item id="1995ba399cb24729b4df7bbbc0c77b31" cid="TBL_SETTING" type="erd-entity" name="Setting" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:37:09">
                 <stereotypes>
                   <stereotype name="table" />
@@ -1467,6 +1480,19 @@
                   </index>
                 </indexes>
               </item>
+              <item id="eed22cb50bf14a369a44386ecff2eddf" cid="REL_SETTING_SETTING_ID" type="erd-relationship" name="REL_SETTING_SETTING_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:46:59" from="1995ba399cb24729b4df7bbbc0c77b31" to="1995ba399cb24729b4df7bbbc0c77b31">
+                <stereotypes>
+                  <stereotype name="relation" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="eed22cb50bf14a369a44386ecff2eddf_relation_c" type="relation" ref="" />
+                </stereotype-instances>
+                <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="0..1">
+                  <attribute-pairs>
+                    <attribute-pair from-attribute="a08479372eb77415d9e7fc24b12fd0d42593" to-attribute="a43f81acbacea4b5eb1ab53c404241e92410" />
+                  </attribute-pairs>
+                </erd-relation>
+              </item>
               <item id="031a668b1d6a45e1907a612d85b43d24" cid="TBL_USER" type="erd-entity" name="User" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:15:45">
                 <stereotypes>
                   <stereotype name="table" />
@@ -1491,29 +1517,29 @@
                   </index>
                 </indexes>
               </item>
-              <item id="eed22cb50bf14a369a44386ecff2eddf" cid="REL_SETTING_SETTING_ID" type="erd-relationship" name="REL_SETTING_SETTING_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:46:59" from="1995ba399cb24729b4df7bbbc0c77b31" to="1995ba399cb24729b4df7bbbc0c77b31">
+              <item id="38364cd5ebf7433c827087a1d94c73ca" cid="REL_TENANTUSER_USER_ID" type="erd-relationship" name="REL_TENANTUSER_USER_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:28:44" from="f7ba98ff46b54ebd99e6e9d48d4aeee9" to="031a668b1d6a45e1907a612d85b43d24">
                 <stereotypes>
                   <stereotype name="relation" />
                 </stereotypes>
                 <stereotype-instances>
-                  <stereotype id="eed22cb50bf14a369a44386ecff2eddf_relation_c" type="relation" ref="" />
+                  <stereotype id="38364cd5ebf7433c827087a1d94c73ca_relation_c" type="relation" ref="" />
                 </stereotype-instances>
                 <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="0..1">
                   <attribute-pairs>
-                    <attribute-pair from-attribute="a08479372eb77415d9e7fc24b12fd0d42593" to-attribute="a43f81acbacea4b5eb1ab53c404241e92410" />
+                    <attribute-pair from-attribute="a6e7eae435a0345fea29288220aa8aa1d623" to-attribute="a6dda4862ea794595834ccbbeacdb68a8699" />
                   </attribute-pairs>
                 </erd-relation>
               </item>
-              <item id="38364cd5ebf7433c827087a1d94c73ca" cid="REL_TENANTUSER_USER_ID" type="erd-relationship" name="REL_TENANTUSER_USER_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:28:44" from="f7ba98ff46b54ebd99e6e9d48d4aeee9" to="031a668b1d6a45e1907a612d85b43d24">
+              <item id="ccc94b03e9f14adf85defc647f594921" cid="REL023" type="erd-relationship" name="REL_COUNTRY_CURRENCY_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:28:10" from="84a3ecb6b97b4e9cbcf5d8255039f80c" to="cb80b20360f340559de7775b16dcf14f">
                 <stereotypes>
                   <stereotype name="relation" />
                 </stereotypes>
                 <stereotype-instances>
-                  <stereotype id="38364cd5ebf7433c827087a1d94c73ca_relation_c" type="relation" ref="" />
+                  <stereotype id="ccc94b03e9f14adf85defc647f594921_relation_c" type="relation" ref="" />
                 </stereotype-instances>
-                <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="0..1">
+                <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="1">
                   <attribute-pairs>
-                    <attribute-pair from-attribute="a6e7eae435a0345fea29288220aa8aa1d623" to-attribute="a6dda4862ea794595834ccbbeacdb68a8699" />
+                    <attribute-pair from-attribute="ab59af341336049cab67540f6403cce1425" to-attribute="ab12dbe3ddb0e44da817555c631a0bcdd360" />
                   </attribute-pairs>
                 </erd-relation>
               </item>
@@ -1543,6 +1569,73 @@
                   </attribute-pairs>
                 </erd-relation>
               </item>
+              <item id="979e2dd2651742e08af31f818c22bf4e" cid="ENT007" type="erd-entity" name="TenantCountry" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:13:26">
+                <stereotypes>
+                  <stereotype name="table" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="979e2dd2651742e08af31f818c22bf4e_table_c" type="table" ref="" />
+                </stereotype-instances>
+                <entity description="" />
+                <attributes>
+                  <attribute uid="af9002db56cf14129b96aa8a533353459288" cid="EA037" name="TenantId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Reference to tenant" default-value="" auto-increment="false" creation-date="11/05/2022 09:21:27" />
+                  <attribute uid="ac565ef6d613e4ce395193ba85470dd24288" cid="EA038" name="CountryId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Reference to country" default-value="" auto-increment="false" creation-date="11/05/2022 09:21:27" />
+                </attributes>
+                <indexes />
+              </item>
+              <item id="84a3ecb6b97b4e9cbcf5d8255039f80c" cid="ENT005" type="erd-entity" name="Country" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:12:36">
+                <stereotypes>
+                  <stereotype name="table" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="84a3ecb6b97b4e9cbcf5d8255039f80c_table_c" type="table" ref="" />
+                </stereotype-instances>
+                <entity pk-constraint-name="PK_COUNTRY_ID" description="" />
+                <attributes>
+                  <attribute uid="aeedb6cafa13c432289059d4aeee86fbf868" cid="EA031" name="Id" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="false" primary-key="true" nullable="false" description="Country primary key" default-value="" auto-increment="true" creation-date="11/05/2022 09:17:15" />
+                  <attribute uid="aee992231074d4df0b1c9b72d1434a01c129" cid="EA033" name="Code" type="nvarchar" type-id="MsSql.nvarchar" type-size="5" foreign-key="false" primary-key="false" nullable="false" description="Country code. Main key to search." default-value="" auto-increment="false" creation-date="11/05/2022 09:19:04" />
+                  <attribute uid="a84ef25ff46594a6a9e18a66e1b39405e129" cid="EA034" name="Name" type="nvarchar" type-id="MsSql.nvarchar" type-size="50" foreign-key="false" primary-key="false" nullable="false" description="Country name. Informational value." default-value="" auto-increment="false" creation-date="11/05/2022 09:19:04" />
+                  <attribute uid="abf111a06e7914da4afb4f701133e9d9c905" cid="EA048" name="VAT" type="int" type-id="MsSql.int" type-size="" foreign-key="false" primary-key="false" nullable="false" description="Percentage VAT definition" default-value="0" auto-increment="false" creation-date="11/05/2022 15:48:54" />
+                  <attribute uid="a432919c754f74f2f8df24ca16654baa9551" cid="EA041" name="Created" type="datetime" type-id="MsSql.datetime" type-size="" foreign-key="false" primary-key="false" nullable="false" description="Record created timestamp" default-value="getdate()" auto-increment="false" creation-date="11/05/2022 09:23:20" />
+                  <attribute uid="a896ddad847ef457eb98892af27a1433d551" cid="EA042" name="Modified" type="datetime" type-id="MsSql.datetime" type-size="" foreign-key="false" primary-key="false" nullable="true" description="Record modified timestamp" default-value="" auto-increment="false" creation-date="11/05/2022 09:23:20" />
+                  <attribute uid="a088e06d1f3f844f087bd5fdb758ae8bb551" cid="EA043" name="Modifier" type="nvarchar" type-id="MsSql.nvarchar" type-size="100" foreign-key="false" primary-key="false" nullable="true" description="Record modifier signature" default-value="" auto-increment="false" creation-date="11/05/2022 09:23:20" />
+                  <attribute uid="ab59af341336049cab67540f6403cce1425" cid="EA047" name="DefaultCurrencyId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Default country currency" default-value="" auto-increment="false" creation-date="11/05/2022 09:27:07" />
+                </attributes>
+                <indexes>
+                  <index uid="ix90c5220734a44edaa19e97e31c949089832" cid="ERI005" name="IDX_COUNTRY_CODE" is-unique="true">
+                    <index-attributes>
+                      <index-attribute ref="aee992231074d4df0b1c9b72d1434a01c129" sort="Asc" />
+                    </index-attributes>
+                  </index>
+                </indexes>
+              </item>
+              <item id="a48a9211b03c407cbb288eded410b64a" cid="REL019" type="erd-relationship" name="REL_TENANTCOUNTRY_TENANT_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:24:18" from="979e2dd2651742e08af31f818c22bf4e" to="e50f79968a404d3fbb33f4a02fa3b572">
+                <stereotypes>
+                  <stereotype name="relation" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="a48a9211b03c407cbb288eded410b64a_relation_c" type="relation" ref="" />
+                </stereotype-instances>
+                <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="1">
+                  <attribute-pairs>
+                    <attribute-pair from-attribute="af9002db56cf14129b96aa8a533353459288" to-attribute="aeda82a68426646d3a6cfa276db9bd56f255" />
+                  </attribute-pairs>
+                </erd-relation>
+              </item>
+              <item id="1596d482602d4447b90d648ed5031bb4" cid="ENT008" type="erd-entity" name="TenantCurrency" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:15:25">
+                <stereotypes>
+                  <stereotype name="table" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="1596d482602d4447b90d648ed5031bb4_table_c" type="table" ref="" />
+                </stereotype-instances>
+                <entity description="" />
+                <attributes>
+                  <attribute uid="a1852ccbbf7aa4e3994563945086ea602887" cid="EA039" name="TenantId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Reference to tenant" default-value="" auto-increment="false" creation-date="11/05/2022 09:21:56" />
+                  <attribute uid="a743bc958b32142279f0be7a53e28a40f887" cid="EA040" name="CurrencyId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Reference to currency" default-value="" auto-increment="false" creation-date="11/05/2022 09:21:56" />
+                </attributes>
+                <indexes />
+              </item>
               <item id="e50f79968a404d3fbb33f4a02fa3b572" cid="TBL_TENANT" type="erd-entity" name="Tenant" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:00:06">
                 <stereotypes>
                   <stereotype name="table" />
@@ -1569,6 +1662,44 @@
                   </index>
                 </indexes>
               </item>
+              <item id="4c112af66ef746a3897a3e2a89b04793" cid="REL022" type="erd-relationship" name="REL_TENANTCURRENCY_CURRENCY__ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:26:21" from="1596d482602d4447b90d648ed5031bb4" to="cb80b20360f340559de7775b16dcf14f">
+                <stereotypes>
+                  <stereotype name="relation" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="4c112af66ef746a3897a3e2a89b04793_relation_c" type="relation" ref="" />
+                </stereotype-instances>
+                <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="1">
+                  <attribute-pairs>
+                    <attribute-pair from-attribute="a743bc958b32142279f0be7a53e28a40f887" to-attribute="ab12dbe3ddb0e44da817555c631a0bcdd360" />
+                  </attribute-pairs>
+                </erd-relation>
+              </item>
+              <item id="cb80b20360f340559de7775b16dcf14f" cid="ENT006" type="erd-entity" name="Currency" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:12:59">
+                <stereotypes>
+                  <stereotype name="table" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="cb80b20360f340559de7775b16dcf14f_table_c" type="table" ref="" />
+                </stereotype-instances>
+                <entity pk-constraint-name="PK_CURRENCY_ID" description="" />
+                <attributes>
+                  <attribute uid="ab12dbe3ddb0e44da817555c631a0bcdd360" cid="EA032" name="Id" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="false" primary-key="true" nullable="false" description="Currency primary key" default-value="" auto-increment="true" creation-date="11/05/2022 09:17:35" />
+                  <attribute uid="aed59b1c4df804811bfde90b55c6713b6712" cid="EA035" name="Code" type="nvarchar" type-id="MsSql.nvarchar" type-size="5" foreign-key="false" primary-key="false" nullable="false" description="Currency code. Main key to search." default-value="" auto-increment="false" creation-date="11/05/2022 09:19:39" />
+                  <attribute uid="a3c54fc44689148239ae254d509f4496e712" cid="EA036" name="Name" type="nvarchar" type-id="MsSql.nvarchar" type-size="50" foreign-key="false" primary-key="false" nullable="false" description="Currency name. Informational value." default-value="" auto-increment="false" creation-date="11/05/2022 09:19:39" />
+                  <attribute uid="a150b7b7f022543269c204fc94aab1e4280" cid="EA049" name="Sign" type="nvarchar" type-id="MsSql.nvarchar" type-size="3" foreign-key="false" primary-key="false" nullable="false" description="Currency sign chars" default-value="" auto-increment="false" creation-date="11/05/2022 15:50:42" />
+                  <attribute uid="a556aaae565f64312a99efd6c5621d810288" cid="EA044" name="Created" type="datetime" type-id="MsSql.datetime" type-size="" foreign-key="false" primary-key="false" nullable="false" description="Record created timestamp" default-value="getdate()" auto-increment="false" creation-date="11/05/2022 09:23:26" />
+                  <attribute uid="abf489d108ff04c83855cdbddabe28e5f288" cid="EA045" name="Modified" type="datetime" type-id="MsSql.datetime" type-size="" foreign-key="false" primary-key="false" nullable="true" description="Record modified timestamp" default-value="" auto-increment="false" creation-date="11/05/2022 09:23:26" />
+                  <attribute uid="a3c38f9e3f9d640e183cc6eb66c758c5d288" cid="EA046" name="Modifier" type="nvarchar" type-id="MsSql.nvarchar" type-size="100" foreign-key="false" primary-key="false" nullable="true" description="Record modifier signature" default-value="" auto-increment="false" creation-date="11/05/2022 09:23:26" />
+                </attributes>
+                <indexes>
+                  <index uid="ix900909c342d84f2ebe2f44e5dfa3f849750" cid="ERI006" name="IDX_CURRENCY_ID" is-unique="true">
+                    <index-attributes>
+                      <index-attribute ref="aed59b1c4df804811bfde90b55c6713b6712" sort="Asc" />
+                    </index-attributes>
+                  </index>
+                </indexes>
+              </item>
               <item id="f7ba98ff46b54ebd99e6e9d48d4aeee9" cid="TBL_TENANTUSER" type="erd-entity" name="TenantUser" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/04/2022 06:22:55">
                 <stereotypes>
                   <stereotype name="table" />
@@ -1628,11 +1759,24 @@
                 </stereotype-instances>
                 <entity description="" />
                 <attributes>
-                  <attribute uid="ab59b0b6bdd31441c89af642f0131a84b208" cid="EA015" name="TenantId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="true" description="Reference to tenant" default-value="" auto-increment="false" creation-date="11/04/2022 06:24:04" />
-                  <attribute uid="a6e7eae435a0345fea29288220aa8aa1d623" cid="EA016" name="UserId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="true" description="Reference to user" default-value="" auto-increment="false" creation-date="11/04/2022 06:25:02" />
+                  <attribute uid="ab59b0b6bdd31441c89af642f0131a84b208" cid="EA015" name="TenantId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Reference to tenant" default-value="" auto-increment="false" creation-date="11/04/2022 06:24:04" />
+                  <attribute uid="a6e7eae435a0345fea29288220aa8aa1d623" cid="EA016" name="UserId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Reference to user" default-value="" auto-increment="false" creation-date="11/04/2022 06:25:02" />
                 </attributes>
                 <indexes />
               </item>
+              <item id="de25be4a0e78494f885762b863143fd6" cid="REL020" type="erd-relationship" name="REL_TENANTCURRENCT_TENANT_ID" creator="CDoZfQE0eoPT0twKUywpA1ytAerZlrAks6wQJtSziyhd5T57" creation-date="11/05/2022 09:25:11" from="1596d482602d4447b90d648ed5031bb4" to="e50f79968a404d3fbb33f4a02fa3b572">
+                <stereotypes>
+                  <stereotype name="relation" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="de25be4a0e78494f885762b863143fd6_relation_c" type="relation" ref="" />
+                </stereotype-instances>
+                <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="1">
+                  <attribute-pairs>
+                    <attribute-pair from-attribute="a1852ccbbf7aa4e3994563945086ea602887" to-attribute="aeda82a68426646d3a6cfa276db9bd56f255" />
+                  </attribute-pairs>
+                </erd-relation>
+              </item>
             </abstract-items>
             <layer id="b333b4971a734e6baa084175a3160d2b" name="Default" visible="true" enabled="true" locked="false">
               <item id="e50f79968a404d3fbb33f4a02fa3b572" iid="650877ac46234db3b6eaebe1730487f3" creation-date="11/04/2022 06:00:07" order-index="1" type="entity">
@@ -1689,6 +1833,68 @@
                 </layout>
                 <relation from="1995ba399cb24729b4df7bbbc0c77b31" from-iid="e5447239d5c14feda620a1961c696222" from-field="ac6d5df86cafd42679955a33396a23de5550" to="e50f79968a404d3fbb33f4a02fa3b572" to-iid="650877ac46234db3b6eaebe1730487f3" to-field="aeda82a68426646d3a6cfa276db9bd56f255" />
               </item>
+              <item id="84a3ecb6b97b4e9cbcf5d8255039f80c" iid="e5295bc500524045bec12462bb4bf306" creation-date="11/05/2022 09:12:36" order-index="9" type="entity">
+                <layout ax="867" ay="492" awidth="207" aheight="268" x="867" y="492" width="207" height="268" rotation-center="-33.5,15" />
+                <erd-entity show-nullability="true" />
+              </item>
+              <item id="cb80b20360f340559de7775b16dcf14f" iid="0699c36719a449eaa54119a347bbcfad" creation-date="11/05/2022 09:12:59" order-index="10" type="entity">
+                <layout ax="1210" ay="511" awidth="207" aheight="249" x="1210" y="511" width="207" height="249" rotation-center="-33.5,44.5" />
+                <erd-entity show-nullability="true" />
+              </item>
+              <item id="979e2dd2651742e08af31f818c22bf4e" iid="4be9c584480042c18525567fede0988e" creation-date="11/05/2022 09:13:26" order-index="11" type="entity">
+                <layout ax="397" ay="1001" awidth="140" aheight="160" x="397" y="1001" width="140" height="160" />
+                <erd-entity show-nullability="true" />
+              </item>
+              <item id="1596d482602d4447b90d648ed5031bb4" iid="0a741e375b0447b39b7312de458e5700" creation-date="11/05/2022 09:15:25" order-index="12" type="entity">
+                <layout ax="640" ay="1001" awidth="140" aheight="160" x="640" y="1001" width="140" height="160" />
+                <erd-entity show-nullability="true" />
+              </item>
+              <item id="a48a9211b03c407cbb288eded410b64a" iid="b61d22b25ba94c74a4a73e12d756729e" creation-date="11/05/2022 09:24:18" order-index="13" type="relation">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="oblique" lock-start-point="true" lock-end-point="true" lock-to-fields="true" auto-path="" x1="397" y1="1068" x2="46" y2="255" start-border-pos="0.8953125" end-border-pos="0.941265060240964" start-local-pos="67" end-local-pos="59" name-position="0,20">
+                  <points>
+                    <point x="397" y="1068" />
+                    <point x="-4" y="578" />
+                    <point x="46" y="255" />
+                  </points>
+                </layout>
+                <relation from="979e2dd2651742e08af31f818c22bf4e" from-iid="4be9c584480042c18525567fede0988e" from-field="af9002db56cf14129b96aa8a533353459288" to="e50f79968a404d3fbb33f4a02fa3b572" to-iid="650877ac46234db3b6eaebe1730487f3" to-field="aeda82a68426646d3a6cfa276db9bd56f255" />
+              </item>
+              <item id="de25be4a0e78494f885762b863143fd6" iid="0cb2e30a53f948de9705e964b9ddc626" creation-date="11/05/2022 09:25:11" order-index="14" type="relation">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-start-point="true" lock-to-fields="true" auto-path="" x1="640" y1="1068" x2="349" y2="254" start-border-pos="0.8953125" end-border-pos="0.308734939759036" start-local-pos="67" end-local-pos="58" name-position="0,20">
+                  <points>
+                    <point x="640" y="1068" />
+                    <point x="349" y="254" />
+                  </points>
+                </layout>
+                <relation from="1596d482602d4447b90d648ed5031bb4" from-iid="0a741e375b0447b39b7312de458e5700" from-field="a1852ccbbf7aa4e3994563945086ea602887" to="e50f79968a404d3fbb33f4a02fa3b572" to-iid="650877ac46234db3b6eaebe1730487f3" to-field="aeda82a68426646d3a6cfa276db9bd56f255" />
+              </item>
+              <item id="7e382f0a73dd4e12b0db78aea55eb53b" iid="e54512e850ec437e821ff92e642823d7" creation-date="11/05/2022 09:25:51" order-index="15" type="relation">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="oblique" lock-start-point="true" lock-end-point="true" lock-to-fields="true" auto-path="" x1="537" y1="1105" x2="867" y2="550" start-border-pos="0.4125" end-border-pos="0.945429104477612" start-local-pos="104" end-local-pos="58" name-position="0,20">
+                  <points>
+                    <point x="537" y="1105" />
+                    <point x="867" y="550" />
+                  </points>
+                </layout>
+                <relation from="979e2dd2651742e08af31f818c22bf4e" from-iid="4be9c584480042c18525567fede0988e" from-field="ac565ef6d613e4ce395193ba85470dd24288" to="84a3ecb6b97b4e9cbcf5d8255039f80c" to-iid="e5295bc500524045bec12462bb4bf306" to-field="aeedb6cafa13c432289059d4aeee86fbf868" />
+              </item>
+              <item id="4c112af66ef746a3897a3e2a89b04793" iid="9f9cb55162264293932c82ef14cfccfc" creation-date="11/05/2022 09:26:21" order-index="16" type="relation">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="oblique" lock-start-point="true" lock-to-fields="true" auto-path="" x1="780" y1="1105" x2="1210" y2="570" start-border-pos="0.4125" end-border-pos="0.941265060240964" start-local-pos="104" end-local-pos="59" name-position="0,20">
+                  <points>
+                    <point x="780" y="1105" />
+                    <point x="1210" y="570" />
+                  </points>
+                </layout>
+                <relation from="1596d482602d4447b90d648ed5031bb4" from-iid="0a741e375b0447b39b7312de458e5700" from-field="a743bc958b32142279f0be7a53e28a40f887" to="cb80b20360f340559de7775b16dcf14f" to-iid="0699c36719a449eaa54119a347bbcfad" to-field="ab12dbe3ddb0e44da817555c631a0bcdd360" />
+              </item>
+              <item id="ccc94b03e9f14adf85defc647f594921" iid="fd3ea7c46e3148d5aaa1b21aaba2be5d" creation-date="11/05/2022 09:28:10" order-index="17" type="relation">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="oblique" lock-start-point="true" lock-end-point="true" lock-to-fields="true" auto-path="" x1="1074" y1="710" x2="1210" y2="570" start-border-pos="0.453358208955224" end-border-pos="0.941265060240964" start-local-pos="218" end-local-pos="59" name-position="0,20">
+                  <points>
+                    <point x="1074" y="710" />
+                    <point x="1210" y="570" />
+                  </points>
+                </layout>
+                <relation from="84a3ecb6b97b4e9cbcf5d8255039f80c" from-iid="e5295bc500524045bec12462bb4bf306" from-field="ab59af341336049cab67540f6403cce1425" to="cb80b20360f340559de7775b16dcf14f" to-iid="0699c36719a449eaa54119a347bbcfad" to-field="ab12dbe3ddb0e44da817555c631a0bcdd360" />
+              </item>
             </layer>
           </diagram>
         </model>

+ 2 - 1
Common/qdr.app.qlbrc.common/Repositories/QlbrcRepository.cs

@@ -1,7 +1,6 @@
 using Quadarax.Application.QLiberace.Common.Domain;
 using Quadarax.Application.QLiberace.Common.Entities.Base;
 using Quadarax.Foundation.Core.Data.Domain;
-using Quadarax.Foundation.Core.Data.Entity;
 using Quadarax.Foundation.Core.Data.Interface.Domain;
 using Quadarax.Foundation.Core.Data.Repository;
 
@@ -9,6 +8,8 @@ namespace Quadarax.Application.QLiberace.Common.Repositories
 {
     public abstract class QlbrcRepository<TEntity> : EntityRepository<long, TEntity> where TEntity : QlbrcEntity, new()
     {
+        protected long? CurrentTenantId => OperationContext?.GetContext<QlbrcContext>().TenantId;
+
         protected QlbrcRepository(IUnitOfWork<IDataDomain> unitOfWork, QlbrcContext operationContext) : base(unitOfWork, operationContext)
         {
         }

+ 4 - 0
Modules/qdr.app.qlbrc.base/Constants.cs

@@ -18,6 +18,10 @@
                 public const string TblSetting = "Setting";
                 public const string TblTenant = "Tenant";
                 public const string TblTenantUser = "TenantUser";
+                public const string TblTenantCountry = "TenantCountry";
+                public const string TblTenantCurrency = "TenantCurrency";
+                public const string TblCountry = "Country";
+                public const string TblCurrency = "Currency";
 
             }
         }

+ 20 - 0
Modules/qdr.app.qlbrc.base/Entities/Country.cs

@@ -0,0 +1,20 @@
+using Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+
+namespace Quadarax.Application.QLiberace.Base.Entities
+{
+    public class Country: QlbrcEntityTracked, IStructCodeName
+    {
+        public string Code { get; set; } = null!;
+        public string Name { get; set; } = null!;
+        public int Vat { get; set; } = 0;
+        public long DefaultCurrencyId { get; set; }
+        public Currency DefaultCurrency { get; set; } = null!;
+        public virtual ICollection<TenantCountry> Tenants { get; set; }
+
+        public Country()
+        {
+            Tenants = new List<TenantCountry>();
+        }
+    }
+}

+ 21 - 0
Modules/qdr.app.qlbrc.base/Entities/Currency.cs

@@ -0,0 +1,21 @@
+using Quadarax.Application.QLiberace.Base.Entities.Interfaces;
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+
+namespace Quadarax.Application.QLiberace.Base.Entities
+{
+    public class Currency: QlbrcEntityTracked, IStructCodeName
+    {
+        public string Code { get; set; } = null!;
+        public string Name { get; set; } = null!;
+        public string Sign { get; set; } = null!;
+
+        public virtual ICollection<TenantCurrency> Tenants { get; set; }
+        public virtual ICollection<Country> Countries { get; set; }
+
+
+        public Currency()
+        {
+            Tenants = new List<TenantCurrency>();
+        }
+    }
+}

+ 51 - 0
Modules/qdr.app.qlbrc.base/Entities/DaoMapper/CountryDm.cs

@@ -0,0 +1,51 @@
+using Microsoft.EntityFrameworkCore;
+using Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper;
+
+namespace Quadarax.Application.QLiberace.Base.Entities.DaoMapper
+{
+    public class CountryDm: TrackedDm<Country>
+    {
+        public override void Map(ModelBuilder builder)
+        {
+
+            if (builder == null) throw new ArgumentNullException(nameof(builder));
+
+            base.Map(builder);
+            builder.Entity<Country>(entity =>
+                {
+                    entity.ToTable(Constants.Modules.Base.TblCountry, Constants.Modules.Base.Schema);
+
+                    // indexes
+                    entity.HasIndex(e => e.Code, "IDX_COUNTRY_CODE")
+                        .IsUnique();
+
+                    // columns
+                    entity.Property(e => e.Code).IsRequired()
+                        .HasMaxLength(5)
+                        .HasComment("Country code. Main key to search.");
+
+                    entity.Property(e => e.Name).IsRequired()
+                        .HasMaxLength(50)
+                        .HasComment("Country name. Informational value.");
+
+                    entity.Property(e => e.Vat).IsRequired()
+                        .HasDefaultValueSql("0")
+                        .HasComment("Percentage VAT definition");
+
+                    entity.Property(e => e.DefaultCurrencyId).IsRequired()
+                        .HasComment("Default country currency");
+                    
+                    // relationship
+                    entity.HasOne(d => d.DefaultCurrency)
+                        .WithMany(p => p.Countries)
+                        .HasForeignKey(d => d.DefaultCurrencyId)
+                        .OnDelete(DeleteBehavior.ClientSetNull)
+                        .HasConstraintName("REL_COUNTRY_CURRENCY_ID");
+
+                }
+            );
+        }
+    }
+}
+
+

+ 46 - 0
Modules/qdr.app.qlbrc.base/Entities/DaoMapper/CurrencyDm.cs

@@ -0,0 +1,46 @@
+using Microsoft.EntityFrameworkCore;
+using Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Quadarax.Application.QLiberace.Base.Entities.DaoMapper
+{
+    public class CurrencyDm: TrackedDm<Currency>
+    {
+        public override void Map(ModelBuilder builder)
+        {
+
+            if (builder == null) throw new ArgumentNullException(nameof(builder));
+
+            base.Map(builder);
+            builder.Entity<Currency>(entity =>
+                {
+                    entity.ToTable(Constants.Modules.Base.TblCurrency, Constants.Modules.Base.Schema);
+
+                    // indexes
+                    entity.HasIndex(e => e.Code, "IDX_CURRENCY_CODE")
+                        .IsUnique();
+
+                    // columns
+                    entity.Property(e => e.Code).IsRequired()
+                        .HasMaxLength(5)
+                        .HasComment("Currency code. Main key to search.");
+
+                    entity.Property(e => e.Name).IsRequired()
+                        .HasMaxLength(50)
+                        .HasComment("Currency name. Informational value.");
+
+                    entity.Property(e => e.Sign).IsRequired()
+                        .HasMaxLength(3)
+                        .HasComment("Currency sign chars");
+
+
+                }
+            );
+        }
+    }
+}
+

+ 42 - 0
Modules/qdr.app.qlbrc.base/Entities/DaoMapper/TenantCountryDm.cs

@@ -0,0 +1,42 @@
+using Microsoft.EntityFrameworkCore;
+using Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper;
+
+namespace Quadarax.Application.QLiberace.Base.Entities.DaoMapper
+{
+    public class TenantCountryDm : KeylessDm<TenantCountry>
+    {
+        public override void Map(ModelBuilder builder)
+        {
+
+            if (builder == null) throw new ArgumentNullException(nameof(builder));
+
+            base.Map(builder);
+            builder.Entity<TenantCountry>(entity =>
+                {
+                    entity.ToTable(Constants.Modules.Base.TblTenantCountry, Constants.Modules.Base.Schema);
+                    entity.HasKey(tu => new { tu.CountryId, tu.TenantId });
+
+                    // foreign keys
+                    entity.Property(e => e.TenantId).IsRequired()
+                        .HasComment("Reference to tenant that setting belongs");
+                    entity.Property(e => e.CountryId).IsRequired()
+                        .HasComment("Reference to country assigned to tenant");
+
+
+                    // relationships
+                    entity.HasOne(pc => pc.Tenant)
+                        .WithMany(p => p.Countries)
+                        .HasForeignKey(pc => pc.TenantId)
+                        .HasConstraintName("REL_TENANTCOUNTRY_TENANT_ID");
+
+                    entity.HasOne(pc => pc.Country)
+                        .WithMany(c => c.Tenants)
+                        .HasForeignKey(pc => pc.CountryId)
+                        .HasConstraintName("REL_TENANTCOUNTRY_COUNTRY_ID");
+
+                }
+            );
+        }
+    }
+}
+

+ 42 - 0
Modules/qdr.app.qlbrc.base/Entities/DaoMapper/TenantCurrencyDm.cs

@@ -0,0 +1,42 @@
+using Microsoft.EntityFrameworkCore;
+using Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper;
+
+namespace Quadarax.Application.QLiberace.Base.Entities.DaoMapper
+{
+    public class TenantCurrencyDm : KeylessDm<TenantCurrency>
+    {
+        public override void Map(ModelBuilder builder)
+        {
+
+            if (builder == null) throw new ArgumentNullException(nameof(builder));
+
+            base.Map(builder);
+            builder.Entity<TenantCurrency>(entity =>
+                {
+                    entity.ToTable(Constants.Modules.Base.TblTenantCurrency, Constants.Modules.Base.Schema);
+                    entity.HasKey(tu => new { tu.CurerrencyId, tu.TenantId });
+
+                    // foreign keys
+                    entity.Property(e => e.TenantId).IsRequired()
+                        .HasComment("Reference to tenant that setting belongs");
+                    entity.Property(e => e.CurerrencyId).IsRequired()
+                        .HasComment("Reference to currency assigned to tenant");
+
+
+                    // relationships
+                    entity.HasOne(pc => pc.Tenant)
+                        .WithMany(p => p.Currencies)
+                        .HasForeignKey(pc => pc.TenantId)
+                        .HasConstraintName("REL_TENANTCURRENCY_TENANT_ID");
+
+                    entity.HasOne(pc => pc.Currency)
+                        .WithMany(c => c.Tenants)
+                        .HasForeignKey(pc => pc.CurerrencyId)
+                        .HasConstraintName("REL_TENANTCURRENCY_CURRENCY_ID");
+
+                }
+            );
+        }
+    }
+}
+

+ 8 - 0
Modules/qdr.app.qlbrc.base/Entities/Interfaces/IStructCodeName.cs

@@ -0,0 +1,8 @@
+namespace Quadarax.Application.QLiberace.Base.Entities.Interfaces
+{
+    public interface IStructCodeName
+    {
+        string Code { get; set; }
+        string Name { get; set; }
+    }
+}

+ 1 - 3
Modules/qdr.app.qlbrc.base/Entities/Interfaces/IStructTenant.cs

@@ -1,9 +1,7 @@
 namespace Quadarax.Application.QLiberace.Base.Entities.Interfaces;
 
-public interface IStructTenant
+public interface IStructTenant : IStructCodeName
 {
-    string Code { get; set; }
-    string Name { get; set; }
     DateTime? LastAccess { get; set; }
     bool IsLocked { get; set; }
 }

+ 2 - 0
Modules/qdr.app.qlbrc.base/Entities/Tenant.cs

@@ -16,6 +16,8 @@ namespace Quadarax.Application.QLiberace.Base.Entities
         public bool IsLocked { get; set; }
 
         public virtual ICollection<TenantUser> Users { get; set; }
+        public virtual ICollection<TenantCountry> Countries { get; set; }
+        public virtual ICollection<TenantCurrency> Currencies { get; set; }
 
         public Tenant()
         {

+ 19 - 0
Modules/qdr.app.qlbrc.base/Entities/TenantCountry.cs

@@ -0,0 +1,19 @@
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Quadarax.Application.QLiberace.Base.Entities
+{
+    public class TenantCountry: QlbrcEntityKeyless
+    {
+        public long CountryId { get; set; }
+
+        public long TenantId { get; set; }
+
+        public Country Country { get; set; } = null!;
+        public Tenant Tenant { get; set; } = null!;
+    }
+}

+ 14 - 0
Modules/qdr.app.qlbrc.base/Entities/TenantCurrency.cs

@@ -0,0 +1,14 @@
+using Quadarax.Application.QLiberace.Common.Entities.Base;
+
+namespace Quadarax.Application.QLiberace.Base.Entities
+{
+    public class TenantCurrency: QlbrcEntityKeyless
+    {
+        public long CurerrencyId { get; set; }
+
+        public long TenantId { get; set; }
+
+        public Currency Currency { get; set; } = null!;
+        public Tenant Tenant { get; set; } = null!;
+    }
+}

+ 6 - 0
Modules/qdr.app.qlbrc.base/QlbrcDbContext.cs

@@ -18,6 +18,8 @@ namespace Quadarax.Application.QLiberace.Base
         public DbSet<Tenant> Tenants { get; set; } = null!;
         public DbSet<Setting> Settings { get; set; } = null!;
         public DbSet<TenantUser> TenantUsers { get; set; } = null!;
+        public DbSet<TenantCurrency> TenantCurrencies { get; set; } = null!;
+        public DbSet<TenantCountry> TenantCountries { get; set; } = null!;
 
         #endregion
         
@@ -53,7 +55,11 @@ namespace Quadarax.Application.QLiberace.Base
             new TenantDm().Map(modelBuilder);
             new UserDm().Map(modelBuilder);
             new SettingDm().Map(modelBuilder);
+            new CurrencyDm().Map(modelBuilder);
+            new CountryDm().Map(modelBuilder);
             new TenantUserDm().Map(modelBuilder);
+            new TenantCurrencyDm().Map(modelBuilder);
+            new TenantCountryDm().Map(modelBuilder);
 
             base.OnModelCreating(modelBuilder);
         }

+ 40 - 0
Modules/qdr.app.qlbrc.base/Repositories/RepoCountry.cs

@@ -0,0 +1,40 @@
+using Microsoft.EntityFrameworkCore;
+using Quadarax.Application.QLiberace.Base.Entities;
+using Quadarax.Application.QLiberace.Common.Domain;
+using Quadarax.Application.QLiberace.Common.Repositories;
+using Quadarax.Foundation.Core.Data;
+using Quadarax.Foundation.Core.Data.Domain;
+using Quadarax.Foundation.Core.Data.Interface;
+using Quadarax.Foundation.Core.Data.Interface.Domain;
+
+
+namespace Quadarax.Application.QLiberace.Base.Repositories
+{
+    public class RepoCountry : QlbrcTrackedRepository<Country>
+    {
+
+
+        public RepoCountry(IUnitOfWork<IDataDomain> unitOfWork, QlbrcContext operationContext) : base(unitOfWork, operationContext)
+        {
+        }
+
+        public Country? GetByCode(string countryCode, bool usingUncommited = false)
+        {
+            if (string.IsNullOrEmpty(countryCode)) throw new ArgumentNullException(nameof(countryCode));
+
+            var prequery = Query(Paging.NoPaging(), usingUncommited).Include(x=>x.Tenants);
+            Country? query;
+            if (CurrentTenantId!=null)
+                query = prequery
+                .FirstOrDefault(x => string.Equals(x.Code, countryCode) && x.Tenants.Any(x=>x.TenantId == CurrentTenantId));
+            else
+                query = prequery.FirstOrDefault(x => string.Equals(x.Code, countryCode));
+            return query;
+        }
+
+        public IQueryable<Country> GetAllGlobal(IPaging paging)
+        {
+            return Query(paging, false).OrderBy(x => x.Name);
+        }
+    }
+}

+ 40 - 0
Modules/qdr.app.qlbrc.base/Repositories/RepoCurrency.cs

@@ -0,0 +1,40 @@
+using Microsoft.EntityFrameworkCore;
+using Quadarax.Application.QLiberace.Base.Entities;
+using Quadarax.Application.QLiberace.Common.Domain;
+using Quadarax.Application.QLiberace.Common.Repositories;
+using Quadarax.Foundation.Core.Data;
+using Quadarax.Foundation.Core.Data.Domain;
+using Quadarax.Foundation.Core.Data.Interface;
+using Quadarax.Foundation.Core.Data.Interface.Domain;
+
+namespace Quadarax.Application.QLiberace.Base.Repositories
+{
+    public class RepoCurrency : QlbrcTrackedRepository<Currency>
+    {
+
+
+        public RepoCurrency(IUnitOfWork<IDataDomain> unitOfWork, QlbrcContext operationContext) : base(unitOfWork, operationContext)
+        {
+        }
+
+        public Currency? GetByCode(string currencyCode, bool usingUncommited = false)
+        {
+            if (string.IsNullOrEmpty(currencyCode)) throw new ArgumentNullException(nameof(currencyCode));
+
+            var prequery = Query(Paging.NoPaging(), usingUncommited).Include(x=>x.Tenants);
+            Currency? query;
+            if (CurrentTenantId!=null)
+                query = prequery
+                    .FirstOrDefault(x => string.Equals(x.Code, currencyCode) && x.Tenants.Any(x=>x.TenantId == CurrentTenantId));
+            else
+                query = prequery.FirstOrDefault(x => string.Equals(x.Code, currencyCode));
+            return query;
+        }
+
+        public IQueryable<Currency> GetAllGlobal(IPaging paging)
+        {
+            return Query(paging, false).OrderBy(x => x.Code);
+        }
+    }
+}
+

+ 43 - 0
Workbench/Entity/Country.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+
+namespace Workbench.Entity
+{
+    public partial class Country
+    {
+        /// <summary>
+        /// Country primary key
+        /// </summary>
+        public long Id { get; set; }
+        /// <summary>
+        /// Country code. Main key to search.
+        /// </summary>
+        public string Code { get; set; } = null!;
+        /// <summary>
+        /// Country name. Informational value.
+        /// </summary>
+        public string Name { get; set; } = null!;
+        /// <summary>
+        /// Percentage VAT definition
+        /// </summary>
+        public int Vat { get; set; }
+        /// <summary>
+        /// Record created timestamp
+        /// </summary>
+        public DateTime Created { get; set; }
+        /// <summary>
+        /// Record modified timestamp
+        /// </summary>
+        public DateTime? Modified { get; set; }
+        /// <summary>
+        /// Record modifier signature
+        /// </summary>
+        public string? Modifier { get; set; }
+        /// <summary>
+        /// Default country currency
+        /// </summary>
+        public long DefaultCurrencyId { get; set; }
+
+        public virtual Currency DefaultCurrency { get; set; } = null!;
+    }
+}

+ 44 - 0
Workbench/Entity/Currency.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+
+namespace Workbench.Entity
+{
+    public partial class Currency
+    {
+        public Currency()
+        {
+            Countries = new HashSet<Country>();
+        }
+
+        /// <summary>
+        /// Currency primary key
+        /// </summary>
+        public long Id { get; set; }
+        /// <summary>
+        /// Currency code. Main key to search.
+        /// </summary>
+        public string Code { get; set; } = null!;
+        /// <summary>
+        /// Currency name. Informational value.
+        /// </summary>
+        public string Name { get; set; } = null!;
+        /// <summary>
+        /// Currency sign chars
+        /// </summary>
+        public string Sign { get; set; } = null!;
+        /// <summary>
+        /// Record created timestamp
+        /// </summary>
+        public DateTime Created { get; set; }
+        /// <summary>
+        /// Record modified timestamp
+        /// </summary>
+        public DateTime? Modified { get; set; }
+        /// <summary>
+        /// Record modifier signature
+        /// </summary>
+        public string? Modifier { get; set; }
+
+        public virtual ICollection<Country> Countries { get; set; }
+    }
+}

+ 130 - 5
Workbench/Entity/QLiberaceContext.cs

@@ -16,8 +16,12 @@ namespace Workbench.Entity
         {
         }
 
+        public virtual DbSet<Country> Countries { get; set; } = null!;
+        public virtual DbSet<Currency> Currencies { get; set; } = null!;
         public virtual DbSet<Setting> Settings { get; set; } = null!;
         public virtual DbSet<Tenant> Tenants { get; set; } = null!;
+        public virtual DbSet<TenantCountry> TenantCountries { get; set; } = null!;
+        public virtual DbSet<TenantCurrency> TenantCurrencies { get; set; } = null!;
         public virtual DbSet<TenantUser> TenantUsers { get; set; } = null!;
         public virtual DbSet<User> Users { get; set; } = null!;
 
@@ -32,6 +36,84 @@ namespace Workbench.Entity
 
         protected override void OnModelCreating(ModelBuilder modelBuilder)
         {
+            modelBuilder.Entity<Country>(entity =>
+            {
+                entity.ToTable("Country", "base");
+
+                entity.HasIndex(e => e.Code, "IDX_COUNTRY_CODE")
+                    .IsUnique();
+
+                entity.Property(e => e.Id).HasComment("Country primary key");
+
+                entity.Property(e => e.Code)
+                    .HasMaxLength(5)
+                    .HasComment("Country code. Main key to search.");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Record created timestamp");
+
+                entity.Property(e => e.DefaultCurrencyId).HasComment("Default country currency");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Record modified timestamp");
+
+                entity.Property(e => e.Modifier)
+                    .HasMaxLength(100)
+                    .HasComment("Record modifier signature");
+
+                entity.Property(e => e.Name)
+                    .HasMaxLength(50)
+                    .HasComment("Country name. Informational value.");
+
+                entity.Property(e => e.Vat)
+                    .HasColumnName("VAT")
+                    .HasComment("Percentage VAT definition");
+
+                entity.HasOne(d => d.DefaultCurrency)
+                    .WithMany(p => p.Countries)
+                    .HasForeignKey(d => d.DefaultCurrencyId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_COUNTRY_CURRENCY_ID");
+            });
+
+            modelBuilder.Entity<Currency>(entity =>
+            {
+                entity.ToTable("Currency", "base");
+
+                entity.HasIndex(e => e.Code, "IDX_CURRENCY_ID")
+                    .IsUnique();
+
+                entity.Property(e => e.Id).HasComment("Currency primary key");
+
+                entity.Property(e => e.Code)
+                    .HasMaxLength(5)
+                    .HasComment("Currency code. Main key to search.");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Record created timestamp");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Record modified timestamp");
+
+                entity.Property(e => e.Modifier)
+                    .HasMaxLength(100)
+                    .HasComment("Record modifier signature");
+
+                entity.Property(e => e.Name)
+                    .HasMaxLength(50)
+                    .HasComment("Currency name. Informational value.");
+
+                entity.Property(e => e.Sign)
+                    .HasMaxLength(3)
+                    .HasComment("Currency sign chars");
+            });
+
             modelBuilder.Entity<Setting>(entity =>
             {
                 entity.ToTable("Setting", "base");
@@ -68,10 +150,6 @@ namespace Workbench.Entity
                     .HasMaxLength(10)
                     .HasComment("Module code that setting belongs. Secondary key");
 
-                entity.Property(e => e.Name)
-                    .HasMaxLength(200)
-                    .HasComment("Setting name. Informational value.");
-
                 entity.Property(e => e.ParentId).HasComment("Reference to parent setting");
 
                 entity.Property(e => e.SequenceNo).HasComment("Order number");
@@ -103,7 +181,6 @@ namespace Workbench.Entity
                 entity.HasIndex(e => e.Code, "IDX_TENANT_CODE")
                     .IsUnique();
 
-                entity.HasKey(e => e.Id);
                 entity.Property(e => e.Id).HasComment("Tenant primary key");
 
                 entity.Property(e => e.Code)
@@ -134,6 +211,52 @@ namespace Workbench.Entity
                     .HasComment("Tenant name. Informational value.");
             });
 
+            modelBuilder.Entity<TenantCountry>(entity =>
+            {
+                entity.HasNoKey();
+
+                entity.ToTable("TenantCountry", "base");
+
+                entity.Property(e => e.CountryId).HasComment("Reference to country");
+
+                entity.Property(e => e.TenantId).HasComment("Reference to tenant");
+
+                entity.HasOne(d => d.Country)
+                    .WithMany()
+                    .HasForeignKey(d => d.CountryId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_TENANTCOUNTRY_COUNTRY_ID");
+
+                entity.HasOne(d => d.Tenant)
+                    .WithMany()
+                    .HasForeignKey(d => d.TenantId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_TENANTCOUNTRY_TENANT_ID");
+            });
+
+            modelBuilder.Entity<TenantCurrency>(entity =>
+            {
+                entity.HasNoKey();
+
+                entity.ToTable("TenantCurrency", "base");
+
+                entity.Property(e => e.CurrencyId).HasComment("Reference to currency");
+
+                entity.Property(e => e.TenantId).HasComment("Reference to tenant");
+
+                entity.HasOne(d => d.Currency)
+                    .WithMany()
+                    .HasForeignKey(d => d.CurrencyId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_TENANTCURRENCY_CURRENCY__ID");
+
+                entity.HasOne(d => d.Tenant)
+                    .WithMany()
+                    .HasForeignKey(d => d.TenantId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_TENANTCURRENCT_TENANT_ID");
+            });
+
             modelBuilder.Entity<TenantUser>(entity =>
             {
                 entity.HasNoKey();
@@ -147,11 +270,13 @@ namespace Workbench.Entity
                 entity.HasOne(d => d.Tenant)
                     .WithMany()
                     .HasForeignKey(d => d.TenantId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
                     .HasConstraintName("REL_TENANTUSER_TENANT_ID");
 
                 entity.HasOne(d => d.User)
                     .WithMany()
                     .HasForeignKey(d => d.UserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
                     .HasConstraintName("REL_TENANTUSER_USER_ID");
             });
 

+ 0 - 4
Workbench/Entity/Setting.cs

@@ -35,10 +35,6 @@ namespace Workbench.Entity
         /// </summary>
         public string Code { get; set; } = null!;
         /// <summary>
-        /// Setting name. Informational value.
-        /// </summary>
-        public string Name { get; set; } = null!;
-        /// <summary>
         /// Setting value description
         /// </summary>
         public string? Description { get; set; }

+ 5 - 9
Workbench/Entity/Tenant.cs

@@ -5,7 +5,11 @@ namespace Workbench.Entity
 {
     public partial class Tenant
     {
-        
+        public Tenant()
+        {
+            Settings = new HashSet<Setting>();
+        }
+
         /// <summary>
         /// Tenant primary key
         /// </summary>
@@ -40,13 +44,5 @@ namespace Workbench.Entity
         public string? Modifier { get; set; }
 
         public virtual ICollection<Setting> Settings { get; set; }
-
-        public ICollection<User> Users { get; set; }
-
-        public Tenant()
-        {
-            Users = new List<User>();
-            Settings = new HashSet<Setting>();
-        }
     }
 }

+ 20 - 0
Workbench/Entity/TenantCountry.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace Workbench.Entity
+{
+    public partial class TenantCountry
+    {
+        /// <summary>
+        /// Reference to tenant
+        /// </summary>
+        public long TenantId { get; set; }
+        /// <summary>
+        /// Reference to country
+        /// </summary>
+        public long CountryId { get; set; }
+
+        public virtual Country Country { get; set; } = null!;
+        public virtual Tenant Tenant { get; set; } = null!;
+    }
+}

+ 20 - 0
Workbench/Entity/TenantCurrency.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace Workbench.Entity
+{
+    public partial class TenantCurrency
+    {
+        /// <summary>
+        /// Reference to tenant
+        /// </summary>
+        public long TenantId { get; set; }
+        /// <summary>
+        /// Reference to currency
+        /// </summary>
+        public long CurrencyId { get; set; }
+
+        public virtual Currency Currency { get; set; } = null!;
+        public virtual Tenant Tenant { get; set; } = null!;
+    }
+}

+ 4 - 4
Workbench/Entity/TenantUser.cs

@@ -8,13 +8,13 @@ namespace Workbench.Entity
         /// <summary>
         /// Reference to tenant
         /// </summary>
-        public long? TenantId { get; set; }
+        public long TenantId { get; set; }
         /// <summary>
         /// Reference to user
         /// </summary>
-        public long? UserId { get; set; }
+        public long UserId { get; set; }
 
-        public virtual Tenant? Tenant { get; set; }
-        public virtual User? User { get; set; }
+        public virtual Tenant Tenant { get; set; } = null!;
+        public virtual User User { get; set; } = null!;
     }
 }

+ 109 - 6
qdr.app.qlbrc.console/Commands/DbInitCmd.cs

@@ -9,6 +9,7 @@ using Quadarax.Application.QLiberace.Base.Entities;
 using Quadarax.Application.QLiberace.Base.Repositories;
 using Quadarax.Application.QLiberace.Common.Domain;
 using Quadarax.Application.QLiberace.Console.Commands.Base;
+using Quadarax.Foundation.Core.Data;
 using Quadarax.Foundation.Core.Data.Domain;
 using Quadarax.Foundation.Core.QConsole;
 using Quadarax.Foundation.Core.QConsole.Attributes;
@@ -68,13 +69,13 @@ namespace Quadarax.Application.QLiberace.Console.Commands
                     WriteCaption($"Tenant: '{tenant.Code}' already exists");
                 }
 
-                tenant = rtenant.GetByCode("test");
-                if (tenant == null)
+                var tenantTst = rtenant.GetByCode("test");
+                if (tenantTst == null)
                 {
-                    tenant = rtenant.New();
-                    tenant.Code = "test";
-                    tenant.Name = "Test tenant";
-                    tenant.IsLocked = false;
+                    tenantTst = rtenant.New();
+                    tenantTst.Code = "test";
+                    tenantTst.Name = "Test tenant";
+                    tenantTst.IsLocked = false;
                     uow.Commit();
                     WriteInfo($"Tenant: '{tenant.Code}' created");
                 }
@@ -113,6 +114,69 @@ namespace Quadarax.Application.QLiberace.Console.Commands
                 uow.Commit();
                 WriteInfo("Assigned.");
 
+
+
+                var rcountry = new RepoCountry(uow.As<IDataDomain>(), new QlbrcContext(null,null,null));
+                var rcurr = new RepoCurrency(uow.As<IDataDomain>(), new QlbrcContext(null,null,null));
+
+                var curUsd = EnsureCurrency(rcurr, "USD", "United States dollar", @"$");
+                var curEur = EnsureCurrency(rcurr, "EUR", "Euro", @"€");
+                var curCzk = EnsureCurrency(rcurr, "CZK", "Czech koruna", @"Kč");
+
+                EnsureCountry(rcountry, "CZE", "Czechia", 21, curCzk);
+                EnsureCountry(rcountry, "USA", "United States of America", 0, curUsd);
+                EnsureCountry(rcountry, "SVK", "Slovakia", 21, curEur);
+
+                uow.Commit();
+
+                var currencies = rcurr.GetAllGlobal(Paging.NoPaging());
+                foreach (var curr in currencies)
+                {
+                    if (curr.Tenants.All(x => x.TenantId != tenant.Id))
+                    {
+                        curr.Tenants.Add(new TenantCurrency()
+                        {
+                            Currency = curr,
+                            Tenant = tenant,
+                        });
+                        WriteInfo($"Assigned currency '{curr.Code}' to tenant '{tenant.Code}'");
+                    }
+
+                    if (curr.Tenants.All(x => x.TenantId != tenantTst.Id))
+                    {
+                        curr.Tenants.Add(new TenantCurrency()
+                        {
+                            Currency = curr,
+                            Tenant = tenantTst,
+                        });
+                        WriteInfo($"Assigned currency '{curr.Code}' to tenant '{tenantTst.Code}'");
+                    }
+                }
+
+                var countries = rcountry.GetAllGlobal(Paging.NoPaging());
+                foreach (var country in countries)
+                {
+                    if (country.Tenants.All(x => x.TenantId != tenant.Id))
+                    {
+                        country.Tenants.Add(new TenantCountry()
+                        {
+                            Country = country,
+                            Tenant = tenant,
+                        });
+                        WriteInfo($"Assigned country '{country.Code}' to tenant '{tenant.Code}'");
+                    }
+
+                    if (country.Tenants.All(x => x.TenantId != tenantTst.Id))
+                    {
+                        country.Tenants.Add(new TenantCountry()
+                        {
+                            Country = country,
+                            Tenant = tenantTst,
+                        });
+                        WriteInfo($"Assigned country '{country.Code}' to tenant '{tenantTst.Code}'");
+                    }
+                }
+                uow.Commit();
             }
             catch (SqlException e)
             {
@@ -127,6 +191,45 @@ namespace Quadarax.Application.QLiberace.Console.Commands
 
         #region *** Private operations ***
 
+        private Currency EnsureCurrency(RepoCurrency repo, string code, string name, string sign)
+        {
+            var cur = repo.GetByCode(code);
+            if (cur == null)
+            {
+                cur = repo.New();
+                cur.Code = code;
+                cur.Name = name;
+                cur.Sign = sign;
+                WriteInfo($"Currency: '{cur?.Code}' created");
+            }
+            else
+            {
+                WriteCaption($"Currency: '{cur?.Code}' already exists");
+            }
+
+            return cur!;
+        }
+
+        private Country EnsureCountry(RepoCountry repo, string code, string name, int vat, Currency defaultCurrency)
+        {
+            var country = repo.GetByCode(code);
+            if (country == null)
+            {
+                country = repo.New();
+                country.Code = code;
+                country.Name = name;
+                country.Vat = vat;
+                country.DefaultCurrency = defaultCurrency;
+                WriteInfo($"Country: '{country?.Code}' created");
+            }
+            else
+            {
+                WriteCaption($"Country: '{country?.Code}' already exists");
+            }
+
+            return country!;
+        }
+
         #endregion
     }
 }