public string ForgotPassword(string content, User rowUser, string SiteAlias) { using (CurrentSiteSettings currentSiteSettings = new Domain.CurrentSiteSettings(rowUser.Site)) { var site = rowUser.Site; string Host = (string.IsNullOrEmpty(site.Alias) ? site.CName : site.Alias); if (Host.IndexOf('.') > 0 && !(Host.Split('.').Length > 2)) { if (currentSiteSettings.IsRunWithWWW && !Host.Contains("www.")) { Host = Host.Replace(Host, "www." + Host); } else if (!currentSiteSettings.IsRunWithWWW && Host.Contains("www.")) { Host = Host.Replace("www.", ""); } } Host = (currentSiteSettings.USESSL ? "https" : "http") + "://" + Host + "/"; ReplaceMailMerge.SiteAlias = Host; } string sBody = ReplaceMailMerge.ForgotPassword(content, rowUser, "/d/home/resetadpassword?token="); return(sBody); }
public static SiteSMTP SiteSMTPDetail() { var sitesmtp = HttpContext.Current.Cache[SITESTMP + CurrentSite.ID]; if (sitesmtp == null) { using (CurrentSiteSettings CurrentSiteSettings = new Domain.CurrentSiteSettings(CurrentSite)) { var repo = DependencyResolver.Current.GetService <ISiteRepository>(); sitesmtp = repo.GetSMTPDetails(CurrentSiteSettings.SiteID); if (sitesmtp == null) { throw new HttpException("Mail Configuration settings not set. Please contact site administrator."); } else { HttpContext.Current.Cache.Remove(SITESTMP + CurrentSiteSettings.SiteID); HttpContext.Current.Cache.Insert(SITESTMP + CurrentSiteSettings.SiteID, sitesmtp, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0)); } } } return(sitesmtp as SiteSMTP); }
public bool PrepareEmailQueue(int SiteID, int LangID, EmailType eEmailType, int SMTPId, string ToAddress, dynamic d) { string SiteSupportEmail = string.Empty; if (SiteID > 0) { var siteservice = DependencyResolver.Current.GetService <ISiteService>(); Site site = siteservice.GetSite(SiteID); if (site == null) { throw new HttpException("No default site either"); } using (CurrentSiteSettings currentSiteSettings = new Domain.CurrentSiteSettings(site)) { siteservice = null; string Host = (string.IsNullOrEmpty(site.Alias) ? site.CName : site.Alias); if (Host.IndexOf('.') > 0 && !(Host.Split('.').Length > 2)) { if (currentSiteSettings.IsRunWithWWW && !Host.Contains("www.")) { Host = Host.Replace(Host, "www." + Host); } else if (!currentSiteSettings.IsRunWithWWW && Host.Contains("www.")) { Host = Host.Replace("www.", ""); } } Host = (currentSiteSettings.USESSL ? "https" : "http") + "://" + Host + "/"; ReplaceMailMerge.SiteAlias = Host; SiteSupportEmail = currentSiteSettings.SiteSupportEmail; } } string strSubject = string.Empty, strEmailContent = string.Empty; EmailTemplates objTemplate = _EmailTemplates.Find(et => et.EmailTypeId == (int)eEmailType && et.SiteID == SiteID && et.LangID == LangID).FirstOrDefault(); if (objTemplate != null) { strSubject = objTemplate.EmailSubject; switch (eEmailType) { case EmailType.ALL_FORGOTPASSWORD: strEmailContent = ReplaceMailMerge.ForgotPassword(objTemplate.EmailContent, d as User); break; case EmailType.RESELLER_WELCOME_EMAIL: case EmailType.RESELLER_ACCOUNT_ACTIVATION_EMAIL: case EmailType.ADMIN_NEW_RESELLER: strEmailContent = ReplaceMailMerge.ResellerWelComeEmail(objTemplate.EmailContent, d as User); break; case EmailType.CUSTOMER_WELCOME_EMAIL: case EmailType.ADMIN_NEW_CUSTOMER: strEmailContent = ReplaceMailMerge.CustomerWelComeEmail(objTemplate.EmailContent, d as User); break; case EmailType.ADMIN_ADD_FUND_NOTIFICATION: strEmailContent = ReplaceMailMerge.AdminAddFund(objTemplate.EmailContent, d as UserTransaction); break; case EmailType.RESELLER_REFUND_NOTIFICATION: strEmailContent = ReplaceMailMerge.ResellerRefundNotification(objTemplate.EmailContent, SiteSupportEmail, d as UserTransaction); break; case EmailType.CUSTOMER_REFUND_NOTIFICATION: strEmailContent = ReplaceMailMerge.CustomerRefundNotification(objTemplate.EmailContent, SiteSupportEmail, d as UserTransaction); break; case EmailType.ADMIN_REFUND_NOTIFICATION: strEmailContent = ReplaceMailMerge.AdminRefundNotification(objTemplate.EmailContent, d as SupportDetail); break; case EmailType.CUSTOMER_SUPPORT_NOTIFICATION: case EmailType.RESELLER_SUPPORT_NOTIFICATION: case EmailType.ADMIN_SUPPORT_NOTIFICATION: strSubject = ReplaceMailMerge.SupportNotification(strSubject, d as SupportDetail); strEmailContent = ReplaceMailMerge.SupportNotification(objTemplate.EmailContent, d as SupportDetail); break; case EmailType.RESELLER_CHANGE_PASSWORD_EMAIL: case EmailType.CUSTOMER_CHANGE_PASSWORD: strEmailContent = ReplaceMailMerge.ChangePassword(objTemplate.EmailContent, d as User, SiteSupportEmail); break; case EmailType.SUPPORT_FRAUDORDER_NOTIFICATION: strEmailContent = ReplaceMailMerge.FraudNotification(objTemplate.EmailContent, d as string); break; case EmailType.RESELLER_NEW_ORDER_EMAIL: case EmailType.CUSTOMER_NEW_ORDER: case EmailType.ADMIN_NEW_ORDER: strSubject = ReplaceMailMerge.OrderNotification(strSubject, d as CheckOutViewModel); strEmailContent = ReplaceMailMerge.OrderNotification(objTemplate.EmailContent, d as CheckOutViewModel); break; case EmailType.ADMIN_NEWUSER_WELCOME_EMAIL: strEmailContent = ReplaceMailMerge.AdminNewUserWelcome(objTemplate.EmailContent, d as User); break; case EmailType.CONTACTUS_EMAIL: string[] strVal = d as string[]; strSubject = strVal[5]; strEmailContent = ReplaceMailMerge.ContactUsEmail(objTemplate.EmailContent, d as string[]); break; case EmailType.NeedAdvice_EMAIL: string[] strValAd = d as string[]; strSubject = strValAd[4]; strEmailContent = ReplaceMailMerge.RFQEmails(objTemplate.EmailContent, 0, d as string[]); break; case EmailType.RequestForQuote_EMAIL: string[] strValreq = d as string[]; strSubject = strValreq[4]; strEmailContent = ReplaceMailMerge.RFQEmails(objTemplate.EmailContent, 1, d as string[]); break; } EmailQueue objQueue = new EmailQueue(); objQueue.BCC = objTemplate.BCC; objQueue.CC = objTemplate.CC; objQueue.EmailContent = strEmailContent; objQueue.From = objTemplate.From; objQueue.QueuedOn = DateTimeWithZone.Now; objQueue.SiteID = objTemplate.SiteID; objQueue.SiteSMTPID = SMTPId; objQueue.Subject = strSubject; objQueue.TO = ToAddress; _EmailQueue.Add(objQueue); return(true); } return(false); }
public ActionResult addfund(FormCollection collection) { string Message = string.Empty; int SiteID = Convert.ToInt32(collection["hndSiteID"]); int UserID = Convert.ToInt32(collection["hndUserID"]); Site = GetSite(SiteID); currentsitesettings = new Domain.CurrentSiteSettings(Site); SetSiteIDInSession(); var _UserRepo = DependencyResolver.Current.GetService <IRepository <User> >(); User _objUser = _UserRepo.FindByID(UserID); _viewModel.ISCC = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("cc") ? true : false; _viewModel.IsPayPal = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("paypal") ? true : false; _viewModel.IsMoneybookers = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("moneybookers") ? true : false; _viewModel.user = _objUser; _viewModel.PayableAmount = Convert.ToDecimal(collection["txtAmount"]); // Set Country Name if (_viewModel.user.Address.CountryID > 0 && _viewModel.user.Address.Country == null) { Country c = CountryList.Find(x => x.ID == _viewModel.user.Address.CountryID & x.RecordStatusID == (int)RecordStatus.ACTIVE); if (c != null) { _viewModel.BillingCountry = c.CountryName; } else { _viewModel.BillingCountry = "US"; } c = null; } else if (_viewModel.user.Address.CountryID > 0 && _viewModel.user.Address.Country != null) { _viewModel.BillingCountry = _viewModel.user.Address.Country.CountryName; } else { _viewModel.BillingCountry = "US"; } //End if (_viewModel.IsPayPal || _viewModel.ISCC || _viewModel.IsMoneybookers) { //if (_viewModel.IsPayPal && !string.IsNullOrEmpty(collection["txtPaypalID"]))-- if (_viewModel.IsPayPal) { _viewModel.PayPalID = !string.IsNullOrEmpty(Convert.ToString(collection["txtPaypalID"])) ? Convert.ToString(collection["txtPaypalID"]) : string.Empty; _viewModel.paymentmode = WBSSLStore.Domain.PaymentMode.PAYPAL; } else if (_viewModel.IsMoneybookers) { _viewModel.MoneybookersID = !string.IsNullOrEmpty(Convert.ToString(collection["txtMoneybookers"])) ? Convert.ToString(collection["txtMoneybookers"]) : string.Empty; _viewModel.paymentmode = WBSSLStore.Domain.PaymentMode.MONEYBOOKERS; } else if (_viewModel.IsPayPal) { ViewBag.ErrorMessage = WBSSLStore.Resources.ErrorMessage.Message.PaypalIdRequired; } else if (_viewModel.ISCC) { _viewModel.CCName = Convert.ToString(collection["txtNameOnCard"]); _viewModel.CCNumber = Convert.ToString(collection["txtCCNumber"]); _viewModel.CVV = Convert.ToString(collection["txtCCV"]); _viewModel.Month = Convert.ToInt32(collection["drpMonth"]); _viewModel.Year = Convert.ToInt32(collection["drpYear"]); _viewModel.paymentmode = WBSSLStore.Domain.PaymentMode.CC; } Message = _service.AddFund(_viewModel, Site); AddFundResponse objResponse = new AddFundResponse(); if (string.IsNullOrEmpty(Message)) { Host = currentsitesettings.USESSL ? "https://" : "http://" + (string.IsNullOrEmpty(currentsitesettings.CurrentSite.Alias) ? currentsitesettings.CurrentSite.CName : currentsitesettings.CurrentSite.Alias); if (currentsitesettings.IsRunWithWWW && !Host.Contains("www.")) { Host = currentsitesettings.USESSL ? "https://" : "http://" + Host.Replace(Host, "www." + Host); } else if (!currentsitesettings.IsRunWithWWW && Host.Contains("www.")) { Host = currentsitesettings.USESSL ? "https://" : "http://" + Host.Replace("www.", ""); } return(Redirect(Host + "/client/orders")); } else { ViewBag.ErrorMessage = Message; } } else { ViewBag.ErrorMessage = WBSSLStore.Resources.ErrorMessage.Message.NoGatewaySelected; } var PGInstance = _service.GetPGInstances(Site.ID); ViewBag.SiteID = Site.ID; PaymentGateways PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.AuthorizeNet).FirstOrDefault(); if (PG != null) { ViewBag.ISCC = true; } else { ViewBag.ISCC = false; } PG = null; PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.PayPalIPN).FirstOrDefault(); if (PG != null) { ViewBag.IsPayPal = true; } else { ViewBag.IsPayPal = false; } PG = null; return(View()); }