示例#1
0
        public void Loadlist()
        {
            try
            {
                int sotin = 20;// list_pro.Getsotin(_Catid);
                if (list_pro.checkShop(_cat_seo_url))
                {
                    var listshop = list_pro.loadProShop(_cat_seo_url, _Catid, _pricetype, _price, 0);
                    if (listshop.Count > 0)
                    {
                        if (_page != 0)
                        {
                            Rplistpro.DataSource = listshop.Skip(sotin * _page - sotin).Take(sotin);
                            Rplistpro.DataBind();
                        }
                        else
                        {
                            Rplistpro.DataSource = listshop.Take(sotin);
                            Rplistpro.DataBind();
                        }

                        ltrPage.Text = change.resultListproduct(listshop.Count, sotin, _cat_seo_url, _Catid, "", _price, _pricetype, "", _page, 1);
                    }
                    return;
                }

                if (list_pro.checkHangsx(_Catid))
                {
                    var listhsx = list_pro.loadProhangsx(_Catid, _pricetype, _price, 0, "");
                    Hdcount.Value = listhsx.Count.ToString();
                    if (listhsx.Count > 0)
                    {
                        if (_page != 0)
                        {
                            Rplistpro.DataSource = listhsx.Skip(sotin * _page - sotin).Take(sotin);
                            Rplistpro.DataBind();
                        }
                        else
                        {
                            Rplistpro.DataSource = listhsx.Take(sotin);
                            Rplistpro.DataBind();
                        }


                        //ltrPage.Text = change.resultListproduct(listhsx.Count, sotin, _cat_seo_url, 0, "", _price, _pricetype, "", _page, 1);
                    }
                    return;
                }

                var list = list_pro.Load_listpro(_Catid, _idhangsx, _pricetype, _price, 0, "");
                Hdcount.Value = list.Count.ToString();
                if (list.Count > 0)
                {
                    if (_page != 0)
                    {
                        Rplistpro.DataSource = list.Skip(sotin * _page - sotin).Take(sotin);
                        Rplistpro.DataBind();
                    }
                    else
                    {
                        Rplistpro.DataSource = list.Take(sotin);
                        Rplistpro.DataBind();
                    }

                    //ltrPage.Text = change.resultListproduct(list.Count, sotin, _cat_seo_url, 0, "", _price, _pricetype, "", _page, 1);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void Loadlist()
        {
            try
            {
                _Catid = Utils.CIntDef(Request.QueryString["idcat"]);
                if (_cat_seo_url.Contains("san-pham-yeu-thich"))
                {
                    Rplistpro.DataSource = list_pro.Load_listproLike(cki.Listcookie_like());
                    Rplistpro.DataBind();
                    return;
                }
                int sotin = 20;// list_pro.Getsotin(_Catid);
                if (list_pro.checkShop(_cat_seo_url))
                {
                    var listshop = list_pro.loadProShop(_cat_seo_url, _Catid, _pricetype, _price, _sortvl);
                    if (listshop.Count > 0)
                    {
                        if (_page != 0)
                        {
                            Rplistpro.DataSource = listshop.Skip(sotin * _page - sotin).Take(sotin);
                            Rplistpro.DataBind();
                        }
                        else
                        {
                            Rplistpro.DataSource = listshop.Take(sotin);
                            Rplistpro.DataBind();
                        }

                        string _listid = _sortvl.ToString();
                        ltrPage.Text = change.resultListproduct(listshop.Count, sotin, _cat_seo_url, _Catid, _listid, _price, _pricetype, _param, _page, 1);
                    }
                    return;
                }

                if (list_pro.checkHangsx(_Catid))
                {
                    var listhsx = list_pro.loadProhangsx(_Catid, _pricetype, _price, _sortvl, _param);
                    if (listhsx.Count > 0)
                    {
                        if (_page != 0)
                        {
                            Rplistpro.DataSource = listhsx.Skip(sotin * _page - sotin).Take(sotin);
                            Rplistpro.DataBind();
                        }
                        else
                        {
                            Rplistpro.DataSource = listhsx.Take(sotin);
                            Rplistpro.DataBind();
                        }

                        string _listid = _sortvl.ToString();
                        ltrPage.Text = change.resultListproduct(listhsx.Count, sotin, _cat_seo_url, 0, _listid, _price, _pricetype, _param, _page, 1);
                    }
                    return;
                }

                var list = list_pro.Load_listpro(_Catid, _idhangsx, _pricetype, _price, _sortvl, _param);
                if (list.Count > 0)
                {
                    if (_page != 0)
                    {
                        Rplistpro.DataSource = list.Skip(sotin * _page - sotin).Take(sotin);
                        Rplistpro.DataBind();
                    }
                    else
                    {
                        Rplistpro.DataSource = list.Take(sotin);
                        Rplistpro.DataBind();
                    }

                    string _listid = _sortvl.ToString();
                    ltrPage.Text = change.resultListproduct(list.Count, sotin, _cat_seo_url, 0, _listid, _price, _pricetype, _param, _page, 1);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }