public async Task Send <T>(object message, CancellationToken cancellationToken = default(CancellationToken)) where T : class { var sender = await GetSender <T>(); sender.ConnectSendObserver(new ErrorQueueConfig(addressProvider.GetAddress("error"))); await sender.Send <T>(message, cancellationToken); }
/// <summary> /// Retrieve the current order and addresses from the database. /// </summary> /// <returns></returns> private OrderInfo GetExistingOrder(int orderID, bool updateDetails) { OrderInfo order = null; if (orderID != Null.NullInteger) { try { order = _orderController.GetOrder(PortalId, orderID); if (order != null) { // Update order details if needed if (updateDetails) { order = _orderController.UpdateOrderDetails(order.OrderID, CurrentCart.GetInfo(PortalId, StoreSettings.SecureCookie).CartID); } // Load billing address or create a new one BillingAddress = _addressProvider.GetAddress(order.BillingAddressID); // Load shipping address or create a new one ShippingAddress = _addressProvider.GetAddress(order.ShippingAddressID); } } catch { order = null; } } return(order); }
private IAddressInfo GetAddress(int addressID, int customerID) { IAddressInfo address; if (addressID == 0) { address = _addressProvider.GetRegistrationAddress(PortalId, customerID, ""); } else { address = _addressProvider.GetAddress(addressID); } return(address); }
private void InitClusters(IAddressProvider addressProvider) { if (addressProvider == null) throw new ArgumentNullException("addressProvider"); clusters = new Cluster[Config.KugelmatikWidth * Config.KugelmatikHeight]; for (int x = 0; x < Config.KugelmatikWidth; x++) for (int y = 0; y < Config.KugelmatikHeight; y++) clusters[y * Config.KugelmatikWidth + x] = new Cluster(this, x, y, addressProvider.GetAddress(Config, x, y)); }
public async Task <Address> GetAddress(string id) { return(await _addressProvider.GetAddress(id)); }
private void SendOrderStatusChangeEmail(OrderInfo order) { // Get Store Currency Symbol if (!string.IsNullOrEmpty(StoreSettings.CurrencySymbol)) { order.CurrencySymbol = StoreSettings.CurrencySymbol; } // Get Order Date Format string orderDateFormat = Localization.GetString("OrderDateFormat", LocalResourceFile); if (!string.IsNullOrEmpty(orderDateFormat)) { order.DateFormat = orderDateFormat; } // Get Customer Email IAddressProvider controler = StoreController.GetAddressProvider(StoreSettings.AddressName); IAddressInfo billingAddress = controler.GetAddress(order.BillingAddressID); string customerEmail = billingAddress.Email; // Get Admin Email string adminEmail = StoreSettings.DefaultEmailAddress; // Customer Order Email Template string customerSubjectEmail = Localization.GetString("CustomerStatusChangedEmailSubject", LocalResourceFile); string customerBodyEmail = Localization.GetString("CustomerStatusChangedEmailBody", LocalResourceFile); // Extract or remove IFPAID token Match regPaidMatch = RegPaid.Match(customerBodyEmail); if (regPaidMatch.Success) { // If Status is Paid if (order.OrderStatusID == 7) { // Replace IFPAID token by his content string paidTemplate = regPaidMatch.Groups[1].ToString(); paidTemplate = RegStripStartNewLine.Replace(paidTemplate, string.Empty); paidTemplate = RegStripEndNewLine.Replace(paidTemplate, string.Empty); customerBodyEmail = RegPaid.Replace(customerBodyEmail, paidTemplate); } else // Remove IFPAID token { customerBodyEmail = RegPaid.Replace(customerBodyEmail, string.Empty); } } // Admin Order Email Template string adminSubjectEmail = Localization.GetString("AdminStatusChangedEmailSubject", LocalResourceFile); string adminBodyEmail = Localization.GetString("AdminStatusChangedEmailBody", LocalResourceFile); // Init Email Order Replacement Tokens EmailOrderTokenReplace tkEmailOrder = new EmailOrderTokenReplace(); tkEmailOrder.StoreSettings = StoreSettings; tkEmailOrder.Order = order; // Replace tokens customerSubjectEmail = tkEmailOrder.ReplaceEmailOrderTokens(customerSubjectEmail); customerBodyEmail = tkEmailOrder.ReplaceEmailOrderTokens(customerBodyEmail); adminSubjectEmail = tkEmailOrder.ReplaceEmailOrderTokens(adminSubjectEmail); adminBodyEmail = tkEmailOrder.ReplaceEmailOrderTokens(adminBodyEmail); try { // Send Customer Email string result = Mail.SendMail(adminEmail, customerEmail, "", customerSubjectEmail, customerBodyEmail, "", HtmlUtils.IsHtml(customerBodyEmail) ? MailFormat.Html.ToString() : MailFormat.Text.ToString(), "", "", "", ""); if (!string.IsNullOrEmpty(result)) { LogSMTPError(customerEmail, result); } // Send Store Admin Email result = Mail.SendMail(adminEmail, adminEmail, "", adminSubjectEmail, adminBodyEmail, "", HtmlUtils.IsHtml(adminBodyEmail) ? MailFormat.Html.ToString() : MailFormat.Text.ToString(), "", "", "", ""); if (!string.IsNullOrEmpty(result)) { LogSMTPError(customerEmail, result); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }