Пример #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);
        }
Пример #2
0
            public void TesterIdWillBeNullIfNoActualAttributesExist()
            {
                // arrange
                var lot  = new tblLot();
                var scan = BuildLotAttribute(StaticAttributeNames.Scan, 3.0, new DateTime(2016, 1, 1), true, new EmployeeKeyReturn {
                    EmployeeKey_Id = 123
                });
                var newLot = new Lot
                {
                    Attributes = new[] { scan }
                };

                // act
                LotSyncHelper.SetTestData(lot, newLot);

                // assert
                Assert.AreEqual(null, lot.TesterID);
            }
Пример #3
0
            public void IfAllAttributeTestDatesAreMinDateValue_TestDateIsNull()
            {
                // arrange
                var lot      = new tblLot();
                var asta     = BuildLotAttribute(StaticAttributeNames.Asta, 1.0, DateTime.MinValue);
                var scoville = BuildLotAttribute(StaticAttributeNames.Scoville, 2.0f, DateTime.MinValue);
                var scan     = BuildLotAttribute(StaticAttributeNames.Scan, 3.0, DateTime.MinValue);
                var newLot   = new Lot
                {
                    Attributes = new[] { asta, scoville, scan }
                };

                // act
                LotSyncHelper.SetTestData(lot, newLot);

                // assert
                Assert.AreEqual(null, lot.TestDate);
            }
Пример #4
0
            public void SetsTesterIdFromLatestAttributeEmployeeId()
            {
                // arrange
                var lot      = new tblLot();
                var asta     = BuildLotAttribute(StaticAttributeNames.Asta, 1.0, DateTime.MinValue);
                var scoville = BuildLotAttribute(StaticAttributeNames.Scoville, 2.0f, new DateTime(2015, 12, 12));
                var scan     = BuildLotAttribute(StaticAttributeNames.Scan, 3.0, new DateTime(2016, 1, 1), employee: new EmployeeKeyReturn {
                    EmployeeKey_Id = 123
                });
                var newLot = new Lot
                {
                    Attributes = new[] { asta, scoville, scan }
                };

                // act
                LotSyncHelper.SetTestData(lot, newLot);

                // assert
                Assert.AreEqual(123, lot.TesterID);
            }
Пример #5
0
            public void SetsTestDateFromMaxDateOfAttributes()
            {
                // arrange
                var lot          = new tblLot();
                var minDate      = DateTime.Now.AddDays(-5).Date;
                var expectedDate = DateTime.Now.Date;
                var asta         = BuildLotAttribute(StaticAttributeNames.Asta, 1.0, minDate);
                var scoville     = BuildLotAttribute(StaticAttributeNames.Scoville, 2.0f, minDate);
                var scan         = BuildLotAttribute(StaticAttributeNames.Scan, 3.0, expectedDate);
                var newLot       = new Lot
                {
                    Attributes = new[] { asta, scoville, scan }
                };

                // act
                LotSyncHelper.SetTestData(lot, newLot);

                // assert
                Assert.True(lot.TestDate.HasValue);
                Assert.AreEqual(expectedDate, lot.TestDate);
            }