/// <summary> /// 获取栏目地址 /// </summary> /// <param name="cls"></param> /// <param name="page"></param> /// <returns></returns> public string GetClassUrl(Class cls, int page) { string url = ""; if (BasePage.SystemSetting.EnableReWrite) { switch (cls.ModelID) { case 1: url = RewriteRule.Get().NewsClass.Exp; break; case 4: url = RewriteRule.Get().BookClass.Exp; break; case 7: url = RewriteRule.Get().ProductList.Exp; break; default: url = string.Format("/Dynamic/Book/Class.aspx?id={0}&page={1}", cls.ID, page); break; } url = url.Replace("{id}", cls.ID.ToS()); url = url.Replace("{classname}", cls.ClassName); url = url.Replace("{page}", page.ToS()); } else { url = string.Format("/Dynamic/Book/Class.aspx?id={0}&page={1}", cls.ID, page); } return(url); }
protected void btn_Save_Click(object sender, EventArgs e) { var s = RewriteRule.Get(); s.NewsClass = new ExpAndTarget { id = rbl_NewsList.SelectedValue, Exp = rbl_NewsList.SelectedItem.Text }; s.NewsPage = new ExpAndTarget { id = rbl_News.SelectedValue, Exp = rbl_News.SelectedItem.Text }; s.BookClass = new ExpAndTarget() { id = rbl_BookList.SelectedValue, Exp = rbl_BookList.SelectedItem.Text }; //new KeyValuePair<string,string>(txt_BookClass.Text,txt2_BookClass.Text); s.BookInfo = new ExpAndTarget() { id = rbl_BookInfo.SelectedValue, Exp = rbl_BookInfo.SelectedItem.Text }; //new KeyValuePair<string,string>(txt_BookInfo.Text,txt2_BookInfo.Text); s.BookChapter = new ExpAndTarget() { id = rbl_Chapter.SelectedValue, Exp = rbl_Chapter.SelectedItem.Text }; //new KeyValuePair<string,string>(txt_BookChapter.Text,txt2_BookChapter.Text); s.ProductList = new ExpAndTarget { id = rbl_ProductList.SelectedValue, Exp = rbl_ProductList.SelectedItem.Text }; s.Product = new ExpAndTarget { id = rbl_Product.SelectedValue, Exp = rbl_Product.SelectedItem.Text }; s.Save(); Js.AlertAndChangUrl("保存成功!", "RewriteSetting.aspx"); }
/// <summary> /// 获取问答url地址 /// </summary> /// <param name="qs"></param> /// <param name="cls"></param> /// <returns></returns> public string GetBookUrl(Book b, Class cls) { string url = RewriteRule.Get().BookInfo.Exp; url = url.Replace("{id}", b.ID.ToS()); url = url.Replace("{classname}", b.ClassName); url = url.Replace("{title}", b.Title); url = url.Replace("{author}", b.Author); return(url); }
/// <summary> /// 获取信息地址 /// </summary> /// <param name="news">信息</param> /// <param name="cls">栏目</param> /// <returns></returns> public string GetNewsUrl(News news, Class cls) { if (BasePage.SystemSetting.EnableReWrite) { string url = RewriteRule.Get().NewsPage.Exp; url = url.Replace("{newsid}", news.ID.ToS()); return(url); } else { return(string.Format("/Dynamic/News/News.aspx?id={0}", news.ID)); } }
/// <summary> /// 获取问答url地址 /// </summary> /// <param name="qs"></param> /// <param name="cls"></param> /// <returns></returns> public string GetBookChapterUrl(BookChapter cp, Class cls) { if (cp == null || cp.ID < 0) { return(""); } string url = RewriteRule.Get().BookChapter.Exp; url = url.Replace("{id}", cp.ID.ToS()); url = url.Replace("{classname}", cls.ClassName); url = url.Replace("{title}", cp.BookTitle); url = url.Replace("{author}", cp.GetBook().Title); return(url); }
protected void LoadInfo() { var s = RewriteRule.Get(); try { rbl_NewsList.SelectedValue = s.NewsClass.id; rbl_News.SelectedValue = s.NewsPage.id; rbl_BookList.SelectedValue = s.BookClass.id; rbl_BookInfo.SelectedValue = s.BookInfo.id; rbl_Chapter.SelectedValue = s.BookChapter.id; rbl_ProductList.SelectedValue = s.ProductList.id; rbl_Product.SelectedValue = s.Product.id; } catch { } }