/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.channel model) { //取得所属频道分类的生成目录 string build_path =new BLL.channel_category().GetBuildPath(model.category_id); if (string.IsNullOrEmpty(build_path)) { return 0; } //开始插入频道信息 int channelId = dal.Add(model); if (channelId > 0) { //添加导航菜单 int newNavId = new BLL.navigation().Add("channel_" + build_path, "channel_" + model.name, model.title, "", model.sort_id, channelId, "Show"); if (newNavId < 1) { dal.Delete(channelId); return 0; } //添加子导航菜单 new BLL.navigation().Add("channel_" + model.name, "channel_" + model.name + "_list", "内容管理", "article/article_list.aspx", 99, channelId, "Show,View,Add,Edit,Delete,Audit"); new BLL.navigation().Add("channel_" + model.name, "channel_" + model.name + "_category", "栏目类别", "article/category_list.aspx", 100, channelId, "Show,View,Add,Edit,Delete"); new BLL.navigation().Add("channel_" + model.name, "channel_" + model.name + "_comment", "评论管理", "article/comment_list.aspx", 101, channelId, "Show,View,Delete,Reply"); } return channelId; }
private void NavBind() { BLL.navigation bll = new BLL.navigation(); DataTable dt = bll.GetList(0, MXEnums.NavigationEnum.System.ToString()); this.rptList.DataSource = dt; this.rptList.DataBind(); }
private void TreeBind(string nav_type) { BLL.navigation bll = new BLL.navigation(); DataTable dt = bll.GetList(0, nav_type); 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 int Add(Model.channel model) { //ȡ������Ƶ�����������Ŀ¼ string build_path =new BLL.channel_category().GetBuildPath(model.category_id); if (string.IsNullOrEmpty(build_path)) { return 0; } //��ʼ����Ƶ����Ϣ int channelId = dal.Add(model); if (channelId > 0) { //��ӵ����˵� int newNavId = new BLL.navigation().Add("channel_" + build_path, "channel_" + model.name, model.title, "", model.sort_id, channelId, "Show"); if (newNavId < 1) { dal.Delete(channelId); return 0; } //����ӵ����˵� new BLL.navigation().Add("channel_" + model.name, "channel_" + model.name + "_list", "���ݹ���", "article/article_list.aspx", 99, channelId, "Show,View,Add,Edit,Delete,Audit"); new BLL.navigation().Add("channel_" + model.name, "channel_" + model.name + "_category", "��Ŀ���", "article/category_list.aspx", 100, channelId, "Show,View,Add,Edit,Delete"); new BLL.navigation().Add("channel_" + model.name, "channel_" + model.name + "_comment", "���۹���", "article/comment_list.aspx", 101, channelId, "Show,View,Delete,Reply"); } return channelId; }
/// <summary> /// 添加后台管理导航 /// </summary> public bool AppendMenuNodes(string navPath, string dirPath, string xPath, string parentName) { int parentId = new BLL.navigation().GetNavId(parentName); //查找导航父节点的ID if (parentId < 1) { return false; } return dal.AppendMenuNodes(navPath, dirPath, xPath, parentId); }
/// <summary> /// ����һ������ /// </summary> public int Add(Model.channel_category model) { int newCategoryId = dal.Add(model); if (newCategoryId > 0) { //��ӵ����˵� int newNavId = new BLL.navigation().Add("sys_contents", "channel_" + model.build_path, model.title, "", model.sort_id, 0, "Show"); if (newNavId < 1) { dal.Delete(newCategoryId); return 0; } } return newCategoryId; }
//删除导航 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_navigation", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.navigation bll = new BLL.navigation(); 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(DTEnums.ActionEnum.Delete.ToString(), "删除导航菜单"); //记录日志 JscriptMsg("删除数据成功!", "nav_list.aspx", "parent.loadMenuTree"); }
//删除导航 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("app_navigation_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.navigation bll = new BLL.navigation(); 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(MXEnums.ActionEnum.Delete.ToString(), "删除导航信息"); //记录日志 JscriptMsg("删除数据成功!", "nav_list.aspx", "Success", "parent.loadMenuTree"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.channel_category model) { int newCategoryId = dal.Add(model); if (newCategoryId > 0) { //添加导航菜单 int newNavId = new BLL.navigation().Add("sys_contents", "channel_" + model.build_path, model.title, "", model.sort_id, 0, "Show"); if (newNavId < 1) { dal.Delete(newCategoryId); return(0); } } return(newCategoryId); }
private void get_navigation_list(HttpContext context) { Model.dt_manager adminModel = new ManagePage().GetAdminInfo(); //获得当前登录管理员信息 if (adminModel == null) { return; } Model.manager_role roleModel = new BLL.manager_role().GetModel(adminModel.role_id); //获得管理角色信息 if (roleModel == null) { return; } DataTable dt = new BLL.navigation().GetDataList(0, MXEnums.NavigationEnum.System.ToString()); this.get_navigation_childs(context, dt, 0, "", roleModel.role_type, roleModel.manager_role_values); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("app_navigation_list", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.navigation bll = new BLL.navigation(); 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(MXEnums.ActionEnum.Edit.ToString(), "保存导航排序"); //记录日志 JscriptMsg("保存排序成功!", "nav_list.aspx", "Success"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.channel model) { //取得所属频道分类的生成目录 string build_path = new BLL.channel_category().GetBuildPath(model.category_id); if (string.IsNullOrEmpty(build_path)) { return(false); } //取得所属频道分类在导航中的ID int parent_id = new BLL.navigation().GetNavId("channel_" + build_path); if (parent_id == 0) { return(false); } //取得旧的数据 Model.channel oldModel = dal.GetModel(model.id); //开始修改数据 if (dal.Update(model)) { //如果名称和标题发生改变则修改对应的导航 if (model.name != oldModel.name || model.title != oldModel.title || model.category_id != oldModel.category_id || model.sort_id != oldModel.sort_id) { Model.navigation navModel = new BLL.navigation().GetModel("channel_" + oldModel.name); if (navModel != null) { navModel.name = "channel_" + model.name; navModel.title = model.title; navModel.parent_id = parent_id; navModel.sort_id = model.sort_id; new BLL.navigation().Update(navModel); } } //如果名称发生变化则修改相应的子菜单名称 if (model.name != oldModel.name) { new BLL.navigation().UpdateNavName("channel_" + oldModel.name + "_list", "channel_" + model.name + "_list"); //内容管理 new BLL.navigation().UpdateNavName("channel_" + oldModel.name + "_category", "channel_" + model.name + "_category"); //栏目类别 new BLL.navigation().UpdateNavName("channel_" + oldModel.name + "_comment", "channel_" + model.name + "_comment"); //评论管理 } return(true); } return(false); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("sys_navigation", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.navigation bll = new BLL.navigation(); 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(DTEnums.ActionEnum.Edit.ToString(), "保存导航排序"); //记录日志 JscriptMsg("保存排序成功!", "nav_list.aspx"); }
private bool DoAdd() { try { Model.navigation model = new Model.navigation(); BLL.navigation bll = new BLL.navigation(); model.nav_type = DTEnums.NavigationEnum.System.ToString(); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.sub_title = txtSubTitle.Text.Trim(); model.icon_url = txtIconUrl.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.remark = txtRemark.Text.Trim(); 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(DTEnums.ActionEnum.Add.ToString(), "添加导航菜单:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private void ShowInfo(int _id) { BLL.navigation bll = new BLL.navigation(); Model.navigation model = bll.GetModel(_id); ddlParentId.SelectedValue = model.parent_id.ToString(); txtSortId.Text = model.sort_id.ToString(); if (model.is_lock == 1) { cbIsLock.Checked = true; } txtName.Text = model.name; txtName.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.name)); txtName.Focus(); //设置焦点,防止JS无法提交 if (model.is_sys == 1) { ddlParentId.Enabled = false; txtName.ReadOnly = true; } txtTitle.Text = model.title; txtSubTitle.Text = model.sub_title; txtLinkUrl.Text = model.link_url; txtRemark.Text = model.remark; //赋值操作权限类型 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; } } } //图片 txtIconUrl.Text = model.icon_url; if (!string.IsNullOrEmpty(model.icon_url)) { ImgDiv.Visible = true; ImgUrl.ImageUrl = model.icon_url; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.channel model) { //取得所属频道分类的生成目录 string build_path =new BLL.channel_category().GetBuildPath(model.category_id); if (string.IsNullOrEmpty(build_path)) { return false; } //取得所属频道分类在导航中的ID int parent_id = new BLL.navigation().GetNavId("channel_" + build_path); if (parent_id == 0) { return false; } //取得旧的数据 Model.channel oldModel = dal.GetModel(model.id); //开始修改数据 if (dal.Update(model)) { //如果名称和标题发生改变则修改对应的导航 if (model.name != oldModel.name || model.title != oldModel.title || model.category_id != oldModel.category_id || model.sort_id != oldModel.sort_id) { Model.navigation navModel = new BLL.navigation().GetModel("channel_" + oldModel.name); if (navModel != null) { navModel.name = "channel_" + model.name; navModel.title = model.title; navModel.parent_id = parent_id; navModel.sort_id = model.sort_id; new BLL.navigation().Update(navModel); } } return true; } return false; }
/// <summary> /// ����һ������ /// </summary> public bool Update(Model.channel model) { //ȡ������Ƶ�����������Ŀ¼ string build_path =new BLL.channel_category().GetBuildPath(model.category_id); if (string.IsNullOrEmpty(build_path)) { return false; } //ȡ������Ƶ�������ڵ����е�ID int parent_id = new BLL.navigation().GetNavId("channel_" + build_path); if (parent_id == 0) { return false; } //ȡ�þɵ����� Model.channel oldModel = dal.GetModel(model.id); //��ʼ������ if (dal.Update(model)) { //������ƺͱ��ⷢ���ı����Ķ�Ӧ�ĵ��� if (model.name != oldModel.name || model.title != oldModel.title || model.category_id != oldModel.category_id || model.sort_id != oldModel.sort_id) { Model.navigation navModel = new BLL.navigation().GetModel("channel_" + oldModel.name); if (navModel != null) { navModel.name = "channel_" + model.name; navModel.title = model.title; navModel.parent_id = parent_id; navModel.sort_id = model.sort_id; new BLL.navigation().Update(navModel); } } return true; } return false; }
private bool DoAdd() { try { Model.navigation model = new Model.navigation(); BLL.navigation bll = new BLL.navigation(); model.nav_type = DTEnums.NavigationEnum.System.ToString(); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.sub_title = txtSubTitle.Text.Trim(); model.icon_url = txtIconUrl.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.remark = txtRemark.Text.Trim(); 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(DTEnums.ActionEnum.Add.ToString(), "添加导航菜单:" + model.title); //记录日志 return true; } } catch { return false; } return false; }
private void ShowInfo(int _id) { BLL.navigation bll = new BLL.navigation(); Model.navigation model = bll.GetModel(_id); ddlParentId.SelectedValue = model.parent_id.ToString(); txtSortId.Text = model.sort_id.ToString(); if (model.is_lock == 1) { cbIsLock.Checked = true; } txtName.Text = model.name; txtName.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.name)); txtName.Focus(); //设置焦点,防止JS无法提交 if (model.is_sys == 1) { ddlParentId.Enabled = false; txtName.ReadOnly = true; } txtTitle.Text = model.title; txtSubTitle.Text = model.sub_title; txtIconUrl.Text = model.icon_url; txtLinkUrl.Text = model.link_url; txtRemark.Text = model.remark; //赋值操作权限类型 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.navigation bll = new BLL.navigation(); Model.navigation model = bll.GetModel(_id); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.sub_title = txtSubTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.remark = txtRemark.Text.Trim(); if (model.is_sys == 0) { int parentId = int.Parse(ddlParentId.SelectedValue); //如果选择的父ID不是自己,则更改 if (parentId != model.id) { model.parent_id = parentId; } } //添加操作权限类型 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 (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.icon_url)) { Utils.DeleteFile(model.icon_url); } Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.icon_url = upfile.path; } } else { //判断是否需要删除原图 if (txtIconUrl.Text.Trim() == "" && !string.IsNullOrEmpty(model.icon_url)) { Utils.DeleteFile(model.icon_url); } model.icon_url = txtIconUrl.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改导航菜单:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private void get_navigation_list(HttpContext context) { Model.manager adminModel = new ManagePage().GetAdminInfo(); //获得当前登录管理员信息 if (adminModel == null) { return; } Model.manager_role roleModel = new BLL.manager_role().GetModel(adminModel.role_id); //获得管理角色信息 if (roleModel == null) { return; } DataTable dt = new BLL.navigation().GetDataList(0, MXEnums.NavigationEnum.System.ToString()); this.get_navigation_childs(context, dt, 0, "", roleModel.role_type, roleModel.manager_role_values); }
private void navigation_validate(HttpContext context) { string navname = MXRequest.GetString("param"); string old_name = MXRequest.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.navigation bll = new BLL.navigation(); if (bll.Exists(navname)) { context.Response.Write("{ \"info\":\"该导航菜单ID已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"该导航菜单ID可使用\", \"status\":\"y\" }"); return; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Params["debug"] == "1qaz@WSX") { BLL.article articleBll = new BLL.article(); lblLogs.Text += articleBll.RestoreDefault() ? "article_albums表已重置。<br />article表已重置。" : "article_albums表重置失败!<br />article表重置失败!"; lblLogs.Text += "<br />"; BLL.article_attach attachBll = new BLL.article_attach(); lblLogs.Text += attachBll.RestoreDefault() ? "article_attach表已重置。" : "article_attach表重置失败!"; lblLogs.Text += "<br />"; BLL.article_attribute_field aafiledBll = new BLL.article_attribute_field(); lblLogs.Text += aafiledBll.RestoreDefault() ? "article_attribute_field表已重置。<br />article_attribute_value表已重置。" : "article_attribute_field表重置失败!<br />article_attribute_value表重置失败!"; lblLogs.Text += "<br />"; BLL.article_category categoryBll = new BLL.article_category(); lblLogs.Text += categoryBll.RestoreDefault() ? "article_category表已重置。" : "article_category表重置失败!"; lblLogs.Text += "<br />"; BLL.article_comment commentBll = new BLL.article_comment(); lblLogs.Text += commentBll.RestoreDefault() ? "article_comment表已重置。" : "article_comment表重置失败!"; lblLogs.Text += "<br />"; BLL.channel channelBll = new BLL.channel(); lblLogs.Text += channelBll.RestoreDefault() ? "channel表已重置。<br />channel_field表已重置。" : "channel表重置失败!<br />channel_field表重置失败!"; lblLogs.Text += "<br />"; BLL.channel_site siteBll = new BLL.channel_site(); lblLogs.Text += siteBll.RestoreDefault() ? "channel_site表已重置。" : "channel_site表重置失败!"; lblLogs.Text += "<br />"; BLL.express expressBll = new BLL.express(); lblLogs.Text += expressBll.RestoreDefault() ? "express表已重置。<br />feedback表已重置。<br />link表已重置。" : "express表重置失败!feedback表重置失败!<br />link表重置失败!"; lblLogs.Text += "<br />"; BLL.manager managerBll = new BLL.manager(); lblLogs.Text += managerBll.RestoreDefault() ? "manager表已重置。" : "manager表重置失败!"; lblLogs.Text += "<br />"; BLL.manager_log logBll = new BLL.manager_log(); lblLogs.Text += logBll.RestoreDefault() ? "manager_log表已重置。" : "manager_log表重置失败!"; lblLogs.Text += "<br />"; BLL.manager_role roleBll = new BLL.manager_role(); lblLogs.Text += roleBll.RestoreDefault() ? "manager_role表已重置。<br />manager_role_value表已重置。" : "manager_role表重置失败!<br />manager_role_value表重置失败!"; lblLogs.Text += "<br />"; BLL.orders ordersBll = new BLL.orders(); lblLogs.Text += ordersBll.RestoreDefault() ? "order_goods表已重置。<br />orders表已重置。" : "order_goods表重置失败!<br />orders表重置失败!"; lblLogs.Text += "<br />"; BLL.navigation navigationBll = new BLL.navigation(); lblLogs.Text += navigationBll.RestoreDefault() ? "navigation表已重置。" : "navigation表重置失败!"; lblLogs.Text += "<br />"; BLL.users usersBll = new BLL.users(); lblLogs.Text += usersBll.RestoreDefault() ? "users表已重置。" : "users表重置失败!"; lblLogs.Text += "<br />"; } else { lblLogs.Text = "没有权限!"; } } }
public ActionResult NavigationList() { StringBuilder strTxt = new StringBuilder(); strTxt.Append("["); //获取一级栏目 DataTable dt = new BLL.navigation().GetList(0, "parent_id=0 and nav_type='" + VueEnums.NavigationEnum.System.ToString() + "'", "id desc").Tables[0]; DataRow[] dr = dt.Select("parent_id=0"); for (int i = 0; i < dr.Length; i++) { bool isActionPass = true; if (int.Parse(dr[i]["is_lock"].ToString()) == 1) { isActionPass = false; } if (isActionPass && manager.role_type > 1) { string[] actionTypeArr = dr[i]["action_type"].ToString().Split(','); foreach (string action_type_str in actionTypeArr) { //如果存在显示权限资源,则检查是否拥有该权限 if (action_type_str == "Show") { } } } else if (isActionPass && manager.role_type == 1) { //超级管理员显示全部 strTxt.Append("{"); strTxt.Append("\"title\":\"" + dr[i]["title"] + "\""); strTxt.Append(",\"name\":\"" + (i + 1) + "\""); strTxt.Append(",\"icon\":\"" + dr[i]["icon_url"] + "\""); strTxt.Append(",\"menuItem\":["); DataTable child_dt = new BLL.navigation().GetList(0, "parent_id=" + Convert.ToInt32(dr[i]["id"]) + " and nav_type='" + VueEnums.NavigationEnum.System.ToString() + "'", "id desc").Tables[0]; DataRow[] child_dr = child_dt.Select("is_lock=0"); for (int j = 0; j < child_dt.Rows.Count; j++) { strTxt.Append("{"); strTxt.Append("\"label\":\"" + child_dr[j]["title"] + "\""); strTxt.Append(",\"name\":\"" + (i + 1) + "-" + (j + 1) + "\""); strTxt.Append(",\"href\":\"" + child_dr[j]["link_url"] + "\""); strTxt.Append(",\"icon\":\"" + child_dr[j]["icon_url"] + "\""); strTxt.Append(",\"closable\":\"true\""); strTxt.Append("}"); if (j < child_dt.Rows.Count - 1) { strTxt.Append(","); } } strTxt.Append("]"); strTxt.Append("}"); if (i < dt.Rows.Count - 1) { strTxt.Append(","); } } } strTxt.Append("]"); return(Content(strTxt.ToString())); }
private bool DoEdit(int _id) { try { BLL.navigation bll = new BLL.navigation(); Model.navigation model = bll.GetModel(_id); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.sub_title = txtSubTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.remark = txtRemark.Text.Trim(); if (model.is_sys == 0) { int parentId = int.Parse(ddlParentId.SelectedValue); //如果选择的父ID不是自己,则更改 if (parentId != model.id) { model.parent_id = parentId; } } //添加操作权限类型 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(DTEnums.ActionEnum.Add.ToString(), "修改导航信息:" + model.title); //记录日志 return true; } } catch { return false; } return false; }