Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
 public void EndGetPaymentById(IAsyncResult result)
 {
     if (result.IsCompleted)
     {
         try
         {
             PaymentEventDto paymentEvent = PaymentEventService.EndGetPaymentEventById(result);
             PaymentEvents.Add(new PaymentEventViewModel(paymentEvent));
         }
         catch (FaultException ex)
         {
             IsError      = true;
             ErrorMessage = ex.Message;
         }
     }
     InProgress = false;
 }
Exemplo n.º 3
0
 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);
         }
     }
 }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
 public bool UpdatePaymentEvent(PaymentEventDto payment)
 {
     Contract.Requires <PaymentServicesException>(payment != null);
     return(default(bool));
 }
Exemplo n.º 6
0
 public int CreatePaymentEvent(PaymentEventDto payment, int customerID)
 {
     Contract.Requires <PaymentServicesException>(payment != null);
     return(-1);
 }
 public PaymentEventViewModel(PaymentEventDto payment)
 {
     _paymentEvent = payment;
     IsNew         = false;
 }
 public PaymentEventViewModel()
 {
     _paymentEvent = new PaymentEventDto();
     IsNew         = true;
 }
 public bool UpdatePaymentEvent(PaymentEventDto paymentDto)
 {
     return(PaymentEventService.UpdatePaymentEvent(paymentDto));
 }
 public int CreatePaymentEvent(PaymentEventDto paymentDto, int customerId)
 {
     return(PaymentEventService.CreatePaymentEvent(paymentDto, customerId));
 }