Ejemplo n.º 1
0
        private static void UpdateOldLot(tblLot oldLot, Lot newLot, Customer customer, bool completedOverride, bool updateSerializationOnly)
        {
            if (!updateSerializationOnly)
            {
                if (customer != null)
                {
                    oldLot.Company_IA = customer.Company.Name;
                }

                oldLot.Notes      = newLot.Notes;
                oldLot.PurchOrder = newLot.PurchaseOrderNumber;
                oldLot.ShipperNum = newLot.ShipperNumber;

                if (string.IsNullOrWhiteSpace(oldLot.Company_IA) || newLot.Vendor != null)
                {
                    oldLot.Company_IA = newLot.Vendor == null ? null : newLot.Vendor.Name;
                }

                LotSyncHelper.SetLotAttributes(oldLot, newLot.Attributes.ToList());
                LotSyncHelper.SetTestData(oldLot, newLot);
                LotSyncHelper.SetLotStat(oldLot, newLot, completedOverride, newLot.ChileLot == null ? null : newLot.ChileLot.ChileProduct.ProductAttributeRanges.ToList());
            }

            oldLot.Serialized = SerializableLot.Serialize(newLot);
        }
Ejemplo n.º 2
0
        protected LotEntityObjectMother.LotDTO CreateTblLot(Lot serializedLot, IEnumerable <LotAttributeDefect> attributeDefects = null, Attributes attributes = null)
        {
            var tblLot = new LotEntityObjectMother.LotDTO
            {
                EntryDate  = DateTime.UtcNow.ConvertUTCToLocal(),
                Serialized = SerializableLot.Serialize(serializedLot, attributeDefects ?? new LotAttributeDefect[0])
            };

            foreach (var attribute in attributes ?? new Attributes())
            {
                var set = tblLot.AttributeSet(attribute.NameKey);
                if (set != null)
                {
                    set((decimal?)attribute.Value);
                }
            }

            return(tblLot);
        }