public int CreatePaymentEvent(PaymentEventDto paymentDto, int customerId)
        {
            PaymentEvent paymentEvent = new PaymentEvent();

            UpdatePaymentEvent(ref paymentEvent, paymentDto);

            Customer customer = _repository.Load<Customer>(customerId);
            customer.PaymentEvents.Add(paymentEvent);

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    _repository.Save<PaymentEvent>(paymentEvent);
                    _repository.Update<Customer>(customer);
                    _repository.Flush();
                    scope.Complete();
                    return paymentEvent.Id;
                }
                catch (Exception ex)
                {
                    log.Error("Error during Creating new PaymentEvent", ex);
                    return -1;
                }
            }
        }
 public bool UpdatePaymentEvent(PaymentEventDto paymentDto)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         try
         {
             var payment = _repository.Load<PaymentEvent>(paymentDto.Id);
             UpdatePaymentEvent(ref payment, paymentDto);
             _repository.Update<PaymentEvent>(payment);
             _repository.Flush();
             scope.Complete();
             return true;
         }
         catch (Exception ex)
         {
             log.Error("Error during marking PaymentEvent update", ex);
             return false;
         }
     }
 }
        public void UpdatePaymentEvent(ref PaymentEvent paymentEvent, PaymentEventDto paymentDto)
        {
            paymentEvent.Description = paymentDto.Description;
            paymentEvent.Name = paymentDto.Title;
            paymentEvent.PartnerIban = paymentDto.PartnerIban;
            paymentEvent.Amount = paymentDto.Amount;
            paymentEvent.Date = paymentDto.Date;
            paymentEvent.Regular = paymentDto.Regular;

            if (paymentDto.PartnerId != -1)
            {
                BusinessPartner partner = _repository.Load<BusinessPartner>(paymentDto.PartnerId);
                paymentEvent.Partner = partner;
            }

            if (paymentDto.AccountId != -1)
            {
                Account account = _repository.Load<Account>(paymentDto.AccountId);
                paymentEvent.Account = account;
            }
        }
 public bool UpdatePaymentEvent(PaymentEventDto paymentDto)
 {
     return PaymentEventService.UpdatePaymentEvent(paymentDto);
 }
 public int CreatePaymentEvent(PaymentEventDto paymentDto, int customerId)
 {
     return PaymentEventService.CreatePaymentEvent(paymentDto, customerId);
 }
 public bool UpdatePaymentEvent(PaymentEventDto payment)
 {
     Contract.Requires<PaymentServicesException>(payment != null);
     return default(bool);
 }
 public int CreatePaymentEvent(PaymentEventDto payment, int customerID)
 {
     Contract.Requires<PaymentServicesException>(payment != null);
     return -1;
 }