Beispiel #1
0
        public static SystemHeatExchanger Duplicate(this SystemHeatExchanger systemToDuplicate)
        {
            if (systemToDuplicate == null)
            {
                throw new ArgumentNullException("Input Exchanger system was empty");
            }
            var currentProject = Project.GetProjectInstance;
            var newSystem      = ((SystemHeatExchanger)systemToDuplicate).DeepClone <SystemHeatExchanger>();

            // system id
            var count      = (currentProject.HeatExchangerSystems.Count + 1);
            var systemName = SystemSetting.UserSetting.defaultSetting.ExchangerName + " " + count;

            while (currentProject.HeatExchangerSystems.Any(i => i.Name.ToLower() == systemName.ToLower()))
            {
                count++;
                systemName = SystemSetting.UserSetting.defaultSetting.ExchangerName + " " + count;
            }


            newSystem.Name = systemName;
            newSystem.RegenerateId();

            var roomIndoor = new RoomIndoor();

            roomIndoor = Project.CurrentProject.ExchangerList[Project.CurrentProject.ExchangerList.FindIndex(x => x.SystemID == systemToDuplicate.Id)].DeepClone();
            // roomIndoor = Project.CurrentProject.ExchangerList[Project.CurrentProject.ExchangerList.FindIndex(x => x.SystemID == systemToDuplicate.Id)];
            roomIndoor.SystemID       = newSystem.Id;
            roomIndoor.ControlGroupID = new List <string>();
            Project.CurrentProject.ExchangerList.Add(roomIndoor);

            currentProject.HeatExchangerSystems.Add((SystemHeatExchanger)newSystem);

            return(newSystem);
        }
Beispiel #2
0
        private SystemBase createHeatExchangerSystem()
        {
            string     Count  = (CurrentProject.HeatExchangerSystems.Count + 1).ToString();
            SystemBase system = new SystemHeatExchanger();

            system.Name           = SystemName;
            system.HvacSystemType = SelectedsystemName.SystemID;
            return(system);
        }