📘
TimeLine E3
  • TimeLine E3 Documentation
  • Framework
    • Introduction
    • DataSet Definition
    • Window Handling Object
      • Input/Output arguments
      • Open
      • BindDataControls
      • Item Changes
      • Item Search
      • MenuItemClicked
      • Print
      • ModuleOpened (BlueArrow)
      • BlueArrowArguments
      • New Row
      • Delete Row
      • Save
      • Transactions
      • Locking [deprecated]
      • Locking (new)
      • Resizing a response window
      • ParaPanel
      • Adding DMS Tab to a Module
    • BusinessObject
    • Controls
      • BindingFormat
      • LookupGrid and SearchDef
      • ComboBox
      • RadioButton
      • Multiline Textbox
      • xTextBoxSearch
      • xFileBrowse [v16+]
      • DxDispoColumn
      • DxProgressColumn
      • DxTemplateColumn
      • Change control caption programmatically
      • TabControl
      • Navigation
      • Enable controls programmatically
      • Enable a MenuItem programmatically
      • Filter search values
      • Jumping to another module
      • Messages, Notifications, Log, Exceptions, Translation
      • LoggerSink [deprecated]
      • Log
      • OpenFile, FolderBrowsing and SaveFile
      • Execute Actions while displaying an Hourglass
      • Using Progress
      • Async methods with progress bar
      • Wizard
      • Customizing controls using xBehaviors
      • TLProperty.AllowInReadOnly [v16+]
    • DataSet Operations
    • Business-related functionality
      • Getting the next primary key
      • Hybrids
      • Enums
      • Get Current User
    • SQL
    • SQL (using named parameters)
    • Advanced SQL
    • Expression Binding
    • Server-side logic & customization [v16+]
      • Service Hoster
      • Starting / stopping hosted services
      • Changes to scheduled jobs!
      • Business Object Proxies
      • Business Object API
    • Colors in Expression Bindings [v15+]
    • Theming
      • Icons
  • TimeLine Developer (TLD)
    • Debugging in TLD
    • Targets
    • Custom Project Rework [v16+]
  • TimeLine-specific LL functions
  • Stunnel proxy
    • Pre-requisites
    • 1. Initial setup
    • 2. Generate the server/web certificates
    • 3.a. Generating client certificates using the CSR flow
    • 3.b. Generate client certificates from the server console
    • 4. Setting up the E3 client connection
    • 5. Setting up the browser certificates
  • Configuration
    • Configuring the WCF timeout
  • Troubleshooting the E3 Bridge
  • [Deprecated]
    • TimeLine WEB - deprecated in v16+
      • Prerequisites for running the WASM modules on the server
      • Prerequisites for developing WASM modules with TLD
      • Creating a small web module with TLD
      • Terminal Configuration
    • Customization Examples - deprecated in v16+
    • Codestore [deprecated]
    • Configuring the scheduled jobs timeout - deprecated in v16+
Powered by GitBook
On this page
  • Adding a new row to the dataSet
  • Deleting a row from the dataSet
  • Duplicate an existing row
  • Copy a table
  • Ignore change on a column
  • Retrieve on one table
  • Save
  1. Framework

DataSet Operations

Adding a new row to the dataSet

public virtual dsRm.rueckm_afoRow RueckmAfo(dsBab.bab_afoRow afoRow)
{
    // prevent the case when datacache is null
    if (this.DataCache == null)
    {
        LoggerSink.PushMessage(this, "busRM.RueckmAfo fehlgeschlagen: TimeLine Data Cache wird geladen! Bitte versuchen Sie es später erneut.");
        return null;
    }
    var row = tSet.rueckm_afo.NewRow();
    row.lfd_nr = ParaUtils.GetNextRueckmAfoLfdNr();
    row.rm_typ = 10; 
    
    row.datum = DateTime.Now;
    row.erstellt_am = DateTime.Now;
     
    //.....         
    
    return row;
}

The primary keys for a new row are set only at saving

RowStates:

  • For the operations order New->Add->Initialisation the RowState of the new row will be EditingNew

  • For the operations order New->Initialisation->Add the RowState of the new row will be New

For all RowStates see corresponding chapter.

Deleting a row from the dataSet

public virtual DeleteAfo(dsBab.bab_afoRow afoRow)        
{
    afoRow.Row.Delete();
}

Duplicate an existing row

public virtual DataRow AddNewRueckmFertigart(DataRow fertigRow)
{
    if (fertigRow == null)
    {
        return null;
    }

    this.tSet.rueckm_fertigart.Table.ImportRow(fertigRow);
    return fertigNew;
}

Copy a table

Copy() creates a new DataTable with the same structure and data as the original DataTable.

var docPosDetailRows = BusObjDoc.tSet.belpos_detail.Copy();

Ignore change on a column

This is useful when we don’t want to receive a save message when a specific column, that comes from a db compute (not updateable), has changed.

Structure:

dSet.IgnoreStateChange(tableName, fieldName);

Example:

private void SetBestandValues()
{
    dSet.IgnoreStateChange("Versandvorschlag", "cf_bestand");

    foreach (var item in tSet.Versandvorschlag)
    {
        item.cf_bestand = BestandUtils.Instance.GetBestand(item.artnr, item.belpos_lager_nr.ToInt(-1), item.bel_typ, item.bel_nr, item.posnr);
    }
}

Retrieve on one table

tSet.Documents.Retrieve(docTyp, docNr);

Save

public override int Save()
{      
    //...
    
    foreach (var dataSet in AllChildDataSets)
    {
        dataSet.SetEditCheckpoint();
    }

    int ret = BookRM(commit: false);
    try
    {
        foreach (var dataSet in AllChildDataSets)
        {
            dataSet.CommitEditCheckpoint();
        }
    }
    catch (Exception ex)
    {
        foreach (var dataSet in AllChildDataSets)
        {
            dataSet.RevertEditCheckpoint();
        }
        LoggerSink.PushMessage(this, l.Translate(ex.Message), Severity.Exception);
    }

    return ret;
}

dataSet.SetEditCheckpoint() is used for prevent the possibility that an exception to be thrown. In that case, if SetEditCheckpoint() is not used, the DataBase will return to its previous state, but the DataSet will not.

In conclusion, SetEditCheckpoint() is used for rollbacks to be done on DataSets as well.

PreviousTLProperty.AllowInReadOnly [v16+]NextBusiness-related functionality

Last updated 3 years ago