| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- using System;
- using System.Linq;
- using Comal.Classes;
- using InABox.Mobile;
- using Syncfusion.XForms.Core;
- using Xamarin.CommunityToolkit.ObjectModel;
- using Xamarin.Forms;
- namespace PRS.Mobile
- {
- public class StockHoldingShell : Shell<StockHoldingModel, StockHolding>
- {
- public StockHoldingShell()
- {
- Transactions = new ObservableRangeCollection<StockTransaction>();
- Transactions.CollectionChanged += (sender, args) =>
- {
- OnPropertyChanged(nameof(Transactions));
- };
- }
- protected override void ConfigureColumns(ShellColumns<StockHoldingModel, StockHolding> columns)
- {
- columns
- .Map(nameof(ProductID), x => x.Product.ID)
- .Map(nameof(ProductCode), x => x.Product.Code)
- .Map(nameof(ProductName), x => x.Product.Name)
- .Map(nameof(JobID), x => x.Job.ID)
- .Map(nameof(JobNumber), x => x.Job.JobNumber)
- .Map(nameof(JobName), x => x.Job.Name)
- .Map(nameof(LocationID), x => x.Location.ID)
- .Map(nameof(LocationCode), x => x.Location.Code)
- .Map(nameof(LocationDescription), x => x.Location.Description)
- .Map(nameof(LocationAreaID), x => x.Location.Area.ID)
- .Map(nameof(LocationAreaCode), x => x.Location.Area.Code)
- .Map(nameof(LocationAreaDescription), x => x.Location.Area.Description)
- .Map(nameof(StyleID), x => x.Style.ID)
- .Map(nameof(StyleCode), x => x.Style.Code)
- .Map(nameof(StyleDescription), x => x.Style.Description)
- .Map(nameof(DimensionsUnitID), x => x.Dimensions.Unit.ID)
- .Map(nameof(DimensionsHasQuantity), x => x.Dimensions.Unit.HasQuantity)
- .Map(nameof(DimensionsHasLength), x => x.Dimensions.Unit.HasLength)
- .Map(nameof(DimensionsHasHeight), x => x.Dimensions.Unit.HasHeight)
- .Map(nameof(DimensionsHasWeight), x => x.Dimensions.Unit.HasWeight)
- .Map(nameof(DimensionsHasWidth), x => x.Dimensions.Unit.HasWidth)
- .Map(nameof(DimensionsQuantity), x => x.Dimensions.Quantity)
- .Map(nameof(DimensionsLength), x => x.Dimensions.Length)
- .Map(nameof(DimensionsHeight), x => x.Dimensions.Height)
- .Map(nameof(DimensionsWeight), x => x.Dimensions.Weight)
- .Map(nameof(DimensionsWidth), x => x.Dimensions.Width)
- .Map(nameof(DimensionsUnitFormat), x => x.Dimensions.Unit.Format)
- .Map(nameof(DimensionsUnitFormula), x => x.Dimensions.Unit.Formula)
- .Map(nameof(DimensionsUnitSize), x => x.Dimensions.UnitSize)
- .Map(nameof(DimensionsValue), x => x.Dimensions.Value)
-
- .Map(nameof(ImageID), x => x.Product.Image.ID)
- .Map(nameof(Units), x => x.Units)
- .Map(nameof(Available), x => x.Available)
- .Map(nameof(AverageCost), x=>x.AverageValue)
- .Map(nameof(LastStocktake), x=>x.LastStockTake)
-
- ;
- }
- public Guid ProductID
- {
- get => Get<Guid>();
- set => Set(value);
- }
-
- public String ProductCode
- {
- get => Get<String>();
- set => Set(value);
- }
- public String ProductName
- {
- get => Get<String>();
- set => Set(value);
- }
-
- public String ProductDisplay => ProductID == Guid.Empty ? "" : $"{ProductCode}: {ProductName}";
- public Guid JobID
- {
- get => Get<Guid>();
- set
- {
- Set(value);
- Parent?.UpdateShells(new StockHoldingShell[] { this });
- }
- }
-
- public String JobNumber
- {
- get => Get<String>();
- set => Set(value);
- }
- public String JobName
- {
- get => Get<String>();
- set => Set(value);
- }
-
- public String JobDisplay => JobID == Guid.Empty ? "" : $"{JobNumber}: {JobName}";
-
- public Guid LocationID
- {
- get => Get<Guid>();
- set
- {
- Set(value);
- Parent?.UpdateShells(new StockHoldingShell[] { this });
- }
- }
-
- public String LocationCode
- {
- get => Get<String>();
- set => Set(value);
- }
- public String LocationDescription
- {
- get => Get<String>();
- set => Set(value);
- }
- public Guid LocationAreaID
- {
- get => Get<Guid>();
- set => Set(value);
- }
-
- public String LocationAreaCode
- {
- get => Get<String>();
- set => Set(value);
- }
- public String LocationAreaDescription
- {
- get => Get<String>();
- set => Set(value);
- }
- public Guid StyleID
- {
- get => Get<Guid>();
- set
- {
- Set(value);
- Parent?.UpdateShells(new StockHoldingShell[] { this });
- }
- }
-
- public String StyleCode
- {
- get => Get<String>();
- set => Set(value);
- }
- public String StyleDescription
- {
- get => Get<String>();
- set => Set(value);
- }
-
- public String StyleDisplay => StyleID == Guid.Empty ? "" : $"{StyleCode}: {StyleDescription}";
-
- public Guid DimensionsUnitID
- {
- get => Get<Guid>();
- set => Set(value);
- }
-
- public string DimensionsUnitCode
- {
- get => Get<String>();
- set => Set(value);
- }
- public string DimensionsUnitDescription
- {
- get => Get<String>();
- set => Set(value);
- }
- public bool DimensionsHasQuantity
- {
- get => Get<bool>();
- set => Set(value);
- }
- public double DimensionsQuantity
- {
- get => Get<double>();
- set => Set(value);
- }
- public bool DimensionsHasLength
- {
- get => Get<bool>();
- set => Set(value);
- }
-
- public double DimensionsLength
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public bool DimensionsHasWidth
- {
- get => Get<bool>();
- set => Set(value);
- }
-
- public double DimensionsWidth
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public bool DimensionsHasHeight
- {
- get => Get<bool>();
- set => Set(value);
- }
-
- public double DimensionsHeight
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public bool DimensionsHasWeight
- {
- get => Get<bool>();
- set => Set(value);
- }
-
- public double DimensionsWeight
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public double DimensionsValue
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public string DimensionsUnitFormula
- {
- get => Get<string>();
- set => Set(value);
- }
- public string DimensionsUnitFormat
- {
- get => Get<string>();
- set => Set(value);
- }
-
- public string DimensionsUnitSize
- {
- get => Get<string>();
- set
- {
- Set(value);
- Parent?.UpdateShells(new StockHoldingShell[] { this });
- }
- }
- public Guid ImageID
- {
- get => Get<Guid>();
- set
- {
- Set(value);
- OnPropertyChanged(nameof(Image));
- }
- }
- public byte[]? Image
- {
- get
- {
- if (Parent != null && Parent.Images.TryGetValue(ImageID, out byte[] data))
- return data;
- return new byte[] { };
- }
- }
-
- public double Units
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public double Available
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public double AverageCost
- {
- get => Get<double>();
- set => Set(value);
- }
-
- public DateTime LastStocktake
- {
- get => Get<DateTime>();
- }
-
- public ObservableRangeCollection<StockTransaction> Transactions { get; private set; }
- public StockTransactionAllocation[] Allocations => Parent.GetAllocations(this);
- }
-
- }
|