public ActionResult Three_99(FormCollection form, ShippingModels.ShippingAddress shipping)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            OrderProcess oProcess = new OrderProcess();
            CommonMethods oComm = new CommonMethods();
            OrderVariables oVariables = new OrderVariables();
            try
            {
                if (ModelState.IsValid == false)
                {
                    var message = string.Join("<br>", ModelState.Values
                        .SelectMany(v => v.Errors)
                        .Select(e => e.ErrorMessage));
                    ViewBag.ErrorMsg = message.ToString();
                    return View();
                }

                //var value = HttpContext.Request.Params.Get("vendorcode");
                //oVariables = oProcess.GetOfferAndPageDetails("seuss-winter-595-responsive");
                oVariables = oProcess.GetOfferAndPageDetails("fosina-elmo-399-secure");

                #region "Commented by Samrat_Globsyn @ 07.11.2016"
                //if ((string)Request.QueryString["vendorcode"] != null) { oVariables.vendor_id = (string)Request.QueryString["vendorcode"]; }
                //if ((string)Request.QueryString["key"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["key"]; }
                //if ((string)Request.QueryString["vc"] != null) { oVariables.vendor_id = (string)Request.QueryString["vc"]; }
                //if ((string)Request.QueryString["pc"] != null) { oVariables.promotion_code = (string)Request.QueryString["pc"]; }
                //if ((string)Request.QueryString["aff_id"] != null) { oVariables.vendor_data1 = (string)Request.QueryString["aff_id"]; } if ((string)Request.QueryString["tracking"] != null) { oVariables.vendor_cust_ref_id = (string)Request.QueryString["tracking"]; }
                //if ((string)Request.QueryString["src"] != null) { oVariables.pcode_pos_8 = (string)Request.QueryString["src"]; }
                //if ((string)Request.QueryString["seg"] != null) { oVariables.pcode_segment = (string)Request.QueryString["seg"]; } if ((string)Request.QueryString["aff_id2"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["aff_id2"]; }
                //oVariables.referring_url = System.Web.HttpContext.Current.Request.Url.ToString();
                #endregion

                var offerService = new OfferService();
                oVariables = offerService.MapQueryStringToOrderVariables(oVariables: oVariables);
                oVariables = ShippingModels.AssignShippingToOrderVariable(oVariables, shipping);

                //Submitting shipping details to order engin for order process
                //Code commented for passing to payment page.
                oVariables = oProcess.OrderSubmit(oVariables);
                if (oVariables != null)
                {
                    if (oVariables.order_id > 0)
                    {
                        Session.Add("NewOrderDetails", oVariables);
                        return RedirectToAction("Confirmation", "Home");
                    }
                    else
                    {
                        if (oVariables.err.Length >= 0)
                        {
                            // page_log += "Order is NOT processed. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                            if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                            {
                                //   page_log += "Order is NOT processed with Order Status X or F. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  Response.Redirect("../orderstatus.aspx" + oComm.GetURIString(), false);
                                // HttpContext.Current.ApplicationInstance.CompleteRequest();
                                Session.Add("NewOrderDetails", oVariables);
                                return RedirectToAction("orderstatus", "Home");
                            }
                            else if (oVariables.err.Length > 0)
                            {
                                //  page_log += "Order is NOT processed with an ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  lblErrorMsg.Text = oVariables.err;
                                //  oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                //  string error_msg = string.Empty;
                                //  error_msg = "alert('" + oVariables.err + "')";
                                //  ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true);
                                //oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                            else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                            {
                                //  page_log += "Order is NOT processed with NO ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                Session.Add("NewSBMDetails", oVariables);
                                //   Response.Redirect("../" + oVariables.redirect_page + oComm.GetURIString() + "&template=club", false);
                                //   HttpContext.Current.ApplicationInstance.CompleteRequest();
                                return RedirectToAction("Payment_399", "Elmo");
                            }
                            else
                            {
                                /* page_log += "Order is NOT processed with YES ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                 lblErrorMsg.Text = oVariables.err;
                                 oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                 string error_msg = string.Empty;
                                 error_msg = "alert('" + oVariables.err + "')";
                                 ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true); */

                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                        }
                    }
                }
                else
                {
                    //page_log += "Order is NOT processed, Order Process returned NULL.<br>";
                    Session["NewSBMDetails"] = null;
                    return RedirectToAction("orderstatus", "Home");
                }
                //ends Submitting shipping details to order engin for order process
                //Session["NewSBMDetails"] = oVariables;
                //Session["ShippingDetails"] = oVariables;
                //return RedirectToAction("Payment4_for_1", "Seuss");
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";
                CommonModels oCom = new CommonModels();
                string s = "";// oCom.LogBrowserCapabilities(Request.Browser);
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            return View();
        }
        public ActionResult Payment_399(FormCollection form, ShippingModels.BillingDetails billing)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();

            OrderVariables oVariables = new OrderVariables();
            OrderProcess oProcess = new OrderProcess();
            CommonModels oComm = new CommonModels();

            string cart_details, conf_pg_tac, total = "";
            string shipall = "false";
            string template = "";
            string pixel = "";

            if (!string.IsNullOrEmpty(billing.SecurityCaptch) && Session["rndtext"] != null)
            {
                string strCaptch = Session["rndtext"] as string;
                if (!strCaptch.Equals(billing.SecurityCaptch))
                {
                    ViewBag.ErrorMsg = "Invalid Security Captcha.";
                    //return View();
                }
            }
            else
            {
                //if (string.IsNullOrEmpty(billing.SecurityCaptch))
                //{
                ViewBag.ErrorMsg = "Security Captcha is required.";
                // return View();
                //}
            }

            if (Session["ShippingDetails"] != null)
                oVariables = Session["ShippingDetails"] as OrderVariables;

            try
            {
                if (Session["NewSBMDetails"] != null)
                {
                    oVariables = (OrderVariables)Session["NewSBMDetails"];

                    if (oVariables != null)
                    {
                        if (ViewBag.ErrorMsg != null && ViewBag.ErrorMsg != "")
                        {
                            //Setting values if page is getting back to the payment view only.
                            Dictionary<string, string> d = oComm.GetOfferCreatives(oVariables);
                            ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                            if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                            if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                            string cartId = oVariables.cart_id.ToString();
                            conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                            cart_details = oComm.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                            total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                            ViewBag.IsBonusSelected = false;
                            if (oVariables.bonus_option == true)
                            {
                                ViewBag.IsBonusSelected = true;
                            }
                            ViewBag.CartSummary = cart_details;
                            ViewBag.Cart = cartId;
                            ViewBag.Total = total;
                            ViewBag.ConfPgTAC = conf_pg_tac;

                            return View();
                        }

                        oVariables = ShippingModels.AssignBillingToOrderVariable(oVariables, billing);
                        oVariables = oProcess.OrderSubmit(oVariables);
                        if (oVariables != null)
                        {
                            if (oVariables.order_id > 0)
                            {
                                Session["NewSBMDetails"] = null;
                                Session.Add("NewOrderDetails", oVariables);
                                return RedirectToAction("Confirmation", "Home");
                            }
                            else
                            {
                                if (oVariables.err.Length > 0)
                                {
                                    if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                                    {
                                        Session["NewSBMDetails"] = null;
                                        Session.Add("NewOrderDetails", oVariables);
                                        return RedirectToAction("orderstatus", "Home");
                                    }
                                    else
                                    {
                                        Session.Add("NewSBMDetails", oVariables);
                                        ViewBag.ErrorMsg = oVariables.err;
                                        oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                    }
                                }
                                else if (oVariables.isSoftDeclined)
                                {
                                    Session["NewSBMDetails"] = null;
                                    return RedirectToAction("ThankYou", "home");
                                }
                                //Setting values if page is getting back to the payment view only.
                                Dictionary<string, string> d = oComm.GetOfferCreatives(oVariables);
                                ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                                if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                string cartId = oVariables.cart_id.ToString();
                                conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                cart_details = oComm.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                ViewBag.IsBonusSelected = false;
                                if (oVariables.bonus_option == true)
                                {
                                    ViewBag.IsBonusSelected = true;
                                }
                                ViewBag.CartSummary = cart_details;
                                ViewBag.Cart = cartId;
                                ViewBag.Total = total;
                                ViewBag.ConfPgTAC = conf_pg_tac;
                            }
                        }
                        else
                        {
                            return RedirectToAction("orderstatus", "Home");
                        }
                    }
                    return View();
                }
                else
                {
                    return RedirectToAction("Three_99", "Elmo", routeValues: ViewContextExtensions.OptionalParamters(Request.QueryString));
                }

            }
            catch (Exception ex)
            {
                oComm.SendEmail("Exception Raised in EM Landers Payment Page (Submit) - " + ex.Message.ToString());
                return View();
            }
            finally
            {
                oComm = null;
                oVariables = null;
                oProcess = null;
            }
        }
 public ActionResult Index(FormCollection form, ShippingModels.ShippingAddress shipping)
 {
     return RedirectToAction("Four_for_99", "Disney", new { email = shipping.ShippingEmail });
     //return View();
 }
        public ActionResult Four_for_99(FormCollection form, ShippingModels.ShoppingOrder shipping, string[] SelectedBooks)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();
            OrderProcess oProcess = new OrderProcess();
            CommonMethods oComm = new CommonMethods();
            OrderVariables oVariables = new OrderVariables();
            try
            {
                if (shipping.isBillingSameToShipping)
                {
                    shipping.BillingFirstName = shipping.ShippingFirstName;
                    shipping.BillingLastName = shipping.ShippingLastName;
                    shipping.BillingAddress1 = shipping.ShippingAddress1;
                    shipping.BillingCity = shipping.ShippingCity;
                    shipping.BillingZipCode = shipping.ShippingZipCode;
                    shipping.CCBillZipCode = shipping.BillingZipCode;
                }

                if (ModelState.IsValid == false)
                {
                    var message = string.Join("<br/>", ModelState.Values
                        .SelectMany(v => v.Errors)
                        .Select(e => e.ErrorMessage));
                    ViewBag.ErrorMsg = message.ToString();
                    return View();
                }

                oVariables = oProcess.GetOfferAndPageDetails("fosina-disney-4for99-secure");

                if ((string)Request.QueryString["vendorcode"] != null) { oVariables.vendor_id = (string)Request.QueryString["vendorcode"]; }
                if ((string)Request.QueryString["key"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["key"]; }
                if ((string)Request.QueryString["vc"] != null) { oVariables.vendor_id = (string)Request.QueryString["vc"]; }
                if ((string)Request.QueryString["pc"] != null) { oVariables.promotion_code = (string)Request.QueryString["pc"]; }
                if ((string)Request.QueryString["aff_id"] != null) { oVariables.vendor_data1 = (string)Request.QueryString["aff_id"]; } if ((string)Request.QueryString["tracking"] != null) { oVariables.vendor_cust_ref_id = (string)Request.QueryString["tracking"]; }
                if ((string)Request.QueryString["src"] != null) { oVariables.pcode_pos_8 = (string)Request.QueryString["src"]; }
                if ((string)Request.QueryString["seg"] != null) { oVariables.pcode_segment = (string)Request.QueryString["seg"]; } if ((string)Request.QueryString["aff_id2"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["aff_id2"]; }
                oVariables.referring_url = System.Web.HttpContext.Current.Request.Url.ToString();

                oVariables = ShippingModels.AssignShoppingDetailsToOrderVariable(oVariables, shipping);
                string choiceBooks = string.Join(",", SelectedBooks);

                if (!string.IsNullOrEmpty(choiceBooks))
                {
                    oVariables.has_shopping_Cart = true;
                    oVariables.shopping_cart_items = choiceBooks;
                }

                //Submitting shipping details to order engin for order process
                //Code commented for passing to payment page.
                oVariables = oProcess.OrderSubmit(oVariables);
                if (oVariables != null)
                {
                    if (oVariables.order_id > 0)
                    {
                        Session.Add("NewOrderDetails", oVariables);
                        return RedirectToAction("Confirmation", "Home");
                    }
                    else
                    {
                        if (oVariables.err.Length >= 0)
                        {
                            if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                            {
                                //   page_log += "Order is NOT processed with Order Status X or F. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  Response.Redirect("../orderstatus.aspx" + oComm.GetURIString(), false);
                                // HttpContext.Current.ApplicationInstance.CompleteRequest();
                                return RedirectToAction("orderstatus", "Home");
                            }
                            else if (oVariables.err.Length > 0)
                            {
                                //  page_log += "Order is NOT processed with an ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                //  lblErrorMsg.Text = oVariables.err;
                                //  oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                //  string error_msg = string.Empty;
                                //  error_msg = "alert('" + oVariables.err + "')";
                                //  ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true);
                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                            else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                            {
                                //  page_log += "Order is NOT processed with NO ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                Session.Add("NewSBMDetails", oVariables);
                                //   Response.Redirect("../" + oVariables.redirect_page + oComm.GetURIString() + "&template=club", false);
                                //   HttpContext.Current.ApplicationInstance.CompleteRequest();
                                return RedirectToAction("Payment4_for_99", "Disney");
                            }
                            else
                            {
                                /* page_log += "Order is NOT processed with YES ERROR. Error: " + oVariables.err + " | Status: " + oVariables.order_status + "<br>";
                                 lblErrorMsg.Text = oVariables.err;
                                 oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                 string error_msg = string.Empty;
                                 error_msg = "alert('" + oVariables.err + "')";
                                 ScriptManager.RegisterStartupScript(this, this.GetType(), "client_error", error_msg, true); */

                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                        }
                    }
                }
                else
                {
                    //page_log += "Order is NOT processed, Order Process returned NULL.<br>";
                    Session["NewSBMDetails"] = null;
                    return RedirectToAction("orderstatus", "Home");
                }
                //ends Submitting shipping details to order engin for order process
                //Session["NewSBMDetails"] = oVariables;
                //Session["ShippingDetails"] = oVariables;
                //return RedirectToAction("Payment4_for_1", "Seuss");
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";
                CommonModels oCom = new CommonModels();
                string s = "";// oCom.LogBrowserCapabilities(Request.Browser);
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            return View();
        }
        public ActionResult shipping(FormCollection form, ShippingModels.ShoppingOrder shipping)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();
            try
            {
                if (shipping.isBillingSameToShipping)
                {
                    shipping.BillingFirstName = shipping.ShippingFirstName;
                    shipping.BillingLastName = shipping.ShippingLastName;
                    shipping.BillingAddress1 = shipping.ShippingAddress1;
                    shipping.BillingCity = shipping.ShippingCity;
                    shipping.BillingZipCode = shipping.ShippingZipCode;
                    shipping.CCBillZipCode = shipping.BillingZipCode;
                }

                if (ModelState.IsValid == false)
                {
                    var message = string.Join("<br/>", ModelState.Values
                        .SelectMany(v => v.Errors)
                        .Select(e => e.ErrorMessage));
                    ViewBag.ErrorMsg = message.ToString();
                    return View();
                }

                oVariables = oProcess.GetOfferAndPageDetails("disney_tripwire");
                #region "Commented by Sri @ 04.12.2016"
                //if ((string)Request.QueryString["vendorcode"] != null) { oVariables.vendor_id = (string)Request.QueryString["vendorcode"]; }
                //if ((string)Request.QueryString["key"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["key"]; }
                //if ((string)Request.QueryString["vc"] != null) { oVariables.vendor_id = (string)Request.QueryString["vc"]; }
                //if ((string)Request.QueryString["pc"] != null) { oVariables.promotion_code = (string)Request.QueryString["pc"]; }
                //if ((string)Request.QueryString["aff_id"] != null) { oVariables.vendor_data1 = (string)Request.QueryString["aff_id"]; } if ((string)Request.QueryString["tracking"] != null) { oVariables.vendor_cust_ref_id = (string)Request.QueryString["tracking"]; }
                //if ((string)Request.QueryString["src"] != null) { oVariables.pcode_pos_8 = (string)Request.QueryString["src"]; }
                //if ((string)Request.QueryString["seg"] != null) { oVariables.pcode_segment = (string)Request.QueryString["seg"]; } if ((string)Request.QueryString["aff_id2"] != null) { oVariables.vendor_data2 = (string)Request.QueryString["aff_id2"]; }

                //// oVariables.referring_url = System.Web.HttpContext.Current.Request.Url.ToString();

                ////string queryStr = "";
                ////if (System.Web.HttpContext.Current.Request.UrlReferrer != null)
                ////{
                ////    queryStr = System.Web.HttpContext.Current.Request.UrlReferrer.Query;
                ////    string ref_url = System.Web.HttpContext.Current.Request.Url.ToString();
                ////    oVariables.referring_url = ref_url + queryStr;
                ////}
                //string ref_url = System.Web.HttpContext.Current.Request.Url.ToString();
                //oVariables.referring_url = ref_url;
                #endregion

                var offerService = new OfferService();
                oVariables = offerService.MapQueryStringToOrderVariables(oVariables: oVariables);

                oVariables = ShippingModels.AssignShoppingDetailsToOrderVariable(oVariables, shipping);

                oVariables.has_shopping_Cart = true;

                oVariables.pcode_pos_7 = "N";
                oVariables.order_Src = "EMS";

                //Submitting shipping details to order engin for order process
                //Code commented for passing to payment page.
                oVariables = oProcess.OrderSubmit(oVariables);
                if (oVariables != null)
                {
                    if (oVariables.order_id > 0)
                    {
                        oVariables.lastPageClientOn = "upsell_offer1";
                        Session.Add("NewOrderDetails", oVariables);
                        return RedirectToAction("upsell_offer1", "landers");
                    }
                    else
                    {
                        if (oVariables.err.Length >= 0)
                        {
                            if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                            {
                                Session.Add("NewOrderDetails", oVariables);
                                return RedirectToAction("orderstatus", "Home");
                            }
                            else if (oVariables.err.Length > 0)
                            {
                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                            else if (oVariables.isSoftDeclined)
                            {
                                Session["NewSBMDetails"] = null;
                                return RedirectToAction("ThankYou", "home");
                            }
                            else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                            {
                                Session.Add("NewSBMDetails", oVariables);
                                return View();
                                //return RedirectToAction("upsell_offer1", "landers");
                            }
                            else
                            {
                                ViewBag.ErrorMsg = oVariables.err;
                                oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                            }
                        }

                    }
                }
                else
                {
                    Session["NewSBMDetails"] = null;
                    return RedirectToAction("orderstatus", "Home");
                }
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";

                ViewBag.ErrorMsg = ex.Message.ToString();
                string s = "";
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                //return RedirectToAction("shipping", "landers", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            // return RedirectToAction("shipping", "landers", new { uniqueUri = Request.RequestContext.RouteData.Values["uniqueUri"] });
            return View();
        }
        public ActionResult four_for_1_spring2(string SubmitButton, FormCollection form, ShippingModels.ShippingBillingOrder shipping)
        {
            ViewData["StatesList"] = UtilitiesModels.GetStateNameList();
            ViewData["GenderList"] = UtilitiesModels.GetChildGenderNameList();
            ViewData["MonthList"] = UtilitiesModels.GetMonthNameList();
            ViewData["YearList"] = UtilitiesModels.GetCardExpiryYearList();
            OrderProcess oProcess = new OrderProcess();
            CommonMethods oComm = new CommonMethods();
            CommonModels oCom = new CommonModels();
            OrderVariables oVariables = new OrderVariables();
            string cart_details, conf_pg_tac, total = "";
            string shipall = "false";
            string template = "";
            string pixel = "";
            try
            {
                if (!string.IsNullOrEmpty(SubmitButton))
                {
                    switch (SubmitButton.ToLower())
                    {
                        case "rush my books":
                            oVariables = oProcess.GetOfferAndPageDetails("fosina-seuss-4for1-secure-activity");
                            shipping.stepNumber = 1;
                            var offerService = new OfferService();
                            oVariables = offerService.MapQueryStringToOrderVariables(oVariables: oVariables);
                            oVariables = ShippingModels.AssignShippingBillingToOrderVariables(oVariables, shipping);
                            oVariables = oProcess.OrderSubmit(oVariables);
                            if (oVariables != null)
                            {
                                if (oVariables.order_id > 0)
                                {
                                    Session.Add("NewOrderDetails", oVariables);
                                    if (oVariables.upsellId != 0)
                                    {
                                        Session["fireFaceBookConfirmationPixel"] = "false";
                                        return RedirectToAction("OrderDetails", "AdditionalOffers");
                                    }
                                    else
                                    {
                                        Session["fireFaceBookConfirmationPixel"] = "true";
                                        return RedirectToAction("Confirmation", "Home");
                                    }
                                }
                                else
                                {
                                    if (oVariables.err.Length >= 0)
                                    {
                                        if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                                        {
                                            Session.Add("NewOrderDetails", oVariables);
                                            return RedirectToAction("orderstatus", "Home");
                                        }
                                        else if (oVariables.err.Length > 0)
                                        {
                                            ViewBag.ErrorMsg = oVariables.err;
                                            oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                        }
                                        else if ((oVariables.order_status == "N") || (oVariables.redirect_page.Length > 0))
                                        {
                                            Session.Add("NewSBMDetails", oVariables);
                                            shipping.stepNumber = 2;
                                            #region LoadPaymentSection
                                            try
                                            {
                                                if (Session["NewSBMDetails"] != null)
                                                {
                                                    oVariables = (OrderVariables)Session["NewSBMDetails"];
                                                    Dictionary<string, string> d = oCom.GetOfferCreatives(oVariables);
                                                    ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                                                    if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                                    if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                                    string cartId = oVariables.cart_id.ToString();
                                                    conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                                    cart_details = oCom.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                                    total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                                    ViewBag.IsBonusSelected = false;
                                                    if (oVariables.bonus_option == true)
                                                    {
                                                        ViewBag.IsBonusSelected = true;
                                                    }
                                                    ViewBag.CartSummary = cart_details;
                                                    ViewBag.Cart = cartId;
                                                    ViewBag.Total = total;
                                                    ViewBag.ConfPgTAC = conf_pg_tac;
                                                    return View();
                                                }
                                                else
                                                {
                                                    return RedirectToAction("four_for_1_spring", "seuss", routeValues: ViewContextExtensions.OptionalParamters(Request.QueryString));
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                oCom.SendEmail("Exception Raised in EM Landers Payment Page - " + ex.Message.ToString());
                                                return View();
                                            }
                                            finally
                                            {
                                                oComm = null;
                                                oVariables = null;
                                            }
                                            #endregion
                                        }
                                        else
                                        {
                                            ViewBag.ErrorMsg = oVariables.err;
                                            oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                        }
                                    }
                                }
                            }
                            else
                            {
                                //page_log += "Order is NOT processed, Order Process returned NULL.<br>";
                                Session["NewSBMDetails"] = null;
                                return RedirectToAction("orderstatus", "Home");
                            }
                            break;

                        case "submit order":
                            #region Payment Submit
                            if (!string.IsNullOrEmpty(shipping.SecurityCaptch) && Session["rndtext"] != null)
                            {
                                string strCaptch = Session["rndtext"] as string;
                                if (!strCaptch.Equals(shipping.SecurityCaptch))
                                {
                                    ViewBag.ErrorMsg = "Invalid Security Captch.";
                                    // return View();
                                }
                            }
                            else
                            {
                                //if (string.IsNullOrEmpty(billing.SecurityCaptch))
                                //{
                                ViewBag.ErrorMsg = "Security Captch is required.";
                                // return View();
                                //}
                            }

                            if (Session["ShippingDetails"] != null)
                                oVariables = Session["ShippingDetails"] as OrderVariables;

                            try
                            {
                                if (Session["NewSBMDetails"] != null)
                                {
                                    oVariables = (OrderVariables)Session["NewSBMDetails"];

                                    if (oVariables != null)
                                    {
                                        if (ViewBag.ErrorMsg != null && ViewBag.ErrorMsg != "")
                                        {
                                            //Setting values if page is getting back to the payment view only.
                                            Dictionary<string, string> d = oCom.GetOfferCreatives(oVariables);
                                            ViewBag.HeaderImageSrc = oCom.GetDictionaryValue("payment_header", d);
                                            if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                            if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                            string cartId = oVariables.cart_id.ToString();
                                            conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                            cart_details = oCom.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                            total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                            ViewBag.IsBonusSelected = false;
                                            if (oVariables.bonus_option == true)
                                            {
                                                ViewBag.IsBonusSelected = true;
                                            }
                                            ViewBag.CartSummary = cart_details;
                                            ViewBag.Cart = cartId;
                                            ViewBag.Total = total;
                                            ViewBag.ConfPgTAC = conf_pg_tac;
                                            // billing.SecurityCaptch = "";
                                            // ViewData.Model = billing;
                                            //return View(ViewData.Model);
                                            return View();
                                        }

                                        shipping.stepNumber = 2;
                                        oVariables = ShippingModels.AssignShippingBillingToOrderVariables(oVariables, shipping);
                                        oVariables = oProcess.OrderSubmit(oVariables);
                                        if (oVariables != null)
                                        {
                                            if (oVariables.order_id > 0)
                                            {
                                                Session["NewSBMDetails"] = null;
                                                Session.Add("NewOrderDetails", oVariables);
                                                if (oVariables.upsellId != 0)
                                                {
                                                    Session["fireFaceBookConfirmationPixel"] = "false";
                                                    return RedirectToAction("OrderDetails", "AdditionalOffers");
                                                }
                                                else
                                                {
                                                    Session["fireFaceBookConfirmationPixel"] = "true";
                                                    return RedirectToAction("Confirmation", "Home");
                                                }
                                            }
                                            else
                                            {
                                                if (oVariables.err.Length > 0)
                                                {
                                                    if ((oVariables.order_status == "X") || (oVariables.order_status == "F"))
                                                    {
                                                        Session["NewSBMDetails"] = null;
                                                        Session.Add("NewOrderDetails", oVariables);
                                                        return RedirectToAction("orderstatus", "Home");
                                                    }
                                                    else
                                                    {
                                                        Session.Add("NewSBMDetails", oVariables);
                                                        ViewBag.ErrorMsg = oVariables.err;
                                                        oVariables.err = oVariables.err.Replace("<br>", "\\r\\n");
                                                    }
                                                }
                                                else if (oVariables.isSoftDeclined)
                                                {
                                                    Session["NewSBMDetails"] = null;
                                                    return RedirectToAction("ThankYou", "home");
                                                }
                                                //Setting values if page is getting back to the payment view only.
                                                Dictionary<string, string> d = oCom.GetOfferCreatives(oVariables);
                                                ViewBag.HeaderImageSrc = oComm.GetDictionaryValue("payment_header", d);
                                                if ((string)Request.QueryString["shipall"] != null) { shipall = (string)Request.QueryString["shipall"]; }
                                                if ((string)Request.QueryString["template"] != null) { template = (string)Request.QueryString["template"]; }
                                                string cartId = oVariables.cart_id.ToString();
                                                conf_pg_tac = oVariables.PageVars[0].conf_pg_tac;
                                                cart_details = oCom.ResponsivePayment_GiftingProducts(oVariables, Convert.ToBoolean(shipall), template);
                                                total = String.Format("{0:c}", oVariables.total_amt + oVariables.tax_amt + oVariables.total_sah);
                                                ViewBag.IsBonusSelected = false;
                                                if (oVariables.bonus_option == true)
                                                {
                                                    ViewBag.IsBonusSelected = true;
                                                }
                                                ViewBag.CartSummary = cart_details;
                                                ViewBag.Cart = cartId;
                                                ViewBag.Total = total;
                                                ViewBag.ConfPgTAC = conf_pg_tac;
                                            }
                                        }
                                        else
                                        {
                                            return RedirectToAction("orderstatus", "Home");
                                        }
                                    }
                                    return View();
                                }
                                else
                                {
                                    return RedirectToAction("four_for_1_spring2", "seuss", routeValues: ViewContextExtensions.OptionalParamters(Request.QueryString));
                                }

                            }
                            catch (Exception ex)
                            {
                                oCom.SendEmail("Exception Raised in EM Landers Payment Page (Submit) - " + ex.Message.ToString());
                                return View();
                            }
                            finally
                            {
                                oComm = null;
                                oVariables = null;
                                oProcess = null;
                            }
                            #endregion
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                string page_log = "Exception raised. Exception: " + ex.Message.ToString() + "<br>";
                string s = "";// oCom.LogBrowserCapabilities(Request.Browser);
                oCom.SendEmail(HttpContext.Request.Url.ToString() + "<br>ex.message = " + ex.Message.ToString() + "<br> Additional Information - " + page_log + ".<br> Browser Details....<br>" + s);
                return View();
            }
            finally
            {
                oVariables = null;
                oComm = null;
                oProcess = null;
            }
            return View();
        }
 public ActionResult CartDetails(ShippingModels.UpsellCartDetails upsell)
 {
     string myHiddenInput = upsell.selectedUpsells;
     return submitDetails("CartDetails", myHiddenInput);
 }