예제 #1
0
 /// <summary>
 /// Find formatting tags in the text and transform them into static tags.
 /// </summary>
 /// <param name="text">The text to be transformed.</param>
 /// <param name="replyRepository">An instance of IReplyRepository.</param>
 /// <param name="isModerator">True if the current user is a moderator.</param>
 /// <returns>A formatted string.</returns>
 public static string SimplifyComplexTags(string text, IReplyRepository replyRepository, bool isModerator)
 {
     text = TransformTags(text, (content, optionalValue, tag) =>
     {
         if (tag.Is("quote"))
         {
             string reformattedQuote = string.Format("[quote]{0}[/quote]", content);
             if (content.IsLong())
             {
                 Reply reply = replyRepository.GetReply(content.ToLong());
                 if (reply != null)
                 {
                     if (!reply.IsModsOnly() || isModerator)
                     {
                         reformattedQuote = string.Format("[quote][b]Posted by:[/b] [transmit]{0}[/transmit] on {1}\n\n{2}[/quote]", reply.Username, reply.PostedDate, reply.Body);
                     }
                 }
             }
             return(reformattedQuote);
         }
         else
         {
             return(null);
         }
     });
     return(text);
 }
예제 #2
0
        /// <summary>
        /// Find formatting tags in the text and transform them into static tags.
        /// </summary>
        /// <param name="text">The text to be transformed.</param>
        /// <param name="replyRepository">An instance of IReplyRepository.</param>
        /// <param name="isModerator">True if the current user is a moderator.</param>
        /// <returns>A formatted string.</returns>
        public static string SimplifyComplexTags(string text, IReplyRepository replyRepository, bool isModerator)
        {
            var parser = new BBCodeParser(new[]
            {
                new BBTag("quote", "", "", true, true, content =>
                {
                    string reformattedQuote = string.Format(@"[quote]{0}[/quote]", content);
                    if (content.IsLong())
                    {
                        Reply reply = replyRepository.GetReply(content.ToLong());
                        if (reply != null)
                        {
                            if (!reply.IsModsOnly() || isModerator)
                            {
                                var author       = reply.Topic.Board.Anonymous ? "Anon" : reply.Username;
                                reformattedQuote = string.Format("[quote]Posted by: [transmit=USER]{0}[/transmit] on {1}\n\n{2}[/quote]", author, reply.PostedDate, reply.Body);
                            }
                        }
                    }
                    return(reformattedQuote);
                }),
            });

            return(parser.ToHtml(text, false));
        }
예제 #3
0
 // 解析依赖项获取接口实例
 public ForumController(IPostRepository rep1, IUserInfoRepository rep2, ICommentRepository rep3, IReplyRepository rep4, IPraisedRepository rep5)
 {
     post_repository    = rep1;
     user_repository    = rep2;
     comment_repository = rep3;
     reply_repository   = rep4;
     praised_repository = rep5;
 }
예제 #4
0
 public UnitOfWork(DbContext dbContext, IPostRepository postRepository,
                   IReplyRepository replyRepository, ITagRepository tagRepository)
 {
     _dbContext      = dbContext;
     PostRepository  = postRepository;
     ReplyRepository = replyRepository;
     TagRepository   = tagRepository;
 }
예제 #5
0
 public ReplyController(
     IReplyRepository replyRepository,
     UserManager <ApplicationUser> userManager
     )
 {
     this._replyRepository = replyRepository;
     this._userManager     = userManager;
 }
예제 #6
0
 public GraphQLTypeBase(
     IArticleRepository articleRepository,
     IQuestionRepository questionRepository,
     IReplyRepository replyRepository)
 {
     _articleRepository  = articleRepository;
     _questionRepository = questionRepository;
     _replyRepository    = replyRepository;
 }
 public ReplyDownloadController(
     IWebHostEnvironment environment,
     IReplyRepository repository,
     IFileStorageManager fileStorageManager)
 {
     this._environment        = environment;
     this._repository         = repository;
     this._fileStorageManager = fileStorageManager;
 }
예제 #8
0
 public BOARD(
     IBoardRepository boardRepository,
     ITopicRepository topicRepository,
     IReplyRepository replyRepository
 )
 {
     _boardRepository = boardRepository;
     _topicRepository = topicRepository;
     _replyRepository = replyRepository;
 }
예제 #9
0
 public BOARD(
     IBoardRepository boardRepository,
     ITopicRepository topicRepository,
     IReplyRepository replyRepository
     )
 {
     _boardRepository = boardRepository;
     _topicRepository = topicRepository;
     _replyRepository = replyRepository;
 }
예제 #10
0
 public TOPIC(
     IReplyRepository replyRepository,
     ITopicRepository topicRepository,
     IBoardRepository boardRepository
 )
 {
     _replyRepository = replyRepository;
     _topicRepository = topicRepository;
     _boardRepository = boardRepository;
 }
예제 #11
0
파일: TOPIC.cs 프로젝트: mBr001/u413-C-
 public TOPIC(
     IReplyRepository replyRepository,
     ITopicRepository topicRepository,
     IBoardRepository boardRepository
     )
 {
     _replyRepository = replyRepository;
     _topicRepository = topicRepository;
     _boardRepository = boardRepository;
 }
예제 #12
0
 public ThreadController(
     IThreadRepository threadRepository,
     IReplyRepository replyRepository,
     ITagRepository tagRepository,
     UserManager <ApplicationUser> userManager)
 {
     this._replyRepository  = replyRepository;
     this._threadRepository = threadRepository;
     this._tagRepository    = tagRepository;
     this._userManager      = userManager;
 }
예제 #13
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context      = context;
     Posts         = new PostRepository(_context);
     Products      = new ProductRepository(_context);
     Users         = new ApplicationUserRepository(_context);
     Orders        = new OrderRepository(_context);
     OrderProducts = new OrderProductRepository(_context);
     Tags          = new TagRepository(_context);
     Images        = new ImageRepository(_context);
     Replies       = new ReplyRepository(_context);
 }
예제 #14
0
 public HomeController(ICategoryRepository categoryRepository, IProductRepository productRepository,
                       SignInManager <User> signInManager, ICommentRepository commentRepository, IReplyRepository replyRepository,
                       IOrderRepository orderRepository, UserManager <User> userManager)
 {
     _categoryRepository = categoryRepository;
     _productRepository  = productRepository;
     _signInManager      = signInManager;
     _commentRepository  = commentRepository;
     _replyRepository    = replyRepository;
     _orderRepository    = orderRepository;
     _userManager        = userManager;
 }
예제 #15
0
 public ReplyService(
     ILogger <IReplyRepository> logger,
     IReplyRepository replyRepository,
     IApiReplyRequestModelValidator replyModelValidator,
     IBOLReplyMapper bolreplyMapper,
     IDALReplyMapper dalreplyMapper)
     : base(logger,
            replyRepository,
            replyModelValidator,
            bolreplyMapper,
            dalreplyMapper)
 {
 }
예제 #16
0
 public ReplyService(
     ILogger <ReplyService> logger,
     IMapper mapper,
     IPostService postService,
     IReplyRepository replyRepository,
     IUserService user)
 {
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _mapper          = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _postService     = postService ?? throw new ArgumentNullException(nameof(postService));
     _replyRepository = replyRepository ?? throw new ArgumentNullException(nameof(replyRepository));
     _userService     = user ?? throw new ArgumentNullException(nameof(user));
 }
예제 #17
0
        public PostService(IUnitOfWork unitOfWork, IPostRepository postRepository, IReplyRepository replyRepository,
                           IAccountRepository accountRepository, ISectionRepository seciontRepository)
        {
            this._unitOfWork        = unitOfWork;
            this._postRepository    = postRepository;
            this._replyRepository   = replyRepository;
            this._accountRepository = accountRepository;
            this._sectionRepository = seciontRepository;

            this._postRepository.UnitOfWork    = unitOfWork;
            this._replyRepository.UnitOfWork   = unitOfWork;
            this._accountRepository.UnitOfWork = unitOfWork;
            this._sectionRepository.UnitOfWork = unitOfWork;
        }
 public EvaluationToolController(IEvaluationToolApplicationService serviceEvaluationTool,
                                 IQuestionApplicationService serviceQuestion,
                                 IReplyRepository serviceReply,
                                 IFilledToolCoachApplicationService serviceFilledToolCoach,
                                 IFilledToolCoacheeApplicationService serviceFilledToolCoachee,
                                 ICoachApplicationService serviceCoach)
 {
     this._serviceEvaluationTool    = serviceEvaluationTool;
     this._serviceQuestion          = serviceQuestion;
     this._serviceReply             = serviceReply;
     this._serviceFilledToolCoach   = serviceFilledToolCoach;
     this._serviceFilledToolCoachee = serviceFilledToolCoachee;
     this._serviceCoach             = serviceCoach;
 }
예제 #19
0
 public AbstractReplyService(
     ILogger logger,
     IReplyRepository replyRepository,
     IApiReplyRequestModelValidator replyModelValidator,
     IBOLReplyMapper bolReplyMapper,
     IDALReplyMapper dalReplyMapper)
     : base()
 {
     this.ReplyRepository     = replyRepository;
     this.ReplyModelValidator = replyModelValidator;
     this.BolReplyMapper      = bolReplyMapper;
     this.DalReplyMapper      = dalReplyMapper;
     this.logger = logger;
 }
 public EvaluationToolController(IEvaluationToolApplicationService serviceEvaluationTool,
     IQuestionApplicationService serviceQuestion,
     IReplyRepository serviceReply,
     IFilledToolCoachApplicationService serviceFilledToolCoach,
     IFilledToolCoacheeApplicationService serviceFilledToolCoachee,
     ICoachApplicationService serviceCoach)
 {
     this._serviceEvaluationTool = serviceEvaluationTool;
     this._serviceQuestion = serviceQuestion;
     this._serviceReply = serviceReply;
     this._serviceFilledToolCoach = serviceFilledToolCoach;
     this._serviceFilledToolCoachee = serviceFilledToolCoachee;
     this._serviceCoach = serviceCoach;
 }
예제 #21
0
        public ReplyService(
            ILogger <IReplyService> logger,
            MediatR.IMediator mediator,
            IReplyRepository replyRepository,
            IApiReplyServerRequestModelValidator replyModelValidator,
            IDALReplyMapper dalReplyMapper)
            : base()
        {
            this.ReplyRepository     = replyRepository;
            this.ReplyModelValidator = replyModelValidator;
            this.DalReplyMapper      = dalReplyMapper;
            this.logger = logger;

            this.mediator = mediator;
        }
        public StoriesController(IStoryRepository storyRepo,
                                 IReplyRepository replyRepo)
        {
            storyRepository = storyRepo;
            replyRepository = replyRepo;

            storyRepository.CreateTestData(3);
            replyRepository.CreateTestData(3);

            // Sort the stories by the first letter of the Header Property
            // in each story.
            // storyRepo.Stories.Sort((s1, s2) =>
            //							 s1.Header.Substring(0).CompareTo(
            //							 s2.Header.Substring(0)));
        }
예제 #23
0
        protected BaseReplyTest()
        {
            var logger = A.Fake <ILogger <ReplyService> >();

            Mapper          = A.Fake <IMapper>();
            PostService     = A.Fake <IPostService>();
            ReplyRepository = A.Fake <IReplyRepository>();
            User            = A.Fake <IUserService>();

            ReplyService = new ReplyService(
                logger,
                Mapper,
                PostService,
                ReplyRepository,
                User
                );
        }
예제 #24
0
 public ReplyService(IReplyRepository replyRepository, IMapper mapper, IUnitOfWork unitOfWork)
 {
     _unitOfWork      = unitOfWork;
     _mapper          = mapper;
     _replyRepository = replyRepository;
 }
예제 #25
0
 public ClsQuery(IQueryRepository queryRepository, IReplyRepository replyRepository, IDocumentRepository documentrepository)
 {
     this.QueryRepository    = queryRepository;
     this.ReplyRepository    = replyRepository;
     this.DocumentRepository = documentrepository;
 }
예제 #26
0
 public ReplyService(IReplyRepository replyRepository)
 {
     this.replyRepository = replyRepository;
 }
 public ReplyManager(IReplyRepository repository) : base(repository)
 {
     this._replyRepository = repository;
 }
예제 #28
0
파일: LINK.cs 프로젝트: fdanny/CT-Terminal
 public LINK(ILinkRepository linkRepository, IReplyRepository replyRepository)
 {
     _linkRepository = linkRepository;
     _replyRepository = replyRepository;
 }
예제 #29
0
 public ReplyApiController(IReplyRepository replyRepository, IMediator mediator)
 {
     _replyRepository = replyRepository;
     _mediator        = mediator;
 }
 public void Dispose()
 {
     _repository = null;
 }
예제 #31
0
 public ReplyManager(IUnitOfWork unitOfWork)
 {
     _unitOfWork      = unitOfWork;
     _replyRepository = _unitOfWork.ReplyRepository;
 }
 public RepliesController(IReplyRepository repo, IMapper mapper)
 {
     this._mapper = mapper;
     this._repo   = repo;
 }
예제 #33
0
 public ApiReplyRequestModelValidator(IReplyRepository replyRepository)
     : base(replyRepository)
 {
 }
 public ReplyApplicationService(IReplyRepository repository, IUnitOfWork unitOfWork)
     : base(unitOfWork)
 {
     this._repository = repository;
 }
예제 #35
0
파일: BBCodeUtility.cs 프로젝트: xcjs/u413
 /// <summary>
 /// Find formatting tags in the text and transform them into static tags.
 /// </summary>
 /// <param name="text">The text to be transformed.</param>
 /// <param name="replyRepository">An instance of IReplyRepository.</param>
 /// <param name="isModerator">True if the current user is a moderator.</param>
 /// <returns>A formatted string.</returns>
 public static string SimplifyComplexTags(string text, IReplyRepository replyRepository, bool isModerator)
 {
     text = TransformTags(text, (content, optionalValue, tag) =>
         {
             if (tag.Is("quote"))
             {
                 string reformattedQuote = string.Format("[quote]{0}[/quote]", content);
                 if (content.IsLong())
                 {
                     Reply reply = replyRepository.GetReply(content.ToLong());
                     if (reply != null)
                         if (!reply.IsModsOnly() || isModerator)
                             reformattedQuote = string.Format("[quote][b]Posted by:[/b] [transmit]{0}[/transmit] on {1}\n\n{2}[/quote]", reply.Username, reply.PostedDate, reply.Body);
                 }
                 return reformattedQuote;
             }
             else
                 return null;
         });
     return text;
 }
 /// <summary>
 /// Find formatting tags in the text and transform them into static tags.
 /// </summary>
 /// <param name="text">The text to be transformed.</param>
 /// <param name="replyRepository">An instance of IReplyRepository.</param>
 /// <param name="isModerator">True if the current user is a moderator.</param>
 /// <returns>A formatted string.</returns>
 public static string SimplifyComplexTags(string text, IReplyRepository replyRepository, bool isModerator)
 {
     var parser = new BBCodeParser(new[]
         {
             new BBTag("quote", "", "", true, true, content =>
                 {
                     string reformattedQuote = string.Format(@"[quote]{0}[/quote]", content);
                     if (content.IsLong())
                     {
                         Reply reply = replyRepository.GetReply(content.ToLong());
                         if (reply != null)
                             if (!reply.IsModsOnly() || isModerator)
                             {
                                 var author = reply.Topic.Board.Anonymous ? "Anon" : reply.Username;
                                 reformattedQuote = string.Format("[quote]Posted by: [transmit=USER]{0}[/transmit] on {1}\n\n{2}[/quote]", author, reply.PostedDate, reply.Body);
                             }
                     }
                     return reformattedQuote;
                 }),
         });
     return parser.ToHtml(text, false);
 }
예제 #37
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context = context;
     Posts    = new PostRepository(_context);
     Replies  = new ReplyRepository(_context);
 }
 public ReplyController(IReplyRepository repo)
 {
     this.repo = repo;
 }