/// <summary> /// Создает несохраненного клона (Itemid которого =-1) переданного элемента /// </summary> /// <param name="toCopy">Элемент для клонирования (иожет быть равен null)</param> /// <returns>Склонированный элемент или элемент по умолчанию</returns> public DirectiveRecord(DirectiveRecord toCopy) : this() { if (toCopy == null) { return; } Completed = toCopy.Completed; Dispatched = toCopy.Dispatched; MaintenanceOrganization = toCopy.MaintenanceOrganization; ODR = toCopy.ODR; _onLifelength = toCopy.OnLifelength; _parent = toCopy.Parent; _parentId = toCopy.ParentId; _parentType = toCopy.ParentType; _performanceNum = toCopy.PerformanceNum; _recordDate = toCopy.RecordDate; RecordTypeId = toCopy.RecordTypeId; Reference = toCopy.Reference; _remarks = toCopy.Remarks; _directivePackage = toCopy.DirectivePackage; _directivePackageId = toCopy.DirectivePackageId; _attachedFile = toCopy.AttachedFile; }
/// <summary> /// Создает новый зкземпляр записи о выполнении на основе след.выполнения /// </summary> /// <param name="nextPerformance"></param> /// <returns></returns> public static DirectiveRecord CreateInstance(NextPerformance nextPerformance) { DirectiveRecord dr = new DirectiveRecord(); if (nextPerformance == null) { return(dr); } //дата выполнения if (nextPerformance.PerformanceDate.HasValue) { dr.RecordDate = nextPerformance.PerformanceDate.Value; } //номер выполнения dr.PerformanceNum = nextPerformance.PerformanceNum; return(dr); }