private bool DoEdit(int _id) { try { BLL.area_category bll = new BLL.area_category(); Model.area_category model = bll.GetModel(_id); int parentId = int.Parse(ddlParentId.SelectedValue); 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; if (bll.Update(model)) { AddAdminLog(PLEnums.ActionEnum.Edit.ToString(), "修改" + model.title + "地区栏目分类:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private void TreeBindArea() { BLL.area_category bll = new BLL.area_category(); DataTable dt = bll.GetList(0); this.ddlAreaId.Items.Clear(); this.ddlAreaId.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.ddlAreaId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlAreaId.Items.Add(new ListItem(Title, Id)); } } }
private bool DoAdd() { try { Model.area_category model = new Model.area_category(); BLL.area_category bll = new BLL.area_category(); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.parent_id = int.Parse(ddlParentId.SelectedValue); 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; if (bll.Add(model) > 0) { AddAdminLog(PLEnums.ActionEnum.Add.ToString(), "添加" + model.title + "地区栏目分类:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
//数据绑定 private void RptBind() { BLL.area_category bll = new BLL.area_category(); DataTable dt = bll.GetList(0); this.rptList.DataSource = dt; this.rptList.DataBind(); }
/// <summary> /// 返回当前地区名称 /// </summary> /// <param name="area_id">地区ID</param> /// <returns>String</returns> protected string get_area_title(int area_id, string default_value) { BLL.area_category bll = new BLL.area_category(); if (bll.Exists(area_id)) { return(bll.GetTitle(area_id)); } return(default_value); }
/// <summary> /// 递归找到父节点 /// </summary> private void LoopAreaMenu(StringBuilder strTxt, string urlKey, int area_id) { BLL.area_category bll = new BLL.area_category(); int parentId = bll.GetParentId(area_id); if (parentId > 0) { this.LoopAreaMenu(strTxt, urlKey, parentId); } strTxt.Append(" > <a href=\"" + linkurl(urlKey, area_id, 1) + "\">" + bll.GetTitle(area_id) + "</a>"); }
//删除类别 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_area_category", PLEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.area_category bll = new BLL.area_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(PLEnums.ActionEnum.Edit.ToString(), "删除地区栏目分类数据"); //记录日志 JscriptMsg("删除数据成功!", Utils.CombUrlTxt("area_list.aspx", "", string.Empty)); }
private void ShowInfo(int _id) { BLL.area_category bll = new BLL.area_category(); Model.area_category model = bll.GetModel(_id); ddlParentId.SelectedValue = model.parent_id.ToString(); txtCallIndex.Text = model.call_index; 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; }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("sys_area_category", PLEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.area_category bll = new BLL.area_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(PLEnums.ActionEnum.Edit.ToString(), "保存地区栏目分类排序"); //记录日志 JscriptMsg("保存排序成功!", Utils.CombUrlTxt("area_list.aspx", "", string.Empty)); }
/// <summary> /// 返回父id /// </summary> /// <param name="category_id"></param> /// <returns></returns> protected int get_area_parent_id(string category_id) { BLL.area_category bll = new BLL.area_category(); return(bll.GetParentId(Convert.ToInt32(category_id))); }
/// <summary> /// 返回父id /// </summary> /// <param name="category_id"></param> /// <returns></returns> protected int get_area_parent_id(int category_id) { BLL.area_category bll = new BLL.area_category(); return(bll.GetParentId(category_id)); }