Click here to Skip to main content
15,881,709 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 36.8K   770   41  
Xenta architecture overview
using System;
using System.ComponentModel;
using System.Web.UI.WebControls;
using SiberTek.Xenta.Presentation;
using SiberTek.Xenta.Presentation.Presenters;
using SiberTek.Xenta.Presentation.Views;
using SiberTek.Xenta.Presentation.Resources;
using SiberTek.Xenta.Utils;
using SiberTek.Xenta.Web.Controls;
using SiberTek.Xenta.Presentation.Utils;
using SiberTek.Xenta.Enums;

namespace SiberTek.Xenta.Web.Home.Modules
{
    public partial class PublicationCommentForm : ViewBase<ForumPostPresenter>, IForm, ICommandHandler
    {
        #region Properties
        [Browsable(false)]
        public int TopicID
        {
            get
            {
                return Convert.ToInt32(ViewState["TopicID"]);
            }
            set
            {
                ViewState["TopicID"] = value;
            }
        }

        public string ValidationGroup
        {
            set
            {
                vldTitle.ValidationGroup = value;
            }
        }

        public bool Enabled
        {
            set
            {
                txtTitle.ReadOnly = !value;
                txtText.ReadOnly = !value;
            }
        }
        #endregion

        #region Methods
        public void Reset()
        {
            txtTitle.Text = String.Empty;
            txtText.Text = String.Empty;
        }
        #endregion

        #region Handlers
        protected override void OnInit(EventArgs e)
        {
            if(!IsPostBack)
            {
                lblTitle.Text = StringManager.GetString("Home.PublicationCommentForm.lblTitle.Text");
                lblText.Text = StringManager.GetString("Home.PublicationCommentForm.lblText.Text");
            }
            base.OnInit(e);
        }

        public void OnCommand(object sender, CommandEventArgs e)
        {
            switch(e.CommandName)
            {
                case "Create":
                    {
                        try
                        {
                            ViewDataContainer item = new ViewDataContainer();

                            item["ParentPostID"] = 0;
                            item["TopicID"] = TopicID;
                            item["AuthorID"] = UserContext.Current.UserID;
                            item["Title"] = StringHelper.EncodeHtml(txtTitle.Text);
                            item["Text"] = StringHelper.EncodeHtml(txtText.Text);
                            item["IsActive"] = true;

                            DataContainer["ForumPost"] = item;

                            Presenter.Create();
                        }
                        catch(Exception ex)
                        {
                            Page.ShowMessage(ex.Message);
                        }
                    }
                    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