Esempio n. 1
0
        void OnSearchButtonClick(object sender, EventArgs e)
        {
            Execute(() =>
            {
                SearchBox.Enabled    = false;
                SearchButton.Enabled = false;

                SearchResultsGrid.Rows.Clear();

                // TODO: May add query asnyc?
                var results = GoogleFinanceHelper.SearchTicker(SearchBox.Text);

                foreach (var item in results)
                {
                    SearchResultsGrid.Rows.Add(item.Name, item.Symbol, item.Exchange);
                }

                if (SearchResultsGrid.Rows.Count > 0)
                {
                    SearchResultsGrid.Select();
                    SearchResultsGrid.Focus();
                }
            }, () =>
            {
                SearchBox.Enabled    = true;
                SearchButton.Enabled = true;

                if (SearchResultsGrid.Rows.Count == 0)
                {
                    SearchBox.SelectAll();
                    SearchBox.Focus();
                }
            });
        }
Esempio n. 2
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;
    }
Esempio n. 3
0
        private void SetAttachRubricResultList()
        {
            WaitForIFrameToDisplay();

            AttachRubricResultsList = new List <AttachRubricLineItem>();
            SearchResultsGrid.Wait(3);
            AttachRubricResultsWebElementList = SearchResultsRows.WaitForElements(5);
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeId  = "ctl00_MainContent_GridRubrics_ctl03_AddButton";
                dummy1.FakeAttributeRid = "8789";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeId  = "ctl00_MainContent_GridRubrics_ctl04_AddButton";
                dummy2.FakeAttributeRid = "8790";

                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2
                };
                AttachRubricResultsWebElementList = new ReadOnlyCollection <IWebElement>(list);
            }

            int index = 0;

            foreach (var webElement in AttachRubricResultsWebElementList)
            {
                int    itemid         = -1;
                string attachButtonId = null;
                string uniqueId       = null;

                itemid         = int.Parse(webElement.GetAttribute("rid"));
                attachButtonId = webElement.GetAttribute("id");
                Report.Write("Got the attribute: 'id' = '" + attachButtonId + "' of attach button [" + index + "].");
                uniqueId = GetUniqueId(attachButtonId);

                Report.Write("AttachRubricLineItem by itemid: '" + itemid + "'; index: '" + index + "'; uniqueId: '" + uniqueId);
                var lineItem = new AttachRubricLineItem(itemid, index, uniqueId, this.Parent.CurrentWindowHandle);
                AttachRubricResultsList.Add(lineItem);
                index++;
            }
        }
 protected void SearchButton_Click(object sender, EventArgs e)
 {
     SearchResultsGrid.Visible = true;
     SearchResultsGrid.DataBind();
 }
Esempio n. 5
0
        private void SetItemCentralResultList()
        {
            ItemCentralResultsList = new List <ItemCentralLineItem>();
            SearchResultsGrid.Wait(3);
            ItemCentralResultsWebElementList = SearchResultsRows.WaitForElements(5);
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeItemid    = "231270";
                dummy1.FakeAttributePassageid = "35605";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeItemid    = "231271";
                dummy2.FakeAttributePassageid = "35606";
                DummyWebElement dummy3 = new DummyWebElement();
                dummy3.FakeAttributeItemid    = "231272";
                dummy3.FakeAttributePassageid = "35607";
                DummyWebElement dummy4 = new DummyWebElement();
                dummy4.FakeAttributeItemid    = "231273";
                dummy4.FakeAttributePassageid = "35608";
                DummyWebElement dummy5 = new DummyWebElement();
                dummy5.FakeAttributeItemid    = "231274";
                dummy5.FakeAttributePassageid = "35609";
                DummyWebElement dummy6 = new DummyWebElement();
                dummy6.FakeAttributeItemid    = "231275";
                dummy6.FakeAttributePassageid = "35610";
                DummyWebElement dummy7 = new DummyWebElement();
                dummy7.FakeAttributeItemid    = "231276";
                dummy7.FakeAttributePassageid = "35611";
                DummyWebElement dummy8 = new DummyWebElement();
                dummy8.FakeAttributeItemid    = "231277";
                dummy8.FakeAttributePassageid = "35612";
                DummyWebElement dummy9 = new DummyWebElement();
                dummy9.FakeAttributeItemid    = "231278";
                dummy9.FakeAttributePassageid = "35613";
                DummyWebElement dummy10 = new DummyWebElement();
                dummy10.FakeAttributeItemid    = "231279";
                dummy10.FakeAttributePassageid = "35614";

                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2, dummy3, dummy4, dummy5, dummy6, dummy7, dummy8, dummy9, dummy10
                };
                ItemCentralResultsWebElementList = new ReadOnlyCollection <IWebElement>(list);
            }

            int index = 0;

            foreach (var webElement in ItemCentralResultsWebElementList)
            {
                int    itemid    = -1;
                int    passageid = -1;
                string uniqueId  = null;
                switch (ItemCentralType)
                {
                case ItemCentralType.Item:
                    itemid    = int.Parse(webElement.GetAttribute("itemid"));
                    ItemCheck = new WebElementWrapper(ByCheckItemLocator(itemid));
                    //ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03_chkItem
                    ItemCheck.FakeAttributeId = "ctl00_MainContent_ItemFinder1_" + ControlMiddle + "gridResults_ctl03_chkItem";
                    uniqueId = GetUniqueId(ItemCheck, ByCheckItemLocator(itemid));
                    break;

                case ItemCentralType.Passage:
                    itemid    = int.Parse(webElement.GetAttribute("passageid"));
                    ItemCheck = new WebElementWrapper(ByCheckItemLocator(itemid));
                    //ctl00_MainContent_ItemFinder1_PassageFinderResults1_gridResults_ctl03_chkPassage
                    ItemCheck.FakeAttributeId = "ctl00_MainContent_ItemFinder1_" + ControlMiddle + "gridResults_ctl03_chkItem";
                    uniqueId = GetUniqueId(ItemCheck, ByCheckItemLocator(itemid));
                    break;

                case ItemCentralType.Rubric:
                    By ByAlink = By.CssSelector("a[id*='ButtonDetails']");
                    WebElementWrapper aLinkElement = new WebElementWrapper(ByAlink);
                    if (Driver.GetType() == typeof(DummyDriver))
                    {
                        aLinkElement.FakeAttributeRubricid = "8560";
                        //ctl00_MainContent_RubricFinder1_RubricFinderResults1_gridResults_ctl03_ButtonDetails
                        aLinkElement.FakeAttributeId = "ctl00_MainContent_RubricFinder1_" + ControlMiddle + "gridResults_ctl03_ButtonDetails";
                    }
                    itemid   = int.Parse(aLinkElement.GetAttribute("rubric_id"));
                    uniqueId = GetUniqueId(aLinkElement, SearchResultsRows.By);
                    break;
                }
                Report.Write("ItemCentralLineItem by itemid: '" + itemid + "'; passageid: '{" + passageid + "'; index: '" + index + "'; uniqueId: '" + uniqueId);
                var lineItem = new ItemCentralLineItem(webElement, ItemCentralType, itemid, index, uniqueId);
                ItemCentralResultsList.Add(lineItem);
                index++;
            }
        }
        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);
            }
        }