Exemplo n.º 1
0
        public void Refresh()
        {
            ddSort.SelectedValue = SortValue;
            lblKeyword.Visible   = false;
            int amount = 0;

            if (SearchKey != null)
            {
                String SearchPhrase = new ProviderBFC().RefineSearchKey(SearchKey);
                SetDataSourcebySearchKey(SearchPhrase);
                amount          = new ProviderDAC().RetrieveProviderActivitiesbySearchPhraseCount(ProviderID, SearchPhrase);
                lblAmount1.Text = lblAmount.Text = amount.ToString();

                if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow))
                {
                    lblEndIndex.Text = lblAmount.Text;
                }
                else
                {
                    lblEndIndex.Text = (StartRow + PageSize).ToString();
                }

                lblStartIndex.Text = (StartRow + 1).ToString();

                if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text))
                {
                    lblStartIndex.Text = lblEndIndex.Text;
                }


                lblEndIndex1.Text   = lblEndIndex.Text;
                lblStartIndex1.Text = lblStartIndex.Text;

                lblKeyword.Visible = true;
                if (lblAmount.Text != "0")
                {
                    lblKeyword.Text = "Search Found " + lblAmount.Text + " Record  with keyword '" + SearchKey + "'";
                }
                else
                {
                    lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'";
                }
            }
            else
            {
                SetDataSourcebyProviderCategory();
                amount          = new ProviderDAC().RetrieveProviderActivitiesbyCategoryIDCount(ProviderID, CategoryID);
                lblAmount1.Text = lblAmount.Text = amount.ToString();

                if (Convert.ToInt32(lblAmount.Text) <= Convert.ToInt32(PageSize + StartRow))
                {
                    lblEndIndex.Text = lblAmount.Text;
                }
                else
                {
                    lblEndIndex.Text = (StartRow + PageSize).ToString();
                }

                lblStartIndex.Text = (StartRow + 1).ToString();

                if (Convert.ToInt32(lblStartIndex.Text) >= Convert.ToInt32(lblEndIndex.Text))
                {
                    lblStartIndex.Text = lblEndIndex.Text;
                }

                lblEndIndex1.Text   = lblEndIndex.Text;
                lblStartIndex1.Text = lblStartIndex.Text;
            }
            if (amount == 0 || amount <= PageSize)
            {
                divPager.Visible   = false;
                tabShowAct.Visible = false;
            }
            else
            {
                divPager.Visible   = true;
                tabShowAct.Visible = true;
            }
        }