public static bool SendInvoiceEmail(InvoiceModel invoice) { var proxy = ServiceClientProvider.GetCommunicationServiceProxy(); try { if (null != proxy) { var dataToSend = ConvertInvoiceToSendData(invoice); var request = new TriggeredSendRequestRequest_V01(); request.Data = dataToSend; var response = proxy.SendTriggeredMessage(new SendTriggeredMessageRequest(request)).SendTriggeredMessageResult; if (response.Status == ServiceResponseStatusType.Success) { return(true); } else { LoggerHelper.Error(string.Format("CommunicationSvcProvider: Error sending Invoice Email invoice: {0}, member id: {1} status:{2}.", invoice.DisplayMemberInvoiceNumber, invoice.MemberId, response.Status)); return(false); } } return(false); } catch (Exception ex) { LoggerHelper.Error(string.Format("CommunicationSvcProvider: Error sending Invoice Email invoice: {0}, member id: {1} Exception Message:{2}.", invoice.DisplayMemberInvoiceNumber, invoice.MemberId, ex.Message)); return(false); } }
public bool SendEmailConfirmation(string orderNumber, string paymentType) { var proxy = ServiceClientProvider.GetCommunicationServiceProxy(); try { var holder = OrderProvider.GetPaymentGatewayOrder(orderNumber); if (holder != null) { GdoOrderEmailSendData_V01 dataToSend = new GdoOrderEmailSendData_V01(); switch (paymentType) { case "Abandoned": case "PaymentDeclined": case "PaymentDeclinedOldOrder": case "PaymentDeclinedMaxTries": dataToSend = getDataDeclinedEmailConfirmation(holder.BTOrder, EmailDeclinedType, orderNumber); break; case "OrderSubmitted": dataToSend = getDataEmailConfirmation(holder.BTOrder, EmailConfirmationType, orderNumber); break; case "Processing": dataToSend = getDataInProcessingEmailConfirmation(holder.BTOrder, EmailInProcessingType, orderNumber); break; } var request = new TriggeredSendRequestRequest_V01(); request.Data = dataToSend; var response = proxy.SendTriggeredMessage(new SendTriggeredMessageRequest(request)).SendTriggeredMessageResult; if (response.Status == ServiceResponseStatusType.Success) { return(true); } else { var ex = new ApplicationException(string.Format("CommunicationSvcProvider: Error sending SendTriggeredMessage order:{0}.", orderNumber)); WebUtilities.LogServiceExceptionWithContext(ex, proxy); return(false); } } return(false); } catch (Exception ex) { ex = new ApplicationException(string.Format("CommunicationSvcProvider: Error sending SendTriggeredMessage order:{0}.", orderNumber), ex); WebUtilities.LogServiceExceptionWithContext(ex, proxy); return(false); } }