private tblLot AddNewLot(ChileMaterialsReceived received, LotNumberResult lotNumber) { var lot = new tblLot { Lot = lotNumber, EmployeeID = received.ChileLot.Lot.EmployeeId, EntryDate = received.ChileLot.Lot.TimeStamp.ConvertUTCToLocal().RoundMillisecondsForSQL(), PTypeID = received.LotTypeId, Julian = lotNumber.Julian, BatchNum = received.LotDateSequence, BatchStatID = null, //looks like default value set in old context - RI 2/17/2014 TargetWgt = 0, //looks like default value set in old context - RI 2/17/2014 Notes = "Old Context Synchronization", }; OldContext.tblLots.AddObject(lot); return(lot); }
private tblLot CreateNewLot(LotNumberResult lotNumber, ProductionBatch productionBatch) { var chileProduct = OldContextHelper.GetProduct(productionBatch.PackSchedule.ChileProduct); var productionLine = OldContextHelper.GetProductionLine(productionBatch.PackSchedule.ProductionLineLocation); var batchTypeId = BatchTypeIDHelper.GetBatchTypeID(productionBatch.PackSchedule.WorkType.Description); return(new tblLot { Lot = lotNumber, EmployeeID = productionBatch.Production.ResultingChileLot.Lot.EmployeeId, EntryDate = productionBatch.Production.ResultingChileLot.Lot.TimeStamp.ConvertUTCToLocal().RoundMillisecondsForSQL(), Notes = productionBatch.Production.ResultingChileLot.Lot.Notes, PTypeID = productionBatch.LotTypeId, Julian = lotNumber.Julian, BatchNum = productionBatch.LotDateSequence, ProdID = chileProduct.ProdID, PackSchID = productionBatch.PackSchedule.PackSchID, BatchTypeID = (int?)batchTypeId, Company_IA = productionBatch.PackSchedule.Customer == null ? null : productionBatch.PackSchedule.Customer.Company.Name, ProductionDate = productionBatch.PackSchedule.ScheduledProductionDate, ProductionLine = productionLine, BatchProdctnOrder = 0, //Seems constant in old context - RI 2014/4/16 SetTrtmtID = 0, LotStat = 0, BatchStatID = (int?)BatchStatID.Scheduled, TargetWgt = (decimal?)productionBatch.TargetParameters.BatchTargetWeight, TgtAsta = (decimal?)productionBatch.TargetParameters.BatchTargetAsta, TgtScan = (decimal?)productionBatch.TargetParameters.BatchTargetScan, TgtScov = (decimal?)productionBatch.TargetParameters.BatchTargetScoville, }); }