Beispiel #1
0
        /// <summary>
        /// Accepts the changes.
        /// </summary>
        public override void AcceptChanges()
        {
            if (_Parent == null)
            {
                throw new NoNullAllowedException("Parent");
            }

            if (_Parent.ObjectState == MetaObjectState.Added)
            {
                throw new MetaException("Must save parent object");
            }

            if (ObjectState != MetaObjectState.Deleted)
            {
                this.OrderGroupId = _Parent.OrderGroupId;
                this.OrderFormId  = _Parent.OrderFormId;
            }

            using (TransactionScope scope = new TransactionScope())
            {
                base.AcceptChanges();

                if (this.ObjectState != MetaObjectState.Deleted)
                {
                    Discounts.AcceptChanges();
                }

                scope.Complete();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Accepts the changes.
        /// </summary>
        public override void AcceptChanges()
        {
            if (_Parent == null)
            {
                throw new NoNullAllowedException("Parent");
            }

            if (_Parent.ObjectState == MetaObjectState.Added)
            {
                throw new MetaException("Must save parent object");
            }

            if (ObjectState != MetaObjectState.Deleted)
            {
                this.OrderGroupId = _Parent.OrderGroupId;
                this.OrderFormId  = _Parent.OrderFormId;

                // Convert LineItemIds to the string
                string           lineItemIdsString = String.Empty;
                StringCollection lineItemIndexes   = LineItemIndexes;
                if (lineItemIndexes != null && lineItemIndexes.Count > 0)
                {
                    foreach (string lineItemId in lineItemIndexes)
                    {
                        if (String.IsNullOrEmpty(lineItemIdsString))
                        {
                            lineItemIdsString = lineItemId.Trim();
                        }
                        else
                        {
                            lineItemIdsString += "," + lineItemId.Trim();
                        }
                    }
                }

                this["LineItemIds"] = lineItemIdsString;
            }

            // Save record
            using (TransactionScope scope = new TransactionScope())
            {
                base.AcceptChanges();

                if (this.ObjectState != MetaObjectState.Deleted)
                {
                    // Save discounts
                    Discounts.AcceptChanges();
                }

                scope.Complete();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Accepts the changes.
        /// </summary>
        public override void AcceptChanges()
        {
            if (_Parent == null)
            {
                throw new NoNullAllowedException("Parent");
            }

            if (_Parent.ObjectState == MetaObjectState.Added)
            {
                throw new MetaException("Must save parent object");
            }

            if (this.ObjectState != MetaObjectState.Deleted)
            {
                this["OrderGroupId"] = _Parent.OrderGroupId;
            }

            using (TransactionScope scope = new TransactionScope())
            {
                base.AcceptChanges();

                if (this.ObjectState != MetaObjectState.Deleted)
                {
                    // Save shipments
                    Shipments.AcceptChanges();

                    // Save payments
                    Payments.AcceptChanges();

                    // Save payments
                    LineItems.AcceptChanges();

                    // Save discounts
                    Discounts.AcceptChanges();
                }

                scope.Complete();
            }
        }