예제 #1
0
        public void Remove(string Name)
        {
            using (DbTransaction tran = DbTransaction.Begin())
            {
                DBForum.RemoveSetting(m_NodeId, Name);
                m_settings.Remove(Name);

                tran.Commit();
            }
        }
예제 #2
0
        /// <summary>
        /// Gets the owner container key.
        /// </summary>
        /// <param name="NodeId">The node id.</param>
        /// <returns></returns>
        public static string GetOwnerContainerKey(int NodeId)
        {
            using (IDataReader reader = DBForum.GetOwnerContainerKey(NodeId))
            {
                if (reader.Read())
                {
                    return((string)reader["ContainerKey"]);
                }
            }

            return(null);
        }
예제 #3
0
        public ForumThreadInfo GetForumThread(int ThreadId)
        {
            using (IDataReader reader = DBForum.GetForumThread(ThreadId))
            {
                if (reader.Read())
                {
                    return(new ForumThreadInfo(reader));
                }
            }

            return(null);
        }
예제 #4
0
        public ForumThreadNodeInfo GetForumThreadNode(int NodeId)
        {
            using (IDataReader reader = DBForum.GetForumThreadNode(this.CurrentUserTimeZoneId, NodeId))
            {
                if (reader.Read())
                {
                    return(new ForumThreadNodeInfo(reader));
                }
            }

            return(null);
        }
예제 #5
0
        /// <summary>
        /// Gets the forum thread nodes.
        /// </summary>
        /// <returns></returns>
        public ForumThreadNodeInfo[] GetForumThreadNodes()
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DBForum.GetForumThreadNodesByContainerKey(this.CurrentUserTimeZoneId, _ownerContainer.Key))
            {
                while (reader.Read())
                {
                    list.Add(new ForumThreadNodeInfo(reader));
                }
            }
            return((ForumThreadNodeInfo[])list.ToArray(typeof(ForumThreadNodeInfo)));
        }
예제 #6
0
        /// <summary>
        /// Gets the forum thread nodes.
        /// </summary>
        /// <param name="forum">The forum.</param>
        /// <returns></returns>
        public ForumThreadNodeInfo[] GetForumThreadNodes(ForumInfo forum)
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DBForum.GetForumThreadNodesByForumId(this.CurrentUserTimeZoneId, forum.Id))
            {
                while (reader.Read())
                {
                    list.Add(new ForumThreadNodeInfo(reader));
                }
            }
            return((ForumThreadNodeInfo[])list.ToArray(typeof(ForumThreadNodeInfo)));
        }
예제 #7
0
        /// <summary>
        /// Gets the forum threads.
        /// </summary>
        /// <returns></returns>
        public ForumThreadInfo[] GetForumThreads()
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DBForum.GetForumThreadsByContainerKey(_ownerContainer.Key))
            {
                while (reader.Read())
                {
                    list.Add(new ForumThreadInfo(reader));
                }
            }
            return((ForumThreadInfo[])list.ToArray(typeof(ForumThreadInfo)));
        }
예제 #8
0
        /// <summary>
        /// Gets the forum threads.
        /// </summary>
        /// <param name="ForumId">The forum id.</param>
        /// <returns></returns>
        public ForumThreadInfo[] GetForumThreads(int ForumId)
        {
            ArrayList list = new ArrayList();

            using (IDataReader reader = DBForum.GetForumThreadsByForumId(ForumId))
            {
                while (reader.Read())
                {
                    list.Add(new ForumThreadInfo(reader));
                }
            }
            return((ForumThreadInfo[])list.ToArray(typeof(ForumThreadInfo)));
        }
예제 #9
0
        public static ForumThreadNodeInfo Load(int NodeId)
        {
            ForumThreadNodeInfo retVal = null;

            using (IDataReader reader = DBForum.GetForumThreadNode(Security.CurrentUser.TimeZoneId, NodeId))
            {
                if (reader.Read())
                {
                    retVal = new ForumThreadNodeInfo(reader);
                }
            }

            return(retVal);
        }
예제 #10
0
 private void SetSettings()
 {
     using (IDataReader reader = DBForum.GetSettings(m_NodeId))
     {
         if (reader != null)
         {
             while (reader.Read())
             {
                 string name = (string)reader["Key"];
                 m_settings[name] = new ForumThreadNodeSetting((int)reader["SettingId"], name, (string)reader["Value"]);
             }
         }
     }
 }
예제 #11
0
 private DBForum GetForumFromReader(IDataReader dataReader)
 {
     DBForum forum = new DBForum();
     forum.ForumID = NopSqlDataHelper.GetInt(dataReader, "ForumID");
     forum.ForumGroupID = NopSqlDataHelper.GetInt(dataReader, "ForumGroupID");
     forum.Name = NopSqlDataHelper.GetString(dataReader, "Name");
     forum.Description = NopSqlDataHelper.GetString(dataReader, "Description");
     forum.NumTopics = NopSqlDataHelper.GetInt(dataReader, "NumTopics");
     forum.NumPosts = NopSqlDataHelper.GetInt(dataReader, "NumPosts");
     forum.LastTopicID = NopSqlDataHelper.GetInt(dataReader, "LastTopicID");
     forum.LastPostID = NopSqlDataHelper.GetInt(dataReader, "LastPostID");
     forum.LastPostUserID = NopSqlDataHelper.GetInt(dataReader, "LastPostUserID");
     forum.LastPostTime = NopSqlDataHelper.GetNullableUtcDateTime(dataReader, "LastPostTime");
     forum.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
     forum.CreatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
     forum.UpdatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
     return forum;
 }
예제 #12
0
        public void Add(string Name, string Value)
        {
            using (DbTransaction tran = DbTransaction.Begin())
            {
                int id = DBForum.SetSetting(m_NodeId, Name, Value);

                ForumThreadNodeSetting setting = (ForumThreadNodeSetting)m_settings[Name];
                if (setting != null && setting.SettingId == id)
                {
                    setting.Value = Value;
                }
                else
                {
                    m_settings[Name] = new ForumThreadNodeSetting(id, Name, Value);
                }

                tran.Commit();
            }
        }
예제 #13
0
 /// <summary>
 /// Deletes the forum thread.
 /// </summary>
 /// <param name="ThreadId">The thread id.</param>
 public void DeleteForumThread(int ThreadId)
 {
     DBForum.DeleteForumThreadById(ThreadId);
 }
예제 #14
0
 /// <summary>
 /// Deletes the forum thread.
 /// </summary>
 /// <param name="info">The info.</param>
 public void DeleteForumThread(ForumInfo info)
 {
     DBForum.DeleteForumThreadByForumId(info.Id);
 }
예제 #15
0
 /// <summary>
 /// Deletes the forum.
 /// </summary>
 /// <param name="ForumId">The forum id.</param>
 public void DeleteForum(int ForumId)
 {
     DBForum.DeleteForumById(ForumId);
 }
예제 #16
0
 /// <summary>
 /// Deletes the forum.
 /// </summary>
 public void DeleteForum()
 {
     DBForum.DeleteForumByContainerKey(_ownerContainer.Key);
 }
예제 #17
0
 /// <summary>
 /// Sets the thread node text.
 /// </summary>
 /// <param name="NodeId">The node id.</param>
 /// <param name="Text">The text.</param>
 /// <returns></returns>
 public ForumThreadNodeInfo SetThreadNodeText(int NodeId, string Text)
 {
     DBForum.SetThreadNodeText(NodeId, Text);
     return(this.GetForumThreadNode(NodeId));
 }
예제 #18
0
 /// <summary>
 /// Renames the forum thread.
 /// </summary>
 /// <param name="ThreadId">The thread id.</param>
 /// <param name="newName">The new name.</param>
 /// <returns></returns>
 public ForumThreadInfo RenameForumThread(int ThreadId, string newName)
 {
     DBForum.RenameForumThread(ThreadId, newName);
     return(this.GetForumThread(ThreadId));
 }
예제 #19
0
        public ForumThreadInfo CreateForumThread(int ForumId, string Name, DateTime Created)
        {
            int retVal = DBForum.CreateForumThread(ForumId, Name, Created);

            return(GetForumThread(retVal));
        }
예제 #20
0
        public ForumThreadNodeInfo CreateForumThreadNode(string Text, DateTime Created, int CreatorId, int EMailMessageId, int nodeType)
        {
            int retVal = DBForum.CreateSimpleForumThreadNode(_ownerContainer.Key, Text, Created, CreatorId, null, null, EMailMessageId, nodeType);

            return(GetForumThreadNode(retVal));
        }
예제 #21
0
        public ForumThreadNodeInfo CreateForumThreadNode(string Text, DateTime Created, string CreatorName, string CreatorEmail, int nodeType)
        {
            int retVal = DBForum.CreateSimpleForumThreadNode(_ownerContainer.Key, Text, Created, null, CreatorName, CreatorEmail, null, nodeType);

            return(GetForumThreadNode(retVal));
        }
예제 #22
0
        public ForumThreadNodeInfo CreateForumThreadNode(int ThreadId, string Text, DateTime Created, int CreatorId, int EMailMessageId, int nodeType)
        {
            int retVal = DBForum.CreateForumThreadNode(ThreadId, Text, Created, CreatorId, null, null, EMailMessageId, nodeType);

            return(GetForumThreadNode(retVal));
        }
예제 #23
0
 /// <summary>
 /// Deletes this instance.
 /// </summary>
 public void Delete()
 {
     DBForum.DeleteForumsByContainerKey(this._ownerContainer.Key);
 }
예제 #24
0
        public ForumThreadInfo CreateForumThread(string Name)
        {
            int retVal = DBForum.CreateSimpleForumThread(_ownerContainer.Key, Name, DateTime.UtcNow);

            return(GetForumThread(retVal));
        }
예제 #25
0
 /// <summary>
 /// Deletes the forum thread node.
 /// </summary>
 /// <param name="info">The info.</param>
 public void DeleteForumThreadNode(ForumThreadInfo info)
 {
     DBForum.DeleteForumThreadNodeByThreadId(info.Id);
 }
예제 #26
0
 /// <summary>
 /// Renames the forum.
 /// </summary>
 /// <param name="ForumId">The forum id.</param>
 /// <param name="newName">The new name.</param>
 /// <param name="newDescription">The new description.</param>
 /// <returns></returns>
 public ForumInfo RenameForum(int ForumId, string newName, string newDescription)
 {
     DBForum.RenameForum(ForumId, newName, newDescription);
     return(this.GetForum(ForumId));
 }
예제 #27
0
 /// <summary>
 /// Deletes the forum thread node.
 /// </summary>
 /// <param name="NodeId">The node id.</param>
 public void DeleteForumThreadNode(int NodeId)
 {
     DBForum.DeleteForumThreadNodeById(NodeId);
 }
예제 #28
0
        public ForumInfo CreateForum(string Name, string Description, DateTime Created)
        {
            int retVal = DBForum.CreateForum(_ownerContainer.Key, Name, Description, Created);

            return(GetForum(retVal));
        }
예제 #29
0
        public ForumThreadNodeInfo CreateForumThreadNode(int ThreadId, string Text, DateTime Created, string CreatorName, string CreatorEmail, int nodeType)
        {
            int retVal = DBForum.CreateForumThreadNode(ThreadId, Text, Created, null, CreatorName, CreatorEmail, null, nodeType);

            return(GetForumThreadNode(retVal));
        }
예제 #30
0
        private static Forum DBMapping(DBForum dbItem)
        {
            if (dbItem == null)
                return null;

            Forum item = new Forum();
            item.ForumID = dbItem.ForumID;
            item.ForumGroupID = dbItem.ForumGroupID;
            item.Name = dbItem.Name;
            item.Description = dbItem.Description;
            item.NumTopics = dbItem.NumTopics;
            item.NumPosts = dbItem.NumPosts;
            item.LastTopicID = dbItem.LastTopicID;
            item.LastPostID = dbItem.LastPostID;
            item.LastPostUserID = dbItem.LastPostUserID;
            item.LastPostTime = dbItem.LastPostTime;
            item.DisplayOrder = dbItem.DisplayOrder;
            item.CreatedOn = dbItem.CreatedOn;
            item.UpdatedOn = dbItem.UpdatedOn;

            return item;
        }