Ejemplo n.º 1
0
    public void ShowPage(DataSet resultSet)
    {
        // Do not display the grid if there are no results
        PagingLabel.Visible = true;
        if ((Results != null) && (Results.Items.Count == 0))
        {
            SearchResultsGrid.Visible = false;
            StatusLabel.Visible       = true;
            if (!String.IsNullOrEmpty(Results.ErrorMessage))
            {
                StatusLabel.Text    = Results.ErrorMessage;
                PagingLabel.Visible = false;
            }
            else
            {
                StatusLabel.Text = GetLocalResourceObject("SpeedSearch_Label_NoResults").ToString();
            }
        }
        else
        {
            StatusLabel.Visible       = false;
            SearchResultsGrid.Visible = true;
        }


        // Populate the DataGrid
        SearchResultsGrid.DataSource = resultSet;
        if (resultSet == null)
        {
            SearchResultsGrid.DataSource = ResultsToDataSet();
            if (Session[ClientID] != null)
            {
                Session[ClientID + "DataSet"] = SearchResultsGrid.DataSource;
            }
            else
            {
                Session[ClientID + "DataSet"] = SearchResultsGrid.DataSource;
            }
        }
        SearchResultsGrid.PageSize         = ItemsPerPage;
        SearchResultsGrid.CurrentPageIndex = whichResultsPage;
        SearchResultsGrid.VirtualItemCount = totalDocCount;
        SearchResultsGrid.DataBind();

        Results = null;
    }
 protected void SearchButton_Click(object sender, EventArgs e)
 {
     SearchResultsGrid.Visible = true;
     SearchResultsGrid.DataBind();
 }
        protected void GlobalSearchButton_OnClick(Object sender, EventArgs e)
        {
            Mercury.Server.Application.SearchResultsMemberResponse memberSearchResponse;

            Mercury.Server.Application.SearchResultsProviderResponse providerSearchResponse;


            memberSearchResponse = MercuryApplication.SearchMember(GlobalSearchText.Text, null, GlobalSearchText.Text);

            providerSearchResponse = MercuryApplication.SearchProvider(GlobalSearchText.Text, GlobalSearchText.Text);

            if ((memberSearchResponse.HasException) || (providerSearchResponse.HasException))
            {
                if (memberSearchResponse.HasException)
                {
                    TelerikAjaxManager.ResponseScripts.Add("alert ('" + memberSearchResponse.Exception.Message.Replace("'", "''") + "');");
                }

                else if (providerSearchResponse.HasException)
                {
                    TelerikAjaxManager.ResponseScripts.Add("alert ('" + providerSearchResponse.Exception.Message.Replace("'", "''") + "');");
                }

                else
                {
                    TelerikAjaxManager.ResponseScripts.Add("alert ('Unable to complete search.');");
                }
            }


            else
            {
                System.Data.DataTable resultsTable = SearchResultsTable;

                resultsTable.Rows.Clear();

                foreach (Mercury.Server.Application.SearchResultMember currentMemberResult in memberSearchResponse.Results)
                {
                    Client.Core.Member.Member member = MercuryApplication.MemberGet(currentMemberResult.MemberId, true);


                    String memberEffectiveDate = (member.MostRecentEnrollment != null) ? member.MostRecentEnrollment.EffectiveDate.ToString("MM/dd/yyyy") : "*";

                    String memberTerminationDate = "*";

                    if (member.MostRecentEnrollment != null)
                    {
                        if (member.MostRecentEnrollment.TerminationDate == new DateTime(9999, 12, 31))
                        {
                            memberTerminationDate = "< active >";
                        }

                        else
                        {
                            memberTerminationDate = member.MostRecentEnrollment.TerminationDate.ToString("MM/dd/yyyy");
                        }
                    }


                    String programMemberId = (member.MostRecentEnrollment != null) ? member.MostRecentEnrollment.ProgramMemberId : "&nbsp";


                    resultsTable.Rows.Add(

                        "Member",

                        programMemberId,

                        CommonFunctions.MemberProfileAnchor(currentMemberResult.MemberId, currentMemberResult.Name),

                        currentMemberResult.BirthDate.ToString("MM/dd/yyyy") + " (" + member.CurrentAge.ToString().PadLeft(2, ' ') + ") | " + currentMemberResult.Gender,

                        memberEffectiveDate,

                        memberTerminationDate

                        );
                }

                foreach (Mercury.Server.Application.SearchResultProvider currentProviderResult in providerSearchResponse.Results)
                {
                    Client.Core.Provider.Provider provider = MercuryApplication.ProviderGet(currentProviderResult.ProviderId, true);

                    String providerTerminationDate = "< active >";

                    if (!provider.HasCurrentEnrollment)
                    {
                        providerTerminationDate = String.Empty;
                    }

                    else if (provider.CurrentEnrollment.TerminationDate != new DateTime(9999, 12, 31))
                    {
                        providerTerminationDate = provider.CurrentEnrollment.TerminationDate.ToString("MM/dd/yyyy");
                    }

                    resultsTable.Rows.Add(

                        "Provider",

                        ((provider.HasCurrentEnrollment) ? provider.CurrentEnrollment.ProgramProviderId : String.Empty),

                        CommonFunctions.ProviderProfileAnchor(currentProviderResult.ProviderId, currentProviderResult.Name),

                        currentProviderResult.FederalTaxId + " | " + currentProviderResult.NationalProviderId + " | " + currentProviderResult.PrimarySpecialtyName,

                        ((provider.HasCurrentEnrollment) ? provider.CurrentEnrollment.EffectiveDate.ToString("MM/dd/yyyy") : String.Empty),

                        providerTerminationDate

                        );
                }

                SearchResultsTable = resultsTable;

                SearchResultsGrid.DataSource = resultsTable;

                SearchResultsGrid.DataBind();


                String showDialogScript = "$find(\"" + GlobalSearchResultsWindow.ClientID + "\").show ();";

                TelerikAjaxManager.ResponseScripts.Add(showDialogScript);
            }
        }