Beispiel #1
0
        /// <summary>
        /// Creates a threaded rating for the given rating forum
        /// </summary>
        /// <param name="RatingForum">The forum to post to</param>
        /// <param name="rating">The rating to add</param>
        /// <returns>The created rating object</returns>
        public ThreadInfo RatingThreadCreate(RatingForum ratingForum, RatingInfo rating)
        {
            ISite site = SiteList.GetSite(ratingForum.SiteName);

            //check for repeat posting
            ValidateRating(ratingForum, rating, site);

            Threads threadsObj = new Threads(DnaDiagnostics, DnaDataReaderCreator, CacheManager, SiteList);
            threadsObj.CallingUser = CallingUser;
            threadsObj.BbcUid = BbcUid;
            threadsObj.IpAddress = IpAddress;

            //create the thread entry
            ThreadInfo createdThread = threadsObj.ThreadCreate((Forum)ratingForum, (RatingInfo)rating);

            using (var reader = CreateReader("ratingscreate"))
            {
                reader.AddParameter("entryid", createdThread.rating.ID);
                reader.AddParameter("uid", ratingForum.Id);
                reader.AddParameter("rating", rating.rating);
                reader.AddParameter("userid", CallingUser.UserID);
                reader.AddParameter("siteid", site.SiteID);
                reader.Execute();
            }
            createdThread.rating.rating = rating.rating;

            return createdThread;
        }