Monday, 27 February 2012

Singleton Class


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusinessLayer
{
    public partial class Management
    {
        #region "Code to follow Singleton Design Pattern"

        /// <summary>
        /// Declare a private static variable
        /// </summary>
        private static Management _Instance;

        /// <summary>
        /// Return the instance of the application by initialising once only.
        /// </summary>
        public static Management GetInstance
        {
            get
            {
                if (_Instance == null)
                {
                    _Instance = new Management();
                }
                return _Instance;
            }
            set
            {
                _Instance = value;
            }
        }
        #endregion


        //public List<Company> GetChildCompany(int p)
        //{
        //    throw new NotImplementedException();
        //}

        public void InsertVoucher(Objects.PaymentReceipt newVoucher)
        {
            throw new NotImplementedException();
        }
    }
}

No comments:

Post a Comment