Пример #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            GeneticProfessional gp = new GeneticProfessional();
            DataSet             dbSet;

            dbSet = gp.GetSearchFormMasterData();

            selState.DataSource     = dbSet.Tables["States"];
            selState.DataTextField  = "Name";
            selState.DataValueField = "StateAbbr";
            selState.DataBind();
            selState.Items.Insert(0, new System.Web.UI.WebControls.ListItem("all states", "all states;default"));
            Functions.EncodeHtmlSelectValues(selState, e);

            selCancerFamily.DataSource     = dbSet.Tables["CancerFamily"];
            selCancerFamily.DataTextField  = "FamilyCancerSyndrome";
            selCancerFamily.DataValueField = "Value";
            selCancerFamily.DataBind();
            selCancerFamily.Items.Insert(0, new System.Web.UI.WebControls.ListItem("all", "all;default"));
            Functions.EncodeHtmlSelectValues(selCancerFamily, e);

            selCancerType.DataSource     = dbSet.Tables["CancerType"];
            selCancerType.DataTextField  = "CancerTypeSite";
            selCancerType.DataValueField = "Type";
            selCancerType.DataBind();
            selCancerType.Items.Insert(0, new System.Web.UI.WebControls.ListItem("all types", "all types;default"));
            Functions.EncodeHtmlSelectValues(selCancerType, e);

            selCountry.DataSource     = dbSet.Tables["Country"];
            selCountry.DataTextField  = "Country";
            selCountry.DataValueField = "Country";
            selCountry.DataBind();
            selCountry.Items.Insert(0, new System.Web.UI.WebControls.ListItem("all countries", "all countries;default"));
            Functions.EncodeHtmlSelectValues(selCountry, e);

            if (dbSet != null)
            {
                dbSet.Dispose();
            }

            if (WebAnalyticsOptions.IsEnabled)
            {
                // Add page name to analytics
                this.PageInstruction.SetWebAnalytics(WebAnalyticsOptions.eVars.evar1, wbField =>
                {
                    wbField.Value = ConfigurationManager.AppSettings["HostName"] + SearchPageInfo.SearchResultsPrettyUrl;
                });
            }
        }
        /// <summary>
        /// Event method sets content version and template and user control properties<br/>
        /// <br/>
        /// [1] Uses input parameter, personid (comma-delimited intIds or recnum;intId pairs), to <br/>
        ///     identify instance of template<br/>
        /// [2] Uses usp_GetGeneticProfessional to pull professional summary data<br/>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            string args = Strings.Clean(Request.Params["personid"]);

            if (args != null)
            {
                string[]            personids = args.Split(',');
                GeneticProfessional geneticPro;
                String geneticProHtml;

                foreach (string id in personids)
                {
                    if (Strings.Clean(id) != null)
                    {
                        geneticPro     = new GeneticProfessional(id);
                        geneticProHtml = geneticPro.GetHtml(Server.MapPath("/Stylesheets"));
                        geneticProHtml = geneticProHtml.Replace("/search/search_geneticsservices.aspx", SearchPageInfo.SearchPagePrettyUrl);
                        geneticProHtml = geneticProHtml.Replace("<GeneticsProfessional>", "");
                        geneticProHtml = geneticProHtml.Replace("</GeneticsProfessional>", "");

                        content += "<li><div class='result'>" + geneticProHtml + "</div></li>";
                    }
                }

                if (Strings.Clean(content) == null)
                {
                    content = "The cancer genetic professional(s) you selected was not found.";
                }
                else
                {
                    // wrap in ul element
                    content = "<div class='slot-item'><div class='results'><ul class='no-bullets'>" + content + "</ul></div></div>";
                }
            }
            else
            {
                content = "No genetic professional(s) were selected.";
            }

            string pagePrintUrl = PageAssemblyContext.Current.requestedUrl + "?personid=" + args + "&print=1";

            PageAssemblyContext.Current.PageAssemblyInstruction.AddUrlFilter("Print", (name, url) =>
            {
                url.SetUrl(pagePrintUrl);
            });

            //Web Analytics
            if (WebAnalyticsOptions.IsEnabled)
            {
                // Add page name to analytics
                this.PageInstruction.SetWebAnalytics(WebAnalyticsOptions.eVars.evar1, wbField =>
                {
                    wbField.Value = ConfigurationManager.AppSettings["HostName"] + SearchPageInfo.SearchResultsPrettyUrl;
                });
                //End of Web Anlytics
            }

            this.PageInstruction.AddUrlFilter(PageAssemblyInstructionUrls.CanonicalUrl, (name, url) =>
            {
                string localUrl = url.ToString();

                if (args != "")
                {
                    localUrl += "?personid=" + args;
                }

                url.SetUrl(localUrl);
            });
        }
Пример #3
0
        /// <summary>
        /// Event method sets content version and templates and user control properties<br/>
        /// <br/>
        /// [1] Input parameters:<br/>
        ///			selCancerType {* name(string);value(integer), comma-delimited : genetic professional cancer type names and identifiers},<br/>
        ///			selCancerFamily {* string, comma-delimited: cancer family search parameters},<br/>
        ///			txtCity {string: city search parameter},<br/>
        ///			selState {* string, comma-delimited: postal abbreviations},<br/>
        ///			selCountry {string: country names},<br/>
        ///			txtLastName {string: last name search parameter},<br/>
        ///			selectedPage {integer: indicates page view to display}<br/>
        ///	[2] Uses usp_GetCancerGeneticProfessionals to get results table<br/>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        ///

        protected override void OnLoad(EventArgs e)
        {
            NameValueCollection postedValues = Request.Form;
            String nextKey;

            for (int i = 0; i < postedValues.AllKeys.Length; i++)
            {
                nextKey = postedValues.AllKeys[i];
                if (nextKey.Substring(0, 2) != "__")
                {
                    if (nextKey.Contains("selCancerType"))
                    {
                        CancerType = postedValues[i];
                    }
                    else if (nextKey.Contains("selCancerFamily"))
                    {
                        CancerFamily = postedValues[i];
                    }
                    else if (nextKey.Contains("selState"))
                    {
                        State = postedValues[i];
                    }

                    else if (nextKey.Contains("selCountry"))
                    {
                        Country = postedValues[i];
                    }
                }
            }


            base.OnLoad(e);
            string city     = Request.Form["txtCity"];
            string lastName = Request.Form["txtLastName"];

            GeneticProfessional gp = new GeneticProfessional();
            DataTable           dbTable;

            dbTable = gp.GetCancerGeneticProfessionals(CancerType, CancerFamily, city, State, Country, lastName);

            resultCount = dbTable.Rows.Count.ToString();

            searchSummary = BuildSearchSummary(Functions.ParseNameValue(CancerType, 0).Replace(",", ", "), Functions.ParseNameValue(CancerFamily, 0).Replace(",", ", "), lastName, city, Functions.ParseNameValue(State, 0).Replace(",", ", "), Functions.ParseNameValue(Country, 0), resultCount);

            if (resultCount == "0")
            {
                resultLabel         = "Results: 0 - 0 of " + resultCount;
                this.submit.Visible = false;
                resultGrid.Visible  = false;
            }
            else
            {
                int selectedPage = Strings.ToInt(Request.Form["selectedPage"], 0);
                selectedPage = selectedPage <= 0 ? 1 : selectedPage;

                firstRec = selectedPage;
                lastRec  = (selectedPage + (recordsPerPage - 1)) < Convert.ToInt32(resultCount) ? (selectedPage + (recordsPerPage - 1)) : Convert.ToInt32(resultCount);

                ResultsGeneticServicesPager objPager = new ResultsGeneticServicesPager();
                objPager.CurrentPage    = (selectedPage / recordsPerPage) + ((selectedPage % recordsPerPage) > 0 ? 1 : 0);
                objPager.RecordCount    = Convert.ToInt32(resultCount);
                objPager.RecordsPerPage = recordsPerPage;
                objPager.ShowPages      = 2;
                ulPager.Text            = objPager.RenderPager();

                DataTable resultPage = dbTable.Clone();
                for (int i = firstRec - 1; i < lastRec; i++)
                {
                    resultPage.ImportRow(dbTable.Rows[i]);
                }

                resultLabel           = "Results: " + firstRec.ToString() + " - " + lastRec.ToString() + " of " + resultCount;
                resultGrid.Visible    = true;
                resultGrid.DataSource = resultPage;
                resultGrid.DataBind();

                if (resultPage != null)
                {
                    resultPage.Dispose();
                }
            }

            if (dbTable != null)
            {
                dbTable.Dispose();
            }

            if (WebAnalyticsOptions.IsEnabled)
            {
                // Add page name to analytics
                this.PageInstruction.SetWebAnalytics(WebAnalyticsOptions.eVars.evar1, wbField =>
                {
                    wbField.Value = ConfigurationManager.AppSettings["HostName"] + SearchPageInfo.DetailedViewSearchResultPagePrettyUrl;
                });
            }
        }