using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; public partial class control_trade : System.Web.UI.UserControl { public string tradecontent = string.Empty;//内容 public DataSet dsjsq = Fun.Funjsqid(); public int pagesite = 10;//一页显示多少个 public int page = 1; public int start = 0;//从第几条开始读取 public int classid = 0; protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["page"] != null) { page = Convert.ToInt32(Request.QueryString["page"].ToString()); } string classstr = ""; if (Request.QueryString["classid"] != null && Request.QueryString["classid"] != "" && Request.QueryString["classid"] != "0") { classid = Convert.ToInt32(Request.QueryString["classid"].ToString()); classstr = "&classid=" + classid; } Pager1.PageSize = pagesite; start = (page - 1) * pagesite; string web = string.Empty; web = Fun.Funtradecountxml() + "?jsqid=" + dsjsq.Tables[0].Rows[0]["jsqid"].ToString() + "" + classstr + ""; try { DataSet dss = new DataSet(); dss.ReadXml(web); if (dss.Tables.Count > 0) { Pager1.RecordCount = Convert.ToInt32(dss.Tables[0].Rows[0]["count"].ToString()); } } catch { } try { string website = string.Empty; website = Fun.Funtradepartxml() + "?jsqid=" + dsjsq.Tables[0].Rows[0]["jsqid"].ToString() + "&num=" + dsjsq.Tables[0].Rows[0]["tradewords"].ToString() + "" + classstr + "&top=" + pagesite + "&start=" + start + ""; DataSet ds = new DataSet(); ds.ReadXml(website); if (ds.Tables.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string id = ds.Tables[0].Rows[i]["id"].ToString(); string proname = Server.UrlDecode(ds.Tables[0].Rows[i]["name"].ToString()); string description = Server.UrlDecode(ds.Tables[0].Rows[i]["description"].ToString()); string picture = Cutpic(ds.Tables[0].Rows[i]["picture"].ToString()); string clid = ds.Tables[0].Rows[i]["classid"].ToString(); tradecontent += "
    1. \"\"
    2. "; tradecontent += "
    3. " + proname + "" + description + "...
  • "; } } else { if (classid <= 0) { string pagename = dsjsq.Tables[0].Rows[0]["pagename"].ToString(); pagename = pagename.Replace(".aspx", "").Replace(".html", ""); string serverpath = Server.MapPath(pagename + ".aspx"); if (!File.Exists(serverpath)) { Response.Redirect("product.html"); } else { Response.Redirect(pagename + ".html"); } } } } catch { } } public string Cutpic(string str) { if (str.Trim() != "") { str = Fun.Funtradeurl() + "s_" + str; } else { str = Fun.Funtradeurl() + "s_trade_policy.jpg"; } return str; } }