/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { page = DTRequest.GetQueryInt("page", 1); category_id = DTRequest.GetQueryInt("category_id"); channel = get_channel_by_catagoryid(category_id); if (null == channel) { channel = get_channel_by_channelid(1); } }
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 儲存URL配置.結束 return(true); }
private void ShowInfo(int _id) { BLL.sys_channel bll = new BLL.sys_channel(); Model.sys_channel model = bll.GetModel(_id); txtName.Text = model.name; hidName.Value = model.name; txtTitle.Text = model.title; ddlModelId.SelectedValue = model.model_id.ToString(); txtSortId.Text = model.sort_id.ToString(); //綁定URL配置清單 //rptList.DataSource = new BLL.url_rewrite().GetList(model.id.ToString()); //rptList.DataBind(); }
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"); 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()), //源页面地址 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 保存URL配置.结束 return true; }
/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { id = DTRequest.GetQueryInt("id"); page = DTRequest.GetQueryString("page"); BLL.article bll = new BLL.article(); BLL.sys_channel bll_channel = new BLL.sys_channel(); if (id > 0) { if (!bll.Exists(id)) { HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")); return; } model = bll.GetContentModel(id); } else if (!string.IsNullOrEmpty(page)) { if (!bll.ContentExists(page)) { HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")); return; } model = bll.GetContentModel(page); } else { Server.Transfer("error.aspx"); return; } //浏览数+1 bll.UpdateField(model.id, "click=click+1"); //跳转URL if (model.link_url != null) model.link_url = model.link_url.Trim(); if (!string.IsNullOrEmpty(model.link_url)) { HttpContext.Current.Response.Redirect(model.link_url); } channel = bll_channel.GetModel(model.channel_id); }
/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { BLL.sys_channel bll = new BLL.sys_channel(); channel = bll.GetModel(1); }