Beispiel #1
0
 public void Add(RecordsetCell item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     _cells.Add(item);
 }
Beispiel #2
0
 public void Add(RecordsetCell item)
 {
     if(item == null)
     {
         throw new ArgumentNullException("item");
     }
     _cells.Add(item);
 }
Beispiel #3
0
        /// <summary>
        /// Sets the value of the field at the given field index in the given row.
        /// <remarks>
        /// A new row is added if <paramref name="record"/> is <code>null</code>.
        /// A new field is added if <paramref name="fieldIndex"/> is greater than or equal to <see cref="Fields"/> count.
        /// </remarks>
        /// </summary>
        /// <param name="record">The record to be updated; may be null.</param>
        /// <param name="fieldIndex">The index of the field to be updated.</param>
        /// <param name="value">The value.</param>
        public void SetValue(ref RecordsetRecord record, int fieldIndex, string value)
        {
            if (record == null)
            {
                record = NewRecord();
                Records.Add(record);
            }

            var cell = new RecordsetCell
            {
                Name  = record.Label + "." + Fields[fieldIndex].Alias,
                Label = Fields[fieldIndex].Alias,
                Value = value
            };

            if (fieldIndex >= record.Count)
            {
                record.Add(cell);
            }
            else
            {
                record[fieldIndex] = cell;
            }
        }
        /// <summary>
        /// Sets the value of the field at the given field index in the given row.
        /// <remarks>
        /// A new row is added if <paramref name="record"/> is <code>null</code>.
        /// A new field is added if <paramref name="fieldIndex"/> is greater than or equal to <see cref="Fields"/> count.
        /// </remarks>
        /// </summary>
        /// <param name="record">The record to be updated; may be null.</param>
        /// <param name="fieldIndex">The index of the field to be updated.</param>
        /// <param name="value">The value.</param>
        public void SetValue(ref RecordsetRecord record, int fieldIndex, string value)
        {
            if(record == null)
            {
                record = NewRecord();
                Records.Add(record);
            }

            var cell = new RecordsetCell
            {
                Name = record.Label + "." + Fields[fieldIndex].Alias,
                Label = Fields[fieldIndex].Alias,
                Value = value
            };
            if(fieldIndex >= record.Count)
            {
                record.Add(cell);
            }
            else
            {
                record[fieldIndex] = cell;
            }
        }
        public void AddWithRecordsetCellExpectedAddsRecordsetCell()
        {
            var record = new RecordsetRecord();
            var cell = new RecordsetCell();
            record.Add(cell);

            Assert.AreEqual(1, record.Count);
            Assert.AreSame(cell, record[0]);
        }