Exemple #1
0
        /// <summary>
        /// 通过类反射获取列信息,建立列信息
        /// </summary>
        /// <param name="type"></param>
        public virtual void CreateInterColumnsFromType(Type type)
        {
            #region 原始列的预处理
            if (ColumnInfos == null)
            {
                ColumnInfos = new List <ColumnInfo>();
            }
            #endregion

            var result = new List <ColumnInfo>();
            //通过属性特性生成列
            foreach (var property in type.GetProperties())
            {
                var interColumnInfo = property.GetSingleAttributeOrNull <InterColumnAttribute>();
                if (interColumnInfo != null)
                {
                    var tempColumnInfo = interColumnInfo.BuildColumnInfo(property);
                    //tempColumnInfo.ColumnKey = property.Name;
                    //tempColumnInfo.ValuePath =string.IsNullOrEmpty(tempColumnInfo.ValuePath)?property.Name:tempColumnInfo.ValuePath;
                    if (!HaveColumn(tempColumnInfo.ColumnKey))
                    {
                        tempColumnInfo.TenantId = TenantId;
                        ColumnInfos.Add(tempColumnInfo);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 附加列多个
        /// </summary>
        /// <param name="columnInfos"></param>
        public virtual void AddColumnInfo(List <ColumnInfo> columnInfos)
        {
            #region 原始列的预处理
            if (ColumnInfos == null)
            {
                ColumnInfos = new List <ColumnInfo>();
            }
            #endregion

            //附加基础列
            if (ColumnInfos.Count == 0)
            {
                foreach (var columnInfo in columnInfos)
                {
                    columnInfo.TenantId = TenantId;
                    ColumnInfos.Add(columnInfo);
                }
            }
            else
            {
                foreach (var columnInfo in columnInfos)
                {
                    //判断是否有对应的列
                    if (!HaveColumn(columnInfo.ColumnKey))
                    {
                        columnInfo.TenantId = TenantId;
                        ColumnInfos.Add(columnInfo);
                    }
                }
            }
        }
        private IDataTableColumnInfo GetColumnInfoAtIndex(int index)
        {
            var columnInfo = ColumnInfos.FirstOrDefault(c => c.Index == index);

            if (columnInfo == null)
            {
                columnInfo = new DataTableColumnInfo(index);
                ColumnInfos.Add(columnInfo);
            }
            return(columnInfo);
        }
Exemple #4
0
        /// <summary>
        /// 附加列单个
        /// </summary>
        /// <param name="columnInfo"></param>
        public virtual void AddColumnInfo(ColumnInfo columnInfo)
        {
            #region 原始列的预处理
            if (ColumnInfos == null)
            {
                ColumnInfos = new List <ColumnInfo>();
            }
            #endregion

            //判断是否有对应的列
            if (!HaveColumn(columnInfo.ColumnKey))
            {
                columnInfo.TenantId = TenantId;
                ColumnInfos.Add(columnInfo);
            }
        }
Exemple #5
0
        public void DictDeserialize(IDictionary <string, object> docu, Scenario scenario = Scenario.Database)
        {
            Name = docu.Set("Name", Name);
            Size = docu.Set("Size", Size);

            Description = docu.Set("Description", Description);
            var doc = docu as FreeDocument;

            if (doc != null && doc.Children != null)
            {
                foreach (FreeDocument item in doc.Children)
                {
                    var Column = new ColumnInfo();
                    Column.DictDeserialize(item);
                    ColumnInfos.Add(Column);
                }
            }
        }
Exemple #6
0
 public void AddColumn(int index, string columnName, string columnType)
 {
     ColumnInfos.Add(new ColumnInfo {
         Index = index, ColumnName = columnName, ColumnType = columnType
     });
 }