public void Refresh() { ddSort.SelectedValue = SortValue; lblKeyword.Visible = false; if (PageSize == 8 || PageSize == 16) { PageSize = 10; } /* if (SearchKey != null) * { * String SearchPhrases = new CustomerBFC().RefineSearchKeyreward(SearchKey); * string query = ""; * foreach (var phrase in SearchPhrases) * { * if (query.StartsWith(SystemConstants.Query)) * { * query = phrase; * query = query.Replace(SystemConstants.Query, string.Empty); * } * } * SetDataSourcebySearchKey(query);*/ if (SearchKey != null) { String SearchPhrase = new CustomerBFC().RefineSearchKeyreward(SearchKey); SetDataSourcebySearchKey(SearchPhrase); int amount = new CustomerDAC().RetrieveAdminRewardsbySearchPhraseCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID, SearchPhrase); 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; lblAmount1.Text = lblAmount.Text; lblKeyword.Visible = true; if (lblAmount.Text == "0") { //lblKeyword.Text = "Search Found " + lblAmount.Text + " Record with keyword '" + SearchKey + "'"; //else //{ divPager.Visible = false; //lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'"; } } else { SetDataSourcebyProviderCategory(); int amount = new CustomerDAC().RetrieveAdminRewardsCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID); 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; lblAmount1.Text = lblAmount.Text; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } } }
public void Refresh() { ddSort.SelectedValue = SortValue; lblKeyword.Visible = false; if (SearchKey != null) { String SearchPhrase = new CustomerBFC().RefineSearchKeyreward(SearchKey); SetDataSourcebySearchKey(SearchPhrase); lblAmount.Text = new CustomerDAC().RetrieveAdminRewardsbySearchPhraseCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID, SearchPhrase).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; lblAmount1.Text = lblAmount.Text; lblKeyword.Visible = true; if (lblAmount.Text == "0") { //lblKeyword.Text = "Search Found " + lblAmount.Text + " Record with keyword '" + SearchKey + "'"; //else //{ divPager.Visible = false; //lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'"; } } else { SetDataSourcebyProviderCategory(); int amount = new CustomerDAC().RetrieveAdminRewardsCount(ProviderID, AgeFrom, AgeTo, RewardType, CategoryID); 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; lblAmount1.Text = lblAmount.Text; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } } }
public void Refresh() { if (WebSecurity.IsAuthenticated) { RetrieveSavedList(); } ddSort.SelectedValue = SortValue; lblKeyword.Visible = false; String query = ""; Stopwatch sw = new Stopwatch(); sw.Start(); if (!string.IsNullOrEmpty(SearchKey)) { List <String> parameters = new CustomerBFC().RefineSearchKey(SearchKey); foreach (var parameter in parameters) { if (!string.IsNullOrEmpty(parameter)) { if (parameter.StartsWith(SystemConstants.Query)) { query = parameter.Replace(SystemConstants.Query, string.Empty); } else if (parameter.StartsWith(SystemConstants.Location)) { String[] locs = parameter.Replace(SystemConstants.Location, string.Empty).ToUpper().Split(';'); var subDT = new CustomerDAC().RetrieveSuburbs(); var suburbs = subDT.Where(x => locs.Contains(x.Name.ToUpper())); foreach (var sub in suburbs) { if (String.IsNullOrEmpty(SuburbID)) { SuburbID = sub.ID.ToString(); } else { SuburbID += "|" + sub.ID.ToString(); } } } else if (parameter.StartsWith(SystemConstants.Day)) { MonFilter = TueFilter = WedFilter = ThursFilter = FriFilter = SatFilter = SunFilter = false; string[] days = parameter.Replace(SystemConstants.Day, string.Empty).Split(';'); foreach (var day in days) { if (day.ToUpper().Equals(DayOfWeek.Monday.ToString().ToUpper())) { MonFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Tuesday.ToString().ToUpper())) { TueFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Wednesday.ToString().ToUpper())) { WedFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Thursday.ToString().ToUpper())) { ThursFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Friday.ToString().ToUpper())) { FriFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Saturday.ToString().ToUpper())) { SatFilter = true; } if (day.ToUpper().Equals(DayOfWeek.Sunday.ToString().ToUpper())) { SunFilter = true; } } } else if (parameter.StartsWith(SystemConstants.Time)) { string[] times = parameter.Replace(SystemConstants.Time, string.Empty).Split('-'); if (times.Length == 2) { dtFrom = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[0]).ToShortTimeString()); dtTo = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[1]).ToShortTimeString()); } else if (times.Length == 1) { dtFrom = Convert.ToDateTime(SystemConstants.nodate.ToShortDateString() + " " + Convert.ToDateTime(times[0]).ToShortTimeString()); } } } } } TimeSpan time = sw.Elapsed; sw.Restart(); lbltimerefine.Text = time.ToString(); if (!string.IsNullOrEmpty(query)) { SetDataSourcebySearchKey(query); int amount = new CustomerDAC().RetrieveProviderActivitiesbySearchPhraseCount(ProviderID, dtFrom.ToString(), dtTo.ToString(), tmFrom.ToString(), tmTo.ToString(), AgeFrom, AgeTo, SuburbID, CategoryID, query, MonFilter.ToString(), TueFilter.ToString(), WedFilter.ToString(), ThursFilter.ToString(), FriFilter.ToString(), SatFilter.ToString(), SunFilter.ToString()); 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; lblAmount1.Text = lblAmount.Text; lblKeyword.Visible = true; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } TimeSpan time1 = sw.Elapsed; lblshowres.Text = hdnTimespan.Value = "Set list by searchprovcat: " + time1.ToString(); } else { SetDataSourcebyProviderCategory(); int amount = new CustomerDAC().RetrieveProviderActivitiesCount(ProviderID, dtFrom.ToString(), dtTo.ToString(), tmFrom.ToString(), tmTo.ToString(), AgeFrom, AgeTo, SuburbID, CategoryID, MonFilter.ToString(), TueFilter.ToString(), WedFilter.ToString(), ThursFilter.ToString(), FriFilter.ToString() , SatFilter.ToString(), SunFilter.ToString()); 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; lblAmount1.Text = lblAmount.Text; if (amount == 0) { ItemCountBottom.Visible = false; } else { if (amount <= PageSize) { divPager.Visible = false; ItemCountBottom.Visible = true; } else { divPager.Visible = ItemCountBottom.Visible = true; } } TimeSpan time1 = sw.Elapsed; lblshowres.Text = hdnTimespan.Value = "Set list byprovcat: " + time1.ToString(); } }