Click here to Skip to main content
15,881,882 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.Enums;
using SiberTek.Xenta.Web.Controls;
using SiberTek.Xenta.Presentation.Resources;

namespace SiberTek.Xenta.Web.Home.Modules
{
    public partial class PublicationTypeDropDownList : UserControlBase, IDropDownList<PublicationType?>
    {
        #region Events
        public event EventHandler SelectedIndexChanged;
        #endregion

        #region Properties
        [Browsable(false)]
        public PublicationType? SelectedValue
        {
            get
            {
                return String.IsNullOrEmpty(lstPublicationTypeList.SelectedValue) ? (PublicationType?)null : (PublicationType)Enum.Parse(typeof(PublicationType), lstPublicationTypeList.SelectedValue);
            }
            set
            {
                lstPublicationTypeList.SelectedValue = value.HasValue ? value.Value.ToString() : String.Empty;
            }
        }

        public bool AllowEmptyItem
        {
            get
            {
                return Convert.ToBoolean(ViewState["AllowEmptyItem"]);
            }
            set
            {
                ViewState["AllowEmptyItem"] = value;
            }
        }

        public bool AutoPostBack
        {
            get
            {
                return lstPublicationTypeList.AutoPostBack;
            }
            set
            {
                lstPublicationTypeList.AutoPostBack = value;
            }
        }

        public int ItemCount
        {
            get
            {
                return lstPublicationTypeList.Items.Count;
            }
        }

        public bool Enabled
        {
            set
            {
                lstPublicationTypeList.Enabled = value;
            }
        }
        #endregion

        #region Methods
        public override void BindData()
        {
            lstPublicationTypeList.Items.Clear();

            if(AllowEmptyItem)
            {
                lstPublicationTypeList.Items.Add(new ListItem("-", String.Empty));
            }
            foreach(string name in Enum.GetNames(typeof(PublicationType)))
            {
                lstPublicationTypeList.Items.Add(new ListItem(StringManager.GetString("Home.PublicationType.{0}", name), name));
            }
            base.BindData();
        }
        #endregion

        #region Handlers
        protected void LstPublicationTypeList_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            FireSelectedIndexChangedEvent();
        }
        #endregion

        #region Utilities
        private void FireSelectedIndexChangedEvent()
        {
            if(SelectedIndexChanged != null)
            {
                SelectedIndexChanged(this, EventArgs.Empty);
            }
        }
        #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