/// <summary>
 /// Get a list of pallet solution descriptor that match a defined key (pallet / overhang)
 /// </summary>
 /// <param name="key">Key</param>
 /// <returns>List of pallet solution descriptor</returns>
 public List <PalletSolutionDesc> QueryPalletSolutions(PalletSolutionKey key)
 {
     return(_palletSolutionList.FindAll(
                delegate(PalletSolutionDesc palletSolDesc)
                { return palletSolDesc.MatchesKey(key); }
                ));
 }
        public PalletSolutionDesc(PalletSolutionDatabase db, CasePalletSolution sol, string friendlyName)
        {
            BoxProperties       boxProperties    = sol.Analysis.BProperties as BoxProperties;
            PalletProperties    palletProperties = sol.Analysis.PalletProperties;
            PalletConstraintSet constraintSet    = sol.Analysis.ConstraintSet;

            _guid         = Guid.NewGuid();
            _friendlyName = friendlyName;
            _key          = new PalletSolutionKey(
                palletProperties.Length, palletProperties.Width, constraintSet.MaximumHeight
                , constraintSet.OverhangX, constraintSet.OverhangY);

            _caseDimensions[0] = boxProperties.Length;
            _caseDimensions[1] = boxProperties.Width;
            _caseDimensions[2] = boxProperties.Height;

            _insideCaseDimensions[0] = boxProperties.InsideLength;
            _insideCaseDimensions[1] = boxProperties.InsideWidth;
            _insideCaseDimensions[2] = boxProperties.InsideHeight;

            _caseWeight   = boxProperties.Weight;
            _palletWeight = palletProperties.Weight;

            _caseOrientation = sol.CaseOrientation;
            _caseCount       = sol.CaseCount;

            _parentDB = db;
        }
 /// <summary>
 /// Check if database has a certain key (pallet dimensions + overhangs)
 /// </summary>
 /// <param name="key">Key to search</param>
 /// <returns></returns>
 public bool HasKey(PalletSolutionKey key)
 {
     foreach (PalletSolutionDesc desc in _palletSolutionList)
     {
         if (desc.MatchesKey(key))
         {
             return(true);
         }
     }
     return(false);
 }
        public PalletSolutionDesc(PalletSolutionDatabase db, string palletDimensions, string overhang
                                  , string caseDimensions, string caseInsideDimensions
                                  , string caseWeight, string palletWeight
                                  , string caseCount, string sGuid, string friendlyName)
        {
            _key = new PalletSolutionKey(palletDimensions, overhang);
            this.CaseDimensionsString       = caseDimensions;
            this.CaseInsideDimensionsString = caseInsideDimensions;
            this.CaseCount = int.Parse(caseCount);
            CultureInfo ci = new CultureInfo("en-US");

            this.CaseWeight   = double.Parse(caseWeight, ci);
            this.PalletWeight = double.Parse(palletWeight, ci);
            _guid             = new Guid(sGuid);
            _friendlyName     = friendlyName;
            _parentDB         = db;
        }
 public PalletSolutionDesc(PalletSolutionDatabase db, double palletLength, double palletWidth, double palletHeight
                           , double overhangX, double overhangY
                           , double caseLength, double caseWidth, double caseHeight
                           , double insideCaseLength, double insideCaseWidth, double insideCaseHeight
                           , double caseWeight, double palletWeight
                           , int caseCount
                           , Guid guid
                           , string friendlyName)
 {
     _key = new PalletSolutionKey(palletLength, palletWidth, palletHeight, overhangX, overhangY);
     _caseDimensions[0]       = caseLength; _caseDimensions[1] = caseWidth; _caseDimensions[2] = caseHeight;
     _insideCaseDimensions[0] = insideCaseLength; _insideCaseDimensions[1] = insideCaseWidth; _insideCaseDimensions[2] = insideCaseHeight;
     _caseWeight   = caseWeight;
     _caseCount    = caseCount;
     _guid         = guid;
     _friendlyName = friendlyName;
     _parentDB     = db;
 }
 public bool MatchesKey(PalletSolutionKey key)
 {
     return(_key.Equals(key));
 }