Beispiel #1
0
        public override bool UpdateThread(int threadID, int postID, bool isApproved, int threadCatalogID, int iconID
            , string subject, int price, int lastEditorID, string lastEditorName, string content, bool enableHtml
            , bool enableMaxCode3, bool enableSignature, bool enableReplyNotice, AttachmentCollection attachments, IEnumerable<int> historyAttachmentIDs
            , ThreadAttachType attachType, string words, out BasicThread thread, out PostV5 post, out List<int> attachmentIDs, out Dictionary<string, int> fileIDs)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandType = CommandType.StoredProcedure;
                query.CommandText = "bx_v5_UpdateThread";

                SetUpdatePostParams(query, postID, iconID, subject, lastEditorID, lastEditorName
                    , content, enableHtml, enableMaxCode3, enableSignature, enableReplyNotice, isApproved, attachments, historyAttachmentIDs);

                query.CreateParameter<int>("@ThreadID", threadID, SqlDbType.Int);
                query.CreateParameter<int>("@ThreadCatalogID", threadCatalogID, SqlDbType.Int);
                query.CreateParameter<int>("@Price", price, SqlDbType.Int);
                query.CreateParameter<int>("@AttachmentType", (int)attachType, SqlDbType.TinyInt);
                query.CreateParameter<string>("@Words", words, SqlDbType.NVarChar, 400);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    GetThread(reader, attachments, null, out thread, out post, out attachmentIDs, out fileIDs);
                }
            }

            return true;
        }
Beispiel #2
0
        private void SetCreateThreadParams(SqlQuery query, int forumID, int threadCatalogID, ThreadStatus threadStatus, int iconID
            , string subject, string subjectStyle, int postUserID, string postNickName, bool isLocked, bool isValued, string content, bool enableHtml
            , bool enableMaxCode3, bool enableSignature, bool enableReplyNotice, string ipAddress, AttachmentCollection attachments
            , IEnumerable<int> historyAttachmentIDs, string extendData, ThreadAttachType attachType, string words)
        {
            query.CreateParameter("@ThreadCatalogID", threadCatalogID, SqlDbType.Int);
            query.CreateParameter("@ThreadStatus", (int)threadStatus, SqlDbType.TinyInt);
            //query.CreateParameter("@ThreadType", (int)threadType, SqlDbType.TinyInt);

            query.CreateParameter("@SubjectStyle", subjectStyle, SqlDbType.NVarChar, 300);

            //query.CreateParameter("@Price", price, SqlDbType.Int);

            query.CreateParameter("@IsLocked", isLocked, SqlDbType.Bit);
            query.CreateParameter("@IsValued", isValued, SqlDbType.Bit);

            query.CreateParameter("@ExtendData", extendData, SqlDbType.NText);

            query.CreateParameter<int>("@ThreadRandNumber", GetSortNumber("thread"), SqlDbType.Int);


            query.CreateParameter<int>("@UserTotalThreads", SqlDbType.Int, ParameterDirection.Output);

            query.CreateParameter<int>("@TempPostID", GetTempPostID(), SqlDbType.Int);

            query.CreateParameter<int>("@AttachmentType", (int)attachType, SqlDbType.TinyInt);

            query.CreateParameter<string>("@Words", words, SqlDbType.NVarChar, 400);

            SetCreatePostParams(query, forumID, iconID, subject, postUserID, postNickName, content, enableHtml, enableMaxCode3, enableSignature, enableReplyNotice
                , ipAddress, attachments, historyAttachmentIDs);

        }
Beispiel #3
0
        public override bool CreatePolemize(string agreeViewPoint, string againstViewPoint, DateTime polemizeExpiresDate
           , int forumID, int threadCatalogID, ThreadStatus threadStatus, int iconID
           , string subject, string subjectStyle, int postUserID, string postNickName, bool isLocked, bool isValued, string content, bool enableHtml
           , bool enableMaxCode3, bool enableSignature, bool enableReplyNotice, string ipAddress, AttachmentCollection attachments, IEnumerable<int> historyAttachmentIDs
           ,ThreadAttachType attachType, string words, out BasicThread thread, out PostV5 post, out int totalThreads, out int totalPosts, out List<int> attachmentIDs, out Dictionary<string, int> fileIDs)
        {

            using (SqlQuery query = new SqlQuery())
            {
                query.CommandType = CommandType.StoredProcedure;
                query.CommandText = "bx_v5_CreatePolemize";

                string extendData = PolemizeThreadV5.GetExtendData(againstViewPoint, againstViewPoint, 0, 0, 0, polemizeExpiresDate, null);

                SetCreateThreadParams(query, forumID, threadCatalogID, threadStatus, iconID, subject, subjectStyle, postUserID, postNickName, isLocked
                    , isValued, content, enableHtml, enableMaxCode3, enableSignature, enableReplyNotice, ipAddress, attachments, historyAttachmentIDs, extendData, attachType, words);

                query.CreateParameter<string>("@AgreeViewPoint", agreeViewPoint, SqlDbType.NText);
                query.CreateParameter<string>("@AgainstViewPoint", againstViewPoint, SqlDbType.NText);
                query.CreateParameter<DateTime>("@ExpiresDate", polemizeExpiresDate, SqlDbType.DateTime);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    GetThread(reader, attachments, polemizeExpiresDate, out thread, out post, out attachmentIDs, out fileIDs);
                }

                int returnValue = (int)query.Parameters["@ErrorCode"].Value;

                if (returnValue != -1)
                {
                    totalThreads = (query.Parameters["@UserTotalThreads"].Value == DBNull.Value ? 0 : Convert.ToInt32(query.Parameters["@UserTotalThreads"].Value));
                    totalPosts = (query.Parameters["@UserTotalPosts"].Value == DBNull.Value ? 0 : Convert.ToInt32(query.Parameters["@UserTotalPosts"].Value));
                }
                else
                {
                    totalThreads = 0;
                    totalPosts = 0;
                    return false;
                }

                return true;


            }

        }
Beispiel #4
0
        public override bool CreatePoll(string pollItems, int pollMultiple, bool pollIsAlwaysEyeable, DateTime pollExpiresDate
            , int forumID, int threadCatalogID, ThreadStatus threadStatus, int iconID
            , string subject, string subjectStyle, int postUserID, string postNickName, bool isLocked, bool isValued, string content, bool enableHtml
            , bool enableMaxCode3, bool enableSignature, bool enableReplyNotice, string ipAddress, AttachmentCollection attachments, IEnumerable<int> historyAttachmentIDs
            , ThreadAttachType attachType, string words, out BasicThread thread, out PostV5 post, out int totalThreads, out int totalPosts, out List<int> attachmentIDs, out Dictionary<string, int> fileIDs)
        {

            using (SqlQuery query = new SqlQuery())
            {
                query.CommandType = CommandType.StoredProcedure;
                query.CommandText = "bx_v5_CreatePoll";

                SetCreateThreadParams(query, forumID, threadCatalogID, threadStatus, iconID, subject, subjectStyle, postUserID, postNickName, isLocked
                    , isValued, content, enableHtml, enableMaxCode3, enableSignature, enableReplyNotice, ipAddress, attachments, historyAttachmentIDs, null, attachType, words);

                query.CreateParameter("@PollItems", pollItems, SqlDbType.NText);
                query.CreateParameter("@Multiple", pollMultiple, SqlDbType.Int);
                query.CreateParameter("@AlwaysEyeable", pollIsAlwaysEyeable, SqlDbType.Bit);
                query.CreateParameter("@ExpiresDate", pollExpiresDate, SqlDbType.DateTime);

                PollItemCollectionV5 pollitems = null;
                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    GetThread(reader, attachments, pollExpiresDate, out thread, out post, out attachmentIDs, out fileIDs);

                    if (reader.NextResult())
                    {
                        pollitems = new PollItemCollectionV5(reader);
                    }
                }

                int returnValue = (int)query.Parameters["@ErrorCode"].Value;

                if (returnValue != -1)
                {
                    totalThreads = (query.Parameters["@UserTotalThreads"].Value == DBNull.Value ? 0 : Convert.ToInt32(query.Parameters["@UserTotalThreads"].Value));
                    totalPosts = (query.Parameters["@UserTotalPosts"].Value == DBNull.Value ? 0 : Convert.ToInt32(query.Parameters["@UserTotalPosts"].Value));
                }
                else
                {
                    totalThreads = 0;
                    totalPosts = 0;
                    return false;
                }


                string extendData = PollThreadV5.GetExtendData(pollIsAlwaysEyeable, pollExpiresDate, pollMultiple, pollitems, new List<int>());

                thread.SetExtendData(extendData);

                UpdateThreadExtendData(extendData, thread.ThreadID, query);

                return true;


            }

        }
Beispiel #5
0
        public override bool CreateThread(int forumID, int threadCatalogID, ThreadStatus threadStatus, int iconID
            , string subject, string subjectStyle, int price, int postUserID, string postNickName, bool isLocked, bool isValued, string content, bool enableHtml
            , bool enableMaxCode3, bool enableSignature, bool enableReplyNotice, string ipAddress, AttachmentCollection attachments, IEnumerable<int> historyAttachmentIDs
            , ThreadAttachType attachType, string words, out BasicThread thread, out PostV5 post, out int totalThreads, out int totalPosts, out List<int> attachmentIDs, out Dictionary<string, int> fileIDs)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandType = CommandType.StoredProcedure;
                query.CommandText = "bx_v5_CreateThread";

                SetCreateThreadParams(query, forumID, threadCatalogID, threadStatus, iconID, subject, subjectStyle, postUserID, postNickName, isLocked
                    , isValued, content, enableHtml, enableMaxCode3, enableSignature, enableReplyNotice, ipAddress, attachments, historyAttachmentIDs, null, attachType, words);

                query.CreateParameter<int>("@ThreadID", SqlDbType.Int, ParameterDirection.Output);
                query.CreateParameter<int>("@PostID", SqlDbType.Int, ParameterDirection.Output);
                query.CreateParameter("@ThreadType", (int)ThreadType.Normal, SqlDbType.TinyInt);
                query.CreateParameter("@Price", price, SqlDbType.Int);


                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    GetThread(reader, attachments, null, out thread, out post, out attachmentIDs, out fileIDs);
                }

                int returnValue = (int)query.Parameters["@ErrorCode"].Value;

                if (returnValue != -1)
                {
                    //threadID = Convert.ToInt32(query.Parameters["@ThreadID"].Value);
                    //postID = Convert.ToInt32(query.Parameters["@PostID"].Value);
                    totalThreads = (query.Parameters["@UserTotalThreads"].Value == DBNull.Value ? 0 : Convert.ToInt32(query.Parameters["@UserTotalThreads"].Value));
                    totalPosts = (query.Parameters["@UserTotalPosts"].Value == DBNull.Value ? 0 : Convert.ToInt32(query.Parameters["@UserTotalPosts"].Value));

                    return true;
                }
                else
                {
                    //threadID = 0;
                    //postID = 0;
                    totalPosts = 0;
                    totalThreads = 0;

                    return false;
                }
            }

        }
Beispiel #6
0
 public abstract bool UpdateThread(int threadID, int postID, bool isApproved, int threadCatalogID, int iconID
                                   , string subject, int price, int lastEditorID, string lastEditorName, string content, bool enableHtml
                                   , bool enableMaxCode3, bool enableSignature, bool enableReplyNotice, AttachmentCollection attachments, IEnumerable <int> historyAttachmentIDs
                                   , ThreadAttachType attachType, string words, out BasicThread thread, out PostV5 post, out List <int> attachmentIDs, out Dictionary <string, int> fileIDs);
Beispiel #7
0
 public abstract bool CreatePolemize(string agreeViewPoint, string againstViewPoint, DateTime polemizeExpiresDate
                                     , int forumID, int threadCatalogID, ThreadStatus threadStatus, int iconID
                                     , string subject, string subjectStyle, int postUserID, string postNickName, bool isLocked, bool isValued, string content, bool enableHtml
                                     , bool enableMaxCode3, bool enableSignature, bool enableReplyNotice, string ipAddress, AttachmentCollection attachments, IEnumerable <int> historyAttachmentIDs
                                     , ThreadAttachType attachType, string words, out BasicThread thread, out PostV5 post, out int totalThreads, out int totalPosts, out List <int> attachmentIDs, out Dictionary <string, int> fileIDs);