public SubForum(SubForum sf)
 {
     this.subForumId = sf.subForumId;
     this.subForumTitle = sf.subForumTitle;
     this.moderators = null;
     this.discussions = null;
     this.parentForum = null;
     this.vocabulary = null;
 }
 public Discussion(string title, string content, User publisher, SubForum parentSubForum)
 {
     // TODO: Complete member initialization
     this.discussionId = discussionId;
     this.title = title;
     this.content = content;
     this.publishDate = DateTime.Now;
     this.publisher = publisher;
     this.comments = new List<Comment>();
     this.parentSubForum = parentSubForum;
 }
        public static bool checkModeratorAuthorization(SubForum sf, string userName, string password, Moderator.modLevel modLevel)
        {
            // forum admin is also a subforum moderator
            try
            {
                Moderator moderator = sf.getModerator(userName);
                if (moderator != null && moderator.user.password == password &&
                    moderator.user.isLogged() && moderator.level == modLevel)
                    return true;

                return false;
            }
            catch
            {
                return false;
            }
        }
Example #4
0
 internal SubForum createNewSubForum(string subForumTitle, ForumGeneratorContext db)
 {
     if (this.subForums.Find(delegate(SubForum subfrm) { return subfrm.subForumTitle == subForumTitle; }) != null)
         throw new UnauthorizedOperationException(ForumGeneratorDefs.EXIST_TITLE);
     SubForum newSubForum = new SubForum(subForumTitle, this, db);
     //lock (db)
     //{
         this.subForums.Add(newSubForum);
         db.SubForums.Add(newSubForum);
         db.SaveChanges();
     //}
     return newSubForum;
 }