/// <summary> /// 绑定下拉框 /// </summary> /// <param name="where">绑定的数据源的查询条件</param> /// <param name="options">下拉框</param> /// <param name="leveStr">层级的前缀</param> /// <param name="nextStr">层级的前缀的前缀</param> public string GetChannelList(SqlWhereList where, string option, string leveStr, string nextStr) { options += option; List <Channel> list = channelBLL.GetAll(where); foreach (Channel ch in list) { string txt = ch.ChannelName; if (leveStr.Length != 1) { txt = leveStr + ch.ChannelName.ToString(); } options += " <option value='" + ch.ChannelId + "'>" + txt + "</option>"; SqlWhereList sqllist = new SqlWhereList(); sqllist.Add("ParentID", ch.ChannelId); sqllist.Add("TypeId", 2); List <Channel> channelList = channelBLL.GetAll(sqllist); if (channelList.Count != 0) { string nextLevelStr = leveStr.Insert(0, nextStr); GetChannelList(sqllist, option, nextLevelStr, nextStr); } } return(options); }
private void GetzTree(SqlWhereList where, zTreeNode root, int templateId, int templeteType) { List <Channel> list = channelBLL.GetAll(where); zTreeNode node = null; root.children = new List <zTreeNode>(); foreach (Channel item in list) { node = new zTreeNode(); DataTable dt = templateDetailBLL.GetTemplateDetailChecked(templateId); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["ChannelId"].Equals(item.ChannelId) && templeteType == 2) { node.@checked = true; node.chkDisabled = true;//设为禁用 } } node.id = item.ChannelId; node.name = item.ChannelName; node.pId = item.ParentId; node.open = true; TemplateDetail _TemplateDetail = getIsExistTemplatedetail(templateId, node.id); if (_TemplateDetail == null) { node.@checked = false; } else { node.@checked = true; } node.attributes = new zTreeNodeCustAttr(node.id); SqlWhereList wherelist = new SqlWhereList(); wherelist.Add("ParentID", node.id); if (templeteType == 2) { wherelist.Add("TypeId", 1); } GetzTree(wherelist, node, templateId, templeteType); root.children.Add(node); } }
public string deleteChannelByID(string channelID) { string msg = ""; Channel channel = new Channel(); channel.ChannelId = channelID; SqlWhereList sqlWhere = new SqlWhereList(); sqlWhere.Add("ParentID", channelID); List <Channel> channellist = channelBLL.GetAll(sqlWhere); if (channellist.Count > 0) { msg = "还有子节点,不能直接删除!!!"; } else { channelBLL.Delete(channel); } return(msg); }