public SetValue ( |
||
record | The record to be updated; may be null. | |
fieldIndex | int | The index of the field to be updated. |
value | string | The value. |
return | void |
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;
}
}
Recordset::SetValue ( int recordIndex, int fieldIndex, string value ) : void |
public void SetValueWithRecordNotExistiongExpectedAddANewRecordToRecordset() { var rs = new Recordset { Name = "MyRec" }; rs.Fields.Add(new RecordsetField { Name = "MyField", Alias = "MyField" }); rs.SetValue(0, 0, "MyTestData"); Assert.AreEqual("MyTestData", rs.Records[0][0].Value); }