/// <summary> /// Deep Clone /// </summary> /// <returns></returns> public EQALoop Copy() { EQALoop loop = MemberwiseClone() as EQALoop; loop.Equipments = this.Equipments.Copy(); return(loop); }
/// <summary> /// 从Loop表的数据行和Eqp表生成回路类的实例 /// </summary> /// <param name="rowEQALoop">Loop表的数据行</param> /// <param name="tableEQAEquipment">Eqp表</param> /// <returns></returns> public static EQALoop CreateEQALoop(DataRow rowEQALoop, DataTable tableEQAEquipment) { if (rowEQALoop == null) { throw new System.ArgumentNullException("from function CreateEQALoop", "Parameter rowEQALoop equals to null"); } if (tableEQAEquipment == null) { throw new System.ArgumentNullException("from function CreateEQALoop", "Parameter tableEQAEquipment equals to null"); } EQALoop loop = new EQALoop(); lock (rowEQALoop) { try { loop.SubSystemID = (rowEQALoop[TblLoop.SYS_ID] as string).Trim(); loop.LoopNo = (rowEQALoop[TblLoop.LOOP_TAGNAME] as string).Trim(); loop.Location = rowEQALoop[TblLoop.LOC] as string; loop.ProcMedium = rowEQALoop[TblLoop.MED] as string; loop.ProcParameter = rowEQALoop[TblLoop.CHR] as string; loop.LowerLimit = rowEQALoop[TblLoop.LOW] as string; loop.UpperLimit = rowEQALoop[TblLoop.HIGH] as string; loop.Unit = rowEQALoop[TblLoop.UNIT] as string; loop.HasLocalIndication = Convert.ToBoolean(rowEQALoop[TblLoop.LI]); loop.HasLocalOperating = Convert.ToBoolean(rowEQALoop[TblLoop.LO]); loop.HasComputerIndication = Convert.ToBoolean(rowEQALoop[TblLoop.I]); loop.HasComputerOperating = Convert.ToBoolean(rowEQALoop[TblLoop.O]); loop.HasRecording = Convert.ToBoolean(rowEQALoop[TblLoop.R]); loop.HasAccumulating = Convert.ToBoolean(rowEQALoop[TblLoop.Q]); loop.HasControlling = Convert.ToBoolean(rowEQALoop[TblLoop.C]); loop.HasAlarm = Convert.ToBoolean(rowEQALoop[TblLoop.A]); loop.HasInterlock = Convert.ToBoolean(rowEQALoop[TblLoop.S]); loop.Description = rowEQALoop[TblLoop.DESCRIP] as string; lock (tableEQAEquipment) { foreach (DataRow rowEquipment in tableEQAEquipment.Rows) { if ((rowEquipment[TblEqp.LOOP_TAGNAME] as string).Trim() == loop.LoopNo) { loop.Equipments.Add(CreateEQAEquipment(rowEquipment)); } } } } catch (System.Data.DataException ex) { MessageBoxWinForm.Info("数据访问错误", ex.Message, ""); } } return(loop); }