+2002-12-04 Ville Palo <vi64pa@koti.soon.fi>\r
+\r
+ * DataRow.cs: \r
+ * DataRowCollection.cs: Added some event handlins stuff.\r
+ * DataSet.cs: Some fixes.\r
+ * DataTable.cs: Added event handlers.\r
+ \r
2002-11-30 Ville Palo <vi64pa@koti.soon.fi>\r
\r
* DataRowChangeEventArgs.cs: Implemented Action and Row properties \r
private string[] columnErrors;
private string rowError;
private DataRowState rowState;
- protected internal int xmlRowID = 0;
+ internal int xmlRowID = 0;
#endregion
[MonoTODO]
set {
DataColumn column = _table.Columns[columnName];
- if (column == null)
+ if (column == null)
throw new IndexOutOfRangeException ();
this[column] = value;
}
current[columnIndex] = DBNull.Value;
else
current[columnIndex] = value;
+ _table.ChangedDataColumn (this, column, value);
}
else {
BeginEdit (); // implicitly called
proposed[columnIndex] = DBNull.Value;
else
proposed[columnIndex] = value;
+ _table.ChangedDataColumn (this, column, value);
}
//Don't know if this is the rigth thing to do,
switch (rowState) {
case DataRowState.Added:
Table.Rows.Remove (this);
+ _table.DeletedDataRow (this, DataRowAction.Delete);
break;
case DataRowState.Deleted:
throw new DeletedRowInaccessibleException ();
rowState = DataRowState.Unchanged;
break;
}
+
+ _table.ChangedDataRow (this, DataRowAction.Rollback);
}
}
//TODO: validation
list.Add (row);
row.RowStateInternal = DataRowState.Added;
+ row.Table.ChangedDataRow (row, DataRowAction.Add);
}
/// <summary>
// Rodrigo Moya <rodrigo@ximian.com>
// Stuart Caborn <stuart.caborn@virgin.net>
// Tim Coleman (tim@timcoleman.com)
+// Ville Palo <vi64pa@koti.soon.fi>
//
// (C) Ximian, Inc. 2002
// Copyright (C) Tim Coleman, 2002
#region Public Methods
+ [MonoTODO]
public void AcceptChanges()
{
- throw new NotImplementedException ();
+ foreach (DataTable tempTable in tableCollection)
+ tempTable.AcceptChanges ();
}
public void Clear()
// TODO: other types!
if ((e = schema.Items [i] as XmlSchemaElement) != null) {
-
+
dataSetName = e.Name;
if (dataSetName != oldSchemaName) {
}
if ((t = e.SchemaType as XmlSchemaComplexType) != null) {
-
+
if ((c = t.Particle as XmlSchemaChoice) != null) {
for (int j = 0; j < c.Items.Count; j++) {
}
else {
// If not known type then it's declared after this
- schemaTypeName = e.SchemaTypeName.ToString ();
+ schemaTypeName = e.SchemaTypeName.ToString ();
+
+ // FIXME: when xmlschema works correcty this is not needed anymore
+ if (schemaTypeName.StartsWith (":"))
+ schemaTypeName = schemaTypeName.Substring (1);
}
} // TODO: SimpleType
else if ((t = schema.Items [i] as XmlSchemaComplexType) != null) {
if (t.Name == schemaTypeName) {
-
+
if ((s = t.Particle as XmlSchemaSequence) != null) {
for (int j = 0; j < s.Items.Count; j++) {
else {
// If table type is not known it's declared after this
tableTypeName = e.SchemaTypeName.ToString ();
+
+ // FIXME: when XmlSchema works correctly this is not
+ // needed anymore
+ if (tableTypeName.StartsWith (":"))
+ tableTypeName = tableTypeName.Substring (1);
}
}
}
}
else if (t.Name == tableTypeName) { // table type declaration
-
+
if ((s = t.Particle as XmlSchemaSequence) != null) {
for (int j = 0; j < s.Items.Count; j++) {
}
+ internal void ChangedDataColumn (DataRow dr, DataColumn dc, object pv)
+ {
+ DataColumnChangeEventArgs e = new DataColumnChangeEventArgs (dr, dc, pv);
+ OnColumnChanged(e);
+ }
+
+ internal void DeletedDataRow (DataRow dr, DataRowAction action)
+ {
+ DataRowChangeEventArgs e = new DataRowChangeEventArgs (dr, action);
+ OnRowDeleted (e);
+ }
+
+ internal void ChangedDataRow (DataRow dr, DataRowAction action)
+ {
+ DataRowChangeEventArgs e = new DataRowChangeEventArgs (dr, action);
+ OnRowChanged (e);
+ }
+
/// <summary>
/// Gets the collection of child relations for this DataTable.
/// </summary>
[MonoTODO]
public void RejectChanges()
{
+ foreach(DataRow myRow in _rows)
+ {
+ if (myRow.RowState != DataRowState.Unchanged)
+ myRow.RejectChanges();
+ }
}
/// <summary>
}
}
+
/// <summary>
/// Raises the RowChanging event.
/// </summary>