public static void CloseBonus(Topic topicinfo, int userid, int[] postIds, int[] winerIds, string[] winnerNames, string[] costBonuss, string[] valuableAnswers, int bestAnswer) { int isbest = 0; topicinfo.Special = 3; //Topics.UpdateTopic(topicinfo); //var tp = Topic.FindByID(topicinfo.Tid); var tp = topicinfo; tp.Special = 3; tp.Update(); //var extid = Scoresets.GetBonusCreditsTrans(); Byte extid = 0; for (int i = 0; i < winerIds.Length; i++) { int num = costBonuss[i].ToInt(); if (winerIds[i] > 0 && num > 0) { User.UpdateUserExtCredits(winerIds[i], extid, (float)num); } if (Utils.InArray(postIds[i].ToString(), valuableAnswers)) { isbest = 1; } if (postIds[i] == bestAnswer) { isbest = 2; } //BBX.Data.Bonus.AddLog(topicinfo.Tid, topicinfo.Posterid, winerIdArray[i], winnerNameArray[i], postIdArray[i], num, Scoresets.GetBonusCreditsTrans(), isbest); var log = new BonusLog(); log.Tid = topicinfo.ID; log.AuthorID = topicinfo.PosterID; log.AnswerID = winerIds[i]; log.AnswerName = winnerNames[i]; log.Pid = postIds[i]; log.Dateline = DateTime.Now; log.Bonus = num; log.ExtID = extid; log.IsBest = (Byte)isbest; } }