protected virtual DataColumn addStandardColumnShema(DataTable shema, dataUnitPresenter presenter, PropertyEntryColumn pec) { string name = pec.toColumnCaption(false); string desc = pec.getDescriptionForKey(); DataColumn dc = shema.Columns.Add(pec.toStringSafe()); dc.ColumnName = pec.toStringSafe(); dc.Caption = name; dc.DataType = pec.toColumnType(); dc.ExtendedProperties[templateFieldDataTable.col_caption] = name; dc.ExtendedProperties[templateFieldDataTable.col_desc] = desc; dc.ExtendedProperties[templateFieldDataTable.col_format] = ""; dc.ExtendedProperties[templateFieldDataTable.col_group] = ""; dc.ExtendedProperties[templateFieldDataTable.col_priority] = pec.toColumnPriority(); dc.ExtendedProperties[templateFieldDataTable.col_type] = typeof(string); return(dc); }
/// <summary> /// Sets the data column according to PropertyEntryColumn /// </summary> /// <param name="column">The column.</param> /// <param name="tableColumn">The table column.</param> /// <exception cref="System.ArgumentOutOfRangeException"></exception> public static void setDataColumn(this PropertyEntryColumn column, DataColumn tableColumn) { tableColumn.Caption = column.toColumnCaption(false); //tableColumn.SetHeading(column.toColumnCaption(false)); tableColumn.ColumnName = "_" + column.ToString(); tableColumn.ExtendedProperties[templateFieldStyling.text_horizontalAligment] = printHorizontal.left; tableColumn.ExtendedProperties[templateFieldStyling.render_isHidden] = false; tableColumn.ExtendedProperties[templateFieldDataTable.col_name] = column; //tableColumn.ExtendedProperties[templateFieldStyling.color_variationRole] = acePaletteVariationRole.none; tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 0; String desc = column.getDescriptionForKey(); switch (column) { case PropertyEntryColumn.entry_key: tableColumn.DataType = typeof(String); break; case PropertyEntryColumn.entry_name: tableColumn.DataType = typeof(String); tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 1; //desc = "Human-readable name of the property"; break; case PropertyEntryColumn.property_description: case PropertyEntryColumn.entry_description: tableColumn.DataType = typeof(String); //desc = "About / info on the property"; break; case PropertyEntryColumn.entry_value: tableColumn.DataType = typeof(String); tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 2; tableColumn.ExtendedProperties[templateFieldStyling.text_horizontalAligment] = printHorizontal.right; // desc = "Formated value"; break; case PropertyEntryColumn.entry_valueAndUnit: tableColumn.DataType = typeof(String); tableColumn.ExtendedProperties[templateFieldStyling.text_horizontalAligment] = printHorizontal.right; tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 2; // desc = "Formated value with unit sufix"; break; case PropertyEntryColumn.role_letter: tableColumn.DataType = typeof(String); // desc = "Letter asociated with the role of the property"; break; case PropertyEntryColumn.role_symbol: tableColumn.DataType = typeof(String); // desc = "Symbol associated with the role of the property"; break; case PropertyEntryColumn.role_name: tableColumn.DataType = typeof(String); // desc = "Descriptive name of the property role"; break; case PropertyEntryColumn.entry_unit: tableColumn.DataType = typeof(String); tableColumn.ExtendedProperties[templateFieldStyling.color_variationAdjustment] = 1; // desc = "The unit short name - abbr./sufix"; break; case PropertyEntryColumn.entry_unitname: tableColumn.DataType = typeof(String); // desc = "Name of the property unit"; break; case PropertyEntryColumn.entry_importance: // desc = "Remarks on property relevance and/or on alarming value"; tableColumn.DataType = typeof(String); break; default: throw new ArgumentOutOfRangeException(); } tableColumn.ExtendedProperties[templateFieldDataTable.col_desc] = desc; // return column.ToString(); }