/// <summary> /// Makes a deep copy of the current DojoMembership. /// </summary> /// <returns> A new DojoMembership object reflecting the cloned DojoMembership object.</returns> /// <param name="isolation">Placeholders are used to isolate the DojoMembership from its children.</param> public DojoMembership Copy(bool isolation) { DojoMembership dojoMembership = new DojoMembership(); CopyTo(dojoMembership, isolation); return(dojoMembership); }
/// <summary> /// Makes a deep copy of the current DojoMembership. /// </summary> /// <returns> A new DojoMembership object reflecting the cloned DojoMembership object.</returns> public DojoMembership Copy() { DojoMembership dojoMembership = new DojoMembership(); CopyTo(dojoMembership); return(dojoMembership); }
public static DojoMembership NewPlaceHolder(int iD) { DojoMembership dojoMembership = new DojoMembership(); dojoMembership.iD = iD; dojoMembership.isPlaceHolder = true; dojoMembership.isSynced = true; return(dojoMembership); }
/// <summary> /// Duplicates DojoMembership object into a database; may or may not be the same database /// as the parent object. /// </summary> /// <returns> A new DojoMembership object reflecting the replicated DojoMembership object.</returns> public DojoMembership Duplicate() { DojoMembership clonedDojoMembership = this.Clone(); // Insert must be called after children are replicated! clonedDojoMembership.iD = DojoMembershipManager._insert(clonedDojoMembership); clonedDojoMembership.isSynced = true; return(clonedDojoMembership); }
public void Remove(DojoMembership value) { OnCollectionChanged(EventArgs.Empty); int index = IndexOf(value); if (index == -1) { throw(new Exception("DojoMembership not found in collection.")); } RemoveAt(index); }
/// <summary> /// Clones DojoMembership object and clones child objects with cloning or replication. /// as the parent object. /// </summary> /// <returns> A new DojoMembership object reflecting the replicated DojoMembership object.</returns> public DojoMembership Clone() { DojoMembership clonedDojoMembership = new DojoMembership(); clonedDojoMembership.iD = iD; clonedDojoMembership.isSynced = isSynced; clonedDojoMembership.startDate = startDate; clonedDojoMembership.endDate = endDate; clonedDojoMembership.organizationMemberID = organizationMemberID; clonedDojoMembership.sessionID = sessionID; clonedDojoMembership.fee = fee; clonedDojoMembership.paymentAmount = paymentAmount; clonedDojoMembership.isProRated = isProRated; clonedDojoMembership.createDate = createDate; clonedDojoMembership.modifyDate = modifyDate; if (member != null) { clonedDojoMembership.member = member; } if (organization != null) { clonedDojoMembership.organization = organization; } if (parent != null) { clonedDojoMembership.parent = parent; } if (memberTypeTemplate != null) { clonedDojoMembership.memberTypeTemplate = memberTypeTemplate; } if (membershipTemplate != null) { clonedDojoMembership.membershipTemplate = membershipTemplate; } if (priorMembership != null) { clonedDojoMembership.priorMembership = priorMembership; } if (invoiceLine != null) { clonedDojoMembership.invoiceLine = invoiceLine; } return(clonedDojoMembership); }
public int IndexOf(DojoMembership value) { lock (this) { for (int x = 0; x < count; x++) { if (DojoMembershipArray[x].Equals(value)) { return(x); } } return(-1); } }
public int Add(DojoMembership value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; // Resize the array if the count is greater than the length // of the array. if (count > DojoMembershipArray.GetUpperBound(0) + 1) { DojoMembership[] tempDojoMembershipArray = new DojoMembership[count * 2]; Array.Copy(DojoMembershipArray, tempDojoMembershipArray, count - 1); DojoMembershipArray = tempDojoMembershipArray; } DojoMembershipArray[count - 1] = value; } return(count - 1); }
public void Insert(int index, DojoMembership value) { OnCollectionChanged(EventArgs.Empty); lock (this) { count++; // Resize the array if the count is greater than the length // of the array. if (count > DojoMembershipArray.GetUpperBound(0) + 1) { DojoMembership[] tempDojoMembershipArray = new DojoMembership[count * 2]; Array.Copy(DojoMembershipArray, tempDojoMembershipArray, count - 1); DojoMembershipArray = tempDojoMembershipArray; } for (int x = index + 1; x == count - 2; x++) { DojoMembershipArray[x] = DojoMembershipArray[x - 1]; } DojoMembershipArray[index] = value; } }
public bool Contains(DojoMembership value) { return(IndexOf(value) != -1); }
/// <summary> /// Compares the object's ID to another object's ID. /// </summary> public int CompareTo(DojoMembership dojoMembership) { return(this.iD - dojoMembership.iD); }
/// <summary> /// Compares the object's ID to another object's ID. /// </summary> int IComparable.CompareTo(object obj) { DojoMembership dojoMembership = (DojoMembership)obj; return(this.iD - dojoMembership.iD); }
/// <summary> /// Deep copies the current DojoMembership to another instance of DojoMembership. /// </summary> /// <param name="DojoMembership">The DojoMembership to copy to.</param> /// <param name="isolation">Placeholders are used to isolate the DojoMembership from its children.</param> public void CopyTo(DojoMembership dojoMembership, bool isolation) { dojoMembership.iD = iD; dojoMembership.isPlaceHolder = isPlaceHolder; dojoMembership.isSynced = isSynced; if (member != null) { if (isolation) { dojoMembership.member = member.NewPlaceHolder(); } else { dojoMembership.member = member.Copy(false); } } dojoMembership.startDate = startDate; dojoMembership.endDate = endDate; if (organization != null) { if (isolation) { dojoMembership.organization = organization.NewPlaceHolder(); } else { dojoMembership.organization = organization.Copy(false); } } dojoMembership.organizationMemberID = organizationMemberID; if (parent != null) { if (isolation) { dojoMembership.parent = parent.NewPlaceHolder(); } else { dojoMembership.parent = parent.Copy(false); } } if (memberTypeTemplate != null) { if (isolation) { dojoMembership.memberTypeTemplate = memberTypeTemplate.NewPlaceHolder(); } else { dojoMembership.memberTypeTemplate = memberTypeTemplate.Copy(false); } } if (membershipTemplate != null) { if (isolation) { dojoMembership.membershipTemplate = membershipTemplate.NewPlaceHolder(); } else { dojoMembership.membershipTemplate = membershipTemplate.Copy(false); } } dojoMembership.sessionID = sessionID; dojoMembership.fee = fee; if (priorMembership != null) { if (isolation) { dojoMembership.priorMembership = priorMembership.NewPlaceHolder(); } else { dojoMembership.priorMembership = priorMembership.Copy(false); } } dojoMembership.paymentAmount = paymentAmount; dojoMembership.isProRated = isProRated; dojoMembership.createDate = createDate; dojoMembership.modifyDate = modifyDate; if (invoiceLine != null) { if (isolation) { dojoMembership.invoiceLine = invoiceLine.NewPlaceHolder(); } else { dojoMembership.invoiceLine = invoiceLine.Copy(false); } } }
/// <summary> /// Deep copies the current DojoMembership to another instance of DojoMembership. /// This method does not provide isolated copies; use overriden method for this feature. /// </summary> /// <param name="DojoMembership">The DojoMembership to copy to.</param> public void CopyTo(DojoMembership dojoMembership) { CopyTo(dojoMembership, false); }