public static string ReplaceContentTags(string source, MerchantTribeApplication app, string itemCount, bool isSecureRequest) { Accounts.Store currentStore = app.CurrentStore; string currentUserId = SessionManager.GetCurrentUserId(app.CurrentStore); string output = source; RouteCollection r = System.Web.Routing.RouteTable.Routes; //VirtualPathData homeLink = r.GetVirtualPath(requestContext.RoutingContext, "homepage", new RouteValueDictionary()); output = output.Replace("{{homelink}}", app.StoreUrl(isSecureRequest, false)); output = output.Replace("{{logo}}", HtmlRendering.Logo(app, isSecureRequest)); output = output.Replace("{{logotext}}", HtmlRendering.LogoText(app)); output = output.Replace("{{headermenu}}", HtmlRendering.HeaderMenu(app.CurrentRequestContext.RoutingContext, app.CurrentRequestContext)); output = output.Replace("{{cartlink}}", HtmlRendering.CartLink(app, itemCount)); output = output.Replace("{{copyright}}", "<span class=\"copyright\">Copyright ©" + DateTime.Now.Year.ToString() + "</span>"); output = output.Replace("{{headerlinks}}", HtmlRendering.HeaderLinks(app, currentUserId)); output = output.Replace("{{searchform}}", HtmlRendering.SearchForm(app)); output = output.Replace("{{assets}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForStoreTheme(app, currentStore.Settings.ThemeId, isSecureRequest) + "assets/"); output = output.Replace("{{img}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest)); output = output.Replace("{{storeassets}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest)); output = output.Replace("{{sitefiles}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForSingleStore(app, isSecureRequest)); output = output.Replace("{{storeaddress}}", app.ContactServices.Addresses.FindStoreContactAddress().ToHtmlString()); return(output); }
public static void RedirectToMainStoreUrl(long storeId, System.Uri requestedUrl, MerchantTribeApplication app) { Accounts.Store store = app.AccountServices.Stores.FindById(storeId); if (store == null) { return; } app.CurrentStore = store; string host = requestedUrl.Authority; string relativeRoot = "http://" + host; bool secure = false; if (requestedUrl.ToString().ToLowerInvariant().StartsWith("https://")) { secure = true; } string destination = app.StoreUrl(secure, false); string pathAndQuery = requestedUrl.PathAndQuery; // Trim starting slash because root URL already has this pathAndQuery = pathAndQuery.TrimStart('/'); destination = System.IO.Path.Combine(destination, pathAndQuery); // 301 redirect to main url if (System.Web.HttpContext.Current != null) { System.Web.HttpContext.Current.Response.RedirectPermanent(destination); } }
public static void SendCustomDomainRequest(string name, string email, string phone, string domain, string ownsDomain, string hasSsl) { Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); MailMessage m = new MailMessage(email, WebAppSettings.SuperAdminEmail); m.Subject = "BV Hosted Custom Domain Request | Contact Form"; StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>New Hosted Signup Lead</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>Custom Domain Request</h1>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Domain:", domain)); sb.Append(RenderEmailTableRow("Email:", email)); sb.Append(RenderEmailTableRow("Phone:", phone)); sb.Append(RenderEmailTableRow("Owns Domain:", ownsDomain)); sb.Append(RenderEmailTableRow("Has SSL:", hasSsl)); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); sender.SendMail(m); }
public Collection <ShippingRateDisplay> GetRates(List <ShippingGroup> groups) { Accounts.Store currentStore = RequestContext.GetCurrentRequestContext().CurrentStore; Collection <ShippingRateDisplay> result = new Collection <ShippingRateDisplay>(); MerchantTribe.Shipping.IShippingService p = Shipping.AvailableServices.FindById(this.ShippingProviderId, currentStore); if (p != null) { p.BaseSettings.Clear(); p.BaseSettings.Merge(this.Settings); List <IShippingRate> tempRates = p.RateShipment(ConvertGroupsToShipments(groups)); if (tempRates != null) { for (int i = 0; i <= tempRates.Count - 1; i++) { ShippingRateDisplay r = new ShippingRateDisplay(tempRates[i]); r.ShippingMethodId = this.Bvin; if (r.DisplayName == string.Empty) { r.DisplayName = this.Name; } AdjustRate(r); result.Add(r); } } } return(result); }
public Collection <ShippingRateDisplay> GetRates(Orders.Order o, Accounts.Store currentStore) { Collection <ShippingRateDisplay> result = new Collection <ShippingRateDisplay>(); List <ShippingGroup> groups = o.GetShippingGroups(); return(GetRates(groups, currentStore)); }
public static void SendAdminUserResetLink(Accounts.UserAccount u, Accounts.Store s) { if (u == null || s == null) { return; } MailMessage m = new MailMessage(WebAppSettings.ApplicationEmail, u.Email); m.Subject = "BV Commerce Password Reset Instructions"; StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>BV Commerce Password Reset Instructions</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>Password Reset Instructions</h1>"); sb.Append("<p>Your Reset Key = " + u.ResetKey + "</p>"); sb.Append("<p>Use the link below to reset your password.</p>"); sb.Append("<p><a href=\"" + s.RootUrlSecure() + "adminaccount/ResetPassword2?email=" + u.Email + "&resetkey=" + u.ResetKey + "\">"); sb.Append("Click Here to Reset Your Password</a></p>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); Utilities.MailServices.SendMail(m); }
public string GetDefaultLink(Accounts.Store currentStore) { string result = ""; result = currentStore.RootUrl(); result += "?" + WebAppSettings.AffiliateQueryStringName + "=" + this.ReferralId; return(result); }
public static IShippingService FindById(string id, Accounts.Store currentStore) { foreach (IShippingService svc in FindAll(currentStore)) { if (svc.Id == id) { return(svc); } } return(null); }
public static PayPalAPI GetPaypalAPI(Accounts.Store currentStore) { com.paypal.sdk.profiles.IAPIProfile APIProfile = Utilities.PaypalExpressUtilities.CreateAPIProfile(currentStore.Settings.PayPal.UserName, currentStore.Settings.PayPal.Password, currentStore.Settings.PayPal.Signature, currentStore.Settings.PayPal.FastSignupEmail, currentStore.Settings.PayPal.Mode); return(new PayPalAPI(APIProfile)); }
public static long ParseStoreId(System.Uri url, MerchantTribeApplication app) { long result = -1; // Individual Mode if (WebAppSettings.IsIndividualMode) { Accounts.Store temp = app.AccountServices.FindOrCreateIndividualStore(); if (temp != null) { return(temp.Id); } } string host = url.DnsSafeHost.ToLowerInvariant(); string mainDomain; mainDomain = WebAppSettings.ApplicationBaseUrl; // Trim off http://www if (mainDomain.Length > 11) { mainDomain = mainDomain.Substring(10, mainDomain.Length - 10); mainDomain = mainDomain.TrimEnd('/'); } if (host.EndsWith(mainDomain)) { // see if we're matching site domain first string storeName; storeName = ParseStoreName(url); Accounts.Store current = null; current = app.AccountServices.Stores.FindByStoreName(storeName); if (current != null) { if (current.Id > 0) { result = current.Id; } } } else { // not on main domain, try custom urls result = GetStoreIdForCustomUrl(url, app); } return(result); }
public bool AdminUserResetRequest(string email, Accounts.Store store) { UserAccount u = AdminUsers.FindByEmail(email); if (u == null) { return(false); } u.ResetKey = System.Guid.NewGuid().ToString(); AdminUsers.Update(u); Utilities.MailServices.SendAdminUserResetLink(u, store); return(true); }
public static void SendLeadAlert(Accounts.UserAccount u, Accounts.Store s) { Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); if (u == null || s == null) { return; } MailMessage m = new MailMessage(WebAppSettings.ApplicationEmail, WebAppSettings.SuperAdminEmail); if (s.PlanId == 0) { m.Subject = "BV Hosted FREE Signup Lead | Contact Form"; } else { m.Subject = "BV Hosted PAID PLAN signup | Contact Form"; } if (s.Settings.LeadSource == "PayPalOffer") { m.Subject += " | from PayPal Offer"; } StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>New Hosted Signup Lead</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>New Hosted Store Signup</h1>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Email", u.Email)); sb.Append(RenderEmailTableRow("Store Name", s.StoreName)); sb.Append(RenderEmailTableRowLink("Store URL", s.RootUrl(), s.RootUrl())); sb.Append(RenderEmailTableRowLink("Store Admin URL", s.RootUrl() + "admin", s.RootUrl() + "admin")); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); sender.SendMail(m); }
private decimal CalculateHandlingAmount(Order o) { Accounts.Store currentStore = _app.CurrentStore; if (currentStore == null) { return(0); } if (currentStore.Settings.HandlingType == (int)HandlingMode.PerItem) { decimal amount = 0; foreach (Orders.LineItem item in o.Items) { if (item.ShippingSchedule == -1) { if (currentStore.Settings.HandlingNonShipping) { amount += item.Quantity; } } else { amount += item.Quantity; } } return(currentStore.Settings.HandlingAmount * amount); } else if (currentStore.Settings.HandlingType == (int)HandlingMode.PerOrder) { //charge handling if there aren't non shipping items if (currentStore.Settings.HandlingNonShipping) { foreach (Orders.LineItem item in o.Items) { return(currentStore.Settings.HandlingAmount); } } else { foreach (Orders.LineItem item in o.Items) { if (item.ShippingSchedule != -1) { return(currentStore.Settings.HandlingAmount); } } } } return(0); }
public List <HtmlTemplateTag> DefaultReplacementTags(MerchantTribeApplication app) { List <HtmlTemplateTag> result = new List <HtmlTemplateTag>(); Accounts.Store currentStore = app.CurrentStore; result.Add(new HtmlTemplateTag("[[Store.Address]]", app.ContactServices.Addresses.FindStoreContactAddress().ToHtmlString())); result.Add(new HtmlTemplateTag("[[Store.ContactEmail]]", currentStore.Settings.MailServer.EmailForGeneral)); result.Add(new HtmlTemplateTag("[[Store.Logo]]", Utilities.HtmlRendering.Logo(app, false))); result.Add(new HtmlTemplateTag("[[Store.SecureUrl]]", currentStore.RootUrlSecure())); result.Add(new HtmlTemplateTag("[[Store.StoreName]]", currentStore.StoreName)); result.Add(new HtmlTemplateTag("[[Store.StandardUrl]]", currentStore.RootUrl())); result.Add(new HtmlTemplateTag("[[Store.CurrentLocalTime]]", DateTime.Now.ToString())); result.Add(new HtmlTemplateTag("[[Store.CurrentUtcTime]]", DateTime.UtcNow.ToString())); return(result); }
public static void SendPlanDowngradeAlert(Accounts.UserAccount u, Accounts.Store s) { if (u == null || s == null) { return; } MailMessage m = new MailMessage(WebAppSettings.ApplicationEmail, WebAppSettings.SuperAdminEmail); m.Subject = "BV Hosted | Plan Downgrade to " + s.PlanName; if (s.Settings.LeadSource == "PayPalOffer") { m.Subject += " | from PayPal Offer"; } StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>New Hosted Plan Downgrade</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>New Hosted Plan Downgrade</h1>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Email", u.Email)); sb.Append(RenderEmailTableRow("Store Name", s.StoreName)); sb.Append(RenderEmailTableRowLink("Store URL", s.RootUrl(), s.RootUrl())); sb.Append(RenderEmailTableRowLink("Store Admin URL", s.RootUrl() + "admin", s.RootUrl() + "admin")); sb.Append(RenderEmailTableRow("Downgraded to Plan", s.PlanName)); sb.Append(RenderEmailTableRow("Bill Day of Month", s.CurrentPlanDayOfMonth.ToString())); sb.Append(RenderEmailTableRow("Bill Rate", s.CurrentPlanRate.ToString("c"))); sb.Append(RenderEmailTableRow("Percentage", s.CurrentPlanPercent.ToString())); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); sender.SendMail(m); }
public static void SendAccountInformation(Accounts.UserAccount u, Accounts.Store s) { Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); if (u == null || s == null) { return; } string fromEmail = WebAppSettings.ApplicationEmail; if (WebAppSettings.IsIndividualMode) { fromEmail = s.Settings.MailServer.FromEmail; } MailMessage m = new MailMessage(fromEmail, u.Email); m.Subject = s.StoreName + " Account Reminder Information"; StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>BV Commerce Account Information Reminder</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>Account Information</h1>"); sb.Append("<p>Thank you for creating a MerchantTribe store. Your account information appears below:</p>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Email", u.Email)); // Passwords are now hashed so we can't send them. //sb.Append(RenderEmailTableRow("Password", u.Password)); sb.Append(RenderEmailTableRow("Store Name", s.StoreName)); sb.Append(RenderEmailTableRowLink("Store URL", s.RootUrl(), s.RootUrl())); sb.Append(RenderEmailTableRowLink("Store Admin URL", s.RootUrl() + "admin", s.RootUrl() + "admin")); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); sender.SendMail(m); }
public Collection <DisplayPaymentMethod> EnabledMethods(Accounts.Store currentStore) { Collection <DisplayPaymentMethod> result = new Collection <DisplayPaymentMethod>(); Dictionary <string, string> enabledList = currentStore.Settings.PaymentMethodsEnabled; if (enabledList != null) { for (int i = 0; i <= Methods.Count - 1; i++) { if (enabledList.ContainsKey(Methods[i].MethodId)) { result.Add(Methods[i]); } } } return(result); }
// Primary Method to Detect Store from Uri public static Accounts.Store ParseStoreFromUrl(System.Uri url, MerchantTribeApplication app) { // Individual Mode if (WebAppSettings.IsIndividualMode) { return(app.AccountServices.FindOrCreateIndividualStore()); } // Multi Mode Accounts.Store result = null; long storeid = ParseStoreId(url, app); if (storeid > 0) { result = app.AccountServices.Stores.FindById(storeid); } return(result); }
public static void SSLRedirect(MerchantTribeApplication app, Accounts.Store currentStore, SSLRedirectTo RedirectTo) { string CurrentUrl = app.CurrentRequestContext.RoutingContext.HttpContext.Request.RawUrl.ToLower(); //UrlRewriter.GetRewrittenUrlFromRequest(page.Request).ToLower(); string StandardURL = app.StoreUrl(false, true).ToLowerInvariant(); string SecureURL = app.StoreUrl(true, false).ToLowerInvariant(); string sessionId = WebAppSettings.SessionId; string cartId = WebAppSettings.CartId; string currentSessionId = SessionManager.GetCurrentUserId(currentStore); string currentCartId = SessionManager.GetCurrentCartID(currentStore); string url = BuildUrlForRedirect(CurrentUrl, StandardURL, SecureURL, RedirectTo, sessionId, cartId, currentSessionId, currentCartId, false ); //if the urls match, then for some reason we aren't replacing anything //so if we redirect then we will go into a loop if (url != CurrentUrl) { app.CurrentRequestContext.RoutingContext.HttpContext.Response.Redirect(url); } }
public static List <IShippingService> FindAll(Accounts.Store currentStore) { List <IShippingService> result = new List <IShippingService>(); result = Service.FindAll(); //result.Add(new MerchantTribe.Shipping.Fedex.FedExProvider()); //FedEx MerchantTribe.Shipping.FedEx.FedExGlobalServiceSettings fedexGlobal = new FedExGlobalServiceSettings(); fedexGlobal.UserKey = currentStore.Settings.ShippingFedExKey; fedexGlobal.UserPassword = currentStore.Settings.ShippingFedExPassword; fedexGlobal.AccountNumber = currentStore.Settings.ShippingFedExAccountNumber; fedexGlobal.MeterNumber = currentStore.Settings.ShippingFedExMeterNumber; fedexGlobal.DefaultDropOffType = (MerchantTribe.Shipping.FedEx.DropOffType)currentStore.Settings.ShippingFedExDropOffType; fedexGlobal.DefaultPackaging = (MerchantTribe.Shipping.FedEx.PackageType)currentStore.Settings.ShippingFedExDefaultPackaging; fedexGlobal.DiagnosticsMode = currentStore.Settings.ShippingFedExDiagnostics; fedexGlobal.ForceResidentialRates = currentStore.Settings.ShippingFedExForceResidentialRates; fedexGlobal.UseListRates = currentStore.Settings.ShippingFedExUseListRates; result.Add(new MerchantTribe.Shipping.FedEx.FedExProvider(fedexGlobal, new EventLog())); // Load US Postal MerchantTribe.Shipping.USPostal.USPostalServiceGlobalSettings uspostalGlobal = new MerchantTribe.Shipping.USPostal.USPostalServiceGlobalSettings(); uspostalGlobal.DiagnosticsMode = currentStore.Settings.ShippingUSPostalDiagnostics; result.Add(new MerchantTribe.Shipping.USPostal.DomesticProvider(uspostalGlobal, new EventLog())); result.Add(new MerchantTribe.Shipping.USPostal.InternationalProvider(uspostalGlobal, new EventLog())); // Load UPS MerchantTribe.Shipping.Ups.UPSServiceGlobalSettings upsglobal = new MerchantTribe.Shipping.Ups.UPSServiceGlobalSettings(); upsglobal.AccountNumber = currentStore.Settings.ShippingUpsAccountNumber; upsglobal.LicenseNumber = currentStore.Settings.ShippingUpsLicense; upsglobal.Username = currentStore.Settings.ShippingUpsUsername; upsglobal.Password = currentStore.Settings.ShippingUpsPassword; upsglobal.DefaultPackaging = (MerchantTribe.Shipping.Ups.PackagingType)currentStore.Settings.ShippingUpsDefaultPackaging; upsglobal.DiagnosticsMode = currentStore.Settings.ShippingUPSDiagnostics; upsglobal.ForceResidential = currentStore.Settings.ShippingUpsForceResidential; upsglobal.IgnoreDimensions = currentStore.Settings.ShippingUpsSkipDimensions; upsglobal.PickUpType = (MerchantTribe.Shipping.Ups.PickupType)currentStore.Settings.ShippingUpsPickupType; result.Add(new MerchantTribe.Shipping.Ups.UPSService(upsglobal, new EventLog())); return(result); }
public static string ReplaceContentTags(string source, MerchantTribeApplication app, string itemCount) { var profiler = MiniProfiler.Current; using (profiler.Step("Tag Replacer")) { if (source.Contains("{{")) { bool isSecureRequest = app.IsCurrentRequestSecure(); Accounts.Store currentStore = app.CurrentStore; string currentUserId = app.CurrentCustomerId; string output = source; RouteCollection r = System.Web.Routing.RouteTable.Routes; output = output.Replace("{{homelink}}", app.StoreUrl(isSecureRequest, false)); output = output.Replace("{{logo}}", HtmlRendering.Logo(app, isSecureRequest)); output = output.Replace("{{logotext}}", HtmlRendering.LogoText(app)); output = output.Replace("{{headermenu}}", HtmlRendering.HeaderMenu(app)); output = output.Replace("{{cartlink}}", HtmlRendering.CartLink(app, itemCount)); output = output.Replace("{{copyright}}", "<span class=\"copyright\">Copyright ©" + DateTime.Now.Year.ToString() + "</span>"); output = output.Replace("{{headerlinks}}", HtmlRendering.HeaderLinks(app, currentUserId)); output = output.Replace("{{searchform}}", HtmlRendering.SearchForm(app)); output = output.Replace("{{assets}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForStoreTheme(app, currentStore.Settings.ThemeId, isSecureRequest) + "assets/"); output = output.Replace("{{img}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest)); output = output.Replace("{{storeassets}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest)); output = output.Replace("{{sitefiles}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForSingleStore(app, isSecureRequest)); output = output.Replace("{{storeaddress}}", app.ContactServices.Addresses.FindStoreContactAddress().ToHtmlString()); return(output); } else { return(source); } } }
public static void SendPlanDowngradeAlert(Accounts.UserAccount u, Accounts.Store s) { if (u == null || s == null) return; MailMessage m = new MailMessage(WebAppSettings.ApplicationEmail, WebAppSettings.SuperAdminEmail); m.Subject = "BV Hosted | Plan Downgrade to " + s.PlanName; if (s.Settings.LeadSource == "PayPalOffer") { m.Subject += " | from PayPal Offer"; } StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>New Hosted Plan Downgrade</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>New Hosted Plan Downgrade</h1>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Email", u.Email)); sb.Append(RenderEmailTableRow("Store Name", s.StoreName)); sb.Append(RenderEmailTableRowLink("Store URL", s.RootUrl(), s.RootUrl())); sb.Append(RenderEmailTableRowLink("Store Admin URL", s.RootUrl() + "admin", s.RootUrl() + "admin")); sb.Append(RenderEmailTableRow("Downgraded to Plan", s.PlanName)); sb.Append(RenderEmailTableRow("Bill Day of Month", s.CurrentPlanDayOfMonth.ToString())); sb.Append(RenderEmailTableRow("Bill Rate", s.CurrentPlanRate.ToString("c"))); sb.Append(RenderEmailTableRow("Percentage", s.CurrentPlanPercent.ToString())); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); sender.SendMail(m); }
public static void SendLeadAlert(Accounts.UserAccount u, Accounts.Store s) { Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); if (u == null || s == null) return; MailMessage m = new MailMessage(WebAppSettings.ApplicationEmail, WebAppSettings.SuperAdminEmail); if (s.PlanId == 0) { m.Subject = "BV Hosted FREE Signup Lead | Contact Form"; } else { m.Subject = "BV Hosted PAID PLAN signup | Contact Form"; } if (s.Settings.LeadSource == "PayPalOffer") { m.Subject += " | from PayPal Offer"; } StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>New Hosted Signup Lead</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>New Hosted Store Signup</h1>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Email", u.Email)); sb.Append(RenderEmailTableRow("Store Name", s.StoreName)); sb.Append(RenderEmailTableRowLink("Store URL", s.RootUrl(), s.RootUrl())); sb.Append(RenderEmailTableRowLink("Store Admin URL", s.RootUrl() + "admin", s.RootUrl() + "admin")); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); sender.SendMail(m); }
public static void SendCustomDomainRequest(string name, string email, string phone, string domain, string ownsDomain, string hasSsl) { Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); MailMessage m = new MailMessage(email, WebAppSettings.SuperAdminEmail); m.Subject = "BV Hosted Custom Domain Request | Contact Form"; StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>New Hosted Signup Lead</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>Custom Domain Request</h1>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Domain:", domain)); sb.Append(RenderEmailTableRow("Email:", email)); sb.Append(RenderEmailTableRow("Phone:", phone)); sb.Append(RenderEmailTableRow("Owns Domain:",ownsDomain)); sb.Append(RenderEmailTableRow("Has SSL:", hasSsl)); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); sender.SendMail(m); }
public static void SendAdminUserResetLink(Accounts.UserAccount u, Accounts.Store s) { Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); if (u == null || s == null) return; MailMessage m = new MailMessage(WebAppSettings.ApplicationEmail, u.Email); m.Subject = "BV Commerce Password Reset Instructions"; StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>BV Commerce Password Reset Instructions</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>Password Reset Instructions</h1>"); sb.Append("<p>Your Reset Key = " + u.ResetKey + "</p>"); sb.Append("<p>Use the link below to reset your password.</p>"); sb.Append("<p><a href=\"" + s.RootUrlSecure() + "adminaccount/ResetPassword2?email=" + u.Email + "&resetkey=" + u.ResetKey + "\">"); sb.Append("Click Here to Reset Your Password</a></p>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); sender.SendMail(m); }
public static void SendAccountInformation(Accounts.UserAccount u, Accounts.Store s) { Accounts.Store tempStore = new Accounts.Store(); MailServices sender = new MailServices(tempStore); if (u == null || s == null) return; string fromEmail = WebAppSettings.ApplicationEmail; if (WebAppSettings.IsIndividualMode) { fromEmail = s.Settings.MailServer.FromEmail; } MailMessage m = new MailMessage(fromEmail, u.Email); m.Subject = s.StoreName + " Account Reminder Information"; StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\" >"); sb.Append("<head><title>BV Commerce Account Information Reminder</title>"); sb.Append(RenderEmailHtmlStyles()); sb.Append("</head><body><div style=\"padding:20px;\">"); sb.Append("<h1>Account Information</h1>"); sb.Append("<p>Thank you for creating a MerchantTribe store. Your account information appears below:</p>"); sb.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">"); sb.Append(RenderEmailTableRow("Email", u.Email)); // Passwords are now hashed so we can't send them. //sb.Append(RenderEmailTableRow("Password", u.Password)); sb.Append(RenderEmailTableRow("Store Name", s.StoreName)); sb.Append(RenderEmailTableRowLink("Store URL", s.RootUrl(), s.RootUrl())); sb.Append(RenderEmailTableRowLink("Store Admin URL", s.RootUrl() + "admin", s.RootUrl() + "admin")); sb.Append("</table>"); sb.Append(" <br />"); sb.Append(" <br />"); sb.Append("</div></body></html>"); m.IsBodyHtml = true; m.Body = sb.ToString(); sender.SendMail(m); }
public MailServices(Accounts.Store currentStore) { _store = currentStore; }
public Utilities.SortableCollection <Shipping.ShippingRateDisplay> FindAvailableShippingRates(Order o, Accounts.Store currentStore) { Utilities.SortableCollection <Shipping.ShippingRateDisplay> result = new Utilities.SortableCollection <Shipping.ShippingRateDisplay>(); // Get all the methods that apply to this shipping address and store List <Zone> zones = ShippingZones.FindAllZonesForAddress(o.ShippingAddress, o.StoreId); List <ShippingMethod> methods = new List <ShippingMethod>(); methods = this.ShippingMethods.FindForZones(zones); // Get Rates for each Method foreach (Shipping.ShippingMethod m in methods) { Collection <Shipping.ShippingRateDisplay> tempRates = m.GetRates(o, currentStore); if (tempRates != null) { for (int i = 0; i <= tempRates.Count - 1; i++) { ShippingRateDisplay fRate = tempRates[i].GetCopy(); //fRate.AdjustRate(m.AdjustmentType, m.Adjustment); result.Add(fRate); } } } // Tally up extra ship fees decimal totalExtraFees = 0m; foreach (LineItem li in o.Items) { if (li.ExtraShipCharge > 0) { totalExtraFees += li.ExtraShipCharge; } } // update results with extra ship fees and handling foreach (Shipping.ShippingRateDisplay displayRate in result) { displayRate.Rate += totalExtraFees + o.TotalHandling; } // Apply promotions to rates here: // Run workflow to get shipping rate discounts //BusinessRules.ShippingTaskContext c = new BusinessRules.ShippingTaskContext(); //c.Rates = result; //c.UserId = this.UserID; //c.Order = this; //BusinessRules.Workflow.RunByName(c, BusinessRules.WorkflowNames.ApplyShippingDiscounts); // Sort Rates result.Sort("Rate", Utilities.SortDirection.Ascending); if (result.Count < 1) { if (o.IsOrderFreeShipping()) { result.Add(new Shipping.ShippingRateDisplay("Free Shipping.", "", "", 0m, "FREESHIPPING")); } else { string value = Content.SiteTerms.GetTerm(Content.SiteTermIds.ShippingUnknown); if (!string.IsNullOrEmpty(value)) { result.Add(new Shipping.ShippingRateDisplay(value, "", "", 0m, "UNKNOWN")); } else { result.Add(new Shipping.ShippingRateDisplay("To Be Determined. Contact Store for Details", "", "", 0m, "TOBEDETERMINED")); } } } return(result); }
public Shipping.ShippingRateDisplay OrdersFindShippingRateByUniqueKey(string key, Order o, Accounts.Store currentStore) { Utilities.SortableCollection <Shipping.ShippingRateDisplay> rates = FindAvailableShippingRates(o, currentStore); if (rates == null) { return(null); } if (rates.Count < 1) { return(null); } foreach (Shipping.ShippingRateDisplay r in rates) { if (r.UniqueKey == key) { return(r); } } return(null); }
public bool OrdersRequestShippingMethodByUniqueKey(string rateUniqueKey, Order o, Accounts.Store currentStore) { bool result = false; Utilities.SortableCollection <Shipping.ShippingRateDisplay> rates = FindAvailableShippingRates(o, currentStore); foreach (Shipping.ShippingRateDisplay r in rates) { if (r.UniqueKey == rateUniqueKey) { return(OrdersRequestShippingMethod(r, o)); } } return(result); }
public static bool SendMail(System.Net.Mail.MailMessage m, Accounts.Store fromStore) { MailServices sender = new MailServices(fromStore); return(sender.SendMail(m)); }