public SubServiceController(ISubService SubService, IUnitOfWork uow, IServiceRepository service, ILoginInterface loginInterface)
 {
     _SubService         = SubService;
     _uow                = uow;
     _service            = service;
     this.loginInterface = loginInterface;
 }
Example #2
0
 public SubHandler(ISubService subService,
                   IMembershipService membershipService,
                   IPostService postService)
 {
     _subService        = subService;
     _membershipService = membershipService;
     _postService       = postService;
 }
Example #3
0
 public SubBanning(IPermissionService permissionDao,
                   IMembershipService membershipService,
                   ISubService subService,
                   ISubUserBanService subUserBanService)
 {
     _permissionDao     = permissionDao;
     _membershipService = membershipService;
     _subService        = subService;
     _subUserBanService = subUserBanService;
 }
Example #4
0
 public ModeratorService(
     NewsDbContext context,
     INotificationService notificationService,
     ISubService subService,
     IProfileService profileService)
 {
     this.context             = context;
     this.notificationService = notificationService;
     this.subService          = subService;
     this.profileService      = profileService;
 }
Example #5
0
 public StylesHandler(ILogger <StylesHandler> logger,
                      IMembershipService membershipService,
                      ISubService subService,
                      IPermissionService permissionService,
                      ISubCssService subStylesService)
 {
     _logger            = logger;
     _membershipService = membershipService;
     _subService        = subService;
     _permissionService = permissionService;
     _subStylesService  = subStylesService;
 }
        public AggregateServiceInheritanceFixture()
        {
            _someDependencyMock = new Mock<ISomeDependency>().Object;
            _someOtherDependencyMock = new Mock<ISomeOtherDependency>().Object;

            var builder = new ContainerBuilder();
            builder.RegisterAggregateService<ISubService>();
            builder.RegisterInstance(_someDependencyMock);
            builder.RegisterInstance(_someOtherDependencyMock);
            _container = builder.Build();

            _aggregateService = _container.Resolve<ISubService>();
        }
 public MainWindow()
 {
     InitializeComponent();
     _subServiceFactory   = new SubServiceFactory("WPF");
     service              = _subServiceFactory.getFirstService();
     searchTimer          = new DispatcherTimer();
     searchTimer.Interval = new TimeSpan(0, 0, 0, 0, 500);
     searchTimer.Tick    += searchTimer_Tick;
     vm                  = new ViewModel();
     DataContext         = vm;
     vm.PropertyChanged += OnPropertyChanged;
     vm.subtitles        = new List <Subtitle>();
 }
Example #8
0
 public ModerationHandler(IModerationService moderationService,
                          IModerationInviteService moderationInviteService,
                          IMembershipService membershipService,
                          ISubService subService,
                          IPermissionService permissionService,
                          ILogger <ModerationHandler> logger)
 {
     _moderationService       = moderationService;
     _moderationInviteService = moderationInviteService;
     _membershipService       = membershipService;
     _subService        = subService;
     _permissionService = permissionService;
     _logger            = logger;
 }
Example #9
0
        public void Setup()
        {
            _someDependencyMock      = new Mock <ISomeDependency>().Object;
            _someOtherDependencyMock = new Mock <ISomeOtherDependency>().Object;

            var builder = new ContainerBuilder();

            builder.RegisterAggregateService <ISubService>();
            builder.RegisterInstance(_someDependencyMock);
            builder.RegisterInstance(_someOtherDependencyMock);
            _container = builder.Build();

            _aggregateService = _container.Resolve <ISubService>();
        }
Example #10
0
 public MessagesHandler(ILogger <MessagesHandler> logger,
                        IMembershipService membershipService,
                        ISubService subService,
                        IPermissionService permissionService,
                        IMessageService messageService,
                        IMarkdownCompiler markdownCompiler,
                        IPermissionDao permissionDao)
 {
     _logger            = logger;
     _membershipService = membershipService;
     _subService        = subService;
     _permissionService = permissionService;
     _messageService    = messageService;
     _markdownCompiler  = markdownCompiler;
     _permissionDao     = permissionDao;
 }
Example #11
0
        public Form1()
        {
            InitializeComponent();
            subServiceFactory = new SubServiceFactory();
            service           = subServiceFactory.getFirstService();
            languageCBB.Items.Add(new Language()
            {
                service_id = "",
                name       = "Any",
                id_iso639  = ""
            });
            languageCBB.Items.AddRange(languages.ToArray());
            Language item = languages.First(language => language.id_iso639 == "en");

            languageCBB.SelectedIndex = 0;
            meta = new Metadata();
        }
Example #12
0
 public SubHandler(ISubService subService,
                   IMembershipService membershipService,
                   IPostService postService,
                   IEventBus eventBus,
                   ICommandBus commandBus,
                   ISubUserBanService subUserBanService,
                   IModerationService moderationService,
                   IPermissionService permissionService,
                   IMarkdownCompiler markdownCompiler,
                   ISettingsProvider <SubSettings> subSettings)
 {
     _subService        = subService;
     _membershipService = membershipService;
     _postService       = postService;
     _eventBus          = eventBus;
     _commandBus        = commandBus;
     _subUserBanService = subUserBanService;
     _moderationService = moderationService;
     _permissionService = permissionService;
     _markdownCompiler  = markdownCompiler;
     _subSettings       = subSettings;
 }
Example #13
0
 public PostHandler(IMarkdownCompiler markdownCompiler,
                    ILogger <PostHandler> logger,
                    IMembershipService membershipService,
                    IPostService postService,
                    ISubService subService,
                    ISubUserBanService subUserBanService,
                    ICommandBus commandBus,
                    IPermissionService permissionService,
                    ISettingsProvider <SubSettings> subSettings,
                    IEventBus eventBus,
                    IEmbeddedProvider embeddedProvider)
 {
     _markdownCompiler  = markdownCompiler;
     _logger            = logger;
     _membershipService = membershipService;
     _postService       = postService;
     _subService        = subService;
     _subUserBanService = subUserBanService;
     _commandBus        = commandBus;
     _permissionService = permissionService;
     _subSettings       = subSettings;
     _eventBus          = eventBus;
     _embeddedProvider  = embeddedProvider;
 }
Example #14
0
        static void Main(string[] args)
        {
            try
            {
                SkimurContext.Initialize(
                    new Program(),
                    new Skimur.App.Registrar());

                _mirrorSettings = SkimurContext.ServiceProvider.GetRequiredService<ISettingsProvider<MirrorSettings>>().Settings;
                _subService = SkimurContext.ServiceProvider.GetRequiredService<ISubService>();
                _postService = SkimurContext.ServiceProvider.GetRequiredService<IPostService>();
                _membershipService = SkimurContext.ServiceProvider.GetRequiredService<IMembershipService>();
                _commandBus = SkimurContext.ServiceProvider.GetRequiredService<ICommandBus>();

                if (_mirrorSettings.SubsToMirror == null || _mirrorSettings.SubsToMirror.Count == 0)
                    return;

                var botUser = _membershipService.GetUserByUserName(_mirrorSettings.BotName);
                if (botUser == null) return;

                var reddit = new Reddit();

                foreach (var subToMirror in _mirrorSettings.SubsToMirror)
                {
                    Console.WriteLine("Attempting to mirror " + subToMirror + ".");

                    var sub = _subService.GetSubByName(subToMirror);
                    if (sub == null)
                    {
                        Console.WriteLine("Sub doesn't exist.");
                        continue;
                    }

                    var redditSub = reddit.GetSubreddit("/r/" + subToMirror);
                    if (redditSub == null)
                    {
                        Console.WriteLine("Couldn't find reddit sub.");
                        continue;
                    }

                    foreach (var redditPost in redditSub.GetTop(_mirrorSettings.FromTime).Take(_mirrorSettings.PostsPerSub))
                    {
                        Console.WriteLine("Syncing " + redditPost.Title);

                        var existing = _postService.QueryPosts(redditPost.Title, sub.Id).Select(x => _postService.GetPostById(x)).ToList();
                        var exists = false;
                        if (existing.Count > 0)
                        {
                            foreach (var item in existing)
                            {
                                if (item.Title == redditPost.Title && item.Mirrored == "reddit")
                                    exists = true;
                            }
                        }
                        if (exists)
                        {
                            Console.WriteLine("Already exists.");
                            continue;
                        }

                        var createPostResponse = _commandBus.Send<CreatePost, CreatePostResponse>(
                            new CreatePost
                            {
                                CreatedByUserId = botUser.Id,
                                Title = redditPost.Title,
                                Url = redditPost.Url.ToString(),
                                Content = redditPost.SelfText,
                                PostType = redditPost.IsSelfPost ? PostType.Text : PostType.Link,
                                SubName = subToMirror,
                                NotifyReplies = false,
                                Mirror = "reddit",
                                OverrideDateCreated = redditPost.CreatedUTC
                            });

                        if (!string.IsNullOrEmpty(createPostResponse.Error))
                        {
                            Console.WriteLine("Couldn't create post. " + createPostResponse.Error);
                            continue;
                        }

                        if (!createPostResponse.PostId.HasValue)
                        {
                            Console.WriteLine("No post id");
                            continue;
                        }

                        var createCommentResponse = _commandBus.Send<CreateComment, CreateCommentResponse>(
                           new CreateComment
                           {
                               PostId = createPostResponse.PostId.Value,
                               DateCreated = Common.CurrentTime(),
                               AuthorUserName = botUser.UserName,
                               Body = string.Format("Mirrored from [here]({0}).", redditPost.Shortlink),
                               SendReplies = false
                           });

                        if (!string.IsNullOrEmpty(createCommentResponse.Error))
                        {
                            Console.WriteLine("Couldn't create comment. " + createCommentResponse.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #15
0
 public LoanController(ICompanyService db, ISubService sub)
 {
     this._db = db;
     this.sub = sub;
 }
Example #16
0
 public PermissionDao(ISubService subService, ICommentService commentService)
     :base(subService, commentService)
 {
     
 }
Example #17
0
        static void Main(string[] args)
        {
            try
            {
                SkimurContext.Initialize(
                    new Program(),
                    new Skimur.App.Registrar());

                _mirrorSettings    = SkimurContext.ServiceProvider.GetRequiredService <ISettingsProvider <MirrorSettings> >().Settings;
                _subService        = SkimurContext.ServiceProvider.GetRequiredService <ISubService>();
                _postService       = SkimurContext.ServiceProvider.GetRequiredService <IPostService>();
                _membershipService = SkimurContext.ServiceProvider.GetRequiredService <IMembershipService>();
                _commandBus        = SkimurContext.ServiceProvider.GetRequiredService <ICommandBus>();

                if (_mirrorSettings.SubsToMirror == null || _mirrorSettings.SubsToMirror.Count == 0)
                {
                    return;
                }

                var botUser = _membershipService.GetUserByUserName(_mirrorSettings.BotName);
                if (botUser == null)
                {
                    return;
                }

                var reddit = new Reddit();

                foreach (var subToMirror in _mirrorSettings.SubsToMirror)
                {
                    Console.WriteLine("Attempting to mirror " + subToMirror + ".");

                    var sub = _subService.GetSubByName(subToMirror);
                    if (sub == null)
                    {
                        Console.WriteLine("Sub doesn't exist.");
                        continue;
                    }

                    var redditSub = reddit.GetSubreddit("/r/" + subToMirror);
                    if (redditSub == null)
                    {
                        Console.WriteLine("Couldn't find reddit sub.");
                        continue;
                    }

                    foreach (var redditPost in redditSub.GetTop(_mirrorSettings.FromTime).Take(_mirrorSettings.PostsPerSub))
                    {
                        Console.WriteLine("Syncing " + redditPost.Title);

                        var existing = _postService.QueryPosts(redditPost.Title, sub.Id).Select(x => _postService.GetPostById(x)).ToList();
                        var exists   = false;
                        if (existing.Count > 0)
                        {
                            foreach (var item in existing)
                            {
                                if (item.Title == redditPost.Title && item.Mirrored == "reddit")
                                {
                                    exists = true;
                                }
                            }
                        }
                        if (exists)
                        {
                            Console.WriteLine("Already exists.");
                            continue;
                        }

                        var createPostResponse = _commandBus.Send <CreatePost, CreatePostResponse>(
                            new CreatePost
                        {
                            CreatedByUserId     = botUser.Id,
                            Title               = redditPost.Title,
                            Url                 = redditPost.Url.ToString(),
                            Content             = redditPost.SelfText,
                            PostType            = redditPost.IsSelfPost ? PostType.Text : PostType.Link,
                            SubName             = subToMirror,
                            NotifyReplies       = false,
                            Mirror              = "reddit",
                            OverrideDateCreated = redditPost.CreatedUTC
                        });

                        if (!string.IsNullOrEmpty(createPostResponse.Error))
                        {
                            Console.WriteLine("Couldn't create post. " + createPostResponse.Error);
                            continue;
                        }

                        if (!createPostResponse.PostId.HasValue)
                        {
                            Console.WriteLine("No post id");
                            continue;
                        }

                        var createCommentResponse = _commandBus.Send <CreateComment, CreateCommentResponse>(
                            new CreateComment
                        {
                            PostId         = createPostResponse.PostId.Value,
                            DateCreated    = Common.CurrentTime(),
                            AuthorUserName = botUser.UserName,
                            Body           = string.Format("Mirrored from [here]({0}).", redditPost.Shortlink),
                            SendReplies    = false
                        });

                        if (!string.IsNullOrEmpty(createCommentResponse.Error))
                        {
                            Console.WriteLine("Couldn't create comment. " + createCommentResponse.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #18
0
 public SubEventHandler(ISubService subService)
 {
     _subService = subService;
 }
Example #19
0
 public SubController(ISubService subService)
 {
     this.subService = subService;
 }
Example #20
0
 public SubController(ISubService subService)
 {
     _subService = subService;
 }
Example #21
0
 public SubCommandHandler(ISubService subService)
 {
     _subService = subService;
 }
Example #22
0
 // constructor injection
 public CalculatorService([DepedencyAtrribute(typeof(ISubService))] ISubService sub)
 {
     this.sub = sub;
 }
Example #23
0
 public PermissionService(ISubService subService, ICommentService commentService)
 {
     _subService = subService;
 }
Example #24
0
 public MyService(ISubService s)
 {
 }