/// <summary> /// Set the value for the specified column /// </summary> /// <param name="column">LaytonDataColumn to identify the column in question</param> /// <param name="value"></param> public void SetValue(LaytonDataColumn column, object value) { // Try and find the column in the dataset int index = _parentSet.FindColumn(column); if (index != -1) { _values[index] = value; } }
/// <summary> /// return the the value for the specified column /// </summary> /// <param name="column">LaytonDataColumn to identify the column in question</param> public object GetValueTag(LaytonDataColumn column) { // Try and find the column in the dataset int index = _parentSet.FindColumn(column); if (index != -1) { return(GetValueTag(index)); } return(""); }
/// <summary> /// This function is called to increment a value held in this row at the specified column position /// If the value is not an integer then this function will fail and will return 0. /// </summary> /// <param name="column"></param> /// <returns></returns> public int IncrementValue(LaytonDataColumn column) { // Try and find the column in the dataset int index = _parentSet.FindColumn(column); if (index != -1) { return(IncrementValue(index)); } return(0); }
/// <summary> /// Find a column in the collection and return it's index /// </summary> /// <param name="column">The LaytonDataColumn object to find</param> /// <returns>index of the column, -1 if not found</returns> public int FindColumn(LaytonDataColumn theColumn) { for (int isub = 0; isub < _listColumns.Count; isub++) { if (_listColumns[isub].Key == theColumn.Key) { return(isub); } } return(-1); }
/// <summary> /// Find a column in the collection given it's key and return it /// </summary> /// <param name="key">The key to look for</param> /// <returns>The column if found, null otherwise</returns> public LaytonDataColumn FindColumn(string key) { LaytonDataColumn returnColumn = null; foreach (LaytonDataColumn column in _listColumns) { if (column.Key == key) { returnColumn = column; break; } } return(returnColumn); }
/// <summary> /// Primary constructor /// </summary> /// <param name="parentSet">Parent DataSet</param> /// <param name="key">Unique key for this row</param> public LaytonDataRow(LaytonDataSet parentSet, string key) { _parentSet = parentSet; _key = key; // Allocate and initialize the values list as we know how many columns we have _values = new List <object>(parentSet.ColumnCount()); _valuesTags = new List <object>(parentSet.ColumnCount()); // for (int isub = 0; isub < parentSet.ColumnCount(); isub++) { LaytonDataColumn column = _parentSet.Columns[isub]; if (column.DataType == typeof(string) || column.DataType == typeof(DateTime)) { _values.Add(""); } else { _values.Add(0); } _valuesTags.Add(0); } }
/// <summary> /// Add a new data column to the dataset /// </summary> /// <param name="newColumn"></param> public void AddColumn(LaytonDataColumn newColumn) { _listColumns.Add(newColumn); return; }