private bool DoEdit(int _id) { try { BLL.meal_category bll = new BLL.meal_category(); Model.meal_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(DTEnums.ActionEnum.Edit.ToString(), "修改套餐频道栏目分类:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private void TreeBind() { BLL.meal_category bll = new BLL.meal_category(); DataTable dt = bll.GetList(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)); } } }
private bool DoAdd() { try { Model.meal_category model = new Model.meal_category(); BLL.meal_category bll = new BLL.meal_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(DTEnums.ActionEnum.Add.ToString(), "添加套餐频道栏目分类:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
//数据绑定 private void RptBind() { BLL.meal_category bll = new BLL.meal_category(); DataTable dt = bll.GetList(0); this.rptList.DataSource = dt; this.rptList.DataBind(); }
//删除类别 protected void btnDelete_Click(object sender, EventArgs e) { //ChkAdminLevel("channel_套餐_category", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.meal_category bll = new BLL.meal_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(DTEnums.ActionEnum.Edit.ToString(), "删除套餐频道栏目分类数据"); //记录日志 JscriptMsg("删除数据成功!", "category_list.aspx", "Success"); }
private void ShowInfo(int _id) { BLL.meal_category bll = new BLL.meal_category(); Model.meal_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("channel_套餐_category", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.meal_category bll = new BLL.meal_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(DTEnums.ActionEnum.Edit.ToString(), "保存套餐频道栏目分类排序"); //记录日志 JscriptMsg("保存排序成功!", "category_list.aspx", "Success"); }
private void TreeBind() { BLL.meal_category bll = new BLL.meal_category(); DataTable dt = bll.GetList(0); this.ddlCategoryId.Items.Clear(); this.ddlCategoryId.Items.Add(new ListItem("所有类别", "")); 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.ddlCategoryId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); } } }
private bool DoAdd() { try { Model.meal_category model = new Model.meal_category(); BLL.meal_category bll = new BLL.meal_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(DTEnums.ActionEnum.Add.ToString(), "添加套餐频道栏目分类:" + model.title); //记录日志 return true; } } catch { return false; } return false; }
private bool DoEdit(int _id) { try { BLL.meal_category bll = new BLL.meal_category(); Model.meal_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(DTEnums.ActionEnum.Edit.ToString(), "修改套餐频道栏目分类:" + model.title); //记录日志 return true; } } catch { return false; } return false; }