/// <summary> /// /// </summary> /// <returns></returns> public IHierarchyObject GetCopy() { PeriodName periodName = new PeriodName(); periodName.name = "Copy Of " + this.name; periodName.position = -1; periodName.parent = null; foreach (PeriodName child in this.childrenListChangeHandler.Items) { IHierarchyObject copy = child.GetCopy(); periodName.AddChild(copy); } return(periodName); }
public IHierarchyObject CloneObject() { PeriodName periodName = new PeriodName(); string stringValue = this.name; periodName.name = stringValue; int intValue = this.position; periodName.position = intValue; //periodName.parent = this.parent != null ? (PeriodName)this.parent.CloneObject() : null; stringValue = this.show; periodName.show = stringValue; bool boolValue = this.showDay; periodName.showDay = boolValue; boolValue = this.showMonth; periodName.showMonth = boolValue; boolValue = this.showWeek; periodName.showWeek = boolValue; boolValue = this.showYear; periodName.showYear = boolValue; stringValue = this.granularity; periodName.granularity = stringValue; boolValue = this.iDateDefault; periodName.iDateDefault = boolValue; intValue = this.incrementationCount; periodName.incrementationCount = intValue; boolValue = this.isModified; periodName.isModified = boolValue; stringValue = this.modificationDate; periodName.modificationDate = stringValue; stringValue = this.creationDate; periodName.creationDate = stringValue; intValue = this.oid.HasValue ? this.oid.Value : 0; if (intValue != 0) { periodName.oid = intValue; } stringValue = this.typeName; periodName.typeName = stringValue; stringValue = this.periodFrom; periodName.periodFrom = stringValue; stringValue = this.periodTo; periodName.periodTo = stringValue; periodName.root = null; periodName.intervalListChangeHandler = new PersistentListChangeHandler <PeriodInterval>(); foreach (PeriodInterval intervalle in this.intervalListChangeHandler.Items) { periodName.intervalListChangeHandler.AddNew((PeriodInterval)intervalle.CloneObject()); } periodName.root = periodName.GetRootPeriodInterval(); boolValue = this.isModified; periodName.isModified = boolValue; boolValue = this.isCompleted; periodName.isCompleted = boolValue; stringValue = this.DEFAULT_DATE_NAME1; periodName.DEFAULT_DATE_NAME1 = stringValue; periodName.childrenListChangeHandler = new PersistentListChangeHandler <PeriodName>(); foreach (PeriodName periodname in this.childrenListChangeHandler.Items) { periodName.AddChild((PeriodName)periodname.CloneObject()); } return(periodName); }