// <fileinfo name="CategorySalesfor1997Row_Base.cs">
//      <copyright>
//          All rights reserved.
//      </copyright>
//      <remarks>
//          Do not change this source code manually. Changes to this file may 
//          cause incorrect behavior and will be lost if the code is regenerated.
//      </remarks>
//      <generator rewritefile="True" infourl="http://www.SharpPower.com">RapTier</generator>
// </fileinfo>

using System;

namespace MyCompany.MyProject.Db
{
    /// <summary>
    /// The base class for <see cref="CategorySalesfor1997Row"/> that 
    /// represents a record in the <c>Category Sales for 1997</c> view.
    /// </summary>
    /// <remarks>
    /// Do not change this source code manually. Update the <see cref="CategorySalesfor1997Row"/>
    /// class if you need to add or change some functionality.
    /// </remarks>
    public abstract class CategorySalesfor1997Row_Base
    {
        private string _categoryName;
        private decimal _categorySales;
        private bool _categorySalesNull = true;

        /// <summary>
        /// Initializes a new instance of the <see cref="CategorySalesfor1997Row_Base"/> class.
        /// </summary>
        public CategorySalesfor1997Row_Base()
        {
            // EMPTY
        }

        /// <summary>
        /// Gets or sets the <c>CategoryName</c> column value.
        /// </summary>
        /// <value>The <c>CategoryName</c> column value.</value>
        public string CategoryName
        {
            get { return _categoryName; }
            set { _categoryName = value; }
        }

        /// <summary>
        /// Gets or sets the <c>CategorySales</c> column value.
        /// This column is nullable.
        /// </summary>
        /// <value>The <c>CategorySales</c> column value.</value>
        public decimal CategorySales
        {
            get
            {
                if(IsCategorySalesNull)
                    throw new InvalidOperationException("Cannot get value because it is DBNull.");
                return _categorySales;
            }
            set
            {
                _categorySalesNull = false;
                _categorySales = value;
            }
        }

        /// <summary>
        /// Indicates whether the <see cref="CategorySales"/>
        /// property value is null.
        /// </summary>
        /// <value>true if the property value is null, otherwise false.</value>
        public bool IsCategorySalesNull
        {
            get { return _categorySalesNull; }
            set { _categorySalesNull = value; }
        }

        /// <summary>
        /// Returns the string representation of this instance.
        /// </summary>
        /// <returns>The string representation of this instance.</returns>
        public override string ToString()
        {
            System.Text.StringBuilder dynStr = new System.Text.StringBuilder(GetType().Name);
            dynStr.Append(':');
            dynStr.Append("  CategoryName=");
            dynStr.Append(CategoryName);
            dynStr.Append("  CategorySales=");
            dynStr.Append(IsCategorySalesNull ? (object)"<NULL>" : CategorySales);
            return dynStr.ToString();
        }
    } // End of CategorySalesfor1997Row_Base class
} // End of namespace