当前位置: 首页>>代码示例>>C#>>正文


C# DataRowAction类代码示例

本文整理汇总了C#中DataRowAction的典型用法代码示例。如果您正苦于以下问题:C# DataRowAction类的具体用法?C# DataRowAction怎么用?C# DataRowAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataRowAction类属于命名空间,在下文中一共展示了DataRowAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: taxi_managementDataSet_car_madeRowChangeEventConstructorTest

 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");
 }
开发者ID:coderogue,项目名称:TaxiManagement,代码行数:7,代码来源:taxi_managementDataSet_car_madeRowChangeEventTest.cs

示例2: RowTest

 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.");
 }
开发者ID:coderogue,项目名称:TaxiManagement,代码行数:9,代码来源:taxi_managementDataSet_car_madeRowChangeEventTest.cs

示例3: EvaluateExpressions

        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);
                        }
                    }
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:68,代码来源:DataTable.cs

示例4: SetNewRecordWorker

        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
            {
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:DataTable.cs

示例5: RaiseRowChanging

        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;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:31,代码来源:DataTable.cs

示例6: RaiseRowChanged

 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;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:DataTable.cs

示例7: CascadeAll

 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);
         }
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:DataTable.cs

示例8: Corporation_LinkRowChangeEvent

 public Corporation_LinkRowChangeEvent(Corporation_LinkRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:5,代码来源:Map_Info_Tables.cs

示例9: rowActionInit

		private void rowActionInit (DataRowAction[] act)
		{
			checkAction = true;
			rowChagedCounter = 0;
			rowChangingCounter = 0;
			for (int i = 0; i < 5; i++)
				rowChangeAction[i] = act[i];
		}
开发者ID:symform,项目名称:mono,代码行数:8,代码来源:DataTableTest.cs

示例10: AcceptChangesTest

		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);
			}
		}
开发者ID:symform,项目名称:mono,代码行数:24,代码来源:DataTableTest.cs

示例11: RowChanging

		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");
		}
开发者ID:symform,项目名称:mono,代码行数:16,代码来源:DataTableTest.cs

示例12: PermissionsTableRowChangeEvent

 public PermissionsTableRowChangeEvent(PermissionsTableRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
开发者ID:CarverLab,项目名称:Oyster,代码行数:5,代码来源:Permissions.cs

示例13: userantwortselectRowChangeEvent

 public userantwortselectRowChangeEvent(userantwortselectRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
开发者ID:BackupTheBerlios,项目名称:questioncatalog-svn,代码行数:5,代码来源:DSUserantwortselect.cs

示例14: _TableRowChangeEvent

 public _TableRowChangeEvent(_TableRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
开发者ID:yesashii,项目名称:upa,代码行数:5,代码来源:DataSet1.cs

示例15: Sheet_LinkRowChangeEvent

 public Sheet_LinkRowChangeEvent(Sheet_LinkRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:5,代码来源:Map_Info_Tables.cs


注:本文中的DataRowAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。