예제 #1
0
        public static void RenewReferral(int id, int numberOfDays)
        {
            var referral = new RentedReferral(id);

            referral.ExpireDate = referral.ExpireDate.AddDays(numberOfDays);
            referral.Save();
        }
예제 #2
0
        /// <summary>
        /// Deletes the referral
        /// For REAL: cleans the Referer and IsRented and whole record in RentedReferrals
        /// For BOTS: delete the whole record)
        /// </summary>
        /// <param name="id">Referral id</param>
        public static void DeleteReferral(int id, Parser parser)
        {
            //Check if normal or bot
            RentedReferral referral = (TableHelper.SelectRows <RentedReferral>(TableHelper.MakeDictionary("RefId", id)))[0];
            string         command;

            if (referral.BotClass == -1)
            {
                command = "UPDATE Users SET Referer = '', IsRented = 'false', PointsEarnedToReferer = 0, LastPointableActivity = null WHERE Username = '******'";
                parser.ExecuteRawCommandNonQuery(command);
            }
            //Anyway delete from rentedreferrals
            command = "DELETE FROM RentedReferrals WHERE RefId = " + id.ToString();
            parser.ExecuteRawCommandNonQuery(command);
        }