public void CopyVariableGrid(VariableGrid tocopy) { this.VarName = tocopy.VarName; this.VarNameID = tocopy.VarNameID; this.pouID = tocopy.pouID; this.Description = tocopy.Description; this.InitialVal = tocopy.InitialVal; this.Type = tocopy.Type; this.Option = (int)tocopy.Option; this.PlantStructureID = tocopy.PlantStructureID; this.DispalyID = tocopy.DispalyID; this.AEB = tocopy.AEB; this.ALB = tocopy.ALB; this.SampleTime = tocopy.SampleTime; this.RTT = tocopy.RTT; this.Interval = tocopy.Interval; this.Archive = tocopy.Archive; this.ArchiveInterval = tocopy.ArchiveInterval; bool found = false; tblAlarm tblaralm; int count = m_tblAlarmCollection.Count; for (int i = count - 1; i >= 0; i--) { found = false; tblaralm = m_tblAlarmCollection[i]; foreach (AlarmObject alarmobject in tocopy.m_AlarmCollection) { if (tblaralm.ID == alarmobject.ID) { found = true; break; } } if (!found) { tblaralm.Delete(); m_tblAlarmCollection.Remove(tblaralm); } } foreach (AlarmObject alarmobject in tocopy.m_AlarmCollection) { if (alarmobject.ID == -1) { tblAlarm tblalarm = new tblAlarm(); tblalarm.AlarmObjectCopy(alarmobject); tblalarm.Insert(); m_tblAlarmCollection.Add(tblalarm); } else { foreach (tblAlarm tblalarm in m_tblAlarmCollection) { if (tblalarm.ID == alarmobject.ID) { tblalarm.AlarmObjectCopy(alarmobject); tblalarm.Update(); } } } } }