コード例 #1
0
        /// <summary>
        /// Parse the pathinfo. Translate pathinfo parameters into member variables.
        /// </summary>
        protected override void ParsePathInfo()
        {
            if (base.ModulePathInfo != null)
            {
                // try to find an articleId
                string expression = @"^\/(\d+)";
                if (Regex.IsMatch(base.ModulePathInfo, expression, RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled))
                {
                    this._currentArticleId = Int32.Parse(Regex.Match(base.ModulePathInfo, expression).Groups[1].Value);
                    this._currentAction    = ArticleModuleAction.Details;
                    return;
                }

                // try to find a categoryid
                expression = @"^\/category\/(\d+)";
                if (Regex.IsMatch(base.ModulePathInfo, expression, RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled))
                {
                    this._currentCategoryId = Int32.Parse(Regex.Match(base.ModulePathInfo, expression).Groups[1].Value);
                    this._currentAction     = ArticleModuleAction.Category;
                    return;
                }

                expression = @"^\/archive";
                if (Regex.IsMatch(base.ModulePathInfo, expression, RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled))
                {
                    this._isArchive     = true;
                    this._currentAction = ArticleModuleAction.Archive;
                    return;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public ArticleModule(IContentItemService <Article> contentItemService, ICategoryService categoryService, ICommentService commentService)
 {
     this._contentItemService = contentItemService;
     this._categoryService    = categoryService;
     this._commentService     = commentService;
     this._currentArticleId   = -1;
     this._currentCategoryId  = -1;
     this._currentAction      = ArticleModuleAction.List;
 }
コード例 #3
0
        /// <summary>
        /// Parse the pathinfo. Translate pathinfo parameters into member variables.
        /// </summary>
        protected override void ParsePathInfo()
        {
            if (base.ModulePathInfo != null)
                {
                    // try to find an articleId
                    string expression = @"^\/(\d+)";
                    if (Regex.IsMatch(base.ModulePathInfo, expression, RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled))
                    {
                        this._currentArticleId = Int32.Parse(Regex.Match(base.ModulePathInfo, expression).Groups[1].Value);
                        this._currentAction = ArticleModuleAction.Details;
                        return;
                    }

                    // try to find a categoryid
                    expression = @"^\/category\/(\d+)";
                    if (Regex.IsMatch(base.ModulePathInfo, expression, RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled))
                    {
                        this._currentCategoryId = Int32.Parse(Regex.Match(base.ModulePathInfo, expression).Groups[1].Value);
                        this._currentAction = ArticleModuleAction.Category;
                        return;
                    }

                    expression = @"^\/archive";
                    if (Regex.IsMatch(base.ModulePathInfo, expression, RegexOptions.Singleline | RegexOptions.CultureInvariant | RegexOptions.Compiled))
                    {
                        this._isArchive = true;
                        this._currentAction = ArticleModuleAction.Archive;
                        return;
                    }
                }
        }
コード例 #4
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public ArticleModule(IContentItemService<Article> contentItemService, ICategoryService categoryService, ICommentService commentService)
 {
     this._contentItemService = contentItemService;
     this._categoryService = categoryService;
     this._commentService = commentService;
     this._currentArticleId = -1;
     this._currentCategoryId = -1;
     this._currentAction = ArticleModuleAction.List;
 }
コード例 #5
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public ArticleModule(ICommonDao commonDao, IArticleDao articleDao)
 {
     this._commonDao = commonDao;
     this._articleDao = articleDao;
     this._currentArticleId = -1;
     this._currentCategoryId = -1;
     this._currentAction = ArticleModuleAction.List;
 }