Example #1
0
        /// <summary>
        /// Saves the DojoPromotion object state to the database.
        /// </summary>
        public int Save()
        {
            if (member != null)
            {
                member.Save();
            }
            if (test != null)
            {
                test.Save();
            }
            if (promotionRank != null)
            {
                promotionRank.Save();
            }
            if (lastRank != null)
            {
                lastRank.Save();
            }

            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DojoPromotionManager._insert(this);
            }
            else
            {
                DojoPromotionManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }