public void TreeBind(int channel_id) { Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category(); DataTable dt = null; if (channel_id == 0) { dt = bll.GetList(0, channel_id, ""); } else { dt = bll.GetList(0, channel_id, "where channel_id=" + channel_id); } this.ddlParentId.Items.Clear(); this.ddlParentId.Items.Add(new ListItem("无父级", "0")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["title"].ToString().Trim(); if (ClassLayer == 1) { this.ddlParentId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlParentId.Items.Add(new ListItem(Title, Id)); } } }
/// <summary> /// 绑定类别 /// </summary> public void listbind() { Cms.BLL.C_article_category ccc = new Cms.BLL.C_article_category(); DataTable dt = ccc.GetList("channel_id=1 order by sort_id asc").Tables[0]; ddpid.DataSource = dt.DefaultView; ddpid.DataTextField = "title"; ddpid.DataValueField = "id"; ddpid.DataBind(); dt = ccc.GetList("channel_id=5 order by sort_id asc").Tables[0]; ddcz.DataSource = dt.DefaultView; ddcz.DataTextField = "title"; ddcz.DataValueField = "id"; ddcz.DataBind(); }
private void RptBind(int id) { Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category(); DataTable dt = bll.GetList(0, this.channel_id, "where channel_id=" + id); this.rptList.DataSource = dt; this.rptList.DataBind(); Cms.BLL.C_Column cm = new Cms.BLL.C_Column(); string classname = cm.GetModel(27).className; bool bladd = adminUser.setpurview(classname, "add"); bool blEdit = adminUser.setpurview(classname, "Edit"); bool blDelete = adminUser.setpurview(classname, "Delete"); if (!bladd) { btnadd.Visible = false; } if (!blEdit) { btnSave.Visible = false; } if (!blDelete) { btnDelete.Visible = false; } }
/// <summary> /// 返回类别名称 /// </summary> /// <param name="type"></param> /// <returns></returns> public string typename(string type) { string str = ""; Cms.BLL.C_article_category ccc = new Cms.BLL.C_article_category(); DataTable dt = ccc.GetList("id=" + type).Tables[0]; if (dt.Rows.Count > 0) { str = dt.Rows[0]["title"].ToString(); } return(str); }
public string getcolumn(int channel_id) { string result = ""; Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category(); DataSet ds = bll.GetList("id=" + channel_id); if (ds != null && ds.Tables[0].Rows.Count > 0) { result = ds.Tables[0].Rows[0]["title"].ToString(); } return(result); }
public string getclasslayer(int parentId, int result) { string resultone = ""; Cms.BLL.C_article_category bll = new Cms.BLL.C_article_category(); DataSet ds = bll.GetList("id=" + parentId); if (ds != null && ds.Tables[0].Rows.Count > 0) { result = result + 1; int id = Convert.ToInt32(ds.Tables[0].Rows[0]["parent_id"].ToString()); resultone = getclasslayer(id, result); } else { resultone = result.ToString(); } return(resultone); }