using BS.Shared;
using BS.Shared.DataContracts;
using System;

namespace BeWo.ViewModel
{
    public class CustomerAPPCodeVM : AbstractDCMapperVM<CustomerAPPCodeDC>
    {
        public static string PropertyName_CustomerCode = "CustomerCode";

        public static string PropertyName_CustomerCodeGenDate = "CustomerCodeGenDate";

        public static string PropertyName_IsChatAktive = "IsChatAktive";

        private string _CustomerCode;

        private DateTime _CustomerCodeGenDate;

        private long? _CustomerOid;

        private int _IsChatAktive;


        public CustomerAPPCodeVM(CustomerAPPCodeDC pDC)
            : base(pDC, true)
        {
        }


        public virtual string CustomerCode
        {
            get { return this._CustomerCode; }

            set
            {
                if (this.AreDifferent(this._CustomerCode, value))
                {
                    this._CustomerCode = value;
                }
            }
        }

        public DateTime CustomerCodeGenDate
        {
            get { return this._CustomerCodeGenDate; }

            set
            {
                if (this.AreDifferent(this._CustomerCodeGenDate, value))
                {
                    this._CustomerCodeGenDate = value;
                    this.StoreDirtyInformation(this.AreDifferent(this.DataContract.CustomerCodeGenDate, value), PropertyName_CustomerCodeGenDate);
                    this.FirePropertyChanged(PropertyName_CustomerCodeGenDate);
                }
            }
        }
     
        public virtual long? CustomerOid
        {
            get
            {
                return this._CustomerOid;
            }

            set
            {
                if (this.AreDifferent(this._CustomerOid, value))
                {
                    this._CustomerOid = value;
                }
            }
        }

        public virtual int IsChatAktive
        {
            get
            {
                return this._IsChatAktive;
            }

            set
            {
                if (this.AreDifferent(this._IsChatAktive, value))
                {
                    this._IsChatAktive = value;
                }
            }
        }

        protected override void InitByDataContract(CustomerAPPCodeDC pDataContract)
        {
            this._CustomerCode = pDataContract.CustomerCode;
            this._CustomerCodeGenDate = pDataContract.CustomerCodeGenDate;
            this._CustomerOid = pDataContract.CustomerOid;
            this._IsChatAktive = pDataContract.IsChatAktive;
        }

        protected override CustomerAPPCodeDC MapToDataContract(CustomerAPPCodeDC pDataContract, bool doCommit)
        {
            pDataContract.CustomerCode = _CustomerCode;
            pDataContract.CustomerCodeGenDate = _CustomerCodeGenDate;   
            pDataContract.CustomerOid = _CustomerOid;
            pDataContract.IsChatAktive = _IsChatAktive; 

            return pDataContract;
        }
    }
}