using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Kingo.PluginServiceInterface
{
    [XmlRoot("FieldsCfg")]
    public class FieldCfg
    {
        public int ID { get; set; }
        public int PID { get; set; }
        [XmlAttribute("Name")]
        public string Name { get; set; }
        [XmlAttribute("AliasName")]
        public string AliasName { get; set; }
        [XmlAttribute("DicName")]
        public string DicName { get; set; }
        [XmlAttribute("Display")]
        public bool Display { get; set; }
        [XmlAttribute("EnumPropertyType")]
        public string EnumPropertyType { get; set; }
        [XmlAttribute("DisplayWhere")]
        public string DisplayWhere { get; set; }
        [XmlAttribute("DontDisplayWhere")]
        public string DontDisplayWhere { get; set; }
        [XmlAttribute("ShowTips")]
        public string ShowTips { get; set; }
        [XmlAttribute("DisplayType")]
        public string DisplayType { get; set; }
        [XmlAttribute("IsReadOnly")]
        public bool IsReadOnly { get; set; }
        [XmlAttribute("NotEdit")]
        public string NotEdit { get; set; }
        [XmlAttribute("CanEdit")]
        public string CanEdit { get; set; }
        [XmlAttribute("ComboBoxItems")]
        public string ComboBoxItems { get; set; }
        [XmlAttribute("StillShow")]
        public bool StillShow { get; set; }
        [XmlAttribute("Sql")]
        public string Sql { get; set; }
        [XmlAttribute("SetNullField")]
        public string SetNullField { get; set; }
        [XmlAttribute("SetNullValue")]
        public string SetNullValue { get; set; }
        [XmlAttribute("NotSetNullValue")]
        public string NotSetNullValue { get; set; }
        [XmlAttribute("LengthWhere")]
        public string LengthWhere { get; set; }
        [XmlAttribute("Order")]
        public int Order { get; set; }
        [XmlAttribute("FieldName")]
        public string FieldName { get; set; }
        [XmlAttribute("JudgeVisibleValue")]
        public string JudgeVisibleValue { get; set; }
        /// 
        /// 通过Sql查询给字段赋值
        /// 
        [XmlAttribute("SetValueSql")]
        public string SetValueSql { get; set; }
        /// 
        /// 是否通过字段有值才展示
        /// 
        [XmlAttribute("IsVisibleByValue")]
        public string IsVisibleByValue { get; set; }
        [System.Xml.Serialization.XmlIgnore]
        public object Value { get; set; }
        [System.Xml.Serialization.XmlIgnore]
        private List _Fields;
        [XmlElement(ElementName = "FieldCfg")]
        public List Fields
        {
            get
            {
                if (_Fields != null)
                {
                    for (int i = 0; i < _Fields.Count; i++)
                    {
                        _Fields[i].PID = ID;
                        _Fields[i].ID = ID * 100 + i + 1;
                    }
                }
                return _Fields;
            }
            set
            {
                _Fields = value;
            }
        }
        public FieldCfg()
        {
            Fields = new List();
        }
    }
}