public override bool Equals(Object obj) { if (obj == null) { return(false); } if (!(obj is DataTable)) { return(false); } DataTable other = (DataTable)obj; if (!format.Equals(other.getFormat())) { return(false); } if (getRecordCount() != other.getRecordCount()) { return(false); } if (!Util.equals(quality, other.quality)) { return(false); } for (int i = 0; i < getRecordCount(); i++) { if (!getRecord(i).Equals(other.getRecord(i))) { return(false); } } return(true); }
private static HashSet <string> copyWithoutKeyFields(DataTable source, DataTable target, bool copyReadOnlyFields, bool copyNonReplicatableFields, bool removeRecordsFromTarget, ICollection <String> fields) { var errors = new HashSet <String>(); while (removeRecordsFromTarget && target.getRecordCount() > source.getRecordCount()) { if (target.getRecordCount() > target.getFormat().getMinRecords()) { target.removeRecord(target.getRecordCount() - 1); } else { if (source.getFormat().getMinRecords() != source.getFormat().getMaxRecords()) { errors.Add(Cres.get().getString("dtTargetTableMinRecordsReached")); } break; } } for (var i = 0; i < Math.Min(source.getRecordCount(), target.getRecordCount()); i++) { var srcRec = source.getRecord(i); var tgtRec = target.getRecord(i); foreach (var each in copyRecord(srcRec, tgtRec, copyReadOnlyFields, copyNonReplicatableFields, fields)) { errors.Add(each); } } if (source.getRecordCount() > target.getRecordCount()) { for (var i = target.getRecordCount(); i < Math.Min(target.getFormat().getMaxRecords(), source.getRecordCount()); i++) { foreach ( var each in copyRecord(source.getRecord(i), target.addRecord(), copyReadOnlyFields, copyNonReplicatableFields, fields)) { errors.Add(each); } } } if (source.getRecordCount() > target.getFormat().getMaxRecords()) { if (source.getFormat().getMinRecords() != source.getFormat().getMaxRecords()) { errors.Add(Cres.get().getString("dtTargetTableMaxRecordsReached")); } } return(errors); }