private void AddPaymentInfoToAccount(AccountViewModel account, PaymentInfo paymentInfo) { Common.ValidateArgument<AccountViewModel>(account, "account"); Common.ValidateArgument<PaymentInfo>(paymentInfo, "paymentInfo"); PaymentInfoLogic piLogic = new PaymentInfoLogic(); PaymentInfo existingPaymentInfo = piLogic.GetPaymentInfoByPaymentInfoGuid(paymentInfo.PaymentInfoGuid); if (existingPaymentInfo == null || existingPaymentInfo.PaymentInfoGuid == Guid.Empty) { paymentInfo = piLogic.InsertPaymentInfo(paymentInfo); } else { paymentInfo.PaymentInfoGuid = existingPaymentInfo.PaymentInfoGuid; piLogic.UpdatePaymentInfo(paymentInfo); paymentInfo = piLogic.GetPaymentInfoByPaymentInfoGuid(paymentInfo.PaymentInfoGuid); } account.PaymentInfoGuid = paymentInfo.PaymentInfoGuid; }
public DC.PaymentInfo GetPaymentInfoByPaymentInfoGuid(Guid paymentInfoGuid) { try { BL.PaymentInfoLogic paymentInfoLogic = new BL.PaymentInfoLogic(); BE.PaymentInfo entity = paymentInfoLogic.GetPaymentInfoByPaymentInfoGuid(paymentInfoGuid); DC.PaymentInfo response = entity.ToDataContract(); return response; } catch (BE.PaymentInfoNotFoundException ex) { FC.PaymentInfoFault fault = new FC.PaymentInfoFault(); fault.PaymentInfoGuid = ex.PaymentInfoGuid; fault.ErrorMessage = "PaymentInfo does not exsist in the database."; throw new FaultException<FC.PaymentInfoFault>(fault, new FaultReason(ex.Message)); } catch (Exception ex) { FC.PaymentInfoFault fault = new FC.PaymentInfoFault(); fault.ErrorMessage = "Could not retrieve a specific PaymentInfo for unknown reasons."; throw new FaultException<FC.PaymentInfoFault>(fault, new FaultReason(ex.Message)); } }