/// <summary> /// Saves the DojoRank object state to the database. /// </summary> public int Save() { if (promotionRank != null) { promotionRank.Save(); } if (isSynced) { return(iD); } if (iD == -1) { throw (new Exception("Invalid record; cannot be saved.")); } if (iD == 0) { iD = DojoRankManager._insert(this); } else { DojoRankManager._update(this); } isSynced = iD != -1; return(iD); }
/// <summary> /// Duplicates DojoRank object into a database; may or may not be the same database /// as the parent object. /// </summary> /// <returns> A new DojoRank object reflecting the replicated DojoRank object.</returns> public DojoRank Duplicate() { DojoRank clonedDojoRank = this.Clone(); // Insert must be called after children are replicated! clonedDojoRank.iD = DojoRankManager._insert(clonedDojoRank); clonedDojoRank.isSynced = true; return(clonedDojoRank); }