コード例 #1
0
        /// <summary>
        /// Deletes a <see cref="IAppliedPayment"/>
        /// </summary>
        /// <param name="appliedPayment">The <see cref="IAppliedPayment"/> to be deleted</param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        public void Delete(IAppliedPayment appliedPayment, bool raiseEvents = true)
        {
            if (raiseEvents)
            {
                if (Deleting.IsRaisedEventCancelled(new DeleteEventArgs <IAppliedPayment>(appliedPayment), this))
                {
                    ((AppliedPayment)appliedPayment).WasCancelled = true;
                    return;
                }
            }

            using (new WriteLock(Locker))
            {
                var uow = UowProvider.GetUnitOfWork();
                using (var repository = RepositoryFactory.CreateAppliedPaymentRepository(uow))
                {
                    repository.Delete(appliedPayment);
                    uow.Commit();
                }
            }

            if (raiseEvents)
            {
                Deleted.RaiseEvent(new DeleteEventArgs <IAppliedPayment>(appliedPayment), this);
            }
        }
コード例 #2
0
 public static IAppliedPayment MockSavedWithKey(this IAppliedPayment entity, Guid key)
 {
     entity.Key = key;
     ((Entity)entity).AddingEntity();
     entity.ResetDirtyProperties();
     return(entity);
 }
コード例 #3
0
        internal static IAppliedPayment ToAppliedPayment(this AppliedPaymentDisplay appliedPaymentDisplay, IAppliedPayment destination)
        {
            if (appliedPaymentDisplay.Key != Guid.Empty) destination.Key = appliedPaymentDisplay.Key;

            // the only things we can change here are the amount and the description
            destination.Description = appliedPaymentDisplay.Description;
            destination.Amount = appliedPaymentDisplay.Amount;

            return destination;
        }
コード例 #4
0
 /// <summary>
 /// Saves a single <see cref="IAppliedPayment"/>
 /// </summary>
 /// <param name="appliedPayment">The <see cref="IAppliedPayment"/> to be saved</param>
 public void Save(IAppliedPayment appliedPayment)
 {
     _paymentService.Save(appliedPayment);
 }
コード例 #5
0
ファイル: PaymentService.cs プロジェクト: vonbv/Merchello
 /// <summary>
 /// Deletes a <see cref="IAppliedPayment"/>
 /// </summary>
 /// <param name="appliedPayment">The <see cref="IAppliedPayment"/> to be deleted</param>
 /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
 public void Delete(IAppliedPayment appliedPayment, bool raiseEvents = true)
 {
     _appliedPaymentService.Delete(appliedPayment, raiseEvents);
 }
コード例 #6
0
        /// <summary>
        /// Saves an <see cref="IAppliedPayment"/>
        /// </summary>
        /// <param name="appliedPayment">The <see cref="IAppliedPayment"/> to be saved</param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        public void Save(IAppliedPayment appliedPayment, bool raiseEvents = true)
        {
            if (raiseEvents)
                if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IAppliedPayment>(appliedPayment), this))
                {
                    ((AppliedPayment)appliedPayment).WasCancelled = true;
                    return;
                }

            using (new WriteLock(Locker))
            {
                var uow = UowProvider.GetUnitOfWork();
                using (var repository = RepositoryFactory.CreateAppliedPaymentRepository(uow))
                {
                    repository.AddOrUpdate(appliedPayment);
                    uow.Commit();
                }
            }

            if (raiseEvents) Saved.RaiseEvent(new SaveEventArgs<IAppliedPayment>(appliedPayment), this);
        }
コード例 #7
0
        internal static IAppliedPayment ToAppliedPayment(this AppliedPaymentDisplay appliedPaymentDisplay, IAppliedPayment destination)
        {
            if (appliedPaymentDisplay.Key != Guid.Empty)
            {
                destination.Key = appliedPaymentDisplay.Key;
            }

            // the only things we can change here are the amount and the description
            destination.Description = appliedPaymentDisplay.Description;
            destination.Amount      = appliedPaymentDisplay.Amount;

            return(destination);
        }
コード例 #8
0
 internal static AppliedPaymentDisplay ToAppliedPaymentDisplay(this IAppliedPayment appliedPayment)
 {
     return(AutoMapper.Mapper.Map <AppliedPaymentDisplay>(appliedPayment));
 }
コード例 #9
0
ファイル: PaymentService.cs プロジェクト: drpeck/Merchello
 /// <summary>
 /// Saves an <see cref="IAppliedPayment"/>
 /// </summary>
 /// <param name="appliedPayment">The <see cref="IAppliedPayment"/> to be saved</param>
 /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
 public void Save(IAppliedPayment appliedPayment, bool raiseEvents = true)
 {
     _appliedPaymentService.Save(appliedPayment, raiseEvents);
 }
コード例 #10
0
 /// <summary>
 /// Saves a single <see cref="IAppliedPayment"/>
 /// </summary>
 /// <param name="appliedPayment">The <see cref="IAppliedPayment"/> to be saved</param>
 public void Save(IAppliedPayment appliedPayment)
 {
     _paymentService.Save(appliedPayment);
 }