//BEGIN COPIED CODE######################################### //Server Side Event to call the Modal Popup Extender (Shopping Cart) //Or call method to add a single item to Shopping Cart if JavaScript is turned off protected void DisplayModalPopUp(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 OrderedPub = (ImageButton)sender; OrderedPub.CommandArgument = ""; OrderedPub.ImageUrl = "images/PublicationInYourCart_off.gif"; OrderedPub.AlternateText = "Publication - 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.PubOrderOK.CommandArgument = e.CommandArgument.ToString(); Product p = DAL.DAL.GetProductbyPubID(Convert.ToInt32(e.CommandArgument)); labelPubTitle.Text = p.LongTitle; PubQtyLimit.Text = p.NumQtyLimit.ToString(); PubLimitLabel.Text = "Limit " + PubQtyLimit.Text; //Need to call update panel update to populate the values UpdatePanelOrderPub.UpdateMode = UpdatePanelUpdateMode.Conditional; UpdatePanelOrderPub.Update(); //Show the Modal Popup this.PubOrderModalPopup.Show(); //BackToSearchResultsLink.NavigateUrl = "javascript:history.go(-2);"; //Do not show once modal pop-up is displayed } }
protected void PubOrderOK_Click(object sender, EventArgs e) { if (!IsQtyValueValid(QuantityOrdered.Text, PubQtyLimit.Text)) { labelErrMsgPubOrder.Text = "Please enter a valid quantity."; UpdatePanelOrderPub.UpdateMode = UpdatePanelUpdateMode.Conditional; UpdatePanelOrderPub.Update(); this.PubOrderModalPopup.Show(); return; } int qty = Int32.Parse(QuantityOrdered.Text); if (qty > 0) { if (!IsItemInCart(this.PubOrderOK.CommandArgument.ToString())) //Check for browser re-load { Session["NCIPL_Pubs"] += this.PubOrderOK.CommandArgument.ToString() + ","; Session["NCIPL_Qtys"] += qty + ","; } //Change the searh results list view here to show "In Cart" items //foreach (ListViewItem dItem in this.ListViewSearchResults.Items) //{ // if (dItem.ItemType == ListViewItemType.DataItem) // { // ImageButton OrderedPub = (ImageButton)dItem.FindControl("OrderPublication"); if (string.Compare(OrderPublication.CommandArgument, PubOrderOK.CommandArgument, true) == 0) { OrderPublication.CommandArgument = ""; //OrderPublication.ImageUrl = "images/PublicationInYourCart_off.gif"; //OrderPublication.AlternateText = "Publication - In Your Cart"; OrderPublication.Text = "Publication - In Your Cart"; OrderPublication.CssClass = "btn"; } #region EAC remove omniture code from the 2 buttons(20130221) OrderPublication.Attributes.Remove("onclick"); OrderCover.Attributes.Remove("onclick"); #endregion // } //} //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; QuantityOrdered.Text = "1"; //Reset through code } else { //dont do anything for now } //BackToSearchResultsLink.NavigateUrl = "javascript:history.go(-3);"; //Do not show once modal pop-up is displayed }