コード例 #1
0
        internal List <DataListColumn> getTableColumns(string tableName)
        {
            List <DataListColumn> ret = new List <DataListColumn>();
            TableDef tableDef         = dbAdmin.getTableDef(tableName);
            int      i = 0;

            foreach (FieldDef field in tableDef.FieldDefs)
            {
                i++;
                if (i > DataSourceConst.MaxCol)
                {
                    break;
                }
                DataListColumn col = new DataListColumn();
                col.field = field.Name;

                col.title = field.Alias;
                if (string.IsNullOrEmpty(col.title))
                {
                    col.title = field.Name;
                }

                col.resizable = true;
                col.sortable  = true;
                ret.Add(col);
            }
            return(ret);
        }
コード例 #2
0
        public static List <DataListColumn> getColumns(DataTable tb)
        {
            List <DataListColumn> ret = new List <DataListColumn>();

            foreach (DataColumn col in tb.Columns)
            {
                if (col.DataType.IsArray)
                {
                    continue;
                }
                DataListColumn listCol = new DataListColumn();
                string         fldName = col.ColumnName;
                if (col.ExtendedProperties.ContainsKey("Alias"))
                {
                    fldName = col.ExtendedProperties["Alias"].ToString();
                }
                listCol.field     = fldName;
                listCol.title     = col.Caption;
                listCol.resizable = true;
                listCol.hidden    = false;
                listCol.editor    = "text";
                if (col.ReadOnly)
                {
                    listCol.editor = null;
                }

                ret.Add(listCol);
            }

            foreach (DataColumn col in tb.PrimaryKey)
            {
                DataListColumn listCol = new DataListColumn();
                string         fldName = col.ColumnName;
                //                if (col.ExtendedProperties.ContainsKey("Alias"))
                //                    fldName = col.ExtendedProperties["Alias"].ToString();
                listCol.field  = XSqlBuilder.OLD_VERSION_PIX + fldName;
                listCol.title  = col.Caption;
                listCol.hidden = true;
                ret.Add(listCol);
                // row.Pk.Add(fldName, value);
            }
            return(ret);
        }
コード例 #3
0
        private static List <DataListColumn> getColumns(List <FieldDef> fields)
        {
            List <DataListColumn> ret = new List <DataListColumn>();

            foreach (FieldDef col in fields)
            {
                DbType type = DatabaseAdmin.getInstance().getDbType(col.Type);
                if (type.Equals(DbType.Binary))
                {
                    continue;
                }
                DataListColumn listCol = new DataListColumn();
                string         fldName = col.Name;
                listCol.field     = fldName;
                listCol.title     = col.Title;
                listCol.resizable = true;
                listCol.hidden    = false;
                listCol.editor    = "text";
                ret.Add(listCol);
            }
            return(ret);
        }
コード例 #4
0
ファイル: DataSource.cs プロジェクト: foxbill/xbase-2018.01
        private void applySchema(DataTable table)
        {
            foreach (FieldSchema fldsch in _schema.Fields)
            {
                if (!fldsch.Visable)
                {
                    continue;
                }
                //  DataColumn col = mastTable.Columns[fldsch.Id];

                DataListColumn listCol = new DataListColumn();

                string fldName = fldsch.Id;
                if (!string.IsNullOrEmpty(fldsch.Alias))
                {
                    fldName = fldsch.Alias;
                }
                //if (col.ExtendedProperties.ContainsKey("Alias"))
                //    fldName = col.ExtendedProperties["Alias"].ToString();

                listCol.field = fldName;
                listCol.title = fldName;
                if (string.IsNullOrEmpty(fldsch.Title))
                {
                    listCol.title = fldsch.Title;
                }
                listCol.editor = "text";
                //listCol.width = 0;
                //listCol.rowspan = 1;
                //listCol.colspan = 1;
                listCol.align    = null;
                listCol.halign   = null;
                listCol.sortable = true;
                //    listCol.order = "asc";
                listCol.resizable = true;
            }
        }
コード例 #5
0
        public static List <DataListColumn> getColumns(List <FieldSchema> fieldDefs)
        {
            List <DataListColumn> ret   = new List <DataListColumn>();
            DataListColumn        ckCol = new DataListColumn();

            ckCol.checkbox = true;
            ckCol.field    = "ck";
            ret.Add(ckCol);
            foreach (FieldSchema fldSchema in fieldDefs)
            {
                if (fldSchema.DataType == DbType.Binary)
                {
                    continue;
                }
                DataListColumn listCol = new DataListColumn();
                string         fldName = fldSchema.Id;
                if (!string.IsNullOrEmpty(fldSchema.Alias))
                {
                    fldName = fldSchema.Alias;
                }
                listCol.field = fldName;
                listCol.title = fldSchema.Title;// string.IsNullOrEmpty(fldSchema.Title) ? fldName : fldSchema.Title;
                if (string.IsNullOrEmpty(listCol.title))
                {
                    listCol.title = fldName;
                }

                listCol.width = fldSchema.DisplayWidth < 50 ? 50 : fldSchema.DisplayWidth;

                listCol.resizable = true;
                listCol.hidden    = !fldSchema.Visable;

                if (!string.IsNullOrEmpty(fldSchema.Editor))
                {
                    listCol.editor = fldSchema.Editor;
                }
                else
                {
                    listCol.editor = editorForType(fldSchema.DataType);
                }

                if (fldSchema.ReadOnly || fldSchema.IsAutoInc)
                {
                    listCol.editor = null;
                }

                ret.Add(listCol);

                if (fldSchema.IsKey)
                {
                    listCol        = new DataListColumn();
                    listCol.field  = XSqlBuilder.OLD_VERSION_PIX + fldName;
                    listCol.title  = listCol.field;
                    listCol.hidden = true;
                    ret.Add(listCol);
                }
            }


            return(ret);
        }