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

namespace CRVM.Utility
{
    /// <summary>
    /// Entity Class,use memory project information,and as params 将所有信息存入项目配置文件
    /// </summary>
    public sealed class EPItem
    {
        private string projName;
        public string ProjName
        {
            get { return projName; }
            set { projName = value; }
        }

        private string scanfreq;
        public string Scanfreq
        {
            get { return scanfreq; }
            set { scanfreq = value; }
        }

        private bool autostart;
        public bool AutoStart
        {
            get { return autostart; }
            set { autostart = value; }
        }

        private string psource;
        public string Psource
        {
            get { return psource; }
            set { psource = value; }
        }

        private EDBItem sourcedb;
        public EDBItem Sourcedb
        {
            get { return sourcedb; }
            set { sourcedb = value; }
        }

        private EDBItem destdb;
        public EDBItem Destdb
        {
            get { return destdb; }
            set { destdb = value; }
        }

        private string keyString;
        public string KeyString
        {
            get { return keyString; }
            set { keyString = value; }
        }

        private string tableNameString;
        public string TableNameString
        {
            get { return tableNameString; }
            set { tableNameString = value; }
        }

        private int intervalTime;
        public int InervalTime
        {
            get { return intervalTime; }
            set { intervalTime = value; }
        }
        private List<ETPItem> sourceAndDestETPItem;
        public List<ETPItem> SourDestETPItem
        {
            get { return sourceAndDestETPItem; }
            set { sourceAndDestETPItem = value; }
        }

        private List<EWItem> ewItem;
        public List<EWItem> Ewitem
        {
            get { return ewItem; }
            set { ewItem = value; }
        }

        private string recordType;
        /// <summary>
        /// 类型判断，是否写日志
        /// </summary>
        public string RecordType
        {
            get { return recordType; }
            set { recordType = value; }
        }

        private string scanfType;
        /// <summary>
        /// 类型判断，是否写日志
        /// </summary>
        public string ScanfType
        {
            get { return scanfType; }
            set { scanfType = value; }
        }
    }

    /// <summary>
    /// Entity class , memory the database of projects 保存数据库登录信息
    /// </summary>
    public sealed class EDBItem
    {
        private string database;
        /// <summary>
        /// Gets or sets the database.
        /// </summary>
        /// <value>The database.</value>
        public string Database
        {
            get { return database; }
            set { database = value; }
        }

        private string datatype;
        /// <summary>
        /// Gets or sets the type of the data.
        /// </summary>
        /// <value>The type of the data.</value>
        public string DataType
        {
            get { return datatype; }
            set { datatype = value; }
        }

        private string userid;
        /// <summary>
        /// Gets or sets the userid.
        /// </summary>
        /// <value>The userid.</value>
        public string Userid
        {
            get { return userid; }
            set { userid = value; }
        }

        private string password;
        /// <summary>
        /// Gets or sets the password.
        /// </summary>
        /// <value>The password.</value>
        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        private string ipaddress;
        /// <summary>
        /// Gets or sets the ipaddress.
        /// </summary>
        /// <value>The ipaddress.</value>
        public string Ipaddress
        {
            get { return ipaddress; }
            set { ipaddress = value; }
        }
        private string port;

        public string Port
        {
            get { return port; }
            set { port = value; }
        }
    }
    /// <summary>
    /// The Contrast of Source Table and Destination Table 记录源表和目标表的信息
    /// </summary>
    public sealed class ETPItem
    {
        private string sourceName;
        public string SourceName
        {
            get { return sourceName; }
            set { sourceName = value; }
        }
        private string destName;
        public string DestName
        {
            get { return destName; }
            set { destName = value; }
        }

        private string sourceWhereValue;//where 条件值
        public string SourceWhereValue
        {
            get { return sourceWhereValue; }
            set { sourceWhereValue = value; }
        }
        private string destWhereValue;//where 条件值
        public string DestWhereValue
        {
            get { return destWhereValue; }
            set { destWhereValue = value; }
        }

        private List<ETBItem> sourceETBItem;
        public List<ETBItem> SourceETBItem
        {
            get { return sourceETBItem; }
            set { sourceETBItem = value; }
        }
        private List<ETBItem> destETBItem;
        public List<ETBItem> DestETBItem
        {
            get { return destETBItem; }
            set { destETBItem = value; }
        }

        private string eventName;//事件名
        public string EventName
        {
            get { return eventName; }
            set { eventName = value; }
        }
    }

    /// <summary>
    /// Entity Class,Table and  Conditon of Filter for DBTableDetailForms 记录表的各个字段
    /// </summary>
    public sealed class ETBItem
    {
        private string tableName;
        public string TableName
        {
            get { return tableName; }
            set { tableName = value; }
        }
        private string columnName;
        public string ColumnName
        {
            get { return columnName; }
            set { columnName = value; }
        }
        private string columnType;
        public string ColumnType
        {
            get { return columnType; }
            set { columnType = value; }
        }
        private string relativeWord;
        public string RelativeWord
        {
            get { return relativeWord; }
            set { relativeWord = value; }
        }
        private int labValue;
        public int LabValue
        {
            get { return labValue; }
            set { labValue = value; }
        }
        private string keyValue;//主键值
        public string KeyValue
        {
            get { return keyValue; }
            set { keyValue = value; }
        }
        private string isSelect;//是否选中
        public string IsSelect
        {
            get { return isSelect; }
            set { isSelect = value; }
        }
        private int columnLength;//长度
        public int ColumnLength
        {
            get { return columnLength; }
            set { columnLength = value; }
        }
        private string nullString;
        public string NullString
        {
            get { return nullString; }
            set { nullString = value; }
        }

        //public static bool operator >(ETBItem etb, ETBItem etb2)
        //{
        //    return etb.LabValue > etb2.LabValue ? true : false;
        //}

        //public static bool operator ==(ETBItem etb, ETBItem etb2)
        //{
        //    return etb.LabValue == etb2.LabValue ? true : false;
        //}

        //public static bool operator !=(ETBItem etb, ETBItem etb2)
        //{
        //    return etb.LabValue != etb2.LabValue ? true : false;
        //}

        //public static bool operator <(ETBItem etb, ETBItem etb2)
        //{
        //    return etb.LabValue > etb2.LabValue ? false : true;
        //}
    }
    /// <summary>
    /// Entity of class which inculde the list of ETBItem and wherevalue 
    /// </summary>
    public sealed class ETBLItem
    {
        private string whereValue;//where 条件值
        public string WhereValue
        {
            get { return whereValue; }
            set { whereValue = value; }
        }
        private List<ETBItem> listETBItem;
        public List<ETBItem> ListETBItem
        {
            get { return listETBItem; }
            set { listETBItem = value; }
        }
    }

    public sealed class EWItem
    {
        private int seqno;

        public int Seqno
        {
            get { return seqno; }
            set { seqno = value; }
        }
        private string eventName;

        public string EventName
        {
            get { return eventName; }
            set { eventName = value; }
        }

        private string colName;

        public string ColName
        {
            get { return colName; }
            set { colName = value; }
        }

        private string values;
        public string Values
        {
            get { return values; }
            set { values = value; }
        }
        private string status;
        public string Status
        {
            get { return status; }
            set { status = value; }
        }
    }

    public enum StateFlag
    { userAble, writeFinish, NullSourceData, writeFail }

}
