Exemple #1
0
        protected void PubCoverOrderOK_Click(object sender, EventArgs e)
        {
            if (!IsQtyValueValid(QuantityOrderedCover.Text, CoverQtyLimit.Text))
            {
                labelErrMsgPubCover.Text         = "Please enter a valid quantity.";
                UpdatePanelOrderCover.UpdateMode = UpdatePanelUpdateMode.Conditional;
                UpdatePanelOrderCover.Update();
                this.PubCoverOrderModalPopup.Show();
                return;
            }

            int qty = Int32.Parse(QuantityOrderedCover.Text);

            if (qty > 0)
            {
                if (!IsItemInCart(this.PubCoverOrderOK.CommandArgument.ToString())) //Check for browser re-load
                {
                    Session["NCIPL_Pubs"] += this.PubCoverOrderOK.CommandArgument.ToString() + ",";
                    Session["NCIPL_Qtys"] += qty + ",";
                }

                //Change the searh results listview here to show "In Cart" items
                //foreach (ListViewItem dItem in this.ListViewSearchResults.Items)
                //{
                //    if (dItem.ItemType == ListViewItemType.DataItem)
                //    {
                //        ImageButton OrderedCover = (ImageButton)dItem.FindControl("OrderCover");
                if (string.Compare(OrderCover.CommandArgument, PubCoverOrderOK.CommandArgument, true) == 0)
                {
                    OrderCover.CommandArgument = "";
                    //OrderCover.ImageUrl = "images/CoverOnlyInYourCart_off.gif";
                    //OrderCover.AlternateText = "Covers Only - In Your Cart";

                    OrderCover.Text     = "Covers Only - In Your Cart";
                    OrderCover.CssClass = "btn";
                }
                //    }
                //}

                //Display the master page tabs
                GlobalUtils.Utils UtilMethod = new GlobalUtils.Utils();
                if (Session["NCIPL_Pubs"] != null)
                {
                    Master.LiteralText = UtilMethod.GetTabHtmlMarkUp(Session["NCIPL_Qtys"].ToString(), "");
                }
                else
                {
                    Master.LiteralText = UtilMethod.GetTabHtmlMarkUp("", "");
                }
                UtilMethod = null;

                QuantityOrderedCover.Text = "1";         //Reset through code
                //BackToSearchResultsLink.Visible = false; //Do not show if pub was orded from details page
            }
            else
            {
                //dont do anything for now
            }
            //BackToSearchResultsLink.NavigateUrl = "javascript:history.go(-3);"; //Do not show once modal pop-up is displayed
        }
Exemple #2
0
        protected void DisplayModalPopUpCover(object sender, CommandEventArgs e)
        {
            if (e.CommandArgument.ToString().Length == 0)
            {
                Response.Redirect("cart.aspx", true);
                return;
            }

            if (string.Compare(Session["JSTurnedOn"].ToString(), "False") == 0)
            {
                //Add a default quantity of one to the shopping cart if JavaScript is not enabled
                if (!IsItemInCart(e.CommandArgument.ToString())) //Check for browser re-load
                {
                    Session["NCIPL_Pubs"] += e.CommandArgument.ToString() + ",";
                    Session["NCIPL_Qtys"] += "1" + ",";
                }

                ImageButton OrderedCover = (ImageButton)sender;
                OrderedCover.CommandArgument = "";
                OrderedCover.ImageUrl        = "images/CoverOnlyInYourCart_off.gif";
                OrderedCover.AlternateText   = "Covers Only - In Your Cart";

                //Display the master page tabs
                GlobalUtils.Utils UtilMethod = new GlobalUtils.Utils();
                if (Session["NCIPL_Pubs"] != null)
                {
                    Master.LiteralText = UtilMethod.GetTabHtmlMarkUp(Session["NCIPL_Qtys"].ToString(), "");
                }
                else
                {
                    Master.LiteralText = UtilMethod.GetTabHtmlMarkUp("", "");
                }
                UtilMethod = null;
            }
            else
            {
                this.PubCoverOrderOK.CommandArgument = e.CommandArgument.ToString();

                Product p = DAL.DAL.GetProductbyPubID(Convert.ToInt32(e.CommandArgument));
                labelCoverPubTitle.Text = p.LongTitle;
                CoverQtyLimit.Text      = p.NumQtyLimit.ToString(); //p.NumQtyAvailable.ToString();
                CoverLimitLabel.Text    = "Pack of 25 covers" + "     " + "Limit " + CoverQtyLimit.Text;

                //Get the content URL - TO DO, can be optimized later to use a stored procedure
                //that returns only one value.
                KVPairCollection kvpaircoll = DAL.DAL.GetKVPair("sp_NCIPL_getNerdoPubIdsURLS");;
                foreach (KVPair kvpair in kvpaircoll)
                {
                    if (string.Compare(kvpair.Key, p.PubId.ToString()) == 0)
                    {
                        linkCoverPubUrl.NavigateUrl = kvpair.Val;
                        break;
                    }
                }

                //Need to call update panel update to populate the values
                UpdatePanelOrderCover.UpdateMode = UpdatePanelUpdateMode.Conditional;
                UpdatePanelOrderCover.Update();

                //Show the Modal Popup
                this.PubCoverOrderModalPopup.Show();
                //BackToSearchResultsLink.NavigateUrl = "javascript:history.go(-2);"; //Do not show once modal pop-up is displayed
            }
        }