private void RptBind(string _strWhere) { this.txtKeywords.Text = this.keywords; DTcms.BLL.sys_channel bll = new DTcms.BLL.sys_channel(); this.rptList.DataSource = bll.GetList(_strWhere); this.rptList.DataBind(); }
private bool DoEdit(int _id) { DTcms.BLL.sys_channel bll = new DTcms.BLL.sys_channel(); DTcms.Model.sys_channel model = bll.GetModel(_id); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.model_id = int.Parse(ddlModelId.SelectedValue); model.sort_id = int.Parse(txtSortId.Text.Trim()); if (!bll.Update(model)) { return(false); } #region 儲存URL配置.開始=================================== BLL.url_rewrite bll2 = new BLL.url_rewrite(); bll2.Remove("channel", model.id.ToString()); //先刪除 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPathArr = Request.Form.GetValues("item_path"); string[] itemPatternArr = Request.Form.GetValues("item_pattern"); string[] itemQuerystringArr = Request.Form.GetValues("item_querystring"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemPageArr = Request.Form.GetValues("item_page"); if (itemTypeArr != null && itemNameArr != null && itemPathArr != null && itemPatternArr != null && itemQuerystringArr != null && itemTempletArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPathArr.Length) && (itemPathArr.Length == itemPatternArr.Length) && (itemPatternArr.Length == itemQuerystringArr.Length) && (itemQuerystringArr.Length == itemTempletArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { bll2.Add(new Model.url_rewrite { name = itemNameArr[i].Trim(), path = itemPathArr[i].Trim(), pattern = itemPatternArr[i].Trim(), //page = GetPageName(model.name, itemTypeArr[i].Trim()), //源頁面地址 page = itemPageArr[i].Trim(), querystring = itemQuerystringArr[i].Trim(), templet = itemTempletArr[i].Trim(), channel = model.id.ToString(), type = itemTypeArr[i].Trim(), inherit = GetInherit(model.model_id, itemTypeArr[i].Trim()) //繼承的類名 }); } } } #endregion 儲存URL配置.結束 return(true); }
//删除操作 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_channel", DTEnums.ActionEnum.Delete.ToString()); //检查权限 DTcms.BLL.sys_channel bll = new DTcms.BLL.sys_channel(); BLL.url_rewrite bll2 = new BLL.url_rewrite(); //批量删除 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); //删除URL映射表 bll2.Remove("channel", id.ToString()); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("sys_channel_list.aspx", "keywords={0}", txtKeywords.Text.Trim()), "Success", "parent.loadChannelTree"); }
//刪除操作 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_channel", DTEnums.ActionEnum.Delete.ToString()); //檢查許可權 DTcms.BLL.sys_channel bll = new DTcms.BLL.sys_channel(); BLL.url_rewrite bll2 = new BLL.url_rewrite(); //批次刪除 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); //刪除URL映射表 bll2.Remove("channel", id.ToString()); } } JscriptMsg("批次刪除成功!", Utils.CombUrlTxt("sys_channel_list.aspx", "keywords={0}", txtKeywords.Text.Trim()), "Success", "parent.loadChannelTree"); }
private bool DoEdit(int _id) { DTcms.BLL.sys_channel bll = new DTcms.BLL.sys_channel(); DTcms.Model.sys_channel model = bll.GetModel(_id); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.model_id = int.Parse(ddlModelId.SelectedValue); model.sort_id = int.Parse(txtSortId.Text.Trim()); if (!bll.Update(model)) { return false; } #region 保存URL配置.开始=================================== BLL.url_rewrite bll2 = new BLL.url_rewrite(); bll2.Remove("channel", model.id.ToString()); //先删除 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPathArr = Request.Form.GetValues("item_path"); string[] itemPatternArr = Request.Form.GetValues("item_pattern"); string[] itemQuerystringArr = Request.Form.GetValues("item_querystring"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemPageArr = Request.Form.GetValues("item_page"); if (itemTypeArr != null && itemNameArr != null && itemPathArr != null && itemPatternArr != null && itemQuerystringArr != null && itemTempletArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPathArr.Length) && (itemPathArr.Length == itemPatternArr.Length) && (itemPatternArr.Length == itemQuerystringArr.Length) && (itemQuerystringArr.Length == itemTempletArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { bll2.Add(new Model.url_rewrite { name = itemNameArr[i].Trim(), path = itemPathArr[i].Trim(), pattern = itemPatternArr[i].Trim(), //page = GetPageName(model.name, itemTypeArr[i].Trim()), //源页面地址 page = itemPageArr[i].Trim(), querystring = itemQuerystringArr[i].Trim(), templet = itemTempletArr[i].Trim(), channel = model.id.ToString(), type = itemTypeArr[i].Trim(), inherit = GetInherit(model.model_id, itemTypeArr[i].Trim()) //继承的类名 }); } } } #endregion 保存URL配置.结束 return true; }