Click here to Skip to main content
15,897,187 members
Articles / Web Development / ASP.NET

Open Source Extensible Enterprise n-tier Application Framework with Multilayered Architecture

Rate me:
Please Sign up or sign in to vote.
4.67/5 (2 votes)
3 Dec 2010MIT3 min read 37K   770   41  
Xenta architecture overview
using System;
using System.Web.UI.WebControls;
using SiberTek.Xenta.Enums;
using SiberTek.Xenta.Presentation;
using SiberTek.Xenta.Presentation.Utils;
using SiberTek.Xenta.Presentation.Resources;
using SiberTek.Xenta.Web.Home.Modules;
using SiberTek.Xenta.Web.Utils;

namespace SiberTek.Xenta.Web.Home.Pages
{
    public partial class ArticlePage : HomePageBase
    {
        #region Properties
        private int QParamArticle
        {
            get
            {
                return HttpHelper.GetQueryParam<Int32>("Article");
            }
        }

        public override string PageTitle
        {
            get
            {
                return infArticle.MetaTitle;
            }
        }

        public override string PageDescription
        {
            get
            {
                return infArticle.MetaDescription;
            }
        }

        public override string PageKeywords
        {
            get
            {
                return infArticle.MetaKeywords;
            }
        }
        #endregion

        #region Handlers
        protected override void OnInit(EventArgs e)
        {
            if(!IsPostBack)
            {
                btnCreateComment.CommandName = "Create";
                lblTags.Text = StringManager.GetString("Home.ArticlePage.lblTags.Text");
                lblComments.Text = StringManager.GetString("Home.ArticlePage.lblComments.Text");
                lblCreateComment.Text = StringManager.GetString("Home.ArticlePage.lblCreateComment.Text");
                btnCreateComment.Text = StringManager.GetString("Home.ArticlePage.btnCreateComment.Text");
            }
            btnCreateComment.Command += frmPublicationCommentForm.OnCommand;
            btnCreateComment.Command += OnCommand;

            base.OnInit(e);
        }

        protected override void OnLoadComplete(EventArgs e)
        {
            if(!IsPostBack)
            {
                infArticle.PublicationID = QParamArticle;
                infArticle.BindData();

                if(!infArticle.Visible)
                {
                    Response.Redirect(UrlHelper.GetUrl("home", "not-found.aspx"));
                }

                lstTagList.PublicationID = QParamArticle;
                lstTagList.BindData();
                pnlTags.Visible = lstTagList.ItemCount != 0;

                int topicID = ForumHelper.GetForumTopicAssignedToPublication(QParamArticle);
                if(topicID != 0)
                {
                    frmPublicationCommentForm.TopicID = topicID;
                    lstPublicationCommentList.TopicID = topicID;

                    if(!ForumHelper.IsUserHasForumTopicPermission(topicID, UserContext.Current.UserID, (int)ForumPermission.ForumWrite))
                    {
                        btnCreateComment.Enabled = false;
                        frmPublicationCommentForm.Enabled = false;
                    }
                    if(ForumHelper.IsUserHasForumTopicPermission(topicID, UserContext.Current.UserID, (int)ForumPermission.ForumRead))
                    {
                        lstPublicationCommentList.BindData();
                    }
                    pnlComments.Visible = lstPublicationCommentList.ItemCount != 0;
                }
                else
                {
                    pnlComments.Visible = false;
                    pnlCreateComment.Visible = false;
                }

                blkTagCloudBlock.BindData();
                blkSubscriptionBlock.BindData();

                ctlBreadcrumb.Items.Add(new Breadcrumb.Item(StringManager.GetString("Home.HomePage.Title"), UrlHelper.GetUrl("home")));
                ctlBreadcrumb.Items.Add(new Breadcrumb.Item(StringManager.GetString("Home.ArticleIndexPage.Title"), UrlHelper.GetUrl("home", "articles.aspx")));
                ctlBreadcrumb.Items.Add(new Breadcrumb.Item(infArticle.MetaTitle));
                ctlBreadcrumb.BindData();
            }
            base.OnLoadComplete(e);
        }

        public void OnCommand(object sender, CommandEventArgs e)
        {
            switch(e.CommandName)
            {
                case "Create":
                    {
                        frmPublicationCommentForm.Reset();
                        lstPublicationCommentList.BindData();
                        pnlComments.Visible = lstPublicationCommentList.ItemCount != 0;
                    }
                    break;
            }
        }
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions