private void TreeBind(int _channel_id) { BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, _channel_id); this.ddlParentId.Items.Clear(); this.ddlParentId.Items.Add(new ListItem("无父级分类", "1")); 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> /// 栏目URL public string Url(int category_id) { string _url = string.Empty; BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "class_list like '%," + category_id + ",%'", "class_layer desc, sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { if (!string.IsNullOrEmpty(dt.Rows[0]["link_url"].ToString())) { _url = dt.Rows[0]["link_url"].ToString(); } else { if (bll.GetModel(category_id).model_id != 0) { string _key1 = BasePage.pageUrl(bll.GetModel(category_id).model_id); _url = new BasePage().linkurl(_key1, category_id); } else { string _key = BasePage.pageUrl(Convert.ToInt32(dt.Rows[0]["model_id"])); string _category_id = dt.Rows[0]["id"].ToString(); _url = new BasePage().linkurl(_key, _category_id); } } } return(_url.ToString()); }
/// <summary> /// 获取Foot菜单项 /// </summary> /// <returns></returns> public static string GetMenuFootLst() { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetLists(1, " parent_id=1 and id!=91 and is_lock=0 "); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append("<dl>"); rStr.Append(" <dt><a href=\"" + dt.Rows[i]["link_url"] + "\">"); rStr.Append(dt.Rows[i]["title"]); DataTable dtChild = bll.GetLists(Convert.ToInt32(dt.Rows[i]["id"]), " parent_id=" + dt.Rows[i]["id"] + " and is_lock=0 "); int numChild = 1; for (int ic = 0; ic < dtChild.Rows.Count; ic++) { rStr.Append("<dd>"); rStr.Append("<a id=\"child" + numChild + "\" href=\"" + dtChild.Rows[ic]["link_url"]); rStr.Append("?IdF=" + dtChild.Rows[ic]["parent_id"] + "&id=" + dtChild.Rows[ic]["id"] + "&mId=" + numChild + "\">" + dtChild.Rows[ic]["title"].ToString() + "</a>"); numChild++; rStr.Append("</dd>"); } rStr.Append("</a></dt>"); rStr.Append("</dl>"); num++; } } return(rStr.ToString()); }
protected string menus(int category_id) { string menu = ""; Model.contents.article_category model = new BLL.contents.article_category().GetModel(category_id); if (model != null) { string class_list = model.class_list.Trim(','); string[] arr = class_list.Split(','); int loop = 0; if (arr.Length > 0) { foreach (string i in arr) { loop++; string style = loop == arr.Length ? "" : " > "; if (loop != 1) { menu += new BLL.contents.article_category().GetTitle(Convert.ToInt32(i)) + style; } } } } return(menu.ToString()); }
private void ShowSysField(int _category_id) { //查找该频道所选的默认字段 List <Model.contents.article_attribute_field> ls = new BLL.contents.article_attribute_field().GetModelList(this.category_id, "is_sys=1"); foreach (Model.contents.article_attribute_field modelt in ls) { //查找相应的控件,如找到则显示 HtmlGenericControl htmlDiv = FindControl("div_" + modelt.name) as HtmlGenericControl; if (htmlDiv != null) { htmlDiv.Visible = true; ((Label)htmlDiv.FindControl("div_" + modelt.name + "_title")).Text = modelt.title; ((TextBox)htmlDiv.FindControl("field_control_" + modelt.name)).Text = modelt.default_value; ((Label)htmlDiv.FindControl("div_" + modelt.name + "_tip")).Text = modelt.valid_tip_msg; } } //查找该频道所开启的功能 Model.contents.article_category categoryModel = new BLL.contents.article_category().GetModel(_category_id); if (categoryModel.is_albums == 1) { div_albums_container.Visible = true; } if (categoryModel.is_attach == 1) { div_attach_container.Visible = true; } }
private void navigation_validate(HttpContext context) { string navname = OSRequest.GetString("param"); string old_name = OSRequest.GetString("old_name"); if (string.IsNullOrEmpty(navname)) { context.Response.Write("{ \"info\":\"该导航菜单ID不可为空!\", \"status\":\"n\" }"); return; } if (navname.ToLower() == old_name.ToLower()) { context.Response.Write("{ \"info\":\"该导航菜单ID可使用\", \"status\":\"y\" }"); return; } //检查保留的名称开头 if (navname.ToLower().StartsWith("channel_")) { context.Response.Write("{ \"info\":\"该导航菜单ID系统保留,请更换!\", \"status\":\"n\" }"); return; } BLL.contents.article_category bll = new BLL.contents.article_category(); if (bll.Exists(navname)) { context.Response.Write("{ \"info\":\"该导航菜单ID已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"该导航菜单ID可使用\", \"status\":\"y\" }"); return; }
private void edit_category(HttpContext context) { //取得管理员登录信息 Model.managers.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo(); if (adminInfo == null) { context.Response.Write("{\"status\": 0, \"msg\": \"未登录或已超时,请重新登录!\"}"); return; } int category1 = OSRequest.GetFormInt("Category1"); int category2 = OSRequest.GetFormInt("Category2"); if (category1 == category2) { context.Response.Write("{\"status\": 0, \"msg\": \"移动目录跟目的目录不能相同!\"}"); return; } BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(category2); if (model.class_list.IndexOf("," + category1 + ",") > 0) { context.Response.Write("{\"status\": 0, \"msg\": \"父级本不能向其子级转移!\"}"); return; } if (bll.GetModel(category1).parent_id == category2) { context.Response.Write("{\"status\": 0, \"msg\": \"移动目录已经在目的目录里!\"}"); return; } DataTable dt = bll.GetList(0, "class_list like '%," + category1 + ",%'", "class_layer asc").Tables[0]; if (dt.Rows != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { int id = Convert.ToInt32(dt.Rows[i]["id"]); string class_list = dt.Rows[i]["class_list"].ToString(); int new_channel_id = model.channel_id; string new_class_list = model.class_list + class_list.Substring(class_list.IndexOf("," + category1 + ",")).TrimStart(','); string new_class_layer = new_class_list.Trim(',').Split(',').Length.ToString(); if (i == 0) { bll.UpdateField(id, "channel_id=" + new_channel_id + ", parent_id=" + category2 + ", class_list='" + new_class_list + "',class_layer=" + new_class_layer); } else { bll.UpdateField(id, "channel_id=" + new_channel_id + ", class_list='" + new_class_list + "',class_layer=" + new_class_layer); } } } new BLL.managers.manager_log().Add(adminInfo.id, adminInfo.user_name, OSEnums.ActionEnum.Edit.ToString(), "移动栏目:" + bll.GetModel(category1).title); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"栏目转移成功!\"}"); }
//数据绑定 private void RptBind() { BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetLists(0, ""); this.rptList.DataSource = dt; this.rptList.DataBind(); }
private void ShowInfo(int _id) { BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(_id); ddlParentId.SelectedValue = model.parent_id.ToString(); txtCallIndex.Text = model.call_index; txtCallIndex.Attributes.Add("ajaxurl", "../../ashx/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.call_index)); txtCallIndex.Focus(); //设置焦点,防止JS无法提交 txtTitle.Text = model.title; txtSortId.Text = model.sort_id.ToString(); txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; txtLinkUrl.Text = model.link_url; txtImgUrl.Text = model.img_url; txtContent.Value = model.content; rblStatus.SelectedValue = model.model_id.ToString(); if (model.is_add_category == 1) { cblItem.Items[0].Selected = true; } if (model.is_add_content == 1) { cblItem.Items[1].Selected = true; } if (model.is_show_top == 1) { cblItem.Items[2].Selected = true; } if (model.is_show_foot == 1) { cblItem.Items[3].Selected = true; } if (model.is_albums == 1) { cbIsAlbums.Checked = true; } if (model.is_attach == 1) { cbIsAttach.Checked = true; } txtPageSize.Text = model.page_size.ToString(); //赋值扩展字段 if (model.category_fields != null) { for (int i = 0; i < cblAttributeField.Items.Count; i++) { Model.contents.category_field modelt = model.category_fields.Find(p => p.field_id == int.Parse(cblAttributeField.Items[i].Value)); //查找对应的字段ID if (modelt != null) { cblAttributeField.Items[i].Selected = true; } } } }
/// <summary> /// 加载栏目简介 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetCategoryZhaiYao(int id) { string rStr = string.Empty; BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(id); if (model != null) { rStr = model.content; } return rStr; }
public void ProcessRequest(HttpContext context) { BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = new Model.contents.article_category(); int id = OSRequest.GetQueryInt("id", -2); int type = OSRequest.GetQueryInt("type", -2); //0上 ;1下 model = bll.GetModel(id); DataTable dt_sx = bll.GetList(0, "parent_id=" + model.parent_id, "sort_id asc,id desc").Tables[0]; if (dt_sx.Rows != null && dt_sx.Rows.Count > 0) { for (int i = 0; i < dt_sx.Rows.Count; i++) { if (Convert.ToInt32(dt_sx.Rows[i]["ID"]) == id) { if (type == 1) { if ((i + 1) < dt_sx.Rows.Count) { int newId = Convert.ToInt32(dt_sx.Rows[i + 1]["ID"]); //位置互换 bll.UpdateField(newId, "sort_id=" + model.sort_id + ""); bll.UpdateField(id, "sort_id=" + (bll.GetModel(newId).sort_id + 1) + ""); context.Response.Write("OK"); } else { context.Response.Write("down"); } } else if (type == 0) { if ((i - 1) >= 0) { int newId = Convert.ToInt32(dt_sx.Rows[i - 1]["ID"]); //位置互换 bll.UpdateField(newId, "sort_id=" + model.sort_id + ""); bll.UpdateField(id, "sort_id=" + (bll.GetModel(newId).sort_id - 1) + ""); context.Response.Write("OK"); } else { context.Response.Write("up"); } } else { context.Response.Write("参数错误"); } } } } }
/// <summary> /// 加载栏目简介 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetCategoryZhaiYao(int id) { string rStr = string.Empty; BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(id); if (model != null) { rStr = model.content; } return(rStr); }
/// <summary> /// 加载名称+Url /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetPageNameUrl(int id) { string rStr = string.Empty; BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(id); if (model != null) { rStr = "<a href=\"" + model.link_url + "\">" + model.title + "</a>"; } return(rStr); }
/// <summary> /// 获取二级菜单 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetMenuChildById(int id) { if (id == 123) { return(string.Empty); } StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetChildList(id, 6); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { if (i < 3) { rStr.Append("<li class=\"li" + num + "\">"); rStr.Append("<a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">"); rStr.Append(dt.Rows[i]["title"].ToString()); rStr.Append("</a>"); rStr.Append("</li>"); } else { if (i == 3) { rStr.Append("<li><a id=\"a\" href=\"#\">更多</a></li>"); rStr.Append(" <ul id=\"ul1\" class=\"dis\">"); rStr.Append(" <li><a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">" + dt.Rows[i]["title"] + "</a></li>"); } else if (i == dt.Rows.Count - 1) { rStr.Append("<li><a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">" + dt.Rows[i]["title"] + "</a></li>"); rStr.Append("</ul>"); } else { rStr.Append("<li><a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">" + dt.Rows[i]["title"] + "</a></li>"); } } if (i < dt.Rows.Count - 1) { rStr.Append("| "); } num++; } } return(rStr.ToString()); }
private bool DoEdit(int _id) { try { BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; model.call_index = txtName.Text.Trim(); if (cbIsLock.Checked == true) { model.is_lock = 1; } if (model.is_sys == 0) { int parentId = int.Parse(ddlParentId.SelectedValue); //如果选择的父ID不是自己,则更改 if (parentId != model.id) { model.parent_id = parentId; } } model.link_url = txtLinkUrl.Text.Trim(); model.content = txtRemark.Text; //添加操作权限类型 string action_type_str = string.Empty; for (int i = 0; i < cblActionType.Items.Count; i++) { if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value)) { action_type_str += cblActionType.Items[i].Value + ","; } } model.action_type = Utils.DelLastComma(action_type_str); if (bll.Update(model)) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "修改导航信息:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
protected string get_menu() { StringBuilder sb = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "parent_id=0 and is_lock=0", "sort_id asc,id desc").Tables[0]; if (dt.Rows != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<li class=\"topMenuIco_" + (i + 1) + "\"><a href=\"Left.aspx?type=" + dt.Rows[i]["id"] + "\" target=\"leftFrame\">" + dt.Rows[i]["title"] + "</a></li>"); } } return sb.ToString(); }
/// <summary> /// 获取菜单项 /// </summary> /// <returns></returns> public static string GetMenuAndChildLstByFidAndId(int Fid, int id) { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); //一级菜单 DataTable dt = bll.GetList(-1, " parent_id=" + Fid + " and is_lock=0 and model_id<5 ", "sort_id").Tables[0]; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string classStr = string.Empty; if (id == Convert.ToInt32(dt.Rows[i]["id"])) { classStr = "class=\"changechild\""; } //二级菜单 DataTable dtChild = bll.GetLists(Convert.ToInt32(dt.Rows[i]["id"]), " parent_id=" + dt.Rows[i]["id"] + " and is_lock=0 and id not in(221,147,154,206,207,251,252,253,254,257) and model_id<5"); if (dtChild.Rows.Count > 0) { rStr.Append(" <li " + classStr + " id=\"child" + dt.Rows[i]["id"] + "\"> <div> <a><b>"); rStr.Append(dt.Rows[i]["title"]); rStr.Append(" </b> <span class=\"arrow up\"></span></a></div>"); rStr.Append("<ul class=\"body_int_gk_li_div\" style=\"display: block;\">"); } else { rStr.Append(" <li " + classStr + " id=\"child" + dt.Rows[i]["id"] + "\"> <a href=\"" + dt.Rows[i]["link_url"] + "?id=" + dt.Rows[i]["id"] + "\">"); rStr.Append(dt.Rows[i]["title"]); rStr.Append(" </a>"); } int numChild = 1; for (int ic = 0; ic < dtChild.Rows.Count; ic++) { rStr.Append("<li><a id=\"child" + numChild + "\" href=\"" + dtChild.Rows[ic]["link_url"]); rStr.Append("?id=" + dtChild.Rows[ic]["id"] + "\">" + dtChild.Rows[ic]["title"].ToString() + "</a></li>"); numChild++; } if (dtChild.Rows.Count > 0) { rStr.Append("</ul>"); } rStr.Append("</li>"); } } return(rStr.ToString()); }
protected string get_menu() { StringBuilder sb = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "parent_id=0 and is_lock=0", "sort_id asc,id desc").Tables[0]; if (dt.Rows != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<li class=\"topMenuIco_" + (i + 1) + "\"><a href=\"Left.aspx?type=" + dt.Rows[i]["id"] + "\" target=\"leftFrame\">" + dt.Rows[i]["title"] + "</a></li>"); } } return(sb.ToString()); }
/// <summary> /// 第一级栏目ID public int ParentID(int category_id) { int _pid = 0; BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "class_list like '%," + category_id + ",%'", "class_layer asc, sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { string _class_list = dt.Rows[0]["class_list"].ToString(); string[] arr = _class_list.Replace(",1,", "").Trim(',').ToString().Split(','); if (arr.Length > 0) { _pid = Convert.ToInt32(arr[0]); } } return _pid; }
protected static string column_menu(int category_id) { string menu = ""; string class_list = new BLL.contents.article_category().GetModel(category_id).class_list.Trim(','); string[] arr = class_list.Split(','); if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { string style = arr.Length == (i + 1) ? "" : " > "; menu += new BLL.contents.article_category().GetTitle(Convert.ToInt32(arr[i])) + style; } } return(menu.ToString()); }
/// <summary> //栏目样式调用 public bool Style(int category_id1, int category_id2) { bool result = false; BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "id=" + category_id2, "sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { string _class_list = dt.Rows[0]["class_list"].ToString(); if (_class_list.IndexOf("," + category_id1 + ",") > 0) { result = true; } } return(result); }
//删除导航 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("app_navigation_list", OSEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.contents.article_category bll = new BLL.contents.article_category(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } AddAdminLog(OSEnums.ActionEnum.Delete.ToString(), "删除导航信息"); //记录日志 Response.Redirect("nav_list.aspx"); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("app_navigation_list", OSEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.contents.article_category bll = new BLL.contents.article_category(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "保存导航排序"); //记录日志 Response.Redirect("nav_list.aspx"); }
/// <summary> /// 第一级栏目ID public int ParentID(int category_id) { int _pid = 0; BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "class_list like '%," + category_id + ",%'", "class_layer asc, sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { string _class_list = dt.Rows[0]["class_list"].ToString(); string[] arr = _class_list.Replace(",1,", "").Trim(',').ToString().Split(','); if (arr.Length > 0) { _pid = Convert.ToInt32(arr[0]); } } return(_pid); }
private bool DoAdd() { try { Model.contents.article_category model = new Model.contents.article_category(); BLL.contents.article_category bll = new BLL.contents.article_category(); model.nav_type = OSEnums.NavigationEnum.System.ToString().Trim();; model.title = txtTitle.Text.Trim(); model.channel_id = -1; model.call_index = txtName.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.content = txtRemark.Text; model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.parent_id = int.Parse(ddlParentId.SelectedValue); //添加操作权限类型 string action_type_str = string.Empty; for (int i = 0; i < cblActionType.Items.Count; i++) { if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value)) { action_type_str += cblActionType.Items[i].Value + ","; } } model.action_type = Utils.DelLastComma(action_type_str); if (bll.Add(model) > 0) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加导航信息:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
protected static string page_menu(int category_id) { string menu = ""; string class_list = new BLL.contents.article_category().GetModel(category_id).class_list.Trim(','); string[] arr = class_list.Split(','); int loop = 0; if (arr.Length > 0) { foreach (string i in arr) { loop++; string style = loop == arr.Length ? "" : " <i class=\"arrow\"></i> "; menu += new BLL.contents.article_category().GetTitle(Convert.ToInt32(i)) + style; } } return(menu.ToString()); }
/// <summary> /// 返回面包屑 public string ChannelMenu(int category_id,string _str) { StringBuilder sb = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "id=" + category_id, "sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { string _class_list = dt.Rows[0]["class_list"].ToString(); string[] arr = _class_list.Replace(",1,", "").Trim(',').ToString().Split(','); if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { sb.Append("" + _str + "<a href=\"" + Url(Convert.ToInt32(arr[i])) + "\">" + bll.GetTitle(Convert.ToInt32(arr[i])) + "</a>"); } } } return sb.ToString(); }
/// <summary> /// 获取菜单项 /// </summary> /// <returns></returns> public static string GetMenuAndChildLst() { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); //一级菜单 DataTable dt = bll.GetList(-1, " parent_id=1 and is_lock=0 and model_id<5 ", "sort_id").Tables[0]; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append(" <li id=\"menu" + dt.Rows[i]["id"] + "\"> <span class=\"nav_span_f\"><a href=\"" + dt.Rows[i]["link_url"] + "\">"); rStr.Append(dt.Rows[i]["title"]); rStr.Append(" </span></a>"); //二级菜单 DataTable dtChild = bll.GetLists(Convert.ToInt32(dt.Rows[i]["id"]), " parent_id=" + dt.Rows[i]["id"] + " and is_lock=0 and id not in(96,97,121,122,128,129,130) and model_id<5"); if (dtChild.Rows.Count > 0) { rStr.Append("<div>"); } for (int ic = 0; ic < dtChild.Rows.Count; ic++) { if (dtChild.Rows[ic]["id"].ToString().Trim() == "167") { rStr.Append("<a id=\"child" + dtChild.Rows[ic]["id"] + "\" target=\"_blank\" href=\"" + dtChild.Rows[ic]["link_url"]); } else { rStr.Append("<a id=\"child" + dtChild.Rows[ic]["id"] + "\" href=\"" + dtChild.Rows[ic]["link_url"]); } rStr.Append("?id=" + dtChild.Rows[ic]["id"] + "\"><span>" + dtChild.Rows[ic]["title"].ToString() + "</span></a>"); } if (dtChild.Rows.Count > 0) { rStr.Append("</div>"); } rStr.Append("</li>"); } } return(rStr.ToString()); }
private void ShowInfo(DropDownList ddl) { //BLL.carts.orders bll = new BLL.carts.orders(); //Model.carts.orders model = bll.GetModel(_order_no); //BLL.carts.express bll2 = new BLL.carts.express(); //DataTable dt = bll2.GetList("").Tables[0]; //ddlExpressId.Items.Clear(); //ddlExpressId.Items.Add(new ListItem("请选择配送方式", "")); //foreach (DataRow dr in dt.Rows) //{ // ddlExpressId.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString())); //} //txtExpressNo.Text = model.express_no; //ddlExpressId.SelectedValue = model.express_id.ToString(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetLists(1, "channel_id>0 "); ddl.Items.Clear(); ddl.Items.Add(new ListItem(siteConfig.webname, "1")); 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 == 2) { ddl.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; ddl.Items.Add(new ListItem(Title, Id)); } } }
/// <summary> /// 返回面包屑 public string ChannelMenu(int category_id, string _str) { StringBuilder sb = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "id=" + category_id, "sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { string _class_list = dt.Rows[0]["class_list"].ToString(); string[] arr = _class_list.Replace(",1,", "").Trim(',').ToString().Split(','); if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { sb.Append("" + _str + "<a href=\"" + Url(Convert.ToInt32(arr[i])) + "\">" + bll.GetTitle(Convert.ToInt32(arr[i])) + "</a>"); } } } return(sb.ToString()); }
private void delete_category(HttpContext context) { //取得管理员登录信息 Model.managers.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo(); if (adminInfo == null) { context.Response.Write("{\"status\": 0, \"msg\": \"未登录或已超时,请重新登录!\"}"); return; } int category_id = OSRequest.GetQueryInt("category_id"); if (category_id == 0) { context.Response.Write("{\"status\": 0, \"msg\": \"参数错误!\"}"); return; } BLL.contents.article_category bll = new BLL.contents.article_category(); new BLL.managers.manager_log().Add(adminInfo.id, adminInfo.user_name, OSEnums.ActionEnum.Edit.ToString(), "删除栏目:" + bll.GetTitle(category_id)); //记录日志 bll.Delete(category_id); context.Response.Write("{\"status\": 1, \"msg\": \"栏目删除成功!\"}"); }
/// <summary> /// 获取菜单项 /// </summary> /// <returns></returns> public static string GetMenuLst() { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); //一级菜单 DataTable dt = bll.GetLists(1, " parent_id=1 and is_lock=0 "); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append(" <li><a id=\"menu" + dt.Rows[i]["id"] + "\" class=\"\" href=\"" + dt.Rows[i]["link_url"] + "\">"); rStr.Append(dt.Rows[i]["title"]); rStr.Append("</a></li>"); } num++; } return(rStr.ToString()); }
public static string GetMenuChildUrl(int cid) { BLL.contents.article_category bll = new BLL.contents.article_category(); int id = bll.GetParentId(cid); StringBuilder rStr = new StringBuilder(); DataTable dt = bll.GetChildList(id, 6); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToInt32(dt.Rows[i]["id"]) == cid) { rStr.Append(GetPageNameUrl(Convert.ToInt32(dt.Rows[i]["id"]))); rStr.Append("?IdF=" + dt.Rows[i]["parent_id"] + "&id=" + dt.Rows[i]["id"] + "&mId=" + num); } num++; } } return(rStr.ToString()); }
/// <summary> /// 获取二级菜单English /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetMenuChild_En(int id) { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetChildList(id, 6); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i]["link_url"].ToString())) { rStr.Append("<dd><a id=\"child" + num + "\" href=\"" + dt.Rows[i]["link_url"]); rStr.Append("?IdF=" + dt.Rows[i]["parent_id"] + "&id=" + dt.Rows[i]["id"] + "&mId=" + num + "\"><i>></i>" + dt.Rows[i]["title"].ToString() + "</a></dd>"); num++; } } } return(rStr.ToString()); }
protected string menus(int category_id) { string menu = ""; Model.contents.article_category model = new BLL.contents.article_category().GetModel(category_id); if (model != null) { string class_list = model.class_list.Trim(','); string[] arr = class_list.Split(','); int loop = 0; if (arr.Length > 0) { foreach (string i in arr) { loop++; string style = loop == arr.Length ? "" : " > "; if (loop != 1) { menu += new BLL.contents.article_category().GetTitle(Convert.ToInt32(i)) + style; } } } } return menu.ToString(); }
/// <summary> /// 获取菜单项 /// </summary> /// <returns></returns> public static string GetMenuLst() { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); //一级菜单 DataTable dt = bll.GetLists(1, " parent_id=1 and is_lock=0 "); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append(" <li><a id=\"menu" + dt.Rows[i]["id"] + "\" class=\"\" href=\"" + dt.Rows[i]["link_url"] + "\">"); rStr.Append(dt.Rows[i]["title"]); rStr.Append("</a></li>"); } num++; } return rStr.ToString(); }
/// <summary> /// 获取菜单项 /// </summary> /// <returns></returns> public static string GetMenuLstOfPhone() { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); //一级菜单 DataTable dt = bll.GetLists(1, " parent_id=1 and is_lock=0 "); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { switch (Convert.ToInt32(dt.Rows[i]["id"])) { case 123: rStr.Append(" <li ><a href=\"index.aspx\">"); break; case 129: rStr.Append(" <li ><a href=\"jqg.aspx?fId=" + dt.Rows[i]["id"] + "&cId=137\">"); break; case 134: rStr.Append(" <li ><a href=\"jqg.aspx?fId=" + dt.Rows[i]["id"] + "&cId=135\">"); break; default: rStr.Append(" <li ><a href=\"jqg.aspx?fId=" + dt.Rows[i]["id"] + "&cId=" + dt.Rows[i]["id"] + "\">"); break; } rStr.Append(dt.Rows[i]["title"]); rStr.Append("<i></i></a></li>"); } } return rStr.ToString(); }
/// <summary> /// 根据视图获得查询分页数据 /// </summary> public DataSet GetList(string channel_name, int category_id, int pageIndex, string strWhere, string filedOrder, out int recordCount, out int pageSize) { pageSize = new BLL.contents.article_category().GetModel(category_id).page_size; //自动获得频道分页数量 return dal.GetList(channel_name, category_id, pageSize, pageIndex, strWhere, filedOrder, out recordCount); }
/// <summary> /// 加载名称+Url /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetPageNameUrl(int id) { string rStr = string.Empty; BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(id); if (model != null) { rStr = "<a href=\"" + model.link_url + "\">" + model.title + "</a>"; } return rStr; }
public static string GetMenuChildUrl(int cid) { BLL.contents.article_category bll = new BLL.contents.article_category(); int id = bll.GetParentId(cid); StringBuilder rStr = new StringBuilder(); DataTable dt = bll.GetChildList(id, 6); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToInt32(dt.Rows[i]["id"]) == cid) { rStr.Append(GetPageNameUrl(Convert.ToInt32(dt.Rows[i]["id"]))); rStr.Append("?IdF=" + dt.Rows[i]["parent_id"] + "&id=" + dt.Rows[i]["id"] + "&mId=" + num); } num++; } } return rStr.ToString(); }
/// <summary> /// 获取二级菜单English /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetMenuChild_En(int id) { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetChildList(id, 6); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i]["link_url"].ToString())) { rStr.Append("<dd><a id=\"child" + num + "\" href=\"" + dt.Rows[i]["link_url"]); rStr.Append("?IdF=" + dt.Rows[i]["parent_id"] + "&id=" + dt.Rows[i]["id"] + "&mId=" + num + "\"><i>></i>" + dt.Rows[i]["title"].ToString() + "</a></dd>"); num++; } } } return rStr.ToString(); }
/// <summary> /// 获取二级菜单 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetMenuChild(int id) { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetChildList(id, 6); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append("<li class=\"li" + num + "\">"); rStr.Append("<a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">"); rStr.Append(dt.Rows[i]["title"].ToString()); rStr.Append("</a>"); rStr.Append("</li>"); num++; } } return rStr.ToString(); }
private bool DoEdit(int _id) { try { BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; model.call_index = txtName.Text.Trim(); if (cbIsLock.Checked == true) { model.is_lock = 1; } if (model.is_sys == 0) { int parentId = int.Parse(ddlParentId.SelectedValue); //如果选择的父ID不是自己,则更改 if (parentId != model.id) { model.parent_id = parentId; } } model.link_url = txtLinkUrl.Text.Trim(); model.content = txtRemark.Text; //添加操作权限类型 string action_type_str = string.Empty; for (int i = 0; i < cblActionType.Items.Count; i++) { if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value)) { action_type_str += cblActionType.Items[i].Value + ","; } } model.action_type = Utils.DelLastComma(action_type_str); if (bll.Update(model)) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "修改导航信息:" + model.title); //记录日志 return true; } } catch { return false; } return false; }
/// <summary> /// 栏目URL public string Url(int category_id) { string _url = string.Empty; BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "class_list like '%," + category_id + ",%'", "class_layer desc, sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { if (!string.IsNullOrEmpty(dt.Rows[0]["link_url"].ToString())) { _url = dt.Rows[0]["link_url"].ToString(); } else { if (bll.GetModel(category_id).model_id != 0) { string _key1 = BasePage.pageUrl(bll.GetModel(category_id).model_id); _url = new BasePage().linkurl(_key1, category_id); } else { string _key = BasePage.pageUrl(Convert.ToInt32(dt.Rows[0]["model_id"])); string _category_id = dt.Rows[0]["id"].ToString(); _url = new BasePage().linkurl(_key, _category_id); } } } return _url.ToString(); }
private void NavBind() { BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetLists(0, ""); this.rptList.DataSource = dt; this.rptList.DataBind(); }
protected static string page_menu(int category_id) { string menu = ""; string class_list = new BLL.contents.article_category().GetModel(category_id).class_list.Trim(','); string[] arr = class_list.Split(','); int loop = 0; if (arr.Length > 0) { foreach (string i in arr) { loop++; string style = loop == arr.Length ? "" : " <i class=\"arrow\"></i> "; menu += new BLL.contents.article_category().GetTitle(Convert.ToInt32(i)) + style; } } return menu.ToString(); }
/// <summary> /// 获取Foot菜单项 /// </summary> /// <returns></returns> public static string GetMenuFootLst() { StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetLists(1, " parent_id=1 and id!=91 and is_lock=0 "); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { rStr.Append("<dl>"); rStr.Append(" <dt><a href=\"" + dt.Rows[i]["link_url"] + "\">"); rStr.Append(dt.Rows[i]["title"]); DataTable dtChild = bll.GetLists(Convert.ToInt32(dt.Rows[i]["id"]), " parent_id=" + dt.Rows[i]["id"] + " and is_lock=0 "); int numChild = 1; for (int ic = 0; ic < dtChild.Rows.Count; ic++) { rStr.Append("<dd>"); rStr.Append("<a id=\"child" + numChild + "\" href=\"" + dtChild.Rows[ic]["link_url"]); rStr.Append("?IdF=" + dtChild.Rows[ic]["parent_id"] + "&id=" + dtChild.Rows[ic]["id"] + "&mId=" + numChild + "\">" + dtChild.Rows[ic]["title"].ToString() + "</a>"); numChild++; rStr.Append("</dd>"); } rStr.Append("</a></dt>"); rStr.Append("</dl>"); num++; } } return rStr.ToString(); }
private bool DoAdd() { try { Model.contents.article_category model = new Model.contents.article_category(); BLL.contents.article_category bll = new BLL.contents.article_category(); model.nav_type = OSEnums.NavigationEnum.System.ToString().Trim();; model.title = txtTitle.Text.Trim(); model.channel_id = -1; model.call_index = txtName.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.content = txtRemark.Text; model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.parent_id = int.Parse(ddlParentId.SelectedValue); //添加操作权限类型 string action_type_str = string.Empty; for (int i = 0; i < cblActionType.Items.Count; i++) { if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value)) { action_type_str += cblActionType.Items[i].Value + ","; } } model.action_type = Utils.DelLastComma(action_type_str); if (bll.Add(model) > 0) { AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加导航信息:" + model.title); //记录日志 return true; } } catch { return false; } return false; }
private void ShowInfo(int _id) { BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(_id); ddlParentId.SelectedValue = model.parent_id.ToString(); txtSortId.Text = model.sort_id.ToString(); if (model.is_lock == 1) { cbIsLock.Checked = true; } ddlParentId.Enabled = false; if (model.nav_type.Trim() == "WebSite") { txtTitle.Enabled = false; style = " style=\"display:none\""; } txtTitle.Text = model.title; txtName.Text = model.call_index; txtName.Attributes.Add("ajaxurl", "../../ashx/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.call_index)); txtName.Focus(); //设置焦点,防止JS无法提交 txtLinkUrl.Text = model.link_url; txtRemark.Text = model.content; //赋值操作权限类型 string[] actionTypeArr = model.action_type.Split(','); for (int i = 0; i < cblActionType.Items.Count; i++) { for (int n = 0; n < actionTypeArr.Length; n++) { if (actionTypeArr[n].ToLower() == cblActionType.Items[i].Value.ToLower()) { cblActionType.Items[i].Selected = true; } } } }
private bool DoEdit(int _id) { try { BLL.contents.article_category bll = new BLL.contents.article_category(); Model.contents.article_category model = bll.GetModel(_id); int parentId = int.Parse(ddlParentId.SelectedValue); model.channel_id = this.channel_id; model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); //如果选择的父ID不是自己,则更改 //if (parentId != model.id) //{ // model.parent_id = parentId; //} model.sort_id = int.Parse(txtSortId.Text.Trim()); model.seo_title = txtSeoTitle.Text; model.seo_keywords = txtSeoKeywords.Text; model.seo_description = txtSeoDescription.Text; model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.content = txtContent.Value; model.model_id = int.Parse(rblStatus.SelectedValue); model.is_add_category = 0; model.is_add_content = 0; model.is_show_top = 0; model.is_show_foot = 0; if (cblItem.Items[0].Selected == true) { model.is_add_category = 1; } if (cblItem.Items[1].Selected == true) { model.is_add_content = 1; } if (cblItem.Items[2].Selected == true) { model.is_show_top = 1; } if (cblItem.Items[3].Selected == true) { model.is_show_foot = 1; } if (cbIsAlbums.Checked == true) { model.is_albums = 1; } if (cbIsAttach.Checked == true) { model.is_attach = 1; } model.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10); //添加频道扩展字段 List<Model.contents.category_field> ls = new List<Model.contents.category_field>(); for (int i = 0; i < cblAttributeField.Items.Count; i++) { if (cblAttributeField.Items[i].Selected) { ls.Add(new Model.contents.category_field { category_id = model.id, field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0) }); } } model.category_fields = ls; if (bll.Update(model)) { AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道栏目分类:" + model.title); //记录日志 return true; } } catch { return false; } return false; }
/// <summary> /// 获取二级菜单 /// </summary> /// <param name="id"></param> /// <returns></returns> public static string GetMenuChildById(int id) { if (id == 123) { return string.Empty; } StringBuilder rStr = new StringBuilder(); BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetChildList(id, 6); if (dt != null && dt.Rows.Count > 0) { int num = 1; for (int i = 0; i < dt.Rows.Count; i++) { if (i < 3) { rStr.Append("<li class=\"li" + num + "\">"); rStr.Append("<a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">"); rStr.Append(dt.Rows[i]["title"].ToString()); rStr.Append("</a>"); rStr.Append("</li>"); } else { if (i == 3) { rStr.Append("<li><a id=\"a\" href=\"#\">更多</a></li>"); rStr.Append(" <ul id=\"ul1\" class=\"dis\">"); rStr.Append(" <li><a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">" + dt.Rows[i]["title"] + "</a></li>"); } else if (i == dt.Rows.Count - 1) { rStr.Append("<li><a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">" + dt.Rows[i]["title"] + "</a></li>"); rStr.Append("</ul>"); } else { rStr.Append("<li><a href=\"" + dt.Rows[i]["link_url"] + "?fId=" + dt.Rows[i]["parent_id"] + "&cId=" + dt.Rows[i]["id"] + "\">" + dt.Rows[i]["title"] + "</a></li>"); } } if (i < dt.Rows.Count - 1) { rStr.Append("| "); } num++; } } return rStr.ToString(); }
protected static string column_menu(int category_id) { string menu = ""; string class_list = new BLL.contents.article_category().GetModel(category_id).class_list.Trim(','); string[] arr = class_list.Split(','); if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { string style = arr.Length == (i + 1) ? "" : " > "; menu += new BLL.contents.article_category().GetTitle(Convert.ToInt32(arr[i])) + style; } } return menu.ToString(); }
/// <summary> //栏目样式调用 public bool Style(int category_id1,int category_id2) { bool result = false; BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0, "id="+category_id2, "sort_id asc,id desc").Tables[0]; if (dt.Rows.Count > 0 && dt.Rows != null) { string _class_list = dt.Rows[0]["class_list"].ToString(); if(_class_list.IndexOf(","+category_id1+",")>0) { result = true; } } return result; }
private void TreeBind() { BLL.contents.article_category bll = new BLL.contents.article_category(); DataTable dt = bll.GetList(0,"","sort_id asc,id desc").Tables[0]; 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)); } } }