Example #1
0
        public static IEnumerable <PriceScheduleView> ToPriceView
        (
            this IEnumerable <IInvPrice> TodaysPrices_ForPart
            , Inventry_27 InventoryPricesAreFor
            , short Schedule_0
            , short Schedule_List
            , short Schedule_Cash
        )
        {
            var mp = new ValueTuple <int, IEnumerable <IInvPrice> >
                     (
                InvPrice_Indexes.InventoryUnique(TodaysPrices_ForPart.First())
                , TodaysPrices_ForPart
                     );

            var mpp = new ValueTuple <IEnumerable <IInvPrice>, IInventoryBasePriceInfo>
                      (
                TodaysPrices_ForPart
                , TodaysPrices_ForPart.PopulateBasePriceSchedInfo_NoPrice
                (
                    InventoryPricesAreFor
                    , Schedule_0
                    , Schedule_List
                    , Schedule_Cash
                )
                      );

            mpp.Item2.CalculateBasePrices();
            var pv = mpp.Item2.CalculatePrices(mpp.Item1);

            return(pv);
        }
Example #2
0
        public static IEnumerable <IEnumerable <PriceScheduleView> > ToPriceView
        (
            this IEnumerable <IInvPrice> TodaysPrices
            , short Schedule_0
            , short Schedule_List
            , short Schedule_Cash
        )
        {
            var ManyPrices = TodaysPrices.GroupBy(price => InvPrice_Indexes.InventoryUnique(price))
                             .Select(group => group);

            var ManyPriceInfoPairs = ManyPrices.Select
                                     (
                p => new ValueTuple <IEnumerable <IInvPrice>, IInventoryBasePriceInfo>
                (
                    p
                    , p.PopulateBasePriceSchedInfo_NoPrice
                    (
                        new Inventry_27()
            {
                InvUnique = p.First().PartUnique
            }
                        , Schedule_0
                        , Schedule_List
                        , Schedule_Cash
                    )
                )
                                     );

            foreach (var PriceInfoPair in ManyPriceInfoPairs)
            {
                PriceInfoPair.Item2.CalculateBasePrices();
            }
            #region duplicate of linq code using foreach
            if (false)
            {
                List <ValueTuple <IEnumerable <IInvPrice>, IInventoryBasePriceInfo> > b;
                b = new List <ValueTuple <IEnumerable <IInvPrice>, IInventoryBasePriceInfo> >();

                foreach (var prices in ManyPrices)
                {
                    b.Add
                    (
                        new ValueTuple <IEnumerable <IInvPrice>, IInventoryBasePriceInfo>
                        (
                            prices
                            , prices.PopulateBasePriceSchedInfo_NoPrice(new Inventry_27()
                    {
                        InvUnique = prices.First().PartUnique
                    }, 0, 0, 0)
                        )
                    );
                }
            }
            #endregion duplicate of linq code using foreach

            var PriceViews = ManyPriceInfoPairs.Select(pair => pair.Item2.CalculatePrices(pair.Item1));

            return(PriceViews);
        }
        public static IEnumerable <IS5InvAssembled> ToAssembled(this IS5Inventory InvToAssemble)
        {
            IEnumerable <IEnumerable <IStok> > StokLinesPerInventry = new List <List <IStok> >();

            StokLinesPerInventry = GenericAggregateToLists <IStok, int> .ToLists
                                   (
                InvToAssemble.StokLines
                , Stok_Indexes.InventoryUnique
                                   );

            var TodaysPrices = InvToAssemble.InvPrices.GetPricesAsOf(DateTime.Now);
            IEnumerable <IEnumerable <IInvPrice> > InvPricesPerInventry;

            InvPricesPerInventry = GenericAggregateToLists <IInvPrice, int> .ToLists
                                   (
                TodaysPrices
                , InvPrice_Indexes.InventoryUnique
                                   );

            IEnumerable <IEnumerable <IComments> > CommentsLinesPerInventry;

            CommentsLinesPerInventry = GenericAggregateToLists <IComments, int> .ToLists
                                       (
                InvToAssemble.CommentsLines.Select(comments => new Comments_Clean(comments))
                , Comments_Indexes.InventoryUnique_File135
                                       );

            IEnumerable <IEnumerable <IAltSuply> > AltSupliesPerInventry;

            AltSupliesPerInventry = GenericAggregateToLists <IAltSuply, int> .ToLists
                                    (
                InvToAssemble.AltSupplies.Select(altSuply => new AltSuply_Clean(altSuply))
                , AltSuply_Indexes.InventoryUnique
                                    );

            IEnumerable <IInventry_27> Inventry_27s = InvToAssemble.Inventry_27s.Select(inv => new Inventry_27_Clean(inv));

            IEnumerable <IS5InvAssembled> InventoryAssembled = new List <IS5InvAssembled>();

            InventoryAssembled =
                from inv27 in Inventry_27s

                join pricePerInv in InvPricesPerInventry
                on Inventry_27_Indexes.InventoryUnique(inv27) equals InvPrice_Indexes.InventoryUnique(pricePerInv.First())
                into priceNullRecords
                from priceNullRecord in priceNullRecords.DefaultIfEmpty()

                join stockPerInv in StokLinesPerInventry
                on Inventry_27_Indexes.InventoryUnique(inv27) equals Stok_Indexes.InventoryUnique(stockPerInv.First())
                into stockNullRecords
                from stockNullRecord in stockNullRecords.DefaultIfEmpty()

                join ffs in CommentsLinesPerInventry
                on Inventry_27_Indexes.InventoryUnique(inv27) equals Comments_Indexes.InventoryUnique_File135(ffs.First())
                into ff4NullRecords
                from ff4NullRecord in ff4NullRecords.DefaultIfEmpty()

                join LUs in AltSupliesPerInventry
                on Inventry_27_Indexes.InventoryUnique(inv27) equals AltSuply_Indexes.InventoryUnique(LUs.First())
                into AltSupplyNullRecords
                from AltSupplyNullRecord in AltSupplyNullRecords.DefaultIfEmpty()

                select(IS5InvAssembled) new S5InvAssembled
                (
                    Inv: inv27
                    , Price_PerInventry_27: priceNullRecord
                    , Stok_PerInventry_27: stockNullRecord
                    , Comments_PerInventry_27: ff4NullRecord
                    , AltSuply_PerInventry_27: AltSupplyNullRecord
                )
            ;

            return(InventoryAssembled);
        }