/// <summary> /// Makes a deep copy of the current DojoClass. /// </summary> /// <returns> A new DojoClass object reflecting the cloned DojoClass object.</returns> /// <param name="isolation">Placeholders are used to isolate the DojoClass from its children.</param> public DojoClass Copy(bool isolation) { DojoClass dojoClass = new DojoClass(); CopyTo(dojoClass, isolation); return(dojoClass); }
/// <summary> /// Makes a deep copy of the current DojoClass. /// </summary> /// <returns> A new DojoClass object reflecting the cloned DojoClass object.</returns> public DojoClass Copy() { DojoClass dojoClass = new DojoClass(); CopyTo(dojoClass); return(dojoClass); }
public static DojoClass NewPlaceHolder(int iD) { DojoClass dojoClass = new DojoClass(); dojoClass.iD = iD; dojoClass.isPlaceHolder = true; dojoClass.isSynced = true; return(dojoClass); }
/// <summary> /// Duplicates DojoClass object into a database; may or may not be the same database /// as the parent object. /// </summary> /// <returns> A new DojoClass object reflecting the replicated DojoClass object.</returns> public DojoClass Duplicate() { DojoClass clonedDojoClass = this.Clone(); // Insert must be called after children are replicated! clonedDojoClass.iD = DojoClassManager._insert(clonedDojoClass); clonedDojoClass.isSynced = true; return(clonedDojoClass); }
public void Remove(DojoClass value) { OnCollectionChanged(EventArgs.Empty); int index = IndexOf(value); if (index == -1) { throw(new Exception("DojoClass not found in collection.")); } RemoveAt(index); }
public int IndexOf(DojoClass value) { lock (this) { for (int x = 0; x < count; x++) { if (DojoClassArray[x].Equals(value)) { return(x); } } return(-1); } }
//--- Begin Custom Code --- public DojoClass ToDojoClass() { DojoClass c = new DojoClass(); EnsurePreLoad(); c.name = name; c.signinStart = nextSigninStart; c.signinEnd = nextSigninEnd; c.classStart = nextClassStart; c.classEnd = nextClassEnd; c.instructor = instructor; c.location = location; c.parentDefinition = this; return(c); }
public int Add(DojoClass value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; // Resize the array if the count is greater than the length // of the array. if (count > DojoClassArray.GetUpperBound(0) + 1) { DojoClass[] tempDojoClassArray = new DojoClass[count * 2]; Array.Copy(DojoClassArray, tempDojoClassArray, count - 1); DojoClassArray = tempDojoClassArray; } DojoClassArray[count - 1] = value; } return(count - 1); }
/// <summary> /// Clones DojoClass object and clones child objects with cloning or replication. /// as the parent object. /// </summary> /// <returns> A new DojoClass object reflecting the replicated DojoClass object.</returns> public DojoClass Clone() { DojoClass clonedDojoClass = new DojoClass(); clonedDojoClass.iD = iD; clonedDojoClass.isSynced = isSynced; clonedDojoClass.name = name; clonedDojoClass.occupancyMax = occupancyMax; clonedDojoClass.occupancyTarget = occupancyTarget; clonedDojoClass.occupancyCurrent = occupancyCurrent; clonedDojoClass.occupancyCheckDate = occupancyCheckDate; clonedDojoClass.signinStart = signinStart; clonedDojoClass.signinEnd = signinEnd; clonedDojoClass.classStart = classStart; clonedDojoClass.classEnd = classEnd; if (instructor != null) { clonedDojoClass.instructor = instructor; } if (parentSeminar != null) { clonedDojoClass.parentSeminar = parentSeminar; } if (parentDefinition != null) { clonedDojoClass.parentDefinition = parentDefinition; } if (location != null) { clonedDojoClass.location = location; } if (accessControlGroup != null) { clonedDojoClass.accessControlGroup = accessControlGroup; } return(clonedDojoClass); }
public void Insert(int index, DojoClass value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; // Resize the array if the count is greater than the length // of the array. if (count > DojoClassArray.GetUpperBound(0) + 1) { DojoClass[] tempDojoClassArray = new DojoClass[count * 2]; Array.Copy(DojoClassArray, tempDojoClassArray, count - 1); DojoClassArray = tempDojoClassArray; } for (int x = index + 1; x == count - 2; x++) { DojoClassArray[x] = DojoClassArray[x - 1]; } DojoClassArray[index] = value; } }
public bool Contains(DojoClass value) { return(IndexOf(value) != -1); }
/// <summary> /// Compares the object's ID to another object's ID. /// </summary> public int CompareTo(DojoClass dojoClass) { return(this.iD - dojoClass.iD); }
/// <summary> /// Compares the object's ID to another object's ID. /// </summary> int IComparable.CompareTo(object obj) { DojoClass dojoClass = (DojoClass)obj; return(this.iD - dojoClass.iD); }
/// <summary> /// Deep copies the current DojoClass to another instance of DojoClass. /// </summary> /// <param name="DojoClass">The DojoClass to copy to.</param> /// <param name="isolation">Placeholders are used to isolate the DojoClass from its children.</param> public void CopyTo(DojoClass dojoClass, bool isolation) { dojoClass.iD = iD; dojoClass.isPlaceHolder = isPlaceHolder; dojoClass.isSynced = isSynced; dojoClass.name = name; if (instructor != null) { if (isolation) { dojoClass.instructor = instructor.NewPlaceHolder(); } else { dojoClass.instructor = instructor.Copy(false); } } if (parentSeminar != null) { if (isolation) { dojoClass.parentSeminar = parentSeminar.NewPlaceHolder(); } else { dojoClass.parentSeminar = parentSeminar.Copy(false); } } if (parentDefinition != null) { if (isolation) { dojoClass.parentDefinition = parentDefinition.NewPlaceHolder(); } else { dojoClass.parentDefinition = parentDefinition.Copy(false); } } if (location != null) { if (isolation) { dojoClass.location = location.NewPlaceHolder(); } else { dojoClass.location = location.Copy(false); } } if (accessControlGroup != null) { if (isolation) { dojoClass.accessControlGroup = accessControlGroup.NewPlaceHolder(); } else { dojoClass.accessControlGroup = accessControlGroup.Copy(false); } } dojoClass.occupancyMax = occupancyMax; dojoClass.occupancyTarget = occupancyTarget; dojoClass.occupancyCurrent = occupancyCurrent; dojoClass.occupancyCheckDate = occupancyCheckDate; dojoClass.signinStart = signinStart; dojoClass.signinEnd = signinEnd; dojoClass.classStart = classStart; dojoClass.classEnd = classEnd; }
/// <summary> /// Deep copies the current DojoClass to another instance of DojoClass. /// This method does not provide isolated copies; use overriden method for this feature. /// </summary> /// <param name="DojoClass">The DojoClass to copy to.</param> public void CopyTo(DojoClass dojoClass) { CopyTo(dojoClass, false); }