Example #1
0
        private void Validate(int index, DataColumnMapping value)
        {
            if (value == null)
            {
                throw ADP.ColumnsAddNullAttempt("value");
            }
            if (value.Parent != null)
            {
                if (this != value.Parent)
                {
                    throw ADP.ColumnsIsNotParent(this);
                }
                if (index != this.IndexOf(value))
                {
                    throw ADP.ColumnsIsParent(this);
                }
            }
            string sourceColumn = value.SourceColumn;

            if (ADP.IsEmpty(sourceColumn))
            {
                index = 1;
                do
                {
                    sourceColumn = "SourceColumn" + index.ToString(CultureInfo.InvariantCulture);
                    index++;
                }while (-1 != this.IndexOf(sourceColumn));
                value.SourceColumn = sourceColumn;
            }
            else
            {
                this.ValidateSourceColumn(index, sourceColumn);
            }
        }
Example #2
0
        private void Validate(int index, DataColumnMapping value)
        {
            if (null == value)
            {
                throw ADP.ColumnsAddNullAttempt(nameof(value));
            }
            if (null != value.Parent)
            {
                if (this != value.Parent)
                {
                    throw ADP.ColumnsIsNotParent(this);
                }
                else if (index != IndexOf(value))
                {
                    throw ADP.ColumnsIsParent(this);
                }
            }

            string name = value.SourceColumn;

            if (string.IsNullOrEmpty(name))
            {
                index = 1;
                do
                {
                    name = ADP.SourceColumn + index.ToString(System.Globalization.CultureInfo.InvariantCulture);
                    index++;
                } while (-1 != IndexOf(name));
                value.SourceColumn = name;
            }
            else
            {
                ValidateSourceColumn(index, name);
            }
        }
Example #3
0
        private void Validate(int index, DataColumnMapping value)
        {
            if (null == value)
            {
                throw ADP.ColumnsAddNullAttempt("value");
            }
            if (null != value.Parent)
            {
                if (this != value.Parent)
                {
                    throw ADP.ColumnsIsNotParent(value.SourceColumn);
                }
                else if (index != IndexOf(value))
                {
                    throw ADP.ColumnsIsParent(value.SourceColumn);
                }
            }

            String name = value.SourceColumn;

            if (ADP.IsEmpty(name))
            {
                index = 1;
                do
                {
                    name = ADP.SourceColumn + index.ToString();
                    index++;
                } while (-1 != IndexOf(name));
                value.SourceColumn = name;
            }
            else
            {
                ValidateSourceColumn(index, name);
            }
        }