public CreateChileLotHelper(ILotMother lotMother, IEnumerable <tblLotStatu> lotStatuses)
        {
            var lotStatusDescriptions = lotStatuses.ToDictionary(s => LotStatHelper.GetLotStat(s.LotStatID).Value, s => s.LotStatDesc);

            _serializedChileLotHelper   = new SerializedChileLotHelper(lotMother, lotStatusDescriptions);
            _unserializedChileLotHelper = new UnserializedChileLotHelper(lotMother, lotStatusDescriptions);
        }
            public AttributeCommonData(LotDTO oldLot, ILotMother lotMother)
            {
                var testerId           = oldLot.TesterID == null ? lotMother.DefaultEmployee.EmployeeId : oldLot.TesterID.Value;
                var determinedTestDate = (oldLot.TestDate ?? oldLot.ProductionDate ?? oldLot.EntryDate ?? Models.Helpers.DataConstants.SqlMinDate).Date;
                var entryDate          = oldLot.EntryDate.ConvertLocalToUTC();

                _oldLot    = oldLot;
                _logMethod = lotMother.Log;

                _testerId           = testerId;
                _determinedTestDate = determinedTestDate;
                _entryDate          = entryDate;

                _defaultTester   = oldLot.TesterID == null;
                _defaultTestDate = determinedTestDate == Models.Helpers.DataConstants.SqlMinDate;
                _nullEntryDate   = oldLot.EntryDate == null;
                NullTestDate     = oldLot.TestDate == null;
            }
        public static LotAttribute AddNewAttribute(this Lot lot, ILotAttributes oldLot, IAttributeNameKey attributeNameKey, CreateChileLotHelper.AttributeCommonData attributeData, ILotMother lotMother)
        {
            var getter = oldLot.AttributeGet(attributeNameKey);

            if (getter == null)
            {
                return(null);
            }

            var setter = oldLot.AttributeSet(attributeNameKey, true);
            var value  = setter(getter());

            if (value == null)
            {
                return(null);
            }

            lotMother.AddRead(EntityTypes.LotAttribute);
            if (attributeData.EntryDate == null)
            {
                return(null);
            }

            var lotAttribute = new LotAttribute
            {
                LotDateCreated     = lot.LotDateCreated,
                LotDateSequence    = lot.LotDateSequence,
                LotTypeId          = lot.LotTypeId,
                AttributeShortName = attributeNameKey.AttributeNameKey_ShortName,

                AttributeValue = (double)value,
                AttributeDate  = attributeData.DeterminedTestDate,

                EmployeeId = attributeData.TesterId,
                TimeStamp  = attributeData.EntryDate.Value,
                Computed   = attributeData.NullTestDate
            };

            lot.Attributes.Add(lotAttribute);
            return(lotAttribute);
        }
 public UnserializedChileLotHelper(ILotMother lotMother, Dictionary <LotStat, string> lotStatusDescriptions)
     : base(lotMother)
 {
     _lotStatusDescriptions = lotStatusDescriptions;
 }
 protected ChileLotHelperBase(ILotMother lotMother)
 {
     LotMother = lotMother;
 }