Beispiel #1
0
            public static ColumnDomainRow CreateColumnDomainRow(BacksightDataSet ds)
            {
                ColumnDomainRow result = ds.ColumnDomain.NewColumnDomainRow();

                result.SetDefaultValues();
                return(result);
            }
Beispiel #2
0
            /// <summary>
            /// Creates a new row in the <c>ColumnDomains</c> table
            /// </summary>
            /// <param name="cd">Information for the row to add</param>
            /// <returns>The row inserted into this table</returns>
            internal ColumnDomainRow AddColumnDomainRow(IColumnDomain cd)
            {
                ColumnDomainRow result = NewColumnDomainRow();

                result.TableId    = (cd.ParentTable == null ? 0 : cd.ParentTable.Id);
                result.ColumnName = cd.ColumnName;
                result.DomainId   = (cd.Domain == null ? 0 : cd.Domain.Id);
                AddColumnDomainRow(result);
                return(result);
            }
            /// <summary>
            /// Checks an array of <c>ColumnDomainRow</c> to see if any element refers
            /// to a specific database column and domain
            /// </summary>
            /// <param name="cd">The item to look for</param>
            /// <param name="rows">The rows to check</param>
            /// <returns>True if any row matches the search item</returns>
            /// <remarks>This helps to avoid the clumsy syntax of Array.Find, making
            /// calling code a bit more readable.</remarks>
            internal static bool HasMatchInArray(IColumnDomain cd, ColumnDomainRow[] rows)
            {
                int tableId = (cd.ParentTable == null ? 0 : cd.ParentTable.Id);
                int domainTableId = (cd.Domain == null ? 0 : cd.Domain.Id);
                string columnName = cd.ColumnName;

                foreach (ColumnDomainRow row in rows)
                {
                    if (row.TableId == tableId &&
                        row.DomainId == domainTableId &&
                        row.ColumnName == columnName)
                        return true;
                }

                return false;
            }