コード例 #1
0
        public ComplexRecipe(ComplexProduction production)
            : this()
        {
            locationId      = production.LocationId;
            location        = production.Location;
            location2       = production.Location2;
            partnerId       = production.PartnerId;
            partnerName     = production.PartnerName;
            partnerName2    = production.PartnerName2;
            userId          = production.UserId;
            userName        = production.UserName;
            userName2       = production.UserName2;
            loggedUserId    = production.LoggedUserId;
            loggedUserName  = production.LoggedUserName;
            loggedUserName2 = production.LoggedUserName2;

            foreach (ComplexProductionDetail detail in production.DetailsMat)
            {
                detailsMat.Add(new ComplexRecipeDetail(detail));
            }

            detailsMat = GetCombinedDetails(false, true, detailsMat);

            foreach (ComplexProductionDetail detail in production.DetailsProd)
            {
                detailsProd.Add(new ComplexRecipeDetail(detail));
            }

            detailsProd = GetCombinedDetails(false, true, detailsProd);
        }
コード例 #2
0
        public void QuantityEvaluate(double value, ComplexProduction parent)
        {
            Quantity = value;

            if (SourceRecipe != null)
            {
                ComplexRecipeDetail recDetail = GetMatchingRecipeDetail(this);
                if (recDetail != null)
                {
                    double coef = value / recDetail.Quantity;

                    foreach (ComplexProductionDetail detail in parent.DetailsMat)
                    {
                        if (!ReferenceEquals(detail.SourceRecipe, SourceRecipe))
                        {
                            continue;
                        }

                        if (detail.ItemId == itemId)
                        {
                            continue;
                        }

                        recDetail = GetMatchingRecipeDetail(detail);
                        if (recDetail == null)
                        {
                            continue;
                        }

                        detail.Quantity = recDetail.Quantity * coef;
                    }

                    foreach (ComplexProductionDetail detail in parent.DetailsProd)
                    {
                        if (!ReferenceEquals(detail.SourceRecipe, SourceRecipe))
                        {
                            continue;
                        }

                        if (detail.ItemId == itemId)
                        {
                            continue;
                        }

                        recDetail = GetMatchingRecipeDetail(detail);
                        if (recDetail == null)
                        {
                            continue;
                        }

                        detail.Quantity = recDetail.Quantity * coef;
                    }
                }
            }

            parent.RecalculatePrices();
        }
コード例 #3
0
        public bool ItemEvaluate(Item item, PriceGroup priceGroup, bool updatePrice, ComplexProduction parent)
        {
            bool ret = ItemEvaluate(item, priceGroup, updatePrice);

            if (ret)
            {
                parent.RecalculatePrices();
            }

            return(ret);
        }
コード例 #4
0
        public static ComplexProduction GetPending(long pId, long lId)
        {
            ComplexProduction production = BusinessDomain.DataAccessProvider.GetPendingOperation <ComplexProduction> (OperationType.ComplexProductionMaterial, pId, lId);

            if (production != null)
            {
                production.LoadDetails();
                production.IsDirty = false;
            }

            return(production);
        }
コード例 #5
0
        public static ComplexProduction GetById(long id)
        {
            ComplexProduction production = BusinessDomain.DataAccessProvider.GetOperationById <ComplexProduction> (OperationType.ComplexProductionMaterial, id);

            if (production != null)
            {
                production.LoadDetails();
                production.IsDirty = false;
            }

            return(production);
        }