Example #1
0
     private void FixupPaymentUsage(PaymentUsage previousValue, bool skipKeys = false)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.PaymentRequests.Contains(this))
         {
             previousValue.PaymentRequests.Remove(this);
         }
 
         if (PaymentUsage != null)
         {
             if (!PaymentUsage.PaymentRequests.Contains(this))
             {
                 PaymentUsage.PaymentRequests.Add(this);
             }
 
             PaymentUsageId = PaymentUsage.Id;
         }
         else if (!skipKeys)
         {
             PaymentUsageId = null;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("PaymentUsage")
                 && (ChangeTracker.OriginalValues["PaymentUsage"] == PaymentUsage))
             {
                 ChangeTracker.OriginalValues.Remove("PaymentUsage");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("PaymentUsage", previousValue);
             }
             if (PaymentUsage != null && !PaymentUsage.ChangeTracker.ChangeTrackingEnabled)
             {
                 PaymentUsage.StartTracking();
             }
         }
     }
Example #2
0
        protected override void Create()
        {
            var paymentusage = new PaymentUsage
                                   {
                                       Name = Name,
                                       DefaultPaymentMeanId = DefaultPaymentMeanId,
                                       FinancialAccountId = FinancialAccountId,
                                       Description = Description,
                                       IsDefault = IsDefault
                                   };

            using (
                var paymentusageService =
                    SvcClientManager.GetSvcClient<PaymentUsageServiceClient>(SvcType.PaymentUsageSvc))
            {
                paymentusageService.AddNewPaymentUsage(paymentusage, CurrentUser.Id);
            }
        }