예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Missing Session
            if (Session["JSTurnedOn"] == null)
            {
                Response.Redirect("PEAUHErrorScreen.htm?missingsession=true", true);
            }
            //Other important checks - redirect to default page
            if (Request.QueryString["prodid"] == null)
            {
                Response.Redirect("PEAUHErrorScreen.htm?redirect=dispimage", true);
            }
            else if (Request.QueryString["prodid"].Length > 10)
            {
                Response.Redirect("PEAUHErrorScreen.htm?redirect=dispimage", true);
            }

            if (!Page.IsPostBack)
            {
                if (Request.QueryString["prodid"] != null)
                {
                    GlobalUtils.Utils UtilMethodClean = new GlobalUtils.Utils();
                    _prodid         = UtilMethodClean.Clean(Request.QueryString["prodid"].ToString());
                    UtilMethodClean = null;

                    ProductCollection pColl = DAL.DAL.GetProductbyProductIDWithRules(_prodid);

                    //Checking for a valid Product Id
                    if (pColl == null)
                    {
                        Response.Redirect("PEAUHErrorScreen.htm?redirect=dispimage", true);
                    }
                    else if (pColl.Pubs.Length == 0)
                    {
                        Response.Redirect("PEAUHErrorScreen.htm?redirect=dispimage", true);
                    }

                    Product p = pColl[0];

                    Image PubLargeImage = (Image)this.FindControl("PubLargeImage");
                    PubLargeImage.AlternateText = p.ShortTitle;
                    string imagepath = ConfigurationManager.AppSettings["PubLargeImagesURL"];
                    PubLargeImage.ImageUrl = imagepath + "/" + p.PubLargeImage;
                }
                else
                {
                    throw new ArgumentException("Missing parameter in dispimage.aspx", "value");
                }
            }
        }
예제 #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Missing Session
            //if (Session["JSTurnedOn"] == null)
            //    Response.Redirect("default.aspx?missingsession=true", true);

            //Just for the details page--allow users to come in directly
            if (Session["JSTurnedOn"] == null)
            {
                Session["JSTurnedOn"] = "True"; //Assuming JavaScript is enabled, by default.
                if (Session["NCIPL_Pubs"] == null)
                {
                    Session["NCIPL_Pubs"] = "";
                }
                if (Session["NCIPL_Qtys"] == null)
                {
                    Session["NCIPL_Qtys"] = "";
                }
                if (Session["PUBENT_SearchKeyword"] == null)
                {
                    Session["PUBENT_SearchKeyword"] = "";
                }
                if (Session["PUBENT_TypeOfCancer"] == null)
                {
                    Session["PUBENT_TypeOfCancer"] = "";
                }
                if (Session["PUBENT_Subject"] == null)
                {
                    Session["PUBENT_Subject"] = "";
                }
                if (Session["PUBENT_Audience"] == null)
                {
                    Session["PUBENT_Audience"] = "";
                }
                if (Session["PUBENT_ProductFormat"] == null)
                {
                    Session["PUBENT_ProductFormat"] = "";
                }
                if (Session["PUBENT_Language"] == null)
                {
                    Session["PUBENT_Language"] = "";
                }
                if (Session["PUBENT_StartsWith"] == null)
                {
                    Session["PUBENT_StartsWith"] = "";
                }
                if (Session["PUBENT_Series"] == null)
                {
                    Session["PUBENT_Series"] = ""; //Or collection
                }
                if (Session["PUBENT_NewOrUpdated"] == null)
                {
                    Session["PUBENT_NewOrUpdated"] = "";
                }
                if (Session["PUBENT_Race"] == null)
                {
                    Session["PUBENT_Race"] = "";
                }
                if (Session["PUBENT_CannedSearch"] == null)
                {
                    Session["PUBENT_CannedSearch"] = "";
                }
            }
            //End of code

            //Some more checks -- for HailStorm
            if (QuantityOrdered.Text.Length > 4)
            {
                Response.Redirect("default.aspx?redirect=detail1", true);
            }
            else if (PubQtyLimit.Text.Length > 5)
            {
                Response.Redirect("default.aspx?redirect=detail2", true);
            }
            else if (QuantityOrderedCover.Text.Length > 4)
            {
                Response.Redirect("default.aspx?redirect=detail3", true);
            }
            else if (CoverQtyLimit.Text.Length > 5)
            {
                Response.Redirect("default.aspx?redirect=detail4", true);
            }
            //End of HailStorm checks

            //Other important checks - redirect to default page
            if (Request.QueryString["prodid"] == null)
            {
                Response.Redirect("default.aspx?redirect=detail", true);
            }
            else if (Request.QueryString["prodid"].Length > 10)
            {
                Response.Redirect("default.aspx?redirect=detail", true);
            }

            if (!Page.IsPostBack)
            {
                //***EAC decided to use product ID instead on PUBID to dicourage users from guessing this param
                if (Request.QueryString["prodid"] != null)
                {
                    GlobalUtils.Utils UtilMethodClean = new GlobalUtils.Utils();
                    _prodid         = UtilMethodClean.Clean(Request.QueryString["prodid"].ToString());
                    UtilMethodClean = null;

                    ProductCollection pColl = DAL.DAL.GetProductbyProductIDWithRules(_prodid);
                    //Product p = Product.GetPubByProductID(Request.QueryString["prodid"].ToString());

                    //Checking for a valid Product Id
                    if (pColl == null)
                    {
                        Response.Redirect("default.aspx?redirect=detail", true);
                    }
                    else if (pColl.Pubs.Length == 0)
                    {
                        Response.Redirect("default.aspx?redirect=detail", true);
                    }

                    Product p = pColl[0];

                    lblTitle.Text    = p.LongTitle;
                    lblTitlesm.Text  = p.LongTitle;
                    lblFormat.Text   = p.Format;
                    lblFormatsm.Text = p.Format;
                    if (lblFormat.Text.Length <= 0)
                    {
                        lblFormatText.Visible = false; lblFormatTextsm.Visible = false;
                    }
                    lblNumPages.Text = p.NumPages;
                    if (lblNumPages.Text.Length <= 0)
                    {
                        lblNumPagesText.Visible = false;
                    }
                    //Image1.ImageUrl = "pubimages/" + p.PubImage;
                    lblAud.Text   = p.Audience;
                    lblAudsm.Text = p.Audience;
                    if (lblAud.Text.Length <= 0)
                    {
                        lblAudText.Visible = false; lblAudTextsm.Visible = false;
                    }
                    lblLang.Text = p.Language;
                    if (lblLang.Text.Length <= 0)
                    {
                        lblLangText.Visible = false;
                    }
                    //lblSumm.Text = p.Summary;
                    lblDesc.Text   = p.Abstract;
                    lblDescsm.Text = p.Abstract;
                    //if (lblDesc.Text.Length <= 0)
                    //lblDescText.Visible = false; //LSK no label for description


                    string LastUpdatedMon  = "";
                    string LastUpdatedDay  = "";
                    string LastUpdatedYear = "";
                    string LastUpdatedText = "";

                    LastUpdatedMon  = p.RevisedMonth;
                    LastUpdatedDay  = p.RevisedDay;
                    LastUpdatedYear = p.RevisedYear;

                    if (LastUpdatedMon.Length > 0 && LastUpdatedDay.Length > 0 && LastUpdatedYear.Length > 0)
                    {
                        LastUpdatedText = LastUpdatedMon + " " + LastUpdatedDay + ", " + LastUpdatedYear;
                    }
                    else if (LastUpdatedMon.Length > 0 && LastUpdatedYear.Length > 0)
                    {
                        LastUpdatedText = LastUpdatedMon + " " + LastUpdatedYear;
                    }
                    else if (LastUpdatedYear.Length > 0)
                    {
                        LastUpdatedText = LastUpdatedYear;
                    }
                    else
                    {
                        LastUpdatedText = "";
                    }

                    lblLastupd.Text = LastUpdatedText;
                    //lblLastupdText.Text = p.RevisedDateType;
                    lblLastupdText.Text = p.RevisedDateType.ToLower();

                    if (lblLastupd.Text.Length <= 0)
                    {
                        lblLastupdText.Visible = false;
                    }
                    lblProductID.Text   = p.ProductId;
                    lblProductIDsm.Text = p.ProductId;
                    if (lblProductID.Text.Length <= 0)
                    {
                        lblProductIDText.Visible = false; lblProductIDTextsm.Visible = false;
                    }
                    lblOrderLimit.Text = p.NumQtyLimit.ToString(); //HITT 8288
                    if (p.CanOrder == 0)                           //HITT 8288
                    {
                        lblOrderLimit.Visible     = false;
                        lblOrderLimitText.Visible = false;
                    }
                    lblNIH.Text   = p.NIHNum;
                    lblNIHsm.Text = p.NIHNum;
                    if (lblNIH.Text.Length <= 0)
                    {
                        lblNIHText.Visible = false; lblNIHTextsm.Visible = false;
                    }
                    //if (lblNIHText.Visible == true) //CR-10 HITT 9456
                    //{
                    //    if (p.NIHNum.Length > 7)
                    //        lblNIHText.Text = "NIH Number(s):&nbsp;";
                    //}
                    lblAwards.Text   = p.Awards;
                    lblAwardssm.Text = p.Awards;
                    //if (lblAwards.Text.Length > 0)
                    //    lblAwards.Text = p.Awards;
                    //lblAwardsText.Visible = false; //LSK no longer show awards label
                    if (p.PubImage.Length > 0)
                    {
                        panelThumbImg.Visible = true;
                        string imagepath = ConfigurationManager.AppSettings["PubImagesURL"];
                        //Image1.ImageUrl = "pubimages/" + p.PubImage;
                        Image1.ImageUrl      = imagepath + "/" + p.PubImage;
                        Image1.AlternateText = p.ShortTitle;
                        //Image3.AlternateText = p.ShortTitle;
                        if (p.PubLargeImage.Length > 0)
                        {
                            panelThumbImg.Visible = false;
                            panelLargeImg.Visible = true;
                            string lgimagepath = ConfigurationManager.AppSettings["PubLargeImagesURL"];
                            Image2.AlternateText = p.ShortTitle;
                            Image2.ImageUrl      = lgimagepath + "/" + p.PubLargeImage;
                            //Image3.AlternateText = p.ShortTitle;
                            //Image3.ImageUrl = lgimagepath + "/" + p.PubLargeImage;
                            //MagnifierLink.Visible = true;
                            //MagnifierLink.NavigateUrl = "dispimage.aspx?prodid=" + p.ProductId;
                        }
                    }

                    #region PATCH for Omniture order buttons (20130221)
                    if (Session["NCIPL_Pubs"] == null || Session["NCIPL_Pubs"].ToString() == "")
                    {
                        OrderPublication.Attributes.Add("prodid", p.ProductId);
                        OrderPublication.Attributes.Add("onclick", "NCIAnalytics.CartStarted(this.getAttribute('prodid'));");
                        OrderCover.Attributes.Add("prodid", p.ProductId + "C");
                        OrderCover.Attributes.Add("onclick", "NCIAnalytics.CartStarted(this.getAttribute('prodid'));");
                    }
                    #endregion

                    OrderPublication.CommandArgument = p.PubId.ToString();
                    OrderCover.CommandArgument       = p.PubIdCover;

                    if (p.CanView == 1)
                    {
                        //ReadOnlineLink.Visible = true;
                        //ReadOnlineLink.Target = "_blank";
                        //ReadOnlineLink.NavigateUrl = p.Url;

                        if (p.Url.Length > 0)
                        {
                            //textbreaker1.Visible = true;
                            HtmlLink.Visible       = true;
                            HtmlLink.NavigateUrl   = p.Url;
                            varHtmlLink            = p.Url;
                            HtmlLinksm.Visible     = true;
                            HtmlLinksm.NavigateUrl = p.Url;
                        }

                        if (p.PDFUrl.Length > 0)
                        {
                            //textbreaker2.Visible = true;
                            PdfLink.Visible       = true;
                            PdfLink.NavigateUrl   = p.PDFUrl;
                            PdfLinksm.Visible     = true;
                            PdfLinksm.NavigateUrl = p.PDFUrl;
                        }
                    }
                    #region SHOW EBOOK URLS IF ANY
                    string kindle = DAL2.DAL.EbookUrl(p.PubId, "kindle");
                    if (kindle.Length > 0)
                    {
                        KindleLink.Visible       = true;
                        KindleLink.NavigateUrl   = kindle;
                        KindleLinksm.Visible     = true;
                        KindleLinksm.NavigateUrl = kindle;
                    }

                    string epub = DAL2.DAL.EbookUrl(p.PubId, "epub");
                    if (epub.Length > 0)
                    {
                        EpubLink.Visible       = true;
                        EpubLink.NavigateUrl   = epub;
                        EpubLinksm.Visible     = true;
                        EpubLinksm.NavigateUrl = epub;
                    }
                    #endregion

                    if (p.OrderMsg.Length > 0)
                    {
                        //HITT 7445 labelOrderMsg.Visible = true;
                        labelOrderMsg.Text = p.OrderMsg;
                    }

                    if (p.CanOrder == 1)
                    {
                        OrderPublication.Visible = true;
                    }
                    else //HITT 10265
                    {
                        HiddenPopUpButton.Visible = false;
                        PubOrderPanel.Visible     = false;
                    }

                    if (p.CoverMsg.Length > 0)
                    {
                        //HITT 7445 labelCoverMsg.Visible = true;
                        labelCoverMsg.Text = p.CoverMsg;
                    }

                    if (p.CanOrderCover == 1)
                    {
                        OrderCover.Visible = true;
                    }
                    else //HITT 10265
                    {
                        HiddenCoverPopUpButton.Visible = false;
                        PubCoverOrderPanel.Visible     = false;
                    }

                    //Check whether this pub is already in cart
                    if (!IsItemInCart(p.PubId.ToString()))
                    {
                        OrderPublication.CommandArgument = p.PubId.ToString();

                        //OrderPublication.ImageUrl = "images/order_off.gif";
                        //OrderPublication.AlternateText = "Order Publication";
                        //OrderPublication.AlternateText = "Order";
                        OrderPublication.Text = "Order Publication";
                    }
                    else
                    {
                        OrderPublication.CommandArgument = "";
                        //OrderPublication.ImageUrl = "images/PublicationInYourCart_off.gif";
                        //OrderPublication.AlternateText = "Publication - In Your Cart";
                        OrderPublication.Text     = "Publication - In Your Cart";
                        OrderPublication.CssClass = "btn";
                    }

                    //Check whether this pub is already in cart
                    if (!IsItemInCart(p.PubIdCover.ToString()))
                    {
                        OrderCover.CommandArgument = p.PubIdCover.ToString();

                        //OrderCover.ImageUrl = "images/ordercovers_off.gif";
                        //CR 28 OrderCover.AlternateText = "Order Covers Only";
                        //OrderCover.AlternateText = "Order Covers";
                        OrderCover.Text = "Order Covers";
                    }
                    else
                    {
                        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";
                    }

                    //_pubid = DAL.DAL.GetPubIdFromProductId(Request.QueryString["prodid"]);
                    //_pubid = DAL.DAL.GetPubIdFromProductId(_prodid);
                    _pubid = p.PubId;


                    //Code for physical description
                    string Dimension = "";
                    string Color     = "";
                    string Other     = "";
                    //Get the physical description of the product from the database
                    IDataReader dr = DAL.DAL.GetPubPhysicalDesc(_pubid);
                    try
                    {
                        using (dr)
                        {
                            while (dr.Read())
                            {
                                Dimension = dr["DIMENSION"].ToString();
                                Color     = dr["COLOR"].ToString();
                                Other     = dr["OTHER"].ToString();
                            }
                        }
                    }
                    catch (Exception Ex)
                    {
                        //TO DO: log any error
                        if (!dr.IsClosed)
                        {
                            dr.Close();
                        }
                    }

                    //Assigning to label
                    string phydesc = "";
                    if (Dimension.Length > 0)
                    {
                        phydesc += Dimension + "; ";
                    }
                    if (Color.Length > 0)
                    {
                        phydesc += Color + "; ";
                    }
                    if (Other.Length > 0)
                    {
                        phydesc += Other + "; ";
                    }

                    char[] temparr = { ';', ' ' };

                    if (phydesc.Length > 2)
                    {
                        phydesc = phydesc.TrimEnd(temparr);
                    }

                    lblPhysicalDesc.Text = phydesc;

                    //if (lblPhysicalDesc.Text.Length <= 0)
                    //lblPhysicalDescText.Visible = false; //LSK label for physdesc no longer shown
                    //End code for physical description

                    //Get Collections that this pub belongs to
                    try
                    {
                        grdViewPubCollections.DataSource = DAL.DAL.GetPubCollections(_pubid);
                        grdViewPubCollections.DataBind();
                    }
                    catch (Exception Ex)
                    {
                        //Do nothing
                    }
                    if (grdViewPubCollections.Rows.Count > 0)
                    {
                        //Display singular label
                        lblPubCollections.Text = "part of the collection:&nbsp;";
                        if (grdViewPubCollections.Rows.Count > 1)
                        {
                            //Display plural label
                            lblPubCollections.Text = "part of the collections:&nbsp;";
                        }
                    }
                    else
                    {
                        lblPubCollections.Visible = false;
                    }
                    //End code for displaying the publication collection

                    //Begin code for Contents & Cover URL
                    if (p.UrlNerdo.Length > 0 && p.UrlCover.Length > 0)
                    {
                        NerdoContentsLink.Text        = "Print Contents";
                        NerdoContentsLink.NavigateUrl = p.UrlNerdo;
                        NerdoCoverLink.Text           = "Print Cover";
                        NerdoCoverLink.NavigateUrl    = p.UrlCover;
                    }
                    else
                    {
                        /* lblNerdo.Visible = false;*/
                        NerdoContentsLink.Visible = false;
                        /* lblNerdoSpace.Visible = false;*/
                        NerdoCoverLink.Visible = false;
                    }

                    ////Begin CR-30: HITT 8719 - Pub Translations
                    ////PlaceHolder plcTranslations = (PlaceHolder)e.Item.FindControl("plcTranslations");
                    //int counter = 0;
                    //Panel linksPanel = new Panel();
                    //foreach (Product tranlatedproduct in DAL.DAL.GetProductTranslations(p.PubId))
                    //{
                    //    HyperLink TranslationsLink = new HyperLink();
                    //    TranslationsLink.CssClass = "linkDefault";
                    //    TranslationsLink.Text = tranlatedproduct.Language;
                    //    TranslationsLink.NavigateUrl = "detail.aspx?prodid=" + tranlatedproduct.ProductId;
                    //    Label spaceLabel = new Label();
                    //    //if (counter > 0 && counter % 3 == 0)
                    //    //    spaceLabel.Text = "<br/>";
                    //    //else
                    //    spaceLabel.Text = "&nbsp;&nbsp;";
                    //    linksPanel.Controls.Add(TranslationsLink);
                    //    linksPanel.Controls.Add(spaceLabel);
                    //    TranslationsLink = null;
                    //    spaceLabel = null;
                    //    counter++;
                    //}
                    //if (counter > 0)
                    //{
                    //    //Label Translations = new Label();
                    //    //Translations.CssClass = "textDefault";
                    //    //Translations.Text = "Translations: ";
                    //    //linksPanel.Controls.AddAt(0, Translations);
                    //    //Translations = null;
                    //    plcTranslations.Controls.Add(linksPanel);
                    //}
                    //else
                    //    lblTranslations.Visible = false;
                    //linksPanel = null;
                    ////End CR-30

                    //Manage div heights here
                    //pnlTitleLabel.Height = pnlTitleText.Height;
                    //lblDescText.Height = lblDesc.Height;

                    //End of Code

                    //Add controls to the dynamic table here

                    //End code to add controls to dynamic table

                    if (Request.UrlReferrer != null)
                    {
                        hdnReferrer.Value = Request.UrlReferrer.ToString();
                    }
                    if (Session["JSTurnedOn"] != null && Request.UrlReferrer != null)
                    {
                        if (string.Compare(Session["JSTurnedOn"].ToString(), "True", true) == 0 &&
                            (this.Page.Request.UrlReferrer.ToString().Contains("searchres.aspx") || this.Page.Request.UrlReferrer.ToString().Contains("newupdated.aspx")))
                        {
                            //BackToSearchResultsLink.Visible = true;
                            lnkBtnSearchRes.Visible = true;
                        }
                    }
                }
                else
                {
                    throw new ArgumentException("Missing parameter in detail.aspx", "value");
                }


                PubOrderOK.OnClientClick      = String.Format("fnAddItemToCart('{0}','{1}')", PubOrderOK.UniqueID, "");
                PubCoverOrderOK.OnClientClick = String.Format("fnAddItemToCart('{0}','{1}')", PubCoverOrderOK.UniqueID, "");

                //Newly added code to reset textbox when cancel button is clicked on popup
                PubOrderCancel.OnClientClick      = String.Format("fnCancelClick('{0}')", QuantityOrdered.ClientID);
                PubCoverOrderCancel.OnClientClick = String.Format("fnCancelClick('{0}')", QuantityOrderedCover.ClientID);

                PubOrderLink.Attributes.Add("href", "javascript:fnPostBack(" + "'" + PubOrderOK.UniqueID + "','" + "','" + QuantityOrdered.ClientID + "','" + PubQtyLimit.ClientID + "','" + labelErrMsgPubOrder.ClientID + "','" + PubOrderModalPopup.BehaviorID + "')");
                PubCoverOrderLink.Attributes.Add("href", "javascript:fnPostBack(" + "'" + PubCoverOrderOK.UniqueID + "','" + "','" + QuantityOrderedCover.ClientID + "','" + CoverQtyLimit.ClientID + "','" + labelErrMsgPubCover.ClientID + "','" + PubCoverOrderModalPopup.BehaviorID + "')");


                dlistRelatedProducs.DataSource = (ProductCollection)DAL.DAL.GetRelatedProducts(_pubid);
                dlistRelatedProducs.DataBind();

                if (dlistRelatedProducs.Items.Count > 0)
                {
                    //Do not do anything
                }
                else
                {
                    divRelatedProducts.Visible = false;
                }

                //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;
            }

            #region Rebuild Dynamic Controls
            //Begin HITT - 9846 - Dynamic Controls need to re-initalized each time when the page posts back
            try
            {
                //Begin CR-30: HITT 8719 - Pub Translations
                _pubid = DAL.DAL.GetPubIdFromProductId(Request.QueryString["prodid"]);
                int   counter    = 0;
                Panel linksPanel = new Panel();
                foreach (Product tranlatedproduct in DAL.DAL.GetProductTranslations(_pubid))
                {
                    HyperLink TranslationsLink = new HyperLink();
                    TranslationsLink.CssClass    = "linkDefault";
                    TranslationsLink.Text        = tranlatedproduct.Language;
                    TranslationsLink.NavigateUrl = "detail.aspx?prodid=" + tranlatedproduct.ProductId;
                    Label spaceLabel = new Label();

                    spaceLabel.Text = "&nbsp;&nbsp;";
                    linksPanel.Controls.Add(TranslationsLink);
                    linksPanel.Controls.Add(spaceLabel);
                    TranslationsLink = null;
                    spaceLabel       = null;
                    counter++;
                }
                if (counter > 0)
                {
                    plcTranslations.Controls.Add(linksPanel);
                }
                else
                {
                    lblTranslations.Visible = false;
                }
                linksPanel = null;
                //End CR-30
            }
            catch (Exception Ex)
            {
                LogEntry logEnt     = new LogEntry();
                string   logmessage = "\r\n";
                logmessage    += "Translation Pubs Error on detail: " + "\r\n";
                logmessage    += Ex.Message + Ex.StackTrace;
                logEnt.Message = logmessage;
                Logger.Write(logEnt, "Logs");
            }
            //End HITT - 9846
            #endregion
        }
예제 #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //***EAC Check for CONFID
            if (Request.QueryString["ConfID"] == null)
            {
                throw new ArgumentException("Required parameter missing: ", "Conference ID");
            }
            conferenceid = Request.QueryString["ConfID"].ToString();

            //***EAC Check for PRODID
            if (Request.QueryString["prodid"] == null || Request.QueryString["prodid"].Length > 10)
            {
                throw new ArgumentException("Missing parameter in detail.aspx", "value");
            }

            //***EAC Check for location  (20130308)
            if (Session["KIOSK_ShipLocation"] == null || Session["KIOSK_ShipLocation"].ToString().Trim() == "")
            {
                Response.Redirect("location.aspx?ConfID=" + Request.QueryString["ConfID"].ToString() + "&prodid=" + Request.QueryString["prodid"], true);
            }


            //***EAC Hide ViewCart button or not...Better to do on PageLoad for each page than in Master.cs!
            if (Session["KIOSK_Qtys"].ToString() != "" || Session["KIOSK_Urls"].ToString() != "")
            {
                Master.FindControl("btnViewCart").Visible = true;
            }
            else
            {
                Master.FindControl("btnViewCart").Visible = false;
            }
            Master.FindControl("btnFinish").Visible       = false;
            Master.FindControl("lblFreePubsInfo").Visible = false;

            ContinueSearch.Attributes.Add("onmousedown", "this.src='images/continuered_on.jpg'");
            ContinueSearch.Attributes.Add("onmouseup", "this.src='images/continuered_off.jpg'");
            OrderPublication.Attributes.Add("onmousedown", "this.src='images/addtocart_on.jpg'");
            OrderPublication.Attributes.Add("onmouseup", "this.src='images/addtocart_off.jpg'");
            URLPublication.Attributes.Add("onmousedown", "this.src='images/addurl_on.jpg'");
            URLPublication.Attributes.Add("onmouseup", "this.src='images/addurl_off.jpg'");


            if (!Page.IsPostBack)
            {
                //***EAC decided to use product ID instead on PUBID to dicourage users from guessing this param
                if (Request.QueryString["prodid"] != null)
                {
                    GlobalUtils.Utils UtilMethodClean = new GlobalUtils.Utils();
                    _prodid         = UtilMethodClean.Clean(Request.QueryString["prodid"].ToString());
                    UtilMethodClean = null;

                    Product p = Product.GetPubByProductID(_prodid);

                    //Checking for a valid Product Id
                    if (p == null)
                    {
                        throw new ArgumentException("Unable to find product", "value");
                    }



                    //***EAC Everything checks out at this point...start populating fields

                    #region Load FLEXSLIDER with TOC images
                    flexslider = "<div class='flexslider'>  <ul class='slides'>";
                    try
                    {
                        string   tocUrl  = ConfigurationManager.AppSettings["TOCImageURL"];
                        string   tocpath = Server.MapPath(tocUrl);
                        string[] x       = System.IO.Directory.GetFiles(tocpath, _prodid + "_toc*.jpg");

                        //***EAC TODO: you may have to pre-load images if images are delayed

                        if (x.Count() > 0)
                        {
                            for (int i = 0; i < x.Count(); i++)
                            {
                                flexslider += "<li>      <img src='pubimages/kiosktocs/" + Path.GetFileName(x[i]) + "' />";
                            }
                        }
                        else
                        {
                            flexslider += "<li>      <img src='pubimages/kiosktocs/blank_toc.jpg' />";
                        }
                    }
                    catch (Exception myerr)
                    {
                        //do nothing..no images so what?!?  Just give them the text so they can still order using buttons
                    }
                    flexslider += "</ul></div>";
                    #endregion


                    lblTitle.Text  = p.LongTitle;
                    lblFormat.Text = p.Format;
                    if (lblFormat.Text.Length <= 0)
                    {
                        lblFormatText.Visible = false;
                    }
                    lblNumPages.Text = p.NumPages;
                    if (lblNumPages.Text.Length <= 0)
                    {
                        lblNumPagesText.Visible = false;
                    }

                    lblAud.Text = p.Audience;
                    if (lblAud.Text.Length <= 0)
                    {
                        lblAudText.Visible = false;
                    }
                    lblLang.Text = p.Language;
                    if (lblLang.Text.Length <= 0)
                    {
                        lblLangText.Visible = false;
                    }

                    lblDesc.Text = p.Abstract;
                    if (lblDesc.Text.Length <= 0)
                    {
                        lblDescText.Visible = false;
                    }


                    string LastUpdatedMon  = "";
                    string LastUpdatedDay  = "";
                    string LastUpdatedYear = "";
                    string LastUpdatedText = "";

                    LastUpdatedMon  = p.RevisedMonth;
                    LastUpdatedDay  = p.RevisedDay;
                    LastUpdatedYear = p.RevisedYear;

                    if (LastUpdatedMon.Length > 0 && LastUpdatedDay.Length > 0 && LastUpdatedYear.Length > 0)
                    {
                        LastUpdatedText = LastUpdatedMon + " " + LastUpdatedDay + ", " + LastUpdatedYear;
                    }
                    else if (LastUpdatedMon.Length > 0 && LastUpdatedYear.Length > 0)
                    {
                        LastUpdatedText = LastUpdatedMon + " " + LastUpdatedYear;
                    }
                    else if (LastUpdatedYear.Length > 0)
                    {
                        LastUpdatedText = LastUpdatedYear;
                    }
                    else
                    {
                        LastUpdatedText = "";
                    }

                    lblLastupd.Text     = LastUpdatedText;
                    lblLastupdText.Text = p.RevisedDateType;
                    if (lblLastupd.Text.Length <= 0)
                    {
                        lblLastupdText.Visible = false;
                    }
                    lblProductID.Text = p.ProductId;

                    lblNIH.Text = p.NIHNum;
                    if (lblNIH.Text.Length <= 0)
                    {
                        lblNIHText.Visible = false;
                    }
                    if (lblNIHText.Visible == true)
                    {
                        //if (p.NIHNum.Length > 7)
                        //    lblNIHText.Text = "NIH Number(s):&nbsp;";
                    }
                    string imagepath = ConfigurationManager.AppSettings["PubImagesURL"];

                    _pubid = p.PubId;


                    //Code for physical description
                    string Dimension = "";
                    string Color     = "";
                    string Other     = "";
                    //Get the physical description of the product from the database
                    IDataReader dr = DAL.DAL.GetPubPhysicalDesc(_pubid);
                    try
                    {
                        using (dr)
                        {
                            while (dr.Read())
                            {
                                Dimension = dr["DIMENSION"].ToString();
                                Color     = dr["COLOR"].ToString();
                                Other     = dr["OTHER"].ToString();
                            }
                        }
                    }
                    catch (Exception Ex)
                    {
                        //TO DO: log any error
                        if (!dr.IsClosed)
                        {
                            dr.Close();
                        }
                    }

                    //Assigning to label
                    string phydesc = "";
                    if (Dimension.Length > 0)
                    {
                        phydesc += Dimension + "; ";
                    }
                    if (Color.Length > 0)
                    {
                        phydesc += Color + "; ";
                    }
                    if (Other.Length > 0)
                    {
                        phydesc += Other + "; ";
                    }

                    char[] temparr = { ';', ' ' };

                    if (phydesc.Length > 2)
                    {
                        phydesc = phydesc.TrimEnd(temparr);
                    }

                    lblPhysicalDesc.Text = phydesc;

                    if (lblPhysicalDesc.Text.Length <= 0)
                    {
                        lblPhysicalDescText.Visible = false;
                    }

                    #region SHOW EBOOK URLS IF ANY
                    pnlHtmlPdf.Visible = false;
                    pnlKindle.Visible  = false;
                    pnlOther.Visible   = false;

                    string htmlpdf = DAL2.DAL.EbookUrl(p.PubId, "htmlpdf");
                    if (htmlpdf.Length > 0)
                    {
                        pnlHtmlPdf.Visible  = true;
                        imgHtmlPdf.ImageUrl = Server.HtmlDecode("https://chart.googleapis.com/chart?cht=qr&chs=120x120&chld=M&choe=UTF-8&chl=" + htmlpdf);
                    }

                    string kindle = DAL2.DAL.EbookUrl(p.PubId, "kindle");
                    if (kindle.Length > 0)
                    {
                        pnlKindle.Visible  = true;
                        imgKindle.ImageUrl = Server.HtmlDecode("https://chart.googleapis.com/chart?cht=qr&chs=120x120&chld=M&choe=UTF-8&chl=" + kindle);
                    }

                    string epub = DAL2.DAL.EbookUrl(p.PubId, "epub");
                    if (epub.Length > 0)
                    {
                        pnlOther.Visible  = true;
                        imgOther.ImageUrl = Server.HtmlDecode("https://chart.googleapis.com/chart?cht=qr&chs=120x120&chld=M&choe=UTF-8&chl=" + epub);
                    }
                    #endregion

                    //**EAC hide order/email buttons for now
                    OrderPublication.Visible = false;
                    URLPublication.Visible   = false;

                    if (p.OrderDisplayStatus.Contains("ORDER") && Session["KIOSK_ShipLocation"].ToString() == "Domestic" && p.NumQtyAvailable > 0)
                    {
                        //***EAC determine the image to use
                        OrderPublication.Visible  = true;
                        OrderPublication.ImageUrl = "images/addtocart_off.jpg";
                        OrderPublication.Enabled  = true;

                        //***EAC is item in cart?
                        if (IsItemInCart(p.PubId.ToString()))
                        {
                            OrderPublication.ImageUrl = "images/alreadyincart.jpg";
                            OrderPublication.Enabled  = false;
                        }

                        //***EAC limit reached
                        if (LimitReached())
                        {
                            OrderPublication.ImageUrl = "images/limitreached.jpg";
                            OrderPublication.Enabled  = false;
                        }
                    }
                    else if (p.OnlineDisplayStatus.Contains("ONLINE"))
                    {
                        URLPublication.Visible  = true;
                        URLPublication.ImageUrl = "images/addurl_off.jpg";
                        URLPublication.Enabled  = true;

                        //***EAC is item in cart?
                        if (IsItemInCart(p.PubId.ToString()))
                        {
                            URLPublication.ImageUrl = "images/alreadyincart.jpg";
                            URLPublication.Enabled  = false;
                        }

                        //***EAC limit reached
                        if (URLLimitReached())
                        {
                            URLPublication.ImageUrl = "images/limitreached.jpg";
                            URLPublication.Enabled  = false;
                        }
                    }
                }
                else
                {
                    throw new ArgumentException("Missing parameter in detail.aspx", "value");
                }
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ScanInputData();

            confid = Request.QueryString["ConfID"];

            //***EAC Hide ViewCart button or not...Better to do on PageLoad for each page than in Master.cs!
            if (Session["KIOSK_Qtys"].ToString() != "")
            {
                Master.FindControl("btnViewCart").Visible = true;
            }
            else
            {
                Master.FindControl("btnViewCart").Visible = false;
            }
            Master.FindControl("btnFinish").Visible = false;

            //Session["KIOSK_TypeOfCancer"] = "";
            //Session["KIOSK_Subject"] = "";
            //Session["KIOSK_Audience"] = "";
            //Session["KIOSK_ProductFormat"] = "";
            //Session["KIOSK_Series"] = ""; //Or collection
            //Session["KIOSK_Language"] = "";

            if (Request.QueryString["CancerType"] != null)
            {
                Session["KIOSK_TypeOfCancer"] = Request.QueryString["CancerType"];
            }
            if (Request.QueryString["Subject"] != null)
            {
                Session["KIOSK_Subject"] = Request.QueryString["Subject"];
            }
            if (Request.QueryString["Audience"] != null)
            {
                Session["KIOSK_Audience"] = Request.QueryString["Audience"];
            }
            if (Request.QueryString["ProductFormat"] != null)
            {
                Session["KIOSK_ProductFormat"] = Request.QueryString["ProductFormat"];
            }
            if (Request.QueryString["Series"] != null)
            {
                Session["KIOSK_Series"] = Request.QueryString["Series"];
            }
            if (Request.QueryString["Languages"] != null)
            {
                Session["KIOSK_Language"] = Request.QueryString["Languages"];
            }
            if (Request.QueryString["st"] != null)
            {
                PubEnt.GlobalUtils.Utils UtilMethodClean = new PubEnt.GlobalUtils.Utils();
                Session["KIOSK_Extratext"] = " for " + UtilMethodClean.Clean(Request.QueryString["st"]);
            }
            extratext = Session["KIOSK_Extratext"].ToString();

            if (!Page.IsPostBack)
            {
                Confs PubsList = new Confs();
                PubsList = PubEnt.DAL.DAL.GetSearchPubs(int.Parse(confid), Session["KIOSK_TypeOfCancer"].ToString(),
                                                        Session["KIOSK_Subject"].ToString(), Session["KIOSK_Audience"].ToString(),
                                                        Session["KIOSK_ProductFormat"].ToString(), Session["KIOSK_Series"].ToString(),
                                                        Session["KIOSK_Language"].ToString());

                string DirectoryPath = "pubimages/kioskimages/";
                string DirectoryName = Server.MapPath(DirectoryPath);
                rackjavascript      = "";
                rackImagejavascript = "";

                int i = 0;
                if (PubsList.Count > 0)
                {
                    foreach (Conf PubsListItem in PubsList)
                    {
                        //--- Validate large size publication image to see if it exists and not display if it is not.
                        rackjavascript += "rack[" + i.ToString() + "] = '" + PubsListItem.ConfName + "';";
                        if (PubEnt.GlobalUtils.Utils.SearchDirectory(PubsListItem.ConfName.Trim() + ".jpg", DirectoryName) >= 1)
                        {
                            rackImagejavascript += "rackImage[" + i.ToString() + "] = '" + DirectoryPath + PubsListItem.ConfName.Trim() + ".jpg';";
                        }
                        else
                        {
                            rackImagejavascript += "rackImage[" + i.ToString() + "] = '" + DirectoryPath + "blank.jpg';";
                        }
                        i++;
                    }
                }
            }
        }