Exemplo n.º 1
0
        protected void btnYes_OnClick(object sender, EventArgs e)
        {
            //In case if use clicks back button and clicks yes again we need to redirect to a special page with some session expired text
            if (CurrentTemplateIndex < AllTemplates.Count)
            {
                Dictionary <int, int> skuAndQuantity = new Dictionary <int, int>();

                GetTemplateSelections(ref skuAndQuantity);

                PathManager pathManager     = new PathManager();
                Template    currentTemplate = pathManager.GetTemplate(AllTemplates[CurrentTemplateIndex]);

                currentTemplate.Process(CartContext.OrderId, CartContext.CartInfo, skuAndQuantity,
                                        (OrderProcessTypeEnum)CSFactory.OrderProcessCheck());

                GoToNextTemplate();
            }
            else
            {
                Response.Redirect("CheckoutExpired.aspx");
            }
        }
 private void GoToNextTemplate()
 {
     CurrentTemplateIndex++;
     if (CurrentTemplateIndex < AllTemplates.Count)
     {
         LoadTemplate(CurrentTemplateIndex);
     }
     else
     {
         //Set gift wrap items
         /////CSWebBase.OrderValues.SetGiftWrap(CartContext);
         //SriComments: Admin may setup path with empty templates: kevin business case
         //If Authorization is needed, use Server.Transfer("AuthorizeOrder.aspx"); instead of Response.Redirect("CheckoutThankYou.aspx");
         if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess)
         {
             Server.Transfer("AuthorizeOrder.aspx");//Response.Redirect("CheckoutThankYou.aspx");
         }
         else
         {
             Response.Redirect("ReviewOrder.aspx");
         }
     }
 }
        public void SaveData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            // attribute save example
            //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>();
            //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com"));
            if (clientData.OrderAttributeValues == null)
            {
                clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>();
            }
            clientData.OrderAttributeValues.Add("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now)));
            clientData.OrderAttributeValues.Add("cartabandonmentid", new CSBusiness.Attributes.AttributeValue(clientData.CartAbandonmentId.ToString()));


            //Recapture billing information if the user modified the information
            if (rId == 0)
            {
                if (Convert.ToBoolean(!cbBillingDifferent.Checked)) //override if the user select yes button
                {
                    Address shippingAddress = new Address();
                    shippingAddress.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                    shippingAddress.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                    shippingAddress.Address1        = CommonHelper.fixquotesAccents(txtShippingAddress1.Text);
                    shippingAddress.Address2        = CommonHelper.fixquotesAccents(txtShippingAddress2.Text);
                    shippingAddress.City            = CommonHelper.fixquotesAccents(txtShippingCity.Text);
                    shippingAddress.StateProvinceId = Convert.ToInt32(ddlShippingState.SelectedValue);
                    shippingAddress.CountryId       = Convert.ToInt32(ddlShippingCountry.SelectedValue);
                    shippingAddress.ZipPostalCode   = txtShippingZipCode.Text;

                    clientData.CustomerInfo.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                    clientData.CustomerInfo.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                    clientData.CustomerInfo.ShippingAddress = shippingAddress;
                }
            }

            SetShippingAddress();

            clientData.CartInfo.CartItems.Clear();
            clientData.CartInfo.ShippingAddress = clientData.CustomerInfo.ShippingAddress;
            int pid  = 104;
            int pid2 = 0;

            if (clientData.CustomerInfo.ShippingAddress.CountryId == 46) // Canada
            {
                pid2 = 108;
            }
            else if (clientData.CustomerInfo.ShippingAddress.CountryId == 231) //US
            {
                if (clientData.CustomerInfo.ShippingAddress.StateProvinceId == 1 ||
                    clientData.CustomerInfo.ShippingAddress.StateProvinceId == 389 ||
                    clientData.CustomerInfo.ShippingAddress.StateProvinceId == 388 ||
                    clientData.CustomerInfo.ShippingAddress.StateProvinceId == 11 ||
                    clientData.CustomerInfo.ShippingAddress.StateProvinceId == 390)
                {
                    pid2 = 108;
                }
            }
            //int qId = 1;
            clientData.CartInfo.AddOrUpdate(pid, 1, true, false, false);
            clientData.CartInfo.AddOrUpdate(107, 1, false, false, false);
            if (pid2 > 0)
            {
                clientData.CartInfo.AddOrUpdate(pid2, 1, false, false, false);
            }
            clientData.CartInfo.Compute();
//            Response.Redirect(string.Format("AddProduct.aspx?PId={0}&CId={1}&QId={2}&DId={3}",
//pid, Convert.ToString((int)CSBusiness.ShoppingManagement.ShoppingCartType.SingleCheckout), ddlQuantityList.SelectedValue, 50));

            PaymentInformation paymentDataInfo = new PaymentInformation();
            string             CardNumber      = txtCCNumber.Text;

            paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
            paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.SelectedValue);
            paymentDataInfo.CreditCardName    = ddlCCType.SelectedItem.Text;
            paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            paymentDataInfo.CreditCardCSC     = txtCvv.Text;

            CartContext.PaymentInfo = paymentDataInfo;



            int orderId = 0;

            if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess ||
                CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder)
            {
                //Save Order information before upsale process

                if (rId == 1)
                {
                    orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                }
                else
                {
                    //update order with modified customer shipping and billing and credit card information
                    orderId = clientData.OrderId;
                    CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                }

                if (orderId > 1)
                {
                    clientData.OrderId         = orderId;
                    Session["ClientOrderData"] = clientData;

                    if (rId == 1)
                    {
                        Response.Redirect("PostSale.aspx");
                    }
                    else
                    {
                        Response.Redirect("CardDecline.aspx");
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void SaveData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            // attribute save example
            //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>();
            //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com"));
            if (clientData.OrderAttributeValues == null)
            {
                clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>();
            }
            clientData.OrderAttributeValues.Add("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now)));
            clientData.OrderAttributeValues.Add("cartabandonmentid", new CSBusiness.Attributes.AttributeValue(clientData.CartAbandonmentId.ToString()));


            // TODO: active when attribue is created

            /*
             * if (clientData.OrderAttributeValues.ContainsKey("SendOffers"))
             * {
             *  clientData.OrderAttributeValues.Remove("SendOffers");
             * }
             * if (chkboxOffers.Checked)
             * {
             *  clientData.OrderAttributeValues.Add("SendOffers", new CSBusiness.Attributes.AttributeValue("1"));
             * }
             * else
             * {
             *  clientData.OrderAttributeValues.Add("SendOffers", new CSBusiness.Attributes.AttributeValue("0"));
             * }
             */

            //Recapture billing information if the user modified the information
            if (rId == 0)
            {
                if (Convert.ToBoolean(!cbBillingDifferent.Checked)) //override if the user select yes button
                {
                    Address billingAddress = new Address();
                    billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtBillingFirstName.Text);
                    billingAddress.LastName        = CommonHelper.fixquotesAccents(txtBillingLastName.Text);
                    billingAddress.Address1        = CommonHelper.fixquotesAccents(txtBillingAddress1.Text);
                    billingAddress.Address2        = CommonHelper.fixquotesAccents(txtBillingAddress2.Text);
                    billingAddress.City            = CommonHelper.fixquotesAccents(txtBillingCity.Text);
                    billingAddress.StateProvinceId = Convert.ToInt32(ddlBillingState.SelectedValue);
                    billingAddress.CountryId       = Convert.ToInt32(ddlBillingCountry.SelectedValue);
                    billingAddress.ZipPostalCode   = txtBillingZipCode.Text;

                    clientData.CustomerInfo.FirstName      = CommonHelper.fixquotesAccents(txtBillingFirstName.Text);
                    clientData.CustomerInfo.LastName       = CommonHelper.fixquotesAccents(txtBillingLastName.Text);
                    clientData.CustomerInfo.BillingAddress = billingAddress;

                    clientData.CartInfo.Compute();
                }
            }

            SetBillingAddress();

            PaymentInformation paymentDataInfo = new PaymentInformation();
            string             CardNumber      = txtCCNumber1.Text + txtCCNumber2.Text + txtCCNumber3.Text + txtCCNumber4.Text;

            paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
            paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.SelectedValue);
            paymentDataInfo.CreditCardName    = ddlCCType.SelectedItem.Text;
            paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            paymentDataInfo.CreditCardCSC     = txtCvv.Text;

            CartContext.PaymentInfo = paymentDataInfo;

            int orderId = 0;

            if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess ||
                CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder)
            {
                //Save Order information before upsale process

                if (rId == 1)
                {
                    orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                }
                else
                {
                    //update order with modified customer shipping and billing and credit card information
                    orderId = clientData.OrderId;
                    CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                }

                if (orderId > 1)
                {
                    clientData.OrderId         = orderId;
                    Session["ClientOrderData"] = clientData;

                    if (rId == 1)
                    {
                        Response.Redirect("PostSale.aspx");
                    }
                    else
                    {
                        Response.Redirect("CardDecline.aspx");
                    }
                }
            }
        }
Exemplo n.º 5
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            if (!Page.IsPostBack)
            {
                if (Session["PId"] != null)
                {
                    skuId = Convert.ToInt32(Session["PId"]);
                }

                if (Request.Params["CId"] != null)
                {
                    cId = Convert.ToInt32(Request.Params["CId"]);
                }

                if (Request.Params["DId"] != null)
                {
                    dId = Convert.ToInt32(Request.Params["DId"]);
                }

                if (Request.Params["QId"] != null)
                {
                    qId = Convert.ToInt32(Request.Params["QId"]);
                }

                if (skuId > 0)
                {
                    if (cId == (int)ShoppingCartType.SingleCheckout)
                    {
                        clientData = (ClientCartContext)Session["ClientOrderData"];
                        cartObject = new Cart();
                        cartObject.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }

                        cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress;
                        cartObject.Compute();
                        cartObject.ShowQuantity = false;
                        clientData.CartInfo     = cartObject;

                        if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess)
                        {
                            int orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                            UserSessions.InsertSessionEntry(Context, true, clientData.CartInfo.Total, clientData.CustomerInfo.CustomerId, orderId);

                            clientData.OrderId = orderId;
                            clientData.ResetData();
                            Session["ClientOrderData"] = clientData;
                        }

                        Response.Redirect("PostSale.aspx");
                    }
                    else if (cId == (int)ShoppingCartType.ShippingCreditCheckout)
                    {
                        clientData = (ClientCartContext)Session["ClientOrderData"];
                        cartObject = new Cart();
                        cartObject.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }
                        cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress;
                        cartObject.Compute();
                        cartObject.ShowQuantity    = false;
                        clientData.CartInfo        = cartObject;
                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("cart.aspx");
                    }

                    else
                    {
                        //we may set this object in index page to capture request information
                        if (Session["ClientOrderData"] == null)
                        {
                            clientData          = new ClientCartContext();
                            clientData.CartInfo = new Cart();
                        }
                        else
                        {
                            clientData = (ClientCartContext)Session["ClientOrderData"];
                            if (clientData.CartInfo == null)
                            {
                                clientData.CartInfo = new Cart();
                            }
                        }

                        clientData.CartInfo.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }
                        clientData.CartInfo.Compute();
                        clientData.CartInfo.ShowQuantity = false;

                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("Cart.aspx");
                    }
                }
            }
        }
Exemplo n.º 6
0
        public void SaveData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            // attribute save example
            //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>();
            //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com"));

            if (clientData.OrderAttributeValues == null)
            {
                clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>();
            }
            clientData.OrderAttributeValues.AddOrUpdateAttributeValue("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now)));
            //Recapture billing information if the user modified the information
            if (rId == 0)
            {
                if (cbBillingDifferent.Checked) //override if the user select yes button
                {
                    Address billingAddress = new Address();
                    billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                    billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                    billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Text);
                    billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                    billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Text);
                    billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                    billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                    billingAddress.ZipPostalCode   = txtZipCode.Text;

                    clientData.CustomerInfo.FirstName      = CommonHelper.fixquotesAccents(txtFirstName.Text);
                    clientData.CustomerInfo.LastName       = CommonHelper.fixquotesAccents(txtLastName.Text);
                    clientData.CustomerInfo.BillingAddress = billingAddress;
                }
            }

            SetBillingAddress();


            PaymentInformation paymentDataInfo = new PaymentInformation();
            string             CardNumber      = txtCCNumber.Text;

            paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
            paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.SelectedValue);
            paymentDataInfo.CreditCardName    = ddlCCType.SelectedItem.Text;
            paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            paymentDataInfo.CreditCardCSC     = txtCvv.Text;

            CartContext.PaymentInfo = paymentDataInfo;

            Session["ClientOrderData"] = clientData;


            ////// Prepaid Card OverLay //////

            int  cardNo    = Convert.ToInt32(CardNumber.Substring(0, 6));
            bool isPrepaid = CSWebBase.PrepaidCardDAL.IsPrepaidCard(cardNo);

            if (isPrepaid && OrderHelper.IsMainKit() && !OrderHelper.IsOnePay())
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "open_expire_soon();", true);
            }
            else
            {
                int orderId = 0;

                if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess ||
                    CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder ||
                    CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableUpsellReviewOrder)
                {
                    //Save Order information before upsale process

                    if (rId == 1)
                    {
                        orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                    }
                    else
                    {
                        //update order with modified customer shipping and billing and credit card information
                        orderId = clientData.OrderId;
                        CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                    }

                    if (orderId > 1)
                    {
                        clientData.OrderId         = orderId;
                        Session["ClientOrderData"] = clientData;

                        if (rId == 1)
                        {
                            Response.Redirect("PostSale.aspx");
                        }
                        else
                        {
                            Response.Redirect("CardDecline.aspx");
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        public void ReloadCartData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];


            if (OrderHelper.IsMainKit() && OrderHelper.IsOnePay())
            {
                int orderId = 0;

                if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess ||
                    CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder)
                {
                    //Save Order information before upsale process


                    orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);

                    if (orderId > 1)
                    {
                        clientData.OrderId         = orderId;
                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("PostSale.aspx");
                    }
                }
            }

            try
            {
                ddlCountry.ClearSelection();

                ddlState.ClearSelection();


                ddlCountry.Items.FindByValue(clientData.CustomerInfo.BillingAddress.CountryId.ToString()).Selected = true;
                ddlCountry.SelectedValue = clientData.CustomerInfo.BillingAddress.CountryId.ToString();

                BindRegions();


                ddlState.Items.FindByValue(clientData.CustomerInfo.BillingAddress.StateProvinceId.ToString()).Selected = true;



                //Payment information
                ddlCCType.SelectedValue = clientData.PaymentInfo.CreditCardType.ToString();
                string ccNumber = CommonHelper.Decrypt(clientData.PaymentInfo.CreditCardNumber);
                txtCCNumber.Text = ccNumber;


                txtCvv.Text = clientData.PaymentInfo.CreditCardCSC;
                DateTime expireDate = DateTime.MinValue;
                DateTime.TryParse(clientData.PaymentInfo.CreditCardExpired.ToString(), out expireDate);
                ddlExpMonth.Items.FindByValue(expireDate.Month.ToString()).Selected = true;
                ddlExpYear.Items.FindByValue(expireDate.Year.ToString()).Selected   = true;

                //Billing informarion
                txtFirstName.Text = clientData.CustomerInfo.BillingAddress.FirstName;
                txtLastName.Text  = clientData.CustomerInfo.BillingAddress.LastName;
                txtAddress1.Text  = clientData.CustomerInfo.BillingAddress.Address1;
                txtAddress2.Text  = clientData.CustomerInfo.BillingAddress.Address2;
                txtCity.Text      = clientData.CustomerInfo.BillingAddress.City;
                txtZipCode.Text   = clientData.CustomerInfo.BillingAddress.ZipPostalCode;
            }
            catch
            {
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["PId"] != null)
                {
                    skuId = Convert.ToInt32(Request.Params["PId"]);
                }

                if (Request.Params["CId"] != null)
                {
                    cId = Convert.ToInt32(Request.Params["CId"]);
                }

                if (Request.Params["DId"] != null)
                {
                    dId = Convert.ToInt32(Request.Params["DId"]);
                }

                if (Request.Params["QId"] != null)
                {
                    qId = Convert.ToInt32(Request.Params["QId"]);
                }

                if (skuId > 0)
                {
                    if (cId == (int)ShoppingCartType.SingleCheckout)
                    {
                        clientData = (ClientCartContext)Session["ClientOrderData"];
                        cartObject = clientData.CartInfo;
                        cartObject.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }

                        //CSWebBase.SiteBasePage.AddAdditionalItems(clientData.CartInfo);

                        cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress;
                        cartObject.Compute();
                        cartObject.ShowQuantity = false;
                        clientData.CartInfo     = cartObject;

                        if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess)
                        {
                            int orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);

                            clientData.OrderId = orderId;
                            //clientData.ResetData();

                            Session["ClientOrderData"] = clientData;
                        }

                        Response.Redirect("PostSale.aspx");

                        //Response.Redirect("AuthorizeOrder.aspx?card_check=1", true); // When we hit this page, we need to do a $1 test charge only to see if card is valid before going to postsale (upsells).
                    }
                    else if (cId == (int)ShoppingCartType.ShippingCreditCheckout)
                    {
                        clientData = (ClientCartContext)Session["ClientOrderData"];
                        cartObject = new Cart();
                        cartObject.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }
                        cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress;
                        cartObject.Compute();
                        cartObject.ShowQuantity    = false;
                        clientData.CartInfo        = cartObject;
                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("cart.aspx");
                    }

                    else
                    {
                        //we may set this object in index page to capture request information
                        if (Session["ClientOrderData"] == null)
                        {
                            clientData          = new ClientCartContext();
                            clientData.CartInfo = new Cart();
                        }
                        else
                        {
                            clientData = (ClientCartContext)Session["ClientOrderData"];
                            if (clientData.CartInfo == null)
                            {
                                clientData.CartInfo = new Cart();
                            }
                        }

                        clientData.CartInfo.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }
                        clientData.CartInfo.Compute();
                        clientData.CartInfo.ShowQuantity = false;

                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("ShoppingCartV4.aspx");
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["PId"] != null)
                {
                    skuId = Convert.ToInt32(Request.Params["PId"]);
                }

                if (Request.Params["CId"] != null)
                {
                    cId = Convert.ToInt32(Request.Params["CId"]);
                }

                if (Request.Params["DId"] != null)
                {
                    dId = Convert.ToInt32(Request.Params["DId"]);
                }

                if (Request.Params["QId"] != null)
                {
                    qId = Convert.ToInt32(Request.Params["QId"]);
                }

                if (skuId > 0)
                {
                    if (cId == (int)ShoppingCartType.SingleCheckout)
                    {
                        clientData = (ClientCartContext)Session["ClientOrderData"];
                        cartObject = new CSBusiness.ShoppingManagement.Cart();
                        cartObject.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }

                        cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress;
                        cartObject.Compute();
                        cartObject.ShowQuantity = false;
                        clientData.CartInfo     = cartObject;

                        //Sri Comment: OverrideSetting for Database configuration
                        if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess)
                        {
                            int orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                            if (orderId > 0)
                            {
                                //remove Customer Data and Payment Data in session object
                                clientData.ResetData();
                                clientData.OrderId         = orderId;
                                Session["ClientOrderData"] = clientData;
                            }
                            if (OrderHelper.AuthorizeOrder(orderId) == true)
                            {
                                Response.Redirect("CheckoutThankYou.aspx?oId=" + orderId);
                            }
                            else
                            {
                                Response.Redirect("CardDecline.aspx?failedAuth=1&orderID=" + orderId);
                            }

                            Response.Redirect("PostSale.aspx");
                        }
                    }
                    else if (cId == (int)ShoppingCartType.ShippingCreditCheckout)
                    {
                        clientData = (ClientCartContext)Session["ClientOrderData"];
                        cartObject = new CSBusiness.ShoppingManagement.Cart();
                        cartObject.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }
                        cartObject.ShippingAddress = clientData.CustomerInfo.BillingAddress;
                        cartObject.Compute();
                        cartObject.ShowQuantity    = false;
                        clientData.CartInfo        = cartObject;
                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("cart.aspx");
                    }

                    else
                    {
                        //we may set this object in index page to capture request information
                        if (Session["ClientOrderData"] == null)
                        {
                            clientData          = new ClientCartContext();
                            clientData.CartInfo = new CSBusiness.ShoppingManagement.Cart();
                        }
                        else
                        {
                            clientData = (ClientCartContext)Session["ClientOrderData"];
                            if (clientData.CartInfo == null)
                            {
                                clientData.CartInfo = new CSBusiness.ShoppingManagement.Cart();
                            }
                        }

                        clientData.CartInfo.AddItem(skuId, qId, true, false);
                        if (dId > 0)
                        {
                            bool settingVal = Convert.ToBoolean(ConfigHelper.ReadAppSetting("DisCountCardDisplay", "false"));
                            cartObject.AddItem(dId, qId, settingVal, false);
                        }
                        clientData.CartInfo.Compute();
                        clientData.CartInfo.ShowQuantity = false;

                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("cart.aspx");
                    }
                }
            }
        }