private WeakReference <PpsMasterDataRow> referencedRow = null; // pointer to the actual row /// <summary></summary> /// <param name="row"></param> /// <param name="column"></param> public PpsMasterDataExtendedValue(PpsDataRow row, PpsDataColumnDefinition column) : base(row, column) { this.environment = PpsDataSetDefinitionDesktop.GetEnvironmentFromColumn(column); this.masterDataTable = environment.MasterData.GetTable( column.Meta.GetProperty <string>("refTable", null) ?? throw new ArgumentNullException("refTable", "Meta attribute refTable is not definied.") ) ?? throw new ArgumentNullException("refTable"); } // ctor
private PpsDataTableRelationDefinition parentRelation; // relation to the parent column, the current column has a value from the parent column /// <summary></summary> /// <param name="table"></param> /// <param name="clone"></param> protected PpsDataColumnDefinition(PpsDataTableDefinition table, PpsDataColumnDefinition clone) { this.table = table; this.columnName = clone.columnName; this.isIdentity = clone.isIdentity; this.isExtendedValue = new Lazy <bool>(() => DataType.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IPpsDataRowExtendedValue))); this.isReadOnly = new Lazy <bool>(() => IsExtended && !DataType.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IPpsDataRowSetGenericValue))); if (clone.IsPrimaryKey) { table.SetPrimaryKey(this); } } // ctor
} // ctor /// <summary>Validate auto tag definition.</summary> public virtual void EndInit() { var tableDef = datasetDefinition.FindTable(tableName); if (tableDef == null) { throw new ArgumentException($"Tag '{tagName}' could not initalized. Table '{tableName}' not found."); } column = tableDef.Columns[columnName]; if (column == null) { throw new ArgumentException($"Tag '{tagName}' could not initalized. Column '{tableName}.{columnName}' not found."); } } // proc EndInit
/// <summary></summary> /// <param name="row"></param> /// <param name="column"></param> public PpsStaticCalculated(PpsDataRow row, PpsDataColumnDefinition column) : base(row, column) { var code = column.Meta.GetProperty("formula", (string)null); // compile the code if (!String.IsNullOrEmpty(code)) { // get lua engine var lua = column.Table.DataSet.Lua; chunk = lua.CompileChunk(code, column.Name + "-formula.lua", null); // register table changed, for the update row.Table.DataSet.DataChanged += (sender, e) => UpdateValue(); } } // ctor
} // func GetPublicMemberList internal static object GetConvertedValue(PpsDataColumnDefinition columnInfo, object value) { if (value != null) // unpack data type { if (columnInfo.IsRelationColumn && value is PpsDataRow parentRow) { if (parentRow.Table.TableDefinition != columnInfo.ParentColumn.Table) { throw new InvalidCastException($"The row (from table '{parentRow.Table.TableName}') is not a member of the parent table ({columnInfo.ParentColumn.Table.Name})"); } value = parentRow[columnInfo.ParentColumn.Index]; } else if (!columnInfo.IsExtended) { value = Procs.ChangeType(value, columnInfo.DataType); } } return(value); } // func GetConvertedValue
/// <summary></summary> /// <param name="row"></param> /// <param name="column"></param> public PpsObjectExtendedValue(PpsDataRow row, PpsDataColumnDefinition column) : base(row, column) { this.environment = PpsDataSetDefinitionDesktop.GetEnvironmentFromColumn(column); this.dataset = (row.Table.DataSet as IPpsObjectBasedDataSet) ?? throw new ArgumentException("Dataset does not implement IPpsObjectBasedDataSet."); } // ctor
internal static PpsEnvironment GetEnvironmentFromColumn(PpsDataColumnDefinition column) => ((PpsDataSetDefinitionDesktop)column.Table.DataSet).Environment ?? throw new ArgumentNullException("environment");
/// <summary></summary> /// <param name="row"></param> /// <param name="column"></param> public PpsLinkedObjectExtendedValue(PpsDataRow row, PpsDataColumnDefinition column) : base(row, column) { this.environment = PpsDataSetDefinitionDesktop.GetEnvironmentFromColumn(column); this.dataset = row.Table.DataSet as IPpsObjectBasedDataSet; } // ctor
} // ctor public PpsDataColumnMetaCollectionClient(PpsDataColumnDefinition column, XElement xMetaGroup) : base(column) { PpsDataHelperClient.AddMetaGroup(xMetaGroup, Add); } // ctor
public PpsDataColumnMetaCollectionClient(PpsDataColumnDefinition column, PpsDataColumnMetaCollectionClient clone) : base(column, clone) { } // ctor
} // ctor /// <summary></summary> /// <param name="column"></param> /// <param name="clone"></param> protected PpsDataColumnMetaCollection(PpsDataColumnDefinition column, PpsDataColumnMetaCollection clone) : base(clone) { this.staticMeta = new PpsDataColumnStaticMetaCollection(column); } // ctor
/// <summary></summary> /// <param name="column"></param> public PpsDataColumnMetaCollection(PpsDataColumnDefinition column) { this.staticMeta = new PpsDataColumnStaticMetaCollection(column); } // ctor
public PpsDataColumnStaticMetaCollection(PpsDataColumnDefinition column) { this.column = column; } // ctor
private object value = null; // id to the master data row /// <summary></summary> /// <param name="row"></param> /// <param name="column"></param> protected PpsDataRowObjectExtendedValue(PpsDataRow row, PpsDataColumnDefinition column) : base(row, column) { } // ctor
/// <summary></summary> /// <param name="row"></param> /// <param name="column"></param> public PpsDataRowExtentedValue(PpsDataRow row, PpsDataColumnDefinition column) { this.row = row; this.column = column; } // ctor