ReportViewerForMvc.Example/Reports/dsLocalReport.Designer.cs
/// <summary>
///Update all changes to the dataset.
///</summary>
Update all changes to the dataset.
Update all changes to the dataset .
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
        public virtual int UpdateAll(dsLocalReport dataSet) {
            if ((dataSet == null)) {
                throw new global::System.ArgumentNullException("dataSet");
            }
            if ((dataSet.HasChanges() == false)) {
                return 0;
            }
            global::System.Data.IDbConnection workConnection = this.Connection;
            if ((workConnection == null)) {
                throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" +
                        "ger TableAdapter property to a valid TableAdapter instance.");
            }
            bool workConnOpened = false;
            if (((workConnection.State & global::System.Data.ConnectionState.Broken) 
                        == global::System.Data.ConnectionState.Broken)) {
                workConnection.Close();
            }
            if ((workConnection.State == global::System.Data.ConnectionState.Closed)) {
                workConnection.Open();
                workConnOpened = true;
            }
            global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction();
            if ((workTransaction == null)) {
                throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" +
                        "ctions or the current state is not allowing the transaction to begin.");
            }
            global::System.Collections.Generic.List<global::System.Data.DataRow> allChangedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>();
            global::System.Collections.Generic.List<global::System.Data.DataRow> allAddedRows = new global::System.Collections.Generic.List<global::System.Data.DataRow>();
            global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter> adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List<global::System.Data.Common.DataAdapter>();
            global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection> revertConnections = new global::System.Collections.Generic.Dictionary<object, global::System.Data.IDbConnection>();
            int result = 0;
            global::System.Data.DataSet backupDataSet = null;
            if (this.BackupDataSetBeforeUpdate) {
                backupDataSet = new global::System.Data.DataSet();
                backupDataSet.Merge(dataSet);
            }
            try {
                ---- Perform updates -----------
                if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete)) {
                    result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows));
                    result = (result + this.UpdateInsertedRows(dataSet, allAddedRows));
                }
                else {
                    result = (result + this.UpdateInsertedRows(dataSet, allAddedRows));
                    result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows));
                }
                result = (result + this.UpdateDeletedRows(dataSet, allChangedRows));
                ---- Commit updates -----------
                workTransaction.Commit();
                if ((0 < allAddedRows.Count)) {
                    global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count];
                    allAddedRows.CopyTo(rows);
                    for (int i = 0; (i < rows.Length); i = (i + 1)) {
                        global::System.Data.DataRow row = rows[i];
                        row.AcceptChanges();
                    }
                }
                if ((0 < allChangedRows.Count)) {
                    global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count];
                    allChangedRows.CopyTo(rows);
                    for (int i = 0; (i < rows.Length); i = (i + 1)) {
                        global::System.Data.DataRow row = rows[i];
                        row.AcceptChanges();
                    }
                }
            }
            catch (global::System.Exception ex) {
                workTransaction.Rollback();
                 ---- Restore the dataset -----------
                if (this.BackupDataSetBeforeUpdate) {
                    global::System.Diagnostics.Debug.Assert((backupDataSet != null));
                    dataSet.Clear();
                    dataSet.Merge(backupDataSet);
                }
                else {
                    if ((0 < allAddedRows.Count)) {
                        global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count];
                        allAddedRows.CopyTo(rows);
                        for (int i = 0; (i < rows.Length); i = (i + 1)) {
                            global::System.Data.DataRow row = rows[i];
                            row.AcceptChanges();
                            row.SetAdded();
                        }
                    }
                }
                throw ex;
            }
            finally {
                if (workConnOpened) {
                    workConnection.Close();
                }
                if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) {
                    global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count];
                    adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters);
                    for (int i = 0; (i < adapters.Length); i = (i + 1)) {
                        global::System.Data.Common.DataAdapter adapter = adapters[i];
                        adapter.AcceptChangesDuringUpdate = true;
                    }
                }
            }
            return result;
        }
[ global :: System . Diagnostics . DebuggerNonUserCodeAttribute ( ) ] [ global :: System . CodeDom . Compiler . GeneratedCodeAttribute ( " " , " " ) ] public virtual int UpdateAll ( dsLocalReport dataSet ) { if ( ( dataSet == null ) ) { throw new global :: System . ArgumentNullException ( " " ) ; } if ( ( dataSet . HasChanges ( ) == false ) ) { return 0 ; } global :: System . Data . IDbConnection workConnection = this . Connection ; if ( ( workConnection == null ) ) { throw new global :: System . ApplicationException ( " " + " " ) ; } bool workConnOpened = false ; if ( ( ( workConnection . State & global :: System . Data . ConnectionState . Broken ) == global :: System . Data . ConnectionState . Broken ) ) { workConnection . Close ( ) ; } if ( ( workConnection . State == global :: System . Data . ConnectionState . Closed ) ) { workConnection . Open ( ) ; workConnOpened = true ; } global :: System . Data . IDbTransaction workTransaction = workConnection . BeginTransaction ( ) ; if ( ( workTransaction == null ) ) { throw new global :: System . ApplicationException ( " " + " " ) ; } global :: System . Collections . Generic . List < global :: System . Data . DataRow > allChangedRows = new global :: System . Collections . Generic . List < global :: System . Data . DataRow > ( ) ; global :: System . Collections . Generic . List < global :: System . Data . DataRow > allAddedRows = new global :: System . Collections . Generic . List < global :: System . Data . DataRow > ( ) ; global :: System . Collections . Generic . List < global :: System . Data . Common . DataAdapter > adaptersWithAcceptChangesDuringUpdate = new global :: System . Collections . Generic . List < global :: System . Data . Common . DataAdapter > ( ) ; global :: System . Collections . Generic . Dictionary < object , global :: System . Data . IDbConnection > revertConnections = new global :: System . Collections . Generic . Dictionary < object , global :: System . Data . IDbConnection > ( ) ; int result = 0 ; global :: System . Data . DataSet backupDataSet = null ; if ( this . BackupDataSetBeforeUpdate ) { backupDataSet = new global :: System . Data . DataSet ( ) ; backupDataSet . Merge ( dataSet ) ; } try { if ( ( this . UpdateOrder == UpdateOrderOption . UpdateInsertDelete ) ) { result = ( result + this . UpdateUpdatedRows ( dataSet , allChangedRows , allAddedRows ) ) ; result = ( result + this . UpdateInsertedRows ( dataSet , allAddedRows ) ) ; } else { result = ( result + this . UpdateInsertedRows ( dataSet , allAddedRows ) ) ; result = ( result + this . UpdateUpdatedRows ( dataSet , allChangedRows , allAddedRows ) ) ; } result = ( result + this . UpdateDeletedRows ( dataSet , allChangedRows ) ) ; workTransaction . Commit ( ) ; if ( ( 0 < allAddedRows . Count ) ) { global :: System . Data . DataRow [ ] rows = new System . Data . DataRow [ allAddedRows . Count ] ; allAddedRows . CopyTo ( rows ) ; for ( int i = 0 ; ( i < rows . Length ) ; i = ( i + 1 ) ) { global :: System . Data . DataRow row = rows [ i ] ; row . AcceptChanges ( ) ; } } if ( ( 0 < allChangedRows . Count ) ) { global :: System . Data . DataRow [ ] rows = new System . Data . DataRow [ allChangedRows . Count ] ; allChangedRows . CopyTo ( rows ) ; for ( int i = 0 ; ( i < rows . Length ) ; i = ( i + 1 ) ) { global :: System . Data . DataRow row = rows [ i ] ; row . AcceptChanges ( ) ; } } } catch ( global :: System . Exception ex ) { workTransaction . Rollback ( ) ; if ( this . BackupDataSetBeforeUpdate ) { global :: System . Diagnostics . Debug . Assert ( ( backupDataSet != null ) ) ; dataSet . Clear ( ) ; dataSet . Merge ( backupDataSet ) ; } else { if ( ( 0 < allAddedRows . Count ) ) { global :: System . Data . DataRow [ ] rows = new System . Data . DataRow [ allAddedRows . Count ] ; allAddedRows . CopyTo ( rows ) ; for ( int i = 0 ; ( i < rows . Length ) ; i = ( i + 1 ) ) { global :: System . Data . DataRow row = rows [ i ] ; row . AcceptChanges ( ) ; row . SetAdded ( ) ; } } } throw ex ; } finally { if ( workConnOpened ) { workConnection . Close ( ) ; } if ( ( 0 < adaptersWithAcceptChangesDuringUpdate . Count ) ) { global :: System . Data . Common . DataAdapter [ ] adapters = new System . Data . Common . DataAdapter [ adaptersWithAcceptChangesDuringUpdate . Count ] ; adaptersWithAcceptChangesDuringUpdate . CopyTo ( adapters ) ; for ( int i = 0 ; ( i < adapters . Length ) ; i = ( i + 1 ) ) { global :: System . Data . Common . DataAdapter adapter = adapters [ i ] ; adapter . AcceptChangesDuringUpdate = true ; } } } return result ; }
Update all changes to the dataset.
Update all changes to the dataset .
// ---- Prepare for update ----------- // //  //---- Perform updates ----------- // //  //---- Commit updates ----------- // // ---- Restore the dataset -----------
dataSet
dsLocalReport