コード例 #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"));
        }
コード例 #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));
        }