protected void Page_Load(object sender, EventArgs e) { string requestCategoryGuid = Request.QueryString["CategoryGuid"]; if(categoryManager == null) categoryManager = new Wis.Website.DataManager.CategoryManager(); DropdownMenuCategory.MenuItems = categoryManager.GetCategoryMenuItems(); if (!Page.IsPostBack) { // 获取分类的信息 if (Wis.Toolkit.Validator.IsGuid(requestCategoryGuid)) { Guid categoryGuid = new Guid(requestCategoryGuid); category = categoryManager.GetCategoryByCategoryGuid(categoryGuid); } // 提交表单前检测 this.btnOK.Attributes.Add("onclick", ""); } // 管理所在位置 MySiteMapPath List<KeyValuePair<string, Uri>> nodes = new List<KeyValuePair<string, Uri>>(); if (category != null) { nodes.Add(new KeyValuePair<string, Uri>(category.CategoryName, new Uri(Request.Url, string.Format("ArticleList.aspx?CategoryGuid={0}", category.CategoryGuid)))); } nodes.Add(new KeyValuePair<string, Uri>("新增内容", Request.Url)); ((Wis.Toolkit.SiteMapDataProvider)SiteMap.Provider).Stack(nodes); }
public static List<Article> GetArticlesByKeywords(string keywords, Guid categoryGuid, int pageIndex, int pageSize) { if (string.IsNullOrEmpty(keywords)) return GetArticlesByCategoryGuid(categoryGuid, pageIndex, pageSize); keywords = keywords.Replace("\"", "").Replace("'", ""); // ����һ����ע��ʽ�������� // ��ȡ������ֵ伯�� SortedList<Guid, Category> categoryDictionaries = new SortedList<Guid, Category>(); CategoryManager categoryManager = new CategoryManager(); categoryDictionaries = categoryManager.GetCategoryDictionaries(); DbProviderHelper.GetConnection(); DbCommand command = DbProviderHelper.CreateCommand("SelectObjects", CommandType.StoredProcedure); command.Parameters.Add(DbProviderHelper.CreateParameter("@TableName", DbType.String, "Article")); command.Parameters.Add(DbProviderHelper.CreateParameter("@ColumnList", DbType.String, "*")); if (categoryGuid == null || categoryGuid.Equals(Guid.Empty)) command.Parameters.Add(DbProviderHelper.CreateParameter("@SearchCondition", DbType.String, string.Format("CONTAINS(*, N'\" * {0} * \"') ", keywords))); else command.Parameters.Add(DbProviderHelper.CreateParameter("@SearchCondition", DbType.String, string.Format("CONTAINS(*, N'\" * {0} * \"') and CategoryGuid='{1}'", keywords, categoryGuid))); command.Parameters.Add(DbProviderHelper.CreateParameter("@OrderList", DbType.String, "DateCreated DESC")); command.Parameters.Add(DbProviderHelper.CreateParameter("@PageSize", DbType.Int32, pageSize)); command.Parameters.Add(DbProviderHelper.CreateParameter("@PageIndex", DbType.Int32, pageIndex)); DbDataReader dataReader = DbProviderHelper.ExecuteReader(command); List<Article> articles = new List<Article>(); while (dataReader.Read()) { Article article = new Article(); article.ArticleId = Convert.ToInt32(dataReader["ArticleId"]); article.ArticleGuid = (Guid)dataReader["ArticleGuid"]; // ��ȡ Category ���� article.Category = categoryDictionaries[(Guid)dataReader["CategoryGuid"]]; if (dataReader["MetaKeywords"] != DBNull.Value) article.MetaKeywords = Convert.ToString(dataReader["MetaKeywords"]); if (dataReader["MetaDesc"] != DBNull.Value) article.MetaDesc = Convert.ToString(dataReader["MetaDesc"]); article.Title = Convert.ToString(dataReader["Title"]); if (dataReader["TitleColor"] != DBNull.Value) article.TitleColor = Convert.ToString(dataReader["TitleColor"]); if (dataReader["SubTitle"] != DBNull.Value) article.SubTitle = Convert.ToString(dataReader["SubTitle"]); if (dataReader["Summary"] != DBNull.Value) article.Summary = Convert.ToString(dataReader["Summary"]); if (dataReader["ContentHtml"] != DBNull.Value) article.ContentHtml = Convert.ToString(dataReader["ContentHtml"]); if (dataReader["Editor"] != DBNull.Value) article.Editor = (Guid)dataReader["Editor"]; if (dataReader["Author"] != DBNull.Value) article.Author = Convert.ToString(dataReader["Author"]); if (dataReader["Original"] != DBNull.Value) article.Original = Convert.ToString(dataReader["Original"]); article.Rank = Convert.ToInt32(dataReader["Rank"]); article.Hits = Convert.ToInt32(dataReader["Hits"]); article.Comments = Convert.ToInt32(dataReader["Comments"]); article.Votes = Convert.ToInt32(dataReader["Votes"]); article.DateCreated = Convert.ToDateTime(dataReader["DateCreated"]); articles.Add(article); } dataReader.Close(); return articles; }
protected void Page_Load(object sender, EventArgs e) { // 1 获取分类的信息 string requestCategoryGuid = Request.QueryString["CategoryGuid"]; if (string.IsNullOrEmpty(requestCategoryGuid) || !Wis.Toolkit.Validator.IsGuid(requestCategoryGuid)) { Warning.InnerHtml = "不正确的分类编号,请<a href='ArticleSelectCategory.aspx'>返回</a>选择分类"; return; } if (categoryManager == null) categoryManager = new Wis.Website.DataManager.CategoryManager(); Guid categoryGuid = new Guid(requestCategoryGuid); category = categoryManager.GetCategoryByCategoryGuid(categoryGuid); if (string.IsNullOrEmpty(category.CategoryName)) { Warning.InnerHtml = "未读取到分类信息,请<a href='ArticleSelectCategory.aspx'>返回</a>选择分类"; return; } HyperLinkCategory.Text = category.CategoryName; HyperLinkCategory.NavigateUrl = string.Format("ArticleList.aspx?CategoryGuid={0}", category.CategoryGuid); }
protected void Page_Load(object sender, EventArgs e) { // 获取分类编号 string requestCategoryGuid = Request.QueryString["CategoryGuid"]; if (Wis.Toolkit.Validator.IsGuid(requestCategoryGuid)) categoryGuid = new Guid(requestCategoryGuid); else categoryGuid = Guid.Empty; if (!Page.IsPostBack) { BindRepeater(); } if (!categoryGuid.Equals(Guid.Empty)) { if (categoryManager == null) categoryManager = new Wis.Website.DataManager.CategoryManager(); category = categoryManager.GetCategoryByCategoryGuid(categoryGuid); } // 管理所在位置 MySiteMapPath List<KeyValuePair<string, Uri>> nodes = new List<KeyValuePair<string, Uri>>(); if (category != null) { nodes.Add(new KeyValuePair<string, Uri>(category.CategoryName, new Uri(Request.Url, string.Format("ArticleList.aspx?CategoryGuid={0}", category.CategoryGuid)))); } nodes.Add(new KeyValuePair<string, Uri>("内容管理", Request.Url)); ((Wis.Toolkit.SiteMapDataProvider)SiteMap.Provider).Stack(nodes); }
/// <summary> /// 发布被引用的页面,比如首页某个栏目引用了该分类,专题引用了改分类,把关联的发布页面重新生成 /// </summary> /// <param name="categoryGuid"></param> public void ReleasingRelatedReleases(Guid relatedGuid) { CategoryManager categoryManager = new CategoryManager(); List<Release> relatedReleases = GetRelatedReleases(relatedGuid); foreach (Release relatedRelease in relatedReleases) { switch (relatedRelease.Template.TemplateType) { case TemplateType.Index: ReleasingIndex(relatedRelease); break; case TemplateType.ArticleItem: // 发布对应分类下的所有文章 ArticleManager articleManager = new ArticleManager(); List<Article> relatedArticles = articleManager.GetArticlesByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Article relatedArticle in relatedArticles) { ReleasingArticleItem(relatedArticle, relatedRelease); } break; case TemplateType.ArticleList: // 发布对应分类下的所有列表页 List<Category> relatedArticleListCategories = categoryManager.GetCategorysByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Category relatedCategory in relatedArticleListCategories) { ReleasingArticleList(relatedCategory, relatedRelease); } break; case TemplateType.ArticleIndex: // 发布对应分类下的所有索引页 List<Category> relatedArticleIndexCategories = categoryManager.GetCategorysByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Category relatedCategory in relatedArticleIndexCategories) { ReleasingArticleIndex(relatedCategory, relatedRelease); } break; case TemplateType.Page: // 发布对应的单页 PageManager pageManager = new PageManager(); List<Page> relatedPages = pageManager.GetPagesByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Page relatedPage in relatedPages) { ReleasingPage(relatedPage, relatedRelease); } break; case TemplateType.PhotoArticleItem: // 发布对应分类下的图片新闻 ArticlePhotoManager photoArticleManager = new ArticlePhotoManager(); List<ArticlePhoto> photoArticles = photoArticleManager.GetPhotoArticlesByReleaseGuid(relatedRelease.ReleaseGuid); foreach (ArticlePhoto photoArticle in photoArticles) { ReleasingPhotoArticleItem(photoArticle, relatedRelease); } break; case TemplateType.PhotoArticleList: // 发布对应分类下的列表页 List<Category> relatedPhotoArticleListCategories = categoryManager.GetCategorysByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Category relatedCategory in relatedPhotoArticleListCategories) { ReleasingPhotoArticleList(relatedCategory, relatedRelease); } break; case TemplateType.SpecialList: // 发布专题列表页 SpecialManager specialManager = new SpecialManager(); List<Special> relatedSpecials = specialManager.GetSpecialsByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Special relatedSpecial in relatedSpecials) { ReleasingSpecial(relatedSpecial, relatedRelease); } break; case TemplateType.VideoArticleItem: // 发布对应分类下的所有视频文章详细页 VideoArticleManager videoArticleManager = new VideoArticleManager(); List<VideoArticle> relatedVideoArticles = videoArticleManager.GetVideoArticlesByReleaseGuid(relatedRelease.ReleaseGuid); foreach (VideoArticle relatedVideoArticle in relatedVideoArticles) { ReleasingVideoArticleItem(relatedVideoArticle, relatedRelease); } break; case TemplateType.VideoArticleList: // 发布对应分类下的所有视频列表页 List<Category> relatedVideoArticleListCategories = categoryManager.GetCategorysByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Category relatedCategory in relatedVideoArticleListCategories) { ReleasingVideoArticleList(relatedCategory, relatedRelease); } break; case TemplateType.VideoArticleIndex: // 发布对应分类下的所有视频索引页 List<Category> relatedVideoArticleIndexCategories = categoryManager.GetCategorysByReleaseGuid(relatedRelease.ReleaseGuid); foreach (Category relatedCategory in relatedVideoArticleIndexCategories) { ReleasingVideoArticleIndex(relatedCategory, relatedRelease); } break; } } }