/// <summary> /// Deep Clone /// </summary> /// <returns></returns> public IDSSystem Copy() { IDSSystem system = MemberwiseClone() as IDSSystem; system.SubSystems = this.SubSystems.Copy(); return(system); }
public static IDSSystem CreateIDSSystem(DataRow rowSystem, DataTable tableLoop, DataTable tableHierarchy, DataTable tableEquipment, DataTable tableSubEquipment, DataTable tableRepositories, DataTable tableCable, DataTable tableMountingScheme) { if (rowSystem == null) { throw new System.ArgumentNullException("frome function CreateIDSSystem", "Parameter rowSystem equals to null"); } IDSSystem system = new IDSSystem(); lock (rowSystem) { try { system.ID = Convert.ToString(rowSystem[TblIDSHierarchy.ID]).Trim(); system.ParentID = Convert.ToString(rowSystem[TblIDSHierarchy.ParentID]).Trim(); system.Code = (rowSystem[TblIDSHierarchy.Code] as string).Trim(); system.Name = (rowSystem[TblIDSHierarchy.Name] as string).Trim(); system.Phase = (rowSystem[TblIDSHierarchy.Phase] as string).Trim(); system.SerialNumber = Convert.ToString(rowSystem[TblIDSHierarchy.SerialNumber]).Trim(); system.Description = (rowSystem[TblIDSHierarchy.Description] as string).Trim(); system.SubSystems.Clear(); lock (tableHierarchy) { foreach (DataRow rowSubSystem in tableHierarchy.Rows) { if (Convert.ToString(rowSubSystem[TblIDSHierarchy.ParentID]).Trim() == system.ID && Convert.ToString(rowSubSystem[TblIDSHierarchy.Type]).Trim() == IDSEnumSystemType.SubSystem) { system.SubSystems.Add(CreateIDSSubSystem(rowSubSystem, system.Code, tableLoop, tableHierarchy, tableEquipment, tableSubEquipment, tableRepositories, tableCable, tableMountingScheme)); } } } } catch (System.Data.DataException ex) { MessageBoxWinForm.Info("数据访问错误", ex.Message, ""); } } return(system); }
public IDSSubSystem(IDSSystem system) { ID = ""; ParentID = ""; _system = system; Code = ""; Name = ""; IsNameInLoop = false; Phase = ""; SerialNumber = ""; Description = ""; Loops = new IDSLoopCollection(); }