public ActionResult FullForm(FullFormVM model) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; if (!ModelState.IsValid) { model.States = LocationsManager.GetStates(); return(View(model)); } int ncid = GetNcId(); int visitId = GetVisitId(); CustomerDT customer = new CustomerDT(); customer.SiteId = model.SiteId; customer.NcId = ncid; customer.Email = model.Email; customer.FirstName = model.FirstName; customer.LastName = model.LastName; customer.Address = model.Address; customer.City = model.City; customer.StateId = model.StateId; customer.ZipCode = model.ZipCode; CreditCardDT cc = new CreditCardDT(); cc.CardNumber = model.CardNumber; cc.CVV = model.CVV; cc.ExpDate = CreditCardHelper.GetExpDate(model.ExpMonth, model.ExpYear); CCType cardType = CCType.VISA; Enum.TryParse(model.CardType.ToString(), out cardType); cc.Type = cardType; var referrer = ReferrersManagers.GetReferrer(model.Referrer); try { customer = CustomersManager.NewCustomer(((SiteDT)ViewBag.Site), customer, cc, visitId, referrer.Id, false); } catch (Exception ex) { SendExceptionEmail(ex.ToString()); CastleClub.BusinessLogic.Utils.EventViewer.Writte("CastleClub", "CastleClubFrontend", ex.Message + "\n" + ex.ToString(), System.Diagnostics.EventLogEntryType.Error); } if (customer != null) { ViewBag.Customer = customer; } else { return(View("Error")); } return(View("Welcome")); }
public ActionResult FullForm() { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var model = new FullFormVM(); model.SiteId = ((SiteDT)ViewBag.Site).Id; model.States = LocationsManager.GetStates(); var referrerDT = ReferrersManagers.GetReferrer(Request.QueryString["s"] != null ? Request.QueryString["s"] : "LF113B3N").GetDT(); Hashtable ht = new Hashtable(); try { ht = EncryptionHelper.Unpack(EncryptionHelper.Decrypt(Request.QueryString["t"].ToString(), referrerDT.SiteKey)); } catch (Exception ex) { SendExceptionEmail(ex.ToString()); } string customerId = String.Empty; string cctype = string.Empty; if (ht.ContainsKey("CustomerID")) { customerId = ht["CustomerID"].ToString(); string data = string.Empty; data = CustomersManager.RequestToPartsGeek(referrerDT, customerId); if (!(string.IsNullOrEmpty(data) || (data.ToLower() == "not found"))) { var customerHash = EncryptionHelper.Unpack(EncryptionHelper.Decrypt(data, referrerDT.SiteKey)); if (customerHash != null) { model.SiteId = ((SiteDT)ViewBag.Site).Id; model.Email = customerHash["Email"] != null ? customerHash["Email"].ToString() : ""; model.FirstName = customerHash["FirstName"] != null ? customerHash["FirstName"].ToString():""; model.LastName = customerHash["LastName"] != null ? customerHash["LastName"].ToString():""; //model. .Phone = this.customerHash["Phone"].ToString(); model.Address = customerHash["Address1"] != null ? customerHash["Address1"].ToString():""; model.City = customerHash["City"] != null ? customerHash["City"].ToString():""; model.StateId = customerHash["State"] != null ? customerHash["State"].ToString():""; model.ZipCode = customerHash["Zip"] != null ? customerHash["Zip"].ToString() : ""; cctype = customerHash["CCType"] != null ? customerHash["CCType"].ToString() : ""; model.SelCCType = cctype; } } } AddVisit(((SiteDT)ViewBag.Site).Id, Request.QueryString.ToString(), cctype); model.Referrer = string.IsNullOrEmpty(Request.QueryString["s"]) ? "LF113B3N" : Request.QueryString["s"]; return(View(model)); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { SiteDT site = SitesManager.GetSiteFromHostname(filterContext.HttpContext.Request.Url.Host); filterContext.Controller.ViewBag.Site = site; if (filterContext.HttpContext.Request.QueryString.AllKeys.Contains("s")) { filterContext.Controller.ViewBag.Referrer = ReferrersManagers.GetReferrer(filterContext.HttpContext.Request.QueryString["s"]).Name; } else { filterContext.Controller.ViewBag.Referrer = "PartsGeek.com"; } base.OnActionExecuting(filterContext); }
public ActionResult EmailForm(EmailFormVM model) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; if (!ModelState.IsValid) { return(View(model)); } if (Request.QueryString.AllKeys.Contains("s") && Request.QueryString.AllKeys.Contains("t")) { string siteIdentifier = Request.QueryString.GetValues("s").FirstOrDefault(); var referrer = ReferrersManagers.GetReferrer(siteIdentifier); int ncid = GetNcId(); int visitId = GetVisitId(); string email = model.Email; string token = Request.QueryString.GetValues("t").FirstOrDefault(); CustomerDT customer = null; try { customer = CustomersManager.NewCustomer(((SiteDT)ViewBag.Site), email, token, ncid, visitId, referrer.GetDT()); ViewBag.Customer = customer; } catch (Exception ex) { SendExceptionEmail(ex.ToString()); } if (customer != null) { return(View("Welcome")); } else { return(View("Error")); } } throw new Exception(); }