| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using comal.timesheets.CustomControls;
- using Comal.Classes;
- using InABox.Clients;
- using InABox.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace comal.timesheets
- {
- public static class RequiItems
- {
- public static List<StoreRequiItem> NewRequisitionRows { get; set; }
- public static List<RequisitionItem> OldRequisitionItems { get; set; }
- public static List<HoldingsCacheShell> holdingsCache { get; set; }
- public static bool HoldingsLoaded { get; set; }
- [DoNotPersist]
- public class HoldingsCacheShell : Entity
- {
- public Guid LocationID { get; set; }
- public Guid ProductID { get; set; }
- public string LocationName { get; set; }
- public string Units { get; set; }
- public Guid JobID { get; set; }
- public string JobNumber { get; set; }
- public string JobName { get; set; }
- public Guid StyleID { get; set; }
- public string StyleCode { get; set; }
- public string StyleDescription { get; set; }
- public StockDimensions Dimensions { get; set; }
- public HoldingsCacheShell()
- {
- LocationID = Guid.Empty;
- ProductID = Guid.Empty;
- LocationName = "";
- Units = "";
- JobID = Guid.Empty;
- JobNumber = "";
- JobName = "";
- StyleID = Guid.Empty;
- StyleCode = "";
- StyleDescription = "";
- Dimensions = new StockDimensions(() => this);
- }
- /// <summary>
- /// For Display Purposes, and save loading time until Dimensions are needed
- /// </summary>
- public void UpdateDimensionsAndLocationName()
- {
- if (ProductID != Guid.Empty)
- {
- CoreTable table = new Client<Product>().Query(new Filter<Product>(x => x.ID).IsEqualTo(ProductID),
- new Columns<Product>(
- x => x.Dimensions.Unit.ID,
- x => x.Dimensions.Unit.HasQuantity,
- x => x.Dimensions.Unit.HasLength,
- x => x.Dimensions.Unit.HasHeight,
- x => x.Dimensions.Unit.HasWeight,
- x => x.Dimensions.Unit.HasWidth,
- x => x.Dimensions.Quantity,
- x => x.Dimensions.Length,
- x => x.Dimensions.Height,
- x => x.Dimensions.Weight,
- x => x.Dimensions.Width,
- x => x.Dimensions.Unit.Format,
- x => x.Dimensions.Unit.Formula,
- x => x.Dimensions.UnitSize
- ));
- Product product = table.Rows.FirstOrDefault().ToObject<Product>();
- Dimensions.Unit.ID = product.Dimensions.Unit.ID;
- Dimensions.Unit.HasQuantity = product.Dimensions.Unit.HasQuantity;
- Dimensions.Unit.HasLength = product.Dimensions.Unit.HasLength;
- Dimensions.Unit.HasHeight = product.Dimensions.Unit.HasHeight;
- Dimensions.Unit.HasWeight = product.Dimensions.Unit.HasWeight;
- Dimensions.Unit.HasWidth = product.Dimensions.Unit.HasWidth;
- Dimensions.Quantity = product.Dimensions.Quantity;
- Dimensions.Length = product.Dimensions.Length;
- Dimensions.Height = product.Dimensions.Height;
- Dimensions.Weight = product.Dimensions.Weight;
- Dimensions.Width = product.Dimensions.Width;
- Dimensions.Unit.Format = product.Dimensions.Unit.Format;
- Dimensions.Unit.Formula = product.Dimensions.Unit.Formula;
- Dimensions.UnitSize = product.Dimensions.UnitSize;
- }
- LocationName = LocationName + " (Units: " + Units + ")" +
- Environment.NewLine + "Style: " + StyleDescription
- + Environment.NewLine + "Job: " + JobNumber
- + Environment.NewLine + "Size: " + Dimensions.UnitSize;
- }
- }
- }
- }
|