コード例 #1
0
ファイル: GenericEFormViewer.cs プロジェクト: aomiit/caisis
        // get label for table name
        private string GetTableLabelByTableName(string tableName)
        {
            DataTable dt = da.GetFieldsByTableName(tableName);

            if (dt.Rows.Count > 0 && dt.Rows[0][MetadataTable.TableLabel_Field].ToString() != "")
            {
                return(dt.Rows[0][MetadataTable.TableLabel_Field].ToString());
            }
            else
            {
                return(tableName);
            }
        }
コード例 #2
0
        /// <summary>
        /// Binds the helper layer to a section 'secName' with title 'secTitle'
        /// </summary>
        /// <param name="secName"></param>
        /// <param name="secTitle"></param>
        protected void BindSection(string secName, string secTitle)
        {
            // Verify section name is given
            if (!string.IsNullOrEmpty(secName))
            {
                MetadataDa mdDa = new MetadataDa();

                // Set global meta field attribute values for use in binding repeater values
                metaTable = mdDa.GetFieldMetadataByTableName("Project");

                // Bind to meta field list
                DataTable metaFieldList = mdDa.GetFieldsByTableName("Project");
                HelpDescriptionRptr.DataSource = metaFieldList;
                HelpDescriptionRptr.DataBind();

                LayerSectionTitle.InnerText           = secTitle;
                LayerSectionTitle.Attributes["title"] = secTitle;
            }
        }
コード例 #3
0
    /// <summary>
    /// Bind the datagrid to a datasource, and set titles via metadata
    /// </summary>
    /// <param name="grid"></param>
    /// <param name="dt"></param>
    /// <param name="biz"></param>
    protected void BindGridViaMetaData(GridView grid, DataTable dt, string tablename)
    {
        MetadataDa mdDa         = new MetadataDa();
        DataTable  fieldsDt     = mdDa.GetFieldsByTableName(tablename);
        DataTable  attributesDt = mdDa.GetFieldMetadataByTableName(tablename);

        foreach (DataColumn col in dt.Columns)
        {
            if (col.ColumnName != "LoggedBy")
            {
                string     s          = CICHelper.GetFieldAttributeValue(attributesDt, col.ColumnName, "FieldLabel");
                BoundField newGridCol = new BoundField();
                newGridCol.DataField  = col.ColumnName;
                newGridCol.HeaderText = !string.IsNullOrEmpty(s) ? s : col.ColumnName;
                grid.Columns.Add(newGridCol);
            }
        }
        grid.DataSource = dt;
        grid.DataBind();
    }