public static Approach CopyApproachForSignal(Approach approachToCopy) { var newApproach = CopyApproachCommonProperties(approachToCopy, true); foreach (var d in approachToCopy.Detectors) { var dForNewApproach = Detector.CopyDetector(d.ID, false); newApproach.Detectors.Add(dForNewApproach); } return(newApproach); }
public static Approach CopyApproachForSignal(int approachIDToCopy) { MOE.Common.Models.Repositories.IApproachRepository approachRepository = MOE.Common.Models.Repositories.ApproachRepositoryFactory.Create(); Approach approachToCopy = approachRepository.GetApproachByApproachID(approachIDToCopy); Approach newApproach = CopyApproachCommonProperties(approachToCopy); foreach (Detector d in approachToCopy.Detectors) { Detector dForNewApproach = Detector.CopyDetector(d.ID, false); newApproach.Detectors.Add(dForNewApproach); } return(newApproach); }
public static Approach CopyApproach(int approachIDToCopy) { MOE.Common.Models.Repositories.IApproachRepository approachRepository = MOE.Common.Models.Repositories.ApproachRepositoryFactory.Create(); Approach approachToCopy = approachRepository.GetApproachByApproachID(approachIDToCopy); Approach newApproach = CopyApproachCommonProperties(approachToCopy); foreach (Detector d in approachToCopy.Detectors) { Detector dForNewApproach = Detector.CopyDetector(d.ID, true); //need to increase DetChannel if not copying the whole signal. newApproach.Detectors.Add(dForNewApproach); } if (newApproach.Detectors.Count > 1) { newApproach = SetDetChannelWhenMultipleDetectorsExist(newApproach); } return(newApproach); }
public static Approach CopyApproach(int approachIDToCopy) { var approachRepository = ApproachRepositoryFactory.Create(); var approachToCopy = approachRepository.GetApproachByApproachID(approachIDToCopy); var newApproach = CopyApproachCommonProperties(approachToCopy, false); if (approachToCopy.Detectors != null) { foreach (var d in approachToCopy.Detectors) { var dForNewApproach = Detector.CopyDetector(d.ID, true); //need to increase DetChannel if not copying the whole signal. newApproach.Detectors.Add(dForNewApproach); } if (newApproach.Detectors.Count > 1) { newApproach = SetDetChannelWhenMultipleDetectorsExist(newApproach); } } return(newApproach); }