示例#1
0
 public DataTable GetDataTableByPage(string mysql, CDBProcess db)
 {
     DataSet myds = new DataSet();
     SqlDataAdapter myda = null;
     myda = db.Getadapter(mysql);
     myda.Fill(myds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "temptbl");
     DataTable dt = myds.Tables["temptbl"];
     return dt;
 }
示例#2
0
    private void BindList(CDBProcess db)
    {
        DataTable dt;

        object obj = Request.QueryString["op"];
        if (ViewState["mydt"] != null && obj != null)
        {
            dt = GetDtByDvAndPage(((DataTable)ViewState["mydt"]).DefaultView);
            this.repToursList.DataSource = dt;
            repToursList.DataBind();
        }
        else
        {
            city = Request["city"] == null ? "" : Request["city"].ToString();
            typ = Request["tp"] == null ? "" : Request["tp"].ToString();
            string sql = "";
            string sqlCount = "";
            //string strWhere = " and state = 0 ";
            if (obj != null)
            {
                city = Request["c"].ToString();
                typ = Request["t"].ToString();
                pname = Request["pname"].ToString();
            }

            if (city == "" || city == "null")
            {
                sql = "select   * from productinfo where  state = 0 and isDel<>1 and type = 4 $pname$ order by [sort] asc";
                sqlCount = "select count(*) from productinfo where  state = 0 and isDel<>1 and type = 4 $pname$";
            }
            else
            {
                if (typ == "Anytype")
                {
                    sql = "select  * from productinfo where  state = 0 and type = 4 and isDel<>1 $pname$ and ProductCity='" + city + "'  order by [sort] asc";
                    sqlCount = "select count(*) from productinfo where  state = 0 and type = 4 and isDel<>1 $pname$ and ProductCity='" + city + "'";
                }
                else
                {
                    sql = "select   * from productinfo where  state = 0 and type = 4 and isDel<>1 $pname$ and ProductCity='" + city + "' and (TourType1='" + typ + "' or TourType2='" + typ + "')  order by [sort] asc";
                    sqlCount = "select count(*) from productinfo where  state = 0 and type = 4 and isDel<>1 $pname$ and ProductCity='" + city + "' and (TourType1='" + typ + "' or TourType2='" + typ + "')";
                }
                aboutTitle = " -- " + city;
            }

            if (string.IsNullOrEmpty(pname) == false)
            {
                sql = sql.Replace("$pname$", " and productname like '%" + pname + "%' ");
                sqlCount = sqlCount.Replace("$pname$", " and productname like '%" + pname + "%' ");
            }
            else
            {
                sql = sql.Replace("$pname$", " ");
                sqlCount = sqlCount.Replace("$pname$", "");
            }

            int count = Convert.ToInt32(db.Scalar(sqlCount));
            dt = GetDataTableByPage(sql, db);
            AspNetPager1.RecordCount = count;

            this.repToursList.DataSource = dt;
            this.repToursList.DataBind();
            ViewState["mydt"] = db.GetDataSet(sql).Tables[0];
        }

        //string strWhere = " and state = 0 ";
        //DataTable dt = CProductInfo.GetproductinfoList(db, 6, strWhere + " and type = 4 ");

        //this.repToursList.DataSource = dt.DefaultView;
        //this.repToursList.DataBind();
    }
示例#3
0
    private void Bindmost(CDBProcess db)
    {
        string strWhere = " and state = 0 ";
        DataTable dt;
        if (typ == "All")
        {
            dt = CProductInfo.GetproductinfoListM(db, 15, strWhere + " and isDel<>1 and type = 4  order by [sort] asc");
        }
        else
        {
            //dt = CProductInfo.GetproductinfoList(db, 10, strWhere + " and type = 1 and ProductCity=" + typ);
            dt = CProductInfo.GetproductinfoListM(db, 15, strWhere + " and isDel<>1 and type = 4  order by [sort] asc");
        }

        this.replistdy.DataSource = dt.DefaultView;
        this.replistdy.DataBind();
    }