Exemple #1
0
        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
Exemple #2
0
        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
Exemple #3
0
        }         // 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
Exemple #5
0
        }         // 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
Exemple #6
0
 /// <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
Exemple #7
0
 internal static PpsEnvironment GetEnvironmentFromColumn(PpsDataColumnDefinition column)
 => ((PpsDataSetDefinitionDesktop)column.Table.DataSet).Environment ?? throw new ArgumentNullException("environment");
Exemple #8
0
 /// <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
Exemple #9
0
        }         // ctor

        public PpsDataColumnMetaCollectionClient(PpsDataColumnDefinition column, XElement xMetaGroup)
            : base(column)
        {
            PpsDataHelperClient.AddMetaGroup(xMetaGroup, Add);
        } // ctor
Exemple #10
0
 public PpsDataColumnMetaCollectionClient(PpsDataColumnDefinition column, PpsDataColumnMetaCollectionClient clone)
     : base(column, clone)
 {
 }         // ctor
Exemple #11
0
            }             // 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
Exemple #12
0
 /// <summary></summary>
 /// <param name="column"></param>
 public PpsDataColumnMetaCollection(PpsDataColumnDefinition column)
 {
     this.staticMeta = new PpsDataColumnStaticMetaCollection(column);
 }             // ctor
Exemple #13
0
 public PpsDataColumnStaticMetaCollection(PpsDataColumnDefinition column)
 {
     this.column = column;
 }             // ctor
Exemple #14
0
        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
Exemple #15
0
 /// <summary></summary>
 /// <param name="row"></param>
 /// <param name="column"></param>
 public PpsDataRowExtentedValue(PpsDataRow row, PpsDataColumnDefinition column)
 {
     this.row    = row;
     this.column = column;
 }         // ctor