Example #1
0
        /// <summary>
        /// Match either side of a : delimited string or all of the string including the delimiter
        /// </summary>
        /// <param name="hashSet">List of strings</param>
        /// <param name="foreignKeyValue">string to match</param>
        /// <returns>true if a match, false if none</returns>
        private bool PickListMatch(COBieColumnRelationship reference, COBieCell cell)
        {
            if (cell.CellValue == Constants.DEFAULT_STRING)
            {
                return(false);
            }

            if (reference.HasKeyMatch(cell.CellValue))
            {
                return(true);
            }

            // There are no current cases where PickLists can have Many to Many mappings - only One to Many. So don't worry about MultipleValues.

            // Due to the way some Categories/Classifications in Pick lists are compound keys (e.g. 11-11 11 14: Exhibition Hall ... where the code and name are stored separately in IFC)
            // we need to special case partial matches, since we may have the code, name, or code:name (perhaps with differing white space)

            if (cell.CellValue.Contains(":")) //assume category split
            {
                return(reference.HasPartialMatch(cell.CellValue, ':'));
            }


            return(false);
        }
Example #2
0
        /// <summary>
        /// Match the Foreign Key with the primary key field
        /// </summary>
        /// <param name="reference">The COBie Index to cross reference</param>
        /// <param name="cell">The COBie Cell to validate</param>
        /// <returns>bool</returns>
        private bool ForeignKeyMatch(COBieColumnRelationship reference, COBieCell cell)
        {
            if (reference.HasKeyMatch(cell.CellValue))
            {
                return(true);
            }

            if (cell.COBieColumn.AllowsMultipleValues == true)
            {
                foreach (string value in cell.CellValues)
                {
                    if (!reference.HasKeyMatch(value))
                    {
                        return(false);
                    }
                }
                return(true);
            }

            return(false);
        }