private void bingCategory(int pcateid) { DataTable dt = new light.BLL.category().GetList(" 1=1 ").Tables[0]; foreach (DataRow dr in dt.Rows) { pcateid1.Items.Add(new ListItem(dr["cname"].ToString(), dr["pkid"].ToString())); } pcateid1.Value = pcateid.ToString(); }
private void doPost() { string cname = Request["cname"]; light.BLL.category bll = new light.BLL.category(); if (!bll.Exists(cname)) { light.Model.category model = new light.Model.category(); model.addtime = DateTime.Now; model.cname = cname; model.ename = light.Common.Hz2Py.Convert(cname); model.isopen = 1; model.parentid = int.Parse(ViewState["pid"].ToString()); bll.Add(model); WebMessageBox.ShowMessageBox("添加成功", this); } else { WebMessageBox.ShowMessageBox("该分类名已经存在", this); } }
public string procategoryList(int type) { StringBuilder myStringBuilder = new StringBuilder(); myStringBuilder.Append("<div class='syCss_2010461021968'>"); myStringBuilder.Append("<table class='Board_Tab' width='100%' border='0' cellspacing='0' cellpadding='0'>"); DataTable dt = new light.BLL.category().GetList(" parentid=0 ").Tables[0]; if (type == 1) { foreach (DataRow dr in dt.Rows) { myStringBuilder.Append("<tr>"); myStringBuilder.Append("<td align='center' height='39' background='/images/left.jpg'>"); myStringBuilder.Append("<a href='productlist.aspx?id=" + dr["pkid"].ToString() + "' target='_self'>[" + dr["cname"].ToString() + "]</a>"); myStringBuilder.Append("</td>"); myStringBuilder.Append("</tr>"); } } else if (type == 2) { foreach (DataRow dr in dt.Rows) { myStringBuilder.Append("<tr>"); myStringBuilder.Append("<td align='center' height='39' background='/images/left.jpg'>"); myStringBuilder.Append("<a href='productlist.aspx?id=" + dr["pkid"].ToString() + "' target='_self'>[" + dr["ename"].ToString().Split('|')[1] + "]</a>"); myStringBuilder.Append("</td>"); myStringBuilder.Append("</tr>"); } } else { foreach (DataRow dr in dt.Rows) { myStringBuilder.Append("<tr>"); myStringBuilder.Append("<td align='center' height='39' background='/images/left.jpg'>"); myStringBuilder.Append("<a href='productlist.aspx?id=" + dr["pkid"].ToString() + "' target='_self'>[" + dr["ename"].ToString().Split('|')[0] + "]</a>"); myStringBuilder.Append("</td>"); myStringBuilder.Append("</tr>"); } } myStringBuilder.Append("</table>"); myStringBuilder.Append("</div>"); return myStringBuilder.ToString(); }