/*******************************************************************************
//  版权所有  (C) 2015 刺客
//  文 件 名：MCMasterInfo.cs
//  文件说明：会员消费主记录实体；
//  版    本：
//
//  创建标识：陈志豪 2016-01-07 10:36:54
//
//  修改标识：
//  修改说明：
*******************************************************************************/

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace VA.Modules.JDingMember.Interface.MemberConsume.ClassLibrary.Model
{
    /// <summary>
    /// 会员消费主记录实体类 
    /// </summary>
    [Serializable]
    public class MCMasterInfo
    {
        int _RID;
        string _Shop_Code;
        string _BizNo;
        string _CardNo;
        string _MemberID;
        string _Name;
        string _Sex;
        string _MobileNo;
        DateTime _Operate_Date;
        string _Operator_Code;
        string _Operator_Name;
        decimal _Costs;
        decimal _Charges;
        decimal _Discounts;
        decimal _PayAmount;
        string _Remark;
        string _DataFrom;

        ///<summary>
        ///记录ID
        ///</summary>
        public int RID
        {
            get { return _RID; }
            set { _RID = value; }
        }

        ///<summary>
        ///店铺代码
        ///</summary>
        public string Shop_Code
        {
            get
            {
                if (_Shop_Code == null)
                    return String.Empty;
                else
                    return _Shop_Code;
            }
            set { _Shop_Code = value; }
        }

        ///<summary>
        ///交易流水号
        ///</summary>
        public string BizNo
        {
            get
            {
                if (_BizNo == null)
                    return String.Empty;
                else
                    return _BizNo;
            }
            set { _BizNo = value; }
        }

        ///<summary>
        ///会员卡号 
        ///</summary>
        public string CardNo
        {
            get
            {
                if (_CardNo == null)
                    return String.Empty;
                else
                    return _CardNo;
            }
            set { _CardNo = value; }
        }

        ///<summary>
        ///会员ID
        ///</summary>
        public string MemberID
        {
            get
            {
                if (_MemberID == null)
                    return String.Empty;
                else
                    return _MemberID;
            }
            set { _MemberID = value; }
        }

        ///<summary>
        ///姓名 
        ///</summary>
        public string Name
        {
            get
            {
                if (_Name == null)
                    return String.Empty;
                else
                    return _Name;
            }
            set { _Name = value; }
        }

        ///<summary>
        ///性别
        ///</summary>
        public string Sex
        {
            get
            {
                if (_Sex == null)
                    return String.Empty;
                else
                    return _Sex;
            }
            set { _Sex = value; }
        }

        ///<summary>
        ///手机号 
        ///</summary>
        public string MobileNo
        {
            get
            {
                if (_MobileNo == null)
                    return String.Empty;
                else
                    return _MobileNo;
            }
            set { _MobileNo = value; }
        }

        ///<summary>
        ///收款日期 
        ///</summary>
        public DateTime Operate_Date
        {
            get { return _Operate_Date; }
            set { _Operate_Date = value; }
        }

        ///<summary>
        ///收款人-代码
        ///</summary>
        public string Operator_Code
        {
            get
            {
                if (_Operator_Code == null)
                    return String.Empty;
                else
                    return _Operator_Code;
            }
            set { _Operator_Code = value; }
        }

        ///<summary>
        ///收款人-姓名
        ///</summary>
        public string Operator_Name
        {
            get
            {
                if (_Operator_Name == null)
                    return String.Empty;
                else
                    return _Operator_Name;
            }
            set { _Operator_Name = value; }
        }

        ///<summary>
        ///消费总额
        ///</summary>
        public decimal Costs
        {
            get { return _Costs; }
            set { _Costs = value; }
        }

        ///<summary>
        ///应收金额
        ///</summary>
        public decimal Charges
        {
            get { return _Charges; }
            set { _Charges = value; }
        }

        ///<summary>
        ///优惠金额 
        ///</summary>
        public decimal Discounts
        {
            get { return _Discounts; }
            set { _Discounts = value; }
        }

        ///<summary>
        ///实收金额 
        ///</summary>
        public decimal PayAmount
        {
            get { return _PayAmount; }
            set { _PayAmount = value; }
        }

        ///<summary>
        ///收费备注。
        ///</summary>
        public string Remark
        {
            get
            {
                if (_Remark == null)
                    return String.Empty;
                else
                    return _Remark;
            }
            set { _Remark = value; }
        }

        ///<summary>
        ///数据来源。1或null-本地系统产生、2-远程系统通过接口上传；
        ///</summary>
        public string DataFrom
        {
            get
            {
                if (_DataFrom == null)
                    return String.Empty;
                else
                    return _DataFrom;
            }
            set { _DataFrom = value; }
        }

        /// <summary>
        /// 消费明细；
        /// </summary>
        public List<MCItemInfo> ConsumeItems
        {
            get
            {
                if (_ConsumeItems == null)
                {
                    _ConsumeItems = new List<MCItemInfo>();
                }
                return _ConsumeItems;
            }
            set { _ConsumeItems = value; }
        }
        List<MCItemInfo> _ConsumeItems;

        /// <summary>
        /// 支付方式记录；
        /// </summary>
        public List<MCPaymentInfo> Payments
        {
            get
            {
                if (_Payments == null)
                {
                    _Payments = new List<MCPaymentInfo>();
                }
                return _Payments;
            }
            set { _Payments = value; }
        }
        List<MCPaymentInfo> _Payments;

        /// <summary>
        /// 深度克隆自身；
        /// </summary>
        /// <returns></returns>
        public MCMasterInfo Clone()
        {
            MCMasterInfo entity = new MCMasterInfo();

            entity.RID = this.RID;
            entity.Shop_Code = this.Shop_Code;
            entity.BizNo = this.BizNo;
            entity.CardNo = this.CardNo;
            entity.MemberID = this.MemberID;
            entity.Name = this.Name;
            entity.Sex = this.Sex;
            entity.MobileNo = this.MobileNo;
            entity.Operate_Date = this.Operate_Date;
            entity.Operator_Code = this.Operator_Code;
            entity.Operator_Name = this.Operator_Name;
            entity.Costs = this.Costs;
            entity.Charges = this.Charges;
            entity.Discounts = this.Discounts;
            entity.PayAmount = this.PayAmount;
            entity.Remark = this.Remark;
            entity.DataFrom = this.DataFrom;

            //======================================================
            List<MCItemInfo> items = new List<MCItemInfo>();
            foreach (MCItemInfo item in this.ConsumeItems)
            {
                items.Add(item.Clone());
            }
            entity.ConsumeItems = items;

            //======================================================
            List<MCPaymentInfo> payments = new List<MCPaymentInfo>();
            foreach (MCPaymentInfo item in this.Payments)
            {
                payments.Add(item.Clone());
            }
            entity.Payments = payments;

            return entity;
        }

    } //class end.
} //namespace end.



