public ArrayList SortVersionRecordsByDate(ArrayList versRec) { ArrayList outVersRec = new ArrayList(); ArrayList sortedlist = new ArrayList(); for (int i = 0; i < versRec.Count; i++) { VersionRecord VPtr = (VersionRecord)versRec[i]; DateTime dateAndTime = VPtr.date_time; sortedlist.Add(dateAndTime); } sortedlist.Sort(); for (int i = 0; i < versRec.Count; i++) { for (int j = 0; j < versRec.Count; j++) { VersionRecord VPtr = (VersionRecord)versRec[j]; if (DateTime.Compare((DateTime)sortedlist[versRec.Count - i - 1], VPtr.date_time) == 0) { outVersRec.Add(VPtr); } } } return(outVersRec); }
private bool Find_in_list(ArrayList OldSortedList, ArrayList NewSortedList, int l) { VersionRecord OldVPtr = (VersionRecord)OldSortedList[l]; for (int i = 0; i < NewSortedList.Count; i++) { VersionRecord NewVPtr = (VersionRecord)NewSortedList[i]; if (CompareVersions(NewVPtr, OldVPtr)) { return(true); } } return(false); }
private bool CompareVersions(VersionRecord oldVerRecordPointer, VersionRecord newVerRecordPointer) { if (string.Compare(oldVerRecordPointer.name_Person, newVerRecordPointer.name_Person) != 0) { return(false); } if (string.Compare(oldVerRecordPointer.typeOfVersion, newVerRecordPointer.typeOfVersion) != 0) { return(false); } if (oldVerRecordPointer.majorVer != newVerRecordPointer.majorVer) { return(false); } if (oldVerRecordPointer.minorVer != newVerRecordPointer.minorVer) { return(false); } if (DateTime.Compare(oldVerRecordPointer.date_time, newVerRecordPointer.date_time) != 0) { return(false); } return(true); }
public frmMChild_Versions(ArrayList interlockingOld, ArrayList interlockingNew, int imageOldIndex, int imageNewIndex, float scaleF, string drawMde, ArrayList versionRecordOld, ArrayList versionRecordNew) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call interlockingNewPointer = interlockingNew; interlockingOldPointer = interlockingOld; //============================ versionRecOld = versionRecordOld; versionRecNew = versionRecordNew; //============================ ArrayList OldSortedList = SortVersionRecordsByDate(versionRecOld); ArrayList NewSortedList = SortVersionRecordsByDate(versionRecNew); for (int l = 0; l < OldSortedList.Count; l++) { VersionRecord oldVPtr = (VersionRecord)OldSortedList[l]; double Major_Minor = oldVPtr.majorVer;// + (((float) oldVPtr.minorVer)/10000); string verstring = ""; verstring = oldVPtr.minorVer.ToString(); if (oldVPtr.minorVer < 1000) { verstring = "0" + verstring; } if (oldVPtr.minorVer < 100) { verstring = "0" + verstring; } if (oldVPtr.minorVer < 10) { verstring = "0" + verstring; } this.OldVersions.Items.Add(oldVPtr.typeOfVersion); this.OldVersions.Items[l].SubItems.Add(oldVPtr.name_Person); //if(oldVPtr.minorVer == 0) this.OldVersions.Items[l].SubItems.Add(Major_Minor.ToString() + ".0000"); //else this.OldVersions.Items[l].SubItems.Add(Major_Minor.ToString() + "." + verstring); this.OldVersions.Items[l].SubItems.Add(oldVPtr.date_time.ToString()); if (!Find_in_list(OldSortedList, NewSortedList, l)) { this.OldVersions.Items[l].ForeColor = Color.Blue; } } for (int l = 0; l < NewSortedList.Count; l++) { if (!Find_in_list(NewSortedList, OldSortedList, l)) { VersionRecord newVPtr = (VersionRecord)NewSortedList[l]; double Major_Minor = newVPtr.majorVer;// + (((float) newVPtr.minorVer)/10000); string verstring = ""; verstring = newVPtr.minorVer.ToString(); if (newVPtr.minorVer < 1000) { verstring = "0" + verstring; } if (newVPtr.minorVer < 100) { verstring = "0" + verstring; } if (newVPtr.minorVer < 10) { verstring = "0" + verstring; } this.OldVersions.Items.Add(newVPtr.typeOfVersion); this.OldVersions.Items[l + OldSortedList.Count].SubItems.Add(newVPtr.name_Person); //if(newVPtr.minorVer == 0) this.OldVersions.Items[l+OldSortedList.Count].SubItems.Add(Major_Minor.ToString() + ".0000"); //else this.OldVersions.Items[l + OldSortedList.Count].SubItems.Add(Major_Minor.ToString() + "." + verstring); this.OldVersions.Items[l + OldSortedList.Count].SubItems.Add(newVPtr.date_time.ToString()); this.OldVersions.Items[l + OldSortedList.Count].ForeColor = Color.Red; } } }