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; } }
public static string GetExtendData(bool alwaysEyeable, DateTime expiresDate, int multiple, PollItemCollectionV5 pollItems, List<int> votedUserIDs) { StringTable table = new StringTable(); table.Add("alwaysEyeable", alwaysEyeable.ToString()); table.Add("expiresDate", expiresDate.ToString()); table.Add("multiple", multiple.ToString()); table.Add("pollItems", pollItems.ToString()); table.Add("votedUserIDs", StringUtil.Join(votedUserIDs, ",")); return table.ToString(); }