STN Asset Movements
This commit is contained in:
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
||||
namespace Sarand.LogisticsMgr.Mobile.Droid
|
||||
{
|
||||
//=======================================================================
|
||||
[Activity(Label = "LogisticsMgrMobile", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
[Activity(Label = "LogisticsMgrMobile", Icon = "@drawable/icon_solent_stevedores", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.2.0" package="LogisticsMgrMobile.LogisticsMgrMobile" android:installLocation="auto" android:versionCode="3">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.2.1" package="LogisticsMgrMobile.LogisticsMgrMobile" android:installLocation="auto" android:versionCode="4" android:icon="@drawable/icon_solent_stevedores">
|
||||
<uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
<application android:label="LogisticsMgrMobile.Android" android:icon="@drawable/icon_solent_stevedores"></application>
|
||||
</manifest>
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.LogisticsMgr.Core.App;
|
||||
using Sarand.LogisticsMgr.Core.WebService;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.App;
|
||||
@@ -114,6 +115,13 @@ namespace Sarand.LogisticsMgr.Mobile.App
|
||||
//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"));
|
||||
}
|
||||
if (SacsSystem.DebugMode)
|
||||
{
|
||||
sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "Localhost", "http://localhost:34567/SaLogMgr"));
|
||||
sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "Sarand107", "http://Sarand107:34567/SaLogMgr"));
|
||||
sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "Sarand107 IP4", "http://10.53.2.208:34567/SaLogMgr"));
|
||||
//sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "Sarand107 IP6", "http://[fe80::c1b6:f5ee:a3ea:35e3]:34567/SaLogMgr"));
|
||||
}
|
||||
}
|
||||
return sites;
|
||||
}
|
||||
@@ -124,6 +132,7 @@ namespace Sarand.LogisticsMgr.Mobile.App
|
||||
// Store Site Definition properties.
|
||||
Properties[PropertyName_Context_Site_Code] = SlmSystem.GetSiteCode(sessionProfile.Site);
|
||||
Properties[PropertyName_Context_Site_Url] = sessionProfile.SiteDefinition.URL;
|
||||
SavePropertiesAsync();
|
||||
|
||||
// Refresh site dependent data.
|
||||
if (codeTypeConsole != null) codeTypeConsole.RefreshCodeTypes();
|
||||
@@ -142,6 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.App
|
||||
{
|
||||
case ModifiedProperty.EmailAddress:
|
||||
Properties[PropertyName_Context_EmailAddress] = sessionProfile.EmailAddress;
|
||||
SavePropertiesAsync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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_Home : SlmCommand_Mobile
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmCommand_Home () : 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.Home, Page_Template_Main.PageBodyMode.Scrollable);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace Sarand.LogisticsMgr.Mobile.App.Commands
|
||||
public override void Execute (object commandParam)
|
||||
{
|
||||
if (!CanExecute(commandParam)) return;
|
||||
SlmGlobals_Mobile.SessionProfile.LogoutUser();
|
||||
App.GetInstance().SlmMainPage.SwitchView(SlmMobile.MainView.Login, Page_Template_Main.PageBodyMode.Scrollable);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,11 @@ namespace Sarand.LogisticsMgr.Mobile.App
|
||||
//-------------------------------------------------------------------
|
||||
private void LoginPanel_UserLogin (object sender, SlmMainPanel_Login.UserLoginEventArgs e)
|
||||
{
|
||||
// Store defaults for next session.
|
||||
SlmGlobals_Mobile.Application.DefaultSiteDefinition = e.SiteDefinition;
|
||||
SlmGlobals_Mobile.Application.DefaultEmailAddress = e.EmailAddress;
|
||||
SlmGlobals_Mobile.Application.StorePersistentSessionProperties();
|
||||
// Switch to 'Home' view.
|
||||
SwitchView(SlmMobile.MainView.Home, PageBodyMode.Scrollable);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ namespace Sarand.LogisticsMgr.Mobile.App
|
||||
ClearMenuOptions();
|
||||
if (menuOptions.Count < 1)
|
||||
{
|
||||
// Home.
|
||||
SacsCommand homeCommand = new SlmCommand_Home();
|
||||
if (homeCommand.CanExecute(null))
|
||||
menuOptions.Add(new OptionData() { Caption = "Home", Command = homeCommand });
|
||||
// Bulk.
|
||||
List<OptionData> bulkCommands = new List<OptionData>();
|
||||
bulkCommands.Add(new OptionData() { Caption = "Ship File", Command = new SlmCommand_Bulk_ShipFile() });
|
||||
@@ -62,9 +66,13 @@ namespace Sarand.LogisticsMgr.Mobile.App
|
||||
}
|
||||
// Config.
|
||||
menuOptions.Add(new OptionData() { Caption = "Config", Heading = true });
|
||||
menuOptions.Add(new OptionData() { Caption = "Options", Command = new SlmCommand_Mobile(OnConfig_OptionsClicked) });
|
||||
//menuOptions.Add(new OptionData() { Caption = "Options", Command = new SlmCommand_Mobile(OnConfig_OptionsClicked) });
|
||||
menuOptions.Add(new OptionData() { Caption = "System", Command = new SlmCommand_Mobile(OnConfig_SystemClicked) });
|
||||
menuOptions.Add(new OptionData() { Caption = "Update", Command = new SlmCommand_Mobile(OnConfig_UpdateClicked) });
|
||||
// Logout.
|
||||
SacsCommand logoutCommand = new SlmCommand_Logout();
|
||||
if (logoutCommand.CanExecute(null))
|
||||
menuOptions.Add(new OptionData() { Caption = "Logout", Command = logoutCommand });
|
||||
}
|
||||
return menuOptions;
|
||||
}
|
||||
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Mobile.Forms.Utils;
|
||||
using Sarand.LogisticsMgr.Core.App;
|
||||
using Sarand.LogisticsMgr.Core.Bus;
|
||||
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_AssetMovement : SlmComponents
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile;
|
||||
private readonly List<TypeCodeDesc> movementTypes = new List<TypeCodeDesc>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmComponents_AssetMovement ()
|
||||
{
|
||||
movementTypes.AddRange(SlmSystem.GetCodesOfType(Slm.SystemCode.AssetMovementType));
|
||||
InitialiseComponents();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public String MessageTitle { get; set; } = "Asset Movement";
|
||||
// Asset Code.
|
||||
public SlmLabel LabelAssetCode { get; } = new SlmLabel() { Text = "Container no." };
|
||||
public SlmEntryView EntryAssetCode { get; } = new SlmEntryView();
|
||||
// Asset Size.
|
||||
public SlmLabel LabelAssetSize { get; } = new SlmLabel() { Text = "Size" };
|
||||
public SlmPickerView_CodeType PickerAssetSize { get; } = new SlmPickerView_CodeType() { CodeType = Slm.CodeType.ContainerSize };
|
||||
// Movement type.
|
||||
public SlmLabel LabelMovementType { get; } = new SlmLabel() { Text = "Movement type" };
|
||||
public SlmPickerView_SystemCodes PickerMovementType { get; } = new SlmPickerView_SystemCodes(Slm.SystemCode.AssetMovementType) { };
|
||||
// Reference.
|
||||
public SlmLabel LabelReference { get; } = new SlmLabel() { Text = "Reference" };
|
||||
public SlmEntryView EntryReference { get; } = new SlmEntryView();
|
||||
// Movement date.
|
||||
public SlmLabel LabelMovementDate { get; } = new SlmLabel() { Text = "Movement date" };
|
||||
public SlmDatePickerView DatePickerMovementDate { get; } = new SlmDatePickerView();
|
||||
// Customer.
|
||||
public SlmLabel LabelCustomer { get; } = new SlmLabel() { Text = "Customer" };
|
||||
public SlmEntryView EntryCustomer { get; } = new SlmEntryView();
|
||||
// Customer reference.
|
||||
public SlmLabel LabelCustomerReference { get; } = new SlmLabel() { Text = "Customer ref" };
|
||||
public SlmEntryView EntryCustomerReference { get; } = new SlmEntryView();
|
||||
// Location - start.
|
||||
public SlmLabel LabelLocationStart { get; } = new SlmLabel() { Text = "Location - start" };
|
||||
public SlmEntryView EntryLocationStart { get; } = new SlmEntryView();
|
||||
// Location - current.
|
||||
public SlmLabel LabelLocationCurrent { get; } = new SlmLabel() { Text = "Location - current" };
|
||||
public SlmEntryView EntryLocationCurrent { get; } = new SlmEntryView();
|
||||
// Location - finish.
|
||||
public SlmLabel LabelLocationFinish { get; } = new SlmLabel() { Text = "Location - finish" };
|
||||
public SlmEntryView EntryLocationFinish { get; } = new SlmEntryView();
|
||||
// Haulier - initial.
|
||||
public SlmLabel LabelHaulierInitial { get; } = new SlmLabel() { Text = "Haulier - initial" };
|
||||
public SlmEntryView EntryHaulierInitial { get; } = new SlmEntryView();
|
||||
// Registration - initial.
|
||||
public SlmLabel LabelRegistrationInitial { get; } = new SlmLabel() { Text = "Registration - initial" };
|
||||
public SlmEntryView EntryRegistrationInitial { get; } = new SlmEntryView();
|
||||
// Haulier - final.
|
||||
public SlmLabel LabelHaulierFinal { get; } = new SlmLabel() { Text = "Haulier - final" };
|
||||
public SlmEntryView EntryHaulierFinal { get; } = new SlmEntryView();
|
||||
// Registration - final.
|
||||
public SlmLabel LabelRegistrationFinal { get; } = new SlmLabel() { Text = "Registration - final" };
|
||||
public SlmEntryView EntryRegistrationFinal { get; } = new SlmEntryView();
|
||||
// Pin number.
|
||||
public SlmLabel LabelPinNumber { get; } = new SlmLabel() { Text = "PIN" };
|
||||
public SlmEntryView EntryPinNumber { get; } = new SlmEntryView();
|
||||
// Seal number.
|
||||
public SlmLabel LabelSealNumber { get; } = new SlmLabel() { Text = "Seal number" };
|
||||
public SlmEntryView EntrySealNumber { get; } = new SlmEntryView();
|
||||
// Status.
|
||||
public SlmLabel LabelStatus { get; } = new SlmLabel() { Text = "Status" };
|
||||
public SlmEntryView EntryStatus { get; } = new SlmEntryView();
|
||||
// InProgress date.
|
||||
public SlmLabel LabelInProgressDate { get; } = new SlmLabel() { Text = "In progress" };
|
||||
public SlmDatePickerView DatePickerInProgressDate { get; } = new SlmDatePickerView();
|
||||
// Completed date.
|
||||
public SlmLabel LabelCompletedDate { get; } = new SlmLabel() { Text = "Completed" };
|
||||
public SlmDatePickerView DatePickerCompletedDate { get; } = new SlmDatePickerView();
|
||||
// Notes.
|
||||
public SlmLabel LabelNotes { get; } = new SlmLabel() { Text = "Notes" };
|
||||
public SlmEditorView EntryNotes { get; } = new SlmEditorView();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I n i t i a l i s e
|
||||
//-------------------------------------------------------------------
|
||||
private void InitialiseComponents ()
|
||||
{
|
||||
// Asset code.
|
||||
EntryAssetCode.MaxLength = 12;
|
||||
EntryAssetCode.TextChanged += EntryAssetCode_TextChanged;
|
||||
EntryAssetCode.Completed += EntryAssetCode_Completed;
|
||||
|
||||
// Size.
|
||||
PickerAssetSize.SelectedIndexChanged += PickerAssetSize_SelectedIndexChanged;
|
||||
|
||||
// Movement type.
|
||||
|
||||
Changed = false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P o p u l a t i o n
|
||||
//-------------------------------------------------------------------
|
||||
public void PopulateToControls (SlmContainer.Data data)
|
||||
{
|
||||
EntryAssetCode.Text = data.Code;
|
||||
PickerAssetSize.SelectedCode= data.SizeCode;
|
||||
Changed = false;
|
||||
}
|
||||
public void PopulateToControls (SlmAssetMovement.Data data)
|
||||
{
|
||||
PickerAssetSize.SelectedCode = data.AssetSizeCode;
|
||||
PickerMovementType.SelectedCode = movementTypes.GetCodeForType((int)data.MovementType);
|
||||
EntryReference.Text = data.MovementRef;
|
||||
DatePickerMovementDate.Date = data.MovementAt;
|
||||
EntryCustomer.Text = data.Customer;
|
||||
EntryCustomerReference.Text = data.CustomerRef;
|
||||
EntryLocationStart.Text = data.LocationStart;
|
||||
EntryLocationCurrent.Text = data.LocationCurrent;
|
||||
EntryLocationFinish.Text = data.LocationFinish;
|
||||
EntryHaulierInitial.Text = data.HaulierInitial;
|
||||
EntryRegistrationInitial.Text = data.RegistrationInitial;
|
||||
EntryHaulierFinal.Text = data.HaulierFinal;
|
||||
EntryRegistrationFinal.Text = data.RegistrationFinal;
|
||||
EntryPinNumber.Text = data.PinNumber;
|
||||
EntrySealNumber.Text = data.SealNumber;
|
||||
EntryStatus.Text = SlmSystem.GetStatusDesc(data.Status);
|
||||
EntryReference.Text = data.MovementRef;
|
||||
DatePickerInProgressDate.Date = data.InProgressAt;
|
||||
DatePickerCompletedDate.Date = data.CompletedAt;
|
||||
EntryNotes.Text = data.Notes;
|
||||
Changed = false;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
public bool IsDataValid (SlmAssetMovement.Data data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
public void PopulateFromControls (SlmAssetMovement.Data data)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l A c t i v i t y
|
||||
//-------------------------------------------------------------------
|
||||
protected override void SetControlActivity ()
|
||||
{
|
||||
SetControlsReadOnly();
|
||||
}
|
||||
protected override void SetControlsReadOnly ()
|
||||
{
|
||||
EntryAssetCode.ReadOnly = ReadOnly;
|
||||
PickerAssetSize.ReadOnly = ReadOnly;
|
||||
PickerMovementType.ReadOnly = ReadOnly;
|
||||
EntryReference.ReadOnly = ReadOnly;
|
||||
DatePickerMovementDate.ReadOnly = ReadOnly;
|
||||
EntryCustomer.ReadOnly = ReadOnly;
|
||||
EntryCustomerReference.ReadOnly = ReadOnly;
|
||||
EntryLocationStart.ReadOnly = ReadOnly;
|
||||
EntryLocationCurrent.ReadOnly = ReadOnly;
|
||||
EntryLocationFinish.ReadOnly = ReadOnly;
|
||||
EntryHaulierInitial.ReadOnly = ReadOnly;
|
||||
EntryRegistrationInitial.ReadOnly = ReadOnly;
|
||||
EntryHaulierFinal.ReadOnly = ReadOnly;
|
||||
EntryRegistrationFinal.ReadOnly = ReadOnly;
|
||||
EntryPinNumber.ReadOnly = ReadOnly;
|
||||
EntrySealNumber.ReadOnly = ReadOnly;
|
||||
EntryStatus.ReadOnly = ReadOnly;
|
||||
EntryStatus.ReadOnly = ReadOnly;
|
||||
DatePickerInProgressDate.ReadOnly = ReadOnly;
|
||||
DatePickerCompletedDate.ReadOnly = ReadOnly;
|
||||
EntryNotes.ReadOnly = ReadOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
// Asset Code.
|
||||
private void EntryAssetCode_TextChanged (object sender, TextChangedEventArgs e)
|
||||
{
|
||||
Changed = true;
|
||||
}
|
||||
private void EntryAssetCode_Completed (object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Asset Size.
|
||||
private void PickerAssetSize_SelectedIndexChanged (object sender, EventArgs e)
|
||||
{
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
+1
-1
@@ -38,7 +38,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
|
||||
public SlmEntryView EntryAssetCode { get; } = new SlmEntryView();
|
||||
// Asset Size.
|
||||
public SlmLabel LabelAssetSize { get; } = new SlmLabel() { Text = "Size" };
|
||||
public SlmPickerView_Codes PickerAssetSize { get; } = new SlmPickerView_Codes() { CodeType = Slm.CodeType.ContainerSize };
|
||||
public SlmPickerView_CodeType PickerAssetSize { get; } = new SlmPickerView_CodeType() { CodeType = Slm.CodeType.ContainerSize };
|
||||
// Repair Narrative.
|
||||
public SlmLabel LabelRepairNarrative { get; } = new SlmLabel() { Text = "Narrative" };
|
||||
public SlmEntryView EntryRepairNarrative { get; } = new SlmEntryView();
|
||||
|
||||
+4
-4
@@ -35,19 +35,19 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
|
||||
// Location code.
|
||||
public SlmLabel LabelLocation { get; } = new SlmLabel() { Text = "Location" };
|
||||
public SlmEntryView EntryLocation { get; } = new SlmEntryView();
|
||||
public SlmPickerView_Codes PickerLocation { get; } = new SlmPickerView_Codes() { CodeType = Slm.CodeType.AssetRepair_Location };
|
||||
public SlmPickerView_CodeType PickerLocation { get; } = new SlmPickerView_CodeType() { CodeType = Slm.CodeType.AssetRepair_Location };
|
||||
// Component code.
|
||||
public SlmLabel LabelComponent { get; } = new SlmLabel() { Text = "Component" };
|
||||
public SlmEntryView EntryComponent { get; } = new SlmEntryView();
|
||||
public SlmPickerView_Codes PickerComponent { get; } = new SlmPickerView_Codes() { CodeType = Slm.CodeType.AssetRepair_Component };
|
||||
public SlmPickerView_CodeType PickerComponent { get; } = new SlmPickerView_CodeType() { CodeType = Slm.CodeType.AssetRepair_Component };
|
||||
// Damage code.
|
||||
public SlmLabel LabelDamage { get; } = new SlmLabel() { Text = "Damage" };
|
||||
public SlmEntryView EntryDamage { get; } = new SlmEntryView();
|
||||
public SlmPickerView_Codes PickerDamage { get; } = new SlmPickerView_Codes() { CodeType = Slm.CodeType.AssetRepair_Damage };
|
||||
public SlmPickerView_CodeType PickerDamage { get; } = new SlmPickerView_CodeType() { CodeType = Slm.CodeType.AssetRepair_Damage };
|
||||
// Repair code.
|
||||
public SlmLabel LabelRepair { get; } = new SlmLabel() { Text = "Repair" };
|
||||
public SlmEntryView EntryRepair { get; } = new SlmEntryView();
|
||||
public SlmPickerView_Codes PickerRepair { get; } = new SlmPickerView_Codes() { CodeType = Slm.CodeType.AssetRepair_Repair };
|
||||
public SlmPickerView_CodeType PickerRepair { get; } = new SlmPickerView_CodeType() { CodeType = Slm.CodeType.AssetRepair_Repair };
|
||||
// Quantity.
|
||||
public SlmLabel LabelQuantity { get; } = new SlmLabel() { Text = "Quantity" };
|
||||
public SlmEntryView EntryQuantity { get; } = new SlmEntryView();
|
||||
|
||||
+4
-6
@@ -55,12 +55,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
|
||||
public void RefreshProperties ()
|
||||
{
|
||||
// Site.
|
||||
for (int siteIdx = 0; siteIdx < sites.Count; siteIdx++)
|
||||
{
|
||||
SlmSiteDefinition siteDefinition = sites[siteIdx];
|
||||
if (siteDefinition == sessionProfile.SiteDefinition)
|
||||
PickerSite.SelectedIndex = siteIdx;
|
||||
}
|
||||
if (sessionProfile.SiteDefinition != null)
|
||||
PickerSite.SelectedSiteDefinition = sessionProfile.SiteDefinition;
|
||||
// User and Email.
|
||||
EntryUser.Text = sessionProfile.UserCode;
|
||||
EntryEmail.Text = sessionProfile.EmailAddress;
|
||||
@@ -82,6 +78,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
|
||||
EntryEmail.TextChanged += EntryEmail_TextChanged;
|
||||
EntryEmail.Completed += EntryEmail_Completed;
|
||||
|
||||
RefreshProperties();
|
||||
|
||||
Changed = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,12 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components
|
||||
//-------------------------------------------------------------------
|
||||
private void InitialiseComponents ()
|
||||
{
|
||||
// Site.
|
||||
if (SlmGlobals_Mobile.Application.DefaultSiteDefinition != null)
|
||||
PickerSite.SelectedSiteDefinition = SlmGlobals_Mobile.Application.DefaultSiteDefinition;
|
||||
|
||||
// Email.
|
||||
if (SlmGlobals_Mobile.Application.DefaultEmailAddress != null)
|
||||
EntryEmail.Text = SlmGlobals_Mobile.Application.DefaultEmailAddress;
|
||||
EntryEmail.TextChanged += EntryEmail_TextChanged;
|
||||
EntryEmail.Completed += EntryEmail_Completed;
|
||||
|
||||
+271
@@ -0,0 +1,271 @@
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Tasks;
|
||||
using Sarand.Core.Xml;
|
||||
using Sarand.LogisticsMgr.Core.App;
|
||||
using Sarand.LogisticsMgr.Core.Bus;
|
||||
using Sarand.LogisticsMgr.Core.WebService;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
|
||||
using Sarand.LogisticsMgr.Mobile.Forms.Components;
|
||||
using Sarand.LogisticsMgr.Mobile.Forms.Effects;
|
||||
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets
|
||||
{
|
||||
//=======================================================================
|
||||
public class SlmPage_Assets_Movement : SlmFormPage
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public new class Config : SlmFormPage.Config
|
||||
{
|
||||
public SlmAssetMovement AssetMovementToUpdate { get; set; }
|
||||
public SlmContainer AssetMovement_Container { get; set; }
|
||||
}
|
||||
private class AssetMovementData
|
||||
{
|
||||
public Slm.AssetItemType AssetItemType { get; set; }
|
||||
public SysId AssetItemId { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Config config;
|
||||
private readonly AssetMovementData assetMovementData = new AssetMovementData();
|
||||
private SlmGrid gridProperties = new SlmGrid();
|
||||
private SlmComponents_AssetMovement assetMovementComponents = new SlmComponents_AssetMovement();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmPage_Assets_Movement (Config config) : base(config)
|
||||
{
|
||||
this.config = config;
|
||||
Title = "Asset Movement";
|
||||
AddMode = config.AssetMovementToUpdate == null;
|
||||
if (config.ReadOnly)
|
||||
{
|
||||
assetMovementComponents.ReadOnly = true;
|
||||
}
|
||||
InitialiseComponents();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I n i t i a l i s e
|
||||
//-------------------------------------------------------------------
|
||||
private void InitialiseComponents ()
|
||||
{
|
||||
// Asset Repair form.
|
||||
FormBodyView.Content = gridProperties;
|
||||
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
|
||||
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
|
||||
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
|
||||
int rowIdx = -1;
|
||||
|
||||
// Asset code.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelAssetCode, 0, rowIdx);
|
||||
//entryAssetCode.Effects.Add(new InputCaseEffect());
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryAssetCode, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryAssetCode, 2);
|
||||
assetMovementComponents.EntryAssetCode.TextChanged += EntryAssetCode_TextChanged;
|
||||
assetMovementComponents.EntryAssetCode.Completed += EntryAssetCode_Completed;
|
||||
|
||||
// Asset Size.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelAssetSize, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.PickerAssetSize, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.PickerAssetSize, 2);
|
||||
|
||||
// Movement type.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelMovementType, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.PickerMovementType, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.PickerMovementType, 2);
|
||||
|
||||
// Reference.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelReference, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryReference, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryReference, 2);
|
||||
|
||||
// Movement date.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelMovementDate, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.DatePickerMovementDate, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.DatePickerMovementDate, 2);
|
||||
|
||||
// Customer.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelCustomer, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryCustomer, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryCustomer, 2);
|
||||
|
||||
// CustomerReference.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelCustomerReference, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryCustomerReference, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryCustomerReference, 2);
|
||||
|
||||
// LocationStart.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelLocationStart, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryLocationStart, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryLocationStart, 2);
|
||||
|
||||
// LocationCurrent.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelLocationCurrent, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryLocationCurrent, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryLocationCurrent, 2);
|
||||
|
||||
// LocationFinish.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelLocationFinish, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryLocationFinish, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryLocationFinish, 2);
|
||||
|
||||
// HaulierInitial.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelHaulierInitial, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryHaulierInitial, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryHaulierInitial, 2);
|
||||
|
||||
// RegistrationInitial.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelRegistrationInitial, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryRegistrationInitial, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryRegistrationInitial, 2);
|
||||
|
||||
// HaulierFinal.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelHaulierFinal, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryHaulierFinal, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryHaulierFinal, 2);
|
||||
|
||||
// RegistrationFinal.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelRegistrationFinal, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryRegistrationFinal, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryRegistrationFinal, 2);
|
||||
|
||||
// PinNumber.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelPinNumber, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryPinNumber, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryPinNumber, 2);
|
||||
|
||||
// SealNumber.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelSealNumber, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntrySealNumber, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntrySealNumber, 2);
|
||||
|
||||
// Status.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelStatus, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryStatus, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryStatus, 2);
|
||||
|
||||
// InProgress date.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelInProgressDate, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.DatePickerInProgressDate, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.DatePickerInProgressDate, 2);
|
||||
|
||||
// Completed date.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelCompletedDate, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.DatePickerCompletedDate, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.DatePickerCompletedDate, 2);
|
||||
|
||||
// Notes.
|
||||
rowIdx = gridProperties.RowDefinitions.Count;
|
||||
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
|
||||
gridProperties.Children.Add(assetMovementComponents.LabelNotes, 0, rowIdx);
|
||||
gridProperties.Children.Add(assetMovementComponents.EntryNotes, 1, rowIdx);
|
||||
Grid.SetColumnSpan(assetMovementComponents.EntryNotes, 2);
|
||||
|
||||
// Complete page configuration.
|
||||
ConfigureComponents();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n f i g u r e C o n t r o l s
|
||||
//-------------------------------------------------------------------
|
||||
private void ConfigureComponents ()
|
||||
{
|
||||
// Populate properties to components.
|
||||
assetMovementComponents.PopulateToControls(config.AssetMovement_Container?.GetData() ?? new SlmContainer.Data());
|
||||
assetMovementComponents.PopulateToControls(config.AssetMovementToUpdate?.GetData() ?? new SlmAssetMovement.Data());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l A c t i v i t y
|
||||
//-------------------------------------------------------------------
|
||||
protected override void SetControlActivity ()
|
||||
{
|
||||
base.SetControlActivity();
|
||||
}
|
||||
protected override void SetControlsReadOnly ()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// N a v i g a t i o n E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
protected override bool SaveFormData ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
protected override bool QueryCancelForm ()
|
||||
{
|
||||
if (!base.QueryCancelForm()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P r o p e r t y E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
// Asset code.
|
||||
private void EntryAssetCode_TextChanged (object sender, TextChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
private void EntryAssetCode_Completed (object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
+1
-1
@@ -69,7 +69,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
|
||||
labelApplicationCaption.Margin = new Thickness(0, 0, 0, 8);
|
||||
labelApplicationCaption.Text = Title;
|
||||
labelApplicationCaption.TextColor = SlmMobile.ApplicationBarTextColor;
|
||||
labelApplicationCaption.FontSize *= SlmMobile.ApplicationBarTextSizeRatio;
|
||||
labelApplicationCaption.FontSize *= SlmMobile.FontSizeRatio * SlmMobile.ApplicationBarTextSizeRatio;
|
||||
labelApplicationCaption.BackgroundColor = Color.Transparent;
|
||||
applicationBar.Children.Add(labelApplicationCaption, 1, 0);
|
||||
// Menu button.
|
||||
|
||||
-1
@@ -231,7 +231,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets
|
||||
SendAssetMovementSelected(eventArgs);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
+170
-20
@@ -1,5 +1,6 @@
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Mobile.Forms.Controls;
|
||||
using Sarand.Core.Mobile.Forms.Panels;
|
||||
using Sarand.Core.Tasks;
|
||||
@@ -7,12 +8,9 @@ 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 Sarand.LogisticsMgr.Mobile.Forms.Pages.Assets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
@@ -27,6 +25,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
{
|
||||
Code,
|
||||
Size,
|
||||
Reference,
|
||||
}
|
||||
public enum PanelMode
|
||||
{
|
||||
@@ -61,6 +60,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
public ColumnDfn Status { get; set; }
|
||||
}
|
||||
private Columns cols = new Columns();
|
||||
private String assetMovementDoubleClickedPrefix = "AstMovDblClick#";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
@@ -102,6 +102,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
{
|
||||
base.InitialiseComponents();
|
||||
|
||||
|
||||
ConfigureComponents();
|
||||
}
|
||||
|
||||
@@ -134,10 +135,11 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
//-------------------------------------------------------------------
|
||||
// I t e m L i s t
|
||||
//-------------------------------------------------------------------
|
||||
protected override List<SacsFilterPropertyType> GetFilterPropertyTypes()
|
||||
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.Reference, "Reference") { Mode = SacsFilterPropertyType.FilterMode.Text });
|
||||
filterPropertyTypes.Add(new SacsFilterPropertyType((int)FilterProperty.Size, "Size") { Mode = SacsFilterPropertyType.FilterMode.Text });
|
||||
return filterPropertyTypes;
|
||||
}
|
||||
@@ -147,6 +149,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
// Filter.
|
||||
assetMovementParams.AssetCodePartial = HeaderPanel.PanelFilter.GetFilterPropertyValue((int)FilterProperty.Code);
|
||||
assetMovementParams.AssetSizeCodePartial = HeaderPanel.PanelFilter.GetFilterPropertyValue((int)FilterProperty.Size);
|
||||
assetMovementParams.MovementRefPartial = HeaderPanel.PanelFilter.GetFilterPropertyValue((int)FilterProperty.Reference);
|
||||
assetMovementParams.StatusCat = SlmAssetMovement.StatusCat.NotDeleted;
|
||||
// Paging.
|
||||
assetMovementParams.ResultsPaging.PageNo = pageNo;
|
||||
@@ -219,7 +222,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
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]":""));
|
||||
if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - END Items: " + (responseData?.Items.Count.ToString() ?? "None") + (taskDataRefreshList_Local.IsCancellationRequested ? " [Cancelled]" : ""));
|
||||
|
||||
// Display item list.
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
@@ -227,7 +230,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
DisplayItemList(responseData);
|
||||
});
|
||||
}
|
||||
catch (Exception exc) { Logger.Debug(fn + " " + exc.GetLogMessage(6)); }
|
||||
catch (Exception exc) { if (SacsSystem.DebugMode) Logger.Warn(fn + " " + exc.GetLogMessage()); }
|
||||
}, taskDataRefreshList_Local.CancellationToken)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
@@ -248,7 +251,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
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>";
|
||||
string html = "<html><head>"+GetItemListStyles().Concat("\n")+GetItemListScripts().Concat("\n")+"</head><body>";
|
||||
if (message != null)
|
||||
{
|
||||
String messageClass = "inf";
|
||||
@@ -263,7 +266,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
messageClass = "wrn";
|
||||
break;
|
||||
}
|
||||
html += "<div class='msg "+ messageClass + "'>" + message.Message + "</div>";
|
||||
html += "<div class='msg " + messageClass + "'>" + message.Message + "</div>";
|
||||
}
|
||||
if (responseData == null)
|
||||
{ }
|
||||
@@ -272,17 +275,32 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
//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.
|
||||
html += "<div id='AssMov-" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "' class='item' ondblclick='slm.openAssetMovement(" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + ")'>";
|
||||
html += "<table class='fullwidth'>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Container</td><td class='value bold'>"+item.GetValue(cols.Asset_Code.DataName)+"</td>";
|
||||
html += " <td class='label'>Size</td><td class='value'>"+item.GetValue(cols.AssetSizeCode.DataName)+"</td>";
|
||||
html += " </tr>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Customer</td><td class='value'>" + item.GetValue(cols.Customer.DataName) + "</td>";
|
||||
html += " <td class='label'>Reference</td><td class='value'>" + item.GetValue(cols.MovementRef.DataName) + "</td>";
|
||||
html += " </tr>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Arrived</td><td class='value'>" + DateUtil.Format(item.GetDateTimeValue(cols.InProgressAt.DataName), "ddd d-MMM-yyyy") + "</td>";
|
||||
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 += " <td class='label'>Status</td><td class='value'>" + SacsSystem.GetStatusDesc(assetMovementStatus) + "</td>";
|
||||
html += " </tr>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Location</td><td class='value'>" + item.GetValue(cols.LocationCurrent.DataName) + "</td>";
|
||||
html += " <td class='label'>Destination</td><td class='value'>" + item.GetValue(cols.LocationFinish.DataName) + "</td>";
|
||||
html += " </tr>";
|
||||
if (SacsSystem.DebugMode)
|
||||
{
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Id</td><td class='value'>" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "</td>";
|
||||
html += " </tr>";
|
||||
}
|
||||
html += "</table>";
|
||||
html += "</div>";
|
||||
}
|
||||
}
|
||||
@@ -295,10 +313,11 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
{
|
||||
return new List<string>()
|
||||
{
|
||||
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiCss) + "</style>",
|
||||
"<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;}",
|
||||
"body{padding:4px;font-size:" + SlmMobile.HtmlFontSize + ";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;}",
|
||||
@@ -309,10 +328,141 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
"</style>"
|
||||
};
|
||||
}
|
||||
private List<String> GetItemListScripts ()
|
||||
{
|
||||
return new List<string>()
|
||||
{
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryJs) + "</script>",
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiJs) + "</script>",
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseJs) + "</script>",
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseJs) + "</script>",
|
||||
"<script>",
|
||||
"slm.openAssetMovement=function(id)",
|
||||
"{",
|
||||
//" alert('slm.openAssetMovement Id: '+id)",
|
||||
" document.location=\"" + SaxWebView.AppActionPrefix + assetMovementDoubleClickedPrefix + "\"+id;",
|
||||
"}",
|
||||
"$(function()",
|
||||
"{",
|
||||
" ",
|
||||
"});",
|
||||
"</script>"
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a n e l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
private SacsTaskData taskDataAppAction;
|
||||
/// <summary>'App' navigation events on Item List web view control.</summary>
|
||||
protected override void ItemListWebView_AppNavigating (object sender, SaxWebView.AppNavigatingEventArgs eventArgs)
|
||||
{
|
||||
String fn = GetType().Name + ".ItemListWebView_AppNavigating";
|
||||
if (SacsSystem.DebugMode) Logger.Debug(fn + " AppAction: " + eventArgs.AppAction);
|
||||
// Cancel previous action.
|
||||
if (taskDataAppAction != null)
|
||||
{
|
||||
taskDataAppAction.TriggerCancellation();
|
||||
taskDataAppAction = null;
|
||||
}
|
||||
taskDataAppAction = new SacsTaskData(null);
|
||||
if (eventArgs.AppAction.StartsWithCI(assetMovementDoubleClickedPrefix))
|
||||
{
|
||||
SacsTaskData taskDataAppAction_Local = taskDataAppAction;
|
||||
SysId assetMovementId = new SysId(StringUtil.ToInt(eventArgs.AppAction.Right(eventArgs.AppAction.Length - assetMovementDoubleClickedPrefix.Length)));
|
||||
Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await showAssetMovementForm(assetMovementId, taskDataAppAction_Local);
|
||||
}
|
||||
catch (Exception exc) { if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc)); }
|
||||
}, taskDataAppAction_Local.CancellationToken)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
taskDataAppAction_Local.Dispose();
|
||||
if (taskDataAppAction == taskDataAppAction_Local)
|
||||
taskDataAppAction = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
private async Task showAssetMovementForm (SysId assetMovementId, SacsTaskData taskDataAppAction_Local)
|
||||
{
|
||||
String fn = GetType().Name + ".ItemListWebView_AppNavigating";
|
||||
if (!SysId.IsValid(assetMovementId))
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await DisplayAlert("Asset Movement", "Invalid asset movement selected.", "OK");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve Asset Movement and associated details.
|
||||
SlmAssetMovement assetMovement = null;
|
||||
SlmContainer container = null;
|
||||
try
|
||||
{
|
||||
SacsTaskData taskData = new SacsTaskData(null) { Debug = SacsSystem.DebugMode };
|
||||
// Retrieve Asset Movement.
|
||||
SlmAssetMovement.Params prmAssetMovement = new SlmAssetMovement.Params();
|
||||
prmAssetMovement.IncludedIds.Add(assetMovementId);
|
||||
prmAssetMovement.StatusCat = SlmAssetMovement.StatusCat.Any;
|
||||
assetMovement = await AssetMgr.GetAssetMovement_Mobile(prmAssetMovement, taskData);
|
||||
// Retrieve Container.
|
||||
if (assetMovement != null)
|
||||
{
|
||||
if (assetMovement.AssetItemType == Slm.AssetItemType.Container)
|
||||
{
|
||||
SlmContainer.Params prmContainer = new SlmContainer.Params();
|
||||
prmContainer.IncludedIds.Add(assetMovement.AssetItemId);
|
||||
prmContainer.StatusCat = SlmContainer.StatusCat.Any;
|
||||
container = await AssetMgr.GetContainer_Mobile(prmContainer, taskData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { Logger.Debug(fn + " " + exc.GetLogMessage(6)); }
|
||||
if (assetMovement == null)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await DisplayAlert("Asset Movement", "Failed to retrieve Asset movement data.", "OK");
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (assetMovement.AssetItemType == Slm.AssetItemType.Container)
|
||||
{
|
||||
if (container == null)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await DisplayAlert("Asset Movement", "Failed to retrieve Container data.", "OK");
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await DisplayAlert("Asset Movement", "Unrecognised asset type: " + assetMovement.AssetItemType.ToString() + ".", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
// Configure Asset Movement page.
|
||||
SlmPage_Assets_Movement.Config pageConfig = new SlmPage_Assets_Movement.Config();
|
||||
pageConfig.AssetMovementToUpdate = assetMovement;
|
||||
pageConfig.AssetMovement_Container = container;
|
||||
pageConfig.ReadOnly = true;
|
||||
if (pageConfig.ReadOnly) pageConfig.NavigationMode = Core.Forms.Base.SlmFormPage.NavigationMode.Close;
|
||||
SlmPage_Assets_Movement assetRepairForm = new SlmPage_Assets_Movement (pageConfig);
|
||||
assetRepairForm.Disappearing += (sender2, e2) =>
|
||||
{
|
||||
};
|
||||
await SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false);
|
||||
});
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
+8
-5
@@ -4,6 +4,7 @@ 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.Core.Forms.Panels;
|
||||
using Sarand.LogisticsMgr.Mobile.Forms.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -39,7 +40,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
// Properties.
|
||||
protected abstract String HeaderCaption { get; }
|
||||
public ushort ItemsPerPage { get; protected set; } = 8;
|
||||
protected SaxPanel_ItemListHeader HeaderPanel { get; private set; }
|
||||
protected SlmPanel_ItemListHeader HeaderPanel { get; private set; }
|
||||
protected SlmWebView ItemListWebView { get; private set; } = new SlmWebView();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -58,12 +59,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
int gridRowIdx = -1;
|
||||
|
||||
// Header panel.
|
||||
SaxPanel_ItemListHeader.Config headerPanelConfig = new SaxPanel_ItemListHeader.Config();
|
||||
SlmPanel_ItemListHeader.Config headerPanelConfig = new SlmPanel_ItemListHeader.Config();
|
||||
headerPanelConfig.Caption = HeaderCaption;
|
||||
headerPanelConfig.LabelMargin = SlmMobile.LabelMargin;
|
||||
headerPanelConfig.LabelFontSizeRatio = SlmMobile.FontSizeRatio;
|
||||
headerPanelConfig.FilterPropertyTypes.AddRange(GetFilterPropertyTypes());
|
||||
HeaderPanel = new SaxPanel_ItemListHeader(headerPanelConfig);
|
||||
HeaderPanel = new SlmPanel_ItemListHeader(headerPanelConfig);
|
||||
gridRowIdx++;
|
||||
viewGrid.Children.Add(HeaderPanel, 0, gridRowIdx);
|
||||
// Paging events.
|
||||
@@ -77,6 +76,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
HorizontalOptions = LayoutOptions.FillAndExpand,
|
||||
VerticalOptions = LayoutOptions.FillAndExpand
|
||||
};
|
||||
ItemListWebView.AppNavigating += ItemListWebView_AppNavigating;
|
||||
gridRowIdx++;
|
||||
viewGrid.Children.Add(ItemListWebView, 0, gridRowIdx);
|
||||
DisplayItemList(null);
|
||||
@@ -145,6 +145,9 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
{
|
||||
RefreshItemList();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>'App' navigation events on Item List web view control.</summary>
|
||||
protected abstract void ItemListWebView_AppNavigating (object sender, SaxWebView.AppNavigatingEventArgs eventArgs);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
ValidateUserProfile(responseData);
|
||||
});
|
||||
}
|
||||
catch (Exception exc) { Logger.Debug(fn + " " + exc.GetLogMessage()); }
|
||||
catch (Exception exc) { if (SacsSystem.DebugMode) Logger.Warn(fn + " " + exc.GetLogMessage()); }
|
||||
finally
|
||||
{
|
||||
requestingUserProfile = false;
|
||||
|
||||
+160
-15
@@ -1,5 +1,6 @@
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Mobile.Forms.Controls;
|
||||
using Sarand.Core.Mobile.Forms.Panels;
|
||||
using Sarand.Core.Tasks;
|
||||
@@ -58,6 +59,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
public ColumnDfn Status { get; set; }
|
||||
}
|
||||
private Columns cols = new Columns();
|
||||
private String berthingDoubleClickedPrefix = "BerthingDblClick#";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
@@ -218,7 +220,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
DisplayItemList(responseData);
|
||||
});
|
||||
}
|
||||
catch (Exception exc) { Logger.Debug(fn + " " + exc.GetLogMessage(6)); }
|
||||
catch (Exception exc) { if (SacsSystem.DebugMode) Logger.Warn(fn + " " + exc.GetLogMessage(6)); }
|
||||
}, taskDataRefreshList_Local.CancellationToken)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
@@ -239,7 +241,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
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>";
|
||||
string html = "<html><head>"+GetItemListStyles().Concat("\n")+GetItemListScripts().Concat("\n")+"</head><body>";
|
||||
if (message != null)
|
||||
{
|
||||
String messageClass = "inf";
|
||||
@@ -263,19 +265,36 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
//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.VesselName.DataName) + "</div>";
|
||||
html += "<div class='floatr'>" + item.GetValue(cols.AgentName.DataName) + "</div>";
|
||||
html += "<div class='clearb'></div>";
|
||||
// Berthing status.
|
||||
html += "<div id='AssMov-" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "' class='item' ondblclick='slm.openBerthing(" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + ")'>";
|
||||
html += "<table class='fullwidth'>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Vessel</td><td class='value bold'>" + item.GetValue(cols.VesselName.DataName) + "</td>";
|
||||
html += " <td class='label'>Agent</td><td class='value'>" + item.GetValue(cols.AgentName.DataName) + "</td>";
|
||||
html += " </tr>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Customer</td><td class='value'>" + item.GetValue(cols.CustomerName.DataName) + "</td>";
|
||||
html += " <td class='label'></td><td class='value'>" + "</td>";
|
||||
html += " </tr>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Berth</td><td class='value'>" + item.GetValue(cols.Berth.DataName) + "</td>";
|
||||
html += " <td class='label'>Bollard</td><td class='value'>" + item.GetValue(cols.Bollard.DataName) + "</td>";
|
||||
html += " </tr>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Arrived</td><td class='value'>" + DateUtil.Format(item.GetDateTimeValue(cols.Arrived.DataName), "ddd d-MMM-yyyy") + "</td>";
|
||||
SaStatus berthingStatus = SacsSystem.GetStatusForCode(item.GetValue(cols.Status.DataName));
|
||||
html += "<div class=''>Customer: " + item.GetValue(cols.CustomerName.DataName) + "</div>";
|
||||
html += "<div class=''>Berth: " + item.GetValue(cols.Berth.DataName) + " </div>";
|
||||
html += "<div class=''>Bollard: " + item.GetValue(cols.Bollard.DataName) + "</div>";
|
||||
html += "<div class=''>Status: " + SacsSystem.GetStatusDesc(berthingStatus) + "</div>";
|
||||
html += "<div class=''>Arrived: " + DateUtil.Format(item.GetDateTimeValue(cols.Arrived.DataName), "d-MMM-yyyy") + "</div>";
|
||||
html += "<div class=''>Completed: " + DateUtil.Format(item.GetDateTimeValue(cols.Completed.DataName), "d-MMM-yyyy") + "</div>";
|
||||
html += "<div class=''>Departed: " + DateUtil.Format(item.GetDateTimeValue(cols.Departed.DataName), "d-MMM-yyyy") + "</div>";
|
||||
html += " <td class='label'>Status</td><td class='value'>" + SacsSystem.GetStatusDesc(berthingStatus) + "</td>";
|
||||
html += " </tr>";
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Completed</td><td class='value'>" + DateUtil.Format(item.GetDateTimeValue(cols.Completed.DataName), "ddd d-MMM-yyyy") + "</td>";
|
||||
html += " <td class='label'>Departed</td><td class='value'>" + DateUtil.Format(item.GetDateTimeValue(cols.Departed.DataName), "ddd d-MMM-yyyy") + "</td>";
|
||||
html += " </tr>";
|
||||
if (SacsSystem.DebugMode)
|
||||
{
|
||||
html += " <tr>";
|
||||
html += " <td class='label'>Id</td><td class='value'>" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "</td>";
|
||||
html += " </tr>";
|
||||
}
|
||||
html += "</table>";
|
||||
html += "</div>";
|
||||
}
|
||||
}
|
||||
@@ -288,10 +307,11 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
{
|
||||
return new List<string>()
|
||||
{
|
||||
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiCss) + "</style>",
|
||||
"<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;}",
|
||||
"body{padding:4px;font-size:" + SlmMobile.HtmlFontSize + ";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;}",
|
||||
@@ -302,10 +322,135 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
|
||||
"</style>"
|
||||
};
|
||||
}
|
||||
private List<String> GetItemListScripts ()
|
||||
{
|
||||
return new List<string>()
|
||||
{
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryJs) + "</script>",
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiJs) + "</script>",
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseJs) + "</script>",
|
||||
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseJs) + "</script>",
|
||||
"<script>",
|
||||
"slm.openBerthing=function(id)",
|
||||
"{",
|
||||
//" alert('slm.openAssetMovement Id: '+id)",
|
||||
" document.location=\"" + SaxWebView.AppActionPrefix + berthingDoubleClickedPrefix + "\"+id;",
|
||||
"}",
|
||||
"$(function()",
|
||||
"{",
|
||||
" ",
|
||||
"});",
|
||||
"</script>"
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a n e l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
private SacsTaskData taskDataAppAction;
|
||||
/// <summary>'App' navigation events on Item List web view control.</summary>
|
||||
protected override void ItemListWebView_AppNavigating (object sender, SaxWebView.AppNavigatingEventArgs eventArgs)
|
||||
{
|
||||
String fn = GetType().Name + ".ItemListWebView_AppNavigating";
|
||||
if (SacsSystem.DebugMode) Logger.Debug(fn + " AppAction: " + eventArgs.AppAction);
|
||||
// Cancel previous action.
|
||||
if (taskDataAppAction != null)
|
||||
{
|
||||
taskDataAppAction.TriggerCancellation();
|
||||
taskDataAppAction = null;
|
||||
}
|
||||
taskDataAppAction = new SacsTaskData(null);
|
||||
if (eventArgs.AppAction.StartsWithCI(berthingDoubleClickedPrefix))
|
||||
{
|
||||
SacsTaskData taskDataAppAction_Local = taskDataAppAction;
|
||||
SysId berthingId = new SysId(StringUtil.ToInt(eventArgs.AppAction.Right(eventArgs.AppAction.Length - berthingDoubleClickedPrefix.Length)));
|
||||
Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await showBerthingForm(berthingId, taskDataAppAction_Local);
|
||||
}
|
||||
catch (Exception exc) { if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc)); }
|
||||
}, taskDataAppAction_Local.CancellationToken)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
taskDataAppAction_Local.Dispose();
|
||||
if (taskDataAppAction == taskDataAppAction_Local)
|
||||
taskDataAppAction = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
private async Task showBerthingForm (SysId berthingId, SacsTaskData taskDataAppAction_Local)
|
||||
{
|
||||
String fn = GetType().Name + ".ItemListWebView_AppNavigating";
|
||||
if (!SysId.IsValid(berthingId))
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await DisplayAlert("Ship File", "Invalid berthing selected.", "OK");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve Berthing and associated details.
|
||||
SlmBerthing berthing = null;
|
||||
SlmVessel vessel = null;
|
||||
try
|
||||
{
|
||||
SacsTaskData taskData = new SacsTaskData(null) { Debug = SacsSystem.DebugMode };
|
||||
// Retrieve Berthing.
|
||||
SlmBerthing.Params prmBerthing = new SlmBerthing.Params();
|
||||
prmBerthing.IncludedIds.Add(berthingId);
|
||||
prmBerthing.StatusCat = SlmBerthing.StatusCat.Any;
|
||||
// ToDo berthing = await BerthingMgr.GetBerthing_Mobile(prmBerthing, taskData);
|
||||
// Retrieve Vessel.
|
||||
if (berthing != null)
|
||||
{
|
||||
if (SysId.IsValid(berthing.VesselId))
|
||||
{
|
||||
SlmVessel.Params prmVessel = new SlmVessel.Params();
|
||||
prmVessel.IncludedIds.Add(berthing.VesselId);
|
||||
prmVessel.StatusCat = SlmVessel.StatusCat.Any;
|
||||
// ToDo vessel = await BerthingMgr.GetVessel_Mobile(prmVessel, taskData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { Logger.Debug(fn + " " + exc.GetLogMessage(6)); }
|
||||
if (berthing == null)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await DisplayAlert("Ship File", "Failed to retrieve Berthing data.", "OK");
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (vessel == null)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await DisplayAlert("Ship File", "Failed to retrieve Vessel data.", "OK");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
// ToDo Configure Asset Movement page.
|
||||
/*
|
||||
SlmPage_ShipFile_Berthing.Config pageConfig = new SlmPage_ShipFile_Berthing.Config();
|
||||
pageConfig.BerthingToUpdate = berthing;
|
||||
pageConfig.Berthing_Vessel = vessel;
|
||||
pageConfig.ReadOnly = true;
|
||||
if (pageConfig.ReadOnly) pageConfig.NavigationMode = Core.Forms.Base.SlmFormPage.NavigationMode.Close;
|
||||
SlmPage_ShipFile_Berthing assetRepairForm = new SlmPage_ShipFile_Berthing (pageConfig);
|
||||
assetRepairForm.Disappearing += (sender2, e2) =>
|
||||
{
|
||||
};
|
||||
await SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false);
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
// P e r s i s t e n t S e s s i o n P r o p e r t i e s
|
||||
//-------------------------------------------------------------------
|
||||
public String DefaultEmailAddress { get; set; }
|
||||
public SlmSiteDefinition DefaultSiteDefinition { get; set; }
|
||||
protected static String PropertyName_Context_Site_Code { get; } = "Context-Site-Code";
|
||||
protected static String PropertyName_Context_Site_Url { get; } = "Context-Site-Url";
|
||||
protected static String PropertyName_Context_EmailAddress { get; } = "Context-Email";
|
||||
@@ -70,7 +71,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
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 sessionEmail = Properties.GetValue(PropertyName_Context_EmailAddress, sessionProfile.EmailAddress);
|
||||
// Populate session properties.
|
||||
// Populate default session properties.
|
||||
// Site definition.
|
||||
if (sessionSiteCode != null && sessionSiteUrl != null)
|
||||
{
|
||||
@@ -80,19 +81,21 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
{
|
||||
if (siteDefinition.Site != site) continue;
|
||||
if (!siteDefinition.URL.Equals(siteUrl)) continue;
|
||||
SetSite(siteDefinition);
|
||||
DefaultSiteDefinition = siteDefinition;
|
||||
}
|
||||
}
|
||||
// User & Email.
|
||||
// User email.
|
||||
if (sessionEmail != null) DefaultEmailAddress = sessionEmail.ToString();
|
||||
}
|
||||
public void StorePersistentSessionProperties ()
|
||||
{
|
||||
SlmSessionProfile_Mobile sessionProfile = SlmGlobals_Mobile.SessionProfile;
|
||||
if (sessionProfile == null) return;
|
||||
Properties[PropertyName_Context_Site_Code] = SlmSystem.GetSiteCode(sessionProfile.Site);
|
||||
Properties[PropertyName_Context_Site_Url] = sessionProfile.SiteDefinition.URL;
|
||||
Properties[PropertyName_Context_EmailAddress] = sessionProfile.EmailAddress;
|
||||
if (DefaultSiteDefinition != null)
|
||||
{
|
||||
Properties[PropertyName_Context_Site_Code] = SlmSystem.GetSiteCode(DefaultSiteDefinition.Site);
|
||||
Properties[PropertyName_Context_Site_Url] = DefaultSiteDefinition.URL;
|
||||
}
|
||||
if (!StringUtil.IsEmpty(DefaultEmailAddress))
|
||||
Properties[PropertyName_Context_EmailAddress] = DefaultEmailAddress;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -60,6 +60,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
public static Color MenuBackgroundColor { get; } = Color.FromHex("#F0F0F0");
|
||||
public static Color MenuHeaderBackgroundColor { get; } = Color.FromHex("#E0E0E0");
|
||||
// Dynamic font sizing.
|
||||
public static String HtmlFontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SaxApplication.MinDeviceDimension > 2000) return "18px";
|
||||
if (SaxApplication.MinDeviceDimension > 1600) return "16px";
|
||||
if (SaxApplication.MinDeviceDimension > 1200) return "14px";
|
||||
return "12px";
|
||||
}
|
||||
}
|
||||
public static double FontSizeRatio
|
||||
{
|
||||
get
|
||||
@@ -84,9 +94,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
public static double PageNavigationPaddingVertical { get; } = 4.0;
|
||||
public static Color PageNavigationBorderColor { get; } = Color.FromHex("#808080");
|
||||
public static Color PageNavigationBackgroundColor { get; } = Color.FromHex("#e9f6fb");
|
||||
// Item List.
|
||||
public static double ItemListHeaderBorderWidth { get; set; } = 2.0;
|
||||
public static float ItemListHeaderBorderRadius = 6.0f;
|
||||
public static Color ItemListHeaderBorderColor = ApplicationBarBackgroundColor;
|
||||
public static Color ItemListHeaderBackgroundColor = Color.FromHex("#F0F0F0");
|
||||
// Controls.
|
||||
public static Color ControlBackgroundColor { get; } = Color.FromHex("#f8f8f8");
|
||||
public static Color ControlBorderColor { get; } = Color.FromHex("#f8f8f8");
|
||||
public static Color ControlBackgroundColor { get; } = Color.FromHex("#F8F8F8");
|
||||
public static Color ControlBorderColor { get; } = Color.FromHex("#E0E0E0");
|
||||
public static double ControlBorderWidth { get; } = 0.5;
|
||||
public static Thickness LabelMargin { get; } = new Thickness(4.0, 8.0, 0, 0);
|
||||
// Associated items panel.
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
Granted = securityRight.GetBoolValue("Granted");
|
||||
}
|
||||
}
|
||||
public SaSecurityProfile_Mobile ()
|
||||
{
|
||||
// Blank profile.
|
||||
}
|
||||
public SaSecurityProfile_Mobile (SlmWebServiceItemData securityItem)
|
||||
{
|
||||
// Security item properties.
|
||||
@@ -73,6 +77,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public bool ValidProfile { get { return SysId.IsValid(UserId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Refresh profile.
|
||||
public bool RefreshProfile (SlmSiteDefinition siteDefinition, SlmWebServiceItemData securityItem)
|
||||
@@ -88,7 +96,21 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
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));
|
||||
return ValidProfile && SysId.InvalidOnNull(UserId).Equals(SysId.InvalidOnNull(userProfile.Id));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Clear profile.
|
||||
public bool ClearProfile ()
|
||||
{
|
||||
String fn = GetType().Name+".ClearProfile";
|
||||
ClearErrorState();
|
||||
// Construct User Security Profile.
|
||||
SaSecurityProfile userProfile = new SaSecurityProfile_Mobile();
|
||||
UserId = new SysId();
|
||||
RefreshProfile(userProfile, null);
|
||||
if (SacsSystem.DebugMode) Logger.Debug(fn + " User logged out");
|
||||
return !ValidProfile;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
private class SlmSiteDefinition_Mobile : SlmSiteDefinition { }
|
||||
internal class SlmSiteDefinition_Mobile : SlmSiteDefinition { }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -19,7 +19,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
// Construction.
|
||||
protected SlmSessionContext_Mobile (SlmSiteDefinition siteDefinition) : base(0)
|
||||
{
|
||||
if (siteDefinition == null) siteDefinition = new SlmSiteDefinition_Mobile();
|
||||
siteDefinition = siteDefinition ?? new SlmSiteDefinition_Mobile();
|
||||
Site = (siteDefinition != null ? siteDefinition.Site : Slm.Site.Unknown);
|
||||
SiteDefinition = siteDefinition;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
// Populate Security Profile.
|
||||
SecurityProfile_Mobile.RefreshProfile(SessionContext_Mobile.SiteDefinition, securityItem);
|
||||
}
|
||||
internal void LogoutUser ()
|
||||
{
|
||||
userData_Mobile.Clear();
|
||||
SecurityProfile_Mobile.ClearProfile();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -61,6 +66,12 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
SlmGlobals_Mobile.Application.SetSite(siteDefinition);
|
||||
return UserContext.ValidUser && SiteDefinition.Valid;
|
||||
}
|
||||
public bool LogoutUser ()
|
||||
{
|
||||
userContext_Local.LogoutUser();
|
||||
SlmGlobals_Mobile.Application.SetSite(new SlmSessionContext_Mobile.SlmSiteDefinition_Mobile());
|
||||
return !(UserContext.ValidUser && SiteDefinition.Valid);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// S e s s i o n P r o f i l e E v e n t s
|
||||
|
||||
@@ -20,6 +20,13 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
EmailAddress = securityItem.GetValue("EmailAddress");
|
||||
DisplayName = securityItem.GetValue("Description");
|
||||
}
|
||||
public void Clear ()
|
||||
{
|
||||
SecurityItemId = new Sarand.Core.Bus.SysId();
|
||||
SecurityItemCode = "";
|
||||
EmailAddress = "";
|
||||
DisplayName = "";
|
||||
}
|
||||
}
|
||||
protected class SlmSessionContext_Mobile_Internal : SlmSessionContext_Mobile
|
||||
{
|
||||
@@ -27,7 +34,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
|
||||
public void SetSiteDefinition (SlmSiteDefinition siteDefinition)
|
||||
{
|
||||
SiteDefinition = siteDefinition;
|
||||
Site = siteDefinition.Site;
|
||||
Site = siteDefinition?.Site ?? Slm.Site.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.CodeTypes
|
||||
foreach (SaCodeType codeType in codeTypes)
|
||||
{
|
||||
if (prmCode.CodeTypeIds.HasValidIds() && !prmCode.CodeTypeIds.Contains(codeType.Id)) continue;
|
||||
if (prmCode.CodeTypeCodes.Count > 1 && !prmCode.CodeTypeCodes.ContainsCI(codeType.Code)) continue;
|
||||
if (prmCode.CodeTypeCodes.Count > 0 && !prmCode.CodeTypeCodes.ContainsCI(codeType.Code)) continue;
|
||||
|
||||
// Code Type is valid - filter code for code types.
|
||||
foreach (SaCode saCode in GetCodeListForCodeType(codeType.Code, prmCode.StatusCat == SaCode.StatusCat.ActiveOnly))
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
// Components.
|
||||
private SlmContentView outerView = new SlmContentView();
|
||||
private SlmContentView embeddedView = new SlmContentView();
|
||||
private readonly SlmLabel label = new SlmLabel();
|
||||
private readonly SlmLabel labelReadOnly = new SlmLabel();
|
||||
// Styling.
|
||||
private Thickness borderThickness = new Thickness();
|
||||
private Color borderColor = Color.Transparent;
|
||||
@@ -40,8 +40,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
BorderWidth = SlmMobile.ControlBorderWidth;
|
||||
|
||||
// Read-only label configuration.
|
||||
label.BackgroundColor = Color.Transparent;
|
||||
label.Margin = new Thickness(SlmMobile.LabelMargin.Left, SlmMobile.LabelMargin.Top);
|
||||
labelReadOnly.BackgroundColor = Color.Transparent;
|
||||
labelReadOnly.Margin = new Thickness(SlmMobile.LabelMargin.Left, SlmMobile.LabelMargin.Top);
|
||||
|
||||
SetControlActivity();
|
||||
}
|
||||
@@ -64,9 +64,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
get { return readOnly; }
|
||||
set { if (readOnly == value) return; readOnly = value; SetControlActivity(); }
|
||||
}
|
||||
public String ReadOnlyText
|
||||
protected String ReadOnlyText
|
||||
{
|
||||
set { if (label.Text.Equals(value)) return; label.Text = value; }
|
||||
get{ return labelReadOnly.Text; }
|
||||
set { if (labelReadOnly.Text.Equals(value)) return; labelReadOnly.Text = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -93,7 +94,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
}
|
||||
protected override void SetControlsReadOnly ()
|
||||
{
|
||||
if (readOnly) Content = label;
|
||||
if (readOnly) Content = labelReadOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Mobile.Forms.Controls;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
{
|
||||
//=======================================================================
|
||||
public class SlmDatePicker : SaxDatePicker
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmDatePicker ()
|
||||
{
|
||||
// Font sizing.
|
||||
FontSize = FontSize * SlmMobile.FontSizeRatio;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P i c k e r E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Mobile.Forms.Controls;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
{
|
||||
//=======================================================================
|
||||
public class SlmDatePickerView : SlmControlView
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly SlmDatePicker datePicker = new SlmDatePicker();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmDatePickerView (SlmDatePicker suppliedPicker = null)
|
||||
{
|
||||
// Control configuration.
|
||||
if (suppliedPicker != null) datePicker = suppliedPicker;
|
||||
datePicker.BackgroundColor = Color.Transparent;
|
||||
|
||||
// Control events.
|
||||
datePicker.BackgroundColor = Color.Transparent;
|
||||
datePicker.DateSelected += DatePicker_DateSelected;
|
||||
datePicker.Focused += DatePicker_Focused;
|
||||
datePicker.Unfocused += DatePicker_Unfocused;
|
||||
|
||||
ConfigureComponents();
|
||||
SetControlActivity();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
protected SlmDatePicker DatePicker { get { return datePicker; } }
|
||||
public DateTime Date
|
||||
{
|
||||
get { return datePicker.Date; }
|
||||
set { if (datePicker.Date == value) return; datePicker.Date = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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>
|
||||
protected override void ConfigureComponents ()
|
||||
{
|
||||
base.ConfigureComponents();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l A c t i v i t y
|
||||
//-------------------------------------------------------------------
|
||||
protected override void SetControlActivity ()
|
||||
{
|
||||
base.SetControlActivity();
|
||||
SetControlsReadOnly();
|
||||
}
|
||||
protected override void SetControlsReadOnly ()
|
||||
{
|
||||
base.SetControlsReadOnly();
|
||||
if (!ReadOnly) Content = datePicker;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// V i e w 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);
|
||||
//Logger.Debug(GetType().Name + ".OnPropertyChanged Name=" + 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
public event EventHandler<DateChangedEventArgs> DateSelected;
|
||||
private void DatePicker_DateSelected (object sender, DateChangedEventArgs e)
|
||||
{
|
||||
ReadOnlyText = datePicker.Date != null ? DateUtil.Format(datePicker.Date, datePicker.Format) : "";
|
||||
if (ReadOnly) return;
|
||||
if (DateSelected != null) DateSelected.Invoke(sender, e);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
private void DatePicker_Focused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Focused(sender, e);
|
||||
}
|
||||
private void DatePicker_Unfocused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Unfocused(sender, e);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Sarand.Core.Mobile.Forms.Controls;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
{
|
||||
//=======================================================================
|
||||
public class SlmEditor : SaxEditor
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmEditor ()
|
||||
{
|
||||
// Font sizing.
|
||||
FontSize = FontSize * SlmMobile.FontSizeRatio;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Mobile.Forms.Controls;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
{
|
||||
//=======================================================================
|
||||
public class SlmEditorView : SlmControlView
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly SlmEditor entry = new SlmEditor();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmEditorView ()
|
||||
{
|
||||
// Control configuration.
|
||||
entry.BackgroundColor = Color.Transparent;
|
||||
|
||||
// Editor events.
|
||||
entry.Focused += Editor_Focused;
|
||||
entry.Unfocused += Editor_Unfocused;
|
||||
entry.TextChanged += Editor_TextChanged;
|
||||
entry.Completed += Editor_Completed;
|
||||
|
||||
ConfigureComponents();
|
||||
SetControlActivity();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public int MaxLength
|
||||
{
|
||||
get { return entry.MaxLength; }
|
||||
set { entry.MaxLength = value; }
|
||||
}
|
||||
public Keyboard Keyboard
|
||||
{
|
||||
get { return entry.Keyboard; }
|
||||
set { entry.Keyboard = value; }
|
||||
}
|
||||
public String Text
|
||||
{
|
||||
get { return entry.Text; }
|
||||
set { value = StringUtil.EmptyOnNull(value); if (entry.Text != null && entry.Text.Equals(value)) return; entry.Text = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l A c t i v i t y
|
||||
//-------------------------------------------------------------------
|
||||
protected override void SetControlActivity ()
|
||||
{
|
||||
base.SetControlActivity();
|
||||
SetControlsReadOnly();
|
||||
}
|
||||
protected override void SetControlsReadOnly ()
|
||||
{
|
||||
base.SetControlsReadOnly();
|
||||
if (!ReadOnly) Content = entry;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
private void Editor_Focused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Focused(sender, e);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
private void Editor_Unfocused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Unfocused(sender, e);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Text changed.
|
||||
public event EventHandler<TextChangedEventArgs> TextChanged;
|
||||
private void Editor_TextChanged (object sender, TextChangedEventArgs e)
|
||||
{
|
||||
ReadOnlyText = entry.Text;
|
||||
if (ReadOnly) return;
|
||||
if (TextChanged != null) TextChanged.Invoke(sender, e);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Completed.
|
||||
public event EventHandler Completed;
|
||||
private void Editor_Completed (object sender, EventArgs e)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
if (Completed != null) Completed.Invoke(sender, e);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// V i e w 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);
|
||||
//Logger.Debug(GetType().Name + ".OnPropertyChanged Name=" + 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -22,6 +22,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
}
|
||||
public class Config
|
||||
{
|
||||
public bool ReadOnly { get; set; }
|
||||
public NavigationMode NavigationMode { get; set; } = NavigationMode.OkCancel;
|
||||
}
|
||||
|
||||
@@ -64,6 +65,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
// Managers.
|
||||
protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } }
|
||||
protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// I n i t i a l i s e
|
||||
//-------------------------------------------------------------------
|
||||
@@ -94,7 +96,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
viewCaptionBar.Children.Add(labelCaption);
|
||||
labelCaption.Text = "Form";
|
||||
labelCaption.TextColor = SlmMobile.PageCaptionTextColor;
|
||||
labelCaption.FontSize *= SlmMobile.PageCaptionTextSizeRatio;
|
||||
labelCaption.FontSize *= SlmMobile.FontSizeRatio * SlmMobile.PageCaptionTextSizeRatio;
|
||||
labelCaption.HorizontalOptions = LayoutOptions.CenterAndExpand;
|
||||
labelCaption.HorizontalTextAlignment = TextAlignment.Center;
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Mobile.Forms.Controls;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
{
|
||||
//=======================================================================
|
||||
public class SlmLabelView : SlmControlView
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmLabelView ()
|
||||
{
|
||||
// Control configuration.
|
||||
ConfigureComponents();
|
||||
SetControlActivity();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public String Text
|
||||
{
|
||||
get { return ReadOnlyText; }
|
||||
set { if (ReadOnlyText.Equals(value)) return; ReadOnlyText = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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>
|
||||
protected override void ConfigureComponents ()
|
||||
{
|
||||
ReadOnly = true;
|
||||
base.ConfigureComponents();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l A c t i v i t y
|
||||
//-------------------------------------------------------------------
|
||||
protected override void SetControlActivity ()
|
||||
{
|
||||
SetControlsReadOnly();
|
||||
}
|
||||
protected override void SetControlsReadOnly ()
|
||||
{
|
||||
base.SetControlsReadOnly();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// V i e w E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -26,13 +26,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
// Control configuration.
|
||||
if (suppliedPicker != null) picker = suppliedPicker;
|
||||
picker.BackgroundColor = Color.Transparent;
|
||||
// In case picker pre-populated and default item selected.
|
||||
ReadOnlyText = (picker.SelectedItem != null ? picker.SelectedItem.ToString() : "");
|
||||
|
||||
// Control events.
|
||||
picker.Populated += Picker_Populated;
|
||||
picker.SelectedIndexChanged += Picker_SelectedIndexChanged;
|
||||
picker.Focused += Picker_Focused;
|
||||
picker.Unfocused += Picker_Unfocused;
|
||||
picker.BackgroundColor = Color.Transparent;
|
||||
picker.SelectedIndexChanged += Picker_SelectedIndexChanged;
|
||||
picker.Populated += Picker_Populated;
|
||||
|
||||
ConfigureComponents();
|
||||
SetControlActivity();
|
||||
@@ -112,16 +113,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t r o l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
private void Picker_Focused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Focused(sender, e);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
private void Picker_Unfocused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Unfocused(sender, e);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
public event SaxPicker.PopulatedEventHandler Populated;
|
||||
private void Picker_Populated (object sender, SaxPicker.PopulatedEventArgs e)
|
||||
{
|
||||
@@ -135,6 +126,15 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
|
||||
if (ReadOnly) return;
|
||||
if (SelectedIndexChanged != null) SelectedIndexChanged.Invoke(sender, e);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
private void Picker_Focused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Focused(sender, e);
|
||||
}
|
||||
private void Picker_Unfocused (object sender, FocusEventArgs e)
|
||||
{
|
||||
Control_Unfocused(sender, e);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
+8
-8
@@ -16,18 +16,18 @@ using Xamarin.Forms;
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
|
||||
{
|
||||
//=======================================================================
|
||||
public class SlmPickerView_Codes : SlmPickerView
|
||||
public class SlmPickerView_CodeType : SlmPickerView
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmPickerView_Codes () : base(new SlmPicker_Codes()) { }
|
||||
public SlmPickerView_CodeType () : base(new SlmPicker_CodeType()) { }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Slm.CodeType CodeType
|
||||
{
|
||||
get { return (Picker as SlmPicker_Codes).CodeType; }
|
||||
set { (Picker as SlmPicker_Codes).CodeType = value; }
|
||||
get { return (Picker as SlmPicker_CodeType).CodeType; }
|
||||
set { (Picker as SlmPicker_CodeType).CodeType = value; }
|
||||
}
|
||||
public bool ContainsCode (String code)
|
||||
{
|
||||
@@ -35,14 +35,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
|
||||
}
|
||||
public String SelectedCode
|
||||
{
|
||||
get { return (Picker as SlmPicker_Codes).SelectedCode; }
|
||||
set { (Picker as SlmPicker_Codes).SelectedCode = value; }
|
||||
get { return (Picker as SlmPicker_CodeType).SelectedCode; }
|
||||
set { (Picker as SlmPicker_CodeType).SelectedCode = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
public class SlmPicker_Codes : SlmPicker
|
||||
public class SlmPicker_CodeType : SlmPicker
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
@@ -51,7 +51,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmPicker_Codes ()
|
||||
public SlmPicker_CodeType ()
|
||||
{
|
||||
PopulateCodes();
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
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_SystemCodes : SlmPickerView
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmPickerView_SystemCodes (Slm.SystemCode systemCodeType) :
|
||||
base(new SlmPicker_SystemCodes(systemCodeType))
|
||||
{ }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public String SelectedCode
|
||||
{
|
||||
get { return (Picker as SlmPicker_SystemCodes).SelectedItemCode; }
|
||||
set { (Picker as SlmPicker_SystemCodes).SelectedItemCode = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
public class SlmPicker_SystemCodes : SlmPicker
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private Slm.SystemCode systemCode;
|
||||
private List<TypeCodeDesc> systemCodes = new List<TypeCodeDesc>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmPicker_SystemCodes (Slm.SystemCode systemCodeType)
|
||||
{
|
||||
this.systemCode = systemCodeType;
|
||||
systemCodes.AddRange(SlmSystem.GetCodesOfType(systemCodeType));
|
||||
PopulateSystemCodes();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P o p u l a t i o n
|
||||
//-------------------------------------------------------------------
|
||||
public void PopulateSystemCodes ()
|
||||
{
|
||||
Items.Clear();
|
||||
foreach (TypeCodeDesc systemCode in systemCodes)
|
||||
{
|
||||
AddItem(systemCode.Code, systemCode.Desc);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using Sarand.Core.Mobile.Forms.Panels;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
|
||||
{
|
||||
public class SlmPanel_ItemListHeader : SaxPanel_ItemListHeader
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public new class Config : SaxPanel_ItemListHeader.Config
|
||||
{
|
||||
public Config ()
|
||||
{
|
||||
Margin = new Thickness(0, 0, 0, 4.0);
|
||||
HeaderBorderWidth = SlmMobile.ItemListHeaderBorderWidth;
|
||||
HeaderBorderRadius = SlmMobile.ItemListHeaderBorderRadius;
|
||||
HeaderBorderColor = SlmMobile.ItemListHeaderBorderColor;
|
||||
HeaderBackgroundColor = SlmMobile.ItemListHeaderBackgroundColor;
|
||||
LabelMargin = SlmMobile.LabelMargin;
|
||||
CaptionLabelFontSizeRatio = SlmMobile.FontSizeRatio * SlmMobile.PageCaptionTextSizeRatio;
|
||||
PagingLabelFontSizeRatio = SlmMobile.FontSizeRatio;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SlmPanel_ItemListHeader (Config config) :
|
||||
base(config)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a n e l E v e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -63,7 +63,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
public override SlmAssetMovement GetAssetMovement (SlmAssetMovement.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (GetAssetMovementCount(prm) != 1) return null;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public async Task<SlmAssetMovement> GetAssetMovement_Mobile (SlmAssetMovement.Params prmAssetMovement, SacsTaskData taskData)
|
||||
@@ -74,17 +73,17 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
|
||||
// Request item data.
|
||||
SlmWebServiceClient.ItemDataResponseData responseData = await webServiceClient.GetItemData(GetAssetMovementRequestConfig(SlmWebServiceRequest.RequestType.Data, taskData.Debug), GetAssetMovementQueryFilter_Mobile(prmAssetMovement), taskData);
|
||||
XElement dataElement = responseData.DataElement;
|
||||
if (dataElement == null) throw new NotSupportedException("No data element found in AssetMovement data response.");
|
||||
if (responseData.DataElement == null) throw new NotSupportedException("No data element found in AssetMovement data response.");
|
||||
if (responseData.ItemElement == null) throw new NotSupportedException("No item element found in AssetMovement data response.");
|
||||
if (responseData.Item == null) throw new NotSupportedException("No item extracted from AssetMovement data response.");
|
||||
|
||||
// Item construction properties.
|
||||
SysId id = new SysId(StringUtil.ToInt(dataElement.GetChildText(SlmAssetMovement.Column.Id.ToString())));
|
||||
Slm.AssetItemType assetItemType = EnumUtil.ParseEnum(dataElement.GetChildText(SlmAssetMovement.Column.AssetItemType.ToString()), Slm.AssetItemType.Unknown);
|
||||
ushort flags = (ushort)StringUtil.ToInt(dataElement.GetChildText(SlmAssetMovement.Column.Id.ToString()));
|
||||
SysId id = responseData.Item.GetIdValue(nameof(SlmAssetMovement.Id));
|
||||
Slm.AssetItemType assetItemType = EnumUtil.ParseEnum(responseData.Item.GetValue(nameof(SlmAssetMovement.AssetItemType)), Slm.AssetItemType.Unknown);
|
||||
ushort flags = (ushort)responseData.Item.GetIntValue(nameof(SlmAssetMovement.Flags));
|
||||
// Create item.
|
||||
SlmAssetMovement_Mobile assetMovement = new SlmAssetMovement_Mobile(Site, id, assetItemType, flags);
|
||||
// Populate item properties.
|
||||
PopulateFrom(dataElement, assetMovement);
|
||||
PopulateFrom(responseData.Item, assetMovement);
|
||||
return assetMovement;
|
||||
}
|
||||
|
||||
@@ -161,57 +160,57 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo (XElement assetMovementElement, SlmAssetMovement assetMovement, DbUpdateInfo dbUpdateInfo)
|
||||
public static void PopulateTo (XElement assetMovementElement, SlmAssetMovement assetMovement, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
// Movement.
|
||||
assetMovementElement.AppendElement("Id", SysId.ToString(assetMovement.Id));
|
||||
assetMovementElement.AppendElement("MovementType", assetMovement.MovementType.ToString());
|
||||
assetMovementElement.AppendElement("MovementAt", DateUtil.FormatXmlDateTime(assetMovement.MovementAt));
|
||||
assetMovementElement.AppendElement("MovementRef", assetMovement.MovementRef);
|
||||
assetMovementElement.AppendElement("MovementInfo", assetMovement.MovementInfo);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.Id), SysId.ToString(assetMovement.Id));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.MovementType), assetMovement.MovementType.ToString());
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.MovementAt), DateUtil.FormatXmlDateTime(assetMovement.MovementAt));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.MovementRef), assetMovement.MovementRef);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.MovementInfo), assetMovement.MovementInfo);
|
||||
// Associated data.
|
||||
assetMovementElement.AppendElement("MovementNotificationIdIn", SysId.ToString(assetMovement.MovementNotificationIdIn));
|
||||
assetMovementElement.AppendElement("MovementNotificationIdOut", SysId.ToString(assetMovement.MovementNotificationIdOut));
|
||||
assetMovementElement.AppendElement("VehicleMovementAssetIdIn", SysId.ToString(assetMovement.VehicleMovementAssetIdIn));
|
||||
assetMovementElement.AppendElement("VehicleMovementAssetIdOut", SysId.ToString(assetMovement.VehicleMovementAssetIdOut));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.MovementNotificationIdIn), SysId.ToString(assetMovement.MovementNotificationIdIn));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.MovementNotificationIdOut), SysId.ToString(assetMovement.MovementNotificationIdOut));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.VehicleMovementAssetIdIn), SysId.ToString(assetMovement.VehicleMovementAssetIdIn));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.VehicleMovementAssetIdOut), SysId.ToString(assetMovement.VehicleMovementAssetIdOut));
|
||||
// Customer.
|
||||
assetMovementElement.AppendElement("Customer", assetMovement.Customer);
|
||||
assetMovementElement.AppendElement("CustomerRef", assetMovement.CustomerRef);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.Customer), assetMovement.Customer);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.CustomerRef), assetMovement.CustomerRef);
|
||||
// Locations.
|
||||
assetMovementElement.AppendElement("LocationStart", assetMovement.LocationStart);
|
||||
assetMovementElement.AppendElement("LocationCurrent", assetMovement.LocationCurrent);
|
||||
assetMovementElement.AppendElement("LocationFinish", assetMovement.LocationFinish);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.LocationStart), assetMovement.LocationStart);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.LocationCurrent), assetMovement.LocationCurrent);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.LocationFinish), assetMovement.LocationFinish);
|
||||
// Transport.
|
||||
assetMovementElement.AppendElement("HaulierInitial", assetMovement.HaulierInitial);
|
||||
assetMovementElement.AppendElement("Haulier", assetMovement.HaulierFinal);
|
||||
assetMovementElement.AppendElement("RegistrationInitial", assetMovement.RegistrationInitial);
|
||||
assetMovementElement.AppendElement("VehicleRegistration", assetMovement.RegistrationFinal);
|
||||
assetMovementElement.AppendElement("WagonType", assetMovement.WagonType);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.HaulierInitial), assetMovement.HaulierInitial);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.HaulierFinal), assetMovement.HaulierFinal);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.RegistrationInitial), assetMovement.RegistrationInitial);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.RegistrationFinal), assetMovement.RegistrationFinal);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.WagonType), assetMovement.WagonType);
|
||||
// Asset.
|
||||
assetMovementElement.AppendElement("AssetItemType", assetMovement.AssetItemType.ToString());
|
||||
assetMovementElement.AppendElement("AssetItemId", SysId.ToString(assetMovement.AssetItemId));
|
||||
assetMovementElement.AppendElement("PinNumber", assetMovement.PinNumber);
|
||||
assetMovementElement.AppendElement("SealNumber", assetMovement.SealNumber);
|
||||
assetMovementElement.AppendElement("DangerousGoodsInfo", assetMovement.DangerousGoodsInfo);
|
||||
assetMovementElement.AppendElement("AssetTypeCode", assetMovement.AssetTypeCode);
|
||||
assetMovementElement.AppendElement("AssetSizeCode", assetMovement.AssetSizeCode);
|
||||
assetMovementElement.AppendElement("AssetWidth", assetMovement.AssetWidth.ToString("N3"));
|
||||
assetMovementElement.AppendElement("AssetHeight", assetMovement.AssetHeight.ToString("N3"));
|
||||
assetMovementElement.AppendElement("AssetLength", assetMovement.AssetLength.ToString("N3"));
|
||||
assetMovementElement.AppendElement("AssetWeightGross", assetMovement.AssetWeightGross.ToString("N3"));
|
||||
assetMovementElement.AppendElement("AssetConditionCode", assetMovement.AssetConditionCode);
|
||||
assetMovementElement.AppendElement("AssetHoldReasonCode", assetMovement.AssetHoldReasonCode);
|
||||
assetMovementElement.AppendElement("AssetHoldReason", assetMovement.AssetHoldReason);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetItemType), assetMovement.AssetItemType.ToString());
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetItemId), SysId.ToString(assetMovement.AssetItemId));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.PinNumber), assetMovement.PinNumber);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.SealNumber), assetMovement.SealNumber);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.DangerousGoodsInfo), assetMovement.DangerousGoodsInfo);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetTypeCode), assetMovement.AssetTypeCode);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetSizeCode), assetMovement.AssetSizeCode);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetWidth), assetMovement.AssetWidth.ToString("N3"));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetHeight), assetMovement.AssetHeight.ToString("N3"));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetLength), assetMovement.AssetLength.ToString("N3"));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetWeightGross), assetMovement.AssetWeightGross.ToString("N3"));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetConditionCode), assetMovement.AssetConditionCode);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetHoldReasonCode), assetMovement.AssetHoldReasonCode);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.AssetHoldReason), assetMovement.AssetHoldReason);
|
||||
// Status dates.
|
||||
assetMovementElement.AppendElement("InProgressAt", DateUtil.FormatXmlDateTime(assetMovement.InProgressAt));
|
||||
assetMovementElement.AppendElement("OnHoldAt", DateUtil.FormatXmlDateTime(assetMovement.OnHoldAt));
|
||||
assetMovementElement.AppendElement("CompletedAt", DateUtil.FormatXmlDateTime(assetMovement.CompletedAt));
|
||||
// TODO assetMovementElement.AppendElement("InvoicedAt", DateUtil.FormatXmlDateTime(assetMovement.InvoicedAt));
|
||||
assetMovementElement.AppendElement("CancelledAt", DateUtil.FormatXmlDateTime(assetMovement.CancelledAt));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.InProgressAt), DateUtil.FormatXmlDateTime(assetMovement.InProgressAt));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.OnHoldAt), DateUtil.FormatXmlDateTime(assetMovement.OnHoldAt));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.CompletedAt), DateUtil.FormatXmlDateTime(assetMovement.CompletedAt));
|
||||
// TODO assetMovementElement.AppendElement(nameof(SlmAssetMovement.InvoicedAt), DateUtil.FormatXmlDateTime(assetMovement.InvoicedAt));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.CancelledAt), DateUtil.FormatXmlDateTime(assetMovement.CancelledAt));
|
||||
// Common properties.
|
||||
assetMovementElement.AppendElement("Notes", assetMovement.Notes);
|
||||
assetMovementElement.AppendElement("Status", SacsSystem.GetStatusCode(assetMovement.Status));
|
||||
assetMovementElement.AppendElement("Flags", assetMovement.Flags.ToString());
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.Notes), assetMovement.Notes);
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.Status), SacsSystem.GetStatusCode(assetMovement.Status));
|
||||
assetMovementElement.AppendElement(nameof(SlmAssetMovement.Flags), assetMovement.Flags.ToString());
|
||||
if (!SysId.IsValid(assetMovement.Id))
|
||||
{
|
||||
assetMovementElement.AppendElement("CreateOn", DateUtil.FormatXmlDateTime(DateTime.Now));
|
||||
@@ -222,58 +221,58 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
assetMovementElement.AppendElement("UpdateBy", SysId.ToString(dbUpdateInfo.UserId));
|
||||
assetMovementElement.AppendElement("UpdateHost", dbUpdateInfo.Host);
|
||||
}
|
||||
private void PopulateFrom (XElement assetMovementElement, SlmAssetMovement assetMovement)
|
||||
public static void PopulateFrom (SlmWebServiceItemData itemData, SlmAssetMovement assetMovement)
|
||||
{
|
||||
// Movement.
|
||||
//assetMovement.Id = new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("Id")));
|
||||
assetMovement.MovementType = EnumUtil.ParseEnum(assetMovementElement.GetChildText("MovementType"), Slm.AssetMovementType.Unknown);
|
||||
assetMovement.MovementAt = DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("MovementAt"));
|
||||
assetMovement.MovementRef = assetMovementElement.GetChildText("MovementRef");
|
||||
assetMovement.MovementInfo = assetMovementElement.GetChildText("MovementInfo");
|
||||
//assetMovement.Id = itemData.GetIdValue(nameof(SlmAssetMovement.Id));
|
||||
assetMovement.MovementType = EnumUtil.ParseEnum(itemData.GetValue(nameof(SlmAssetMovement.MovementType)), Slm.AssetMovementType.Unknown);
|
||||
assetMovement.MovementAt = itemData.GetDateTimeValue(nameof(SlmAssetMovement.MovementAt));
|
||||
assetMovement.MovementRef = itemData.GetValue(nameof(SlmAssetMovement.MovementRef));
|
||||
assetMovement.MovementInfo = itemData.GetValue(nameof(SlmAssetMovement.MovementInfo));
|
||||
// Associated data.
|
||||
assetMovement.MovementNotificationIdIn = new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("MovementNotificationIdIn")));
|
||||
assetMovement.MovementNotificationIdOut = new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("MovementNotificationIdOut")));
|
||||
assetMovement.VehicleMovementAssetIdIn = new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("VehicleMovementAssetIdIn")));
|
||||
assetMovement.VehicleMovementAssetIdOut = new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("VehicleMovementAssetIdOut")));
|
||||
assetMovement.MovementNotificationIdIn = itemData.GetIdValue(nameof(SlmAssetMovement.MovementNotificationIdIn));
|
||||
assetMovement.MovementNotificationIdOut = itemData.GetIdValue(nameof(SlmAssetMovement.MovementNotificationIdOut));
|
||||
assetMovement.VehicleMovementAssetIdIn = itemData.GetIdValue(nameof(SlmAssetMovement.VehicleMovementAssetIdIn));
|
||||
assetMovement.VehicleMovementAssetIdOut = itemData.GetIdValue(nameof(SlmAssetMovement.VehicleMovementAssetIdOut));
|
||||
// Customer.
|
||||
assetMovement.Customer = assetMovementElement.GetChildText("Customer");
|
||||
assetMovement.CustomerRef = assetMovementElement.GetChildText("CustomerRef");
|
||||
assetMovement.Customer = itemData.GetValue(nameof(SlmAssetMovement.Customer));
|
||||
assetMovement.CustomerRef = itemData.GetValue(nameof(SlmAssetMovement.CustomerRef));
|
||||
// Locations.
|
||||
assetMovement.LocationStart = assetMovementElement.GetChildText("LocationStart");
|
||||
assetMovement.LocationCurrent = assetMovementElement.GetChildText("LocationCurrent");
|
||||
assetMovement.LocationFinish = assetMovementElement.GetChildText("LocationFinish");
|
||||
assetMovement.LocationStart = itemData.GetValue(nameof(SlmAssetMovement.LocationStart));
|
||||
assetMovement.LocationCurrent = itemData.GetValue(nameof(SlmAssetMovement.LocationCurrent));
|
||||
assetMovement.LocationFinish = itemData.GetValue(nameof(SlmAssetMovement.LocationFinish));
|
||||
// Transport.
|
||||
assetMovement.HaulierInitial = assetMovementElement.GetChildText("HaulierInitial");
|
||||
assetMovement.HaulierFinal = assetMovementElement.GetChildText("Haulier");
|
||||
assetMovement.RegistrationInitial = assetMovementElement.GetChildText("RegistrationInitial");
|
||||
assetMovement.RegistrationFinal = assetMovementElement.GetChildText("VehicleRegistration");
|
||||
assetMovement.WagonType = assetMovementElement.GetChildText("WagonType");
|
||||
assetMovement.HaulierInitial = itemData.GetValue(nameof(SlmAssetMovement.HaulierInitial));
|
||||
assetMovement.HaulierFinal = itemData.GetValue(nameof(SlmAssetMovement.HaulierFinal));
|
||||
assetMovement.RegistrationInitial = itemData.GetValue(nameof(SlmAssetMovement.RegistrationInitial));
|
||||
assetMovement.RegistrationFinal = itemData.GetValue(nameof(SlmAssetMovement.RegistrationFinal));
|
||||
assetMovement.WagonType = itemData.GetValue(nameof(SlmAssetMovement.WagonType));
|
||||
// Asset.
|
||||
//assetMovement.AssetItemType = (Slm.AssetItemType)dbAssetMovement._AssetItemType");
|
||||
assetMovement.AssetItemId = new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("AssetItemId")));
|
||||
assetMovement.PinNumber = assetMovementElement.GetChildText("PinNumber");
|
||||
assetMovement.SealNumber = assetMovementElement.GetChildText("SealNumber");
|
||||
assetMovement.DangerousGoodsInfo = assetMovementElement.GetChildText("DangerousGoodsInfo");
|
||||
assetMovement.AssetTypeCode = assetMovementElement.GetChildText("AssetTypeCode");
|
||||
assetMovement.AssetSizeCode = assetMovementElement.GetChildText("AssetSizeCode");
|
||||
assetMovement.AssetWidth = StringUtil.ToDecimal(assetMovementElement.GetChildText("AssetWidth"));
|
||||
assetMovement.AssetHeight = StringUtil.ToDecimal(assetMovementElement.GetChildText("AssetHeight"));
|
||||
assetMovement.AssetLength = StringUtil.ToDecimal(assetMovementElement.GetChildText("AssetLength"));
|
||||
assetMovement.AssetWeightGross = StringUtil.ToDecimal(assetMovementElement.GetChildText("AssetWeightGross"));
|
||||
assetMovement.AssetConditionCode = assetMovementElement.GetChildText("AssetConditionCode");
|
||||
assetMovement.AssetHoldReasonCode = assetMovementElement.GetChildText("AssetHoldReasonCode");
|
||||
assetMovement.AssetHoldReason = assetMovementElement.GetChildText("AssetHoldReason");
|
||||
//assetMovement.AssetItemType = EnumUtil.ParseEnum(itemData.GetValue(nameof(SlmAssetMovement.AssetItemType)), Slm.AssetItemType.Unknown);
|
||||
assetMovement.AssetItemId = itemData.GetIdValue(nameof(SlmAssetMovement.AssetItemId));
|
||||
assetMovement.PinNumber = itemData.GetValue(nameof(SlmAssetMovement.PinNumber));
|
||||
assetMovement.SealNumber = itemData.GetValue(nameof(SlmAssetMovement.SealNumber));
|
||||
assetMovement.DangerousGoodsInfo = itemData.GetValue(nameof(SlmAssetMovement.DangerousGoodsInfo));
|
||||
assetMovement.AssetTypeCode = itemData.GetValue(nameof(SlmAssetMovement.AssetTypeCode));
|
||||
assetMovement.AssetSizeCode = itemData.GetValue(nameof(SlmAssetMovement.AssetSizeCode));
|
||||
assetMovement.AssetWidth = itemData.GetDecimalValue(nameof(SlmAssetMovement.AssetWidth));
|
||||
assetMovement.AssetHeight = itemData.GetDecimalValue(nameof(SlmAssetMovement.AssetHeight));
|
||||
assetMovement.AssetLength = itemData.GetDecimalValue(nameof(SlmAssetMovement.AssetLength));
|
||||
assetMovement.AssetWeightGross = itemData.GetDecimalValue(nameof(SlmAssetMovement.AssetWeightGross));
|
||||
assetMovement.AssetConditionCode = itemData.GetValue(nameof(SlmAssetMovement.AssetConditionCode));
|
||||
assetMovement.AssetHoldReasonCode = itemData.GetValue(nameof(SlmAssetMovement.AssetHoldReasonCode));
|
||||
assetMovement.AssetHoldReason = itemData.GetValue(nameof(SlmAssetMovement.AssetHoldReason));
|
||||
// Status dates.
|
||||
assetMovement.InProgressAt = DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("InProgressAt"));
|
||||
assetMovement.OnHoldAt = DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("OnHoldAt"));
|
||||
assetMovement.CompletedAt = DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("CompletedAt"));
|
||||
// TODO assetMovement.InvoicedAt = DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("InvoicedAt"));
|
||||
assetMovement.CancelledAt = DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("CancelledAt"));
|
||||
assetMovement.InProgressAt = itemData.GetDateTimeValue(nameof(SlmAssetMovement.InProgressAt));
|
||||
assetMovement.OnHoldAt = itemData.GetDateTimeValue(nameof(SlmAssetMovement.OnHoldAt));
|
||||
assetMovement.CompletedAt = itemData.GetDateTimeValue(nameof(SlmAssetMovement.CompletedAt));
|
||||
// TODO assetMovement.InvoicedAt = assetMovementElement.GetDateTimeValue(nameof(SlmAssetMovement.InvoicedAt));
|
||||
assetMovement.CancelledAt = itemData.GetDateTimeValue(nameof(SlmAssetMovement.CancelledAt));
|
||||
// Common properties.
|
||||
assetMovement.Notes = assetMovementElement.GetChildText("Notes");
|
||||
assetMovement.Status = SacsSystem.GetStatusForCode(assetMovementElement.GetChildText("Status"));
|
||||
assetMovement.SetCreateStamp(DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("CreateOn")), new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("CreateBy"))), assetMovementElement.GetChildText("CreateHost"));
|
||||
assetMovement.SetUpdateStamp(DateUtil.ParseXmlDateTime(assetMovementElement.GetChildText("UpdateOn")), new SysId(StringUtil.ToInt(assetMovementElement.GetChildText("UpdateBy"))), assetMovementElement.GetChildText("UpdateHost"));
|
||||
assetMovement.Notes = itemData.GetValue(nameof(SlmAssetMovement.Notes));
|
||||
assetMovement.Status = SacsSystem.GetStatusForCode(itemData.GetValue(nameof(SlmAssetMovement.Status)));
|
||||
assetMovement.SetCreateStamp(itemData.GetDateTimeValue("CreateOn"), itemData.GetIdValue("CreateBy"), itemData.GetValue("CreateHost"));
|
||||
assetMovement.SetUpdateStamp(itemData.GetDateTimeValue("UpdateOn"), itemData.GetIdValue("UpdateBy"), itemData.GetValue("UpdateHost"));
|
||||
assetMovement.AcceptChanges();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.Core.Tasks;
|
||||
using Sarand.Core.Xml;
|
||||
using Sarand.LogisticsMgr.Core.App;
|
||||
using Sarand.LogisticsMgr.Core.Bus;
|
||||
using Sarand.LogisticsMgr.Core.WebService;
|
||||
using Sarand.LogisticsMgr.Mobile.Core.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
@@ -41,6 +44,27 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
ClearErrorState();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public async Task<SlmContainer> GetContainer_Mobile (SlmContainer.Params prmContainer, SacsTaskData taskData)
|
||||
{
|
||||
ClearErrorState();
|
||||
List<SlmContainer> companies = new List<SlmContainer>();
|
||||
String fn = GetType().Name + ".GetContainer_Mobile";
|
||||
|
||||
// Request item data.
|
||||
SlmWebServiceClient.ItemDataResponseData responseData = await webServiceClient.GetItemData(GetContainerRequestConfig(SlmWebServiceRequest.RequestType.Data, taskData.Debug), GetContainerQueryFilter_Mobile(prmContainer), taskData);
|
||||
if (responseData.DataElement == null) throw new NotSupportedException("No data element found in Container data response.");
|
||||
if (responseData.ItemElement == null) throw new NotSupportedException("No item element found in Container data response.");
|
||||
if (responseData.Item == null) throw new NotSupportedException("No item extracted from Container data response.");
|
||||
|
||||
// Item construction properties.
|
||||
SysId id = responseData.Item.GetIdValue(nameof(SlmContainer.Id));
|
||||
String code = responseData.Item.GetValue(nameof(SlmContainer.Code));
|
||||
ushort flags = (ushort)responseData.Item.GetIntValue(nameof(SlmContainer.Flags));
|
||||
// Create item.
|
||||
SlmContainer_Mobile container = new SlmContainer_Mobile(Site, id, code, flags);
|
||||
PopulateFrom(responseData.Item, container);
|
||||
return container;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Container.
|
||||
@@ -93,16 +117,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo (XElement containerElement, SlmContainer container, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
containerElement.AppendElement("Id", SysId.ToString(container.Id));
|
||||
containerElement.AppendElement("Code", container.Code);
|
||||
containerElement.AppendElement("SizeCode", container.SizeCode);
|
||||
containerElement.AppendElement("Width", container.Width.ToString("N3"));
|
||||
containerElement.AppendElement("Height", container.Height.ToString("N3"));
|
||||
containerElement.AppendElement("Length", container.Length.ToString("N3"));
|
||||
containerElement.AppendElement(nameof(SlmContainer.Id), SysId.ToString(container.Id));
|
||||
containerElement.AppendElement(nameof(SlmContainer.Code), container.Code);
|
||||
containerElement.AppendElement(nameof(SlmContainer.SizeCode), container.SizeCode);
|
||||
containerElement.AppendElement(nameof(SlmContainer.Width), container.Width.ToString("N3"));
|
||||
containerElement.AppendElement(nameof(SlmContainer.Height), container.Height.ToString("N3"));
|
||||
containerElement.AppendElement(nameof(SlmContainer.Length), container.Length.ToString("N3"));
|
||||
// Common properties.
|
||||
containerElement.AppendElement("Notes", container.Notes);
|
||||
containerElement.AppendElement("Status", SacsSystem.GetStatusCode(container.Status));
|
||||
containerElement.AppendElement("Flags", container.Flags.ToString());
|
||||
containerElement.AppendElement(nameof(SlmContainer.Notes), container.Notes);
|
||||
containerElement.AppendElement(nameof(SlmContainer.Status), SacsSystem.GetStatusCode(container.Status));
|
||||
containerElement.AppendElement(nameof(SlmContainer.Flags), container.Flags.ToString());
|
||||
if (!SysId.IsValid(container.Id))
|
||||
{
|
||||
containerElement.AppendElement("CreateOn", DateUtil.FormatXmlDateTime(DateTime.Now));
|
||||
@@ -113,19 +137,19 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
containerElement.AppendElement("UpdateBy", SysId.ToString(dbUpdateInfo.UserId));
|
||||
containerElement.AppendElement("UpdateHost", dbUpdateInfo.Host);
|
||||
}
|
||||
private void PopulateFrom (XElement containerElement, SlmContainer container)
|
||||
private void PopulateFrom (SlmWebServiceItemData itemData, SlmContainer container)
|
||||
{
|
||||
//container.Id = new SysId(StringUtil.ToInt(containerElement.GetChildText("Id")));
|
||||
//container.Code = containerElement.GetChildText("Code");
|
||||
container.SizeCode = containerElement.GetChildText("SizeCode");
|
||||
container.Width = StringUtil.ToDecimal(containerElement.GetChildText("Width"));
|
||||
container.Height = StringUtil.ToDecimal(containerElement.GetChildText("Height"));
|
||||
container.Length = StringUtil.ToDecimal(containerElement.GetChildText("Length"));
|
||||
//container.Id = itemData.GetIdValue(nameof(SlmContainer.Id)));
|
||||
//container.Code = itemData.GetValue(nameof(SlmContainer.Code));
|
||||
container.SizeCode = itemData.GetValue(nameof(SlmContainer.SizeCode));
|
||||
container.Width = itemData.GetDecimalValue(nameof(SlmContainer.Width));
|
||||
container.Height = itemData.GetDecimalValue(nameof(SlmContainer.Height));
|
||||
container.Length = itemData.GetDecimalValue(nameof(SlmContainer.Length));
|
||||
// Common properties.
|
||||
container.Notes = containerElement.GetChildText("Notes");
|
||||
container.Status = SacsSystem.GetStatusForCode(containerElement.GetChildText("Status"));
|
||||
container.SetCreateStamp(DateUtil.ParseXmlDateTime(containerElement.GetChildText("CreateOn")), new SysId(StringUtil.ToInt(containerElement.GetChildText("CreateBy"))), containerElement.GetChildText("CreateHost"));
|
||||
container.SetUpdateStamp(DateUtil.ParseXmlDateTime(containerElement.GetChildText("UpdateOn")), new SysId(StringUtil.ToInt(containerElement.GetChildText("UpdateBy"))), containerElement.GetChildText("UpdateHost"));
|
||||
container.Notes = itemData.GetValue(nameof(SlmContainer.Notes));
|
||||
container.Status = SacsSystem.GetStatusForCode(itemData.GetValue(nameof(SlmContainer.Status)));
|
||||
container.SetCreateStamp(itemData.GetDateTimeValue("CreateOn"), itemData.GetIdValue("CreateBy"), itemData.GetValue("CreateHost"));
|
||||
container.SetUpdateStamp(itemData.GetDateTimeValue("UpdateOn"), itemData.GetIdValue("UpdateBy"), itemData.GetValue("UpdateHost"));
|
||||
container.AcceptChanges();
|
||||
}
|
||||
|
||||
@@ -202,6 +226,19 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Mgr
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private SlmWebServiceRequest.Config GetContainerRequestConfig (SlmWebServiceRequest.RequestType requestType, bool debug = false)
|
||||
{
|
||||
SlmWebServiceRequest.Config configRequest = new SlmWebServiceRequest.Config();
|
||||
configRequest.DataType = SlmWebServiceRequest.DataType.Container;
|
||||
configRequest.RequestType = requestType;
|
||||
configRequest.Context.SiteDefinition = SiteDefinition;
|
||||
configRequest.Context.User = UserCode;
|
||||
configRequest.Context.Email = EmailAddress;
|
||||
configRequest.Context.Debug = debug;
|
||||
return configRequest;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
Reference in New Issue
Block a user