/// <summary> /// Gets the table that the form is based on. /// </summary> /// <returns>A <see cref="Org.Edgerunner.Dynamics.Nav.CSide.Table"/></returns> public Table GetTable() { // Fetch INSTable INSTable backingTable; Table table; int result = _Form.GetTable(out backingTable); if (result != 0) { throw CSideException.GetException(result); } // Now attempt to fetch the name of the table // first get the ID int tableID; result = backingTable.GetID(out tableID); if (result != 0) { throw CSideException.GetException(result); } // now enumerate by the ID to get the name CallbackEnumerator cbEnum = new CallbackEnumerator(_Client); _Client.EnumTables(cbEnum, tableID); if (cbEnum.Tables.Count != 0) { table = cbEnum.Tables[tableID]; table.SetBackingTable(backingTable); } else { table = new Table(ID, "[Name Unavailable]", _Client); } return(table); }
/// <summary> /// Refreshes the data for this record instance. /// </summary> /// <remarks> /// If any field values have been changed but Modify has not been called, they will be lost upon refresh. /// If any of the primary key fields were modified, this will result in a different record being fetched when Refresh is called. /// This is because Refresh really just re-fetches the data record based on the current primary key values. /// </remarks> public void Refresh() { RehydrateRecord(); CallbackEnumerator cbEnum = new CallbackEnumerator(this); _Record.EnumFieldValues(cbEnum); _Fields = cbEnum.FieldValues; }
/// <summary> /// Fetches the records in this instance. /// </summary> /// <returns></returns> public List <Record> FetchRecords() { FetchBackingTableIfNeeded(); CallbackEnumerator cbEnum = new CallbackEnumerator(this); _Table.EnumRecords(cbEnum); return(cbEnum.Records); }
/// <summary> /// Receives the next record. /// </summary> /// <param name="record">The record.</param> /// <returns>An <see cref="System.Int32"/> representing an error code</returns> public int NextRecord(INSRec record) { // Do not pass in the record variable to our CSide.Record constructor because its lifetime expires at the end of this method // Instead lazy loading will reconstitute a longer lifetime version later as is needed Record rec = new Record(null, _Manager as Table); CallbackEnumerator cbEnum = new CallbackEnumerator(rec); record.EnumFieldValues(cbEnum); rec._Fields = cbEnum.FieldValues; _Records.Add(rec); return(0); }