From 887e981612180450945c23de0bd653fd28083e38 Mon Sep 17 00:00:00 2001 From: Andy Howard Date: Tue, 9 Jul 2019 13:52:20 +0100 Subject: [PATCH] STN Asset Movements --- .../LogisticsMgrMobile.Android.csproj | 14 +- .../Properties/AndroidManifest.xml | 6 +- .../Resources/Resource.designer.cs | 101 +++--- .../drawable-hdpi/icon_solent_stevedores.png | Bin 0 -> 4093 bytes .../drawable-xhdpi/icon_solent_stevedores.png | Bin 0 -> 1835 bytes .../drawable/icon_solent_stevedores.png | Bin 0 -> 2083 bytes .../LogisticsMgrMobile/Mobile/App/App.xaml.cs | 46 +-- .../SlmCommand_Assets_CreateRepair.cs | 55 +++ .../Commands/SlmCommand_Assets_Movements.cs | 42 +++ .../App/Commands/SlmCommand_Bulk_ShipFIle.cs | 38 ++ .../Mobile/App/Commands/SlmCommand_Logout.cs | 36 ++ .../Mobile/App/SlmMainPage.cs | 136 ++++--- .../LogisticsMgrMobile/Mobile/App/SlmMenu.cs | 49 ++- .../App/SlmSessionProfile_Mobile_App.cs | 4 +- .../Components/SlmComponents_AssetRepair.cs | 2 +- .../Forms/Components/SlmComponents_Config.cs | 27 +- .../Forms/Components/SlmComponents_Login.cs | 109 ++++++ .../Pages/Assets/SlmPage_Assets_Repair.cs | 17 +- .../Pages/Config/SlmPage_Config_Options.cs | 42 +-- .../Pages/Config/SlmPage_Config_System.cs | 8 +- .../Pages/Templates/Page_Template_Main.cs | 103 ++++-- .../SlmPanel_AssetMovement_SearchResults.cs | 9 +- .../Assets/SlmPanel_AssetRepair_Images.cs | 12 +- .../Assets/SlmPanel_AssetRepair_Jobs.cs | 22 +- .../Main/SlmMainPanel_AssetMovements.cs | 338 ++++++++++++++++++ .../Forms/Panels/Main/SlmMainPanel_Home.cs | 153 ++++++++ .../Panels/Main/SlmMainPanel_ItemList.cs | 149 ++++++++ .../Forms/Panels/Main/SlmMainPanel_Login.cs | 268 ++++++++++++++ .../Panels/Main/SlmMainPanel_ShipFile.cs | 113 ++++++ .../Mobile/Forms/Views/SlmMenuView.cs | 90 +++-- .../Mobile/Core/App/SlmApplication.cs | 25 +- .../Mobile/Core/App/SlmCommand_Mobile.cs | 35 ++ SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs | 77 ++-- .../Core/App/SlmSecurityProfile_Mobile.cs | 97 +++++ .../Core/App/SlmSessionContext_Mobile.cs | 6 +- .../Core/App/SlmSessionProfile_Mobile.cs | 72 ++-- .../Mobile/Core/App/SlmSiteDefinition.cs | 4 + .../Mobile/Core/App/SlmUserContext_Mobile.cs | 56 +++ .../CodeTypes/SlmCodeTypeConsole_Mobile.cs | 140 ++++---- .../Mobile/Core/Forms/Base/SlmContentView.cs | 2 +- .../Mobile/Core/Forms/Base/SlmEntryView.cs | 7 +- .../Mobile/Core/Forms/Base/SlmFormPage.cs | 2 +- .../Mobile/Core/Forms/Base/SlmMainPanel.cs | 91 +++++ .../Mobile/Core/Forms/Base/SlmPanel.cs | 19 +- .../Mobile/Core/Forms/Base/SlmStackLayout.cs | 5 +- .../Mobile/Core/Forms/Base/SlmWebView.cs | 2 +- ...Picker_Codes.cs => SlmPickerView_Codes.cs} | 5 +- ...ompanies.cs => SlmPickerView_Companies.cs} | 7 +- .../Controls/SlmPickerView_SiteDefinitions.cs | 87 +++++ .../Forms/Panels/SlmPanel_AssociatedItems.cs | 30 +- .../Mobile/Core/Mgr/SlmAccountMgr_Mobile.cs | 4 +- .../Mgr/SlmAccountMgr_Mobile_Addresses.cs | 5 +- .../Mgr/SlmAccountMgr_Mobile_Companies.cs | 5 +- .../Mgr/SlmAssetMgr_Mobile-AssetMovements.cs | 5 +- .../SlmAssetMgr_Mobile-AssetRepairImages.cs | 1 + .../Mgr/SlmAssetMgr_Mobile-AssetRepairJobs.cs | 1 + .../Mgr/SlmAssetMgr_Mobile-AssetRepairs.cs | 5 +- .../Core/Mgr/SlmAssetMgr_Mobile-Containers.cs | 1 + .../Mgr/SlmAssetMgr_Mobile-GeneratorSets.cs | 1 + ...lmAssetMgr_Mobile-MovementNotifications.cs | 1 + .../Core/Mgr/SlmAssetMgr_Mobile-Trains.cs | 1 + ...lmAssetMgr_Mobile-VehicleMovementAssets.cs | 1 + .../SlmAssetMgr_Mobile-VehicleMovements.cs | 1 + .../Mobile/Core/Mgr/SlmAssetMgr_Mobile.cs | 4 +- .../SlmBerthingMgr_Mobile-BerthingCosts.cs | 5 +- .../SlmBerthingMgr_Mobile-BerthingResource.cs | 5 +- .../SlmBerthingMgr_Mobile-BerthingTasks.cs | 5 +- .../Mgr/SlmBerthingMgr_Mobile-Berthings.cs | 5 +- .../SlmBerthingMgr_Mobile-CruiseBerthings.cs | 5 +- .../SlmBerthingMgr_Mobile-DischargeHolds.cs | 5 +- .../Mgr/SlmBerthingMgr_Mobile-Discharges.cs | 5 +- .../Core/Mgr/SlmBerthingMgr_Mobile-Vessels.cs | 5 +- .../Mobile/Core/Mgr/SlmBerthingMgr_Mobile.cs | 4 +- .../SlmChecklistMgr_Mobile-ChecklistItems.cs | 5 +- .../Mgr/SlmChecklistMgr_Mobile-Checklists.cs | 5 +- ...mChecklistMgr_Mobile-ItemChecklistItems.cs | 5 +- .../SlmChecklistMgr_Mobile-ItemChecklists.cs | 5 +- .../Mobile/Core/Mgr/SlmChecklistMgr_Mobile.cs | 4 +- .../Mgr/SlmCommodityMgr_Mobile-Commodities.cs | 5 +- ...mCommodityMgr_Mobile-CommodityLocations.cs | 5 +- .../Mgr/SlmCommodityMgr_Mobile-StockLevels.cs | 5 +- .../SlmCommodityMgr_Mobile-StockLoadings.cs | 5 +- .../SlmCommodityMgr_Mobile-StockLocations.cs | 5 +- .../SlmCommodityMgr_Mobile-StockMovements.cs | 5 +- .../Mobile/Core/Mgr/SlmCommodityMgr_Mobile.cs | 4 +- .../SlmItemDataMgr_Mobile-DataItemValues.cs | 5 +- .../Mobile/Core/Mgr/SlmItemDataMgr_Mobile.cs | 4 +- .../SlmStaffMgr_Mobile-StaffAllocations.cs | 5 +- .../Core/Mgr/SlmStaffMgr_Mobile-StaffJobs.cs | 5 +- ...affMgr_Mobile-StaffMemberAvailabilities.cs | 5 +- .../SlmStaffMgr_Mobile-StaffMemberSkills.cs | 5 +- .../Mgr/SlmStaffMgr_Mobile-StaffMembers.cs | 5 +- .../Mgr/SlmStaffMgr_Mobile-StaffTaskSkills.cs | 5 +- .../Core/Mgr/SlmStaffMgr_Mobile-StaffTasks.cs | 5 +- .../Mobile/Core/Mgr/SlmStaffMgr_Mobile.cs | 4 +- .../SlmTransactionMgr_Mobile-Requirements.cs | 5 +- .../SlmTransactionMgr_Mobile-Transactions.cs | 5 +- .../Core/Mgr/SlmTransactionMgr_Mobile.cs | 4 +- .../Mobile/Core/Utils/ImageUtils.cs | 25 -- 99 files changed, 2417 insertions(+), 566 deletions(-) create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable-hdpi/icon_solent_stevedores.png create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable-xhdpi/icon_solent_stevedores.png create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable/icon_solent_stevedores.png create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_CreateRepair.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_Movements.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Bulk_ShipFIle.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Logout.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_AssetMovements.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs create mode 100644 LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ShipFile.cs create mode 100644 SaLogMgrMobCore/Mobile/Core/App/SlmCommand_Mobile.cs create mode 100644 SaLogMgrMobCore/Mobile/Core/App/SlmSecurityProfile_Mobile.cs create mode 100644 SaLogMgrMobCore/Mobile/Core/App/SlmUserContext_Mobile.cs create mode 100644 SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmMainPanel.cs rename SaLogMgrMobCore/Mobile/Core/Forms/Controls/{SlmPicker_Codes.cs => SlmPickerView_Codes.cs} (96%) rename SaLogMgrMobCore/Mobile/Core/Forms/Controls/{SlmPicker_Companies.cs => SlmPickerView_Companies.cs} (96%) create mode 100644 SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SiteDefinitions.cs delete mode 100644 SaLogMgrMobCore/Mobile/Core/Utils/ImageUtils.cs diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj b/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj index 85420f3..a158e91 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj +++ b/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj @@ -35,7 +35,7 @@ false false true - armeabi-v7a;x86 + armeabi-v7a;x86;x86_64 true @@ -93,11 +93,8 @@ - - - @@ -121,5 +118,14 @@ LogisticsMgrMobile + + + + + + + + + \ No newline at end of file diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml index 4003c23..188e4ff 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml +++ b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml @@ -1,9 +1,9 @@  - - + + - + \ No newline at end of file diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/Resource.designer.cs b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/Resource.designer.cs index b188623..ba82a59 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/Resource.designer.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/Resource.designer.cs @@ -4447,26 +4447,26 @@ namespace Sarand.LogisticsMgr // aapt resource value: 0x7f020053 public const int avd_hide_password = 2130837587; - // aapt resource value: 0x7f02012f - public const int avd_hide_password_1 = 2130837807; - // aapt resource value: 0x7f020130 - public const int avd_hide_password_2 = 2130837808; + public const int avd_hide_password_1 = 2130837808; // aapt resource value: 0x7f020131 - public const int avd_hide_password_3 = 2130837809; + public const int avd_hide_password_2 = 2130837809; + + // aapt resource value: 0x7f020132 + public const int avd_hide_password_3 = 2130837810; // aapt resource value: 0x7f020054 public const int avd_show_password = 2130837588; - // aapt resource value: 0x7f020132 - public const int avd_show_password_1 = 2130837810; - // aapt resource value: 0x7f020133 - public const int avd_show_password_2 = 2130837811; + public const int avd_show_password_1 = 2130837811; // aapt resource value: 0x7f020134 - public const int avd_show_password_3 = 2130837812; + public const int avd_show_password_2 = 2130837812; + + // aapt resource value: 0x7f020135 + public const int avd_show_password_3 = 2130837813; // aapt resource value: 0x7f020055 public const int design_bottom_navigation_item_background = 2130837589; @@ -5018,109 +5018,112 @@ namespace Sarand.LogisticsMgr public const int ic_vol_type_tv_light = 2130837771; // aapt resource value: 0x7f02010c - public const int mr_button_connected_dark = 2130837772; + public const int icon_solent_stevedores = 2130837772; // aapt resource value: 0x7f02010d - public const int mr_button_connected_light = 2130837773; + public const int mr_button_connected_dark = 2130837773; // aapt resource value: 0x7f02010e - public const int mr_button_connecting_dark = 2130837774; + public const int mr_button_connected_light = 2130837774; // aapt resource value: 0x7f02010f - public const int mr_button_connecting_light = 2130837775; + public const int mr_button_connecting_dark = 2130837775; // aapt resource value: 0x7f020110 - public const int mr_button_dark = 2130837776; + public const int mr_button_connecting_light = 2130837776; // aapt resource value: 0x7f020111 - public const int mr_button_light = 2130837777; + public const int mr_button_dark = 2130837777; // aapt resource value: 0x7f020112 - public const int mr_dialog_close_dark = 2130837778; + public const int mr_button_light = 2130837778; // aapt resource value: 0x7f020113 - public const int mr_dialog_close_light = 2130837779; + public const int mr_dialog_close_dark = 2130837779; // aapt resource value: 0x7f020114 - public const int mr_dialog_material_background_dark = 2130837780; + public const int mr_dialog_close_light = 2130837780; // aapt resource value: 0x7f020115 - public const int mr_dialog_material_background_light = 2130837781; + public const int mr_dialog_material_background_dark = 2130837781; // aapt resource value: 0x7f020116 - public const int mr_group_collapse = 2130837782; + public const int mr_dialog_material_background_light = 2130837782; // aapt resource value: 0x7f020117 - public const int mr_group_expand = 2130837783; + public const int mr_group_collapse = 2130837783; // aapt resource value: 0x7f020118 - public const int mr_media_pause_dark = 2130837784; + public const int mr_group_expand = 2130837784; // aapt resource value: 0x7f020119 - public const int mr_media_pause_light = 2130837785; + public const int mr_media_pause_dark = 2130837785; // aapt resource value: 0x7f02011a - public const int mr_media_play_dark = 2130837786; + public const int mr_media_pause_light = 2130837786; // aapt resource value: 0x7f02011b - public const int mr_media_play_light = 2130837787; + public const int mr_media_play_dark = 2130837787; // aapt resource value: 0x7f02011c - public const int mr_media_stop_dark = 2130837788; + public const int mr_media_play_light = 2130837788; // aapt resource value: 0x7f02011d - public const int mr_media_stop_light = 2130837789; + public const int mr_media_stop_dark = 2130837789; // aapt resource value: 0x7f02011e - public const int mr_vol_type_audiotrack_dark = 2130837790; + public const int mr_media_stop_light = 2130837790; // aapt resource value: 0x7f02011f - public const int mr_vol_type_audiotrack_light = 2130837791; + public const int mr_vol_type_audiotrack_dark = 2130837791; // aapt resource value: 0x7f020120 - public const int navigation_empty_icon = 2130837792; + public const int mr_vol_type_audiotrack_light = 2130837792; // aapt resource value: 0x7f020121 - public const int notification_action_background = 2130837793; + public const int navigation_empty_icon = 2130837793; // aapt resource value: 0x7f020122 - public const int notification_bg = 2130837794; + public const int notification_action_background = 2130837794; // aapt resource value: 0x7f020123 - public const int notification_bg_low = 2130837795; + public const int notification_bg = 2130837795; // aapt resource value: 0x7f020124 - public const int notification_bg_low_normal = 2130837796; + public const int notification_bg_low = 2130837796; // aapt resource value: 0x7f020125 - public const int notification_bg_low_pressed = 2130837797; + public const int notification_bg_low_normal = 2130837797; // aapt resource value: 0x7f020126 - public const int notification_bg_normal = 2130837798; + public const int notification_bg_low_pressed = 2130837798; // aapt resource value: 0x7f020127 - public const int notification_bg_normal_pressed = 2130837799; + public const int notification_bg_normal = 2130837799; // aapt resource value: 0x7f020128 - public const int notification_icon_background = 2130837800; - - // aapt resource value: 0x7f02012d - public const int notification_template_icon_bg = 2130837805; - - // aapt resource value: 0x7f02012e - public const int notification_template_icon_low_bg = 2130837806; + public const int notification_bg_normal_pressed = 2130837800; // aapt resource value: 0x7f020129 - public const int notification_tile_bg = 2130837801; + public const int notification_icon_background = 2130837801; + + // aapt resource value: 0x7f02012e + public const int notification_template_icon_bg = 2130837806; + + // aapt resource value: 0x7f02012f + public const int notification_template_icon_low_bg = 2130837807; // aapt resource value: 0x7f02012a - public const int notify_panel_notification_icon_bg = 2130837802; + public const int notification_tile_bg = 2130837802; // aapt resource value: 0x7f02012b - public const int tooltip_frame_dark = 2130837803; + public const int notify_panel_notification_icon_bg = 2130837803; // aapt resource value: 0x7f02012c - public const int tooltip_frame_light = 2130837804; + public const int tooltip_frame_dark = 2130837804; + + // aapt resource value: 0x7f02012d + public const int tooltip_frame_light = 2130837805; static Drawable() { diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable-hdpi/icon_solent_stevedores.png b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable-hdpi/icon_solent_stevedores.png new file mode 100644 index 0000000000000000000000000000000000000000..151b2f11e5c28c9cf6dd186321c1278a799b810b GIT binary patch literal 4093 zcmVp9`TfRoH& ze3&F;hH+-dnIXvllZC7fl8mDy=KzzzS(spF1_P7D*hY(Y8#}>~yjx3m|0TDoez#iI z(!YPpl6ZD^|NdS7Rn@KcUcL9KN&;g>%Ph=HMp2Q9AZpA6BC}z5i{XOTq7njg0ngH9 zh5X;c-(G+a9`7H7k@+oB)&aO_fi(XeY3Ut{R*MVEzScxFrlZW7&YEsvXW!1xcfy)1 z;M(lB%QCY6e8C;uG-3Fc@;btD4q&JDv;41M8ZGGa_Q6YaVt>o&*B3yuYU7BP&4%UP z$bNqm(Tb}S5E2v(jLS|NMe+2Aq99VjgnF4#Ak$5LP9uA<0o~#i9B%sK1P6#}l$d`V zTmJzF?{8sMm{bWL6u*O`MT(yx6i`yS(&x6qaK8`Rd=9%C4@^9OlJzxw{}>zn5k$%W zC#6+rw1F9p3<70PvNApG6xK)3dG>J}f9mY`15{mmF)FOP;fb}Bm?Pp=Tk6?H6lj8?aa`j3|%>8WCRm#x1nXw0ENT7Vxv-_kNe+ONeb?9t4 zH?{yJ>c7PII}wRaA~0j8N@TiUCTg z9gVn?Il()(qpj&#zu#UE7G{xE8b~($Kl$IFt8o3PcLIVVNwte0(W{^VFX!d^QMJUt z@twa`eF*?kF#s7@D8cdGoU3@E0&^Zps-1c;%Q&#hF>PrET|5340W>HWK-DYCaB0m; z^lh&6>lE6(9YxC8jpF(qybam1Lb>EMlqA=eq>=#=xUA+yGUiOhYoTiy9YBQ08$%gu z^s$aK@5wkTrC)-61Mks__+=vf1LTFXe-b2t>rl1$C_&mja_0+CvaW@${cV2CRGL~1 zc;1jUOuE^}*^CsW^CdXmX8zuZSmyUgTM<<(nz7NtSkA=dER$ecmXptX{!+!V7x{dl zgW7C?r7l&0Y%v2U%St!EwcC-wP1xIXq&R@)H{1-<`!Si6lS%0Y zSq7M{ouMH9l8tLbM{{$*XJpV@c2a6C1Uulvu zE%cFY4-QcE`!7QIq^B8EEvGkHx>}i00Xx%56?uq$$al}Hf1q(r)L+Bf^I>?i`BODK zLwcdoR=F%GNBIyO_aF>oAKLSx_e9-&Z09{}^Tn#ofkBe0CN;#q6Kxy69t@yl{byOx zdL3|vv^&{Z$toAf^!^C0_c?Slb({xGKR}7qD_9S0ok7)!&Vpg-{7*h9hc7Jy;n(=B zjZZ#DyY)Qw_%s3S20cIqH9_Kn!PY2U~IC0Ea5OJ0I$ zT}1D*6uaZXiW_X`LlEhIqF>m6tw*%{?_igZ(eykU(J2w6&wdka zjdzS#Hd+5DJ9?Kk-j0`xpZb{%oi@oDe#6lA%}JkvH2OX1Ps5D4h+#Vi`4ZkQJjne9 z`yB1jwP^q0t{iRy3SPW?4kD3eKkFA(wJ15|CNkYWhj;ESbhQtUbh6)fGqN|c#_8~Pn^aHT4HVQ9#FGX`bI~U&W7#2q&)5)pxdQP3gN6*PRN|yLnUj2@u z^DGRp4UXMO<9uddL79AW<80|det93;RZp7{9b_MK*RroFz3_khei_Zhyg+fOYC8?K z>ttZtOR;BD+dzQk*3W_^cCgS?Kj9V5_DE@P)3@Q3#vhMZPEO%K9GO@O$I5AWAIlUP zXQ0-?l9+{**FZn>Yg8>mwY7gRJ>O|$?B!c{A&Lvg>D9pQz6Y)8uK_JimNBFBx>{J1 zo`BsG3Kz|sqn+;kI!=mvajdaBJfk3VcMQqn8;QWmeh5b)1d=nQO;5fzeG3k?yrx$c zrq>cS;|`Tz4@+{OGQB4toNrxta3npF;;i*Ss?$BJJfo#%6xhm{yKKr;m}DgtUg~D0 zIfdTn^~yMhCF!?7`~+v6_6rYA9<^`eEa=kzL6@4*!ej;VNdm2WEm4c=50@GK&9`aC zEG%<5MN7NrJ~>t^o&%`0c{^;*Sgv!5v!N&%Bq=CDybEO~Er0ROc&F-MSRGa|kiCsO zUKw+6vb1}nl-%10lFmh!0+Nh9qZO9}<&*m*$aTXp)6=88+KJsQqqbldie$dobJnQ= zE7f32poR5j36S(g=L}vO4@j~ht_lr`OIchf>gj$APVWmUbnv`zol*v00^}|=uxM36 zhx{ejA16(#CQghuHi`~Cd5W{ySCu0vjN;b+^GSK<_)9ukkwyATNg`>$aKkrdv?=X8 z&pvHasup_S)nk+Gx`682F|_FCOdI?hRD2u+}-pNWN9kpv@d_LnRDkQFsaNA$Skh22t^f(KK({4?j!A7YW6~RcHhUQ27b>tTIiCxidNs{O$aq_@Y?(DK z;LLA$6W?q6wf*AzWS9n0Xa7Lgr7NpeKh=jvinP{)0QGl$>6Ol9=uW&eE&y5H4U~Yt zQiBy{22wWJ{Tcew84Zw;K8sA>uhkEMfT8et-eI+2dq|LUA;v;iVqwEUBuex|WU^#CKYpN=Yt=0s)(#4;=B&1Y@F>b1$M5yPJ@l;P)CO zO;S(u*ULqoG?~^4*v`F}F>Mm2EjokASJuW@J{|5C-yr13})U`fvGdUNRN1Ju+0m~BEN{%rfaA| zH&QMiRWpY&L+;>>1@ZyuTgcf#e%d{9cbMGuewYPz!SP;$@aJUDm;;l+uY*14nA8+t z-Cploj8y$6%BFmr1~&M(oq7Q_>anMJf1v&)8rE@e zA1rBSid7-_{G;eOaxV^Tk=u{YLs=|1j<|RetoY&)7ZPM6zc>~O7)qo9A1Hkh10-dbKwS^C+JQ&vwH}ws)HP=(UP9n&Wfkgdh5Q+Vp zwmV+9*;v|AC&l*A%b8I}JJJ7yK!-I`^rB+1@@wpTv^Y|-{4QMZiT z-^%vhKpt|d?hHiY7_k1Yq=%2EyNQn5#_P@WpPDE&+w@3p%T8XQlp=R5XEUf+WDrWekyY%tAR zlcW?q1FNhWc3(|q+L6V40~dZWXY9GP#k5mulnGyf2q+%OItU^Kh|9Zmld3WTBP@`f3R z;d88PC5`zTRis|Z@dzb7F}63o6(>)Y}Z3&ILca{ zq8dGh_Q!XJ>PVvDCcb}M9YBG1na(_vcy^?JXX`Px?E`GvwxNoR%v}0LRWqOAXw|5E zPcfOt0e+A=ts}klQw#vNQYD_@=N?4TFAq9iQ1!9Nn4XfWz1I?moB1g>N6`Zpv7B$C zc^7Vfp|*KmA7`y~=xBU+xT1wCm{)rlB2h;BMpEgzdg}FXkZvS^)SKKU`xV-q`$j4n ztfLE7&89g1H;X4s;g-$FIptNb2~(dz@G>{)tEfx(efOh6}a{FPIvyy6#(`j;~5t>)|| zN}5T=0vI{KX4K%|%9YkH6P&fhun5<&1-DLyIi;C)>AmW^lW`TVi3C)3;AHwD(|3fe zyC1EM-z%0)xJ>==jx;)VY((Wk>BU|Nt32*YlRNGpW?n9Hg6vVuA@kaHC06BZ4lml9L1~EriMbv zw^Aq@E~q4XMrITKon6|1_O=e-w}rEiV-8T37S>k6j?SS1e~MMC=Ew>ks8Kjx4nG^| z|Cz3I_YU6Q$om^``t<3c0?vsCP?oZ1!X{fatV$-LR!{}wI%($Sxl!i@p81F4R4es* zKrX>%r}wi^3*)&)8sNj&ThSXRZ$04v8mhiUt7gH8yo1*Z)t?3w-eh+4>fB#Z$dcz} v`1@{^P=h#1JYR%}{08>1U26B(7}1{rB}l%fI*kUT00000NkvXXu0mjfFQwiW literal 0 HcmV?d00001 diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable-xhdpi/icon_solent_stevedores.png b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable-xhdpi/icon_solent_stevedores.png new file mode 100644 index 0000000000000000000000000000000000000000..eeee9c2fbd1a21f1754e308d8b5b2941ba9439de GIT binary patch literal 1835 zcmV+`2h{k9P)~6ZkeMn;Ww>(}mB|cegp{d5cj*HEf-t`z&opEW9x+KMFD#|4i3vrSDKhWcdW?36W3qfzE>t;oSktvCVO$)O z=#IF-2*b};Wvt4X%ZDhyl`0cO;KGG)dE%I`aZ+4rS6$3i38ZbJEOCR8Pw3@t5S9fr z5CpCygvk)cGb0GIHTJG?PfXs#R**e$gV8u{OgFWx2pGP;jrKJsj%`_}%J;iwp&_7s z7fo&7XN{^HjQZ;D2kQRNEW;Cm)}5ZO>GsBW<~7$iwr3IT*U+rOmC`)lUe);gY6dL|#4O*rt7?!zE1v;99yve^NFtEc-zn;-I>&T@JVgXy~kwdoUOwc%X{}iD-{k_MTf#96PtayJCwt znlY*B-P(|SPe$9kq9{u-actKX0u9Im;%Gr_!kCa@=F_`EjgWKB|4?;|^S&q}E+RJ$ zE?&0BmGLs3#nEVw%EMC7j3_S4=`16|C;Ono%RKXuPaIeHrvuU|jc%gp_)U{egKYwN zX%xiXjk;E{vf5rq94eIzK2{prq+Xxo!cu7*j>-FEA?s0x_i`E^2$Kd})FcgBE@e}p zv41JKc;Hq1@XZlqKX~i_pPob2p9nRch@=zle0|Z&`%nP$ zO1mZvxF5@@r>@>OtmQJ%@Gasl1S<#~HohFJeJ_b!AQy;vV&Zt1O1U8SV(*?!!FI?a zH{?O?gT{G+feXrMQ#}}0BhcBVX4P>E!4yftwe1%w%tjgx;^j_ zrDt2Om&_7U_U*b|R%&BxFJcR^#>r_Lhq}85ws%*85Cc-s{lXhBmV9**B zW{?`Hi=I@%LSavta^M&MK$3f!9acthza@y|6OH)845aG|J1KcFgx32j+khj>O&67+pj(M^r zZbkJ&(pcB{q{y4Js(oCSb+%xFYwd-k#5IeMVh>tKX4?*aArQ_4wxNNN3C9l|kln2m zkom43-j&29B=Z$B+>cJf8_bHbTfBH{t1gj|-)X-Sa})P*8Q}$OR6WByg z|7f%yCCvu|LPC&!b$-(b4@Oj{k9zU;w@KS6HgvZUA zlk8rAmRJMWfp3(zY%+C&CQ!^7LZOgV*5oc>3)(Lr0$wTTy zHjRbV4o>cvkXlNJE6c1wL*9`cM31Z}Xs7nmE*(gpCno0+it|-(Z~j(B{tI>WtwqJ0 zR)mS;^n4LdK9Yo;p8u+@-m3DA1JW==Ulp~vDtl1c&?0;llFb29?VZz9nm$!0U)5Dg zd78Y&nSfDF-F;%025s3bPPJxiIcl&}uyS9mX%Y*Dk+2lg)3or_5tmuJC@2bb8)z+M;z1Z%J2nY6UvFH*}&y-wjS-4KqrK0xIaLdhcIR?_3K;WaU@tT5ETt=INd8sk4EF-GDup2 Z{{ZHpBXI~G9XbF2002ovPDHLkV1n2dY?A;0 literal 0 HcmV?d00001 diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable/icon_solent_stevedores.png b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Resources/drawable/icon_solent_stevedores.png new file mode 100644 index 0000000000000000000000000000000000000000..ccb8e941e6a4e4e075d44221b24439fa24e0b9e8 GIT binary patch literal 2083 zcmV+;2;BFHP)h@o1rrmA zNJNdACc+>3hZ+S5GP~Vc!vY1<1T_&AiY3~#>CSGuAR@Kxwnf2qot=5_UcdX^%u<^x|$dN-|*;5uKTkNl+8aNCG!Eb%JAuWdPaO+J6x zmL0kQ-BAUR;v@e;4H`h|k70IHLySZshj;un#Th1R+adPka_V*OL zCg~EP=%e`_EeBpxITI4TV7*tLA%k$;CZlaQ6cKQiXoqBE0b{+`1EKcw*`GP$ELT{G zP^W5dzE@p9T5#-Wn%}IapHS z@UB-E1W8=PGy8so+U|p!sV#(;>Br=*Bjp9?`*H;BvzeNV7Bny6bXdsEevO*>LCN#j zmiuX?U*woxDx_H8+_@9{_6(WqMtbzOh$Yw2-uFS$u0)0CsMk~YC!Kmlc>!X{gZyQ+ zk=6@llR0|{UK^h&dbV=t613UmWi2n=49-JdIfa<7g_Cjvf$c;5PM*til@(}*>05JK zsj!s3Ekq%K4{wQ*W87zI0^aG+PIyxZcuno06L310BiyA2pYksygK;SF~74JYS`6u38Wu$#y2>h5Q<=rK}M~81A+XxqW0Y`Tq zD?2xq+(ri5m^y5rO)n@VpbU4ey?Ov4Y|p(BQ#~3Sc#LVbH)Of zqyA)q)}Cr;u2g@c$$d01p=jbO^O~qdmZLTB-3tb&{0>wsL*JL(xbbO z%S^!>&6xuazQWZEt@j*7rZ3rEHd*43YrInDiE z7Avb-B0w9~1u3=>od{I#&K)zI;inuzv_Vx-(lisSr2$Md<6_)EO|0Wm|r9)1BKXtf#mC`Cu~%s*w$-d zw?zyEfbM(*3m+Nz6+#`TxC@qjDTTZqcBFJCfXgX_$KCiA-uKy#M)e+Ca<|`5Frm3~ ze=JN4D4O^oEbE@ir?Pq(6C>+c4oSTHEzW zOpX2$m11Nx@d(%7Rx>LIl%|-&t;5t4uPg}AKfIa@Ug0yRq&6r3l=3l_ad)x+`aDA6 zpFy72Su1)^kpH9mn_hM=(j(Vb1f^?a%YMY?S1Te0>C8Vcky@c|7m|)Mhi1^TI>rUp zlxV@XdEGJ$528E1l0tkFGY7tno;A94NQCM#gu5KSo1g(}`}A@|qsEbQ6V&{}D20}< z29w*#_ose%HYuvYOvQ4ugE({eKS0^eTvAnkpDVURzIVdrX$<%EIV2dd>Oj{QZ za<@Kcd}tMVQKyb~;`p=k3224p?(majesk>uh0`4dp6t2(T;WI5(FERpdvfstKJ{*1 zhAx_)!YAox59IyAy!Sfa!Sk-6?f?Ef1ZBwY9Csh!0@1p)+Y0hK)43fiIlo>;g;gk) zn4u6o?-_7k^9&50_XGpS?d674J3$4VWjUEl2U)jyir75x{>#3fR{~#4fB^7+vka?p zU*Nd!k`VLFWA_VG;$78-)-FEZnQ(FH;G^h?>-heuI&$^KfZJj1tTV`FKhE>xxmr`| zZxO~4JgxB&`i9-`8~SpAdK0nUSk*q*io!jYgZblFK1Fsa7 z@{2|xG_%Vr5Fc6#*SgiO6M* 0) MainPage.DisplayAlert("Sarand LogisticsMgr Mobile", "Startup errors:\n" + startupErrors.Concat("", "\n"), "OK"); } @@ -69,7 +71,7 @@ namespace Sarand.LogisticsMgr.Mobile.App //------------------------------------------------------------------- // Properties. public static App GetInstance () { return app; } - public SlmMobile.Platform MobilePlatform { get; private set; } + public SlmMainPage SlmMainPage { get; private set; } //------------------------------------------------------------------- // W e b S e r v i c e @@ -92,19 +94,26 @@ namespace Sarand.LogisticsMgr.Mobile.App { if (sites.Count < 1) { - sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP", "http://SS-APP-LG1:34568/SaLogMgr")); - sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP4 int]", "http://10.1.20.12:34568/SaLogMgr")); - sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP4 ext]", "http://185.102.148.202:34568/SaLogMgr")); - sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP6 int]", "http://[0:0:0:0:0:ffff:a01:140c]:34568/SaLogMgr")); - //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106]", "http://Sarand106:34567/SaLogMgr")); - //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106-IP4]", "http://192.168.1.118:34567/SaLogMgr")); - sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106-IP6]", "http://[2a00:23c0:1b03:6b00:cc8f:77b4:a561:7801]:34567/SaLogMgr")); - //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106-IP6-2]", "http://[fdaa:bbcc:ddee:0:cc8f:77b4:a561:7801]:34567/SaLogMgr")); - //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev on site [IP4]", "http://10.1.22.70:34567/SaLogMgr")); - //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev on site [IP6]", "http://[fe80:8044:1300:8ea1:3f4%4]:34567/SaLogMgr")); - //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [403]", "http://Sarand403:34567/SaLogMgr")); - //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [403-IP4]", "http://192.168.1.105:34567/SaLogMgr")); - sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [403-IP6]", "http://[2a00:23c0:1b03:6b00:f14f:66b9:c098:242d]:34567/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP4 ext]", "http://37.48.230.34:34568/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP4 int]", "http://10.1.4.13:34567/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP6 int]", "http://[fe80:f4c9:7720:45d8:f1b0]:34567/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN - dev [403-IP6]", "http://[2a00:23c4:1b29:cc00:f14f:66b9:c098:242d]:34567/SaLogMgr")); + if (false/*allowLgp*/) + { + sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP", "http://SS-APP-LG1:34568/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP4 int]", "http://10.1.20.12:34568/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP4 ext]", "http://185.102.148.202:34568/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP6 int]", "http://[0:0:0:0:0:ffff:a01:140c]:34568/SaLogMgr")); + //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106]", "http://Sarand106:34567/SaLogMgr")); + //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106-IP4]", "http://192.168.1.118:34567/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106-IP6]", "http://[2a00:23c0:1b03:6b00:cc8f:77b4:a561:7801]:34567/SaLogMgr")); + //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106-IP6-2]", "http://[fdaa:bbcc:ddee:0:cc8f:77b4:a561:7801]:34567/SaLogMgr")); + //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev on site [IP4]", "http://10.1.22.70:34567/SaLogMgr")); + //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev on site [IP6]", "http://[fe80:8044:1300:8ea1:3f4%4]:34567/SaLogMgr")); + //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [403]", "http://Sarand403:34567/SaLogMgr")); + //sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [403-IP4]", "http://192.168.1.105:34567/SaLogMgr")); + sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [403-IP6]", "http://[2a00:23c4:1b29:cc00:f14f:66b9:c098:242d]:34567/SaLogMgr")); + } } return sites; } @@ -131,11 +140,8 @@ namespace Sarand.LogisticsMgr.Mobile.App if (sessionProfile == null) return; switch (e.Property) { - case ModifiedProperty.User: - Properties[PropertyName_Context_User] = sessionProfile.User; - break; - case ModifiedProperty.Email: - Properties[PropertyName_Context_Email] = sessionProfile.Email; + case ModifiedProperty.EmailAddress: + Properties[PropertyName_Context_EmailAddress] = sessionProfile.EmailAddress; break; } } diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_CreateRepair.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_CreateRepair.cs new file mode 100644 index 0000000..7cafacb --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_CreateRepair.cs @@ -0,0 +1,55 @@ +using Sarand.Core.Base; +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets; +using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.App.Commands +{ + //======================================================================= + public class SlmCommand_Assets_CreateRepair : SlmCommand_Mobile + { + //------------------------------------------------------------------- + // Construction. + public SlmCommand_Assets_CreateRepair () : base(null) + { + } + + //------------------------------------------------------------------- + public override bool CanExecute (object commandParam) + { + if (!UserContext.ValidUser) return false; + if (!SecurityProfile.Assets.CanView) return false; + if (!SlmAppConsole.IsViewApplicable(Site, Slm.View.Assets_Maintenance)) return false; + return true; + } + + //------------------------------------------------------------------- + public bool AssetRepairFormActive { get; private set; } + /// Execute command. + public override async void Execute (object commandParam) + { + if (!CanExecute(commandParam)) return; + if (AssetRepairFormActive) return; + AssetRepairFormActive = true; + try + { + if (!await App.GetInstance().SlmMainPage.IsWebServiceActive()) return; + SlmPage_Assets_Repair.Config pageConfig = new SlmPage_Assets_Repair.Config(); + SlmPage_Assets_Repair assetRepairForm = new SlmPage_Assets_Repair (pageConfig); + assetRepairForm.Disappearing += (sender2, e2) => + { + AssetRepairFormActive = false; + }; + await App.GetInstance().SlmMainPage.Navigation.PushModalAsync(assetRepairForm, false); + } + catch (Exception exc) { Logger.Warn("ShowAssetRepairForm " + exc.GetLogMessage()); } + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_Movements.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_Movements.cs new file mode 100644 index 0000000..54a77a8 --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Assets_Movements.cs @@ -0,0 +1,42 @@ +using Sarand.Core.App; +using Sarand.Core.Base; +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.App.Commands +{ + //======================================================================= + public class SlmCommand_Assets_Movements : SlmCommand_Mobile + { + //------------------------------------------------------------------- + // Construction. + public SlmCommand_Assets_Movements () : base(null) + { + } + + //------------------------------------------------------------------- + public override bool CanExecute (object commandParam) + { + String fn = GetType().Name + ".CanExecute"; + if (SacsSystem.DebugMode) Logger.Debug(fn + " Can view: " + SecurityProfile.Assets.CanView + ". Site: " + Site + ". Is applicable: " + SlmAppConsole.IsViewApplicable(Site, Slm.View.Assets_Movements)); + if (!SecurityProfile.Assets.CanView) return false; + if (!SlmAppConsole.IsViewApplicable(Site, Slm.View.Assets_Movements)) return false; + return true; + } + + //------------------------------------------------------------------- + /// Execute command. + public override void Execute (object commandParam) + { + if (!CanExecute(commandParam)) return; + App.GetInstance().SlmMainPage.SwitchView(SlmMobile.MainView.AssetMovements, Page_Template_Main.PageBodyMode.SelfScrolling); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Bulk_ShipFIle.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Bulk_ShipFIle.cs new file mode 100644 index 0000000..3446989 --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Bulk_ShipFIle.cs @@ -0,0 +1,38 @@ +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.App.Commands +{ + //======================================================================= + public class SlmCommand_Bulk_ShipFile : SlmCommand_Mobile + { + //------------------------------------------------------------------- + // Construction. + public SlmCommand_Bulk_ShipFile () : base(null) + { + } + + //------------------------------------------------------------------- + public override bool CanExecute (object commandParam) + { + if (!SecurityProfile.Assets.CanView) return false; + if (!SlmAppConsole.IsViewApplicable(Site, Slm.View.Bulk_ShipFile)) return false; + return true; + } + + //------------------------------------------------------------------- + /// Execute command. + public override void Execute (object commandParam) + { + if (!CanExecute(commandParam)) return; + App.GetInstance().SlmMainPage.SwitchView(SlmMobile.MainView.ShipFile, Page_Template_Main.PageBodyMode.SelfScrolling); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Logout.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Logout.cs new file mode 100644 index 0000000..e1c31c8 --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/Commands/SlmCommand_Logout.cs @@ -0,0 +1,36 @@ +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.App.Commands +{ + //======================================================================= + public class SlmCommand_Logout : SlmCommand_Mobile + { + //------------------------------------------------------------------- + // Construction. + public SlmCommand_Logout () : base(null) + { + } + + //------------------------------------------------------------------- + public override bool CanExecute (object commandParam) + { + if (!UserContext.ValidUser) return false; + return true; + } + + //------------------------------------------------------------------- + /// Execute command. + public override void Execute (object commandParam) + { + if (!CanExecute(commandParam)) return; + App.GetInstance().SlmMainPage.SwitchView(SlmMobile.MainView.Login, Page_Template_Main.PageBodyMode.Scrollable); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs index 6b4459b..c271b1a 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs @@ -1,10 +1,12 @@ -using Sarand.LogisticsMgr.Core.App; +using Sarand.Core.Base; +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Utils; using Sarand.LogisticsMgr.Mobile.Forms.Components; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; +using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main; using Sarand.LogisticsMgr.Mobile.Forms.Views; using System; using System.Collections.Generic; @@ -25,17 +27,11 @@ namespace Sarand.LogisticsMgr.Mobile.App // Data members. private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile; private SlmMenu menu = new SlmMenu(); - private Image imageLogo = new Image(); - private Button buttonCreateRepair; - // Configuration grid. - private SlmGrid gridConfig = new SlmGrid(); - private SlmComponents_Config configComponents = new SlmComponents_Config(); //------------------------------------------------------------------- // Construction. public SlmMainPage () : base() { - sessionProfile.PropertyModified += SessionProfile_PropertyModified; Title = "Sarand LogisticsMgr"; NavigationPage.SetHasNavigationBar(this, false); InitialiseComponents(); @@ -44,61 +40,95 @@ namespace Sarand.LogisticsMgr.Mobile.App //------------------------------------------------------------------- // Properties. protected override SlmMenuView MenuView { get { return menu; } } + public SlmMobile.MainView MainView { get; private set; } = SlmMobile.MainView.Unknown; + private SlmMainPanel MainPanel { get; set; } //------------------------------------------------------------------- // I n i t i a l i s e //------------------------------------------------------------------- private void InitialiseComponents () { + // Menu. menu.MainPage = this; - // Logo. - imageLogo.Source = ImageUtils.GetImageFromByteArray(SlmResourceConsole.GetImageResource(SlmResourceConsole.ImageResource.Logo_Solent_Stevedores_78_png)); - imageLogo.Margin = new Thickness(0, 4, 0, 4); - PageBody.Children.Add(imageLogo); - - // Configuration grid. - configComponents.ReadOnly = true; - PageBody.Children.Add(gridConfig); - gridConfig.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); - gridConfig.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); - // Config options. - int optionIdx = -1; - // Site. - optionIdx++; - gridConfig.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - gridConfig.Children.Add(configComponents.LabelSite, 0, optionIdx); - gridConfig.Children.Add(configComponents.PickerSite, 1, optionIdx); - // User. - optionIdx++; - gridConfig.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - gridConfig.Children.Add(configComponents.LabelUser, 0, optionIdx); - gridConfig.Children.Add(configComponents.EntryUser, 1, optionIdx); - Grid.SetColumnSpan(configComponents.EntryUser, 2); - // Email. - optionIdx++; - gridConfig.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - gridConfig.Children.Add(configComponents.LabelEmail, 0, optionIdx); - gridConfig.Children.Add(configComponents.EntryEmail, 1, optionIdx); - Grid.SetColumnSpan(configComponents.EntryEmail, 2); - - // 'Create Repair' button. - buttonCreateRepair = new Button() - { - Text = "Create Repair", - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center - }; - buttonCreateRepair.Clicked += ButtonCreateRepair_Clicked; - PageBody.Children.Add(buttonCreateRepair); + // Initial view. + SwitchView(SlmMobile.MainView.Login, PageBodyMode.Scrollable); } //------------------------------------------------------------------- - // S e s s i o n P r o f i l e E v e n t s + // S w i t c h V i e w //------------------------------------------------------------------- - private void SessionProfile_PropertyModified (object sender, EventArgs e) + public void SwitchView (SlmMobile.MainView view, PageBodyMode bodyMode) { - configComponents.RefreshProperties(); + String fn = GetType().Name + ".SwitchView"; + // Check for valid session. + if (view != SlmMobile.MainView.Login && !sessionProfile.UserContext.ValidUser) + view = SlmMobile.MainView.Login; + // Configure requested view. + SlmMainPanel mainPanel = null; + try + { + switch (view) + { + //------------------------------------------------------- + // Application. + case SlmMobile.MainView.Login: + { + SlmMainPanel_Login.Config panelConfig = new SlmMainPanel_Login.Config(); + SlmMainPanel_Login loginPanel = new SlmMainPanel_Login(panelConfig); + loginPanel.UserLogin += LoginPanel_UserLogin; + mainPanel = loginPanel; + break; + } + case SlmMobile.MainView.Home: + { + SlmMainPanel_Home.Config panelConfig = new SlmMainPanel_Home.Config(); + SlmMainPanel_Home loginPanel = new SlmMainPanel_Home(panelConfig); + mainPanel = loginPanel; + break; + } + //------------------------------------------------------- + // Bulk. + case SlmMobile.MainView.ShipFile: + { + SlmMainPanel_ShipFile.Config panelConfig = new SlmMainPanel_ShipFile.Config(); + SlmMainPanel_ShipFile loginPanel = new SlmMainPanel_ShipFile(panelConfig); + mainPanel = loginPanel; + break; + } + //------------------------------------------------------- + // Assets. + case SlmMobile.MainView.AssetMovements: + { + SlmMainPanel_AssetMovements.Config panelConfig = new SlmMainPanel_AssetMovements.Config(); + SlmMainPanel_AssetMovements loginPanel = new SlmMainPanel_AssetMovements(panelConfig); + mainPanel = loginPanel; + break; + } + //------------------------------------------------------- + } + } + catch (Exception exc) { Logger.Warn(fn+" "+exc.GetLogMessage(6)); } + if (mainPanel != null) + { + // Clear previous view. + if (MainPanel != null) + { + MainPanel = null; + } + // Display new view. + MainView = view; + MainPanel = mainPanel; + SwitchPageBody(MainPanel, bodyMode); + } + } + + //------------------------------------------------------------------- + // U s e r L o g i n + //------------------------------------------------------------------- + private void LoginPanel_UserLogin (object sender, SlmMainPanel_Login.UserLoginEventArgs e) + { + SwitchView(SlmMobile.MainView.Home, PageBodyMode.Scrollable); } //------------------------------------------------------------------- @@ -135,16 +165,10 @@ namespace Sarand.LogisticsMgr.Mobile.App { base.OnAppearing(); } - //------------------------------------------------------------------- protected override void OnDisappearing () { base.OnDisappearing(); } - //------------------------------------------------------------------- - private void ButtonCreateRepair_Clicked (object sender, EventArgs e) - { - menu.ShowAssetRepairForm(); - } //------------------------------------------------------------------- } diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMenu.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMenu.cs index e20a207..4cea8ad 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMenu.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMenu.cs @@ -1,4 +1,6 @@ using Sarand.Core.Base; +using Sarand.LogisticsMgr.Mobile.App.Commands; +using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Config; using Sarand.LogisticsMgr.Mobile.Forms.Views; @@ -38,27 +40,46 @@ namespace Sarand.LogisticsMgr.Mobile.App { get { + ClearMenuOptions(); if (menuOptions.Count < 1) { + // Bulk. + List bulkCommands = new List(); + bulkCommands.Add(new OptionData() { Caption = "Ship File", Command = new SlmCommand_Bulk_ShipFile() }); + if (bulkCommands.Exists(item => item.Command.CanExecute(null))) + { + menuOptions.Add(new OptionData() { Caption = "Bulk", Heading = true }); + menuOptions.AddRange(bulkCommands); + } // Assets. - menuOptions.Add(new OptionData() { Caption = "Assets", Heading = true }); - menuOptions.Add(new OptionData() { Caption = "Create repair", ClickedFn = OnAssets_CreateRepairClicked }); + List assetsCommands = new List(); + assetsCommands.Add(new OptionData() { Caption = "Movements", Command = new SlmCommand_Assets_Movements() }); + assetsCommands.Add(new OptionData() { Caption = "Create repair", Command = new SlmCommand_Assets_CreateRepair() }); + if (assetsCommands.Exists(item => item.Command.CanExecute(null))) + { + menuOptions.Add(new OptionData() { Caption = "Assets", Heading = true }); + menuOptions.AddRange(assetsCommands); + } // Config. menuOptions.Add(new OptionData() { Caption = "Config", Heading = true }); - menuOptions.Add(new OptionData() { Caption = "Options", ClickedFn = OnConfig_OptionsClicked }); - menuOptions.Add(new OptionData() { Caption = "System", ClickedFn = OnConfig_SystemClicked}); - menuOptions.Add(new OptionData() { Caption = "Update", ClickedFn = OnConfig_UpdateClicked}); + menuOptions.Add(new OptionData() { Caption = "Options", Command = new SlmCommand_Mobile(OnConfig_OptionsClicked) }); + menuOptions.Add(new OptionData() { Caption = "System", Command = new SlmCommand_Mobile(OnConfig_SystemClicked) }); + menuOptions.Add(new OptionData() { Caption = "Update", Command = new SlmCommand_Mobile(OnConfig_UpdateClicked) }); } return menuOptions; } } + public void ClearMenuOptions() + { + menuOptions.Clear(); + } //------------------------------------------------------------------- // A s s e t s //------------------------------------------------------------------- // Asset Repair. public bool AssetRepairFormActive { get; private set; } - private void OnAssets_CreateRepairClicked () + private void OnAssets_CreateRepairClicked (object commandParam) { ShowAssetRepairForm(); } @@ -68,7 +89,7 @@ namespace Sarand.LogisticsMgr.Mobile.App AssetRepairFormActive = true; try { - OnMenuOptionClicked(); + InvokeMenuOptionClicked(); if (!await MainPage.IsWebServiceActive()) return; SlmPage_Assets_Repair.Config pageConfig = new SlmPage_Assets_Repair.Config(); SlmPage_Assets_Repair assetRepairForm = new SlmPage_Assets_Repair (pageConfig); @@ -84,24 +105,24 @@ namespace Sarand.LogisticsMgr.Mobile.App //------------------------------------------------------------------- // C o n f i g //------------------------------------------------------------------- - private async void OnConfig_OptionsClicked () + private async void OnConfig_OptionsClicked (object commandParam) { - OnMenuOptionClicked(); + InvokeMenuOptionClicked(); SlmPage_Config_Options.Config pageConfig = new SlmPage_Config_Options.Config(); await MainViewNavigation.PushModalAsync(new SlmPage_Config_Options(pageConfig), false); } //------------------------------------------------------------------- - private async void OnConfig_SystemClicked () + private async void OnConfig_SystemClicked (object commandParam) { - OnMenuOptionClicked(); + InvokeMenuOptionClicked(); SlmPage_Config_System.Config pageConfig = new SlmPage_Config_System.Config(); await MainViewNavigation.PushModalAsync(new SlmPage_Config_System(pageConfig), false); } //------------------------------------------------------------------- - private async void OnConfig_UpdateClicked () + private async void OnConfig_UpdateClicked (object commandParam) { - OnMenuOptionClicked(); - await Browser.OpenAsync("http://www.sarand.com/Android/LogisticsMgr.apk", BrowserLaunchMode.SystemPreferred); + InvokeMenuOptionClicked(); + await Browser.OpenAsync("http://www.sarand.com/Android/LogisticsMgrMobile.apk", BrowserLaunchMode.SystemPreferred); } //------------------------------------------------------------------- diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmSessionProfile_Mobile_App.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmSessionProfile_Mobile_App.cs index 1f73040..a952527 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmSessionProfile_Mobile_App.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmSessionProfile_Mobile_App.cs @@ -17,9 +17,9 @@ namespace Sarand.LogisticsMgr.Mobile.App //------------------------------------------------------------------- // S i t e //------------------------------------------------------------------- - public new void SetSiteDefinition (SlmSiteDefinition siteDefinition) + public void SetSiteDefinition (SlmSiteDefinition siteDefinition) { - base.SetSiteDefinition(siteDefinition); + SiteDefinition = siteDefinition; } //------------------------------------------------------------------- diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_AssetRepair.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_AssetRepair.cs index 71fdbcb..8e495c4 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_AssetRepair.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_AssetRepair.cs @@ -84,7 +84,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components EntryRepairNarrative.TextChanged += EntryRepairNarrative_TextChanged; // Repair Inspector. - EntryRepairInspector.Text = SlmGlobals_Mobile.SessionProfile.User; + EntryRepairInspector.Text = SlmGlobals_Mobile.SessionProfile.UserContext.User.DisplayName; EntryRepairInspector.MaxLength = (int)SlmDbDfn.GetColTextLen(SlmDbDfn.ColumnIdx.AssetRepair_RepairInspector); EntryRepairInspector.TextChanged += EntryRepairInspector_TextChanged; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs index 8323a16..e30ed9a 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs @@ -3,6 +3,7 @@ using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Text; @@ -16,12 +17,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components //------------------------------------------------------------------- // Data members. private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile; - private readonly List sites = Sarand.LogisticsMgr.Mobile.App.App.GetInstance().GetSiteDefinitions(); + private readonly List sites; //------------------------------------------------------------------- // Construction. public SlmComponents_Config () { + sites = SlmGlobals_Mobile.Application.GetSiteDefinitions(); InitialiseComponents(); } @@ -29,13 +31,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components // Properties. // Site. public SlmLabel LabelSite { get; } = new SlmLabel() { Text = "Site" }; - public SlmPickerView PickerSite { get; } = new SlmPickerView(); + public SlmPickerView_SiteDefinitions PickerSite { get; } = new SlmPickerView_SiteDefinitions() { ReadOnly = true }; // User. public SlmLabel LabelUser { get; } = new SlmLabel() { Text = "User" }; - public SlmEntryView EntryUser { get; } = new SlmEntryView(); + public SlmEntryView EntryUser { get; } = new SlmEntryView() { ReadOnly = true }; // Email. public SlmLabel LabelEmail { get; } = new SlmLabel() { Text = "Email" }; - public SlmEntryView EntryEmail { get; } = new SlmEntryView() { Keyboard = Keyboard.Email }; + public SlmEntryView EntryEmail { get; } = new SlmEntryView() { Keyboard = Keyboard.Email, ReadOnly = true }; //------------------------------------------------------------------- // Utilities. @@ -60,8 +62,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components PickerSite.SelectedIndex = siteIdx; } // User and Email. - EntryUser.Text = sessionProfile.User; - EntryEmail.Text = sessionProfile.Email; + EntryUser.Text = sessionProfile.UserCode; + EntryEmail.Text = sessionProfile.EmailAddress; Changed = false; } @@ -70,22 +72,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components //------------------------------------------------------------------- private void InitialiseComponents () { - // Site. - for (int siteIdx = 0; siteIdx < sites.Count; siteIdx++) - { - SlmSiteDefinition siteDefinition = sites[siteIdx]; - PickerSite.Items.Add(siteDefinition.Caption); - if (siteDefinition == sessionProfile.SiteDefinition) - PickerSite.SelectedIndex = siteIdx; - } - // User. - EntryUser.Text = sessionProfile.User; + EntryUser.Text = sessionProfile.UserCode; EntryUser.TextChanged += EntryUser_TextChanged; EntryUser.Completed += EntryUser_Completed; // Email. - EntryEmail.Text = sessionProfile.Email; + EntryEmail.Text = sessionProfile.EmailAddress; EntryEmail.TextChanged += EntryEmail_TextChanged; EntryEmail.Completed += EntryEmail_Completed; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs new file mode 100644 index 0000000..3d135c8 --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs @@ -0,0 +1,109 @@ +using Sarand.Core.Base; +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Mobile.App; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using System; +using System.Collections.Generic; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Forms.Components +{ + //======================================================================= + public class SlmComponents_Login : SlmComponents + { + //------------------------------------------------------------------- + // Data members. + private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile; + private readonly List sites; + + //------------------------------------------------------------------- + // Construction. + public SlmComponents_Login () + { + sites = SlmGlobals_Mobile.Application.GetSiteDefinitions(); + InitialiseComponents(); + } + + //------------------------------------------------------------------- + // Properties. + // Site. + public SlmLabel LabelSite { get; } = new SlmLabel() { Text = "Site" }; + public SlmPickerView_SiteDefinitions PickerSite { get; } = new SlmPickerView_SiteDefinitions(); + // Email. + public SlmLabel LabelEmail { get; } = new SlmLabel() { Text = "Email" }; + public SlmEntryView EntryEmail { get; } = new SlmEntryView() { Keyboard = Keyboard.Email }; + // Password. + public SlmLabel LabelPassword { get; } = new SlmLabel() { Text = "Password" }; + public SlmEntryView EntryPassword { get; } = new SlmEntryView() { IsPassword = true }; + + //------------------------------------------------------------------- + // Utilities. + public SlmSiteDefinition SelectedSiteDefinition + { + get + { + if (PickerSite.SelectedIndex < 0) return null; + return sites.Find(item => item.Caption.EqualsCI(PickerSite.Items[PickerSite.SelectedIndex])); + } + } + + //------------------------------------------------------------------- + // Utilities. + + //------------------------------------------------------------------- + // I n i t i a l i s e + //------------------------------------------------------------------- + private void InitialiseComponents () + { + // Email. + EntryEmail.Text = SlmGlobals_Mobile.Application.DefaultEmailAddress; + EntryEmail.TextChanged += EntryEmail_TextChanged; + EntryEmail.Completed += EntryEmail_Completed; + + // Password. + EntryPassword.TextChanged += EntryPassword_TextChanged; + EntryPassword.Completed += EntryPassword_Completed; + + Changed = false; + } + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + SetControlsReadOnly(); + } + protected override void SetControlsReadOnly () + { + PickerSite.ReadOnly = ReadOnly; + EntryEmail.ReadOnly = ReadOnly; + EntryPassword.ReadOnly = ReadOnly; + } + + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + private void EntryEmail_TextChanged (object sender, TextChangedEventArgs e) + { + Changed = true; + } + private void EntryEmail_Completed (object sender, EventArgs e) + { + } + //------------------------------------------------------------------- + private void EntryPassword_TextChanged (object sender, TextChangedEventArgs e) + { + Changed = true; + } + private void EntryPassword_Completed (object sender, EventArgs e) + { + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Assets/SlmPage_Assets_Repair.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Assets/SlmPage_Assets_Repair.cs index edab26f..a019c82 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Assets/SlmPage_Assets_Repair.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Assets/SlmPage_Assets_Repair.cs @@ -43,8 +43,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets private SlmGrid gridRepairProperties = new SlmGrid(); private SlmComponents_AssetRepair assetRepairComponents = new SlmComponents_AssetRepair(); private SlmPanel_AssetMovement_SearchResults assetSearchResultsWebView = new SlmPanel_AssetMovement_SearchResults() { IsVisible = false, }; - private SlmPanel_AssetRepair_Jobs repairJobsPanel = new SlmPanel_AssetRepair_Jobs(); - private SlmPanel_AssetRepair_Images repairImagesPanel = new SlmPanel_AssetRepair_Images(); + private SlmPanel_AssetRepair_Jobs repairJobsPanel; + private SlmPanel_AssetRepair_Images repairImagesPanel; //------------------------------------------------------------------- // Construction. @@ -128,14 +128,18 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets Grid.SetColumnSpan(assetRepairComponents.EntryRepairInspector, 2); // Jobs panel. - repairJobsPanel.AssetRepairPage = this; + SlmPanel_AssetRepair_Jobs.Config jobsPanelConfig = new SlmPanel_AssetRepair_Jobs.Config(); + jobsPanelConfig.AssetRepairPage = this; + repairJobsPanel = new SlmPanel_AssetRepair_Jobs(jobsPanelConfig); rowIdx = gridRepairProperties.RowDefinitions.Count; gridRepairProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); gridRepairProperties.Children.Add(repairJobsPanel, 0, rowIdx); Grid.SetColumnSpan(repairJobsPanel, 3); // Images panel. - repairImagesPanel.AssetRepairPage = this; + SlmPanel_AssetRepair_Images.Config imagesPanelConfig = new SlmPanel_AssetRepair_Images.Config(); + imagesPanelConfig.AssetRepairPage = this; + repairImagesPanel = new SlmPanel_AssetRepair_Images(imagesPanelConfig); rowIdx = gridRepairProperties.RowDefinitions.Count; gridRepairProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); gridRepairProperties.Children.Add(repairImagesPanel, 0, rowIdx); @@ -231,10 +235,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets { return await StoreAssetRepairAsync(assetRepair); } - catch (Exception exc) - { - Logger.Error(GetType().Name + ".StoreAssetRepair " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "z=\n\r")); - } + catch (Exception exc) { Logger.Error(GetType().Name + ".StoreAssetRepair " + exc.GetLogMessage()); } return null; }); if (!storeTask.IsCompleted) storeTask.Wait(); diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs index b4dfa93..aa3dc34 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs @@ -60,43 +60,41 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Config optionsGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); optionsGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); optionsGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); - - // Options. - int optionIdx = -1; + int gridRowIdx = -1; // User. - optionIdx++; + gridRowIdx++; optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - optionsGrid.Children.Add(configComponents.LabelUser, 0, optionIdx); - optionsGrid.Children.Add(configComponents.EntryUser, 1, optionIdx); + optionsGrid.Children.Add(configComponents.LabelUser, 0, gridRowIdx); + optionsGrid.Children.Add(configComponents.EntryUser, 1, gridRowIdx); Grid.SetColumnSpan(configComponents.EntryUser, 2); // Email. - optionIdx++; + gridRowIdx++; optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - optionsGrid.Children.Add(configComponents.LabelEmail, 0, optionIdx); - optionsGrid.Children.Add(configComponents.EntryEmail, 1, optionIdx); + optionsGrid.Children.Add(configComponents.LabelEmail, 0, gridRowIdx); + optionsGrid.Children.Add(configComponents.EntryEmail, 1, gridRowIdx); Grid.SetColumnSpan(configComponents.EntryEmail, 2); // Site. - optionIdx++; + gridRowIdx++; optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - optionsGrid.Children.Add(configComponents.LabelSite, 0, optionIdx); - optionsGrid.Children.Add(configComponents.PickerSite, 1, optionIdx); + optionsGrid.Children.Add(configComponents.LabelSite, 0, gridRowIdx); + optionsGrid.Children.Add(configComponents.PickerSite, 1, gridRowIdx); buttonSiteTest.VerticalOptions = LayoutOptions.Start; buttonSiteTest.Padding = new Thickness(4, 4); buttonSiteTest.Clicked += ButtonSiteTest_Clicked; - optionsGrid.Children.Add(buttonSiteTest, 2, optionIdx); + optionsGrid.Children.Add(buttonSiteTest, 2, gridRowIdx); // Site test output. - optionIdx++; + gridRowIdx++; optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - optionsGrid.Children.Add(webViewSiteTest, 0, optionIdx); + optionsGrid.Children.Add(webViewSiteTest, 0, gridRowIdx); Grid.SetColumnSpan(webViewSiteTest, 2); buttonSiteTestHide.VerticalOptions = LayoutOptions.Start; buttonSiteTestHide.Padding = new Thickness(4, 4); buttonSiteTestHide.Clicked += ButtonSiteTestHide_Clicked; - optionsGrid.Children.Add(buttonSiteTestHide, 2, optionIdx); + optionsGrid.Children.Add(buttonSiteTestHide, 2, gridRowIdx); } //------------------------------------------------------------------- @@ -157,18 +155,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Config //------------------------------------------------------------------- protected override bool SaveFormData () { - // Site. - SlmSiteDefinition siteDefinition = configComponents.SelectedSiteDefinition; - Sarand.LogisticsMgr.Mobile.App.App.GetInstance().SetSite(siteDefinition); - - // User. - if (!sessionProfile.User.Equals(configComponents.EntryUser.Text)) - sessionProfile.User = configComponents.EntryUser.Text; - - // Email. - if (!sessionProfile.Email.Equals(configComponents.EntryEmail.Text)) - sessionProfile.Email = configComponents.EntryEmail.Text; - return true; } protected override bool QueryCancelForm () diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs index 9a9f1ce..302196d 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs @@ -96,13 +96,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Config settings.Add("Build history", VersionTracking.BuildHistory.Concat(", ")); // Populate settings. - int optionIdx = -1; + int gridRowIdx = -1; foreach (StringPair setting in settings) { - optionIdx++; + gridRowIdx++; settingsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - settingsGrid.Children.Add(new SlmLabel() { Text = setting.Item1, HorizontalOptions = LayoutOptions.Start }, 0, optionIdx); - settingsGrid.Children.Add(new SlmLabel() { Text = setting.Item2, HorizontalOptions = LayoutOptions.StartAndExpand }, 1, optionIdx); + settingsGrid.Children.Add(new SlmLabel() { Text = setting.Item1, HorizontalOptions = LayoutOptions.Start }, 0, gridRowIdx); + settingsGrid.Children.Add(new SlmLabel() { Text = setting.Item2, HorizontalOptions = LayoutOptions.StartAndExpand }, 1, gridRowIdx); } } diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs index 3af54d7..bf48e47 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs @@ -3,7 +3,6 @@ using Sarand.Core.Base; using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Forms.Views; -using Sarand.LogisticsMgr.Mobile.Core.Utils; using System; using System.Collections.Generic; using System.IO; @@ -13,31 +12,28 @@ using System.Text; using Xamarin.Forms; using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.Core.Mobile.Utils; namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates { //======================================================================= - public class Page_Template_Main : SlmContentPage + public abstract class Page_Template_Main : SlmContentPage { //------------------------------------------------------------------- // Definitions. - public enum PageBodyType - { - Scroll - } //------------------------------------------------------------------- // Data members. - private StackLayout mainLayout = new StackLayout(); + private SlmGrid baseGrid = new SlmGrid(); // Application bar. private SlmGrid applicationBar = new SlmGrid(); private Label labelApplicationCaption = new Label(); private ImageButton buttonMenu = new ImageButton(); private SlmContentView applicationBarBorderBottom = new SlmContentView(); // Page body. - private AbsoluteLayout pageBody = new AbsoluteLayout(); + private AbsoluteLayout absoluteLayout = new AbsoluteLayout(); private SlmScrollView pageBodyScroll = new SlmScrollView(); - private StackLayout pageBodyStack = new StackLayout(); + private SlmContentView pageBodyStatic = new SlmContentView(); //------------------------------------------------------------------- // Construction. @@ -45,18 +41,20 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates { this.SizeChanged += OnSizeChanged; - // Main layout. - mainLayout.Orientation = StackOrientation.Vertical; - mainLayout.Spacing = 0; - mainLayout.BackgroundColor = SlmMobile.PageBaseColor; - mainLayout.Padding = new Thickness(0); - Content = mainLayout; + // Base layout - Grid. + baseGrid.BackgroundColor = SlmMobile.PageBaseColor; + baseGrid.Padding = new Thickness(0); + baseGrid.RowSpacing = 0; + baseGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + baseGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star }); + Content = baseGrid; + int baseGridRowIdx = -1; // Application bar. applicationBar.Margin = new Thickness(0); applicationBar.Padding = new Thickness(0, 4, 0, 0); - applicationBar.HorizontalOptions = LayoutOptions.Center; - applicationBar.VerticalOptions = LayoutOptions.Center; + applicationBar.HorizontalOptions = LayoutOptions.FillAndExpand; + applicationBar.VerticalOptions = LayoutOptions.CenterAndExpand; applicationBar.RowSpacing = 0; applicationBar.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); applicationBar.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); @@ -65,7 +63,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates applicationBar.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); applicationBar.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); applicationBar.BackgroundColor = SlmMobile.ApplicationBarBackgroundColor; - mainLayout.Children.Add(applicationBar); + baseGrid.Children.Add(applicationBar, 0, ++baseGridRowIdx); // Caption. //labelApplicationCaption.HorizontalOptions = LayoutOptions.CenterAndExpand; labelApplicationCaption.Margin = new Thickness(0, 0, 0, 8); @@ -77,7 +75,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates // Menu button. buttonMenu.HorizontalOptions = LayoutOptions.End; buttonMenu.VerticalOptions = LayoutOptions.Center; - buttonMenu.Source = ImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.Icon_Burger_Black_64_png)); + buttonMenu.Source = SacsImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.Icon_Burger_Black_64_png)); buttonMenu.BackgroundColor = Color.Transparent; buttonMenu.Padding = new Thickness(12, 0); buttonMenu.Clicked += ButtonMenu_Clicked; @@ -91,42 +89,71 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates // Menu. MenuView.MenuOptionClicked += MenuView_MenuOptionClicked; - // Page body. - pageBody.BackgroundColor = SlmMobile.PageBackgroundColor; - pageBody.Padding = new Thickness(0); - mainLayout.Children.Add(pageBody); + // AbsoluteLayout - Required for positioning popup menu etc. + absoluteLayout.BackgroundColor = SlmMobile.PageBackgroundColor; + absoluteLayout.Padding = new Thickness(0); + baseGrid.Children.Add(absoluteLayout, 0, ++baseGridRowIdx); - // Page Body view. - pageBodyScroll.HorizontalOptions = LayoutOptions.Fill; + // Scrolling Page Body. + pageBodyScroll.HorizontalOptions = LayoutOptions.FillAndExpand; pageBodyScroll.VerticalOptions = LayoutOptions.FillAndExpand; pageBodyScroll.BackgroundColor = Color.Transparent; pageBodyScroll.Padding = new Thickness(0); - pageBody.Children.Add(pageBodyScroll); - // Page layout. - pageBodyStack.BackgroundColor = Color.Transparent; - pageBodyStack.Padding = new Thickness(4); - pageBodyScroll.Content = pageBodyStack; + // Static Page Body. + pageBodyStatic.HorizontalOptions = LayoutOptions.FillAndExpand; + pageBodyStatic.VerticalOptions = LayoutOptions.FillAndExpand; + pageBodyStatic.BackgroundColor = Color.Transparent; + pageBodyStatic.Padding = new Thickness(0); // Hide menu when tapping on main page. var bodyTapGestureRecognizer = new TapGestureRecognizer(); bodyTapGestureRecognizer.Tapped += (s, e) => { HideMenu(); }; //pageBody.GestureRecognizers.Add(bodyTapGestureRecognizer); //pageBodyScroll.GestureRecognizers.Add(bodyTapGestureRecognizer); - pageBodyStack.GestureRecognizers.Add(bodyTapGestureRecognizer); + baseGrid.GestureRecognizers.Add(bodyTapGestureRecognizer); // Events. } //------------------------------------------------------------------- // Properties. - public PageBodyType BodyType { get; set; } - public Layout PageBody { get { return pageBodyStack; } } + public PageBodyMode BodyMode { get; private set; } + + //------------------------------------------------------------------- + // S w i t c h P a g e B o d y + //------------------------------------------------------------------- + public enum PageBodyMode + { + Scrollable, + SelfScrolling + } + protected void SwitchPageBody (View mainBodyView, PageBodyMode mode) + { + // Clear previous body. + pageBodyScroll.Content = null; + pageBodyStatic.Content = null; + absoluteLayout.Children.Clear(); + // Add new page body. + BodyMode = mode; + if (mode == PageBodyMode.SelfScrolling) + { + // Replace the static panel and add the body panel to that. + absoluteLayout.Children.Add(pageBodyStatic, new Rectangle(0.0, 0.0, 1.0, 1.0), AbsoluteLayoutFlags.SizeProportional); + pageBodyStatic.Content = mainBodyView; + } + else + { + // Replace the scrolling panel and add the body panel to that. + absoluteLayout.Children.Add(pageBodyScroll, new Rectangle(0.0, 0.0, 1.0, 1.0), AbsoluteLayoutFlags.SizeProportional); + pageBodyScroll.Content = mainBodyView; + } + } //------------------------------------------------------------------- // M e n u //------------------------------------------------------------------- - protected virtual SlmMenuView MenuView { get; } + protected abstract SlmMenuView MenuView { get; } private bool menuShown = false; private void ButtonMenu_Clicked (object sender, EventArgs e) { @@ -139,7 +166,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates } public void HideMenu () { - pageBody.Children.Remove(MenuView); + absoluteLayout.Children.Remove(MenuView); menuShown = false; } private void ShowMenu () @@ -148,8 +175,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates double menuHeight = Math.Min(320, Math.Min(Width, Height) * 0.66); if (MenuView.MenuHeight > menuHeight && MenuView.MenuHeight < Height) menuHeight = MenuView.MenuHeight; - Rectangle menuPosition = new Rectangle(pageBody.Width - menuWidth, 0, menuWidth, menuHeight); - pageBody.Children.Add(MenuView, menuPosition, AbsoluteLayoutFlags.None); + Rectangle menuPosition = new Rectangle(absoluteLayout.Width - menuWidth, 0, menuWidth, menuHeight); + absoluteLayout.Children.Add(MenuView, menuPosition, AbsoluteLayoutFlags.None); menuShown = true; } private void MenuView_MenuOptionClicked (object sender, SlmMenuView.MenuOptionClickedEventArgs e) @@ -163,9 +190,11 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates private void PositionComponents () { // Page size has changed. + // Adjust main body padding. double widthPadding = Math.Max(SlmMobile.PageBodyPaddingHorizontalMin, (Width - 460) / 2); double heightPadding = Math.Max(SlmMobile.PageBodyPaddingVerticalMin, (Height - 800) / 20); pageBodyScroll.Padding = new Thickness(widthPadding, heightPadding); + pageBodyStatic.Padding = new Thickness(widthPadding, heightPadding); } //------------------------------------------------------------------- diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs index 24b0a33..4b6fb08 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs @@ -180,19 +180,16 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets RefreshAssetSearchResultsWebView(info); }); } - catch (Exception exc) - { - Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t")); - } + catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); } } private void RefreshAssetSearchResultsWebView (String body) { - String html = "" + GetAssetSearchStyle() + ""; + String html = "" + GetAssetSearchStyles() + ""; html += body; html += ""; Html = html; } - private String GetAssetSearchStyle () + private String GetAssetSearchStyles () { List menuStyle = new List(); menuStyle.Add(""); diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs index a57c26f..b960133 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs @@ -14,23 +14,29 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets { //------------------------------------------------------------------- // Definitions. + public new class Config : SlmPanel_AssociatedItems.Config + { + public SlmPage_Assets_Repair AssetRepairPage { get; set; } + } //------------------------------------------------------------------- // Data members. + private Config config; private List repairImages = new List(); private SlmLabel labelSummary = new SlmLabel(); private SlmGrid gridDetails = new SlmGrid(); //------------------------------------------------------------------- // Construction. - public SlmPanel_AssetRepair_Images () + public SlmPanel_AssetRepair_Images (Config config) : + base(config) { + this.config = config; InitialiseComponents(); } //------------------------------------------------------------------- // Properties. - public SlmPage_Assets_Repair AssetRepairPage { get; set; } public List RepairImages => new List(repairImages); //------------------------------------------------------------------- @@ -80,7 +86,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets //------------------------------------------------------------------- protected async override void ButtonAddItem_Clicked (object sender, EventArgs e) { - SlmPage_Assets_RepairImage.Config pageConfig = new SlmPage_Assets_RepairImage.Config(AssetRepairPage.CompanyId); + SlmPage_Assets_RepairImage.Config pageConfig = new SlmPage_Assets_RepairImage.Config(config.AssetRepairPage.CompanyId); SlmPage_Assets_RepairImage page = new SlmPage_Assets_RepairImage(pageConfig); page.Disappearing += (sender2, e2) => { diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs index 3337799..22f13ea 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs @@ -1,8 +1,8 @@ using Sarand.Core.App; +using Sarand.Core.Mobile.Utils; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; -using Sarand.LogisticsMgr.Mobile.Core.Utils; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets; using System; using System.Collections.Generic; @@ -16,23 +16,29 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets { //------------------------------------------------------------------- // Definitions. + public new class Config : SlmPanel_AssociatedItems.Config + { + public SlmPage_Assets_Repair AssetRepairPage { get; set; } + } //------------------------------------------------------------------- // Data members. + private Config config; private List repairJobs = new List(); private SlmLabel labelSummary = new SlmLabel(); private SlmGrid gridDetails = new SlmGrid(); //------------------------------------------------------------------- // Construction. - public SlmPanel_AssetRepair_Jobs () + public SlmPanel_AssetRepair_Jobs (Config config) : + base(config) { + this.config = config; InitialiseComponents(); } //------------------------------------------------------------------- // Properties. - public SlmPage_Assets_Repair AssetRepairPage { get; set; } public List RepairJobs => new List(repairJobs); //------------------------------------------------------------------- @@ -95,12 +101,12 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets // 'Update' button. ImageButton buttonUpdate = new ImageButton() { - Source = ImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Pencil_Orange_72_png)) + Source = SacsImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Pencil_Orange_72_png)) }; buttonUpdate.Pressed += (sender, evt) => { // Update job. - SlmPage_Assets_RepairJob.Config pageConfig = new SlmPage_Assets_RepairJob.Config(AssetRepairPage.CompanyId); + SlmPage_Assets_RepairJob.Config pageConfig = new SlmPage_Assets_RepairJob.Config(config.AssetRepairPage.CompanyId); pageConfig.AssetRepairJobToUpdate = repairJob; SlmPage_Assets_RepairJob page = new SlmPage_Assets_RepairJob(pageConfig); page.Disappearing += (sender2, e2) => @@ -114,13 +120,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets // 'Remove' button. ImageButton buttonRemove = new ImageButton() { - Source = ImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_TrashCan_Grey_72_png)) + Source = SacsImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_TrashCan_Grey_72_png)) }; buttonRemove.Pressed += async (sender, evt) => { // Confirm removal. String msg = "Are you sure that job '" + repairJobDisplay + "' should be removed?"; - if (!await AssetRepairPage.DisplayConfirm(msg)) return; + if (!await config.AssetRepairPage.DisplayConfirm(msg)) return; // Remove job from list and refresh. repairJobs.Remove(repairJob); RefreshPanels(); @@ -134,7 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets //------------------------------------------------------------------- protected override void ButtonAddItem_Clicked (object sender, EventArgs e) { - SlmPage_Assets_RepairJob.Config pageConfig = new SlmPage_Assets_RepairJob.Config(AssetRepairPage.CompanyId); + SlmPage_Assets_RepairJob.Config pageConfig = new SlmPage_Assets_RepairJob.Config(config.AssetRepairPage.CompanyId); SlmPage_Assets_RepairJob page = new SlmPage_Assets_RepairJob(pageConfig); page.Disappearing += (sender2, e2) => { diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_AssetMovements.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_AssetMovements.cs new file mode 100644 index 0000000..f216e1d --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_AssetMovements.cs @@ -0,0 +1,338 @@ +using Sarand.Core.App; +using Sarand.Core.Base; +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.Core.Mobile.Forms.Panels; +using Sarand.Core.Tasks; +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Core.Bus; +using Sarand.LogisticsMgr.Core.WebService; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Forms.Components; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main +{ + //======================================================================= + public class SlmMainPanel_AssetMovements : SlmMainPanel_ItemList + { + //------------------------------------------------------------------- + // Definitions. + public enum FilterProperty + { + Code, + Size, + } + public enum PanelMode + { + InProgress + } + public new class Config : SlmMainPanel_ItemList.Config + { + public PanelMode Mode { get; set; } = PanelMode.InProgress; + } + + //------------------------------------------------------------------- + // Data members + private Config config; + private class Columns + { + public ColumnDfn Id { get; set; } + public ColumnDfn MovementType { get; set; } + public ColumnDfn MovementAt { get; set; } + public ColumnDfn MovementRef { get; set; } + public ColumnDfn Customer { get; set; } + public ColumnDfn LocationStart { get; set; } + public ColumnDfn LocationCurrent { get; set; } + public ColumnDfn LocationFinish { get; set; } + public ColumnDfn AssetItemType { get; set; } + public ColumnDfn AssetItemId { get; set; } + public ColumnDfn Asset_Code { get; set; } + public ColumnDfn AssetSizeCode { get; set; } + public ColumnDfn InProgressAt { get; set; } + public ColumnDfn OnHoldAt { get; set; } + public ColumnDfn CompletedAt { get; set; } + public ColumnDfn Flags { get; set; } + public ColumnDfn Status { get; set; } + } + private Columns cols = new Columns(); + + //------------------------------------------------------------------- + // Construction. + public SlmMainPanel_AssetMovements (Config config) : + base(config) + { + this.config = config; + // Columns. + cols.Id = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.Id); + cols.MovementType = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.MovementType); + cols.MovementAt = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.MovementAt); + cols.MovementRef = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.MovementRef); + cols.Customer = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.Customer); + cols.LocationStart = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.LocationStart); + cols.LocationCurrent = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.LocationCurrent); + cols.LocationFinish = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.LocationFinish); + cols.AssetItemType = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.AssetItemType); + cols.AssetItemId = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.AssetItemId); + cols.Asset_Code = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.Asset_Code); + cols.AssetSizeCode = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.AssetSizeCode); + cols.InProgressAt = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.InProgressAt); + cols.OnHoldAt = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.OnHoldAt); + cols.CompletedAt = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.CompletedAt); + cols.Flags = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.Flags); + cols.Status = AssetMgr.GetAssetMovementColumnDfn(SlmAssetMovement.Column.Status); + // Initialise components. + InitialiseComponents(); + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // I n i t i l i a s e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control initialisation on construction. + protected override void InitialiseComponents () + { + base.InitialiseComponents(); + //Logger.Debug("List view row height: "+viewGrid.RowDefinitions[1].Height); + + ConfigureComponents(); + } + + //------------------------------------------------------------------- + // C o n f i g u r e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control configuration that can be changed dynamically. + protected override void ConfigureComponents () + { + base.ConfigureComponents(); + + // Initial population. + RefreshItemList(); + } + + //------------------------------------------------------------------- + // P a n e l A c t i o n s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + } + protected override void SetControlsReadOnly () + { + } + + //------------------------------------------------------------------- + // I t e m L i s t + //------------------------------------------------------------------- + protected override List GetFilterPropertyTypes() + { + List filterPropertyTypes = new List(); + filterPropertyTypes.Add(new SacsFilterPropertyType((int)FilterProperty.Code, "Code") { Mode = SacsFilterPropertyType.FilterMode.Text }); + filterPropertyTypes.Add(new SacsFilterPropertyType((int)FilterProperty.Size, "Size") { Mode = SacsFilterPropertyType.FilterMode.Text }); + return filterPropertyTypes; + } + public SlmAssetMovement.Params GetAssetMovementParams (uint pageNo, ushort pageLength) + { + SlmAssetMovement.Params assetMovementParams = new SlmAssetMovement.Params(); + // Mode. + if (config.Mode == PanelMode.InProgress) + assetMovementParams.StatusCat = SlmAssetMovement.StatusCat.NotClosed; + // Filter. + assetMovementParams.AssetCodePartial = HeaderPanel.PanelFilter.GetFilterPropertyValue((int)FilterProperty.Code); + assetMovementParams.AssetSizeCodePartial = HeaderPanel.PanelFilter.GetFilterPropertyValue((int)FilterProperty.Size); + // Paging. + assetMovementParams.ResultsPaging.PageNo = pageNo; + assetMovementParams.ResultsPaging.PageLength = pageLength; + return assetMovementParams; + } + private SacsTaskData taskDataRefreshList = null; + protected override void RefreshItemList (uint pageNo = 1) + { + String fn = GetType().Name + ".RefreshList"; + + // Kill previous request. + if (taskDataRefreshList != null) + { + taskDataRefreshList.TriggerCancellation(); + taskDataRefreshList = null; + } + + // Clear existing list. + DisplayItemList(null, "Refreshing list. Please wait..."); + + // Refresh the list. + RefreshItemList(GetAssetMovementParams(pageNo, ItemsPerPage), taskDataRefreshList = new SacsTaskData(null)); + } + private void RefreshItemList (SlmAssetMovement.Params assetMovementParams, SacsTaskData taskDataRefreshList_Local) + { + String fn = GetType().Name + ".RefreshList"; + + // Query data after delay. + Device.StartTimer(TimeSpan.FromMilliseconds(250), () => + { + if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer fired."); + Task.Run(async () => + { + try + { + // Configure request. + SlmWebServiceRequest.Config configRequest = new SlmWebServiceRequest.Config(); + configRequest.DataType = SlmWebServiceRequest.DataType.AssetMovement; + configRequest.RequestType = SlmWebServiceRequest.RequestType.List; + configRequest.Context.SiteDefinition = SlmGlobals_Mobile.SessionProfile.SiteDefinition; + configRequest.Context.Debug = SacsSystem.DebugMode; + // Filter. + Dictionary filter = AssetMgr.GetAssetMovementQueryFilter_Mobile(assetMovementParams); + // Columns. + List queryColumns = new List() + { + cols.Id.DataName, + cols.MovementType.DataName, + cols.MovementAt.DataName, + cols.MovementRef.DataName, + cols.Customer.DataName, + cols.LocationStart.DataName, + cols.LocationCurrent.DataName, + cols.LocationFinish.DataName, + cols.AssetItemType.DataName, + cols.AssetItemId.DataName, + cols.Asset_Code.DataName, + cols.AssetSizeCode.DataName, + cols.InProgressAt.DataName, + cols.OnHoldAt.DataName, + cols.CompletedAt.DataName, + cols.Flags.DataName, + cols.Status.DataName, + }; + // Request User profile. + if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - START"); + SlmWebServiceClient.ItemListResponseData responseData = + await new SlmWebServiceClient().GetItemList(configRequest, filter, queryColumns, taskDataRefreshList_Local); + if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - END Items: "+(responseData?.Items.Count.ToString()??"None")+(taskDataRefreshList_Local.IsCancellationRequested?" [Cancelled]":"")); + + // Display item list. + Device.BeginInvokeOnMainThread(() => + { + DisplayItemList(responseData); + }); + } + catch (Exception exc) { Logger.Debug(fn + " " + exc.GetLogMessage(6)); } + }, taskDataRefreshList_Local.CancellationToken) + .ContinueWith(task => + { + taskDataRefreshList_Local.Dispose(); + if (taskDataRefreshList == taskDataRefreshList_Local) + taskDataRefreshList = null; + }); + if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer method complete."); + return false; + }); + } + + //------------------------------------------------------------------- + protected override void DisplayItemList (SlmWebServiceClient.ItemListResponseData responseData, SacsMessage message = null) + { + // Refresh paging properties. + if (responseData != null) + HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total); + else HeaderPanel.SetPaging(0, 0, 0); + // Construct item list HTML. + string html = ""+GetItemListStyles().Concat("\n")+""; + if (message != null) + { + String messageClass = "inf"; + switch (message.MessageLevel) + { + case SaMessageLevel.Fatal: + case SaMessageLevel.Exception: + case SaMessageLevel.Error: + messageClass = "err"; + break; + case SaMessageLevel.Warning: + messageClass = "wrn"; + break; + } + html += "
" + message.Message + "
"; + } + if (responseData == null) + { } + else if (responseData.Items.Count > 0) + { + //html += "
Movements found: " + responseData.Items.Count + "
"; + foreach (var item in responseData.Items) + { + html += "
"; + html += "
" + item.GetValue(cols.Asset_Code.DataName) + "
"; + html += "
" + item.GetValue(cols.AssetSizeCode.DataName) + "
"; + html += "
"; + // Asset movement status. + SaStatus assetMovementStatus = SacsSystem.GetStatusForCode(item.GetValue(cols.Status.DataName)); + html += "
Customer: " + item.GetValue(cols.Customer.DataName) + "
"; + html += "
Status: " + SacsSystem.GetStatusDesc(assetMovementStatus) + "
"; + html += "
Arrived: " + DateUtil.Format(item.GetDateTimeValue(cols.InProgressAt.DataName), "d-MMM-yyyy") + "
"; + html += "
Location: " + item.GetValue(cols.LocationCurrent.DataName) + "
"; + html += "
Destination: " + item.GetValue(cols.LocationFinish.DataName) + "
"; + html += "
"; + } + } + else html += "
No movements found
"; + html += ""; + ItemListWebView.Html = html; + //Logger.Debug("HTML: " + html); + } + private List GetItemListStyles () + { + return new List() + { + "", + "", + "" + }; + } + + //------------------------------------------------------------------- + // P a n e l E v e n t s + //------------------------------------------------------------------- + //------------------------------------------------------------------- + protected override void OnParentSet () + { + base.OnParentSet(); + } + //------------------------------------------------------------------- + protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanging(propertyName); + } + protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanged(propertyName); + } + //------------------------------------------------------------------- + protected override void OnSizeAllocated (double width, double height) + { + base.OnSizeAllocated(width, height); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs new file mode 100644 index 0000000..3c66a54 --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs @@ -0,0 +1,153 @@ +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Forms.Components; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main +{ + //======================================================================= + public class SlmMainPanel_Home : SlmMainPanel + { + //------------------------------------------------------------------- + // Definitions. + public new class Config : SlmMainPanel.Config + { + } + + //------------------------------------------------------------------- + // Data members + private Config config; + private readonly List favouriteActionButtons = new List(); + // Configuration grid. + private SlmGrid gridConfig = new SlmGrid(); + private SlmComponents_Config configComponents; + + //------------------------------------------------------------------- + // Construction. + public SlmMainPanel_Home (Config config) : + base(config) + { + this.config = config; + configComponents = new SlmComponents_Config() { ReadOnly = true }; + InitialiseComponents(); + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // I n i t i l i a s e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control initialisation on construction. + protected void InitialiseComponents () + { + // Configuration grid. + Content = gridConfig; + gridConfig.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); + gridConfig.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); + // Config options. + int gridRowIdx = -1; + // Site. + gridRowIdx++; + gridConfig.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + gridConfig.Children.Add(configComponents.LabelSite, 0, gridRowIdx); + gridConfig.Children.Add(configComponents.PickerSite, 1, gridRowIdx); + // User. + gridRowIdx++; + gridConfig.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + gridConfig.Children.Add(configComponents.LabelUser, 0, gridRowIdx); + gridConfig.Children.Add(configComponents.EntryUser, 1, gridRowIdx); + Grid.SetColumnSpan(configComponents.EntryUser, 2); + // Email. + gridRowIdx++; + gridConfig.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + gridConfig.Children.Add(configComponents.LabelEmail, 0, gridRowIdx); + gridConfig.Children.Add(configComponents.EntryEmail, 1, gridRowIdx); + Grid.SetColumnSpan(configComponents.EntryEmail, 2); + + // ToDo 'Favourite' buttons. + favouriteActionButtons.Clear(); + /* + foreach (SlmAppConsole.FavouriteAction favouriteAction in SlmGlobals_Mobile.SessionProfile.FavouriteActions) + { + SaxButton favouriteActionButton = new SaxButton() + { + Text = favouriteAction., + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center + }; + favouriteActionButton.Clicked += delegate () { }; + } + */ + foreach (SaxButton favouriteActionButton in favouriteActionButtons) + { + gridRowIdx++; + gridConfig.Children.Add(favouriteActionButton, 0, gridRowIdx); + Grid.SetColumnSpan(favouriteActionButton, 2); + } + + // Subscribe to session profile proerty change event. + SlmGlobals_Mobile.SessionProfile.PropertyModified += SessionProfile_PropertyModified; + } + + //------------------------------------------------------------------- + // S e s s i o n P r o f i l e E v e n t s + //------------------------------------------------------------------- + private void SessionProfile_PropertyModified (object sender, EventArgs e) + { + configComponents.RefreshProperties(); + } + + //------------------------------------------------------------------- + // C o n f i g u r e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control configuration that can be changed dynamically. + protected override void ConfigureComponents () + { + } + + //------------------------------------------------------------------- + // P a n e l A c t i o n s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + } + protected override void SetControlsReadOnly () + { + } + + //------------------------------------------------------------------- + // P a n e l E v e n t s + //------------------------------------------------------------------- + protected override void OnParentSet () + { + base.OnParentSet(); + } + //------------------------------------------------------------------- + protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanging(propertyName); + } + protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanged(propertyName); + } + //------------------------------------------------------------------- + protected override void OnSizeAllocated (double width, double height) + { + base.OnSizeAllocated(width, height); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs new file mode 100644 index 0000000..1b1aca1 --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs @@ -0,0 +1,149 @@ +using Sarand.Core.Base; +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.Core.Mobile.Forms.Panels; +using Sarand.LogisticsMgr.Core.WebService; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Forms.Components; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main +{ + //======================================================================= + public abstract class SlmMainPanel_ItemList : SlmMainPanel + { + //------------------------------------------------------------------- + // Definitions. + public new class Config : SlmMainPanel.Config + { + } + + //------------------------------------------------------------------- + // Data members + private Config config; + private SlmGrid viewGrid = new SlmGrid(); + + //------------------------------------------------------------------- + // Construction. + protected SlmMainPanel_ItemList (Config config) : + base(config) + { + this.config = config; + } + + //------------------------------------------------------------------- + // Properties. + public ushort ItemsPerPage { get; protected set; } = 8; + protected SaxPanel_ItemListHeader HeaderPanel { get; private set; } + protected SlmWebView ItemListWebView { get; private set; } = new SlmWebView(); + + //------------------------------------------------------------------- + // I n i t i l i a s e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control initialisation on construction. + protected virtual void InitialiseComponents () + { + // Configuration grid. + viewGrid.BackgroundColor = Color.Transparent; + viewGrid.VerticalOptions = LayoutOptions.FillAndExpand; + HeightRequest = 1; + Content = viewGrid; + viewGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + viewGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); + int gridRowIdx = -1; + + // Header panel. + SaxPanel_ItemListHeader.Config headerPanelConfig = new SaxPanel_ItemListHeader.Config(); + headerPanelConfig.Caption = "Assets - Movements"; + headerPanelConfig.FilterPropertyTypes.AddRange(GetFilterPropertyTypes()); + HeaderPanel = new SaxPanel_ItemListHeader(headerPanelConfig); + gridRowIdx++; + viewGrid.Children.Add(HeaderPanel, 0, gridRowIdx); + // Paging events. + HeaderPanel.PagingAction += PanelHeader_PagingAction; + // Filter events. + HeaderPanel.PanelFilter.FilterChanged += PanelFilter_FilterChanged; + + // Item list view. + ItemListWebView = new SlmWebView() + { + HorizontalOptions = LayoutOptions.FillAndExpand, + VerticalOptions = LayoutOptions.FillAndExpand + }; + gridRowIdx++; + viewGrid.Children.Add(ItemListWebView, 0, gridRowIdx); + DisplayItemList(null); + } + + //------------------------------------------------------------------- + // C o n f i g u r e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control configuration that can be changed dynamically. + protected override void ConfigureComponents () + { + } + + //------------------------------------------------------------------- + // I t e m L i s t + //------------------------------------------------------------------- + protected abstract List GetFilterPropertyTypes (); + protected abstract void RefreshItemList (uint pageNo = 1); + protected abstract void DisplayItemList (SlmWebServiceClient.ItemListResponseData responseData, SacsMessage message = null); + + //------------------------------------------------------------------- + // P a n e l A c t i o n s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + } + protected override void SetControlsReadOnly () + { + } + + //------------------------------------------------------------------- + // P a n e l E v e n t s + //------------------------------------------------------------------- + protected void PanelHeader_PagingAction (object sender, SaxPanel_ItemListHeader.PagingActionEventArgs e) + { + uint pageNo = HeaderPanel.PageNo; + ushort pageLength = HeaderPanel.PageLength; + int totalItems = HeaderPanel.TotalItems; + uint lastPage = (totalItems > 0 && pageLength > 0) ? (uint)Math.Ceiling((double)totalItems / pageLength) : 1; + switch (e.PagingActionType) + { + case SaxPanel_ItemListHeader.PagingActionType.First: + pageNo = 1; + break; + case SaxPanel_ItemListHeader.PagingActionType.Prev: + if (pageNo > 1) pageNo--; + break; + case SaxPanel_ItemListHeader.PagingActionType.Next: + if (pageNo < lastPage) pageNo++; + break; + case SaxPanel_ItemListHeader.PagingActionType.Last: + pageNo = lastPage; + break; + } + RefreshItemList(pageNo); + } + //------------------------------------------------------------------- + /// + /// Filter properties in header panel has changed. + /// + protected void PanelFilter_FilterChanged (object sender, SaxPanel_ItemFilter.FilterChangedEventArgs e) + { + RefreshItemList(); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs new file mode 100644 index 0000000..c5316aa --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs @@ -0,0 +1,268 @@ +using Sarand.Core.App; +using Sarand.Core.Base; +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.Core.Mobile.Utils; +using Sarand.Core.Tasks; +using Sarand.Core.Xml; +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Core.WebService; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Forms.Components; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main +{ + //======================================================================= + public class SlmMainPanel_Login : SlmMainPanel + { + //------------------------------------------------------------------- + // Definitions. + public new class Config : SlmMainPanel.Config + { + } + + //------------------------------------------------------------------- + // Data members + private Config config; + private Image imageLogo = new Image(); + private SlmComponents_Login loginComponents = new SlmComponents_Login(); + private SlmGrid componentGrid = new SlmGrid(); + private SaxButton buttonLogin = new SaxButton() { Text = "Login" }; + + //------------------------------------------------------------------- + // Construction. + public SlmMainPanel_Login (Config config) : + base(config) + { + this.config = config; + InitialiseComponents(); + } + + //------------------------------------------------------------------- + // Properties. + public String Title { get; } = "Login"; + public SlmSiteDefinition SiteDefinition { get { return loginComponents.PickerSite.SelectedSiteDefinition; } } + public String EmailAddress { get { return loginComponents.EntryEmail.Text; } } + private String Password { get { return loginComponents.EntryPassword.Text; } } + + //------------------------------------------------------------------- + // I n i t i l i a s e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control initialisation on construction. + protected void InitialiseComponents () + { + // Options grid. + Content = componentGrid; + componentGrid.BackgroundColor = SlmMobile.PageBackgroundColor; + componentGrid.Padding = new Thickness(4.0); + componentGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); + componentGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); + componentGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); + int gridRowIdx = -1; + + // Logo. + gridRowIdx++; + imageLogo.Source = SacsImageUtils.GetImageFromByteArray(SlmResourceConsole.GetImageResource(SlmResourceConsole.ImageResource.Logo_Solent_Stevedores_78_png)); + imageLogo.Margin = new Thickness(0, 4, 0, 4); + componentGrid.Children.Add(imageLogo, 0, gridRowIdx); + Grid.SetColumnSpan(imageLogo, 2); + + // Site. + gridRowIdx++; + componentGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + componentGrid.Children.Add(loginComponents.LabelSite, 0, gridRowIdx); + componentGrid.Children.Add(loginComponents.PickerSite, 1, gridRowIdx); + + // Email. + gridRowIdx++; + componentGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + componentGrid.Children.Add(loginComponents.LabelEmail, 0, gridRowIdx); + componentGrid.Children.Add(loginComponents.EntryEmail, 1, gridRowIdx); + Grid.SetColumnSpan(loginComponents.EntryEmail, 2); + if (SacsSystem.DebugMode) loginComponents.EntryEmail.Text = "andy@sarand.com"; + + // Password. + gridRowIdx++; + componentGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + componentGrid.Children.Add(loginComponents.LabelPassword, 0, gridRowIdx); + componentGrid.Children.Add(loginComponents.EntryPassword, 1, gridRowIdx); + Grid.SetColumnSpan(loginComponents.EntryPassword, 2); + + // Login action button. + gridRowIdx++; + componentGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + buttonLogin.VerticalOptions = LayoutOptions.Start; + buttonLogin.Padding = new Thickness(4, 4); + buttonLogin.Clicked += ButtonLogin_Clicked; + componentGrid.Children.Add(buttonLogin, 2, gridRowIdx); + + componentGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star }); + } + + //------------------------------------------------------------------- + // C o n f i g u r e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control configuration that can be changed dynamically. + protected override void ConfigureComponents () + { + } + + //------------------------------------------------------------------- + // P a n e l A c t i o n s + //------------------------------------------------------------------- + private bool requestingUserProfile = false; + private SacsTaskData userProfileRequestTaskData; + private void ButtonLogin_Clicked (object sender, EventArgs e) + { + String fn = GetType().Name+".ButtonLogin_Clicked"; + // Validate login properties. + SlmSiteDefinition siteDefinition = SiteDefinition; + if (siteDefinition == null) + { + DisplayAlert(Title, "Please select a site.", "OK"); + return; + } + String emailAddress = EmailAddress; + if (StringUtil.IsEmpty(emailAddress)) + { + DisplayAlert(Title, "Please enter your email address.", "OK"); + return; + } + String password = Password; + // Request User Profile. + SacsTaskData taskData = (userProfileRequestTaskData = new SacsTaskData(null)); + requestingUserProfile = true; + SetControlActivity(); + Task.Run(async () => + { + try + { + SlmWebServiceClient.ItemDataResponseData responseData = + await RequestUserProfile(siteDefinition, emailAddress, password, taskData); + // Interpret response. + Device.BeginInvokeOnMainThread(() => + { + ValidateUserProfile(responseData); + }); + } + catch (Exception exc) { Logger.Debug(fn + " " + exc.GetLogMessage()); } + finally + { + requestingUserProfile = false; + Device.BeginInvokeOnMainThread(() => + { + SetControlActivity(); + }); + } + }, taskData.CancellationToken) + .ContinueWith((task) => + { + // Clear task data. + taskData.Dispose(); + if (userProfileRequestTaskData == taskData) userProfileRequestTaskData = null; + }); + } + private SlmWebServiceClient webServiceClient = new SlmWebServiceClient(); + private async Task RequestUserProfile (SlmSiteDefinition siteDefinition, String emailAddress, String password, SacsTaskData taskData) + { + // Configure Web Service request data. + SlmWebServiceRequest.Config configRequest = new SlmWebServiceRequest.Config(); + configRequest.DataType = SlmWebServiceRequest.DataType.UserProfile; + configRequest.RequestType = SlmWebServiceRequest.RequestType.Data; + configRequest.Context.SiteDefinition = siteDefinition; + configRequest.Context.Debug = SacsSystem.DebugMode; + // User filter. + Dictionary filter = new Dictionary(); + filter.Add("EmailAddress", emailAddress); + filter.Add("IncludeSecurityProfile", "true"); + // Request User profile. + return await webServiceClient.GetItemData(configRequest, filter, taskData); + } + + //------------------------------------------------------------------- + private void ValidateUserProfile (SlmWebServiceClient.ItemDataResponseData responseData) + { + // Validate user. + if (responseData.Item == null) + { + String msg = "Unable to login to server"; + if (responseData.ResponseElement == null) + msg = "Unable to login - failed to communicate with server"; + DisplayAlert(Title, msg, "Close"); + return; + } + //Logger.Debug(SacsXmlUtil.FormatXml(responseData.ResponseDoc)); + + // Load user details to Sesion Profile. + if (!SlmGlobals_Mobile.SessionProfile.LoginUser(SiteDefinition, responseData.Item)) + { + DisplayAlert(Title, "Failed to load user profile.", "Close"); + return; + } + + OnSuccessfulLogin(); + } + + //------------------------------------------------------------------- + private void OnSuccessfulLogin () + { + // Inform listeners that login is done. + UserLoginEventArgs userLoginEventArgs = new UserLoginEventArgs() + { + SiteDefinition = this.SiteDefinition, + EmailAddress = this.EmailAddress + }; + if (UserLogin != null) UserLogin.Invoke(this, userLoginEventArgs); + } + // User Login event. + public class UserLoginEventArgs : EventArgs + { + public SlmSiteDefinition SiteDefinition { get; set; } + public String EmailAddress { get; set; } + public String Password { get; set; } + } + public event EventHandler UserLogin; + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + buttonLogin.IsEnabled = !requestingUserProfile; + } + protected override void SetControlsReadOnly () + { + } + + //------------------------------------------------------------------- + // P a n e l E v e n t s + //------------------------------------------------------------------- + protected override void OnParentSet () + { + base.OnParentSet(); + } + //------------------------------------------------------------------- + protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanging(propertyName); + } + protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanged(propertyName); + } + //------------------------------------------------------------------- + protected override void OnSizeAllocated (double width, double height) + { + base.OnSizeAllocated(width, height); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ShipFile.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ShipFile.cs new file mode 100644 index 0000000..d67f9bf --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ShipFile.cs @@ -0,0 +1,113 @@ +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Forms.Components; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main +{ + //======================================================================= + public class SlmMainPanel_ShipFile : SlmMainPanel + { + //------------------------------------------------------------------- + // Definitions. + public new class Config : SlmMainPanel.Config + { + } + + //------------------------------------------------------------------- + // Data members + private Config config; + private SlmGrid viewGrid = new SlmGrid(); + + //------------------------------------------------------------------- + // Construction. + public SlmMainPanel_ShipFile (Config config) : + base(config) + { + this.config = config; + InitialiseComponents(); + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // I n i t i l i a s e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control initialisation on construction. + protected void InitialiseComponents () + { + // Configuration grid. + Content = viewGrid; + viewGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); + viewGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); + int gridRowIdx = -1; + + // Caption. + gridRowIdx++; + viewGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + SaxLabel labelCaption = new SaxLabel() { Text="Ship File"}; + viewGrid.Children.Add(labelCaption, 0, gridRowIdx); + Grid.SetColumnSpan(labelCaption, 2); + } + + //------------------------------------------------------------------- + // S e s s i o n P r o f i l e E v e n t s + //------------------------------------------------------------------- + private void SessionProfile_PropertyModified (object sender, EventArgs e) + { + } + + //------------------------------------------------------------------- + // C o n f i g u r e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control configuration that can be changed dynamically. + protected override void ConfigureComponents () + { + } + + //------------------------------------------------------------------- + // P a n e l A c t i o n s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + } + protected override void SetControlsReadOnly () + { + } + + //------------------------------------------------------------------- + // P a n e l E v e n t s + //------------------------------------------------------------------- + protected override void OnParentSet () + { + base.OnParentSet(); + } + //------------------------------------------------------------------- + protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanging(propertyName); + } + protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanged(propertyName); + } + //------------------------------------------------------------------- + protected override void OnSizeAllocated (double width, double height) + { + base.OnSizeAllocated(width, height); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs index 7d1d15a..be89a52 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs @@ -1,9 +1,11 @@ -using Sarand.LogisticsMgr.Mobile.App; +using Sarand.Core.Mobile.Forms.Views; +using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using System; using System.Collections.Generic; using System.Text; +using System.Windows.Input; using Xamarin.Forms; namespace Sarand.LogisticsMgr.Mobile.Forms.Views @@ -17,8 +19,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views { public String Caption { get; set; } public bool Heading { get; set; } - public delegate void OnMenuOptionClicked (); - public OnMenuOptionClicked ClickedFn { get; set; } + public ICommand Command { get; set; } public ImageSource ImageSource { get; set; } } @@ -37,39 +38,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views Padding = new Thickness(SlmMobile.MenuBorder, 0, 0, SlmMobile.MenuBorder); // Menu grid. - menuGrid.BackgroundColor = Color.FromHex("#F0F0F0"); - menuGrid.Padding = new Thickness(4,8); + menuGrid.BackgroundColor = SlmMobile.MenuBackgroundColor; + menuGrid.Padding = new Thickness(4, 8); menuGrid.RowSpacing = 2.0; menuGrid.ColumnSpacing = 2.0; - menuGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(48) }); + menuGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(32) }); menuGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); scrollView.Content = menuGrid; - - // Populate menu options. - int optionIdx = -1; - foreach (OptionData option in MenuOptions) - { - optionIdx++; - menuGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - Image optionImage = null; - if (option.ImageSource != null) - { - optionImage = new Image() { Source = option.ImageSource, HeightRequest = 24, WidthRequest = 24 }; - menuGrid.Children.Add(optionImage, 0, optionIdx); - } - SlmLabel optionLabel = new SlmLabel() { Text = option.Caption, HeightRequest = 24, BackgroundColor = Color.Transparent }; - if (option.Heading) - optionLabel.FontAttributes = FontAttributes.Bold; - menuGrid.Children.Add(optionLabel, 1, optionIdx); - if (option.ClickedFn != null) - { - var tapGestureRecognizer = new TapGestureRecognizer(); - tapGestureRecognizer.Tapped += (s, e) => { option.ClickedFn(); }; - optionLabel.GestureRecognizers.Add(tapGestureRecognizer); - if (optionImage != null) - optionImage.GestureRecognizers.Add(tapGestureRecognizer); - } - } } //------------------------------------------------------------------- @@ -77,14 +52,63 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views public virtual List MenuOptions { get; } public double MenuHeight => menuGrid.Height + menuGrid.Padding.Top + menuGrid.Padding.Bottom + SlmMobile.MenuBorder; + //------------------------------------------------------------------- + public void RefreshMenuOptions () + { + // Populate menu options. + menuGrid.Children.Clear(); + int gridRowIdx = -1; + foreach (OptionData option in MenuOptions) + { + gridRowIdx++; + menuGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + // Menu header background colour. + if (option.Heading) + { + SaxBoxView headerBackgroundView = new SaxBoxView() { BackgroundColor = SlmMobile.MenuHeaderBackgroundColor }; + menuGrid.Children.Add(headerBackgroundView, 0, gridRowIdx); + Grid.SetColumnSpan(headerBackgroundView, 2); + } + // Menu option image. + Image optionImage = null; + if (option.ImageSource != null) + { + optionImage = new Image() { Source = option.ImageSource, HeightRequest = 24, WidthRequest = 24 }; + menuGrid.Children.Add(optionImage, 0, gridRowIdx); + } + SlmLabel optionLabel = new SlmLabel() + { + Text = option.Caption, + HeightRequest = 24, + BackgroundColor = Color.Transparent + }; + if (option.Heading) + optionLabel.FontAttributes = FontAttributes.Bold; + menuGrid.Children.Add(optionLabel, 1, gridRowIdx); + if (option.Command?.CanExecute(null) ?? false) + { + var tapGestureRecognizer = new TapGestureRecognizer(); + tapGestureRecognizer.Tapped += (s, e) => { option.Command.Execute(null); InvokeMenuOptionClicked(); }; + optionLabel.GestureRecognizers.Add(tapGestureRecognizer); + if (optionImage != null) + optionImage.GestureRecognizers.Add(tapGestureRecognizer); + } + } + } + //------------------------------------------------------------------- // M e n u E v e n t s //------------------------------------------------------------------- + protected override void OnParentSet () + { + base.OnParentSet(); + RefreshMenuOptions(); + } public class MenuOptionClickedEventArgs : EventArgs { } public event EventHandler MenuOptionClicked; - protected void OnMenuOptionClicked () + protected void InvokeMenuOptionClicked () { if (MenuOptionClicked != null) MenuOptionClicked.Invoke(this, new MenuOptionClickedEventArgs() { }); } diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmApplication.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmApplication.cs index 6a3a6df..52b34d8 100644 --- a/SaLogMgrMobCore/Mobile/Core/App/SlmApplication.cs +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmApplication.cs @@ -4,6 +4,7 @@ using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; using System; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; @@ -27,6 +28,17 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App //------------------------------------------------------------------- // Properties. + public SlmMobile.Platform MobilePlatform { get; protected set; } + public Page CurrentPage + { + get + { + return + MainPage.Navigation.ModalStack.LastOrDefault() + ?? MainPage.Navigation.NavigationStack.LastOrDefault() + ?? MainPage; + } + } //------------------------------------------------------------------- // W e b S e r v i c e @@ -46,10 +58,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App //------------------------------------------------------------------- // P e r s i s t e n t S e s s i o n P r o p e r t i e s //------------------------------------------------------------------- + public String DefaultEmailAddress { get; set; } protected static String PropertyName_Context_Site_Code { get; } = "Context-Site-Code"; protected static String PropertyName_Context_Site_Url { get; } = "Context-Site-Url"; - protected static String PropertyName_Context_User { get; } = "Context-User"; - protected static String PropertyName_Context_Email { get; } = "Context-Email"; + protected static String PropertyName_Context_EmailAddress { get; } = "Context-Email"; public void RestorePersistentSessionProperties () { SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile; @@ -57,8 +69,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App // Retrieve all session properties first before populating to session. Object sessionSiteCode = Properties.GetValue(PropertyName_Context_Site_Code, SlmSystem.GetSiteCode(sessionProfile.Site)); Object sessionSiteUrl = Properties.GetValue(PropertyName_Context_Site_Url, sessionProfile.SiteDefinition != null ? sessionProfile.SiteDefinition.URL : ""); - Object sessionUser = Properties.GetValue(PropertyName_Context_User, sessionProfile.User); - Object sessionEmail = Properties.GetValue(PropertyName_Context_Email, sessionProfile.Email); + Object sessionEmail = Properties.GetValue(PropertyName_Context_EmailAddress, sessionProfile.EmailAddress); // Populate session properties. // Site definition. if (sessionSiteCode != null && sessionSiteUrl != null) @@ -73,8 +84,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App } } // User & Email. - if (sessionUser != null) sessionProfile.User = sessionUser.ToString(); - if (sessionEmail != null) sessionProfile.Email = sessionEmail.ToString(); + if (sessionEmail != null) DefaultEmailAddress = sessionEmail.ToString(); } public void StorePersistentSessionProperties () { @@ -82,8 +92,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App if (sessionProfile == null) return; Properties[PropertyName_Context_Site_Code] = SlmSystem.GetSiteCode(sessionProfile.Site); Properties[PropertyName_Context_Site_Url] = sessionProfile.SiteDefinition.URL; - Properties[PropertyName_Context_User] = sessionProfile.User; - Properties[PropertyName_Context_Email] = sessionProfile.Email; + Properties[PropertyName_Context_EmailAddress] = sessionProfile.EmailAddress; } //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmCommand_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmCommand_Mobile.cs new file mode 100644 index 0000000..0b6d04b --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmCommand_Mobile.cs @@ -0,0 +1,35 @@ +using Sarand.LogisticsMgr.Core.App; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.Core.App +{ + //======================================================================= + public class SlmCommand_Mobile : SlmCommand + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmCommand_Mobile (ExecuteFn executeFn, CanExecuteFn canExecuteFn = null) : + base(executeFn, canExecuteFn) + { + } + + //------------------------------------------------------------------- + // Properties. + public SlmApplication Application { get { return SlmGlobals_Mobile.Application; } } + public SlmMobile.Platform MobilePlatform { get { return Application.MobilePlatform; } } + // Session. + protected SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } + protected Slm.Site Site { get { return SessionProfile.Site; } } + // User. + protected SlmUserContext_Mobile UserContext { get { return SessionProfile.UserContext_Mobile; } } + protected SlmSecurityProfile SecurityProfile { get { return UserContext.SecurityProfile; } } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs index bc841d4..ad0793e 100644 --- a/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs @@ -27,21 +27,38 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App // Utilities. public static Random Random { get; } = new Random(); + //------------------------------------------------------------------- + // Application. + public enum MainView + { + Unknown = 0, + // System. + Login, + Home, + // Bulk. + ShipFile, + // Containers. + AssetMovements + } + //------------------------------------------------------------------- // Localisation. - public static CultureInfo CultureInfo => CultureInfo.CurrentCulture; - public static TextInfo TextInfo => CultureInfo.TextInfo; + public static CultureInfo CultureInfo { get; } = CultureInfo.CurrentCulture; + public static TextInfo TextInfo { get; } = CultureInfo.TextInfo; //------------------------------------------------------------------- // Application styling. - public static double ApplicationBarHeight = 28; - public static Color ApplicationBarBackgroundColor = Color.FromHex("#558395"); - public static Color ApplicationBarTextColor = Color.FromHex("#f8f8f8"); - public static double ApplicationBarTextSizeRatio = 1.5; - public static Color ApplicationBarBorderColor = Color.DarkSlateBlue; - public static double ApplicationBarBorderBottom = 1.0; - public static Color MenuBorderColor = Color.DarkSlateBlue; - public static double MenuBorder = 1.0; + public static double ApplicationBarHeight { get; } = 28; + public static Color ApplicationBarBackgroundColor { get; } = Color.FromHex("#558395"); + public static Color ApplicationBarTextColor { get; } = Color.FromHex("#f8f8f8"); + public static double ApplicationBarTextSizeRatio { get; } = 1.5; + public static Color ApplicationBarBorderColor { get; } = Color.DarkSlateBlue; + public static double ApplicationBarBorderBottom { get; } = 1.0; + // Menu. + public static Color MenuBorderColor { get; } = Color.DarkSlateBlue; + public static double MenuBorder { get; } = 1.0; + public static Color MenuBackgroundColor { get; } = Color.FromHex("#F0F0F0"); + public static Color MenuHeaderBackgroundColor { get; } = Color.FromHex("#E0E0E0"); // Dynamic font sizing. public static double FontSizeRatio { @@ -54,29 +71,29 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App } } // Pages. - public static Color PageCaptionBackgroundColor = Color.FromHex("#558395"); - public static double PageCaptionPaddingHorizontal = 4.0; - public static double PageCaptionPaddingVertical = 8.0; - public static Color PageCaptionTextColor = Color.FromHex("#f8f8f8"); - public static double PageCaptionTextSizeRatio = 1.25; - public static Color PageBaseColor = Color.FromHex("#c8e8f5"); - public static Color PageBackgroundColor = Color.FromHex("#e9f6fb"); - public static double PageBodyPaddingVerticalMin = 4.0; - public static double PageBodyPaddingHorizontalMin = 4.0; - public static double PageNavigationBorderTopWidth = 0.75; - public static double PageNavigationPaddingVertical = 4.0; - public static Color PageNavigationBorderColor = Color.FromHex("#808080"); - public static Color PageNavigationBackgroundColor = Color.FromHex("#e9f6fb"); + public static Color PageCaptionBackgroundColor { get; } = Color.FromHex("#558395"); + public static double PageCaptionPaddingHorizontal { get; } = 4.0; + public static double PageCaptionPaddingVertical { get; } = 8.0; + public static Color PageCaptionTextColor { get; } = Color.FromHex("#f8f8f8"); + public static double PageCaptionTextSizeRatio { get; } = 1.25; + public static Color PageBaseColor { get; } = Color.FromHex("#c8e8f5"); + public static Color PageBackgroundColor { get; } = Color.FromHex("#e9f6fb"); + public static double PageBodyPaddingVerticalMin { get; } = 4.0; + public static double PageBodyPaddingHorizontalMin { get; } = 4.0; + public static double PageNavigationBorderTopWidth { get; } = 0.75; + public static double PageNavigationPaddingVertical { get; } = 4.0; + public static Color PageNavigationBorderColor { get; } = Color.FromHex("#808080"); + public static Color PageNavigationBackgroundColor { get; } = Color.FromHex("#e9f6fb"); // Controls. - public static Color ControlBackgroundColor = Color.FromHex("#f8f8f8"); - public static Color ControlBorderColor = Color.FromHex("#f8f8f8"); - public static double ControlBorderWidth = 0.5; + public static Color ControlBackgroundColor { get; } = Color.FromHex("#f8f8f8"); + public static Color ControlBorderColor { get; } = Color.FromHex("#f8f8f8"); + public static double ControlBorderWidth { get; } = 0.5; public static Thickness LabelMargin { get; } = new Thickness(4.0, 8.0, 0, 0); // Associated items panel. - public static Color AssociatedItemsCaptionBackgroundColor = Color.FromHex("#becee4"); - public static Color AssociatedItemsCaptionTextColor = Color.FromHex("#f8f8f8"); - public static double AssociatedItemsCaptionTextSizeRatio = 1.2; - public static Color AssociatedItemsBackgroundColor = Color.FromHex("#dbe4f0"); + public static Color AssociatedItemsCaptionBackgroundColor { get; } = Color.FromHex("#becee4"); + public static Color AssociatedItemsCaptionTextColor { get; } = Color.FromHex("#f8f8f8"); + public static double AssociatedItemsCaptionTextSizeRatio { get; } = 1.2; + public static Color AssociatedItemsBackgroundColor { get; } = Color.FromHex("#dbe4f0"); //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmSecurityProfile_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmSecurityProfile_Mobile.cs new file mode 100644 index 0000000..c474d56 --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmSecurityProfile_Mobile.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using Sarand.Core.App; +using Sarand.Core.Base; +using Sarand.Core.Bus; +using Sarand.Core.Security; +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Core.WebService; + +namespace Sarand.LogisticsMgr.Mobile.Core.App +{ + //======================================================================= + public class SlmSecurityProfile_Mobile : SlmSecurityProfile + { + //------------------------------------------------------------------- + // Base security profile - for raw User and Computer Security Groups and Rights. + protected class SaSecurityProfile_Mobile : SaSecurityProfile + { + public class GroupData_Mobile : GroupData + { + public GroupData_Mobile(SlmWebServiceItemData securityGroup) + { + GroupId = securityGroup.GetIdValue("Id"); + GroupCode = securityGroup.GetValue("Code"); + GroupDesc = securityGroup.GetValue("Description"); + } + } + public class RightData_Mobile : RightData + { + public RightData_Mobile (SlmWebServiceItemData securityRight) + { + RightId = securityRight.GetIdValue("Id"); + RightCode = securityRight.GetValue("Code"); + RightDesc = securityRight.GetValue("Description"); + DataItemId = securityRight.GetIdValue("ItemIdContext"); + Granted = securityRight.GetBoolValue("Granted"); + } + } + public SaSecurityProfile_Mobile (SlmWebServiceItemData securityItem) + { + // Security item properties. + Id = securityItem.GetIdValue("Id"); + SecurityItemType = EnumUtil.ParseEnum(securityItem.GetValue("ItemType"), SaSecurity.ItemType.Unknown); + Code = securityItem.GetValue("Code"); + EmailAddress= securityItem.GetValue("EmailAddress"); + Description = securityItem.GetValue("Description"); + Location = securityItem.GetValue("Location"); + LastLogin = securityItem.GetDateValue("LastLogin"); + + // Security Groups. + if (securityItem.ChildItems.ContainsKey("SecurityGroupList")) + { + foreach (SlmWebServiceItemData securityGroup in securityItem.ChildItems["SecurityGroupList"]) + { + GroupData_Mobile groupData = new GroupData_Mobile(securityGroup); + foreach (SlmWebServiceItemData securityRight in securityGroup.ChildItems["SecurityRightList"]) + groupData.rights.Add(new RightData_Mobile(securityRight)); + securityGroups.Add(groupData); + } + } + // Security Rights. + foreach (SlmWebServiceItemData securityRight in securityItem.ChildItems["SecurityRightList"]) + securityRights.Add(new RightData_Mobile(securityRight)); + } + } + + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmSecurityProfile_Mobile () : base(false) + { + } + + //------------------------------------------------------------------- + // Refresh profile. + public bool RefreshProfile (SlmSiteDefinition siteDefinition, SlmWebServiceItemData securityItem) + { + String fn = GetType().Name+".RefreshProfile"; + ClearErrorState(); + + // Session context. + SysId previousUserId = UserId; + + // Construct User Security Profile. + SaSecurityProfile userProfile = new SaSecurityProfile_Mobile(securityItem); + UserId = SysId.InvalidOnNull(userProfile.Id); + Logger.Debug(fn + " User: '" + UserDisplayName + "' [Id: " + UserId + "]" + (SysId.IsValid(previousUserId) ? ". Previous UserId: " + SysId.ToString(previousUserId) : "")); + RefreshProfile(userProfile, null); + return SysId.IsValid(UserId) && SysId.InvalidOnNull(UserId).Equals(SysId.InvalidOnNull(userProfile.Id)); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmSessionContext_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmSessionContext_Mobile.cs index d0cd101..1729f7b 100644 --- a/SaLogMgrMobCore/Mobile/Core/App/SlmSessionContext_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmSessionContext_Mobile.cs @@ -10,21 +10,23 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App { //------------------------------------------------------------------- // Definitions. + private class SlmSiteDefinition_Mobile : SlmSiteDefinition { } //------------------------------------------------------------------- // Data members. //------------------------------------------------------------------- // Construction. - public SlmSessionContext_Mobile(SlmSiteDefinition siteDefinition) + protected SlmSessionContext_Mobile (SlmSiteDefinition siteDefinition) : base(0) { + if (siteDefinition == null) siteDefinition = new SlmSiteDefinition_Mobile(); Site = (siteDefinition != null ? siteDefinition.Site : Slm.Site.Unknown); SiteDefinition = siteDefinition; } //------------------------------------------------------------------- // Properties. - public SlmSiteDefinition SiteDefinition { get; private set; } + public SlmSiteDefinition SiteDefinition { get; protected set; } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmSessionProfile_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmSessionProfile_Mobile.cs index 87ec90d..2cc51e7 100644 --- a/SaLogMgrMobCore/Mobile/Core/App/SlmSessionProfile_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmSessionProfile_Mobile.cs @@ -1,4 +1,5 @@ using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Core.WebService; using System; using System.Collections.Generic; using System.Text; @@ -6,57 +7,59 @@ using System.Text; namespace Sarand.LogisticsMgr.Mobile.Core.App { //======================================================================= - public class SlmSessionProfile_Mobile + public class SlmSessionProfile_Mobile : SlmSessionProfile { //------------------------------------------------------------------- - // Data members. - public class SessionData + // Definitions. + private class SlmUserContext_Mobile_Internal : SlmUserContext_Mobile { - public SlmSessionContext_Mobile SessionContext = new SlmSessionContext_Mobile(null); - public String User { get; set; } = ""; - public String Email { get; set; } = ""; + internal void SetSiteDefinition (SlmSiteDefinition siteDefinition) + { + sessionContext_Mobile.SetSiteDefinition(siteDefinition); + } + // Refresh user. + internal void RefreshUser (SlmWebServiceItemData securityItem) + { + // Populate User details. + userData_Mobile.Refresh(securityItem); + // Populate Security Profile. + SecurityProfile_Mobile.RefreshProfile(SessionContext_Mobile.SiteDefinition, securityItem); + } } - private readonly SessionData session = new SessionData(); + + //------------------------------------------------------------------- + // Data members. + private readonly SlmUserContext_Mobile_Internal userContext_Local; //------------------------------------------------------------------- // Construction. protected SlmSessionProfile_Mobile () { + UserContext = (userContext_Local = new SlmUserContext_Mobile_Internal()); } //------------------------------------------------------------------- // Properties. - public SlmSessionContext_Mobile SessionContext { get { return session.SessionContext; } } - public SlmSiteDefinition SiteDefinition { get { return session.SessionContext.SiteDefinition; } } - public Slm.Site Site { get { return session.SessionContext.Site; } } - public String SiteCode { get { return session.SessionContext.SiteCode; } } - public String User + // Session. + public SlmSessionContext_Mobile SessionContext_Mobile { get { return userContext_Local.SessionContext_Mobile; } } + public SlmSiteDefinition SiteDefinition { - get { return session.User; } - set - { - if (session.User.Equals(value)) return; - session.User = value; - OnPropertyModified(ModifiedProperty.User); - } - } - public String Email - { - get { return session.Email; } - set - { - if (session.Email.Equals(value)) return; - session.Email = value; - OnPropertyModified(ModifiedProperty.Email); - } + get { return SessionContext_Mobile.SiteDefinition; } + protected set { userContext_Local.SetSiteDefinition(value); } } + // User. + public SlmUserContext_Mobile UserContext_Mobile { get { return userContext_Local; } } + public String UserCode { get { return userContext_Local.User.SecurityItemCode; } } + public String EmailAddress { get { return userContext_Local.User.EmailAddress; } } //------------------------------------------------------------------- - // S i t e + // U s e r S e s s i o n //------------------------------------------------------------------- - protected void SetSiteDefinition (SlmSiteDefinition siteDefinition) + public bool LoginUser (SlmSiteDefinition siteDefinition, SlmWebServiceItemData securityItem) { - session.SessionContext = new SlmSessionContext_Mobile(siteDefinition); + userContext_Local.RefreshUser(securityItem); + SlmGlobals_Mobile.Application.SetSite(siteDefinition); + return UserContext.ValidUser && SiteDefinition.Valid; } //------------------------------------------------------------------- @@ -65,8 +68,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App public enum ModifiedProperty { Site, - User, - Email, + EmailAddress, } public class PropertyModifiedEventArgs : EventArgs { @@ -76,7 +78,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App public event ModifiedEventHandler PropertyModified; private void OnPropertyModified (ModifiedProperty property) { - if (PropertyModified != null) PropertyModified.Invoke(this, new PropertyModifiedEventArgs() { Property = property}); + if (PropertyModified != null) PropertyModified.Invoke(this, new PropertyModifiedEventArgs() { Property = property }); } //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmSiteDefinition.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmSiteDefinition.cs index 3eb17f8..3e9e4d3 100644 --- a/SaLogMgrMobCore/Mobile/Core/App/SlmSiteDefinition.cs +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmSiteDefinition.cs @@ -17,6 +17,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App //------------------------------------------------------------------- // Construction. + protected SlmSiteDefinition () : + base(Slm.Site.Unknown, "", "") + { + } protected SlmSiteDefinition (Slm.Site site, String caption, String url) : base(site, caption, url) { diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmUserContext_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmUserContext_Mobile.cs new file mode 100644 index 0000000..25c818b --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmUserContext_Mobile.cs @@ -0,0 +1,56 @@ +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Core.WebService; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.Core.App +{ + //======================================================================= + public class SlmUserContext_Mobile : SlmUserContext + { + //------------------------------------------------------------------- + // Definitions. + protected class UserData_Mobile : UserData + { + public void Refresh (SlmWebServiceItemData securityItem) + { + SecurityItemId = securityItem.GetIdValue("Id"); + SecurityItemCode = securityItem.GetValue("Code"); + EmailAddress = securityItem.GetValue("EmailAddress"); + DisplayName = securityItem.GetValue("Description"); + } + } + protected class SlmSessionContext_Mobile_Internal : SlmSessionContext_Mobile + { + public SlmSessionContext_Mobile_Internal () : base(null) { } + public void SetSiteDefinition (SlmSiteDefinition siteDefinition) + { + SiteDefinition = siteDefinition; + Site = siteDefinition.Site; + } + } + + //------------------------------------------------------------------- + // Data members. + protected readonly SlmSessionContext_Mobile_Internal sessionContext_Mobile; + protected readonly UserData_Mobile userData_Mobile; + + //------------------------------------------------------------------- + // Construction - use derived objects. + public SlmUserContext_Mobile () + { + SessionContext = (sessionContext_Mobile = new SlmSessionContext_Mobile_Internal()); + User = (userData_Mobile = new UserData_Mobile()); + SecurityProfile = (SecurityProfile_Mobile = new SlmSecurityProfile_Mobile()); + } + + //------------------------------------------------------------------- + // Properties. + public SlmSessionContext_Mobile SessionContext_Mobile { get { return sessionContext_Mobile; } } + protected SlmSecurityProfile_Mobile SecurityProfile_Mobile { get; } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/CodeTypes/SlmCodeTypeConsole_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/CodeTypes/SlmCodeTypeConsole_Mobile.cs index 2e3798b..f2fd021 100644 --- a/SaLogMgrMobCore/Mobile/Core/CodeTypes/SlmCodeTypeConsole_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/CodeTypes/SlmCodeTypeConsole_Mobile.cs @@ -38,8 +38,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public Slm.Site Site { get { return SessionProfile.Site; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } public override bool DatabaseIsValid { get { return true; } } public override bool CanUpdateDatabase { get { return true; } } public bool Populating { get; private set; } = false; @@ -139,8 +139,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes configRequest.DataType = dataType; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; configRequest.SoapEnvelope = (SlmMobile.Random.Next(2) == 1); configRequest.SoapPrefix = new List() { "", "SOAP", "soap", "S", "s" }[SlmMobile.Random.Next(5)]; @@ -151,6 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes private async Task RequestRefreshData (RefreshTaskData refreshTaskData) { String fn = GetType().Name + ".RequestRefreshData"; + if (!SiteDefinition.Valid) return; try { // Slight delay before refresh (in case of immediate cancellation). @@ -164,10 +165,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes // Wait for all tasks to complete. Task.WaitAll(tasks.ToArray()); } - catch (Exception exc) - { - Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t")); - } + catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); } if (this.refreshTaskData == refreshTaskData) this.refreshTaskData = null; } @@ -329,39 +327,43 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes { return codeTypes.Exists(item => item.Code.EqualsCI(codeTypeCode)); } + public bool CodeTypeMatches (SaCodeType codeType, SaCodeType.Params prmCodeType) + { + if (prmCodeType.IncludedIds.Count > 0 && !prmCodeType.IncludedIds.Contains(codeType.Id)) return false; + if (prmCodeType.ExcludedIds.Count > 0 && prmCodeType.ExcludedIds.Contains(codeType.Id)) return false; + if (!StringUtil.IsEmpty(prmCodeType.Code) && !codeType.Code.EqualsCI(prmCodeType.Code)) return false; + if (!StringUtil.IsEmpty(prmCodeType.CodePartial) && !codeType.Code.ContainsCI(prmCodeType.CodePartial)) return false; + if (!StringUtil.IsEmpty(prmCodeType.Desc) && !codeType.Description.EqualsCI(prmCodeType.Desc)) return false; + if (!StringUtil.IsEmpty(prmCodeType.DescPartial) && !codeType.Description.ContainsCI(prmCodeType.DescPartial)) return false; + if (prmCodeType.StatusCat == SaCodeType.StatusCat.ActiveOnly && codeType.Status != SaCodeType.CurrentStatus) return false; + return true; + } public override int GetCodeTypeCount (SaCodeType.Params prmCodeType) { - return codeTypes.Count; + return GetCodeTypeList(prmCodeType).Count; } public SysId GetCodeTypeId (SaCodeType.Params prmCodeType) { SaCodeType codeType = GetCodeType(prmCodeType); - return (codeType != null ? codeType.Id : new SysId()); + return codeType?.Id ?? new SysId(); } public SysId GetCodeTypeId (String codeTypeCode) { SaCodeType codeType = codeTypes.Find(item => item.Code.EqualsCI(codeTypeCode)); - return (codeType != null ? codeType.Id : new SysId()); + return codeType?.Id ?? new SysId(); } public override SaCodeType GetCodeType (SaCodeType.Params prmCodeType) { - foreach (SaCodeType codeType in codeTypes) - { - if (prmCodeType.IncludedIds.Count > 0 && !prmCodeType.IncludedIds.Contains(codeType.Id)) continue; - if (prmCodeType.ExcludedIds.Count > 0 && prmCodeType.ExcludedIds.Contains(codeType.Id)) continue; - if (!StringUtil.IsEmpty(prmCodeType.Code) && !codeType.Code.EqualsCI(prmCodeType.Code)) continue; - if (!StringUtil.IsEmpty(prmCodeType.CodePartial) && !codeType.Code.ContainsCI(prmCodeType.CodePartial)) continue; - if (!StringUtil.IsEmpty(prmCodeType.Desc) && !codeType.Description.EqualsCI(prmCodeType.Desc)) continue; - if (!StringUtil.IsEmpty(prmCodeType.DescPartial) && !codeType.Description.ContainsCI(prmCodeType.DescPartial)) continue; - if (prmCodeType.StatusCat == SaCodeType.StatusCat.ActiveOnly && codeType.Status != SaCodeType.CurrentStatus) continue; - return codeType; - } - return null; + List< SaCodeType> codeTypesMatched = GetCodeTypeList(prmCodeType); + return codeTypesMatched.Count == 1 ? codeTypesMatched[0] : null; } public override List GetCodeTypeList (SaCodeType.Params prmCodeType) { - return new List(codeTypes); + return codeTypes.FindAll(item => CodeTypeMatches(item, prmCodeType)); } + + //------------------------------------------------------------------- + // Code type list. public override ColumnDfn GetCodeTypeColumnDfn (SaCodeType.Column columnId, string caption = "", int width = 0) { throw new NotImplementedException(); @@ -383,7 +385,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes } //------------------------------------------------------------------- - // Maintain code types - returns true if changes made. + // Maintain code types. public override bool MaintainCodeTypes (bool userCanManageCodeTypes, DbUpdateInfo dbUpdateInfo) { throw new NotImplementedException(); @@ -396,31 +398,55 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes //******************************************************************* // C o d e s //******************************************************************* + // Check whether code exists. + public override bool CodeExistsForCodeType (string codeTypeCode, string code, bool activeOnly = true) + { + SaCode.Params prmCode = new SaCode.Params(); + prmCode.CodeTypeCodes.Add(codeTypeCode); + prmCode.Code = code; + prmCode.StatusCat = (activeOnly ? SaCode.StatusCat.ActiveOnly : SaCode.StatusCat.Any); + return GetCodeCount(prmCode) == 1; + } + + //------------------------------------------------------------------- // Codes for code type. public override bool CodeTypeHasCodes (string codeTypeCode, bool activeOnly = true) { - return (GetCodeListForCodeType(codeTypeCode, activeOnly).Count > 0); + return GetCodeCountForCodeType(codeTypeCode, activeOnly) > 0; } public override int GetCodeCountForCodeType (string codeTypeCode, bool activeOnly = true) { return GetCodeListForCodeType(codeTypeCode, activeOnly).Count; } - public override List GetCodesForCodeType (string codeTypeCode, bool activeOnly = true) - { - List codes = new List(); - foreach (SaCode saCode in GetCodeListForCodeType(codeTypeCode, activeOnly)) - { - codes.Add(saCode.Code, saCode.Description); - } - return new List(); - } public override SaCode GetCodeForCodeType (string codeTypeCode, string code, bool activeOnly = true) { return GetCodeListForCodeType(codeTypeCode, activeOnly).Find(item => item.Code.EqualsCI(code)); } + public override List GetCodeDescsForCodeType (string codeTypeCode, bool activeOnly = true) + { + List codes = new List(); + foreach (SaCode saCode in GetCodeListForCodeType(codeTypeCode, activeOnly)) + codes.Add(saCode.Code, saCode.Description); + return new List(); + } public override List GetCodeListForCodeType (string codeTypeCode, bool activeOnly = true) { - return codeTypeCodes.GetValue(GetCodeTypeId(codeTypeCode), new List()).FindAll(item => !activeOnly || item.Status == SaCode.CurrentStatus); + return codeTypeCodes.GetValue(GetCodeTypeId(codeTypeCode), new List()).FindAll(item => !activeOnly || item.Status == SaCode.ActiveStatus); + } + + //------------------------------------------------------------------- + // Code list. + public override ColumnDfn GetCodeColumnDfn (SaCode.Column columnId, string caption = "", int width = 0) + { + throw new NotImplementedException(); + } + public override DbResultSet ExecuteCodeQuery (List columns, SaCode.Params prm) + { + throw new NotImplementedException(); + } + public override DataValue GetCodeDataValue (ColumnDfn column, NamedValue.Map values) + { + throw new NotImplementedException(); } //------------------------------------------------------------------- @@ -452,35 +478,27 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes if (!StringUtil.IsEmpty(prmCode.CodePartial) && !saCode.Code.ContainsCI(prmCode.CodePartial)) continue; if (!StringUtil.IsEmpty(prmCode.Desc) && !saCode.Description.EqualsCI(prmCode.Desc)) continue; if (!StringUtil.IsEmpty(prmCode.DescPartial) && !saCode.Description.ContainsCI(prmCode.DescPartial)) continue; - if (prmCode.StatusCat == SaCode.StatusCat.ActiveOnly && saCode.Status != SaCode.CurrentStatus) continue; - if (prmCode.StatusCat == SaCode.StatusCat.InactiveOnly && saCode.Status == SaCode.CurrentStatus) continue; + if (prmCode.StatusCat == SaCode.StatusCat.ActiveOnly && saCode.Status != SaCode.ActiveStatus) continue; + if (prmCode.StatusCat == SaCode.StatusCat.InactiveOnly && saCode.Status == SaCode.ActiveStatus) continue; saCodes.Add(saCode); } } return saCodes; } - public override ColumnDfn GetCodeColumnDfn (SaCode.Column columnId, string caption = "", int width = 0) - { - throw new NotImplementedException(); - } - public override DbResultSet ExecuteCodeQuery (List columns, SaCode.Params prm) - { - throw new NotImplementedException(); - } - public override DataValue GetCodeDataValue (ColumnDfn column, NamedValue.Map values) - { - throw new NotImplementedException(); - } //------------------------------------------------------------------- - // Check whether code exists. - public override bool CodeExistsForCodeType (string codeTypeCode, string code, bool activeOnly = true) + // Filtered codes. + public override Dictionary> GetCodesByCodeType (SaCode.Params prmCode) { - SaCode.Params prmCode = new SaCode.Params(); - prmCode.CodeTypeCodes.Add(codeTypeCode); - prmCode.Code = code; - prmCode.StatusCat = (activeOnly ? SaCode.StatusCat.ActiveOnly : SaCode.StatusCat.Any); - return GetCodeCount(prmCode) == 1; + throw new NotImplementedException(); + } + public override Task>> GetCodesByCodeTypeAsync (SaCode.Params prmCode) + { + throw new NotImplementedException(); + } + public override Dictionary> GetCodeDescsByCodeType (SaCode.Params prmCode) + { + throw new NotImplementedException(); } //------------------------------------------------------------------- @@ -508,14 +526,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes throw new NotImplementedException(); } - - //------------------------------------------------------------------- - // Get code desc list.. - public override Dictionary> GetCodeDescList (SaCode.Params prmCode) - { - throw new NotImplementedException(); - } - //------------------------------------------------------------------- } //======================================================================= diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentView.cs index 90136a7..ace42af 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentView.cs @@ -30,7 +30,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. - protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext; } } + protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } } // Managers. protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } } protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } } diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntryView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntryView.cs index 80e3b2a..9c4f648 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntryView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntryView.cs @@ -63,6 +63,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base get { return entry.Keyboard; } set { entry.Keyboard = value; } } + public bool IsPassword + { + get { return entry.IsPassword; } + set { entry.IsPassword = value; } + } public String Text { get { return entry.Text; } @@ -72,7 +77,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // C o n f i g u r e C o m p o n e n t s //------------------------------------------------------------------- - /// Control configuration that can b changed dynamically. + /// Control configuration that can be changed dynamically. protected override void ConfigureComponents () { base.ConfigureComponents(); diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFormPage.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFormPage.cs index 1902408..2ce0aa5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFormPage.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFormPage.cs @@ -56,7 +56,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. - protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext; } } + protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } } protected SlmContentView FormBodyView { get { return contentViewBody; } } public bool AddMode { get; protected set; } = true; public bool Changed { get; protected set; } = false; diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmMainPanel.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmMainPanel.cs new file mode 100644 index 0000000..6c44cda --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmMainPanel.cs @@ -0,0 +1,91 @@ +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Mgr; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +{ + //======================================================================= + public class SlmMainPanel : SlmPanel + { + //------------------------------------------------------------------- + // Definitions. + public new class Config : SlmPanel.Config + { + } + + //------------------------------------------------------------------- + // Data members. + private Config config; + + //------------------------------------------------------------------- + // Construction. + protected SlmMainPanel () + { + this.config = new Config(); + } + protected SlmMainPanel (Config config) + { + this.config = config; + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // C o n f i g u r e C o m p o n e n t s + //------------------------------------------------------------------- + protected override void ConfigureComponents () + { + } + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + } + protected override void SetControlsReadOnly () + { + } + + //------------------------------------------------------------------- + // P a n e l E v e n t s + //------------------------------------------------------------------- + protected override void OnParentSet () + { + base.OnParentSet(); + } + //------------------------------------------------------------------- + protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanging(propertyName); + } + protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) + { + base.OnPropertyChanged(propertyName); + } + //------------------------------------------------------------------- + protected override void OnChildAdded (Element child) + { + base.OnChildAdded(child); + } + protected override void OnChildRemoved (Element child) + { + base.OnChildRemoved(child); + } + //------------------------------------------------------------------- + protected override void OnSizeAllocated (double width, double height) + { + base.OnSizeAllocated(width, height); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} \ No newline at end of file diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPanel.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPanel.cs index 0d0c29d..d133810 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPanel.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPanel.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Text; - +using System.Threading.Tasks; using Xamarin.Forms; namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base @@ -15,14 +15,23 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base { //------------------------------------------------------------------- // Definitions. + public class Config + { + } //------------------------------------------------------------------- // Data members. + private Config config; //------------------------------------------------------------------- // Construction. public SlmPanel () { + this.config = new Config(); + } + protected SlmPanel (Config config) + { + this.config = config; } //------------------------------------------------------------------- @@ -35,6 +44,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base { } + //------------------------------------------------------------------- + // D i s p l a y M e s s a g e s + //------------------------------------------------------------------- + protected Task DisplayAlert (string title, string message, string cancel) + { + return SlmGlobals_Mobile.Application.CurrentPage.DisplayAlert(title, message, cancel); + } + //------------------------------------------------------------------- // C o n t r o l A c t i v i t y //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmStackLayout.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmStackLayout.cs index 742c5fe..bed0768 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmStackLayout.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmStackLayout.cs @@ -1,4 +1,5 @@ -using System; +using Sarand.Core.Mobile.Forms.Layouts; +using System; using System.Collections.Generic; using System.Text; using Xamarin.Forms; @@ -6,7 +7,7 @@ using Xamarin.Forms; namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base { //======================================================================= - public class SlmStackLayout : StackLayout + public class SlmStackLayout : SaxStackLayout { //------------------------------------------------------------------- // Definitions. diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmWebView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmWebView.cs index 6156c6c..5553116 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmWebView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmWebView.cs @@ -29,7 +29,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. - protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext; } } + protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } } // Managers. protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } } protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } } diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker_Codes.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Codes.cs similarity index 96% rename from SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker_Codes.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Codes.cs index 11902da..5508df9 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker_Codes.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Codes.cs @@ -153,10 +153,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls }); codesTaskData = null; } - catch (Exception exc) - { - Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t")); - } + catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); } } //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker_Companies.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Companies.cs similarity index 96% rename from SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker_Companies.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Companies.cs index 5cddfc2..e8efa76 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker_Companies.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Companies.cs @@ -135,10 +135,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls await RefreshCompanies(companiesTaskData); companiesTaskData = null; } - catch (Exception exc) - { - Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t")); - } + catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); } }, companiesTaskData.CancellationToken); } private async Task RefreshCompanies (SacsTaskData taskData) @@ -149,7 +146,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls prmCompany.StatusCat = SlmCompany.StatusCat.Any; // Retrieve companies. - SlmAccountMgr_Mobile accountMgr = new SlmAccountMgr_Mobile(SlmGlobals_Mobile.SessionProfile.SessionContext); + SlmAccountMgr_Mobile accountMgr = new SlmAccountMgr_Mobile(SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile); companies.Clear(); companies.AddRange(await accountMgr.GetCompanyList_Mobile(prmCompany, taskData)); taskData.ThrowIfCancellationRequested(); diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SiteDefinitions.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SiteDefinitions.cs new file mode 100644 index 0000000..a3b5eef --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SiteDefinitions.cs @@ -0,0 +1,87 @@ +using Sarand.Core.Base; +using Sarand.Core.Bus; +using Sarand.Core.CodeTypes; +using Sarand.Core.Tasks; +using Sarand.LogisticsMgr.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Mgr; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +{ + //======================================================================= + public class SlmPickerView_SiteDefinitions : SlmPickerView + { + //------------------------------------------------------------------- + // Construction. + public SlmPickerView_SiteDefinitions () : base(new SlmPicker_SiteDefinitions()) { } + + //------------------------------------------------------------------- + // Properties. + public SlmSiteDefinition SelectedSiteDefinition + { + get { return (Picker as SlmPicker_SiteDefinitions).SelectedSiteDefinition; } + set { (Picker as SlmPicker_SiteDefinitions).SelectedSiteDefinition = value; } + } + + //------------------------------------------------------------------- + } + //======================================================================= + public class SlmPicker_SiteDefinitions : SlmPicker + { + //------------------------------------------------------------------- + // Data members. + private List sites = SlmGlobals_Mobile.Application.GetSiteDefinitions(); + + //------------------------------------------------------------------- + // Construction. + public SlmPicker_SiteDefinitions () + { + PopulateSites(); + } + + //------------------------------------------------------------------- + // Properties. + public SlmSiteDefinition SelectedSiteDefinition + { + get + { + if (SelectedIndex < 0) return null; + return sites.Find(item => item.Caption.EqualsCI(Items[SelectedIndex])); + } + set + { + for (int siteIdx = 0; siteIdx < sites.Count; siteIdx++) + { + SlmSiteDefinition siteDefinition = sites[siteIdx]; + if (siteDefinition == value) + SelectedIndex = siteIdx; + } + } + } + + //------------------------------------------------------------------- + // P o p u l a t i o n + //------------------------------------------------------------------- + public void PopulateSites () + { + Items.Clear(); + for (int siteIdx = 0; siteIdx < sites.Count; siteIdx++) + { + SlmSiteDefinition siteDefinition = sites[siteIdx]; + Items.Add(siteDefinition.Caption); + if (siteDefinition == SlmGlobals_Mobile.SessionProfile.SiteDefinition) + SelectedIndex = siteIdx; + } + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs index d66e66a..d7f226a 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs @@ -1,7 +1,7 @@ using Sarand.Core.App; +using Sarand.Core.Mobile.Utils; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Utils; using System; using System.Collections.Generic; using System.Text; @@ -14,6 +14,13 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels { //------------------------------------------------------------------- // Definitions. + public new class Config : SlmPanel.Config + { + } + + //------------------------------------------------------------------- + // Data members. + private Config config; private SlmFrame viewPanel = new SlmFrame(); private SlmStackLayout stackLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical }; private SlmGrid gridCaption = new SlmGrid(); @@ -24,15 +31,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels private SlmPanel panelSummary = new SlmPanel(); private SlmPanel panelDetails = new SlmPanel(); - //------------------------------------------------------------------- - // Data members. - //------------------------------------------------------------------- // Construction. - public SlmPanel_AssociatedItems () + public SlmPanel_AssociatedItems (Config config) : + base(config) { + this.config = config; // Panel view - to allow rounded corners. - viewPanel.Padding = new Thickness(0,0,0,12); + viewPanel.Padding = new Thickness(0, 0, 0, 12); viewPanel.BackgroundColor = SlmMobile.AssociatedItemsBackgroundColor; viewPanel.CornerRadius = 8; Content = viewPanel; @@ -58,7 +64,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels // Dropdown button. buttonDropdown.HorizontalOptions = LayoutOptions.Start; buttonDropdown.VerticalOptions = LayoutOptions.Center; - buttonDropdown.Source = ImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Arrow_Down_Purple_72_png)); + buttonDropdown.Source = SacsImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Arrow_Down_Purple_72_png)); buttonDropdown.BackgroundColor = Color.Transparent; buttonDropdown.Padding = new Thickness(12, 0); buttonDropdown.Clicked += ButtonDropdown_Clicked; @@ -66,7 +72,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels // Closeup button. buttonCloseUp.HorizontalOptions = LayoutOptions.Start; buttonCloseUp.VerticalOptions = LayoutOptions.Center; - buttonCloseUp.Source = ImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Arrow_Right_Purple_72_png)); + buttonCloseUp.Source = SacsImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Arrow_Right_Purple_72_png)); buttonCloseUp.BackgroundColor = Color.Transparent; buttonCloseUp.Padding = new Thickness(12, 0); buttonCloseUp.Clicked += ButtonCloseUp_Clicked; @@ -80,14 +86,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels // Add Item button. buttonAddItem.HorizontalOptions = LayoutOptions.End; buttonAddItem.VerticalOptions = LayoutOptions.Center; - buttonAddItem.Source = ImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Add_Green_72_png)); + buttonAddItem.Source = SacsImageUtils.GetImageFromByteArray(SacsResourceConsole.GetImageResource(SacsResourceConsole.ImageResource.IconShock_Add_Green_72_png)); buttonAddItem.BackgroundColor = Color.Transparent; buttonAddItem.Padding = new Thickness(12, 0); buttonAddItem.Clicked += ButtonAddItem_Clicked; gridCaption.Children.Add(buttonAddItem, 2, 0); // Panels. - panelSummary.Padding = new Thickness(4,0); + panelSummary.Padding = new Thickness(4, 0); panelSummary.BackgroundColor = Color.Transparent; stackLayout.Children.Add(panelSummary); panelDetails.Padding = new Thickness(4, 0); @@ -105,8 +111,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels get { return labelCaption.Text; } set { if (labelCaption.Text.Equals(value)) return; labelCaption.Text = value; } } - protected SlmPanel SummaryPanel => panelSummary; - protected SlmPanel DetailsPanel => panelDetails; + protected SlmPanel SummaryPanel { get { return panelSummary; } } + protected SlmPanel DetailsPanel { get { return panelDetails; } } //------------------------------------------------------------------- // I t e m s T o g g l e diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile.cs index 5bfb6fe..73b84a1 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile.cs @@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr // Properties. public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Addresses.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Addresses.cs index 5800064..791c868 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Addresses.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Addresses.cs @@ -184,6 +184,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -354,8 +355,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Address; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Companies.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Companies.cs index a2ebbed..36b11a5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Companies.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAccountMgr_Mobile_Companies.cs @@ -191,6 +191,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -357,8 +358,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Company; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetMovements.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetMovements.cs index 0d8d144..e491608 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetMovements.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetMovements.cs @@ -286,6 +286,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -608,8 +609,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.AssetMovement; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairImages.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairImages.cs index e5e12bf..3845897 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairImages.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairImages.cs @@ -136,6 +136,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairJobs.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairJobs.cs index 05df937..4ae0dbb 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairJobs.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairJobs.cs @@ -171,6 +171,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairs.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairs.cs index f407e93..d145094 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairs.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-AssetRepairs.cs @@ -181,6 +181,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -362,8 +363,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.AssetRepair; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Containers.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Containers.cs index c187b19..19cfa7f 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Containers.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Containers.cs @@ -138,6 +138,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-GeneratorSets.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-GeneratorSets.cs index 4ae8ffb..69ef61d 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-GeneratorSets.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-GeneratorSets.cs @@ -122,6 +122,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-MovementNotifications.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-MovementNotifications.cs index 3de6a34..1b25da4 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-MovementNotifications.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-MovementNotifications.cs @@ -182,6 +182,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Trains.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Trains.cs index c8daea2..e2ea3ad 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Trains.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-Trains.cs @@ -130,6 +130,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovementAssets.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovementAssets.cs index 85b420c..06f4da2 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovementAssets.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovementAssets.cs @@ -145,6 +145,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovements.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovements.cs index 72f4ff7..0f5eb3b 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovements.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile-VehicleMovements.cs @@ -177,6 +177,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile.cs index a2a83e9..34e6c58 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmAssetMgr_Mobile.cs @@ -31,8 +31,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr private SlmWebServiceDfn.ElementNameData ElementName { get; } = new SlmWebServiceDfn.ElementNameData(); public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingCosts.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingCosts.cs index d42ece5..4c1d69f 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingCosts.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingCosts.cs @@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -285,8 +286,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.BerthingCost; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingResource.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingResource.cs index 9a0b6cb..093c1c3 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingResource.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingResource.cs @@ -148,6 +148,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -301,8 +302,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.BerthingResource; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingTasks.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingTasks.cs index fed3f21..6317be0 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingTasks.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-BerthingTasks.cs @@ -140,6 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -282,8 +283,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.BerthingTask; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Berthings.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Berthings.cs index 7c9620c..3ec8158 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Berthings.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Berthings.cs @@ -170,6 +170,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -362,8 +363,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Berthing; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-CruiseBerthings.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-CruiseBerthings.cs index e8ea582..d426ccf 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-CruiseBerthings.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-CruiseBerthings.cs @@ -199,6 +199,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -406,8 +407,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.CruiseBerthing; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-DischargeHolds.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-DischargeHolds.cs index 25f9b65..fb080c0 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-DischargeHolds.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-DischargeHolds.cs @@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -291,8 +292,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.DischargeHold; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Discharges.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Discharges.cs index 887d319..d1d4ca6 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Discharges.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Discharges.cs @@ -148,6 +148,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -311,8 +312,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Discharge; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Vessels.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Vessels.cs index 56b7aa9..f5e329f 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Vessels.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile-Vessels.cs @@ -152,6 +152,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -310,8 +311,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Vessel; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile.cs index 2519f6e..3334eb1 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmBerthingMgr_Mobile.cs @@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr // Properties. public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ChecklistItems.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ChecklistItems.cs index 6033a84..984c596 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ChecklistItems.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ChecklistItems.cs @@ -148,6 +148,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -298,8 +299,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.ChecklistItem; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-Checklists.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-Checklists.cs index 0d3d555..babaf53 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-Checklists.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-Checklists.cs @@ -136,6 +136,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -270,8 +271,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Checklist; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklistItems.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklistItems.cs index 0f0a7d8..00589d3 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklistItems.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklistItems.cs @@ -150,6 +150,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -304,8 +305,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.ItemChecklistItem; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklists.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklists.cs index 514f303..d3fc03f 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklists.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile-ItemChecklists.cs @@ -140,6 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -288,8 +289,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.ItemChecklist; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile.cs index 58c8dfb..619c58a 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmChecklistMgr_Mobile.cs @@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr // Properties. public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-Commodities.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-Commodities.cs index 33419ba..ecd4a3e 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-Commodities.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-Commodities.cs @@ -151,6 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -311,8 +312,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Commodity; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-CommodityLocations.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-CommodityLocations.cs index 857f78c..930238d 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-CommodityLocations.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-CommodityLocations.cs @@ -142,6 +142,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -287,8 +288,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.CommodityLocation; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLevels.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLevels.cs index f01dbc7..172a0e8 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLevels.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLevels.cs @@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -296,8 +297,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StockLevel; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLoadings.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLoadings.cs index ac25e37..fc1cae1 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLoadings.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLoadings.cs @@ -138,6 +138,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -277,8 +278,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StockLoading; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLocations.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLocations.cs index 341c621..0d584c5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLocations.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockLocations.cs @@ -140,6 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -284,8 +285,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StockLocation; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockMovements.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockMovements.cs index b054953..92eb896 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockMovements.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile-StockMovements.cs @@ -151,6 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -314,8 +315,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StockMovement; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile.cs index 8c5e26e..af79c0d 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmCommodityMgr_Mobile.cs @@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr // Properties. public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile-DataItemValues.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile-DataItemValues.cs index 4e49430..2bb818b 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile-DataItemValues.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile-DataItemValues.cs @@ -138,6 +138,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -271,8 +272,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.DataItemValue; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile.cs index 587783b..1477cc5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmItemDataMgr_Mobile.cs @@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr // Properties. public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffAllocations.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffAllocations.cs index 26e737f..25ad727 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffAllocations.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffAllocations.cs @@ -136,6 +136,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -272,8 +273,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StaffAllocation; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffJobs.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffJobs.cs index 1850052..8eacf2a 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffJobs.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffJobs.cs @@ -142,6 +142,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -290,8 +291,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StaffJob; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberAvailabilities.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberAvailabilities.cs index 11f5040..896e7b7 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberAvailabilities.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberAvailabilities.cs @@ -134,6 +134,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -270,8 +271,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StaffMemberAvailability; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberSkills.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberSkills.cs index 85efe37..becaa49 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberSkills.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMemberSkills.cs @@ -134,6 +134,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -269,8 +270,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StaffMemberSkill; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMembers.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMembers.cs index d409683..e299ba1 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMembers.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffMembers.cs @@ -160,6 +160,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -324,8 +325,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StaffMember; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTaskSkills.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTaskSkills.cs index 21e5cc5..9fe9d56 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTaskSkills.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTaskSkills.cs @@ -134,6 +134,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -269,8 +270,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StaffTaskSkill; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTasks.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTasks.cs index e338cc1..3e2b6d5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTasks.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile-StaffTasks.cs @@ -142,6 +142,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -295,8 +296,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.StaffTask; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile.cs index 7bc2cbc..7347af1 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmStaffMgr_Mobile.cs @@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr // Properties. public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Requirements.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Requirements.cs index 707e2c6..1458c4e 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Requirements.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Requirements.cs @@ -162,6 +162,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -325,8 +326,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Requirement; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Transactions.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Transactions.cs index d054e53..bb369fe 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Transactions.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile-Transactions.cs @@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr columnDfn.Caption = caption; if (width > 0) columnDfn.Width = width; + columnDfn.DataName = columnId.ToString(); return columnDfn; } @@ -298,8 +299,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr configRequest.DataType = SlmWebServiceRequest.DataType.Transaction; configRequest.RequestType = requestType; configRequest.Context.SiteDefinition = SiteDefinition; - configRequest.Context.User = User; - configRequest.Context.Email = Email; + configRequest.Context.User = UserCode; + configRequest.Context.Email = EmailAddress; configRequest.Context.Debug = debug; return configRequest; } diff --git a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile.cs b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile.cs index 597398b..3e98e77 100644 --- a/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/Mgr/SlmTransactionMgr_Mobile.cs @@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr // Properties. public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } - public String User { get { return SessionProfile.User; } } - public String Email { get { return SessionProfile.Email; } } + public String UserCode { get { return SessionProfile.UserCode; } } + public String EmailAddress { get { return SessionProfile.EmailAddress; } } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Utils/ImageUtils.cs b/SaLogMgrMobCore/Mobile/Core/Utils/ImageUtils.cs deleted file mode 100644 index 5a68017..0000000 --- a/SaLogMgrMobCore/Mobile/Core/Utils/ImageUtils.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using Xamarin.Forms; - -namespace Sarand.LogisticsMgr.Mobile.Core.Utils -{ - //======================================================================= - public static class ImageUtils - { - //------------------------------------------------------------------- - /// - /// Method that uses the ImageConverter object in .Net Framework to convert a byte array, - /// presumably containing a JPEG or PNG file image, into an ImageSource. - /// - public static ImageSource GetImageFromByteArray (byte[] imageAsBytes) - { - return ImageSource.FromStream(() => new MemoryStream(imageAsBytes)); - } - - //------------------------------------------------------------------- - } - //======================================================================= -}