protected void Page_Load(object sender, EventArgs e) { iPageSize = int.Parse(System.Configuration.ConfigurationManager.AppSettings["PageSize"]); //显示方式 sShow = string.IsNullOrEmpty(Request.QueryString["show"]) ? System.Configuration.ConfigurationManager.AppSettings["DefaultSearchDisplay"] : Request.QueryString["show"]; DataSet ds = new DataSet(); DAL.CategoryDAL dal = new DAL.CategoryDAL(); //排序方式 sSort = string.IsNullOrEmpty(Request.QueryString["s"]) ? System.Configuration.ConfigurationManager.AppSettings["DefaultSearchSort"] : Request.QueryString["s"]; if (string.IsNullOrEmpty(sSort)) { sSort = " asc "; } //当前页面 int.TryParse(string.IsNullOrEmpty(Request.QueryString["PageNo"]) ? "0" : Request.QueryString["PageNo"], out iPage); if (iPage < 1) { iPage = 1; } //分页l链接路径 sUrl = string.Format("?act={0}", Request.QueryString["act"]); string sAct = Request.QueryString["act"].Trim().ToLower(); if (string.IsNullOrEmpty(sAct) || sAct == "h") { //热点 if (string.IsNullOrEmpty(Request.QueryString["ID"])) { return; } sCategoryGUID = Request.QueryString["ID"]; sUrl += string.Format("&ID={0}", sCategoryGUID); dtArt = new DAL.Article().GetArticleList(sCategoryGUID, true, sSort, iPage, out iTotalRowsCount); sActionStr = "热门关键词"; } else if (sAct == "lv2h")//*CC* { //二级左下 if (string.IsNullOrEmpty(Request.QueryString["ID"])) { return; } sCategoryGUID = Request.QueryString["ID"]; sUrl += string.Format("&ID={0}", sCategoryGUID); dtArt = new DAL.Article().GetArticleList(sCategoryGUID, true, sSort, iPage, out iTotalRowsCount); string Lv2CategoryPath = DataQuery.CategoryPath(sCategoryGUID); string[] Lv2CategoryPathArray = Lv2CategoryPath.Split('/'); string Lv2CategoryAlias = DataQuery.CategoryIDToAlias(Lv2CategoryPathArray[4].ToString()); string Lv2CategoryName = DataQuery.GetNameByCategoryAlias(Lv2CategoryAlias); string Lv3CategoryName = DataQuery.GetNameByCategoryID(sCategoryGUID); TraceLv2Link.NavigateUrl = "level2.aspx?alias=" + Lv2CategoryAlias; TraceLv2Name.Text = Lv2CategoryName; sActionStr = "> " + Lv3CategoryName; } else if (sAct == "n") { //简单搜索 sActionStr = "简单搜索"; sKeyWords = Request.QueryString["keywords"]; (this.Page.Master as MasterPager.NormalMasterPage).sSearchKeyWords = sKeyWords; string EnCodeKeyWords = Server.UrlEncode(sKeyWords); sUrl += string.Format("&keywords={0}", EnCodeKeyWords); sKeyWords = sKeyWords.Trim().Replace("+", ",").Replace(" ", ",").Replace(" ", ",").Replace(" ", ",").Replace(",", ",").Replace("|", "|").Replace("、", "|").Replace("(", "%").Replace(")", "%").Replace(")", "%").Replace("(", "%").Replace("[", "%").Replace("]", "%").Replace("[", "%").Replace("]", "%").Replace(":", "%").Replace(":", "%").Replace(",,", ",").Replace("%%", "%"); //CC 增加符号 sSearchWhere = dal.GetArticleSearchContent(sKeyWords); ds = dal.GetSearchArticleList(sSearchWhere, iPage, iPageSize, sSort); dtArt = ds.Tables[0]; if (!ds.Tables[1].Rows[0][0].Equals(null)) { int.TryParse(ds.Tables[1].Rows[0][0].ToString(), out iTotalRowsCount); } else { iTotalRowsCount = 0; } } else if (sAct == "a") { //高级检索 sActionStr = "高级搜索"; } else if (sAct == "zt") { sActionStr = "专题搜索"; sKeyWords = Request.QueryString["keywords"]; sUrl += string.Format("&keywords={0}", sKeyWords); sShow = "Thumb"; sKeyWords = sKeyWords.Trim().Replace("+", ",").Replace(" ", ",").Replace(" ", ",").Replace(",", ",").Replace("|", "|").Replace("、", "|").Replace(",,", ","); sSearchWhere = dal.GetSearchContentByKeyWords(sKeyWords, "CategoryName"); ds = dal.GetSearchZTList(sSearchWhere, iPage, iPageSize, sSort); dtArt = ds.Tables[0]; if (!ds.Tables[1].Rows[0][0].Equals(null)) { int.TryParse(ds.Tables[1].Rows[0][0].ToString(), out iTotalRowsCount); } else { iTotalRowsCount = 0; } } else if (sAct == "author") { //作者搜索 sActionStr = "简单搜索"; sKeyWords = Request.QueryString["keywords"]; sUrl += string.Format("&keywords={0}", sKeyWords); sKeyWords = sKeyWords.Trim().Replace("+", ",").Replace(" ", ",").Replace(" ", ",").Replace(",", ",").Replace("|", "|").Replace("、", "|").Replace(",,", ","); sSearchWhere = dal.GetSearchContentByKeyWords(sKeyWords, "Author"); ds = dal.GetSearchArticleList(sSearchWhere, iPage, iPageSize, sSort); dtArt = ds.Tables[0]; if (!ds.Tables[1].Rows[0][0].Equals(null)) { int.TryParse(ds.Tables[1].Rows[0][0].ToString(), out iTotalRowsCount); } else { iTotalRowsCount = 0; } } sActionStr = string.Format("{0} {1}", sActionStr, string.IsNullOrEmpty(sKeyWords)?string.Empty:string.Format("关键词:<b>{0}</b>", sKeyWords)); int iDescLength = (sAct == "zt")?270:63; string sDesc = string.Empty; string sContent = string.Empty; foreach (DataRow dr in dtArt.Rows) { string sDate = DateTime.Parse(dr["CreateTime"].ToString()).ToString("yyyy-MM-dd"); if (sAct != "zt") { sOutTrStr += string.Format("<tr><td class=\"MainListTitle\"><a href=\"{0}\">{1}</a></td><td>{2}</td><td>{3}分钟</td><td>{4}</td></tr>", string.Format("ShowVideo.aspx?ID={0}", dr["ArticleGUID"]), dr["Title"], dr["Author"], dr["Duration"], sDate); } sOutLiStr += "<li>"; string sImg = (sAct == "zt") ? string.Format("ShowZTImage.aspx?Title={0}", dr["CategoryName"]) : DAL.Article.GetArticleImgPath(dr["Filename"].ToString(), dr["CoursePicture"].ToString()); if (sAct == "zt")//*CC* { sOutLiStr += string.Format("<a href=\"{1}\" target=\"_blank\"><img class=\"SearchResultContentDetailPreview\" src=\"{0}\" /></a>", sImg, string.Format("SpecialAttention.aspx?ID={0}&Title={1}", dr["CategoryGUID"], HttpUtility.UrlEncode(dr["CategoryName"].ToString()))); } else { sOutLiStr += string.Format("<a href=\"{1}\" target=\"_blank\"><img class=\"SearchResultContentDetailPreview\" src=\"{0}\" /></a>", sImg, string.Format("ShowVideo.aspx?ID={0}", dr["ArticleGUID"])); } string sTemp = " <div class=\"SearchResultDetailLeft\">"; if (sAct == "zt") { sTemp += string.Format("<div class=\"SearchResultDetailTitle\"><a href=\"{0}\" target=\"_blank\">{1}</a></div>", string.Format("SpecialAttention.aspx?ID={0}&Title={1}", dr["CategoryGUID"], HttpUtility.UrlEncode(dr["CategoryName"].ToString())), dr["CategoryName"]); } else { sTemp += string.Format("<div class=\"SearchResultDetailTitle\"><a href=\"{0}\" target=\"_blank\">{1}</a></div>", string.Format("ShowVideo.aspx?ID={0}", dr["ArticleGUID"]), dr["Title"]); } if (sAct != "zt") { sTemp += "<table class=\"SearchResultDetailInfo\">"; string sAuthor = string.Format("<a href=\"Search.aspx?act=author&keywords={0}\" target=\"_blank\">{0}</a>", dr["Author"]); sTemp += string.Format("<tr><td><span>主讲人:</span> <span class=\"SearchResultInfoTxt\">{0}</span></td><td><span>职务:</span> <span class=\"SearchResultInfoTxt\">{1}</span></td></tr>", sAuthor, dr["SpeakerInfo"]); sTemp += string.Format("<tr><td><span>时长:</span> <span class=\"SearchResultInfoTxt\">{0}分钟</span></td><td><span>日期:</span> <span class=\"SearchResultInfoTxt\">{1}</span></td></tr>", dr["Duration"], sDate); sTemp += "</table> "; } sTemp += "</div>"; if (sAct == "zt") { string sTitle = dr["CategoryName"].ToString(); sContent = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle); } else { sContent = string.IsNullOrEmpty(dr["Summary"].ToString()) ? string.Empty : DAL.Article.RemoveHtml(dr["Summary"].ToString()); } sContent = DAL.Article.RemoveHtml(sContent); if (sContent.Length > iDescLength) { sDesc = sContent.Remove(0, iDescLength); sContent = sContent.Substring(0, iDescLength); } else { sDesc = string.Empty; } sTemp += string.Format("<div class=\"SearchResultDetailSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">简介:<span>{1}</span></div>", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc), sContent); sOutLiStr += string.Format("<div class=\"SearchResultContentDetailInfo\">{0}</div>", sTemp); sOutLiStr += "</li>"; } sSplitContent = GetSplitHtml(iPage, iTotalRowsCount, iPageSize, sUrl); }
protected void Page_Load(object sender, EventArgs e) { string CourseKeyWord; string CourseSperker; url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/"; string CourseId = Request.QueryString["ID"].ToString(); if (CourseId == null) { Response.Redirect("index.aspx"); } string CoursrQueryStr = "SELECT Top 1 ArticleGUID,State,Title,Area,Author,PlainText,Filename,CreateTime,KeyWord FROM ArticleCurrent Where ArticleGUID='" + CourseId + "'"; string SpeakerQueryStr = "Select Top 1 PropertyValue From ArticleCurrentPropertyExt Where PropertyAlias = 'speakerresume' And ArticleGUID='" + CourseId + "'"; string connectingString = ConfigurationManager.ConnectionStrings["zjspccmConnectionString"].ToString(); String SpeakerFile; using (SqlConnection connection = new SqlConnection(connectingString)) { SqlCommand command = new SqlCommand(CoursrQueryStr, connection); connection.Open(); SqlDataReader CourseReder = command.ExecuteReader(); CourseReder.Read(); TopPicLargeLink.NavigateUrl = "ShowVideo.aspx?ID=" + CourseReder[0].ToString(); TopPlayLink.NavigateUrl = "ShowVideo.aspx?ID=" + CourseReder[0].ToString(); TopPicLarge.ImageUrl = DataQuery.GetCoursePicPath(CourseReder[0].ToString(), url, "360x240.png"); TopPicSmall.ImageUrl = DataQuery.GetCoursePicPath(CourseReder[0].ToString(), url, "001.jpg"); SpeakerInfoUrl = DataQuery.GetCoursePicPath(CourseReder[0].ToString(), url, "data/jsData.js"); TopTitle.Text = DataProcessing.SubstringText(CourseReder[2].ToString(), 17); TopSpeaker.Text = DataProcessing.SubstringText(CourseReder[4].ToString(), 17); TopSpeakerInfo.Text = DataProcessing.SubstringText(CourseReder[3].ToString(), 40); TopSpeakerInfo.ToolTip = CourseReder[3].ToString(); TopSummary.Text = DataProcessing.SubstringText(DataProcessing.NoHTML(CourseReder[5].ToString()), 210); TopSummary.ToolTip = DataProcessing.NoHTML(CourseReder[5].ToString()); CourseSperker = CourseReder[4].ToString(); CourseKeyWord = CourseReder[8].ToString(); } //主讲人简介 //using (SqlConnection connection = new SqlConnection(connectingString)) //{ // connection.Open(); // SqlCommand SpeakerCommand = new SqlCommand(SpeakerQueryStr, connection); // SqlDataReader SpeakerReder = SpeakerCommand.ExecuteReader(); // if (SpeakerReder.Read()) // { // SpeakerFile = SpeakerReder[0].ToString(); // string SpeakerFilePath = DataQuery.GetCoursePicPath(CourseId, url, SpeakerFile); // XmlDocument xmlDoc = new XmlDocument(); // try // { // xmlDoc.Load(SpeakerFilePath); // XmlNode root = xmlDoc.SelectSingleNode("Speaker"); // //string SperkerSummary = DataProcessing.NoHTML((root.SelectSingleNode("Information1")).InnerXml); // string SperkerSummary = (root.SelectSingleNode("Information1")).InnerXml; // SperkerSummary = SperkerSummary.Replace("<", "<"); // SperkerSummary = SperkerSummary.Replace(">", ">"); // SperkerSummary = DataProcessing.NoHTML(SperkerSummary); // SperkerSummary = SperkerSummary.Replace("![CDATA[", ""); // SperkerSummary = SperkerSummary.Replace("]]", ""); // SperkerSummary = SperkerSummary.Replace("<", ""); // SperkerSummary = SperkerSummary.Replace(">", ""); // TopSpeakerSummary.Text = DataProcessing.SubstringText(SperkerSummary,45); // } // catch (Exception eXML) // { // } // } //} // 相关列表 string SearchContent = "Author like '%" + CourseSperker + "%'"; string RelatedQueryStr = "SELECT Top 10 ArticleGUID,Title,Author,Area as SpeakerInfo,Filename,CreateTime FROM ArticleCurrent Where " + SearchContent; using (SqlConnection connection = new SqlConnection(connectingString)) { SqlCommand command = new SqlCommand(RelatedQueryStr, connection); connection.Open(); SqlDataReader CourseReder = command.ExecuteReader(); DataTable CourseTable = new DataTable(); CourseTable.Load(CourseReder); CoursesWithSperker.DataSource = CourseTable; CoursesWithSperker.DataBind(); } if (CourseKeyWord != null) { CourseKeyWord = CourseKeyWord.Replace(" ", ","); SearchContent = new DAL.CategoryDAL().GetArticleSearchContent(CourseKeyWord); RelatedQueryStr = "SELECT Top 10 ArticleGUID,Title,Author,Area as SpeakerInfo,Filename,CreateTime FROM ArticleCurrent Where " + SearchContent; using (SqlConnection connection = new SqlConnection(connectingString)) { SqlCommand command = new SqlCommand(RelatedQueryStr, connection); connection.Open(); SqlDataReader CourseReder = command.ExecuteReader(); DataTable CourseTable = new DataTable(); CourseTable.Load(CourseReder); CoursesWithTitle.DataSource = CourseTable; CoursesWithTitle.DataBind(); } } }
protected void Page_PreRender(object sender, EventArgs e) { url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/"; string ChannelTitle = null; // 痕迹&栏目标题 if (Request.QueryString["alias"] == null) { Response.Redirect("index.aspx"); } else { SetAliasAndIsChild(); } string CategoryGUID = DataQuery.CategoryAliasToID(alias); string CategoryPath = DataQuery.CategoryPath(CategoryGUID); char[] PathSeparator = { '/' }; string[] CategoryPaths = CategoryPath.Split(PathSeparator); ChannelAlias = DataQuery.CategoryIDToAlias(CategoryPaths[4]); string Lv2Alias = DataQuery.CategoryIDToAlias(CategoryPaths[5]);//2级分类 ChannelTitle = DataQuery.GetNameByCategoryAlias(ChannelAlias); CurrentTrace.Text = ChannelTitle; CurrentCategoryName.Text = ChannelTitle; //竖导航 String Lv2sAlias = ChannelAlias; DataTable Lv2CategoriesInfo = DataQuery.GetSubCategories(Lv2sAlias); DataRow[] Lv2Current = Lv2CategoriesInfo.Select("CategoryAlias = '" + Lv2Alias + "'"); if (Lv2Current.Length > 0) { Lv2CategoriesIndex = Array.IndexOf(Lv2CategoriesInfo.Select("", "XIndex asc"), Lv2Current[0]); } Lv3Navi.DataSource = Lv2CategoriesInfo; Lv3Navi.DataBind(); //主列表 SetAliasAndIsChild(); // if (Request.QueryString["order"] == null) { ListOrder = "desc"; RadioDesc.Checked = true; } else { ListOrder = Request.QueryString["order"].ToString(); switch (ListOrder) { case "asc": RadioAsc.Checked = true; break; case "desc": RadioDesc.Checked = true; break; default: RadioDesc.Checked = true; break; } } // ListType = GetListType(); // string guid = DataQuery.CategoryAliasToID(alias); if (IsChild == "0") { switch (ListType) { case "pic": Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListPic.DataBind(); break; case "text": Level3MainListText.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListText.DataBind(); break; default: Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListPic.DataBind(); break; } } else { switch (ListType) { case "pic": Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListPic.DataBind(); break; case "text": Level3MainListText.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListText.DataBind(); break; default: Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListPic.DataBind(); break; } } }
protected void Page_PreRender(object sender, EventArgs e) { url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/"; ChannelAlias = ConfigurationManager.AppSettings["ChannelClass"]; string ChannelTitle = "名校公开课"; // 痕迹&栏目标题 //CurrentTrace.Text = ChannelTitle; //CurrentCategoryName.Text = ChannelTitle; //TraceLv2Link.NavigateUrl = "Level2Class.aspx"; //1 //2 Lv3NaviAlias1 = DataQuery.GetChannelAliasByName(ChannelAlias, "国内985大学"); DataTable Lv3Navi2Items = DataQuery.GetSubCategories(Lv3NaviAlias1); Lv3Navi2.DataSource = Lv3Navi2Items; Lv3Navi2.DataBind(); //2a Lv3NaviAlias1a = DataQuery.GetChannelAliasByName(ChannelAlias, "国内211大学"); DataTable Lv3Navi2aItems = DataQuery.GetSubCategories(Lv3NaviAlias1a); Lv3Navi2a.DataSource = Lv3Navi2aItems; Lv3Navi2a.DataBind(); //2b Lv3NaviAlias1b = DataQuery.GetChannelAliasByName(ChannelAlias, "国内其他大学"); DataTable Lv3Navi2bItems = DataQuery.GetSubCategories(Lv3NaviAlias1b); Lv3Navi2b.DataSource = Lv3Navi2bItems; Lv3Navi2b.DataBind(); //3 Lv3NaviAlias2 = DataQuery.GetChannelAliasByName(ChannelAlias, "国外大学"); DataTable Lv3Navi3Items = DataQuery.GetSubCategories(Lv3NaviAlias2); Lv3Navi3.DataSource = Lv3Navi3Items; Lv3Navi3.DataBind(); // SetAliasAndIsChild(); string CategoryGUID = DataQuery.CategoryAliasToID(alias); string CategoryPath = DataQuery.CategoryPath(CategoryGUID); char[] PathSeparator = { '/' }; string[] CategoryPaths = CategoryPath.Split(PathSeparator); string Lv2Alias = DataQuery.CategoryIDToAlias(CategoryPaths[5]);//2级分类 if (Lv2Alias == "gxb2_openclass_3") { Lv2CategoriesIndex = 0; } else if (Lv2Alias == Lv3NaviAlias1) { Lv2CategoriesIndex = 1; } else if (Lv2Alias == Lv3NaviAlias1a) { Lv2CategoriesIndex = 2; } else if (Lv2Alias == Lv3NaviAlias1b) { Lv2CategoriesIndex = 3; } else if (Lv2Alias == Lv3NaviAlias2) { Lv2CategoriesIndex = 4; } else { Lv2CategoriesIndex = 0; } //主列表 if (Request.QueryString["order"] == null) { ListOrder = "desc"; RadioDesc.Checked = true; } else { ListOrder = Request.QueryString["order"].ToString(); switch (ListOrder) { case "asc": RadioAsc.Checked = true; break; case "desc": RadioDesc.Checked = true; break; default: RadioDesc.Checked = true; break; } } // ListType = GetListType(); // string guid = DataQuery.CategoryAliasToID(alias); if (IsChild == "0") { switch (ListType) { case "pic": Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListPic.DataBind(); break; case "text": Level3MainListText.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListText.DataBind(); break; default: Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, true); Level3MainListPic.DataBind(); break; } } else { switch (ListType) { case "pic": Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListPic.DataBind(); break; case "text": Level3MainListText.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListText.DataBind(); break; default: Level3MainListPic.DataSource = new DAL.Article().GetArticleList(guid, false, ListOrder, false); Level3MainListPic.DataBind(); break; } } }