全部代码:
public string writepclasscount(int classid,string cssname)
{
string result = "";
WebSiteDataConfig.product_class PC = this.dataSpace.GetObject<WebSiteDataConfig.product_class>("product_classId=" + classid.ToString());
result += "<div class=" + cssname + ">";
result += "<div class=" + cssname + "tp><img src=\"";
if (classid - 1 < 5)
result += "images/ss/" + (classid - 1).ToString();
else
result += "images pic";
result+=".jpg\" width=90 height=90 /></div>";
result += "<div class=" + cssname + "w><ul class=" + cssname + "w-bt>"+PC.class_name+"</ul><ul class=" + cssname + "w-tj>共有"+countP(classid)+"种产品</ul><ul class=" + cssname + "w-gd><a href=class.aspx?id="+classid.ToString()+" class=sub-quick>详细信息 ></a></ul></div>";
result += "</div>";
return result;
}
public string writepclasspinfo(int classid, string cssname,int page)
{
string result = "";
//WebSiteDataConfig.product[] Prs = this.dataSpace.GetObjects<WebSiteDataConfig.product>();
WayControls.Remoting.PageSizeInfo pageSizeinfo = new WayControls.Remoting.PageSizeInfo(false);
pageSizeinfo.CurrentPageIndex = page - 1;
pageSizeinfo.PageSize = P_pagesize;
string a_sql = "product_class=" + classid.ToString();
int a_count = this.dataSpace.Connection.RecordCount("product", a_sql);
a_sql = "select product_pic,product_name,product_detail,productId from product where " + a_sql + " order by product_hot,productId desc";
DataTable Prs = this.dataSpace.Connection.GetResultFormSqlString(a_sql, pageSizeinfo);
result += "<tr>";
int i = 1;
foreach (DataRow Pr in Prs.Rows)
{
result += "<td><div class=" + cssname + ">";
result += "<div class=" + cssname + "tp><img src=\"";
if (Pr["product_pic"].ToString() == "" | Pr["product_pic"].ToString() == null)
result += "images pic.jpg";
else
result += Pr["product_pic"];
result += "\" width=90 height=90 /></div>";
result += "<div class=" + cssname + "w><ul class=" + cssname + "w-bt>" + Pr["product_name"] + "</ul><ul class=" + cssname + "w-tj>";
if (Pr["product_detail"].ToString() == "" | Pr["product_detail"].ToString() == null)
result += "暂无详细介绍!!";
else
{
if (Pr["product_detail"].ToString().Length < 10)
result += delHTML(Pr["product_detail"].ToString());
else
result += delHTML(Pr["product_detail"].ToString()).Substring(0, 10);
}
result += "</ul><ul class=" + cssname + "w-gd><a href=product.aspx?id=" + Pr["productId"].ToString() + " class=sub-quick>详细信息 ></a></ul></div>";
result += "</div></td>";
if (i % 2 == 0)
result += "</tr><tr><td> </td></tr><tr>";
i++;
}
if (i % 2 == 0)
result += "</tr><tr><td> </td></tr><tr>";
result += "<td colspan=2><div class=" + cssname + "-page>" + writePRpage(a_count, P_pagesize, page, "class.aspx?id=" + classid.ToString()+"&page=#") + "</div></td></tr>";
return result;
}