STN Asset Movements

This commit is contained in:
Andy Howard
2019-07-09 13:52:20 +01:00
parent f892fa7bb6
commit 887e981612
99 changed files with 2417 additions and 566 deletions
@@ -35,7 +35,7 @@
<BundleAssemblies>false</BundleAssemblies> <BundleAssemblies>false</BundleAssemblies>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime> <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk> <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidSupportedAbis>armeabi-v7a;x86</AndroidSupportedAbis> <AndroidSupportedAbis>armeabi-v7a;x86;x86_64</AndroidSupportedAbis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -93,11 +93,8 @@
<ItemGroup> <ItemGroup>
<Folder Include="Mobile\Droid\Effects\" /> <Folder Include="Mobile\Droid\Effects\" />
<Folder Include="Mobile\Droid\Pages\" /> <Folder Include="Mobile\Droid\Pages\" />
<Folder Include="Resources\drawable-hdpi\" />
<Folder Include="Resources\drawable-xhdpi\" />
<Folder Include="Resources\drawable-xxhdpi\" /> <Folder Include="Resources\drawable-xxhdpi\" />
<Folder Include="Resources\drawable-xxxhdpi\" /> <Folder Include="Resources\drawable-xxxhdpi\" />
<Folder Include="Resources\drawable\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\Common-C#\Workspace\SacsCoreBase\SacsCoreBase.csproj"> <ProjectReference Include="..\..\..\..\Common-C#\Workspace\SacsCoreBase\SacsCoreBase.csproj">
@@ -121,5 +118,14 @@
<Name>LogisticsMgrMobile</Name> <Name>LogisticsMgrMobile</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\icon_solent_stevedores.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\icon_solent_stevedores.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\icon_solent_stevedores.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project> </Project>
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.1" package="LogisticsMgrMobile.LogisticsMgrMobile" android:installLocation="auto" android:versionCode="2"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.2.0" package="LogisticsMgrMobile.LogisticsMgrMobile" android:installLocation="auto" android:versionCode="3">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" /> <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="LogisticsMgrMobile.Android"></application> <application android:label="LogisticsMgrMobile.Android" android:icon="@drawable/icon_solent_stevedores"></application>
</manifest> </manifest>
@@ -4447,26 +4447,26 @@ namespace Sarand.LogisticsMgr
// aapt resource value: 0x7f020053 // aapt resource value: 0x7f020053
public const int avd_hide_password = 2130837587; public const int avd_hide_password = 2130837587;
// aapt resource value: 0x7f02012f
public const int avd_hide_password_1 = 2130837807;
// aapt resource value: 0x7f020130 // aapt resource value: 0x7f020130
public const int avd_hide_password_2 = 2130837808; public const int avd_hide_password_1 = 2130837808;
// aapt resource value: 0x7f020131 // 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 // aapt resource value: 0x7f020054
public const int avd_show_password = 2130837588; public const int avd_show_password = 2130837588;
// aapt resource value: 0x7f020132
public const int avd_show_password_1 = 2130837810;
// aapt resource value: 0x7f020133 // aapt resource value: 0x7f020133
public const int avd_show_password_2 = 2130837811; public const int avd_show_password_1 = 2130837811;
// aapt resource value: 0x7f020134 // 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 // aapt resource value: 0x7f020055
public const int design_bottom_navigation_item_background = 2130837589; 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; public const int ic_vol_type_tv_light = 2130837771;
// aapt resource value: 0x7f02010c // aapt resource value: 0x7f02010c
public const int mr_button_connected_dark = 2130837772; public const int icon_solent_stevedores = 2130837772;
// aapt resource value: 0x7f02010d // aapt resource value: 0x7f02010d
public const int mr_button_connected_light = 2130837773; public const int mr_button_connected_dark = 2130837773;
// aapt resource value: 0x7f02010e // aapt resource value: 0x7f02010e
public const int mr_button_connecting_dark = 2130837774; public const int mr_button_connected_light = 2130837774;
// aapt resource value: 0x7f02010f // aapt resource value: 0x7f02010f
public const int mr_button_connecting_light = 2130837775; public const int mr_button_connecting_dark = 2130837775;
// aapt resource value: 0x7f020110 // aapt resource value: 0x7f020110
public const int mr_button_dark = 2130837776; public const int mr_button_connecting_light = 2130837776;
// aapt resource value: 0x7f020111 // aapt resource value: 0x7f020111
public const int mr_button_light = 2130837777; public const int mr_button_dark = 2130837777;
// aapt resource value: 0x7f020112 // aapt resource value: 0x7f020112
public const int mr_dialog_close_dark = 2130837778; public const int mr_button_light = 2130837778;
// aapt resource value: 0x7f020113 // aapt resource value: 0x7f020113
public const int mr_dialog_close_light = 2130837779; public const int mr_dialog_close_dark = 2130837779;
// aapt resource value: 0x7f020114 // 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 // 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 // aapt resource value: 0x7f020116
public const int mr_group_collapse = 2130837782; public const int mr_dialog_material_background_light = 2130837782;
// aapt resource value: 0x7f020117 // aapt resource value: 0x7f020117
public const int mr_group_expand = 2130837783; public const int mr_group_collapse = 2130837783;
// aapt resource value: 0x7f020118 // aapt resource value: 0x7f020118
public const int mr_media_pause_dark = 2130837784; public const int mr_group_expand = 2130837784;
// aapt resource value: 0x7f020119 // aapt resource value: 0x7f020119
public const int mr_media_pause_light = 2130837785; public const int mr_media_pause_dark = 2130837785;
// aapt resource value: 0x7f02011a // aapt resource value: 0x7f02011a
public const int mr_media_play_dark = 2130837786; public const int mr_media_pause_light = 2130837786;
// aapt resource value: 0x7f02011b // aapt resource value: 0x7f02011b
public const int mr_media_play_light = 2130837787; public const int mr_media_play_dark = 2130837787;
// aapt resource value: 0x7f02011c // aapt resource value: 0x7f02011c
public const int mr_media_stop_dark = 2130837788; public const int mr_media_play_light = 2130837788;
// aapt resource value: 0x7f02011d // aapt resource value: 0x7f02011d
public const int mr_media_stop_light = 2130837789; public const int mr_media_stop_dark = 2130837789;
// aapt resource value: 0x7f02011e // 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 // 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 // aapt resource value: 0x7f020120
public const int navigation_empty_icon = 2130837792; public const int mr_vol_type_audiotrack_light = 2130837792;
// aapt resource value: 0x7f020121 // aapt resource value: 0x7f020121
public const int notification_action_background = 2130837793; public const int navigation_empty_icon = 2130837793;
// aapt resource value: 0x7f020122 // aapt resource value: 0x7f020122
public const int notification_bg = 2130837794; public const int notification_action_background = 2130837794;
// aapt resource value: 0x7f020123 // aapt resource value: 0x7f020123
public const int notification_bg_low = 2130837795; public const int notification_bg = 2130837795;
// aapt resource value: 0x7f020124 // aapt resource value: 0x7f020124
public const int notification_bg_low_normal = 2130837796; public const int notification_bg_low = 2130837796;
// aapt resource value: 0x7f020125 // aapt resource value: 0x7f020125
public const int notification_bg_low_pressed = 2130837797; public const int notification_bg_low_normal = 2130837797;
// aapt resource value: 0x7f020126 // aapt resource value: 0x7f020126
public const int notification_bg_normal = 2130837798; public const int notification_bg_low_pressed = 2130837798;
// aapt resource value: 0x7f020127 // aapt resource value: 0x7f020127
public const int notification_bg_normal_pressed = 2130837799; public const int notification_bg_normal = 2130837799;
// aapt resource value: 0x7f020128 // aapt resource value: 0x7f020128
public const int notification_icon_background = 2130837800; public const int notification_bg_normal_pressed = 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;
// aapt resource value: 0x7f020129 // 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 // aapt resource value: 0x7f02012a
public const int notify_panel_notification_icon_bg = 2130837802; public const int notification_tile_bg = 2130837802;
// aapt resource value: 0x7f02012b // aapt resource value: 0x7f02012b
public const int tooltip_frame_dark = 2130837803; public const int notify_panel_notification_icon_bg = 2130837803;
// aapt resource value: 0x7f02012c // 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() static Drawable()
{ {
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -55,7 +55,9 @@ namespace Sarand.LogisticsMgr.Mobile.App
try try
{ {
MainPage = new NavigationPage(new Sarand.LogisticsMgr.Mobile.App.SlmMainPage()); // Configure main page.
SlmMainPage = new SlmMainPage();
MainPage = new NavigationPage(SlmMainPage);
if (startupErrors.Count > 0) if (startupErrors.Count > 0)
MainPage.DisplayAlert("Sarand LogisticsMgr Mobile", "Startup errors:\n" + startupErrors.Concat("", "\n"), "OK"); MainPage.DisplayAlert("Sarand LogisticsMgr Mobile", "Startup errors:\n" + startupErrors.Concat("", "\n"), "OK");
} }
@@ -69,7 +71,7 @@ namespace Sarand.LogisticsMgr.Mobile.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public static App GetInstance () { return app; } 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 // W e b S e r v i c e
@@ -92,19 +94,26 @@ namespace Sarand.LogisticsMgr.Mobile.App
{ {
if (sites.Count < 1) 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.Southampton, "STN [IP4 ext]", "http://37.48.230.34: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.Southampton, "STN [IP4 int]", "http://10.1.4.13:34567/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.Southampton, "STN [IP6 int]", "http://[fe80:f4c9:7720:45d8:f1b0]:34567/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.Southampton, "STN - dev [403-IP6]", "http://[2a00:23c4:1b29:cc00:f14f:66b9:c098:242d]:34567/SaLogMgr"));
//sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP - dev [106]", "http://Sarand106:34567/SaLogMgr")); if (false/*allowLgp*/)
//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", "http://SS-APP-LG1:34568/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 [IP4 int]", "http://10.1.20.12:34568/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 [IP4 ext]", "http://185.102.148.202:34568/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 [IP6 int]", "http://[0:0:0:0:0:ffff:a01:140c]:34568/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 [106]", "http://Sarand106: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 [106-IP4]", "http://192.168.1.118: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.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; return sites;
} }
@@ -131,11 +140,8 @@ namespace Sarand.LogisticsMgr.Mobile.App
if (sessionProfile == null) return; if (sessionProfile == null) return;
switch (e.Property) switch (e.Property)
{ {
case ModifiedProperty.User: case ModifiedProperty.EmailAddress:
Properties[PropertyName_Context_User] = sessionProfile.User; Properties[PropertyName_Context_EmailAddress] = sessionProfile.EmailAddress;
break;
case ModifiedProperty.Email:
Properties[PropertyName_Context_Email] = sessionProfile.Email;
break; break;
} }
} }
@@ -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; }
/// <summary>Execute command.</summary>
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()); }
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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;
}
//-------------------------------------------------------------------
/// <summary>Execute command.</summary>
public override void Execute (object commandParam)
{
if (!CanExecute(commandParam)) return;
App.GetInstance().SlmMainPage.SwitchView(SlmMobile.MainView.AssetMovements, Page_Template_Main.PageBodyMode.SelfScrolling);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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;
}
//-------------------------------------------------------------------
/// <summary>Execute command.</summary>
public override void Execute (object commandParam)
{
if (!CanExecute(commandParam)) return;
App.GetInstance().SlmMainPage.SwitchView(SlmMobile.MainView.ShipFile, Page_Template_Main.PageBodyMode.SelfScrolling);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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;
}
//-------------------------------------------------------------------
/// <summary>Execute command.</summary>
public override void Execute (object commandParam)
{
if (!CanExecute(commandParam)) return;
App.GetInstance().SlmMainPage.SwitchView(SlmMobile.MainView.Login, Page_Template_Main.PageBodyMode.Scrollable);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Utils;
using Sarand.LogisticsMgr.Mobile.Forms.Components; using Sarand.LogisticsMgr.Mobile.Forms.Components;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main;
using Sarand.LogisticsMgr.Mobile.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -25,17 +27,11 @@ namespace Sarand.LogisticsMgr.Mobile.App
// Data members. // Data members.
private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile; private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile;
private SlmMenu menu = new SlmMenu(); 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. // Construction.
public SlmMainPage () : base() public SlmMainPage () : base()
{ {
sessionProfile.PropertyModified += SessionProfile_PropertyModified;
Title = "Sarand LogisticsMgr"; Title = "Sarand LogisticsMgr";
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
InitialiseComponents(); InitialiseComponents();
@@ -44,61 +40,95 @@ namespace Sarand.LogisticsMgr.Mobile.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
protected override SlmMenuView MenuView { get { return menu; } } 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 // I n i t i a l i s e
//------------------------------------------------------------------- //-------------------------------------------------------------------
private void InitialiseComponents () private void InitialiseComponents ()
{ {
// Menu.
menu.MainPage = this; menu.MainPage = this;
// Logo. // Initial view.
imageLogo.Source = ImageUtils.GetImageFromByteArray(SlmResourceConsole.GetImageResource(SlmResourceConsole.ImageResource.Logo_Solent_Stevedores_78_png)); SwitchView(SlmMobile.MainView.Login, PageBodyMode.Scrollable);
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);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// 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(); base.OnAppearing();
} }
//-------------------------------------------------------------------
protected override void OnDisappearing () protected override void OnDisappearing ()
{ {
base.OnDisappearing(); base.OnDisappearing();
} }
//-------------------------------------------------------------------
private void ButtonCreateRepair_Clicked (object sender, EventArgs e)
{
menu.ShowAssetRepairForm();
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -1,4 +1,6 @@
using Sarand.Core.Base; 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.Assets;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Config; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Config;
using Sarand.LogisticsMgr.Mobile.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Views;
@@ -38,27 +40,46 @@ namespace Sarand.LogisticsMgr.Mobile.App
{ {
get get
{ {
ClearMenuOptions();
if (menuOptions.Count < 1) if (menuOptions.Count < 1)
{ {
// Bulk.
List<OptionData> bulkCommands = new List<OptionData>();
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. // Assets.
menuOptions.Add(new OptionData() { Caption = "Assets", Heading = true }); List<OptionData> assetsCommands = new List<OptionData>();
menuOptions.Add(new OptionData() { Caption = "Create repair", ClickedFn = OnAssets_CreateRepairClicked }); 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. // Config.
menuOptions.Add(new OptionData() { Caption = "Config", Heading = true }); menuOptions.Add(new OptionData() { Caption = "Config", Heading = true });
menuOptions.Add(new OptionData() { Caption = "Options", ClickedFn = OnConfig_OptionsClicked }); menuOptions.Add(new OptionData() { Caption = "Options", Command = new SlmCommand_Mobile(OnConfig_OptionsClicked) });
menuOptions.Add(new OptionData() { Caption = "System", ClickedFn = OnConfig_SystemClicked}); menuOptions.Add(new OptionData() { Caption = "System", Command = new SlmCommand_Mobile(OnConfig_SystemClicked) });
menuOptions.Add(new OptionData() { Caption = "Update", ClickedFn = OnConfig_UpdateClicked}); menuOptions.Add(new OptionData() { Caption = "Update", Command = new SlmCommand_Mobile(OnConfig_UpdateClicked) });
} }
return menuOptions; return menuOptions;
} }
} }
public void ClearMenuOptions()
{
menuOptions.Clear();
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// A s s e t s // A s s e t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Asset Repair. // Asset Repair.
public bool AssetRepairFormActive { get; private set; } public bool AssetRepairFormActive { get; private set; }
private void OnAssets_CreateRepairClicked () private void OnAssets_CreateRepairClicked (object commandParam)
{ {
ShowAssetRepairForm(); ShowAssetRepairForm();
} }
@@ -68,7 +89,7 @@ namespace Sarand.LogisticsMgr.Mobile.App
AssetRepairFormActive = true; AssetRepairFormActive = true;
try try
{ {
OnMenuOptionClicked(); InvokeMenuOptionClicked();
if (!await MainPage.IsWebServiceActive()) return; if (!await MainPage.IsWebServiceActive()) return;
SlmPage_Assets_Repair.Config pageConfig = new SlmPage_Assets_Repair.Config(); SlmPage_Assets_Repair.Config pageConfig = new SlmPage_Assets_Repair.Config();
SlmPage_Assets_Repair assetRepairForm = new SlmPage_Assets_Repair (pageConfig); SlmPage_Assets_Repair assetRepairForm = new SlmPage_Assets_Repair (pageConfig);
@@ -84,24 +105,24 @@ namespace Sarand.LogisticsMgr.Mobile.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g // 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(); SlmPage_Config_Options.Config pageConfig = new SlmPage_Config_Options.Config();
await MainViewNavigation.PushModalAsync(new SlmPage_Config_Options(pageConfig), false); 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(); SlmPage_Config_System.Config pageConfig = new SlmPage_Config_System.Config();
await MainViewNavigation.PushModalAsync(new SlmPage_Config_System(pageConfig), false); await MainViewNavigation.PushModalAsync(new SlmPage_Config_System(pageConfig), false);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
private async void OnConfig_UpdateClicked () private async void OnConfig_UpdateClicked (object commandParam)
{ {
OnMenuOptionClicked(); InvokeMenuOptionClicked();
await Browser.OpenAsync("http://www.sarand.com/Android/LogisticsMgr.apk", BrowserLaunchMode.SystemPreferred); await Browser.OpenAsync("http://www.sarand.com/Android/LogisticsMgrMobile.apk", BrowserLaunchMode.SystemPreferred);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -17,9 +17,9 @@ namespace Sarand.LogisticsMgr.Mobile.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// S i t e // S i t e
//------------------------------------------------------------------- //-------------------------------------------------------------------
public new void SetSiteDefinition (SlmSiteDefinition siteDefinition) public void SetSiteDefinition (SlmSiteDefinition siteDefinition)
{ {
base.SetSiteDefinition(siteDefinition); SiteDefinition = siteDefinition;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -84,7 +84,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
EntryRepairNarrative.TextChanged += EntryRepairNarrative_TextChanged; EntryRepairNarrative.TextChanged += EntryRepairNarrative_TextChanged;
// Repair Inspector. // 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.MaxLength = (int)SlmDbDfn.GetColTextLen(SlmDbDfn.ColumnIdx.AssetRepair_RepairInspector);
EntryRepairInspector.TextChanged += EntryRepairInspector_TextChanged; EntryRepairInspector.TextChanged += EntryRepairInspector_TextChanged;
@@ -3,6 +3,7 @@ using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -16,12 +17,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile; private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile;
private readonly List<SlmSiteDefinition> sites = Sarand.LogisticsMgr.Mobile.App.App.GetInstance().GetSiteDefinitions(); private readonly List<SlmSiteDefinition> sites;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
public SlmComponents_Config () public SlmComponents_Config ()
{ {
sites = SlmGlobals_Mobile.Application.GetSiteDefinitions();
InitialiseComponents(); InitialiseComponents();
} }
@@ -29,13 +31,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
// Properties. // Properties.
// Site. // Site.
public SlmLabel LabelSite { get; } = new SlmLabel() { Text = "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. // User.
public SlmLabel LabelUser { get; } = new SlmLabel() { Text = "User" }; public SlmLabel LabelUser { get; } = new SlmLabel() { Text = "User" };
public SlmEntryView EntryUser { get; } = new SlmEntryView(); public SlmEntryView EntryUser { get; } = new SlmEntryView() { ReadOnly = true };
// Email. // Email.
public SlmLabel LabelEmail { get; } = new SlmLabel() { Text = "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. // Utilities.
@@ -60,8 +62,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
PickerSite.SelectedIndex = siteIdx; PickerSite.SelectedIndex = siteIdx;
} }
// User and Email. // User and Email.
EntryUser.Text = sessionProfile.User; EntryUser.Text = sessionProfile.UserCode;
EntryEmail.Text = sessionProfile.Email; EntryEmail.Text = sessionProfile.EmailAddress;
Changed = false; Changed = false;
} }
@@ -70,22 +72,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
//------------------------------------------------------------------- //-------------------------------------------------------------------
private void InitialiseComponents () 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. // User.
EntryUser.Text = sessionProfile.User; EntryUser.Text = sessionProfile.UserCode;
EntryUser.TextChanged += EntryUser_TextChanged; EntryUser.TextChanged += EntryUser_TextChanged;
EntryUser.Completed += EntryUser_Completed; EntryUser.Completed += EntryUser_Completed;
// Email. // Email.
EntryEmail.Text = sessionProfile.Email; EntryEmail.Text = sessionProfile.EmailAddress;
EntryEmail.TextChanged += EntryEmail_TextChanged; EntryEmail.TextChanged += EntryEmail_TextChanged;
EntryEmail.Completed += EntryEmail_Completed; EntryEmail.Completed += EntryEmail_Completed;
@@ -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<SlmSiteDefinition> 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)
{
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -43,8 +43,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets
private SlmGrid gridRepairProperties = new SlmGrid(); private SlmGrid gridRepairProperties = new SlmGrid();
private SlmComponents_AssetRepair assetRepairComponents = new SlmComponents_AssetRepair(); private SlmComponents_AssetRepair assetRepairComponents = new SlmComponents_AssetRepair();
private SlmPanel_AssetMovement_SearchResults assetSearchResultsWebView = new SlmPanel_AssetMovement_SearchResults() { IsVisible = false, }; private SlmPanel_AssetMovement_SearchResults assetSearchResultsWebView = new SlmPanel_AssetMovement_SearchResults() { IsVisible = false, };
private SlmPanel_AssetRepair_Jobs repairJobsPanel = new SlmPanel_AssetRepair_Jobs(); private SlmPanel_AssetRepair_Jobs repairJobsPanel;
private SlmPanel_AssetRepair_Images repairImagesPanel = new SlmPanel_AssetRepair_Images(); private SlmPanel_AssetRepair_Images repairImagesPanel;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
@@ -128,14 +128,18 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets
Grid.SetColumnSpan(assetRepairComponents.EntryRepairInspector, 2); Grid.SetColumnSpan(assetRepairComponents.EntryRepairInspector, 2);
// Jobs panel. // 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; rowIdx = gridRepairProperties.RowDefinitions.Count;
gridRepairProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); gridRepairProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
gridRepairProperties.Children.Add(repairJobsPanel, 0, rowIdx); gridRepairProperties.Children.Add(repairJobsPanel, 0, rowIdx);
Grid.SetColumnSpan(repairJobsPanel, 3); Grid.SetColumnSpan(repairJobsPanel, 3);
// Images panel. // 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; rowIdx = gridRepairProperties.RowDefinitions.Count;
gridRepairProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); gridRepairProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
gridRepairProperties.Children.Add(repairImagesPanel, 0, rowIdx); gridRepairProperties.Children.Add(repairImagesPanel, 0, rowIdx);
@@ -231,10 +235,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets
{ {
return await StoreAssetRepairAsync(assetRepair); return await StoreAssetRepairAsync(assetRepair);
} }
catch (Exception exc) catch (Exception exc) { Logger.Error(GetType().Name + ".StoreAssetRepair " + exc.GetLogMessage()); }
{
Logger.Error(GetType().Name + ".StoreAssetRepair " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "z=\n\r"));
}
return null; return null;
}); });
if (!storeTask.IsCompleted) storeTask.Wait(); if (!storeTask.IsCompleted) storeTask.Wait();
@@ -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.Auto });
optionsGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); optionsGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
optionsGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); optionsGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
int gridRowIdx = -1;
// Options.
int optionIdx = -1;
// User. // User.
optionIdx++; gridRowIdx++;
optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
optionsGrid.Children.Add(configComponents.LabelUser, 0, optionIdx); optionsGrid.Children.Add(configComponents.LabelUser, 0, gridRowIdx);
optionsGrid.Children.Add(configComponents.EntryUser, 1, optionIdx); optionsGrid.Children.Add(configComponents.EntryUser, 1, gridRowIdx);
Grid.SetColumnSpan(configComponents.EntryUser, 2); Grid.SetColumnSpan(configComponents.EntryUser, 2);
// Email. // Email.
optionIdx++; gridRowIdx++;
optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
optionsGrid.Children.Add(configComponents.LabelEmail, 0, optionIdx); optionsGrid.Children.Add(configComponents.LabelEmail, 0, gridRowIdx);
optionsGrid.Children.Add(configComponents.EntryEmail, 1, optionIdx); optionsGrid.Children.Add(configComponents.EntryEmail, 1, gridRowIdx);
Grid.SetColumnSpan(configComponents.EntryEmail, 2); Grid.SetColumnSpan(configComponents.EntryEmail, 2);
// Site. // Site.
optionIdx++; gridRowIdx++;
optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
optionsGrid.Children.Add(configComponents.LabelSite, 0, optionIdx); optionsGrid.Children.Add(configComponents.LabelSite, 0, gridRowIdx);
optionsGrid.Children.Add(configComponents.PickerSite, 1, optionIdx); optionsGrid.Children.Add(configComponents.PickerSite, 1, gridRowIdx);
buttonSiteTest.VerticalOptions = LayoutOptions.Start; buttonSiteTest.VerticalOptions = LayoutOptions.Start;
buttonSiteTest.Padding = new Thickness(4, 4); buttonSiteTest.Padding = new Thickness(4, 4);
buttonSiteTest.Clicked += ButtonSiteTest_Clicked; buttonSiteTest.Clicked += ButtonSiteTest_Clicked;
optionsGrid.Children.Add(buttonSiteTest, 2, optionIdx); optionsGrid.Children.Add(buttonSiteTest, 2, gridRowIdx);
// Site test output. // Site test output.
optionIdx++; gridRowIdx++;
optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); optionsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
optionsGrid.Children.Add(webViewSiteTest, 0, optionIdx); optionsGrid.Children.Add(webViewSiteTest, 0, gridRowIdx);
Grid.SetColumnSpan(webViewSiteTest, 2); Grid.SetColumnSpan(webViewSiteTest, 2);
buttonSiteTestHide.VerticalOptions = LayoutOptions.Start; buttonSiteTestHide.VerticalOptions = LayoutOptions.Start;
buttonSiteTestHide.Padding = new Thickness(4, 4); buttonSiteTestHide.Padding = new Thickness(4, 4);
buttonSiteTestHide.Clicked += ButtonSiteTestHide_Clicked; 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 () 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; return true;
} }
protected override bool QueryCancelForm () protected override bool QueryCancelForm ()
@@ -96,13 +96,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Config
settings.Add("Build history", VersionTracking.BuildHistory.Concat(", ")); settings.Add("Build history", VersionTracking.BuildHistory.Concat(", "));
// Populate settings. // Populate settings.
int optionIdx = -1; int gridRowIdx = -1;
foreach (StringPair setting in settings) foreach (StringPair setting in settings)
{ {
optionIdx++; gridRowIdx++;
settingsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); 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.Item1, HorizontalOptions = LayoutOptions.Start }, 0, gridRowIdx);
settingsGrid.Children.Add(new SlmLabel() { Text = setting.Item2, HorizontalOptions = LayoutOptions.StartAndExpand }, 1, optionIdx); settingsGrid.Children.Add(new SlmLabel() { Text = setting.Item2, HorizontalOptions = LayoutOptions.StartAndExpand }, 1, gridRowIdx);
} }
} }
@@ -3,7 +3,6 @@ using Sarand.Core.Base;
using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Core.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@@ -13,31 +12,28 @@ using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.Core.Mobile.Utils;
namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
{ {
//======================================================================= //=======================================================================
public class Page_Template_Main : SlmContentPage public abstract class Page_Template_Main : SlmContentPage
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
public enum PageBodyType
{
Scroll
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private StackLayout mainLayout = new StackLayout(); private SlmGrid baseGrid = new SlmGrid();
// Application bar. // Application bar.
private SlmGrid applicationBar = new SlmGrid(); private SlmGrid applicationBar = new SlmGrid();
private Label labelApplicationCaption = new Label(); private Label labelApplicationCaption = new Label();
private ImageButton buttonMenu = new ImageButton(); private ImageButton buttonMenu = new ImageButton();
private SlmContentView applicationBarBorderBottom = new SlmContentView(); private SlmContentView applicationBarBorderBottom = new SlmContentView();
// Page body. // Page body.
private AbsoluteLayout pageBody = new AbsoluteLayout(); private AbsoluteLayout absoluteLayout = new AbsoluteLayout();
private SlmScrollView pageBodyScroll = new SlmScrollView(); private SlmScrollView pageBodyScroll = new SlmScrollView();
private StackLayout pageBodyStack = new StackLayout(); private SlmContentView pageBodyStatic = new SlmContentView();
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
@@ -45,18 +41,20 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
{ {
this.SizeChanged += OnSizeChanged; this.SizeChanged += OnSizeChanged;
// Main layout. // Base layout - Grid.
mainLayout.Orientation = StackOrientation.Vertical; baseGrid.BackgroundColor = SlmMobile.PageBaseColor;
mainLayout.Spacing = 0; baseGrid.Padding = new Thickness(0);
mainLayout.BackgroundColor = SlmMobile.PageBaseColor; baseGrid.RowSpacing = 0;
mainLayout.Padding = new Thickness(0); baseGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
Content = mainLayout; baseGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star });
Content = baseGrid;
int baseGridRowIdx = -1;
// Application bar. // Application bar.
applicationBar.Margin = new Thickness(0); applicationBar.Margin = new Thickness(0);
applicationBar.Padding = new Thickness(0, 4, 0, 0); applicationBar.Padding = new Thickness(0, 4, 0, 0);
applicationBar.HorizontalOptions = LayoutOptions.Center; applicationBar.HorizontalOptions = LayoutOptions.FillAndExpand;
applicationBar.VerticalOptions = LayoutOptions.Center; applicationBar.VerticalOptions = LayoutOptions.CenterAndExpand;
applicationBar.RowSpacing = 0; applicationBar.RowSpacing = 0;
applicationBar.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); applicationBar.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
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.Auto });
applicationBar.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); applicationBar.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
applicationBar.BackgroundColor = SlmMobile.ApplicationBarBackgroundColor; applicationBar.BackgroundColor = SlmMobile.ApplicationBarBackgroundColor;
mainLayout.Children.Add(applicationBar); baseGrid.Children.Add(applicationBar, 0, ++baseGridRowIdx);
// Caption. // Caption.
//labelApplicationCaption.HorizontalOptions = LayoutOptions.CenterAndExpand; //labelApplicationCaption.HorizontalOptions = LayoutOptions.CenterAndExpand;
labelApplicationCaption.Margin = new Thickness(0, 0, 0, 8); labelApplicationCaption.Margin = new Thickness(0, 0, 0, 8);
@@ -77,7 +75,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
// Menu button. // Menu button.
buttonMenu.HorizontalOptions = LayoutOptions.End; buttonMenu.HorizontalOptions = LayoutOptions.End;
buttonMenu.VerticalOptions = LayoutOptions.Center; 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.BackgroundColor = Color.Transparent;
buttonMenu.Padding = new Thickness(12, 0); buttonMenu.Padding = new Thickness(12, 0);
buttonMenu.Clicked += ButtonMenu_Clicked; buttonMenu.Clicked += ButtonMenu_Clicked;
@@ -91,42 +89,71 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
// Menu. // Menu.
MenuView.MenuOptionClicked += MenuView_MenuOptionClicked; MenuView.MenuOptionClicked += MenuView_MenuOptionClicked;
// Page body. // AbsoluteLayout - Required for positioning popup menu etc.
pageBody.BackgroundColor = SlmMobile.PageBackgroundColor; absoluteLayout.BackgroundColor = SlmMobile.PageBackgroundColor;
pageBody.Padding = new Thickness(0); absoluteLayout.Padding = new Thickness(0);
mainLayout.Children.Add(pageBody); baseGrid.Children.Add(absoluteLayout, 0, ++baseGridRowIdx);
// Page Body view. // Scrolling Page Body.
pageBodyScroll.HorizontalOptions = LayoutOptions.Fill; pageBodyScroll.HorizontalOptions = LayoutOptions.FillAndExpand;
pageBodyScroll.VerticalOptions = LayoutOptions.FillAndExpand; pageBodyScroll.VerticalOptions = LayoutOptions.FillAndExpand;
pageBodyScroll.BackgroundColor = Color.Transparent; pageBodyScroll.BackgroundColor = Color.Transparent;
pageBodyScroll.Padding = new Thickness(0); pageBodyScroll.Padding = new Thickness(0);
pageBody.Children.Add(pageBodyScroll);
// Page layout. // Static Page Body.
pageBodyStack.BackgroundColor = Color.Transparent; pageBodyStatic.HorizontalOptions = LayoutOptions.FillAndExpand;
pageBodyStack.Padding = new Thickness(4); pageBodyStatic.VerticalOptions = LayoutOptions.FillAndExpand;
pageBodyScroll.Content = pageBodyStack; pageBodyStatic.BackgroundColor = Color.Transparent;
pageBodyStatic.Padding = new Thickness(0);
// Hide menu when tapping on main page. // Hide menu when tapping on main page.
var bodyTapGestureRecognizer = new TapGestureRecognizer(); var bodyTapGestureRecognizer = new TapGestureRecognizer();
bodyTapGestureRecognizer.Tapped += (s, e) => { HideMenu(); }; bodyTapGestureRecognizer.Tapped += (s, e) => { HideMenu(); };
//pageBody.GestureRecognizers.Add(bodyTapGestureRecognizer); //pageBody.GestureRecognizers.Add(bodyTapGestureRecognizer);
//pageBodyScroll.GestureRecognizers.Add(bodyTapGestureRecognizer); //pageBodyScroll.GestureRecognizers.Add(bodyTapGestureRecognizer);
pageBodyStack.GestureRecognizers.Add(bodyTapGestureRecognizer); baseGrid.GestureRecognizers.Add(bodyTapGestureRecognizer);
// Events. // Events.
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public PageBodyType BodyType { get; set; } public PageBodyMode BodyMode { get; private set; }
public Layout<View> PageBody { get { return pageBodyStack; } }
//-------------------------------------------------------------------
// 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 // M e n u
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected virtual SlmMenuView MenuView { get; } protected abstract SlmMenuView MenuView { get; }
private bool menuShown = false; private bool menuShown = false;
private void ButtonMenu_Clicked (object sender, EventArgs e) private void ButtonMenu_Clicked (object sender, EventArgs e)
{ {
@@ -139,7 +166,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
} }
public void HideMenu () public void HideMenu ()
{ {
pageBody.Children.Remove(MenuView); absoluteLayout.Children.Remove(MenuView);
menuShown = false; menuShown = false;
} }
private void ShowMenu () 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); double menuHeight = Math.Min(320, Math.Min(Width, Height) * 0.66);
if (MenuView.MenuHeight > menuHeight && MenuView.MenuHeight < Height) if (MenuView.MenuHeight > menuHeight && MenuView.MenuHeight < Height)
menuHeight = MenuView.MenuHeight; menuHeight = MenuView.MenuHeight;
Rectangle menuPosition = new Rectangle(pageBody.Width - menuWidth, 0, menuWidth, menuHeight); Rectangle menuPosition = new Rectangle(absoluteLayout.Width - menuWidth, 0, menuWidth, menuHeight);
pageBody.Children.Add(MenuView, menuPosition, AbsoluteLayoutFlags.None); absoluteLayout.Children.Add(MenuView, menuPosition, AbsoluteLayoutFlags.None);
menuShown = true; menuShown = true;
} }
private void MenuView_MenuOptionClicked (object sender, SlmMenuView.MenuOptionClickedEventArgs e) private void MenuView_MenuOptionClicked (object sender, SlmMenuView.MenuOptionClickedEventArgs e)
@@ -163,9 +190,11 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
private void PositionComponents () private void PositionComponents ()
{ {
// Page size has changed. // Page size has changed.
// Adjust main body padding.
double widthPadding = Math.Max(SlmMobile.PageBodyPaddingHorizontalMin, (Width - 460) / 2); double widthPadding = Math.Max(SlmMobile.PageBodyPaddingHorizontalMin, (Width - 460) / 2);
double heightPadding = Math.Max(SlmMobile.PageBodyPaddingVerticalMin, (Height - 800) / 20); double heightPadding = Math.Max(SlmMobile.PageBodyPaddingVerticalMin, (Height - 800) / 20);
pageBodyScroll.Padding = new Thickness(widthPadding, heightPadding); pageBodyScroll.Padding = new Thickness(widthPadding, heightPadding);
pageBodyStatic.Padding = new Thickness(widthPadding, heightPadding);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -180,19 +180,16 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
RefreshAssetSearchResultsWebView(info); RefreshAssetSearchResultsWebView(info);
}); });
} }
catch (Exception exc) catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); }
{
Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t"));
}
} }
private void RefreshAssetSearchResultsWebView (String body) private void RefreshAssetSearchResultsWebView (String body)
{ {
String html = "<html><head>" + GetAssetSearchStyle() + "</head><body>"; String html = "<html><head>" + GetAssetSearchStyles() + "</head><body>";
html += body; html += body;
html += "</body></html>"; html += "</body></html>";
Html = html; Html = html;
} }
private String GetAssetSearchStyle () private String GetAssetSearchStyles ()
{ {
List<String> menuStyle = new List<string>(); List<String> menuStyle = new List<string>();
menuStyle.Add("<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseCss) + "</style>"); menuStyle.Add("<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseCss) + "</style>");
@@ -14,23 +14,29 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
public new class Config : SlmPanel_AssociatedItems.Config
{
public SlmPage_Assets_Repair AssetRepairPage { get; set; }
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private Config config;
private List<SlmAssetRepairImage.Data> repairImages = new List<SlmAssetRepairImage.Data>(); private List<SlmAssetRepairImage.Data> repairImages = new List<SlmAssetRepairImage.Data>();
private SlmLabel labelSummary = new SlmLabel(); private SlmLabel labelSummary = new SlmLabel();
private SlmGrid gridDetails = new SlmGrid(); private SlmGrid gridDetails = new SlmGrid();
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
public SlmPanel_AssetRepair_Images () public SlmPanel_AssetRepair_Images (Config config) :
base(config)
{ {
this.config = config;
InitialiseComponents(); InitialiseComponents();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public SlmPage_Assets_Repair AssetRepairPage { get; set; }
public List<SlmAssetRepairImage.Data> RepairImages => new List<SlmAssetRepairImage.Data>(repairImages); public List<SlmAssetRepairImage.Data> RepairImages => new List<SlmAssetRepairImage.Data>(repairImages);
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -80,7 +86,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected async override void ButtonAddItem_Clicked (object sender, EventArgs e) 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); SlmPage_Assets_RepairImage page = new SlmPage_Assets_RepairImage(pageConfig);
page.Disappearing += (sender2, e2) => page.Disappearing += (sender2, e2) =>
{ {
@@ -1,8 +1,8 @@
using Sarand.Core.App; using Sarand.Core.App;
using Sarand.Core.Mobile.Utils;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Utils;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -16,23 +16,29 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
public new class Config : SlmPanel_AssociatedItems.Config
{
public SlmPage_Assets_Repair AssetRepairPage { get; set; }
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private Config config;
private List<SlmAssetRepairJob.Data> repairJobs = new List<SlmAssetRepairJob.Data>(); private List<SlmAssetRepairJob.Data> repairJobs = new List<SlmAssetRepairJob.Data>();
private SlmLabel labelSummary = new SlmLabel(); private SlmLabel labelSummary = new SlmLabel();
private SlmGrid gridDetails = new SlmGrid(); private SlmGrid gridDetails = new SlmGrid();
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
public SlmPanel_AssetRepair_Jobs () public SlmPanel_AssetRepair_Jobs (Config config) :
base(config)
{ {
this.config = config;
InitialiseComponents(); InitialiseComponents();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public SlmPage_Assets_Repair AssetRepairPage { get; set; }
public List<SlmAssetRepairJob.Data> RepairJobs => new List<SlmAssetRepairJob.Data>(repairJobs); public List<SlmAssetRepairJob.Data> RepairJobs => new List<SlmAssetRepairJob.Data>(repairJobs);
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -95,12 +101,12 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
// 'Update' button. // 'Update' button.
ImageButton buttonUpdate = new ImageButton() 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) => buttonUpdate.Pressed += (sender, evt) =>
{ {
// Update job. // 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; pageConfig.AssetRepairJobToUpdate = repairJob;
SlmPage_Assets_RepairJob page = new SlmPage_Assets_RepairJob(pageConfig); SlmPage_Assets_RepairJob page = new SlmPage_Assets_RepairJob(pageConfig);
page.Disappearing += (sender2, e2) => page.Disappearing += (sender2, e2) =>
@@ -114,13 +120,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
// 'Remove' button. // 'Remove' button.
ImageButton buttonRemove = new ImageButton() 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) => buttonRemove.Pressed += async (sender, evt) =>
{ {
// Confirm removal. // Confirm removal.
String msg = "Are you sure that job '" + repairJobDisplay + "' should be removed?"; 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. // Remove job from list and refresh.
repairJobs.Remove(repairJob); repairJobs.Remove(repairJob);
RefreshPanels(); RefreshPanels();
@@ -134,7 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void ButtonAddItem_Clicked (object sender, EventArgs e) 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); SlmPage_Assets_RepairJob page = new SlmPage_Assets_RepairJob(pageConfig);
page.Disappearing += (sender2, e2) => page.Disappearing += (sender2, e2) =>
{ {
@@ -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
//-------------------------------------------------------------------
/// <summary>Control initialisation on construction.</summary>
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
//-------------------------------------------------------------------
/// <summary>Control configuration that can be changed dynamically.</summary>
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<SacsFilterPropertyType> GetFilterPropertyTypes()
{
List<SacsFilterPropertyType> filterPropertyTypes = new List<SacsFilterPropertyType>();
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<String, String> filter = AssetMgr.GetAssetMovementQueryFilter_Mobile(assetMovementParams);
// Columns.
List<String> queryColumns = new List<String>()
{
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 = "<html><head>"+GetItemListStyles().Concat("\n")+"</head><body>";
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 += "<div class='msg "+ messageClass + "'>" + message.Message + "</div>";
}
if (responseData == null)
{ }
else if (responseData.Items.Count > 0)
{
//html += "<div class='msg inf'>Movements found: " + responseData.Items.Count + "</div>";
foreach (var item in responseData.Items)
{
html += "<div class='item'>";
html += "<div class='floatl'>" + item.GetValue(cols.Asset_Code.DataName) + "</div>";
html += "<div class='floatr'>" + item.GetValue(cols.AssetSizeCode.DataName) + "</div>";
html += "<div class='clearb'></div>";
// Asset movement status.
SaStatus assetMovementStatus = SacsSystem.GetStatusForCode(item.GetValue(cols.Status.DataName));
html += "<div class=''>Customer: " + item.GetValue(cols.Customer.DataName) + "</div>";
html += "<div class=''>Status: " + SacsSystem.GetStatusDesc(assetMovementStatus) + "</div>";
html += "<div class=''>Arrived: " + DateUtil.Format(item.GetDateTimeValue(cols.InProgressAt.DataName), "d-MMM-yyyy") + "</div>";
html += "<div class=''>Location: " + item.GetValue(cols.LocationCurrent.DataName) + " </div>";
html += "<div class=''>Destination: " + item.GetValue(cols.LocationFinish.DataName) + "</div>";
html += "</div>";
}
}
else html += "<div class='msg inf'>No movements found</div>";
html += "</body></html>";
ItemListWebView.Html = html;
//Logger.Debug("HTML: " + html);
}
private List<String> GetItemListStyles ()
{
return new List<string>()
{
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseCss) + "</style>",
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseCss) + "</style>",
"<style>",
"body{padding:4px;font-size:12px;border:1px solid #808080;border-radius:8px;overflow-y:auto;}",
"div.msg{margin-bottom:4px;padding:4px;border:1px solid #C0C0C0;border-radius:4px;}",
"div.msg.inf{color:green;}",
"div.msg.wrn{color:orange;}",
"div.msg.err{color:red;}",
"td{padding:4px 4px;}",
"tr.other th, tr.other td{background-color:#f0f0f0;}",
"div.item{margin:0 0 4px 0;padding:4px;background-color:#f8f8f8;border:2px solid #808080;border-radius:8px;}",
"</style>"
};
}
//-------------------------------------------------------------------
// 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);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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<SaxButton> favouriteActionButtons = new List<SaxButton>();
// 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
//-------------------------------------------------------------------
/// <summary>Control initialisation on construction.</summary>
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
//-------------------------------------------------------------------
/// <summary>Control configuration that can be changed dynamically.</summary>
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);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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
//-------------------------------------------------------------------
/// <summary>Control initialisation on construction.</summary>
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
//-------------------------------------------------------------------
/// <summary>Control configuration that can be changed dynamically.</summary>
protected override void ConfigureComponents ()
{
}
//-------------------------------------------------------------------
// I t e m L i s t
//-------------------------------------------------------------------
protected abstract List<SacsFilterPropertyType> 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);
}
//-------------------------------------------------------------------
/// <summary>
/// Filter properties in header panel has changed.
/// </summary>
protected void PanelFilter_FilterChanged (object sender, SaxPanel_ItemFilter.FilterChangedEventArgs e)
{
RefreshItemList();
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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
//-------------------------------------------------------------------
/// <summary>Control initialisation on construction.</summary>
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
//-------------------------------------------------------------------
/// <summary>Control configuration that can be changed dynamically.</summary>
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<SlmWebServiceClient.ItemDataResponseData> 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<String, String> filter = new Dictionary<string, string>();
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<UserLoginEventArgs> 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);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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
//-------------------------------------------------------------------
/// <summary>Control initialisation on construction.</summary>
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
//-------------------------------------------------------------------
/// <summary>Control configuration that can be changed dynamically.</summary>
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);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -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.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Forms.Views namespace Sarand.LogisticsMgr.Mobile.Forms.Views
@@ -17,8 +19,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views
{ {
public String Caption { get; set; } public String Caption { get; set; }
public bool Heading { get; set; } public bool Heading { get; set; }
public delegate void OnMenuOptionClicked (); public ICommand Command { get; set; }
public OnMenuOptionClicked ClickedFn { get; set; }
public ImageSource ImageSource { 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); Padding = new Thickness(SlmMobile.MenuBorder, 0, 0, SlmMobile.MenuBorder);
// Menu grid. // Menu grid.
menuGrid.BackgroundColor = Color.FromHex("#F0F0F0"); menuGrid.BackgroundColor = SlmMobile.MenuBackgroundColor;
menuGrid.Padding = new Thickness(4,8); menuGrid.Padding = new Thickness(4, 8);
menuGrid.RowSpacing = 2.0; menuGrid.RowSpacing = 2.0;
menuGrid.ColumnSpacing = 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 }); menuGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
scrollView.Content = menuGrid; 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<OptionData> MenuOptions { get; } public virtual List<OptionData> MenuOptions { get; }
public double MenuHeight => menuGrid.Height + menuGrid.Padding.Top + menuGrid.Padding.Bottom + SlmMobile.MenuBorder; 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 // M e n u E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void OnParentSet ()
{
base.OnParentSet();
RefreshMenuOptions();
}
public class MenuOptionClickedEventArgs : EventArgs public class MenuOptionClickedEventArgs : EventArgs
{ {
} }
public event EventHandler<MenuOptionClickedEventArgs> MenuOptionClicked; public event EventHandler<MenuOptionClickedEventArgs> MenuOptionClicked;
protected void OnMenuOptionClicked () protected void InvokeMenuOptionClicked ()
{ {
if (MenuOptionClicked != null) MenuOptionClicked.Invoke(this, new MenuOptionClickedEventArgs() { }); if (MenuOptionClicked != null) MenuOptionClicked.Invoke(this, new MenuOptionClickedEventArgs() { });
} }
@@ -4,6 +4,7 @@ using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; using Sarand.LogisticsMgr.Mobile.Core.CodeTypes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
@@ -27,6 +28,17 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // 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 // 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 // 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_Code { get; } = "Context-Site-Code";
protected static String PropertyName_Context_Site_Url { get; } = "Context-Site-Url"; 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_EmailAddress { get; } = "Context-Email";
protected static String PropertyName_Context_Email { get; } = "Context-Email";
public void RestorePersistentSessionProperties () public void RestorePersistentSessionProperties ()
{ {
SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile; 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. // Retrieve all session properties first before populating to session.
Object sessionSiteCode = Properties.GetValue(PropertyName_Context_Site_Code, SlmSystem.GetSiteCode(sessionProfile.Site)); 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 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_EmailAddress, sessionProfile.EmailAddress);
Object sessionEmail = Properties.GetValue(PropertyName_Context_Email, sessionProfile.Email);
// Populate session properties. // Populate session properties.
// Site definition. // Site definition.
if (sessionSiteCode != null && sessionSiteUrl != null) if (sessionSiteCode != null && sessionSiteUrl != null)
@@ -73,8 +84,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
} }
} }
// User & Email. // User & Email.
if (sessionUser != null) sessionProfile.User = sessionUser.ToString(); if (sessionEmail != null) DefaultEmailAddress = sessionEmail.ToString();
if (sessionEmail != null) sessionProfile.Email = sessionEmail.ToString();
} }
public void StorePersistentSessionProperties () public void StorePersistentSessionProperties ()
{ {
@@ -82,8 +92,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
if (sessionProfile == null) return; if (sessionProfile == null) return;
Properties[PropertyName_Context_Site_Code] = SlmSystem.GetSiteCode(sessionProfile.Site); Properties[PropertyName_Context_Site_Code] = SlmSystem.GetSiteCode(sessionProfile.Site);
Properties[PropertyName_Context_Site_Url] = sessionProfile.SiteDefinition.URL; Properties[PropertyName_Context_Site_Url] = sessionProfile.SiteDefinition.URL;
Properties[PropertyName_Context_User] = sessionProfile.User; Properties[PropertyName_Context_EmailAddress] = sessionProfile.EmailAddress;
Properties[PropertyName_Context_Email] = sessionProfile.Email;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -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; } }
//-------------------------------------------------------------------
}
//=======================================================================
}
+47 -30
View File
@@ -27,21 +27,38 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
// Utilities. // Utilities.
public static Random Random { get; } = new Random(); public static Random Random { get; } = new Random();
//-------------------------------------------------------------------
// Application.
public enum MainView
{
Unknown = 0,
// System.
Login,
Home,
// Bulk.
ShipFile,
// Containers.
AssetMovements
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Localisation. // Localisation.
public static CultureInfo CultureInfo => CultureInfo.CurrentCulture; public static CultureInfo CultureInfo { get; } = CultureInfo.CurrentCulture;
public static TextInfo TextInfo => CultureInfo.TextInfo; public static TextInfo TextInfo { get; } = CultureInfo.TextInfo;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Application styling. // Application styling.
public static double ApplicationBarHeight = 28; public static double ApplicationBarHeight { get; } = 28;
public static Color ApplicationBarBackgroundColor = Color.FromHex("#558395"); public static Color ApplicationBarBackgroundColor { get; } = Color.FromHex("#558395");
public static Color ApplicationBarTextColor = Color.FromHex("#f8f8f8"); public static Color ApplicationBarTextColor { get; } = Color.FromHex("#f8f8f8");
public static double ApplicationBarTextSizeRatio = 1.5; public static double ApplicationBarTextSizeRatio { get; } = 1.5;
public static Color ApplicationBarBorderColor = Color.DarkSlateBlue; public static Color ApplicationBarBorderColor { get; } = Color.DarkSlateBlue;
public static double ApplicationBarBorderBottom = 1.0; public static double ApplicationBarBorderBottom { get; } = 1.0;
public static Color MenuBorderColor = Color.DarkSlateBlue; // Menu.
public static double MenuBorder = 1.0; 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. // Dynamic font sizing.
public static double FontSizeRatio public static double FontSizeRatio
{ {
@@ -54,29 +71,29 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
} }
} }
// Pages. // Pages.
public static Color PageCaptionBackgroundColor = Color.FromHex("#558395"); public static Color PageCaptionBackgroundColor { get; } = Color.FromHex("#558395");
public static double PageCaptionPaddingHorizontal = 4.0; public static double PageCaptionPaddingHorizontal { get; } = 4.0;
public static double PageCaptionPaddingVertical = 8.0; public static double PageCaptionPaddingVertical { get; } = 8.0;
public static Color PageCaptionTextColor = Color.FromHex("#f8f8f8"); public static Color PageCaptionTextColor { get; } = Color.FromHex("#f8f8f8");
public static double PageCaptionTextSizeRatio = 1.25; public static double PageCaptionTextSizeRatio { get; } = 1.25;
public static Color PageBaseColor = Color.FromHex("#c8e8f5"); public static Color PageBaseColor { get; } = Color.FromHex("#c8e8f5");
public static Color PageBackgroundColor = Color.FromHex("#e9f6fb"); public static Color PageBackgroundColor { get; } = Color.FromHex("#e9f6fb");
public static double PageBodyPaddingVerticalMin = 4.0; public static double PageBodyPaddingVerticalMin { get; } = 4.0;
public static double PageBodyPaddingHorizontalMin = 4.0; public static double PageBodyPaddingHorizontalMin { get; } = 4.0;
public static double PageNavigationBorderTopWidth = 0.75; public static double PageNavigationBorderTopWidth { get; } = 0.75;
public static double PageNavigationPaddingVertical = 4.0; public static double PageNavigationPaddingVertical { get; } = 4.0;
public static Color PageNavigationBorderColor = Color.FromHex("#808080"); public static Color PageNavigationBorderColor { get; } = Color.FromHex("#808080");
public static Color PageNavigationBackgroundColor = Color.FromHex("#e9f6fb"); public static Color PageNavigationBackgroundColor { get; } = Color.FromHex("#e9f6fb");
// Controls. // Controls.
public static Color ControlBackgroundColor = Color.FromHex("#f8f8f8"); public static Color ControlBackgroundColor { get; } = Color.FromHex("#f8f8f8");
public static Color ControlBorderColor = Color.FromHex("#f8f8f8"); public static Color ControlBorderColor { get; } = Color.FromHex("#f8f8f8");
public static double ControlBorderWidth = 0.5; public static double ControlBorderWidth { get; } = 0.5;
public static Thickness LabelMargin { get; } = new Thickness(4.0, 8.0, 0, 0); public static Thickness LabelMargin { get; } = new Thickness(4.0, 8.0, 0, 0);
// Associated items panel. // Associated items panel.
public static Color AssociatedItemsCaptionBackgroundColor = Color.FromHex("#becee4"); public static Color AssociatedItemsCaptionBackgroundColor { get; } = Color.FromHex("#becee4");
public static Color AssociatedItemsCaptionTextColor = Color.FromHex("#f8f8f8"); public static Color AssociatedItemsCaptionTextColor { get; } = Color.FromHex("#f8f8f8");
public static double AssociatedItemsCaptionTextSizeRatio = 1.2; public static double AssociatedItemsCaptionTextSizeRatio { get; } = 1.2;
public static Color AssociatedItemsBackgroundColor = Color.FromHex("#dbe4f0"); public static Color AssociatedItemsBackgroundColor { get; } = Color.FromHex("#dbe4f0");
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -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));
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -10,21 +10,23 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
private class SlmSiteDefinition_Mobile : SlmSiteDefinition { }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // 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); Site = (siteDefinition != null ? siteDefinition.Site : Slm.Site.Unknown);
SiteDefinition = siteDefinition; SiteDefinition = siteDefinition;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public SlmSiteDefinition SiteDefinition { get; private set; } public SlmSiteDefinition SiteDefinition { get; protected set; }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -1,4 +1,5 @@
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.WebService;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -6,57 +7,59 @@ using System.Text;
namespace Sarand.LogisticsMgr.Mobile.Core.App namespace Sarand.LogisticsMgr.Mobile.Core.App
{ {
//======================================================================= //=======================================================================
public class SlmSessionProfile_Mobile public class SlmSessionProfile_Mobile : SlmSessionProfile
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Definitions.
public class SessionData private class SlmUserContext_Mobile_Internal : SlmUserContext_Mobile
{ {
public SlmSessionContext_Mobile SessionContext = new SlmSessionContext_Mobile(null); internal void SetSiteDefinition (SlmSiteDefinition siteDefinition)
public String User { get; set; } = ""; {
public String Email { get; set; } = ""; 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. // Construction.
protected SlmSessionProfile_Mobile () protected SlmSessionProfile_Mobile ()
{ {
UserContext = (userContext_Local = new SlmUserContext_Mobile_Internal());
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public SlmSessionContext_Mobile SessionContext { get { return session.SessionContext; } } // Session.
public SlmSiteDefinition SiteDefinition { get { return session.SessionContext.SiteDefinition; } } public SlmSessionContext_Mobile SessionContext_Mobile { get { return userContext_Local.SessionContext_Mobile; } }
public Slm.Site Site { get { return session.SessionContext.Site; } } public SlmSiteDefinition SiteDefinition
public String SiteCode { get { return session.SessionContext.SiteCode; } }
public String User
{ {
get { return session.User; } get { return SessionContext_Mobile.SiteDefinition; }
set protected set { userContext_Local.SetSiteDefinition(value); }
{
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);
}
} }
// 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 public enum ModifiedProperty
{ {
Site, Site,
User, EmailAddress,
Email,
} }
public class PropertyModifiedEventArgs : EventArgs public class PropertyModifiedEventArgs : EventArgs
{ {
@@ -76,7 +78,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
public event ModifiedEventHandler PropertyModified; public event ModifiedEventHandler PropertyModified;
private void OnPropertyModified (ModifiedProperty property) 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 });
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -17,6 +17,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
protected SlmSiteDefinition () :
base(Slm.Site.Unknown, "", "")
{
}
protected SlmSiteDefinition (Slm.Site site, String caption, String url) : protected SlmSiteDefinition (Slm.Site site, String caption, String url) :
base(site, caption, url) base(site, caption, url)
{ {
@@ -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; }
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -38,8 +38,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public Slm.Site Site { get { return SessionProfile.Site; } } public Slm.Site Site { get { return SessionProfile.Site; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
public override bool DatabaseIsValid { get { return true; } } public override bool DatabaseIsValid { get { return true; } }
public override bool CanUpdateDatabase { get { return true; } } public override bool CanUpdateDatabase { get { return true; } }
public bool Populating { get; private set; } = false; public bool Populating { get; private set; } = false;
@@ -139,8 +139,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes
configRequest.DataType = dataType; configRequest.DataType = dataType;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
configRequest.SoapEnvelope = (SlmMobile.Random.Next(2) == 1); configRequest.SoapEnvelope = (SlmMobile.Random.Next(2) == 1);
configRequest.SoapPrefix = new List<String>() { "", "SOAP", "soap", "S", "s" }[SlmMobile.Random.Next(5)]; configRequest.SoapPrefix = new List<String>() { "", "SOAP", "soap", "S", "s" }[SlmMobile.Random.Next(5)];
@@ -151,6 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes
private async Task RequestRefreshData (RefreshTaskData refreshTaskData) private async Task RequestRefreshData (RefreshTaskData refreshTaskData)
{ {
String fn = GetType().Name + ".RequestRefreshData"; String fn = GetType().Name + ".RequestRefreshData";
if (!SiteDefinition.Valid) return;
try try
{ {
// Slight delay before refresh (in case of immediate cancellation). // 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. // Wait for all tasks to complete.
Task.WaitAll(tasks.ToArray()); Task.WaitAll(tasks.ToArray());
} }
catch (Exception exc) catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); }
{
Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t"));
}
if (this.refreshTaskData == refreshTaskData) this.refreshTaskData = null; 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)); 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) public override int GetCodeTypeCount (SaCodeType.Params prmCodeType)
{ {
return codeTypes.Count; return GetCodeTypeList(prmCodeType).Count;
} }
public SysId GetCodeTypeId (SaCodeType.Params prmCodeType) public SysId GetCodeTypeId (SaCodeType.Params prmCodeType)
{ {
SaCodeType codeType = GetCodeType(prmCodeType); SaCodeType codeType = GetCodeType(prmCodeType);
return (codeType != null ? codeType.Id : new SysId()); return codeType?.Id ?? new SysId();
} }
public SysId GetCodeTypeId (String codeTypeCode) public SysId GetCodeTypeId (String codeTypeCode)
{ {
SaCodeType codeType = codeTypes.Find(item => item.Code.EqualsCI(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) public override SaCodeType GetCodeType (SaCodeType.Params prmCodeType)
{ {
foreach (SaCodeType codeType in codeTypes) List< SaCodeType> codeTypesMatched = GetCodeTypeList(prmCodeType);
{ return codeTypesMatched.Count == 1 ? codeTypesMatched[0] : null;
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;
} }
public override List<SaCodeType> GetCodeTypeList (SaCodeType.Params prmCodeType) public override List<SaCodeType> GetCodeTypeList (SaCodeType.Params prmCodeType)
{ {
return new List<SaCodeType>(codeTypes); return codeTypes.FindAll(item => CodeTypeMatches(item, prmCodeType));
} }
//-------------------------------------------------------------------
// Code type list.
public override ColumnDfn GetCodeTypeColumnDfn (SaCodeType.Column columnId, string caption = "", int width = 0) public override ColumnDfn GetCodeTypeColumnDfn (SaCodeType.Column columnId, string caption = "", int width = 0)
{ {
throw new NotImplementedException(); 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) public override bool MaintainCodeTypes (bool userCanManageCodeTypes, DbUpdateInfo dbUpdateInfo)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@@ -396,31 +398,55 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes
//******************************************************************* //*******************************************************************
// C o d e s // 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. // Codes for code type.
public override bool CodeTypeHasCodes (string codeTypeCode, bool activeOnly = true) 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) public override int GetCodeCountForCodeType (string codeTypeCode, bool activeOnly = true)
{ {
return GetCodeListForCodeType(codeTypeCode, activeOnly).Count; return GetCodeListForCodeType(codeTypeCode, activeOnly).Count;
} }
public override List<CodeDesc> GetCodesForCodeType (string codeTypeCode, bool activeOnly = true)
{
List<CodeDesc> codes = new List<CodeDesc>();
foreach (SaCode saCode in GetCodeListForCodeType(codeTypeCode, activeOnly))
{
codes.Add(saCode.Code, saCode.Description);
}
return new List<CodeDesc>();
}
public override SaCode GetCodeForCodeType (string codeTypeCode, string code, bool activeOnly = true) public override SaCode GetCodeForCodeType (string codeTypeCode, string code, bool activeOnly = true)
{ {
return GetCodeListForCodeType(codeTypeCode, activeOnly).Find(item => item.Code.EqualsCI(code)); return GetCodeListForCodeType(codeTypeCode, activeOnly).Find(item => item.Code.EqualsCI(code));
} }
public override List<CodeDesc> GetCodeDescsForCodeType (string codeTypeCode, bool activeOnly = true)
{
List<CodeDesc> codes = new List<CodeDesc>();
foreach (SaCode saCode in GetCodeListForCodeType(codeTypeCode, activeOnly))
codes.Add(saCode.Code, saCode.Description);
return new List<CodeDesc>();
}
public override List<SaCode> GetCodeListForCodeType (string codeTypeCode, bool activeOnly = true) public override List<SaCode> GetCodeListForCodeType (string codeTypeCode, bool activeOnly = true)
{ {
return codeTypeCodes.GetValue(GetCodeTypeId(codeTypeCode), new List<SaCode>()).FindAll(item => !activeOnly || item.Status == SaCode.CurrentStatus); return codeTypeCodes.GetValue(GetCodeTypeId(codeTypeCode), new List<SaCode>()).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<ColumnDfn> 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.CodePartial) && !saCode.Code.ContainsCI(prmCode.CodePartial)) continue;
if (!StringUtil.IsEmpty(prmCode.Desc) && !saCode.Description.EqualsCI(prmCode.Desc)) continue; if (!StringUtil.IsEmpty(prmCode.Desc) && !saCode.Description.EqualsCI(prmCode.Desc)) continue;
if (!StringUtil.IsEmpty(prmCode.DescPartial) && !saCode.Description.ContainsCI(prmCode.DescPartial)) 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.ActiveOnly && saCode.Status != SaCode.ActiveStatus) continue;
if (prmCode.StatusCat == SaCode.StatusCat.InactiveOnly && saCode.Status == SaCode.CurrentStatus) continue; if (prmCode.StatusCat == SaCode.StatusCat.InactiveOnly && saCode.Status == SaCode.ActiveStatus) continue;
saCodes.Add(saCode); saCodes.Add(saCode);
} }
} }
return saCodes; return saCodes;
} }
public override ColumnDfn GetCodeColumnDfn (SaCode.Column columnId, string caption = "", int width = 0)
{
throw new NotImplementedException();
}
public override DbResultSet ExecuteCodeQuery (List<ColumnDfn> columns, SaCode.Params prm)
{
throw new NotImplementedException();
}
public override DataValue GetCodeDataValue (ColumnDfn column, NamedValue.Map values)
{
throw new NotImplementedException();
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Check whether code exists. // Filtered codes.
public override bool CodeExistsForCodeType (string codeTypeCode, string code, bool activeOnly = true) public override Dictionary<string, List<SaCode>> GetCodesByCodeType (SaCode.Params prmCode)
{ {
SaCode.Params prmCode = new SaCode.Params(); throw new NotImplementedException();
prmCode.CodeTypeCodes.Add(codeTypeCode); }
prmCode.Code = code; public override Task<Dictionary<string, List<SaCode>>> GetCodesByCodeTypeAsync (SaCode.Params prmCode)
prmCode.StatusCat = (activeOnly ? SaCode.StatusCat.ActiveOnly : SaCode.StatusCat.Any); {
return GetCodeCount(prmCode) == 1; throw new NotImplementedException();
}
public override Dictionary<string, List<CodeDesc>> GetCodeDescsByCodeType (SaCode.Params prmCode)
{
throw new NotImplementedException();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -508,14 +526,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes
throw new NotImplementedException(); throw new NotImplementedException();
} }
//-------------------------------------------------------------------
// Get code desc list..
public override Dictionary<string, List<CodeDesc>> GetCodeDescList (SaCode.Params prmCode)
{
throw new NotImplementedException();
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
//======================================================================= //=======================================================================
@@ -30,7 +30,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext; } } protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } }
// Managers. // Managers.
protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } } 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; } } protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } }
@@ -63,6 +63,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
get { return entry.Keyboard; } get { return entry.Keyboard; }
set { entry.Keyboard = value; } set { entry.Keyboard = value; }
} }
public bool IsPassword
{
get { return entry.IsPassword; }
set { entry.IsPassword = value; }
}
public String Text public String Text
{ {
get { return entry.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 // C o n f i g u r e C o m p o n e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Control configuration that can b changed dynamically.</summary> /// <summary>Control configuration that can be changed dynamically.</summary>
protected override void ConfigureComponents () protected override void ConfigureComponents ()
{ {
base.ConfigureComponents(); base.ConfigureComponents();
@@ -56,7 +56,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // 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; } } protected SlmContentView FormBodyView { get { return contentViewBody; } }
public bool AddMode { get; protected set; } = true; public bool AddMode { get; protected set; } = true;
public bool Changed { get; protected set; } = false; public bool Changed { get; protected set; } = false;
@@ -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);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
@@ -15,14 +15,23 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
public class Config
{
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private Config config;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
public SlmPanel () 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 // C o n t r o l A c t i v i t y
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -1,4 +1,5 @@
using System; using Sarand.Core.Mobile.Forms.Layouts;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
@@ -6,7 +7,7 @@ using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
{ {
//======================================================================= //=======================================================================
public class SlmStackLayout : StackLayout public class SlmStackLayout : SaxStackLayout
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
@@ -29,7 +29,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext; } } protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } }
// Managers. // Managers.
protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } } 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; } } protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } }
@@ -153,10 +153,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
}); });
codesTaskData = null; codesTaskData = null;
} }
catch (Exception exc) catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); }
{
Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t"));
}
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -135,10 +135,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
await RefreshCompanies(companiesTaskData); await RefreshCompanies(companiesTaskData);
companiesTaskData = null; companiesTaskData = null;
} }
catch (Exception exc) catch (Exception exc) { Logger.Warn(fn + " " + exc.GetLogMessage()); }
{
Logger.Warn(fn + " " + exc.GetType().Name + ": " + exc.Message + ExceptionUtil.GetStackEntries(exc, 8).Concat("", "\n\t"));
}
}, companiesTaskData.CancellationToken); }, companiesTaskData.CancellationToken);
} }
private async Task RefreshCompanies (SacsTaskData taskData) private async Task RefreshCompanies (SacsTaskData taskData)
@@ -149,7 +146,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
prmCompany.StatusCat = SlmCompany.StatusCat.Any; prmCompany.StatusCat = SlmCompany.StatusCat.Any;
// Retrieve companies. // 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.Clear();
companies.AddRange(await accountMgr.GetCompanyList_Mobile(prmCompany, taskData)); companies.AddRange(await accountMgr.GetCompanyList_Mobile(prmCompany, taskData));
taskData.ThrowIfCancellationRequested(); taskData.ThrowIfCancellationRequested();
@@ -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<SlmSiteDefinition> 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;
}
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -1,7 +1,7 @@
using Sarand.Core.App; using Sarand.Core.App;
using Sarand.Core.Mobile.Utils;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -14,6 +14,13 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
public new class Config : SlmPanel.Config
{
}
//-------------------------------------------------------------------
// Data members.
private Config config;
private SlmFrame viewPanel = new SlmFrame(); private SlmFrame viewPanel = new SlmFrame();
private SlmStackLayout stackLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical }; private SlmStackLayout stackLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical };
private SlmGrid gridCaption = new SlmGrid(); private SlmGrid gridCaption = new SlmGrid();
@@ -24,15 +31,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
private SlmPanel panelSummary = new SlmPanel(); private SlmPanel panelSummary = new SlmPanel();
private SlmPanel panelDetails = new SlmPanel(); private SlmPanel panelDetails = new SlmPanel();
//-------------------------------------------------------------------
// Data members.
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
public SlmPanel_AssociatedItems () public SlmPanel_AssociatedItems (Config config) :
base(config)
{ {
this.config = config;
// Panel view - to allow rounded corners. // 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.BackgroundColor = SlmMobile.AssociatedItemsBackgroundColor;
viewPanel.CornerRadius = 8; viewPanel.CornerRadius = 8;
Content = viewPanel; Content = viewPanel;
@@ -58,7 +64,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
// Dropdown button. // Dropdown button.
buttonDropdown.HorizontalOptions = LayoutOptions.Start; buttonDropdown.HorizontalOptions = LayoutOptions.Start;
buttonDropdown.VerticalOptions = LayoutOptions.Center; 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.BackgroundColor = Color.Transparent;
buttonDropdown.Padding = new Thickness(12, 0); buttonDropdown.Padding = new Thickness(12, 0);
buttonDropdown.Clicked += ButtonDropdown_Clicked; buttonDropdown.Clicked += ButtonDropdown_Clicked;
@@ -66,7 +72,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
// Closeup button. // Closeup button.
buttonCloseUp.HorizontalOptions = LayoutOptions.Start; buttonCloseUp.HorizontalOptions = LayoutOptions.Start;
buttonCloseUp.VerticalOptions = LayoutOptions.Center; 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.BackgroundColor = Color.Transparent;
buttonCloseUp.Padding = new Thickness(12, 0); buttonCloseUp.Padding = new Thickness(12, 0);
buttonCloseUp.Clicked += ButtonCloseUp_Clicked; buttonCloseUp.Clicked += ButtonCloseUp_Clicked;
@@ -80,14 +86,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
// Add Item button. // Add Item button.
buttonAddItem.HorizontalOptions = LayoutOptions.End; buttonAddItem.HorizontalOptions = LayoutOptions.End;
buttonAddItem.VerticalOptions = LayoutOptions.Center; 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.BackgroundColor = Color.Transparent;
buttonAddItem.Padding = new Thickness(12, 0); buttonAddItem.Padding = new Thickness(12, 0);
buttonAddItem.Clicked += ButtonAddItem_Clicked; buttonAddItem.Clicked += ButtonAddItem_Clicked;
gridCaption.Children.Add(buttonAddItem, 2, 0); gridCaption.Children.Add(buttonAddItem, 2, 0);
// Panels. // Panels.
panelSummary.Padding = new Thickness(4,0); panelSummary.Padding = new Thickness(4, 0);
panelSummary.BackgroundColor = Color.Transparent; panelSummary.BackgroundColor = Color.Transparent;
stackLayout.Children.Add(panelSummary); stackLayout.Children.Add(panelSummary);
panelDetails.Padding = new Thickness(4, 0); panelDetails.Padding = new Thickness(4, 0);
@@ -105,8 +111,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
get { return labelCaption.Text; } get { return labelCaption.Text; }
set { if (labelCaption.Text.Equals(value)) return; labelCaption.Text = value; } set { if (labelCaption.Text.Equals(value)) return; labelCaption.Text = value; }
} }
protected SlmPanel SummaryPanel => panelSummary; protected SlmPanel SummaryPanel { get { return panelSummary; } }
protected SlmPanel DetailsPanel => panelDetails; protected SlmPanel DetailsPanel { get { return panelDetails; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// I t e m s T o g g l e // I t e m s T o g g l e
@@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
// Properties. // Properties.
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -184,6 +184,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -354,8 +355,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Address; configRequest.DataType = SlmWebServiceRequest.DataType.Address;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -191,6 +191,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -357,8 +358,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Company; configRequest.DataType = SlmWebServiceRequest.DataType.Company;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -286,6 +286,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -608,8 +609,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.AssetMovement; configRequest.DataType = SlmWebServiceRequest.DataType.AssetMovement;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -136,6 +136,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -171,6 +171,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -181,6 +181,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -362,8 +363,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.AssetRepair; configRequest.DataType = SlmWebServiceRequest.DataType.AssetRepair;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -138,6 +138,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -122,6 +122,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -182,6 +182,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -130,6 +130,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -145,6 +145,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -177,6 +177,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -31,8 +31,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
private SlmWebServiceDfn.ElementNameData ElementName { get; } = new SlmWebServiceDfn.ElementNameData(); private SlmWebServiceDfn.ElementNameData ElementName { get; } = new SlmWebServiceDfn.ElementNameData();
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -285,8 +286,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.BerthingCost; configRequest.DataType = SlmWebServiceRequest.DataType.BerthingCost;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -148,6 +148,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -301,8 +302,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.BerthingResource; configRequest.DataType = SlmWebServiceRequest.DataType.BerthingResource;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -140,6 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -282,8 +283,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.BerthingTask; configRequest.DataType = SlmWebServiceRequest.DataType.BerthingTask;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -170,6 +170,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -362,8 +363,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Berthing; configRequest.DataType = SlmWebServiceRequest.DataType.Berthing;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -199,6 +199,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -406,8 +407,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.CruiseBerthing; configRequest.DataType = SlmWebServiceRequest.DataType.CruiseBerthing;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -291,8 +292,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.DischargeHold; configRequest.DataType = SlmWebServiceRequest.DataType.DischargeHold;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -148,6 +148,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -311,8 +312,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Discharge; configRequest.DataType = SlmWebServiceRequest.DataType.Discharge;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -152,6 +152,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -310,8 +311,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Vessel; configRequest.DataType = SlmWebServiceRequest.DataType.Vessel;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
// Properties. // Properties.
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -148,6 +148,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -298,8 +299,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.ChecklistItem; configRequest.DataType = SlmWebServiceRequest.DataType.ChecklistItem;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -136,6 +136,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -270,8 +271,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Checklist; configRequest.DataType = SlmWebServiceRequest.DataType.Checklist;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -150,6 +150,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -304,8 +305,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.ItemChecklistItem; configRequest.DataType = SlmWebServiceRequest.DataType.ItemChecklistItem;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -140,6 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -288,8 +289,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.ItemChecklist; configRequest.DataType = SlmWebServiceRequest.DataType.ItemChecklist;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
// Properties. // Properties.
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -151,6 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -311,8 +312,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Commodity; configRequest.DataType = SlmWebServiceRequest.DataType.Commodity;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -142,6 +142,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -287,8 +288,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.CommodityLocation; configRequest.DataType = SlmWebServiceRequest.DataType.CommodityLocation;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -296,8 +297,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StockLevel; configRequest.DataType = SlmWebServiceRequest.DataType.StockLevel;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -138,6 +138,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -277,8 +278,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StockLoading; configRequest.DataType = SlmWebServiceRequest.DataType.StockLoading;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -140,6 +140,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -284,8 +285,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StockLocation; configRequest.DataType = SlmWebServiceRequest.DataType.StockLocation;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -151,6 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -314,8 +315,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StockMovement; configRequest.DataType = SlmWebServiceRequest.DataType.StockMovement;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
// Properties. // Properties.
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -138,6 +138,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -271,8 +272,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.DataItemValue; configRequest.DataType = SlmWebServiceRequest.DataType.DataItemValue;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
// Properties. // Properties.
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -136,6 +136,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -272,8 +273,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StaffAllocation; configRequest.DataType = SlmWebServiceRequest.DataType.StaffAllocation;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -142,6 +142,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -290,8 +291,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StaffJob; configRequest.DataType = SlmWebServiceRequest.DataType.StaffJob;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -134,6 +134,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -270,8 +271,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StaffMemberAvailability; configRequest.DataType = SlmWebServiceRequest.DataType.StaffMemberAvailability;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -134,6 +134,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -269,8 +270,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StaffMemberSkill; configRequest.DataType = SlmWebServiceRequest.DataType.StaffMemberSkill;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -160,6 +160,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -324,8 +325,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StaffMember; configRequest.DataType = SlmWebServiceRequest.DataType.StaffMember;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -134,6 +134,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -269,8 +270,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StaffTaskSkill; configRequest.DataType = SlmWebServiceRequest.DataType.StaffTaskSkill;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -142,6 +142,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -295,8 +296,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.StaffTask; configRequest.DataType = SlmWebServiceRequest.DataType.StaffTask;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
// Properties. // Properties.
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -162,6 +162,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -325,8 +326,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Requirement; configRequest.DataType = SlmWebServiceRequest.DataType.Requirement;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -144,6 +144,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
columnDfn.Caption = caption; columnDfn.Caption = caption;
if (width > 0) if (width > 0)
columnDfn.Width = width; columnDfn.Width = width;
columnDfn.DataName = columnId.ToString();
return columnDfn; return columnDfn;
} }
@@ -298,8 +299,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
configRequest.DataType = SlmWebServiceRequest.DataType.Transaction; configRequest.DataType = SlmWebServiceRequest.DataType.Transaction;
configRequest.RequestType = requestType; configRequest.RequestType = requestType;
configRequest.Context.SiteDefinition = SiteDefinition; configRequest.Context.SiteDefinition = SiteDefinition;
configRequest.Context.User = User; configRequest.Context.User = UserCode;
configRequest.Context.Email = Email; configRequest.Context.Email = EmailAddress;
configRequest.Context.Debug = debug; configRequest.Context.Debug = debug;
return configRequest; return configRequest;
} }
@@ -30,8 +30,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
// Properties. // Properties.
public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } } public SlmSessionProfile_Mobile SessionProfile { get { return SlmGlobals_Mobile.SessionProfile; } }
public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } } public SlmSiteDefinition SiteDefinition { get { return SessionProfile.SiteDefinition; } }
public String User { get { return SessionProfile.User; } } public String UserCode { get { return SessionProfile.UserCode; } }
public String Email { get { return SessionProfile.Email; } } public String EmailAddress { get { return SessionProfile.EmailAddress; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -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
{
//-------------------------------------------------------------------
/// <summary>
/// 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.
/// </summary>
public static ImageSource GetImageFromByteArray (byte[] imageAsBytes)
{
return ImageSource.FromStream(() => new MemoryStream(imageAsBytes));
}
//-------------------------------------------------------------------
}
//=======================================================================
}