private string GetRecommend() { string sDiv = string.Empty; int iDescLength = 108; DataTable dt = new DAL.CategoryDAL().GetRecommendZT(sCategoryPath, iYIndex + 1); for (int i = 0; i < dt.Rows.Count; i++) { DataTable dtArticle = new DAL.Article().GetArticleList(dt.Rows[i]["CategoryGUID"].ToString(), false, 4); string sTitle = dt.Rows[i]["CategoryName"].ToString(); string sContent = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle); sContent = DAL.Article.RemoveHtml(sContent); string sDesc = sContent; if (sContent.Length > iDescLength) { sContent = sContent.Substring(0, iDescLength); sDesc = sDesc.Remove(0, iDescLength); if (sDesc.StartsWith(">")) { sDesc.Remove(0, 1); } } else { sDesc = string.Empty; } sDiv += "<div class=\"SpecialAttentionLeftCommendItem\">"; sDiv += "<div class=\"SpecialAttentionNewLeft\">"; sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle); sDiv += "<img width=\"158\" height=\"118\" src=\"ShowZTImage.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" alt=\"\" border=\"0\" /></a>"; sDiv += "</div>"; sDiv += "<div class=\"SpecialAttentionNewRightL\">"; sDiv += "<div class=\"SpecialAttentionNewTitleL\">"; sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">{2}</a></div>", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle); sDiv += string.Format("<div class=\"ZTSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc)); sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle)) + sContent + "</a>"; sDiv += "</div><table class=\"SpecialAttentionNewTableL\" style=\"table-layout:fixed;\" width=\"465\">"; if (dtArticle.Rows.Count > 0) { for (int j = 0; j < dtArticle.Rows.Count; j++) { if (j % 2 == 0) { sDiv += "<tr>"; } sDiv += "<td class=\"SpecialAttentionNewTableTitleL\" style=\"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;\" width=\"48%\">"; sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{1}</a></td>", dtArticle.Rows[j]["ArticleGUID"].ToString(), dtArticle.Rows[j]["Title"].ToString()); if (j % 2 == 1) { sDiv += "</tr>"; } } } sDiv += "</table></div></div>"; } return(sDiv); }
public HomeController(DAL.CategoryDAL cadal, DAL.BlogDAL bdal, DAL.LogDAL logdal, IHostingEnvironment hostingEnv) { this.cadal = cadal; this.bdal = bdal; this.logdal = logdal; this.hostingEnv = hostingEnv; }
// GET: /<controller>/ public IActionResult Index() { var str = ""; var cateDal = new DAL.CategoryDAL(); str = "新增的分类返回的值:" + cateDal.Insert(new Model.Category() { CateName = "newcatename" }).ToString() + "\r\n"; str = "删除Id==7返回的值:" + cateDal.Delete(7) + "\r\n"; Model.Category cate = cateDal.GetModel(8); if (cate != null) { cate.CateName = "新修改的名称" + DateTime.Now; str += "修改Id==8返回的值:" + cateDal.Update(cate) + "\r\n"; } List <Model.Category> list = cateDal.GetList(""); foreach (var item in list) { str += $"分类ID:{item.Id},分类名称:{item.CateName}\r\n"; } return(Content(str)); }
public TestController(DAL.AdminDAL adal, DAL.BlogDAL blogdal, DAL.CategoryDAL cadal, IHostingEnvironment hostingEnv) { this.adal = adal; this.cadal = cadal; this.blogdal = blogdal; this.hostingEnv = hostingEnv; }
public IActionResult Index() { ///1、测试增 string str = ""; mhq.Blog.DAL.CategoryDAL cadal = new DAL.CategoryDAL(); str += "新增的ID值:" + cadal.insert(new Model.Category() { caname = "caname", bh = "01", pbh = "01", remark = "01" }) + "<hr />"; //2、测试删 bool b = cadal.Delete(3); str += "删除ID=7的结果:" + b + "<hr />"; //3、测试修改 ////先取出数据 Model.Category ca = cadal.Getmodel(3); if (ca != null) { ca.caname = "新修改的名称" + DateTime.Now; bool b2 = cadal.update(ca); str += "修改ID=8的结果:" + b2 + "<hr />"; } ///4、测试查询 List <Model.Category> list = cadal.GetList(""); foreach (var item in list) { str += $"<div>分类id:{item.id},分类名称:{item.caname}</div >"; } return(Content(str)); }
public IActionResult Index(string number) { DAL.CategoryDAL cadal = new DAL.CategoryDAL(); DAL.BlogDAL dal = new DAL.BlogDAL(); ViewBag.calist = cadal.GetList(""); ViewBag.datelist = dal.GetCreatDateGroup(); return(View()); }
//private string GetLevel2New() //{ // //最新动态 // int iDescLength = 360; // string sDiv = string.Empty; // string sDesc = string.Empty; // DataTable dt = new DAL.CategoryDAL().GetArticleIndexList(sCategoryPath, "最新动态", 3,true); // sDiv = "<div class=\"SpecialAttentionLv2NewLeft\">"; // for (int i = 0; i < dt.Rows.Count; i++) // { // sDiv += "<div class=\"SpecialAttentionLv2NewItem\">"; // sDiv += "<div class=\"SpecialAttentionLv2NewTitle\">"; // sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{1}</a>", dt.Rows[i]["ArticleGUID"].ToString(), dt.Rows[i]["Title"].ToString()); // sDiv += "</div>"; // string sContent = DAL.Article.RemoveHtml(dt.Rows[i]["Summary"].ToString()); // if (sContent.Length > iDescLength) { // sDesc = sContent.Remove(0, iDescLength); // sContent = sContent.Substring(0, iDescLength); // } // sDiv += string.Format("<div class=\"ZTSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">{1}</div>", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc), sContent); // sDiv += "</div>"; // } // sDiv += "</div>"; // sDiv += "<div class=\"SpecialAttentionLv2NewRight\">"; // string strFilePath = System.Configuration.ConfigurationManager.AppSettings["FileRootPath"]; // string[] pathList = strFilePath.Split('|'); // for (int i = 0; i < dt.Rows.Count; i++) // { // if (i >= 2) break; // string picpath = string.Empty; // sDiv += "<div class=\"SpecialAttentionLv2NewRightItem\">"; // if (!string.IsNullOrEmpty(dt.Rows[i]["coursepicture"].ToString())) // { // foreach (string sPath in pathList) // { // string tempPath = sPath.Split(',')[1] + "\\" + dt.Rows[i]["Filename"].ToString(); // if (Directory.Exists(tempPath)) // { // string[] sTemp = dt.Rows[i]["coursepicture"].ToString().Split(','); // picpath = sPath.Split(',')[0] + "/" + dt.Rows[i]["Filename"].ToString() + "/" + sTemp[sTemp.Length-1]; // break; // } // } // } // sDiv += string.Format("<img src=\"{0}\" width=\"288px\" height=\"187px\">", picpath); // sDiv += "<div class=\"SpecialAttentionLv2NewRightItemTitle\">"; // sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{2}\" target=\"_blank\">{1} {2}</a>", dt.Rows[i]["ArticleGUID"].ToString(), dt.Rows[i]["Author"].ToString(), dt.Rows[i]["Title"].ToString()); // sDiv += "</div>"; // } // sDiv += "</div>"; // return sDiv; //} //CC private string GetLevel2New() { //最新动态 int iDescLength = 98; string sDiv = string.Empty; string sDesc = string.Empty; DataTable dt = new DAL.CategoryDAL().GetArticleIndexList(sCategoryPath, "最新动态", 9, true); sDiv = "<div class=\"SpecialAttentionLv2NewLeft\">"; for (int i = 3; i < dt.Rows.Count; i++) { sDiv += "<div class=\"SpecialAttentionLv2NewItem\">"; sDiv += "<div class=\"SpecialAttentionLv2NewTitle\">"; sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{1}</a>", dt.Rows[i]["ArticleGUID"].ToString(), dt.Rows[i]["Title"].ToString()); sDiv += "</div>"; string sContent = DAL.Article.RemoveHtml(dt.Rows[i]["Summary"].ToString()); if (sContent.Length > iDescLength) { sDesc = sContent.Remove(0, iDescLength); sContent = sContent.Substring(0, iDescLength); } sDiv += string.Format("<div class=\"ZTSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">{1}</div>", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc), sContent); sDiv += "</div>"; } sDiv += "</div>"; sDiv += "<div class=\"SpecialAttentionLv2NewRight\">"; string strFilePath = System.Configuration.ConfigurationManager.AppSettings["FileRootPath"]; string[] pathList = strFilePath.Split('|'); for (int i = 0; i < 3; i++) { string picpath = string.Empty; sDiv += "<div class=\"SpecialAttentionLv2NewRightItem\">"; if (!string.IsNullOrEmpty(dt.Rows[i]["coursepicture"].ToString())) { foreach (string sPath in pathList) { string tempPath = sPath.Split(',')[1] + "\\" + dt.Rows[i]["Filename"].ToString(); if (Directory.Exists(tempPath)) { string[] sTemp = dt.Rows[i]["coursepicture"].ToString().Split(','); picpath = sPath.Split(',')[0] + "/" + dt.Rows[i]["Filename"].ToString() + "/" + sTemp[sTemp.Length - 1]; break; } } } sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\"><img src=\"{2}\" width=\"160px\" height=\"120px\" class=\"PicNoBorder\"></a>", dt.Rows[i]["ArticleGUID"].ToString(), dt.Rows[i]["Title"].ToString(), picpath); sDiv += "<div class=\"SpecialAttentionLv2NewRightItemTitle\">"; sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt.Rows[i]["ArticleGUID"].ToString(), dt.Rows[i]["Title"].ToString(), DataProcessing.SubstringText(dt.Rows[i]["Title"].ToString(), 17)); sDiv += "</div>"; } sDiv += "</div>"; return(sDiv); }
private string GetLevel2Top() { //专题标题 string sTitle = Request.Form["Title"]; //专题简介 int iDescLength = 144; string sContent = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle); sContent = DAL.Article.RemoveHtml(sContent); string sDesc = sContent; if (sContent.Length > iDescLength) { sContent = sContent.Substring(0, iDescLength); sDesc = sDesc.Remove(0, iDescLength); if (sDesc.StartsWith(">")) { sDesc = sDesc.Remove(0, 1); } } //核心观点 DataTable dt1 = new DAL.CategoryDAL().GetArticleIndexList(sCategoryPath, "核心观点", 2, false); //最新动态 DataTable dt2 = new DAL.CategoryDAL().GetArticleIndexList(sCategoryPath, "最新动态", 2, false); string sDiv = ""; sDiv += string.Format("<div class=\"ZTLevel2ContentRightCenterTitle\">{0}</div>", sTitle); sDiv += string.Format("<div class=\"ZTSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">{1}</div>", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc), sContent); sDiv += " <table class=\"SpecialAttentionNewTableXL\">"; sDiv += " <tr><td class=\"SpecialAttentionNewTableLineTitle\">核心观点</td>"; sDiv += " <td class=\"ZTNewTableTitleXL\">"; if (dt1.Rows.Count > 0) { sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt1.Rows[0]["ArticleGUID"].ToString(), dt1.Rows[0]["Title"].ToString(), DataProcessing.SubstringText(dt1.Rows[0]["Title"].ToString(), 35)); } sDiv += "</td>"; sDiv += "</tr><tr><td></td><td class=\"ZTNewTableTitleXL\">"; if (dt1.Rows.Count > 1) { sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt1.Rows[1]["ArticleGUID"].ToString(), dt1.Rows[1]["Title"].ToString(), DataProcessing.SubstringText(dt1.Rows[1]["Title"].ToString(), 35)); } sDiv += "</td>"; sDiv += "</tr><tr><td class=\"SpecialAttentionNewTableXLSpace\"></td></tr><tr><td class=\"SpecialAttentionNewTableLineTitle\">最新动态</td>"; sDiv += " <td class=\"ZTNewTableTitleXL\">"; if (dt2.Rows.Count > 0) { sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt2.Rows[0]["ArticleGUID"].ToString(), dt2.Rows[0]["Title"].ToString(), DataProcessing.SubstringText(dt2.Rows[0]["Title"].ToString(), 35)); } sDiv += "</td>"; sDiv += "</tr><tr><td></td><td class=\"ZTNewTableTitleXL\">"; if (dt2.Rows.Count > 1) { sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt2.Rows[1]["ArticleGUID"].ToString(), dt2.Rows[1]["Title"].ToString(), DataProcessing.SubstringText(dt2.Rows[1]["Title"].ToString(), 35)); } sDiv += "</td></tr></table>"; return(sDiv); }
public ActionResult MovieEntryForm() { IEnumerable <SelectListItem> lst = new DAL.MovieTypeDAL().GetAllMovies().Select(p => new SelectListItem { Text = p.MovieType1, Value = p.Id.ToString() }); IEnumerable <SelectListItem> cateogrylist = new DAL.CategoryDAL().GetAllCategories().Select(p => new SelectListItem { Text = p.CategoryName, Value = p.Id.ToString() }); ViewData["MovieType"] = lst; ViewData["Category"] = cateogrylist; return(PartialView()); }
// 栏目Path public static string CategoryPath(string CategoryGUID) { DataTable HotSubjectInfo = new DAL.CategoryDAL().GetCategorySimpleInfo(CategoryGUID); if (HotSubjectInfo.Rows.Count > 0) { string CategoryPath = HotSubjectInfo.Rows[0]["CategoryPath"].ToString(); return(CategoryPath); } else { return(null); } }
private string GetLastNew() { int iDescLength = 110; DataTable dt = new DAL.CategoryDAL().GetLastNewZT(sCategoryPath, iYIndex + 1); if (dt == null || dt.Rows.Count == 0) { return(string.Empty); } DataTable dtArticle = new DAL.Article().GetArticleList(dt.Rows[0]["CategoryGUID"].ToString(), false, 3); string sTitle = dt.Rows[0]["CategoryName"].ToString(); string sContent = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle); sContent = DAL.Article.RemoveHtml(sContent); string sDesc = sContent; if (sContent.Length > iDescLength) { sContent = sContent.Replace(" ", "");//*CC* sContent = sContent.Substring(0, iDescLength); sDesc = sDesc.Remove(0, iDescLength); if (sDesc.StartsWith(">")) { sDesc.Remove(0, 1); } } string sDiv = "<div class=\"SpecialAttentionNewLeft\">"; sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">", dt.Rows[0]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle); sDiv += "<img width=\"276\" height=\"195\" src=\"ShowZTImage.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" alt=\"\" border=\"0\" /></a>"; sDiv += "</div><div class=\"SpecialAttentionNewRight\"><div class=\"SpecialAttentionNewTitle\">"; sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">{2}</a>", dt.Rows[0]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), DataProcessing.SubstringText(sTitle, 19)); //*CC* sDiv += "</div>"; sDiv += string.Format("<div class=\"ZTSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc)); sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">", dt.Rows[0]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle)) + sContent + "</a>"; sDiv += "</div><table class=\"SpecialAttentionNewTable\" style=\"table-layout:fixed;\" width=\"355\">"; if (dtArticle.Rows.Count > 0) { for (int i = 0; i < dtArticle.Rows.Count; i++) { sDiv += "<tr><td class=\"SpecialAttentionNewTableTitle SpecialAttentionNewTableTitleZTTop\" style=\"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;\">"; sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a></td>", dtArticle.Rows[i]["ArticleGUID"].ToString(), dtArticle.Rows[i]["Title"].ToString(), DataProcessing.SubstringText(dtArticle.Rows[i]["Title"].ToString(), 18));//*CC* sDiv += "<td align=\"right\">" + DateTime.Parse(dtArticle.Rows[i]["CreateTime"].ToString()).ToString("yyyy-MM-dd") + "</td></tr>"; } } sDiv += "</table></div>"; return(sDiv); }
private byte[] GetAttachment(string sTitle, string alias) { DataTable dt = new DataTable(); dt = new DAL.CategoryDAL().GetImage(alias, sTitle); if (dt.Rows.Count == 0) { return new byte[] { } } ; byte[] btImg = string.IsNullOrEmpty(dt.Rows[0]["ContentSize"].ToString()) ? new byte[] { } : ((byte[])dt.Rows[0]["Content"]); return(btImg); } }
private byte[] GetAttachment(string sTitle) { string sZTSummaryAlias = ConfigurationManager.AppSettings["ZTSummaryAlias"]; DataTable dt = new DataTable(); dt = new DAL.CategoryDAL().GetImage(sZTSummaryAlias, sTitle); if (dt.Rows.Count == 0) { return new byte[] { } } ; byte[] btImg = string.IsNullOrEmpty(dt.Rows[0]["ContentSize"].ToString()) ? new byte[] { } : ((byte[])dt.Rows[0]["Content"]); return(btImg); } }
private string GetHot() { string sDiv = string.Empty; try { int iDescLength = 66; DataTable dt = new DAL.CategoryDAL().GetHotZT(); for (int i = 0; i < dt.Rows.Count; i++) { string sTitle = dt.Rows[i]["CategoryName"].ToString(); string sFixLenTitle = sTitle; if (sFixLenTitle.Length > 17) { sFixLenTitle = sFixLenTitle.Substring(0, 16) + "..."; } string sContent = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle); sContent = DAL.Article.RemoveHtml(sContent); string sDesc = sContent; if (sContent.Length > iDescLength) { sContent = sContent.Substring(0, iDescLength); sDesc = sDesc.Remove(0, iDescLength); if (sDesc.StartsWith(">")) { sDesc.Remove(0, 1); } } sDiv += "<div class=\"SpecialAttentionRightHotItem\">"; sDiv += "<div class=\"SpecialAttentionRightHotItemTitle\">"; sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">{3}</a>", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle, sFixLenTitle); sDiv += "</div>"; sDiv += "<div class=\"SpecialAttentionRightHotItemLeft\">"; sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle); sDiv += "<img width=\"118\" height=\"95\" src=\"ShowZTImage.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" alt=\"\" border=\"0\" /></a>"; sDiv += "</div>"; sDiv += string.Format("<div class=\"ZTSummary\" style=\"width:168px;margin:0 auto;\" data-tooltip=\"{0}\" data-placement=\"bottom\">", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc)); sDiv += "<a href=\"ShowSummary.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" target=\"_blank\">" + sContent + "</a>"; sDiv += "</div></div>"; } } catch { return(string.Empty); } return(sDiv); }
protected void Page_Load(object sender, EventArgs e) { sCategoryGUID = Request.QueryString["ID"].ToString();; DataTable CategoryInfo = new DAL.CategoryDAL().GetCategorySimpleInfo(sCategoryGUID); if (CategoryInfo.Rows.Count == 0) { return; } string sCategoryPath = CategoryInfo.Rows[0]["CategoryPath"].ToString(); int iYIndex = int.Parse(CategoryInfo.Rows[0]["YIndex"].ToString()) + 1; //Left string sTBGZ_Alias = ConfigurationManager.AppSettings["TBGZ_Alias"]; DataTable ZTNaviData = new DAL.CategoryDAL().GetZTMenu(sTBGZ_Alias); SpecialTree.DataSource = ZTNaviData; SpecialTree.DataBind(); //Right if (Request.QueryString["order"] == null) { ListOrder = "Asc"; RadioAsc.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; } } DataTable ZTMainData = new DAL.CategoryDAL().GetZTFromCategoryNote(sCategoryPath, iYIndex, ListOrder); ZTMainList.DataSource = ZTMainData; ZTMainList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { sCategoryGUID = (string)Session["ZJSP_ZTFL_GUID"]; //*CC* DataTable CategoryInfo = new DAL.CategoryDAL().GetCategorySimpleInfo(sCategoryGUID); if (CategoryInfo.Rows.Count == 0) { return; } string sCategoryPath = CategoryInfo.Rows[0]["CategoryPath"].ToString(); int iYIndex = int.Parse(CategoryInfo.Rows[0]["YIndex"].ToString()) + 1; DataTable ZTList = new DAL.CategoryDAL().GetZTFromCategory(sCategoryPath, iYIndex, 10, "asc"); HistoryList.DataSource = ZTList; HistoryList.DataBind(); //HistoryMore.NavigateUrl = "SpecialHistory.aspx?ID=" + sCategoryGUID; }
public static DataTable GetArticleIndexList(string sCategoryGUID, string count, string order) { DataSet ds = new DataSet(); string sql = "select top " + count + " ArticleGUID,Title,Filename,Author,Duration,SpeakerInfo,CreateTime from ( "; string sSearchContent = new DAL.CategoryDAL().GetArticleSearchContentTop(sCategoryGUID, true); if (!string.IsNullOrEmpty(sSearchContent)) { sql += @"select ArticleGUID,Title,Filename,Author,PageCount as Duration,Area as SpeakerInfo,CreateTime from ArticleCurrent where [State]=1 and (" + sSearchContent + ") and ContentType='' "; sql += @" union "; } sql += @" select ac.ArticleGUID,ac.Title,ac.Filename,ac.Author,ac.PageCount as Duration,ac.Area as SpeakerInfo,ac.CreateTime from ArticleCurrent ac inner join dbo.ArticleCurrentOfCategory acc on ac.ArticleGUID=acc.ArticleGUID and [State]=1 and acc.CategoryGUID in (select c.CategoryGUID from Category c,CategoryNodePosition p where c.CategoryGUID=p.CategoryGUID and p.CategoryPath like '%" + sCategoryGUID + "/%') "; sql += @" ) t "; sql += @" where t.ArticleGUID not in(select ArticleGUID from ArticleCurrentNotInCategory where CategoryGUID in (select c.CategoryGUID from Category c,CategoryNodePosition p where c.CategoryGUID=p.CategoryGUID and p.CategoryPath like '%" + sCategoryGUID + "/%'))"; sql += @" order by CreateTime " + order; SelectRows(ds, sql); return(ds.Tables[0]); }
//专业 private string GetMajorClass(string sAlias) { if (string.IsNullOrEmpty(sAlias)) { sAlias = System.Configuration.ConfigurationManager.AppSettings["MAJOR"]; } DataTable dt = new DAL.CategoryDAL().GetCategoryData(sAlias); string sStr = string.Empty; if (dt.Rows.Count > 0) { sStr = "{" + string.Format("Alias:\"{0}\",Name:\"{1}\"", string.Empty, "全部") + "}"; foreach (DataRow dr in dt.Rows) { sStr += ",{" + string.Format("Alias:\"{0}\",Name:\"{1}\"", dr["CategoryAlias"], dr["CategoryName"]) + "}"; } } return(string.Format("[{0}]", sStr)); }
protected void Page_Init(object sender, EventArgs e) { //专题导航 string sCategoryGUID = string.Empty; if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { sCategoryGUID = Request.QueryString["ID"]; } string sTBGZ_Alias = ConfigurationManager.AppSettings["TBGZ_Alias"]; DataTable dt = new DAL.CategoryDAL().GetZTMenu(sTBGZ_Alias); string sMenu = "<ul>"; sMenu += "<li class=\"SpecialAttentionNavSplit\"></li>"; foreach (DataRow dr in dt.Rows) { if (string.IsNullOrEmpty(sCategoryGUID)) { sCategoryGUID = dr["CategoryGUID"].ToString(); } if (sCategoryGUID == dr["CategoryGUID"].ToString()) { Session["ZJSP_ZTFL_NAME"] = dr["CategoryName"]; } sMenu += string.Format("<li id=\"{0}\" class=\"SpecialAttentionNavItem\"><a href=\"SpecialIndex.aspx?ID={0}&Title={1}\">{1}</a></li>", dr["CategoryGUID"], dr["CategoryName"]); sMenu += "<li class=\"SpecialAttentionNavSplit\"></li>"; } sMenu += "<li class=\"SpecialAttentionNavSplitHome\"></li>"; sMenu += "<li class=\"SpecialAttentionNavHome\"><a href=\"index.aspx\">返回首页</a></li>"; sMenu += "<li class=\"SpecialAttentionNavSplitHome\"></li>"; sMenu += "</ul>"; divMenu.InnerHtml = sMenu; //热门关键词 string sHotKey_Alias = ConfigurationManager.AppSettings["HotKeyAlias"]; divHotKey.InnerHtml = new DAL.CategoryDAL().GetHotKey(sHotKey_Alias); Session["ZJSP_ZTFL_GUID"] = sCategoryGUID; }
public IActionResult Index() { string str = ""; Random rd = new Random(); DAL.CategoryDAL cadal = new DAL.CategoryDAL(); DAL.BlogDAL bdal = new DAL.BlogDAL(); var calist = cadal.GetList(""); for (int i = 0; i < 100; i++) { string title = $"英雄联盟比赛{i}"; string body = title + "的内容"; Model.Category m = calist[rd.Next(0, calist.Count())]; string number = m.Number; string categoryName = m.CategoryName; bdal.Insert(new Model.Blog() { Title = title, Body = body, CategoryName = categoryName, CategoryNum = number }); } str = "添加100条数据"; //str += "新增的insert方法返回的值" + cadal.Insert(new Model.Category { CategoryName = "newca"}) + "<hr/>"; //str += "删除ID=11的数据值"+ cadal.Delete(11) + "<hr/>"; //Model.Category ca = cadal.GetModel(10); //if (ca != null) { // ca.CategoryName = "asadad"; // str += "更新ID=10的数据值" + cadal.Update(ca) + "<hr/>"; //} //List<Model.Category> list = cadal.GetList(""); //foreach(var item in list){ // str += $"<div>分类ID:{item.Id},分类名称:{item.CategoryName}</div>"; //} return(Content(str)); }
private string GetLevel2Other() { //其他 string sDiv = string.Empty; DataTable dt = new DAL.CategoryDAL().GetArticleIndexList(sCategoryPath, "相关内容", 0, false); foreach (DataRow dr in dt.Rows) { sDiv += ",{" + string.Format("ArticleGUID:\"{0}\",Title:\"{1}\",Author:\"{2}\",SpeakerInfo:\"{3}\",Duration:\"{4}\",CreateTime:\"{5}\"", dr["ArticleGUID"], dr["Title"], dr["Author"], dr["SpeakerInfo"], dr["Duration"], DateTime.Parse(dr["CreateTime"].ToString()).ToString("yyyy-MM-dd") ) + "}"; } if (sDiv.Length > 0) { sDiv = sDiv.Substring(1); } return(sDiv); }
protected void Page_Load(object sender, EventArgs e) { iPageSize = 15; //显示方式 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 = "?act=h"; string sAct = "h"; if (string.IsNullOrEmpty(sAct) || sAct == "h") { //热点 //if (string.IsNullOrEmpty(Request.QueryString["ID"])) return; sCategoryGUID = DataQuery.CategoryAliasToID(ConfigurationManager.AppSettings["EmbedCategory"]); sUrl += string.Format("&ID={0}", sCategoryGUID); dtArt = new DAL.Article().GetArticleListEmbed(sCategoryGUID, true, sSort, iPage, out iTotalRowsCount); sActionStr = "热门关键词"; } 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("ShowVideoBeta.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("ShowVideoBeta.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("ShowVideoBeta.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); }
public NewsController(DAL.NewsDAL dal, DAL.CategoryDAL cadal) { this.dal = dal; this.cadal = cadal; }
public CategoryController(DAL.CategoryDAL cadal) { this.dal = cadal; }
public BlogController(DAL.BlogDAL dal, DAL.CategoryDAL cadal) { this.cadal = cadal; this.dal = dal; }
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.HomeLite).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); }
public HomeController(DAL.BlogDAL bdal, DAL.CategoryDAL cadal) { this.cadal = cadal; this.bdal = bdal; }
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("HomeLite.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(); } } }
public CategoryController(DAL.CategoryDAL cadal, DAL.BlogDAL blogdal) { this.cadal = cadal; this.blogdal = blogdal; }
protected void Page_Load(object sender, EventArgs e) { InitForm(); 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链接路径 //高级搜索 sActionStr = "高级搜索"; if (string.IsNullOrEmpty(Request.QueryString["SelectType"])) { return; } sSelectType = int.Parse(Request.QueryString["SelectType"]); sUrl = string.Format("?SelectType={0}", sSelectType); //获取参数 sAlias = Request.QueryString["Alias"]; sAlias1 = Request.QueryString["Alias1"]; sAlias2 = Request.QueryString["Alias2"]; if (!string.IsNullOrEmpty(sAlias2)) { sTempAlias = sAlias2; } else if (!string.IsNullOrEmpty(sAlias1)) { sTempAlias = sAlias1; } else if (!string.IsNullOrEmpty(sAlias)) { sTempAlias = sAlias; } else { sTempAlias = string.Empty; } sArea = Request.QueryString["Area"]; sAuthor = Request.QueryString["Author"]; sKeyWords = Request.QueryString["keywords"]; sStartDate = Request.QueryString["StartDate"]; sEndDate = Request.QueryString["EndDate"]; //组合参数 sUrl += string.Format("&Alias={0}&Alias1={1}&Alias2={2}&Area={3}&Author={4}&keywords={5}&StartDate={6}&EndDate={7}", sAlias, sAlias1, sAlias2, sArea, Server.UrlEncode(sAuthor), Server.UrlEncode(sKeyWords), sStartDate, sEndDate); if (!string.IsNullOrEmpty(sKeyWords)) { sKeyWords = sKeyWords.Trim().Replace("+", ",").Replace(" ", ",").Replace(" ", ",").Replace(",", ",").Replace("|", "|").Replace("、", "|").Replace(",,", ","); } sSearchWhere = dal.GetArticleSearchContent(sKeyWords); string sAreaWhere = string.IsNullOrEmpty(sArea) ? string.Empty : GetWhere(sArea, "Area"); string sAuthorWhere = GetWhere(sAuthor, "Author"); string sDateWhere = GetWhere(sStartDate, sEndDate, "ac.CreateTime"); string sWhere = string.IsNullOrEmpty(sAreaWhere) ? string.Empty : sAreaWhere; if (!string.IsNullOrEmpty(sAuthorWhere)) { sWhere = string.Format(" {0} {1} ", string.IsNullOrEmpty(sWhere) ? string.Empty : string.Format("{0} and ", sWhere), sAuthorWhere); } if (!string.IsNullOrEmpty(sDateWhere)) { sWhere = string.Format(" {0} {1} ", string.IsNullOrEmpty(sWhere) ? string.Empty : string.Format("{0} and ", sWhere), sDateWhere); } if (!string.IsNullOrEmpty(sSearchWhere)) { sWhere = string.Format(" {0} {1} ", string.IsNullOrEmpty(sWhere) ? string.Empty : string.Format("{0} and ", sWhere), sSearchWhere); } ds = dal.GetAdvSearchArticleList(sWhere, iPage, iPageSize, sSort, sTempAlias); 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 = 128; 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"); sOutTrStr += string.Format("<tr><td class=\"MainListTitle\"><a href=\"{0}\" target=\"_blank\">{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 = DAL.Article.GetArticleImgPath(dr["Filename"].ToString(), dr["CoursePicture"].ToString()); 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\">"; sTemp += string.Format("<div class=\"SearchResultDetailTitle\"><a href=\"{0}\">{1}</a></div>", string.Format("ShowVideo.aspx?ID={0}", dr["ArticleGUID"]), dr["Title"]); sTemp += "<table class=\"SearchResultDetailInfo\">"; string sTempAuthor = 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>", sTempAuthor, 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>"; 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); }