Пример #1
0
        protected void WriteSettingsToDataTableProperties(DataTable dt, ResultSetComparisonSettings settings)
        {
            foreach (DataColumn column in dt.Columns)
            {
                if (column.ExtendedProperties.ContainsKey("NBi::Role"))
                {
                    column.ExtendedProperties["NBi::Role"] = settings.GetColumnRole(column.Ordinal);
                }
                else
                {
                    column.ExtendedProperties.Add("NBi::Role", settings.GetColumnRole(column.Ordinal));
                }

                if (column.ExtendedProperties.ContainsKey("NBi::Type"))
                {
                    column.ExtendedProperties["NBi::Type"] = settings.GetColumnType(column.Ordinal);
                }
                else
                {
                    column.ExtendedProperties.Add("NBi::Type", settings.GetColumnType(column.Ordinal));
                }

                if (column.ExtendedProperties.ContainsKey("NBi::Tolerance"))
                {
                    column.ExtendedProperties["NBi::Tolerance"] = settings.GetTolerance(column.Ordinal);
                }
                else
                {
                    column.ExtendedProperties.Add("NBi::Tolerance", settings.GetTolerance(column.Ordinal));
                }

                if (column.ExtendedProperties.ContainsKey("NBi::Rounding"))
                {
                    column.ExtendedProperties["NBi::Rounding"] = settings.GetRounding(column.Ordinal);
                }
                else
                {
                    column.ExtendedProperties.Add("NBi::Rounding", settings.GetRounding(column.Ordinal));
                }
            }
        }
Пример #2
0
        public int GetHashCode(DataRow obj)
        {
            var values = obj.ItemArray.Where <object>((o, i) => settings.GetColumnRole(i) == ColumnRole.Key);
            int hash   = 0;

            foreach (var value in values)
            {
                string v = null;
                if (value is IConvertible)
                {
                    v = ((IConvertible)value).ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    v = value.ToString();
                }

                //Console.WriteLine("{0} {1} {2} {3}", value.ToString(), value.GetType(), v.ToString(), v.GetHashCode());

                hash = (hash * 397) ^ v.GetHashCode();
            }
            return(hash);
        }
Пример #3
0
        protected void WriteSettingsToDataTableProperties(DataTable dt, ResultSetComparisonSettings settings)
        {
            foreach (DataColumn column in dt.Columns)
            {
                if (column.ExtendedProperties.ContainsKey("NBi::Role"))
                    column.ExtendedProperties["NBi::Role"] = settings.GetColumnRole(column.Ordinal);
                else
                    column.ExtendedProperties.Add("NBi::Role", settings.GetColumnRole(column.Ordinal));

                if (column.ExtendedProperties.ContainsKey("NBi::Type"))
                    column.ExtendedProperties["NBi::Type"] = settings.GetColumnType(column.Ordinal);
                else
                    column.ExtendedProperties.Add("NBi::Type", settings.GetColumnType(column.Ordinal));

                if (column.ExtendedProperties.ContainsKey("NBi::Tolerance"))
                    column.ExtendedProperties["NBi::Tolerance"] = settings.GetTolerance(column.Ordinal);
                else
                    column.ExtendedProperties.Add("NBi::Tolerance", settings.GetTolerance(column.Ordinal));

                if (column.ExtendedProperties.ContainsKey("NBi::Rounding"))
                    column.ExtendedProperties["NBi::Rounding"] = settings.GetRounding(column.Ordinal);
                else
                    column.ExtendedProperties.Add("NBi::Rounding", settings.GetRounding(column.Ordinal));
            }
        }