예제 #1
0
        private void SetDataSourceFromCategoryProvider()
        {
            ods.TypeName     = typeof(CustomerDAC).FullName;
            ods.EnablePaging = true;
            ods.SelectParameters.Clear();
            ods.SelectParameters.Add("categoryID", CategoryID.ToString());
            ods.SelectParameters.Add("providerID", ProviderID.ToString());
            ods.SelectParameters.Add("stFrom", dtFrom.ToString());
            ods.SelectParameters.Add("stTo", dtTo.ToString());
            ods.SelectParameters.Add("ageFrom", AgeFrom.ToString());
            ods.SelectParameters.Add("ageTo", AgeTo.ToString());
            ods.SelectParameters.Add("suburbID", SuburbID.ToString());

            ods.SelectParameters.Add("MonFilter", MonFilter.ToString());
            ods.SelectParameters.Add("TueFilter", TueFilter.ToString());
            ods.SelectParameters.Add("WedFilter", WedFilter.ToString());
            ods.SelectParameters.Add("ThursFilter", ThursFilter.ToString());
            ods.SelectParameters.Add("FriFilter", FriFilter.ToString());
            ods.SelectParameters.Add("SatFilter", SatFilter.ToString());
            ods.SelectParameters.Add("SunFilter", SunFilter.ToString());

            ods.SelectMethod                = "RetrieveProviderActivities";
            ods.SelectCountMethod           = "RetrieveProviderActivitiesCount";
            ods.MaximumRowsParameterName    = "amount";
            ods.StartRowIndexParameterName  = "startIndex";
            ods.SortParameterName           = "sortExpression";
            GridViewActivities.PageSize     = PageSize;
            GridViewActivities.DataSourceID = "ods";
            SortProducts();
            //DataPager1.SetPageProperties(StartRow, DataPager1.MaximumRows, false);
            //ListViewProducts.DataBind();
        }
예제 #2
0
        private void SetDataSourcebySearchKey(String SearchPhrase)
        {
            ods.TypeName     = typeof(CustomerDAC).FullName;
            ods.EnablePaging = true;
            ods.SelectParameters.Clear();
            ods.SelectParameters.Add("searchKey", SearchPhrase);
            ods.SelectParameters.Add("providerID", ProviderID.ToString());
            ods.SelectParameters.Add("ageFrom", AgeFrom.ToString());
            ods.SelectParameters.Add("ageTo", AgeTo.ToString());
            ods.SelectParameters.Add("stFrom", dtFrom.ToString());
            ods.SelectParameters.Add("stTo", dtTo.ToString());
            ods.SelectParameters.Add("tmFrom", tmFrom.ToString());
            ods.SelectParameters.Add("tmTo", tmTo.ToString());
            ods.SelectParameters.Add("suburbID", SuburbID.ToString());
            ods.SelectParameters.Add("categoryID", CategoryID.ToString());

            ods.SelectParameters.Add("MonFilter", MonFilter.ToString());
            ods.SelectParameters.Add("TueFilter", TueFilter.ToString());
            ods.SelectParameters.Add("WedFilter", WedFilter.ToString());
            ods.SelectParameters.Add("ThursFilter", ThursFilter.ToString());
            ods.SelectParameters.Add("FriFilter", FriFilter.ToString());
            ods.SelectParameters.Add("SatFilter", SatFilter.ToString());
            ods.SelectParameters.Add("SunFilter", SunFilter.ToString());

            ods.SelectMethod               = "RetrieveProviderActivitiesbySearchPhrase";
            ods.SelectCountMethod          = "RetrieveProviderActivitiesbySearchPhraseCount";
            ods.MaximumRowsParameterName   = "amount";
            ods.StartRowIndexParameterName = "startIndex";
            ods.SortParameterName          = "sortExpression";

            ListViewActivities.DataSourceID = "ods";

            SortProducts();
        }
예제 #3
0
        internal void Refresh()
        {
            ddSort.SelectedValue = SortValue;
            lblKeyword.Visible   = false;
            String query = "";


            if (SearchKey != null)
            {
                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());
                            }
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(query))
            {
                Stopwatch sw = Stopwatch.StartNew();

                SetDataSourceFromSearchKey(query);


                lblAmount.Text = 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()).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
                    //{

                    //lblKeyword.Text = "there are no records with keyword '" + SearchKey + "'";
                }
                TimeSpan elapsed = sw.Elapsed;
                hdnTimespan.Value = elapsed.ToString();
            }
            else
            {
                SetDataSourceFromCategoryProvider();
                lblAmount.Text = 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()).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 (GridViewActivities.HeaderRow != null)
            {
                GridViewActivities.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
        }
예제 #4
0
        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();
            }
        }