using Comal.Classes; using InABox.Clients; using InABox.Core; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading; using System.Threading.Tasks; using InABox.Mobile; using Xamarin.CommunityToolkit.Extensions; using Xamarin.CommunityToolkit.UI.Views; using Xamarin.Essentials; using Xamarin.Forms; using Xamarin.Forms.Xaml; using XF.Material.Forms.UI.Dialogs; using LogType = InABox.Core.LogType; namespace PRS.Mobile { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class StocktakeModule : MobilePage { #region Fields, Constructor and OnAppearing List stockLocationShells = new List(); List stockHoldingShells = new List(); string DeviceType = ""; StockLocationShell_Old openLocation = new StockLocationShell_Old(); bool bOpening = false; Color stockHoldingCheckedColor = Color.FromHex("#3eb489"); List movementsToUpdate = new List(); public StocktakeModule(Guid locationid) { InitializeComponent(); var idiom = DeviceInfo.Idiom; if (idiom.Equals(DeviceIdiom.Tablet)) { DeviceType = "Tablet"; } NavigationPage.SetHasBackButton(this, false); if (locationid != Guid.Empty) LoadLocation(locationid); } protected override void OnAppearing() { base.OnAppearing(); bOpening = false; } #endregion #region Button Presses // private async void ExitWithoutSaving(object sender, EventArgs e) // { // if (openLocation.ID != Guid.Empty) // { // string chosenOption = await DisplayActionSheet("Leave without saving?", "Cancel", null, "Yes", "No"); // switch (chosenOption) // { // case "Cancel": // return; // case "Yes": // Navigation.PopAsync(); // break; // case "No": // return; // default: // return; // } // } // else // Navigation.PopAsync(); // } // private void AddLocation_Clicked(object sender, EventArgs e) // { // if (bOpening) // return; // bOpening = true; // StockLocationSelectionPage stockLocationSelectionPage = new StockLocationSelectionPage( new Guid[] { }, true); // stockLocationSelectionPage.OnLocationSelected += (s, e) => // { // foreach (StockLocationShell shell in e.Locations) // { // if (!stockLocationShells.Any(x => x.ID == shell.ID)) // { // //shell.Color = Color.Default; // stockLocationShells.Add(shell); // //if (string.IsNullOrWhiteSpace(shell.NumberOfHoldings)) // // FindHoldingNumber(shell); // } // } // Device.BeginInvokeOnMainThread(() => // { // leftListView.ItemsSource = null; // leftListView.ItemsSource = stockLocationShells; // }); // }; // // Navigation.PushAsync(stockLocationSelectionPage); // } private void AddItem_Clicked(object sender, EventArgs e) { if (openLocation.ID != Guid.Empty) { // var selectionpage = new ProductSelectionPage((product) => // { // StockHoldingShell shell = new StockHoldingShell(); // shell.ProductCode = product.Code; // shell.Name = product.Name; // shell.ImageID = product.ImageID; // shell.ProductID = product.ID; // shell.DisplayJob = openLocation.JobNumber; // if (!string.IsNullOrWhiteSpace(openLocation.JobNumber)) // { // shell.JobNumber = openLocation.JobNumber.Substring(6); // } // shell.JobID = openLocation.JobID; // shell.Units = 0; // shell.DisplayUnits = "Units: 0"; // shell.StyleName = "Finish: Select"; // // shell.DimensionsUnitID = product.DimensionsUnitID; // shell.DimensionsUnitCode = product.DimensionsUnit.Code; // shell.DimensionsUnitDescription = product.DimensionsUnit.Description; // shell.DimensionsQuantity = product.DimensionsQuantity; // shell.DimensionsLength = product.DimensionsLength; // shell.DimensionsWidth = product.DimensionsWidth; // shell.DimensionsHeight = product.DimensionsHeight; // shell.DimensionsWeight = product.DimensionsWeight; // shell.DimensionsValue = product.DimensionsValue; // shell.DimensionsUnitSize = product.DimensionsUnitSize; // shell.DimensionsHasHeight = product.DimensionsUnit.HasHeight; // shell.DimensionsHasLength = product.DimensionsUnit.HasLength; // shell.DimensionsHasWidth = product.DimensionsUnit.HasWidth; // shell.DimensionsHasWeight = product.DimensionsUnit.HasWeight; // shell.DimensionsHasQuantity = product.DimensionsUnit.HasQuantity; // shell.DimensionsUnitFormula = product.DimensionsUnit.Formula; // shell.DimensionsUnitFormat = product.DimensionsUnit.Format; // // stockHoldingShells.Add(shell); // rightListView.ItemsSource = null; // rightListView.ItemsSource = stockHoldingShells; // if (shell.ImageID != Guid.Empty) // LoadImage(shell); // }); // Navigation.PushAsync(selectionpage); } else { string alert = ""; if (stockLocationShells.Count == 0) { alert = "Add a location first"; } else { alert = "Open a location first"; } DisplayAlert("Alert", alert, "OK"); } } #endregion #region Lists Tapped private async void LeftListView_Tapped(object sender, EventArgs e)// open/close a location { // StockLocationShell_Old stockLocationShell = leftListView.SelectedItem as StockLocationShell_Old; // if (openLocation.ID == stockLocationShell.ID) //close location and save movements // { // bool allComplete = true; // bool allIncomplete = true; // foreach (StockHoldingShell_Old shell in stockHoldingShells) // { // if (shell.Color != stockHoldingCheckedColor) // allComplete = false; // else // allIncomplete = false; // } // if (!allComplete && !allIncomplete) // { // DisplayAlert("Alert", "Not all holdings have been checked for this location / pack", "OK"); // return; // } // if (allIncomplete) // { // openLocation.ID = Guid.Empty; // openLocation.Code = ""; // openLocation.Description = ""; // stockLocationShell.Color = Color.Default; // stockLocationShell.OpenCloseLocation = "Open"; // int index = stockLocationShells.FindIndex(x => x.ID.Equals(stockLocationShell.ID)); // stockLocationShells.RemoveAt(index); // stockLocationShells.Insert(index, stockLocationShell); // // leftListView.ItemsSource = null; // leftListView.ItemsSource = stockLocationShells; // // rightListView.ItemsSource = null; // stockHoldingShells.Clear(); // rightCountLbl.Text = "Items: " + stockHoldingShells.Count(); // movementsToUpdate.Clear(); // // return; // } // // StockTakeCompletionPage stockTakeCompletionPage = new StockTakeCompletionPage(movementsToUpdate); // stockTakeCompletionPage.OnStockTakeCompleted += () => // { // openLocation.ID = Guid.Empty; // openLocation.Code = ""; // openLocation.Description = ""; // stockLocationShell.Color = stockHoldingCheckedColor; // stockLocationShell.OpenCloseLocation = "Completed"; // // int index = stockLocationShells.FindIndex(x => x.ID.Equals(stockLocationShell.ID)); // stockLocationShells.RemoveAt(index); // stockLocationShells.Insert(index, stockLocationShell); // // leftListView.ItemsSource = null; // leftListView.ItemsSource = stockLocationShells; // // rightListView.ItemsSource = null; // stockHoldingShells.Clear(); // rightCountLbl.Text = "Items: " + stockHoldingShells.Count(); // movementsToUpdate.Clear(); // }; // Navigation.PushAsync(stockTakeCompletionPage); // } // else if (openLocation.ID == Guid.Empty) //open the location and load holdings // { // Filter filter = new Filter(x => x.Location.ID).IsEqualTo(stockLocationShell.ID); // openLocation.ID = stockLocationShell.ID; // openLocation.Code = stockLocationShell.Code; // openLocation.Description = stockLocationShell.Description; // stockLocationShell.Color = Color.Orange; // stockLocationShell.OpenCloseLocation = "Close"; // // LoadHoldings(filter); // // int index = stockLocationShells.FindIndex(x => x.ID.Equals(stockLocationShell.ID)); // stockLocationShells.RemoveAt(index); // stockLocationShells.Insert(index, stockLocationShell); // // leftListView.ItemsSource = null; // leftListView.ItemsSource = stockLocationShells; // } // else if (openLocation.ID != Guid.Empty) // { // DisplayAlert("Alert", "Currently Open Location must be closed first", "OK"); // } } private void RightListView_Tapped(object sender, EventArgs e) //open popup to confirm, on closing turns green { // if (bOpening) // return; // bOpening = true; // var shell = rightListView.SelectedItem as StockHoldingShell_Old; // var originalShell = DuplicateShell(shell); // // var style = new ProductStyle { ID = shell.StyleID, Code = shell.StyleCode, Description = shell.Finish }; // var job = new Job { ID = shell.JobID, JobNumber = shell.JobNumber }; // // var popup = new RecTransferPopup(shell, job, job, true); // // var additionalmovement = new StockMovement(); // // popup.OnRecTransferItemAccepted += () => // { // var movement = new StockMovement(); // movement.Dimensions.Unit.ID = shell.DimensionsUnitID; // movement.Dimensions.Quantity = shell.DimensionsQuantity; // movement.Dimensions.Length = shell.DimensionsLength; // movement.Dimensions.Width = shell.DimensionsWidth; // movement.Dimensions.Height = shell.DimensionsHeight; // movement.Dimensions.Weight = shell.DimensionsWeight; // movement.Dimensions.Unit.HasHeight = shell.DimensionsHasHeight; // movement.Dimensions.Unit.HasLength = shell.DimensionsHasLength; // movement.Dimensions.Unit.HasWidth = shell.DimensionsHasWidth; // movement.Dimensions.Unit.HasWeight = shell.DimensionsHasWeight; // movement.Dimensions.Unit.HasQuantity = shell.DimensionsHasQuantity; // movement.Dimensions.Unit.Code = shell.DimensionsUnitCode; // movement.Dimensions.Unit.Description = shell.DimensionsUnitDescription; // movement.Dimensions.Value = shell.DimensionsValue; // movement.Dimensions.Unit.Formula = shell.DimensionsUnitFormula; // movement.Dimensions.Unit.Format = shell.DimensionsUnitFormat; // movement.Dimensions.UnitSize = shell.DimensionsUnitSize; // movement.Product.ID = shell.ProductID; // movement.Product.Code = shell.Code; // movement.Product.Name = shell.Name; // movement.Employee.ID = App.Data.Me.ID; // movement.Employee.Name = App.Data.Me.Name; // movement.Location.ID = openLocation.ID; // movement.Location.Description = openLocation.Description; // movement.Location.Code = openLocation.Code; // movement.Job.ID = shell.JobID; // movement.Job.JobNumber = shell.JobNumber; // movement.Style.ID = shell.StyleID; // movement.Style.Code = shell.StyleCode; // movement.Style.Description = shell.Finish; // movement.Type = StockMovementType.StockTake; // movement.Balance = popup.Shell.Units; // // if (popup.Shell.Units < originalShell.Units) // { // movement.Issued = originalShell.Units - popup.Shell.Units; // movement.Notes = "Updated incorrect Qty during stocktake. Less Qty than expected."; // } // else if (popup.Shell.Units > originalShell.Units) // { // movement.Received = popup.Shell.Units - originalShell.Units; // movement.Notes = "Updated incorrect Qty during stocktake. More Qty than expected."; // } // else if (popup.Shell.Units == originalShell.Units) // { // movement.Received = 0; // movement.Issued = 0; // movement.Notes = "Confirmed correct Qty during stocktake."; // } // // //if style is changed, create a movement that issues everything from the original style // //in addition to the first movement created being changed to a receive of the entered qty in the new style // //no need to find the difference in Qty from the original. First movement qty issued should be 0 // if (popup.Shell.StyleID != originalShell.StyleID) // { // additionalmovement.Dimensions.Unit.ID = shell.DimensionsUnitID; // additionalmovement.Dimensions.Quantity = shell.DimensionsQuantity; // additionalmovement.Dimensions.Length = shell.DimensionsLength; // additionalmovement.Dimensions.Width = shell.DimensionsWidth; // additionalmovement.Dimensions.Height = shell.DimensionsHeight; // additionalmovement.Dimensions.Weight = shell.DimensionsWeight; // additionalmovement.Dimensions.Unit.HasHeight = shell.DimensionsHasHeight; // additionalmovement.Dimensions.Unit.HasLength = shell.DimensionsHasLength; // additionalmovement.Dimensions.Unit.HasWidth = shell.DimensionsHasWidth; // additionalmovement.Dimensions.Unit.HasWeight = shell.DimensionsHasWeight; // additionalmovement.Dimensions.Unit.HasQuantity = shell.DimensionsHasQuantity; // additionalmovement.Dimensions.Unit.Code = shell.DimensionsUnitCode; // additionalmovement.Dimensions.Unit.Description = shell.DimensionsUnitDescription; // additionalmovement.Dimensions.Value = shell.DimensionsValue; // additionalmovement.Dimensions.Unit.Formula = shell.DimensionsUnitFormula; // additionalmovement.Dimensions.Unit.Format = shell.DimensionsUnitFormat; // additionalmovement.Dimensions.UnitSize = shell.DimensionsUnitSize; // additionalmovement.Product.ID = shell.ProductID; // additionalmovement.Product.Code = shell.Code; // additionalmovement.Product.Name = shell.Name; // additionalmovement.Employee.ID = App.Data.Me.ID; // additionalmovement.Employee.Name = App.Data.Me.Name; // additionalmovement.Location.ID = openLocation.ID; // additionalmovement.Location.Description = openLocation.Description; // additionalmovement.Location.Code = openLocation.Code; // additionalmovement.Job.ID = shell.JobID; // additionalmovement.Job.JobNumber = shell.JobNumber; // additionalmovement.Style.ID = originalShell.StyleID; // additionalmovement.Style.Code = originalShell.StyleCode; // additionalmovement.Style.Description = originalShell.Finish; // additionalmovement.Notes = movement.Notes + " Also changed finish during stocktake"; // // additionalmovement.Transaction = movement.Transaction; // // additionalmovement.Issued = originalShell.Units; // additionalmovement.Type = StockMovementType.TransferOut; // // movementsToUpdate.Add(additionalmovement); // // movement.Issued = 0; // movement.Received = popup.Shell.Units; // movement.Type = StockMovementType.TransferIn; // movement.Notes += " Also changed finish during stocktake"; // } // // movementsToUpdate.Add(movement); // // shell.Color = stockHoldingCheckedColor; // int index = stockHoldingShells.FindIndex(x => x.ID.Equals(shell.ID)); // stockHoldingShells.RemoveAt(index); // stockHoldingShells.Insert(index, shell); // Device.BeginInvokeOnMainThread(() => // { // rightListView.ItemsSource = null; // rightListView.ItemsSource = stockHoldingShells; // }); // }; // // Navigation.PushAsync(popup); } #endregion #region Utilities private async void FindHoldingNumber(StockLocationShell_Old shell) { //TODO replace code that showed number of holdings //Task.Run(() => //{ // CoreTable table = new Client().Query(new Filter(x => x.ID).IsEqualTo(shell.ID), // new Columns(x => x.Holdings)); // if (table.Rows.Any()) // { // List list = table.Rows.First().Values; // shell.NumberOfHoldings = "Holdings: " + list[0].ToString(); // int index = stockLocationShells.FindIndex(x => x.ID.Equals(shell.ID)); // stockLocationShells.RemoveAt(index); // stockLocationShells.Insert(index, shell); // Device.BeginInvokeOnMainThread(() => // { // leftListView.ItemsSource = null; // leftListView.ItemsSource = stockLocationShells; // }); // } //}); } private async void LoadLocation(Guid locationid) { // using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading")) // { // CoreTable table = QueryLocation(locationid); // while (table == null) // table = QueryLocation(locationid); // if (table.Rows.Any()) // { // StockLocation location = table.Rows.First().ToObject(); // // StockLocationShell_Old shell = new StockLocationShell_Old() // { // ID = locationid, // Description = location.Description, // Warehouse = "Warehouse: " + location.Warehouse.Description, // Area = "Area: " + location.Area.Description, // JobNumber = "Job: " + location.Job.JobNumber, // Code = location.Code, // NumberOfHoldings = "Holdings: LOADING...", // JobID = location.Job.ID, // JobName = location.Job.Name // }; // // stockLocationShells.Add(shell); // // Device.BeginInvokeOnMainThread(() => // { // leftListView.ItemsSource = null; // leftListView.ItemsSource = stockLocationShells; // }); // FindHoldingNumber(shell); // } // } } private CoreTable QueryLocation(Guid locationid) { try { return new Client().Query(new Filter(x => x.ID).IsEqualTo(locationid), new Columns(x => x.Description, x => x.Code, x => x.Warehouse.Description, x => x.Area.Description, x => x.Job.JobNumber) ); } catch (Exception ex) { InABox.Mobile.MobileLogging.Log(ex); return null; } } private StockHoldingShell_Old DuplicateShell(StockHoldingShell_Old shell) { StockHoldingShell_Old NewShell = new StockHoldingShell_Old() { ID = shell.ID, Code = shell.Code, Name = shell.Name, DimensionsUnitID = shell.DimensionsUnitID, DimensionsQuantity = shell.DimensionsQuantity, DimensionsLength = shell.DimensionsLength, DimensionsWidth = shell.DimensionsWidth, DimensionsHeight = shell.DimensionsHeight, DimensionsWeight = shell.DimensionsWeight, DimensionsValue = shell.DimensionsValue, DimensionsHasHeight = shell.DimensionsHasHeight, DimensionsHasLength = shell.DimensionsHasLength, DimensionsHasQuantity = shell.DimensionsHasQuantity, DimensionsHasWidth = shell.DimensionsHasWidth, DimensionsHasWeight = shell.DimensionsHasWeight, DimensionsUnitCode = shell.DimensionsUnitCode, DimensionsUnitDescription = shell.DimensionsUnitDescription, DimensionsUnitFormat = shell.DimensionsUnitFormat, DimensionsUnitFormula = shell.DimensionsUnitFormula, DimensionsUnitSize = shell.DimensionsUnitSize, Finish = shell.Finish, Units = shell.Units, DisplayUnits = shell.DisplayUnits, JobID = shell.JobID, JobName = shell.JobName, JobNumber = shell.JobNumber, DisplayJob = shell.DisplayJob, StyleName = shell.StyleName, StyleID = shell.StyleID, StyleCode = shell.StyleCode, ProductID = shell.ProductID, DisplaySize = shell.DisplaySize, LastRowHeight = shell.LastRowHeight, ImageID = shell.ImageID, ImageSource = shell.ImageSource, ImageVisible = shell.ImageVisible, Color = shell.Color }; return NewShell; } // private void LoadImage(StockHoldingShell_Old shell) // { // Task.Run(() => // { // CoreTable table = QueryImage(shell); // while (table == null) // table = QueryImage(shell); // // if (table.Rows.Any()) // { // CoreRow docrow = table.Rows.FirstOrDefault(); // if (docrow != null) // { // byte[] data = docrow.Get(x => x.Data); // ImageSource src = ImageSource.FromStream(() => new MemoryStream(data)); // if (src != null) // { // shell.ImageSource = src; // shell.ImageVisible = true; // if (DeviceType == "Tablet") // { // shell.LastRowHeight = 300; // } // else // { // shell.LastRowHeight = 150; // } // Device.BeginInvokeOnMainThread(() => // { // rightListView.ItemsSource = null; // rightListView.ItemsSource = stockHoldingShells; // }); // } // } // } // }); // } // private CoreTable QueryImage(StockHoldingShell_Old shell) // { // try // { // return new Client().Query(new Filter(x => x.ID).IsEqualTo(shell.ImageID)); // } // catch (Exception ex) // { // InABox.Mobile.MobileLogging.Log(ex); // return null; // } // // } //private void LoadImages() //{ // Task.Run(() => // { // List imageids = new List(); // foreach (StockHoldingShell_Old shell in stockHoldingShells) // { // if (shell.ImageID != Guid.Empty) // { // imageids.Add(shell.ImageID); // } // } // if (imageids.Count == 0) // return; // // CoreTable table = QueryImages(imageids); // while (table == null) // table = QueryImages(imageids); // // foreach (CoreRow row in table.Rows) // { // var item = stockHoldingShells.FirstOrDefault(x => x.ImageID == row.Get(x => x.ID)); // item.ImageVisible = true; // item.ImageSource = ImageSource.FromStream(() => new MemoryStream(row.Get(x => x.Data))); // if (DeviceType == "Tablet") // { // item.LastRowHeight = 300; // } // else // { // item.LastRowHeight = 150; // } // } // Device.BeginInvokeOnMainThread(() => // { // rightListView.ItemsSource = null; // rightListView.ItemsSource = stockHoldingShells; // }); // }); //} // private CoreTable QueryImages(List imageids) // { // try // { // return new Client().Query(new Filter(x => x.ID).InList(imageids.ToArray()), // new Columns(x => x.ID, x => x.Data)); // } // catch (Exception ex) // { // InABox.Mobile.MobileLogging.Log(ex); // return null; // } // } //private async void LoadHoldings(Filter filter) //{ // await Task.Run(() => // { // CoreTable table = QueryStockHoldings(filter); // while(table == null) // table = QueryStockHoldings(filter); // // if (table.Rows.Any()) // { // foreach (CoreRow row in table.Rows) // { // StockHoldingShell_Old shell = new StockHoldingShell_Old(); // // shell.ID = row.Get(x => x.Location.ID).ToString() // + row.Get(x => x.Product.ID).ToString() // + row.Get(x => x.Job.ID).ToString() // + row.Get(x => x.Style.ID).ToString() // + row.Get(x => x.Dimensions.UnitSize); // shell.Code = row.Get(x => x.Product.Code); // shell.Name = row.Get(x => x.Product.Name); // shell.Finish = row.Get(x => x.Style.Description); // shell.StyleName = "Finish: " + shell.Finish; // shell.Units = row.Get(x => x.Units); // shell.DimensionsUnitSize = row.Get(x => x.Dimensions.UnitSize); // shell.DisplaySize = "UOM: " + shell.DimensionsUnitSize; // shell.DisplayUnits = "Units: " + shell.Units; // shell.JobID = row.Get(x => x.Job.ID); // shell.JobName = row.Get(x => x.Job.Name); // shell.JobNumber = row.Get(x => x.Job.JobNumber); // shell.DisplayJob = "Job: " + shell.JobNumber; // shell.StyleID = row.Get(x => x.Style.ID); // shell.StyleCode = row.Get(x => x.Style.Code); // shell.ProductID = row.Get(x => x.Product.ID); // shell.ImageID = row.Get(x => x.Product.Image.ID); // shell.DimensionsUnitID = row.Get(x => x.Dimensions.Unit.ID); // shell.DimensionsQuantity = row.Get(x => x.Dimensions.Quantity); // shell.DimensionsLength = row.Get(x => x.Dimensions.Length); // shell.DimensionsWidth = row.Get(x => x.Dimensions.Width); // shell.DimensionsHeight = row.Get(x => x.Dimensions.Height); // shell.DimensionsWeight = row.Get(x => x.Dimensions.Weight); // shell.DimensionsValue = row.Get(x => x.Dimensions.Value); // shell.DimensionsHasHeight = row.Get(x => x.Dimensions.Unit.HasHeight); // shell.DimensionsHasWeight = row.Get(x => x.Dimensions.Unit.HasWeight); // shell.DimensionsHasLength = row.Get(x => x.Dimensions.Unit.HasLength); // shell.DimensionsHasQuantity = row.Get(x => x.Dimensions.Unit.HasQuantity); // shell.DimensionsHasWidth = row.Get(x => x.Dimensions.Unit.HasWidth); // shell.DimensionsUnitFormat = row.Get(x => x.Dimensions.Unit.Format); // shell.DimensionsUnitFormula = row.Get(x => x.Dimensions.Unit.Formula); // // if (!shell.Code.Contains("FREIGHT") && shell.Units != 0) // { // stockHoldingShells.Add(shell); // } // // } // LoadImages(); // Device.BeginInvokeOnMainThread(() => // { // rightCountLbl.Text = "Items: " + stockHoldingShells.Count(); // rightListView.ItemsSource = null; // rightListView.ItemsSource = stockHoldingShells; // }); // } // }); //} // private CoreTable QueryStockHoldings(Filter filter) // { // try // { // return new Client().Query // ( // filter, // new Columns // ( // x => x.ID, // x => x.Product.Code, // x => x.Product.Name, // x => x.Style.Description, // x => x.Units, // x => x.Location.ID, // x => x.Job.ID, // x => x.Job.Name, // x => x.Job.JobNumber, // x => x.Style.ID, // x => x.Style.Code, // x => x.Product.ID, // x => x.Product.Image.ID, // x => x.Dimensions.UnitSize, // x => x.Dimensions.Unit.ID, // x => x.Dimensions.Quantity, // x => x.Dimensions.Length, // x => x.Dimensions.Width, // x => x.Dimensions.Height, // x => x.Dimensions.Weight, // x => x.Dimensions.Value, // x => x.Dimensions.Unit.HasQuantity, // x => x.Dimensions.Unit.HasLength, // x => x.Dimensions.Unit.HasWeight, // x => x.Dimensions.Unit.HasWidth, // x => x.Dimensions.Unit.HasHeight, // x => x.Dimensions.Unit.Format, // x => x.Dimensions.Unit.Formula // ), // null // ); // } // catch (Exception ex) // { // InABox.Mobile.MobileLogging.Log(ex); // return null; // } // } #endregion private void Holding_Clicked(object sender, EventArgs e) { throw new NotImplementedException(); } private void TransactionImage_Clicked(object sender, EventArgs e) { throw new NotImplementedException(); } private void Transaction_Clicked(object sender, EventArgs e) { throw new NotImplementedException(); } private void DeleteTransaction_Clicked(object sender, MobileMenuButtonClickedEventArgs args) { throw new NotImplementedException(); } private void Image_Clicked(object sender, EventArgs e) { throw new NotImplementedException(); } private void Save_Clicked(object sender, MobileMenuButtonClickedEventArgs args) { throw new NotImplementedException(); } private void Location_Clicked(object sender, MobileButtonClickEventArgs args) { StockLocationSelectionPage page = new StockLocationSelectionPage( new Guid[] { ViewModel?.Location?.ID ?? Guid.Empty }, false, false); page.OnLocationSelected += (s, e) => { var location = e.Locations.FirstOrDefault(); ViewModel.Location = location ?? new StockLocationShell(); }; Navigation.PushAsync(page); } } public class StockLocationShell_Old { public Guid ID { get; set; } public string Description { get; set; } public string Code { get; set; } public string Warehouse { get; set; } public string Area { get; set; } public string NumberOfHoldings { get; set; } public string OpenCloseLocation { get; set; } public Color Color { get; set; } public string JobNumber { get; set; } public Guid JobID { get; set; } public String JobName { get; set; } public List PoItems { get; set; } public string NumberOfReceivedItems { get; set; } public StockLocationShell_Old() { ID = Guid.Empty; Description = ""; Warehouse = ""; Area = ""; NumberOfHoldings = ""; OpenCloseLocation = "Open"; Color = Color.Default; JobNumber = ""; Code = ""; PoItems = new List(); NumberOfReceivedItems = ""; JobID = Guid.Empty; JobName = ""; } } }