using System;

namespace ChuPiao.Common.Models
{
    /// <summary>
    /// 系统配置
    /// </summary>
    [Serializable]
    public class S_SysConfigEntity
    {
        public S_SysConfigEntity()
        { }
        #region Model
        private int _sc_id;
        private int _sc_key;
        private string _sc_name = "";
        private bool _sc_isuse = true;
        private int _sc_datatype;
        private string _sc_value = "";
        private string _sc_remark;
        /// <summary>
        /// 配置ID
        /// </summary>
        public int Sc_Id
        {
            set { _sc_id = value; }
            get { return _sc_id; }
        }
        /// <summary>
        /// 配置Key
        /// </summary>
        public int Sc_Key
        {
            set { _sc_key = value; }
            get { return _sc_key; }
        }
        /// <summary>
        /// 配置名称
        /// </summary>
        public string Sc_Name
        {
            set { _sc_name = value; }
            get { return _sc_name; }
        }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Sc_IsUse
        {
            set { _sc_isuse = value; }
            get { return _sc_isuse; }
        }
        /// <summary>
        /// 数据类型（默认为0，0--数字；1--字符串；2--日期）
        /// </summary>
        public int Sc_DataType
        {
            set { _sc_datatype = value; }
            get { return _sc_datatype; }
        }
        /// <summary>
        /// 配置值
        /// </summary>
        public string Sc_Value
        {
            set { _sc_value = value; }
            get { return _sc_value; }
        }
        /// <summary>
        /// 配置值说明
        /// </summary>
        public string Sc_Remark
        {
            set { _sc_remark = value; }
            get { return _sc_remark; }
        }

        #endregion Model

        #region 扩展属性

        private int _intValue;
        private string _strValue;
        private DateTime _dateValue;
        public void SetTypeValue()
        {
            switch (Sc_DataType)
            {
                case 0:
                    _intValue = int.Parse(_sc_value);
                    break;
                case 1:
                    _strValue = _sc_value;
                    break;
                case 2:
                    _dateValue = DateTime.Parse(_sc_value);
                    break;
            }
        }
        /// <summary>
        /// 数值
        /// </summary>
        public int IntValue
        {
            get { return _intValue; }
        }
        /// <summary>
        /// 字符串值
        /// </summary>
        public string StrValue
        {
            get { return _strValue; }
        }
        /// <summary>
        /// 日期值
        /// </summary>
        public DateTime DateValue
        {
            get { return _dateValue; }
        }

        #endregion

        #region ICloneable 成员

        public object Clone()
        {
            return this.MemberwiseClone();
        }

        #endregion
    }
}

