Beispiel #1
0
 private static Ingredient? ToLotTypeIngredient(LotTypeEnum lotType)
 {
     switch(lotType)
     {
         case LotTypeEnum.DeHydrated: return Ingredient.MWD;
         case LotTypeEnum.WIP: return Ingredient.Wbase;
         case LotTypeEnum.FinishedGood: return Ingredient.Fbase;
         case LotTypeEnum.GRP: return Ingredient.GRP;
     }
     return null;
 }
        internal static Lot SetLotKey(this Lot lot, LotTypeEnum lotType, DateTime dateCreated, int sequence)
        {
            if (lot == null)
            {
                throw new ArgumentNullException("lot");
            }

            lot.LotTypeEnum     = lotType;
            lot.LotDateCreated  = dateCreated.Date;
            lot.LotDateSequence = sequence;

            return(lot);
        }
Beispiel #3
0
        public static bool IsChileLot(this LotTypeEnum lotType)
        {
            switch (lotType)
            {
            case LotTypeEnum.Raw:
            case LotTypeEnum.DeHydrated:
            case LotTypeEnum.WIP:
            case LotTypeEnum.FinishedGood:
            case LotTypeEnum.Other:
            case LotTypeEnum.GRP:
                return(true);

            default: return(false);
            }
        }
Beispiel #4
0
        public static ChileStateEnum ToChileState(this LotTypeEnum itemType)
        {
            switch (itemType)
            {
            case LotTypeEnum.FinishedGood: return(ChileStateEnum.FinishedGoods);

            case LotTypeEnum.DeHydrated: return(ChileStateEnum.Dehydrated);

            case LotTypeEnum.WIP:
            case LotTypeEnum.Other:
                return(ChileStateEnum.WIP);

            case LotTypeEnum.Raw:
            case LotTypeEnum.GRP:
                return(ChileStateEnum.OtherRaw);

            default: throw new InvalidEnumArgumentException(string.Format("Cannot convert the InventoryItemTypeEnum value '{0}' to a ChileStateEnum.", itemType.ToString()));
            }
        }
Beispiel #5
0
        public static ProductTypeEnum ToProductType(this LotTypeEnum lotType)
        {
            switch (lotType)
            {
            case LotTypeEnum.WIP:
            case LotTypeEnum.Raw:
            case LotTypeEnum.GRP:
            case LotTypeEnum.FinishedGood:
            case LotTypeEnum.DeHydrated:
            case LotTypeEnum.Other:
                return(ProductTypeEnum.Chile);

            case LotTypeEnum.Additive:
                return(ProductTypeEnum.Additive);

            case LotTypeEnum.Packaging:
                return(ProductTypeEnum.Packaging);

            default: throw new InvalidEnumArgumentException(string.Format("Cannot convert the LotTypeEnum value '{0}' to a ProductTypeEnum.", lotType));
            }
        }
            public void CreatesFilterLotParameterObjectCorrectly()
            {
                // Arrange
                const LotTypeEnum         expectedLotType = LotTypeEnum.GRP;
                const LotProductionStatus expectedStatus  = LotProductionStatus.Produced;

                FilterLotParameters actualParameters = null;

                MockLotService
                .Setup(m => m.GetLotSummaries(It.IsAny <FilterLotParameters>()))
                .Callback((FilterLotParameters param) => actualParameters = param)
                .Returns(new SuccessResult <ILotQualitySummariesReturn>(Fixture.Create <ILotQualitySummariesReturn>()));

                // Act
                LotsControler.Get(expectedLotType, expectedStatus);

                // Assert
                Assert.IsNotNull(actualParameters);
                Assert.AreEqual(expectedLotType, actualParameters.LotType);
                Assert.AreEqual(expectedStatus, actualParameters.ProductionStatus);
            }
 internal static Expression <Func <InventoryTransaction, bool> > BySourceLotType(LotTypeEnum lotType)
 {
     return(Projector <InventoryTransaction> .To(t => t.SourceLotTypeId == (int)lotType));
 }
Beispiel #8
0
        internal static IResult <ChileProductCommandParameters> ToParsedParameters(this IChileProductParameters parameters, LotTypeEnum lotType)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            var chileTypeKeyResult = KeyParserHelper.ParseResult <IChileTypeKey>(parameters.ChileTypeKey);

            if (!chileTypeKeyResult.Success)
            {
                return(chileTypeKeyResult.ConvertTo((ChileProductCommandParameters)null));
            }

            return(new SuccessResult <ChileProductCommandParameters>(new ChileProductCommandParameters
            {
                Parameters = parameters,
                ChileTypeKey = new ChileTypeKey(chileTypeKeyResult.ResultingObject),
                ChileState = lotType.ToChileState()
            }));
        }
        internal static Expression <Func <Inventory, bool> > ByLotType(LotTypeEnum lotTypeEnum)
        {
            var lotType = (int)lotTypeEnum;

            return(i => i.LotTypeId == lotType);
        }
Beispiel #10
0
 public static int ToInt(this LotTypeEnum itemType)
 {
     return((int)itemType);
 }
 public static string ToFullName(this LotTypeEnum lotType)
 {
     return(lotType == null ? string.Empty : string.Format("{0} - {1}", (int)lotType, lotType.ToString()));
 }
Beispiel #12
0
        internal static Expression <Func <Lot, bool> > FilterByLotType(LotTypeEnum lotType)
        {
            var lotTypeId = (int)lotType;

            return(l => l.LotTypeId == lotTypeId);
        }
Beispiel #13
0
 internal static Expression <Func <Lot, bool> > FilterByLotDateAndTypeId(DateTime lotDate, LotTypeEnum lotType)
 {
     return(l => l.LotDateCreated == lotDate && l.LotTypeId == (int)lotType);
 }