Пример #1
0
        public virtual void UpdateAmount()
        {
            if (!IsLoaded && !IsCreated)
            {
                return;
            }

            if (Product != null)
            {
                Amount = (GetProductPrice() * Quantity) - Discount;
            }
            else
            {
                Amount = 0;
            }
            if (SaleBase != null)
            {
                SaleBase.UpdateAmount();
            }
        }
Пример #2
0
        public void Copy(SaleBase target)
        {
            //rewrite with Cloner - S35833
            target.Discount          = Discount;
            target.DiscountPercent   = DiscountPercent;
            target.Name              = Name;
            target.Owner             = Owner;
            target.PotentialCustomer = PotentialCustomer;

            foreach (SaleItem saleItem in SaleItems)
            {
                SaleItem saleItemNew = ObjectSpace.CreateObject <SaleItem>();
                saleItemNew.Discount = saleItem.Discount;
                saleItemNew.Product  = saleItem.Product;
                saleItemNew.Quantity = saleItem.Quantity;
                saleItemNew.UpdateAmount();

                target.SaleItems.Add(saleItemNew);
            }
            target.UpdateAmount();

            if (target is IOpportunityTarget)
            {
                if (this is Opportunity)
                {
                    ((IOpportunityTarget)target).SourceOpportunity = (Opportunity)this;
                }
                else if (this is IOpportunityTarget)
                {
                    ((IOpportunityTarget)target).SourceOpportunity = ((IOpportunityTarget)this).SourceOpportunity;
                }
            }
            if (this is IGenericAddressableSale)
            {
                ((IGenericAddressableSale)this).Copy(target as IGenericAddressableSale);
            }
        }