public void taxi_managementDataSet_car_madeRowChangeEventConstructorTest()
 {
     taxi_managementDataSet.car_madeRow row = null; // TODO: Initialize to an appropriate value
     DataRowAction action = new DataRowAction(); // TODO: Initialize to an appropriate value
     taxi_managementDataSet.car_madeRowChangeEvent target = new taxi_managementDataSet.car_madeRowChangeEvent(row, action);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
 public void RowTest()
 {
     taxi_managementDataSet.car_madeRow row = null; // TODO: Initialize to an appropriate value
     DataRowAction action = new DataRowAction(); // TODO: Initialize to an appropriate value
     taxi_managementDataSet.car_madeRowChangeEvent target = new taxi_managementDataSet.car_madeRowChangeEvent(row, action); // TODO: Initialize to an appropriate value
     taxi_managementDataSet.car_madeRow actual;
     actual = target.Row;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #3
0
 public GlobalMapRowChangeEvent(GlobalMapRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #4
0
        private void SetNewRecordWorker(DataRow row, int proposedRecord, DataRowAction action, bool isInMerge, bool suppressEnsurePropertyChanged,
            int position, bool fireEvent, out Exception deferredException) {

            // this is the event workhorse... it will throw the changing/changed events
            // and update the indexes. Used by change, add, delete, revert.

            // order of execution is as follows
            //
            // 1) set temp record
            // 2) Check constraints for non-expression columns
            // 3) Raise RowChanging/RowDeleting with temp record
            // 4) set the new record in storage
            // 5) Update indexes with recordStateChanges - this will fire ListChanged & PropertyChanged events on associated views
            // 6) Evaluate all Expressions (exceptions are deferred)- this will fire ListChanged & PropertyChanged events on associated views
            // 7) Raise RowChanged/ RowDeleted
            // 8) Check constraints for expression columns

            Debug.Assert(row != null, "Row can't be null.");
            deferredException = null;
            
            if (row.tempRecord != proposedRecord) {
                // $HACK: for performance reasons, EndUpdate calls SetNewRecord with tempRecord == proposedRecord
                if (!inDataLoad) {
                    row.CheckInTable();
                    CheckNotModifying(row);
                }
                if (proposedRecord == row.newRecord) {
                    if (isInMerge) {
                        Debug.Assert(fireEvent, "SetNewRecord is called with wrong parameter");
                        RaiseRowChanged(null, row, action);
                    }
                    return;
                }

                Debug.Assert(!row.inChangingEvent, "How can this row be in an infinite loop?");

                row.tempRecord = proposedRecord;
            }
            DataRowChangeEventArgs drcevent = null;

            try {
                row._action = action;
                drcevent = RaiseRowChanging(null, row, action, fireEvent);
            }
            catch {
                row.tempRecord = -1;
                throw;
            }
            finally {
                row._action = DataRowAction.Nothing;
            }

            row.tempRecord = -1;

            int currentRecord = row.newRecord;

            // if we're deleting, then the oldRecord value will change, so need to track that if it's distinct from the newRecord.
            int secondRecord = (proposedRecord != -1 ?
                                proposedRecord :
                                (row.RowState != DataRowState.Unchanged ?
                                 row.oldRecord :
                                 -1));

            if (action == DataRowAction.Add) { //if we come here from insert we do insert the row to collection
                if (position == -1)
                    Rows.ArrayAdd(row);
                else
                    Rows.ArrayInsert(row, position);
            }

            List<DataRow> cachedRows = null;
            if ((action == DataRowAction.Delete || action == DataRowAction.Change)
                && dependentColumns != null && dependentColumns.Count > 0) {
                // if there are expression columns, need to cache related rows for deletes and updates (key changes)
                // before indexes are modified.
                cachedRows = new List<DataRow>();
                for (int j = 0; j < ParentRelations.Count; j++) {
                    DataRelation relation = ParentRelations[j];
                    if (relation.ChildTable != row.Table) {
                        continue;
                    }
                    cachedRows.InsertRange(cachedRows.Count, row.GetParentRows(relation));
                }

                for (int j = 0; j < ChildRelations.Count; j++) {
                    DataRelation relation = ChildRelations[j];
                    if (relation.ParentTable != row.Table) {
                        continue;
                    }
                    cachedRows.InsertRange(cachedRows.Count, row.GetChildRows(relation));
                }
            }

            // Dev10 Bug 688779: DataRowView.PropertyChanged are not raised on RejectChanges
            // if the newRecord is changing, the propertychanged event should be allowed to triggered for ListChangedType.Changed or .Moved
            // unless the specific condition is known that no data has changed, like DataRow.SetModified()
            if (!suppressEnsurePropertyChanged && !row.HasPropertyChanged && (row.newRecord != proposedRecord)
                && (-1 != proposedRecord) // explictly not fixing Dev10 Bug 692044: DataRowView.PropertyChanged are not raised on DataTable.Delete when mixing current and original records in RowStateFilter
                && (-1 != row.newRecord)) // explictly not fixing parts of Dev10 Bug 697909: when mixing current and original records in RowStateFilter
            {
                // DataRow will believe multiple edits occured and
                // DataView.ListChanged event w/ ListChangedType.ItemChanged will raise DataRowView.PropertyChanged event and
                // PropertyChangedEventArgs.PropertyName will now be empty string so
                // WPF will refresh the entire row
                row.LastChangedColumn = null;
                row.LastChangedColumn = null;
            }

                // Check whether we need to update indexes
                if (LiveIndexes.Count != 0) {

                    // Dev10 bug #463087: DataTable internal index is currupted: '5'
                    if ((-1 == currentRecord) && (-1 != proposedRecord) && (-1 != row.oldRecord) && (proposedRecord != row.oldRecord)) {
                        // the transition from DataRowState.Deleted -> DataRowState.Modified
                        // with same orginal record but new current record
                        // needs to raise an ItemChanged or ItemMoved instead of ItemAdded in the ListChanged event.
                        // for indexes/views listening for both DataViewRowState.Deleted | DataViewRowState.ModifiedCurrent
                        currentRecord = row.oldRecord;
                    }

                    DataViewRowState currentRecordStatePre = row.GetRecordState(currentRecord);
                    DataViewRowState secondRecordStatePre = row.GetRecordState(secondRecord);

                    row.newRecord = proposedRecord;
                    if (proposedRecord != -1)
                        this.recordManager[proposedRecord] = row;

                    DataViewRowState currentRecordStatePost = row.GetRecordState(currentRecord);
                    DataViewRowState secondRecordStatePost = row.GetRecordState(secondRecord);

                    // may raise DataView.ListChanged event
                    RecordStateChanged(currentRecord, currentRecordStatePre, currentRecordStatePost,
                        secondRecord, secondRecordStatePre, secondRecordStatePost);
                }
                else {
                    row.newRecord = proposedRecord;
                    if (proposedRecord != -1)
                        this.recordManager[proposedRecord] = row;
                }

                // Dev10 Bug 461199 - reset the last changed column here, after all
                // DataViews have raised their DataRowView.PropertyChanged event
                row.ResetLastChangedColumn();

                // SQLBU 278737: Record manager corruption when reentrant write operations
                // free the 'currentRecord' only after all the indexes have been updated.
                // Corruption! { if (currentRecord != row.oldRecord) { FreeRecord(ref currentRecord); } }
                // RecordStateChanged raises ListChanged event at which time user may do work
                if (-1 != currentRecord) {
                    if (currentRecord != row.oldRecord)
                    {
                        if ((currentRecord != row.tempRecord) &&   // Delete, AcceptChanges, BeginEdit
                            (currentRecord != row.newRecord) &&    // RejectChanges & SetAdded
                            (row == recordManager[currentRecord])) // AcceptChanges, NewRow
                        {
                            FreeRecord(ref currentRecord);
                        }
                    }
                }

            if (row.RowState == DataRowState.Detached && row.rowID != -1) {
                RemoveRow(row, false);
            }

            if (dependentColumns != null && dependentColumns.Count > 0) {
                try {
                    EvaluateExpressions(row, action, cachedRows);
                }
                catch (Exception exc) {
                    // For DataRows being added, throwing of exception from expression evaluation is
                    // deferred until after the row has been completely added.
                    if (action != DataRowAction.Add) {
                        throw exc;
                    }
                    else {
                        deferredException = exc;
                    }
                }
            }

            try {
                if (fireEvent) {
                    RaiseRowChanged(drcevent, row, action);
                }
            }
            catch (Exception e) {
                // 
                if (!Common.ADP.IsCatchableExceptionType(e)) {
                    throw;
                }
                ExceptionBuilder.TraceExceptionWithoutRethrow(e);
                // ignore the exception
            }
        }
コード例 #5
0
 public AddressTypeListTableRowChangeEvent(AddressTypeListTableRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #6
0
 public Corporation_LinkRowChangeEvent(Corporation_LinkRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
コード例 #7
0
 private DataRowChangeEventArgs RaiseRowChanged(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction) {
     try {
         if (UpdatingCurrent(eRow, eAction) && (IsTypedDataTable || (null != onRowChangedDelegate))) {
             args = OnRowChanged(args, eRow, eAction);
         }
         // check if we deleting good row
         else if (DataRowAction.Delete == eAction && eRow.newRecord == -1 && (IsTypedDataTable || (null != onRowDeletedDelegate))) {
             if (null == args) {
                 args = new DataRowChangeEventArgs(eRow, eAction);
             }
             OnRowDeleted(args);
         }
     }
     catch (Exception f) {
        // 
        if (!Common.ADP.IsCatchableExceptionType(f)) {
          throw;
        }
        ExceptionBuilder.TraceExceptionWithoutRethrow(f);
        // ignore the exception
     }
     return args;
 }
コード例 #8
0
ファイル: DataTableTest.cs プロジェクト: symform/mono
		public void Load_RowStateUpsert ()
		{
			localSetup ();
			dt.Rows.Add (new object[] { 4, "mono 4" });
			dt.Rows.Add (new object[] { 5, "mono 5" });
			dt.AcceptChanges ();
			DataTableReader dtr = dt.CreateDataReader ();
			DataTable dtLoad = setupRowState ();
			// Notice rowChange-Actions only occur 5 times, as number 
			// of actual rows, ignoring row duplication of the deleted row.
			DataRowAction[] dra = new DataRowAction[] {
				DataRowAction.Change,
				DataRowAction.Change,
				DataRowAction.Add,
				DataRowAction.Change,
				DataRowAction.Add};
			rowActionInit (dra);
			dtLoad.Load (dtr, LoadOption.Upsert);
			rowActionEnd ();
			// asserting Unchanged Row0
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Current], "RowData0-C");
			Assert.AreEqual ("RowState 1", dtLoad.Rows[0][1, DataRowVersion.Original], "RowData0-O");
			Assert.AreEqual (DataRowState.Modified, dtLoad.Rows[0].RowState, "RowState0");
			// asserting Modified Row1
			Assert.AreEqual ("mono 2", dtLoad.Rows[1][1, DataRowVersion.Current], "RowData1-C");
			Assert.AreEqual ("RowState 2", dtLoad.Rows[1][1, DataRowVersion.Original], "RowData1-O");
			Assert.AreEqual (DataRowState.Modified, dtLoad.Rows[1].RowState, "RowState1");
			// asserting Deleted Row2 and "Deleted-Added" Row4
			Assert.AreEqual ("RowState 3", dtLoad.Rows[2][1, DataRowVersion.Original], "RowData2-O");
			Assert.AreEqual (DataRowState.Deleted, dtLoad.Rows[2].RowState, "RowState2");
			Assert.AreEqual ("mono 3", dtLoad.Rows[4][1, DataRowVersion.Current], "RowData4-C");
			Assert.AreEqual (DataRowState.Added, dtLoad.Rows[4].RowState, "RowState4");
			// asserting Added Row3
			Assert.AreEqual ("mono 4", dtLoad.Rows[3][1, DataRowVersion.Current], "RowData3-C");
			Assert.AreEqual (DataRowState.Added, dtLoad.Rows[3].RowState, "RowState3");
			// asserting Unpresent Row5
			// Notice row4 is used for added row of deleted row2 and so
			// unpresent row4 moves to row5
			Assert.AreEqual ("mono 5", dtLoad.Rows[5][1, DataRowVersion.Current], "RowData5-C");
			Assert.AreEqual (DataRowState.Added, dtLoad.Rows[5].RowState, "RowState5");
		}
コード例 #9
0
 public FeatureRowChangeEvent(FeatureRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
コード例 #10
0
 public tsh_LocalidadesRowChangeEvent(tsh_LocalidadesRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #11
0
 public TIPIRARowChangeEvent(TIPIRADataSet.TIPIRARow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #12
0
 public SecurityRightRowChangeEvent(SecurityRightData.SecurityRightRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #13
0
 public tsh_ConversionesRowChangeEvent(tsh_ConversionesRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #14
0
ファイル: DataSet1.cs プロジェクト: yesashii/upa
 public _TableRowChangeEvent(_TableRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #15
0
 public QuestionsRowChangeEvent(PipeData.QuestionsRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #16
0
 public AnswersRowChangeEvent(PipeData.AnswersRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #17
0
ファイル: DataTableTest.cs プロジェクト: symform/mono
		public void AcceptChangesTest ()
		{
			DataTable dt = new DataTable ("test");
			dt.Columns.Add ("id", typeof (int));
			dt.Columns.Add ("name", typeof (string));

			dt.Rows.Add (new object [] { 1, "mono 1" });

			dt.RowChanged  += new DataRowChangeEventHandler (OnRowChanged);
			dt.RowChanging += new DataRowChangeEventHandler (OnRowChanging);

			try {
				rowActionChanged = rowActionChanging = DataRowAction.Nothing;
				dt.AcceptChanges ();

				Assert.AreEqual (DataRowAction.Commit, rowActionChanging,
						 "#1 should have fired event and set action to commit");
				Assert.AreEqual (DataRowAction.Commit, rowActionChanged,
						 "#2 should have fired event and set action to commit");
			} finally {
				dt.RowChanged  -= new DataRowChangeEventHandler (OnRowChanged);
				dt.RowChanging -= new DataRowChangeEventHandler (OnRowChanging);
			}
		}
コード例 #18
0
 public total_matriculaRowChangeEvent(total_matriculaRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #19
0
ファイル: DataTableTest.cs プロジェクト: symform/mono
		private void rowActionInit (DataRowAction[] act)
		{
			checkAction = true;
			rowChagedCounter = 0;
			rowChangingCounter = 0;
			for (int i = 0; i < 5; i++)
				rowChangeAction[i] = act[i];
		}
コード例 #20
0
 public KREDITORRowChangeEvent(KREDITORDataSet.KREDITORRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #21
0
ファイル: datosPagare.cs プロジェクト: yesashii/upa
 public pagareRowChangeEvent(pagareRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
コード例 #22
0
 public T_SeccionRowChangeEvent(T_SeccionRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #23
0
 public Sheet_LinkRowChangeEvent(Sheet_LinkRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
コード例 #24
0
 public T_ListadoRowChangeEvent(T_ListadoRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #25
0
 internal void CascadeAll(DataRow row, DataRowAction action) {
     if (DataSet != null && DataSet.fEnableCascading) {
         for (ParentForeignKeyConstraintEnumerator constraints = new ParentForeignKeyConstraintEnumerator(dataSet, this); constraints.GetNext();) {
             constraints.GetForeignKeyConstraint().CheckCascade(row, action);
         }
     }
 }
コード例 #26
0
 public sy_VariablesPuestosRowChangeEvent(sy_VariablesPuestosRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #27
0
        private DataRowChangeEventArgs RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction, bool fireEvent) {

            // check all constraints
            if (EnforceConstraints && !inLoad ) {
                int columnCount = columnCollection.Count;
                for(int i = 0; i < columnCount; ++i) {
                    DataColumn column = columnCollection[i];
                    if (!column.Computed || eAction != DataRowAction.Add) {
                        column.CheckColumnConstraint(eRow, eAction);
                    }
                }

                int constraintCount = constraintCollection.Count;
                for(int i = 0; i < constraintCount; ++i) {
                    constraintCollection[i].CheckConstraint(eRow, eAction);
                }
            }

            // $$anandra.  Check this event out. May be an issue.
            if (fireEvent) {
                args = RaiseRowChanging(args, eRow, eAction);
            }

            if (!inDataLoad) {
                // cascade things...
                if (!MergingData && eAction != DataRowAction.Nothing && eAction != DataRowAction.ChangeOriginal) {
                    CascadeAll(eRow, eAction);
                }
            }
            return args;
        }
コード例 #28
0
ファイル: DataSet1.cs プロジェクト: yesashii/upa
 public _TableRowChangeEvent(_TableRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
コード例 #29
0
        internal void EvaluateExpressions(DataRow row, DataRowAction action, List<DataRow> cachedRows) {
            // evaluate all expressions for specified row
            if (action == DataRowAction.Add ||
                action == DataRowAction.Change||
                (action == DataRowAction.Rollback && (row.oldRecord!=-1 || row.newRecord!=-1))) {
                 // only evaluate original values if different from current.
                if (row.oldRecord != -1 && row.oldRecord != row.newRecord) {
                    EvaluateDependentExpressions(dependentColumns, row, DataRowVersion.Original, cachedRows);
                }
                if (row.newRecord != -1) {
                    EvaluateDependentExpressions(dependentColumns, row, DataRowVersion.Current, cachedRows);
                }
                if (row.tempRecord != -1) {
                    EvaluateDependentExpressions(dependentColumns, row, DataRowVersion.Proposed, cachedRows);
                }
                return;
            }
            else if ((action == DataRowAction.Delete || (action==DataRowAction.Rollback && row.oldRecord==-1 && row.newRecord==-1)) && dependentColumns != null) {
                foreach(DataColumn col in dependentColumns) {                    
                    if (col.DataExpression != null && col.DataExpression.HasLocalAggregate() && col.Table == this) {
                        for (int j = 0; j < Rows.Count; j++) {
                            DataRow tableRow = Rows[j];

                            if (tableRow.oldRecord != -1 && tableRow.oldRecord != tableRow.newRecord) {
                                EvaluateDependentExpressions(dependentColumns, tableRow, DataRowVersion.Original, null);
                            }                          
                        }
                        for (int j = 0; j < Rows.Count; j++)
                        {
                            DataRow tableRow = Rows[j];
                         
                            if (tableRow.tempRecord != -1)
                            {
                                EvaluateDependentExpressions(dependentColumns, tableRow, DataRowVersion.Proposed, null);
                            }                           
                        }
                        // VSTFDEVDIV911434: Order is important here - we need to update proposed before current
                        // Oherwise rows that are in edit state will get ListChanged/PropertyChanged event before default value is changed
                        // It is also the reason why we are not doping it in the single loop: EvaluateDependentExpression can update the
                        // whole table, if it happens, current for all but first row is updated before proposed value
                        for (int j = 0; j < Rows.Count; j++)
                        {
                            DataRow tableRow = Rows[j];
                                                     
                            if (tableRow.newRecord != -1)
                            {
                                EvaluateDependentExpressions(dependentColumns, tableRow, DataRowVersion.Current, null);
                            }
                        }
                        break;
                    }
                }

                if (cachedRows != null) {
                    foreach (DataRow relatedRow in cachedRows) {
                        if (relatedRow.oldRecord != -1 && relatedRow.oldRecord != relatedRow.newRecord) {
                            relatedRow.Table.EvaluateDependentExpressions(relatedRow.Table.dependentColumns, relatedRow, DataRowVersion.Original, null);
                        }
                        if (relatedRow.newRecord != -1) {
                            relatedRow.Table.EvaluateDependentExpressions(relatedRow.Table.dependentColumns, relatedRow, DataRowVersion.Current, null);
                        }
                        if (relatedRow.tempRecord != -1) {
                            relatedRow.Table.EvaluateDependentExpressions(relatedRow.Table.dependentColumns, relatedRow, DataRowVersion.Proposed, null);
                        }
                    }
                }
            }
        }
コード例 #30
0
ファイル: Permissions.cs プロジェクト: CarverLab/Oyster
 public PermissionsTableRowChangeEvent(PermissionsTableRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
コード例 #31
0
ファイル: VehicleTypeDS.cs プロジェクト: jpheary/Argix08
 public VehicleTypeListTableRowChangeEvent(VehicleTypeListTableRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #32
0
 public ColumnIdMapRowChangeEvent(ColumnIdMapRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #33
0
 public userantwortselectRowChangeEvent(userantwortselectRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
コード例 #34
0
ファイル: Dataset1.cs プロジェクト: pizsa44/winforms-demos
 public CategoriesRowChangeEvent(CategoriesRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #35
0
ファイル: DataTableTest.cs プロジェクト: symform/mono
		public void RowChanging ()
		{
			DataTable dt = new DataTable ("table");
			dt.Columns.Add ("col1");
			dt.Columns.Add ("col2");
			dt.RowChanging += new DataRowChangeEventHandler (RowChanging);
			dt.RowChanged += new DataRowChangeEventHandler (RowChanged);
			rowChangingExpectedAction = DataRowAction.Add;
			dt.Rows.Add (new object [] {1, 2});
			Assert.IsTrue (rowChangingRowChanging, "changing,Added");
			Assert.IsTrue (rowChangingRowChanged, "changed,Added");
			rowChangingExpectedAction = DataRowAction.Change;
			dt.Rows [0] [0] = 2;
			Assert.IsTrue (rowChangingRowChanging, "changing,Changed");
			Assert.IsTrue (rowChangingRowChanged, "changed,Changed");
		}
コード例 #36
0
ファイル: IdiomasDataset.cs プロジェクト: windygu/ger20160318
 public IdiomasRowChangeEvent(IdiomasRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #37
0
ファイル: DataTableTest.cs プロジェクト: symform/mono
		public void OnRowChanged (object src, DataRowChangeEventArgs args)
		{
			rowActionChanged = args.Action;
		}
コード例 #38
0
ファイル: DataSet1.cs プロジェクト: yyangrns/winforms-demos
 public StatisticsRowChangeEvent(StatisticsRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #39
0
ファイル: DataTableTest.cs プロジェクト: symform/mono
		public void Load_RowStateOverwriteChanges ()
		{
			localSetup ();
			dt.Rows.Add (new object[] { 4, "mono 4" });
			dt.Rows.Add (new object[] { 5, "mono 5" });
			dt.AcceptChanges ();
			DataTableReader dtr = dt.CreateDataReader ();
			DataTable dtLoad = setupRowState ();
			DataRowAction[] dra = new DataRowAction[] {
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal};
			rowActionInit (dra);
			dtLoad.Load (dtr, LoadOption.OverwriteChanges);
			rowActionEnd ();
			// asserting Unchanged Row0
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Current], "RowData0-C");
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Original], "RowData0-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[0].RowState, "RowState0");
			// asserting Modified Row1
			Assert.AreEqual ("mono 2", dtLoad.Rows[1][1, DataRowVersion.Current], "RowData1-C");
			Assert.AreEqual ("mono 2", dtLoad.Rows[1][1, DataRowVersion.Original], "RowData1-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[1].RowState, "RowState1");
			// asserting Deleted Row2
			Assert.AreEqual ("mono 3", dtLoad.Rows[2][1, DataRowVersion.Current], "RowData1-C");
			Assert.AreEqual ("mono 3", dtLoad.Rows[2][1, DataRowVersion.Original], "RowData1-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[2].RowState, "RowState2");
			// asserting Added Row3
			Assert.AreEqual ("mono 4", dtLoad.Rows[3][1, DataRowVersion.Current], "RowData3-C");
			Assert.AreEqual ("mono 4", dtLoad.Rows[3][1, DataRowVersion.Original], "RowData3-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[3].RowState, "RowState3");
			// asserting Unpresent Row4
			Assert.AreEqual ("mono 5", dtLoad.Rows[4][1, DataRowVersion.Current], "RowData4-C");
			Assert.AreEqual ("mono 5", dtLoad.Rows[4][1, DataRowVersion.Original], "RowData4-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[4].RowState, "RowState4");
		}
コード例 #40
0
 public tpu_ProveedoresEstadosRowChangeEvent(tpu_ProveedoresEstadosRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #41
0
ファイル: DataTableTest.cs プロジェクト: symform/mono
		public void Load_RowStateUpsertUnchangedEqualVal ()
		{
			localSetup ();
			DataTable dtLoad = new DataTable ("LoadRowStateChanges");
			dtLoad.Columns.Add ("id", typeof (int));
			dtLoad.Columns.Add ("name", typeof (string));
			dtLoad.PrimaryKey = new DataColumn[] { dtLoad.Columns["id"] };
			dtLoad.Rows.Add (new object[] { 1, "mono 1" });
			dtLoad.AcceptChanges ();
			DataTableReader dtr = dt.CreateDataReader ();
			DataRowAction[] dra = new DataRowAction[] {
				DataRowAction.Nothing,// REAL action
				DataRowAction.Nothing,// dummy  
				DataRowAction.Nothing,// dummy  
				DataRowAction.Nothing,// dummy  
				DataRowAction.Nothing};// dummy  
			rowActionInit (dra);
			dtLoad.Load (dtr, LoadOption.Upsert);
			rowActionEnd ();
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Current], "RowData0-C");
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Original], "RowData0-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[0].RowState, "RowState0");
		}
コード例 #42
0
 public UserAccessRowChangeEvent(UserAccessRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #43
0
 public PatrolsRowChangeEvent(PatrolsRow row, DataRowAction action) {
     this.eventRow = row;
     this.eventAction = action;
 }
コード例 #44
0
 public TERRITORYRowChangeEvent(TERRITORYRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #45
0
 public Person_LinkRowChangeEvent(Person_LinkRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
コード例 #46
0
 public CITYRowChangeEvent(CITYRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #47
0
 public StreetRowChangeEvent(StreetRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
コード例 #48
0
 public tblBarrowedRowChangeEvent(tblBarrowedRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #49
0
 private void SetMergeRecords(DataRow row, int newRecord, int oldRecord, DataRowAction action) {
     if (newRecord != -1) {
         SetNewRecord(row, newRecord, action, true, true);
         SetOldRecord(row, oldRecord);
     }
     else {
         SetOldRecord(row, oldRecord);
         if (row.newRecord != -1) {
             Debug.Assert(action == DataRowAction.Delete, "Unexpected SetNewRecord action in merge function.");
             SetNewRecord(row, newRecord, action, true, true);
         }
     }
 }
コード例 #50
0
 public CustOrderHistRowChangeEvent(CustOrderHistRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #51
0
 private DataRowChangeEventArgs OnRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction) {
     if ((null != onRowChangingDelegate) || IsTypedDataTable) {
         if (null == args) {
             args = new DataRowChangeEventArgs(eRow, eAction);
         }
         OnRowChanging(args);
     }
     return args;
 }
コード例 #52
0
 public ProductsRowChangeEvent(ProductsRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #53
0
        private DataRowChangeEventArgs RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction) {
            if (UpdatingCurrent(eRow, eAction) && (IsTypedDataTable || (null != onRowChangingDelegate))) {
                eRow.inChangingEvent = true;

                // don't catch
                try {
                    args = OnRowChanging(args, eRow, eAction);
                }
                finally {
                    eRow.inChangingEvent = false;
                }
            }
            // check if we deleting good row
            else if (DataRowAction.Delete == eAction && eRow.newRecord != -1 && (IsTypedDataTable || (null != onRowDeletingDelegate))) {
                eRow.inDeletingEvent = true;
                // don't catch
                try {
                    if (null == args) {
                        args = new DataRowChangeEventArgs(eRow, eAction);
                    }
                    OnRowDeleting(args);
                }
                finally {
                    eRow.inDeletingEvent = false;
                }
            }
            return args;
        }
コード例 #54
0
 public authorsRowChangeEvent(authorsRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #55
0
 internal void SetNewRecord(DataRow row, int proposedRecord, DataRowAction action = DataRowAction.Change, bool isInMerge = false, bool fireEvent = true, bool suppressEnsurePropertyChanged = false) {
     Exception deferredException = null;
     SetNewRecordWorker(row, proposedRecord, action, isInMerge, suppressEnsurePropertyChanged, -1, fireEvent, out deferredException); // we are going to call below overload from insert
     if (deferredException != null) {
         throw deferredException;
     }
 }
コード例 #56
0
 public OrdersRowChangeEvent(OrdersRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #57
0
        internal bool UpdatingCurrent(DataRow row, DataRowAction action) {
            return(action == DataRowAction.Add || action == DataRowAction.Change ||
                   action == DataRowAction.Rollback || action == DataRowAction.ChangeOriginal ||
                   action == DataRowAction.ChangeCurrentAndOriginal);
//                (action == DataRowAction.Rollback && row.tempRecord != -1));
}
コード例 #58
0
 public ParametersRowChangeEvent(ParametersRow row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
コード例 #59
0
				public Order_DetailsRowChangeEvent(Order_DetailsRow row, DataRowAction action) 
				{
					this.eventRow = row;
					this.eventAction = action;
				}
コード例 #60
0
 public DataTable1RowChangeEvent(POPISPROMJENAKOEFICIJENATA.DataTable1Row row, DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }