//删除操作 protected void btnDelete_Click(object sender, EventArgs e) { BLL.url_rewrite bll = new BLL.url_rewrite(); for (int i = 0; i < rptList.Items.Count; i++) { string urlName = ((HiddenField)rptList.Items[i].FindControl("hideName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Remove("name", urlName); } } JscriptMsg("URL规则删除成功啦!", "url_rewrite_list.aspx", "Success"); }
//删除操作 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("site_url_rewrite", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.url_rewrite bll = new BLL.url_rewrite(); for (int i = 0; i < rptList.Items.Count; i++) { string urlName = ((HiddenField)rptList.Items[i].FindControl("hideName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Remove("name", urlName); } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除URL配置信息"); //记录日志 JscriptMsg("URL配置删除成功!", "url_rewrite_list.aspx", "Success"); }
//删除操作 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_url_rewrite", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.url_rewrite bll = new BLL.url_rewrite(); for (int i = 0; i < rptList.Items.Count; i++) { string urlName = ((HiddenField)rptList.Items[i].FindControl("hideName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Remove("name", urlName); } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除URL配置信息"); //记录日志 JscriptMsg("URL配置删除成功!", "url_rewrite_list.aspx"); }
//删除操作 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_channel", DTEnums.ActionEnum.Delete.ToString()); //检查权限 Egojit.BLL.sys_channel bll = new Egojit.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) { BLL.site_channel bll = new BLL.site_channel(); Model.site_channel model = bll.GetModel(_id); string old_name = model.name; model.site_id = Utils.StrToInt(ddlSiteId.SelectedValue, 0); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.is_lock = 0; model.is_comment = 0; model.is_albums = 0; model.is_attach = 0; model.is_spec = 0; if (cbIsLock.Checked == false) { model.is_lock = 1; } if (cbIsComment.Checked == true) { model.is_comment = 1; } if (cbIsAlbums.Checked == true) { model.is_albums = 1; } if (cbIsAttach.Checked == true) { model.is_attach = 1; } if (cbIsSpec.Checked == true) { model.is_spec = 1; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); //添加频道扩展字段 List <Model.site_channel_field> ls = new List <Model.site_channel_field>(); for (int i = 0; i < cblAttributeField.Items.Count; i++) { if (cblAttributeField.Items[i].Selected) { string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值 ls.Add(new Model.site_channel_field { channel_id = model.id, field_id = Utils.StrToInt(fieldIdArr[1], 0) }); } } model.channel_fields = ls; if (!bll.Update(model)) { return(false); } #region 保存URL配置 BLL.url_rewrite urlBll = new BLL.url_rewrite(); urlBll.Remove("channel", old_name); //先删除旧的 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPageArr = Request.Form.GetValues("item_page"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemPageSizeArr = Request.Form.GetValues("item_pagesize"); string[] itemRewriteArr = Request.Form.GetValues("item_rewrite"); if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemPageSizeArr != null && itemRewriteArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemPageSizeArr.Length) && (itemPageSizeArr.Length == itemRewriteArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { Model.url_rewrite urlModel = new Model.url_rewrite(); urlModel.name = itemNameArr[i].Trim(); urlModel.type = itemTypeArr[i].Trim(); urlModel.page = itemPageArr[i].Trim(); urlModel.inherit = GetInherit(urlModel.type); urlModel.templet = itemTempletArr[i].Trim(); if (Utils.StrToInt(itemPageSizeArr[i].Trim(), 0) > 0) { urlModel.pagesize = itemPageSizeArr[i].Trim(); } urlModel.channel = model.name; List <Model.url_rewrite_item> itemLs = new List <Model.url_rewrite_item>(); string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串 for (int j = 0; j < urlRewriteArr.Length; j++) { string[] urlItemArr = urlRewriteArr[j].Split(','); if (urlItemArr.Length == 3) { itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] }); } } urlModel.url_rewrite_items = itemLs; urlBll.Add(urlModel); } } } #endregion AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改频道" + model.title); //记录日志 return(true); }
private bool DoAdd() { Model.channel model = new Model.channel(); BLL.channel bll = new BLL.channel(); model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); if (cbIsAlbums.Checked == true) { model.is_albums = 1; } if (cbIsAttach.Checked == true) { model.is_attach = 1; } if (cbIsGroupPrice.Checked == true) { model.is_group_price = 1; } model.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); //添加频道扩展字段 List <Model.channel_field> ls = new List <Model.channel_field>(); for (int i = 0; i < cblAttributeField.Items.Count; i++) { if (cblAttributeField.Items[i].Selected) { ls.Add(new Model.channel_field { field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0) }); } } model.channel_fields = ls; if (bll.Add(model) < 1) { return(false); } #region 保存URL配置 BLL.url_rewrite urlBll = new BLL.url_rewrite(); urlBll.Remove("channel", model.name); //先删除 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPageArr = Request.Form.GetValues("item_page"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemRewriteArr = Request.Form.GetValues("item_rewrite"); if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemRewriteArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemRewriteArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { Model.url_rewrite urlModel = new Model.url_rewrite(); urlModel.name = itemNameArr[i].Trim(); urlModel.type = itemTypeArr[i].Trim(); urlModel.page = itemPageArr[i].Trim(); urlModel.inherit = GetInherit(urlModel.type); urlModel.templet = itemTempletArr[i].Trim(); urlModel.channel = model.name; List <Model.url_rewrite_item> itemLs = new List <Model.url_rewrite_item>(); string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串 for (int j = 0; j < urlRewriteArr.Length; j++) { string[] urlItemArr = urlRewriteArr[j].Split(','); if (urlItemArr.Length == 3) { itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] }); } } urlModel.url_rewrite_items = itemLs; urlBll.Add(urlModel); } } } #endregion AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加频道" + model.title); //记录日志 return(true); }
private bool DoEdit(int _id) { BLL.channel bll = new BLL.channel(); Model.channel model = bll.GetModel(_id); string old_name = model.name; model.site_id = Utils.StrToInt(ddlSiteId.SelectedValue, 0); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.is_albums = 0; model.is_attach = 0; model.is_spec = 0; if (cbIsAlbums.Checked == true) { model.is_albums = 1; } if (cbIsAttach.Checked == true) { model.is_attach = 1; } if (cbIsSpec.Checked == true) { model.is_spec = 1; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); //添加频道扩展字段 List<Model.channel_field> ls = new List<Model.channel_field>(); for (int i = 0; i < cblAttributeField.Items.Count; i++) { if (cblAttributeField.Items[i].Selected) { string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值 ls.Add(new Model.channel_field { channel_id = model.id, field_id = Utils.StrToInt(fieldIdArr[1], 0) }); } } model.channel_fields = ls; if (!bll.Update(model)) { return false; } #region 保存URL配置 BLL.url_rewrite urlBll = new BLL.url_rewrite(); urlBll.Remove("channel", old_name); //先删除旧的 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPageArr = Request.Form.GetValues("item_page"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemPageSizeArr = Request.Form.GetValues("item_pagesize"); string[] itemRewriteArr = Request.Form.GetValues("item_rewrite"); if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemPageSizeArr != null && itemRewriteArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemPageSizeArr.Length) && (itemPageSizeArr.Length == itemRewriteArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { Model.url_rewrite urlModel = new Model.url_rewrite(); urlModel.name = itemNameArr[i].Trim(); urlModel.type = itemTypeArr[i].Trim(); urlModel.page = itemPageArr[i].Trim(); urlModel.inherit = GetInherit(urlModel.type); urlModel.templet = itemTempletArr[i].Trim(); if (Utils.StrToInt(itemPageSizeArr[i].Trim(), 0) > 0) { urlModel.pagesize = itemPageSizeArr[i].Trim(); } urlModel.channel = model.name; List<Model.url_rewrite_item> itemLs = new List<Model.url_rewrite_item>(); string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串 for (int j = 0; j < urlRewriteArr.Length; j++) { string[] urlItemArr = urlRewriteArr[j].Split(','); if (urlItemArr.Length == 3) { itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] }); } } urlModel.url_rewrite_items = itemLs; urlBll.Add(urlModel); } } } #endregion AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改频道" + model.title); //记录日志 return true; }
private bool DoAdd() { Model.channel model = new Model.channel(); BLL.channel bll = new BLL.channel(); model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); if (cbIsAlbums.Checked == true) { model.is_albums = 1; } if (cbIsAttach.Checked == true) { model.is_attach = 1; } if (cbIsGroupPrice.Checked == true) { model.is_group_price = 1; } model.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); //添加频道扩展字段 List<Model.channel_field> ls = new List<Model.channel_field>(); for (int i = 0; i < cblAttributeField.Items.Count; i++) { if (cblAttributeField.Items[i].Selected) { ls.Add(new Model.channel_field { field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0) }); } } model.channel_fields = ls; if (bll.Add(model) < 1) { return false; } #region 保存URL配置 BLL.url_rewrite urlBll = new BLL.url_rewrite(); urlBll.Remove("channel", model.name); //先删除 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPageArr = Request.Form.GetValues("item_page"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemRewriteArr = Request.Form.GetValues("item_rewrite"); if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemRewriteArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemRewriteArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { Model.url_rewrite urlModel = new Model.url_rewrite(); urlModel.name = itemNameArr[i].Trim(); urlModel.type = itemTypeArr[i].Trim(); urlModel.page = itemPageArr[i].Trim(); urlModel.inherit = GetInherit(urlModel.type); urlModel.templet = itemTempletArr[i].Trim(); urlModel.channel = model.name; List<Model.url_rewrite_item> itemLs = new List<Model.url_rewrite_item>(); string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串 for (int j = 0; j < urlRewriteArr.Length; j++) { string[] urlItemArr = urlRewriteArr[j].Split(','); if (urlItemArr.Length == 3) { itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] }); } } urlModel.url_rewrite_items = itemLs; urlBll.Add(urlModel); } } } #endregion AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加频道" + model.title); //记录日志 return true; }
private bool DoAdd() { Model.sys_channel model = new Model.sys_channel(); BLL.sys_channel bll = new BLL.sys_channel(); 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()); int new_id = bll.Add(model); //保存 if (new_id < 1) { return false; } #region 保存URL配置.开始=================================== BLL.url_rewrite bll2 = new BLL.url_rewrite(); bll2.Remove("channel", new_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 && itemPageArr != 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 = new_id.ToString(), type = itemTypeArr[i].Trim(), inherit = GetInherit(model.model_id, itemTypeArr[i].Trim()) //继承的类名 }); } } } #endregion return true; }
private bool DoAdd() { Model.site_channel model = new Model.site_channel(); BLL.site_channel bll = new BLL.site_channel(); model.site_id = Utils.StrToInt(ddlSiteId.SelectedValue, 0); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); if (cbIsLock.Checked == false) { model.is_lock = 1; } if (cbIsComment.Checked == true) { model.is_comment = 1; } if (cbIsAlbums.Checked == true) { model.is_albums = 1; } if (cbIsAttach.Checked == true) { model.is_attach = 1; } if (cbIsSpec.Checked == true) { model.is_spec = 1; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); //添加频道扩展字段 List <Model.site_channel_field> ls = new List <Model.site_channel_field>(); for (int i = 0; i < cblAttributeField.Items.Count; i++) { if (cblAttributeField.Items[i].Selected) { string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值 ls.Add(new Model.site_channel_field { field_id = Utils.StrToInt(fieldIdArr[1], 0) }); } } model.channel_fields = ls; if (bll.Add(model) < 1) { return(false); } #region 保存URL配置 BLL.url_rewrite urlBll = new BLL.url_rewrite(); urlBll.Remove("channel", model.name); //先删除 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPageArr = Request.Form.GetValues("item_page"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemPageSizeArr = Request.Form.GetValues("item_pagesize"); string[] itemRewriteArr = Request.Form.GetValues("item_rewrite"); if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemPageSizeArr != null && itemRewriteArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemPageSizeArr.Length) && (itemPageSizeArr.Length == itemRewriteArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { Model.url_rewrite urlModel = new Model.url_rewrite(); urlModel.name = itemNameArr[i].Trim(); urlModel.type = itemTypeArr[i].Trim(); urlModel.page = itemPageArr[i].Trim(); urlModel.inherit = GetInherit(urlModel.type); urlModel.templet = itemTempletArr[i].Trim(); if (Utils.StrToInt(itemPageSizeArr[i].Trim(), 0) > 0) { urlModel.pagesize = itemPageSizeArr[i].Trim(); } urlModel.channel = model.name; List <Model.url_rewrite_item> itemLs = new List <Model.url_rewrite_item>(); string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串 for (int j = 0; j < urlRewriteArr.Length; j++) { string[] urlItemArr = urlRewriteArr[j].Split(','); if (urlItemArr.Length == 3) { itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] }); } } urlModel.url_rewrite_items = itemLs; urlBll.Add(urlModel); } } } else { #region 添加默认URl配置 //列表url Model.url_rewrite urlModelList = new Model.url_rewrite(); urlModelList.name = model.name; urlModelList.type = "list"; urlModelList.page = model.name + ".aspx"; urlModelList.inherit = GetInherit(urlModelList.type); urlModelList.templet = model.name + ".html"; urlModelList.pagesize = "20"; urlModelList.channel = model.name; List <Model.url_rewrite_item> listItems = new List <Model.url_rewrite_item> { new Model.url_rewrite_item() { path = model.name + ".aspx", pattern = model.name + ".aspx" }, new Model.url_rewrite_item() { path = model.name + "/{0}.aspx", pattern = model.name + "/(\\d+).aspx", querystring = "category_id=$1" }, new Model.url_rewrite_item() { path = model.name + "/{0}/{1}.aspx", pattern = model.name + "/(\\d+)/(\\w+).aspx", querystring = "category_id=$1^page=$2" } }; urlModelList.url_rewrite_items = listItems; urlBll.Add(urlModelList); //详情页url Model.url_rewrite urlModelShow = new Model.url_rewrite(); urlModelShow.name = model.name + "_show"; urlModelShow.type = "detail"; urlModelShow.page = model.name + "_show.aspx"; urlModelShow.inherit = GetInherit(urlModelShow.type); urlModelShow.templet = model.name + "_show.html"; urlModelShow.channel = model.name; List <Model.url_rewrite_item> showItems = new List <Model.url_rewrite_item> { new Model.url_rewrite_item() { path = model.name + "/show-{0}.aspx", pattern = model.name + "/show-(\\d+).aspx", querystring = "id=$1" } }; urlModelShow.url_rewrite_items = showItems; urlBll.Add(urlModelShow); #endregion } #endregion AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加频道" + model.title); //记录日志 return(true); }
private bool DoAdd() { Model.channel model = new Model.channel(); BLL.channel bll = new BLL.channel(); model.site_id = Utils.StrToInt(ddlSiteId.SelectedValue, 0); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); if (cbIsAlbums.Checked == true) { model.is_albums = 1; } if (cbIsAttach.Checked == true) { model.is_attach = 1; } if (cbIsSpec.Checked == true) { model.is_spec = 1; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); //扩展 if (cbIsComment.Checked == true) { model.is_comment = 1; } if (cbIsAttr.Checked == true) { model.is_attribute = 1; } if (cbIsRecycle.Checked == true) { model.is_recycle = 1; } model.is_type = Utils.StrToInt(rblIsType.SelectedValue, 0); model.height = int.Parse(txtHeight.Text.Trim(), 0); model.width = int.Parse(txtWidth.Text.Trim(), 0); //SEO优化 model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim().Replace(",", ","); model.seo_description = txtSeoDescription.Text.Trim(); //添加频道扩展字段 List <Model.channel_field> ls = new List <Model.channel_field>(); for (int i = 0; i < cblAttributeField.Items.Count; i++) { if (cblAttributeField.Items[i].Selected) { string[] fieldIdArr = cblAttributeField.Items[i].Value.Split(','); //分解出ID值 ls.Add(new Model.channel_field { field_id = Utils.StrToInt(fieldIdArr[1], 0) }); } } model.channel_fields = ls; if (bll.Add(model) < 1) { return(false); } #region 保存URL配置 BLL.url_rewrite urlBll = new BLL.url_rewrite(); urlBll.Remove("channel", model.name); //先删除 string[] itemTypeArr = Request.Form.GetValues("item_type"); string[] itemNameArr = Request.Form.GetValues("item_name"); string[] itemPageArr = Request.Form.GetValues("item_page"); string[] itemTempletArr = Request.Form.GetValues("item_templet"); string[] itemPageSizeArr = Request.Form.GetValues("item_pagesize"); string[] itemRewriteArr = Request.Form.GetValues("item_rewrite"); if (itemTypeArr != null && itemNameArr != null && itemPageArr != null && itemTempletArr != null && itemPageSizeArr != null && itemRewriteArr != null) { if ((itemTypeArr.Length == itemNameArr.Length) && (itemNameArr.Length == itemPageArr.Length) && (itemPageArr.Length == itemTempletArr.Length) && (itemTempletArr.Length == itemPageSizeArr.Length) && (itemPageSizeArr.Length == itemRewriteArr.Length)) { for (int i = 0; i < itemTypeArr.Length; i++) { Model.url_rewrite urlModel = new Model.url_rewrite(); urlModel.name = itemNameArr[i].Trim(); urlModel.type = itemTypeArr[i].Trim(); urlModel.page = itemPageArr[i].Trim(); urlModel.inherit = GetInherit(urlModel.type); urlModel.templet = itemTempletArr[i].Trim(); if (Utils.StrToInt(itemPageSizeArr[i].Trim(), 0) > 0) { urlModel.pagesize = itemPageSizeArr[i].Trim(); } urlModel.channel = model.name; List <Model.url_rewrite_item> itemLs = new List <Model.url_rewrite_item>(); string[] urlRewriteArr = itemRewriteArr[i].Split('&'); //分解URL重写字符串 for (int j = 0; j < urlRewriteArr.Length; j++) { string[] urlItemArr = urlRewriteArr[j].Split(','); if (urlItemArr.Length == 3) { itemLs.Add(new Model.url_rewrite_item { path = urlItemArr[0], pattern = urlItemArr[1], querystring = urlItemArr[2] }); } } urlModel.url_rewrite_items = itemLs; urlBll.Add(urlModel); } } } #endregion AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加频道" + model.title); //记录日志 return(true); }