Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
            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);
            }
Exemplo n.º 4
0
        public ActionResult GetReferrersInfo()
        {
            UserDT user = UsersManager.GetUserByAspNetId(User.Identity.GetUserId());

            List <ReferrerInfoDT> sitesInfo = SitesManager.GetReferrersInfo();

            ViewBag.SitesInfo = sitesInfo;

            List <CustomerVM> model = new List <CustomerVM>();
            var todayDate           = DateTime.Now.Date;

            foreach (var customer in ReferrersManagers.GetCustomers(0, true).Where(x => x.CreatedAt >= todayDate))
            {
                string type = string.Empty;
                CustomersManager.GetLastFourDigitCreditCards(customer.Id, out type);

                model.Add(CustomerVM.TransformFromCustomerDT(customer, type));
            }

            return(View(model));
        }
Exemplo n.º 5
0
        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();
        }