Beispiel #1
0
        static void Main(string[] args)
        {
            IPublisherSettings publisherSettings = ConfigurationUtil
                                                   .GetConfiguration()
                                                   .GetTypedSection <PublisherSettings>(nameof(PublisherSettings));

            using EventReceivingService eventReceivingService = new EventReceivingService(publisherSettings);

            _messenger = new Services.TelegramMessenger(publisherSettings);

            _messenger.Init();

            eventReceivingService.Run <EmergencyMessage>((message) => _messenger.SendTextMessageAsync(message.Address));

            bool isContinue = true;

            while (isContinue)
            {
                var text = Console.ReadLine();

                if (text == "stop")
                {
                    isContinue = false;
                }
                else
                {
                    _messenger.SendTextMessageAsync(text);
                }
            }
        }
Beispiel #2
0
 public Publisher(IPublisherSettings publisherSettings, IFileCopyService fileCopyService, 
     IFileSystem fileSystem, IXmlTransformService xmlTransformService)
 {
     _publisherSettings = publisherSettings;
     _fileCopyService = fileCopyService;
     _fileSystem = fileSystem;
     _xmlTransformService = xmlTransformService;
 }
 public TelegramMessenger(IPublisherSettings settings)
 {
     _settings       = settings;
     _chatRepository = new ChatRepository();
 }
        public static void AddConfigureBusinessLogic(
            this IServiceCollection services,
            IConfiguration configuration,
            out List <Profile> profiles)
        {
            profiles = new List <Profile>();

            services.AddConfigureMongoDb(configuration);

            profiles.AddRange(new Profile[] {
                new LocationMappingProfile(),
                new AnimalMappingProfile(),
                new StoryMappingProfile(),
                new BlogMappingProfile(),
                new ArticleMappingProfile(),
                new CmsConfigurationMappingProfile(),
                new DonationConfigurationMappingProfile(),
                new FinancialReportMappingProfile(),
                new TagMappingProfile(),
                new WellKnownTagMappingProfile(),
                new TagLargeMappingProfile(),
                new SequenceMappingProfile(),
                new BucketItemMappingProfile(),
                new VacancyMappingProfile(),
                new ApplicationUserMappingProfile(),
                new RequestMappingProfile(),
                new HistoryProfile()
            });

            services.Configure <AdminSettings>(configuration.GetSection("AdminDetail"));

            IPublisherSettings publisherSettings = configuration.GetTypedSection <PublisherSettings>(nameof(PublisherSettings));

            services.AddSingleton <IPublisherSettings>(p => publisherSettings);
            services.AddSingleton <IEventEmittingService, EventEmittingService>();

            services.AddScoped <IRecoverDataService, RecoverDataService>();
            services.AddScoped <ILocationService, LocationService>();
            services.AddScoped <IBlFullCrud <AnimalDto, AnimalDto, Guid>, AnimalService>()
            .Decorate <IBlFullCrud <AnimalDto, AnimalDto, Guid>, TagDecorator <AnimalDto, AnimalDto, Guid> >()
            .Decorate <IBlFullCrud <AnimalDto, AnimalDto, Guid>, HistoryDecorator <AnimalDto, AnimalDto, Guid> >();
            services.AddScoped <IBlFullCrud <BlogDto, BlogDto, Guid>, BlogService>()
            .Decorate <IBlFullCrud <BlogDto, BlogDto, Guid>, TagDecorator <BlogDto, BlogDto, Guid> >();
            services.AddScoped <IBlFullCrud <VacancyDto, VacancyDto, Guid>, VacancyService>();

            services.AddScoped <IRequestService, RequestService>()
            .Decorate <IRequestService, HistoryRequestDecorator>();

            services.AddSingleton <IImageSizeConfiguration, ImageSizeConfiguration>();
            services.AddScoped <IImageService, ImageService>();

            services.AddScoped <IDocumentCollectionService, DocumentCollectionService>();
            services.AddScoped <IFinancialReportService, FinancialReportService>();
            services.AddScoped <IDocumentService, DocumentService>();
            services.AddScoped <IConfigurationService, ConfigurationService>();
            services.AddScoped <ITagService, TagService>()
            .Decorate <ITagService, HistoryTagDecorator>();
            services.AddScoped <IWellKnownTagService, WellKnownTagService>();
            services.AddScoped <ITagLargeService, TagLargeService>();
            services.AddScoped <IJwtFactory, JwtFactory>();
            services.AddScoped <IAccountService, AccountService>();
            services.AddScoped <IEmailSender, EmailSender>();
            services.AddScoped <IOrganizationDocumentService, OrganizationDocumentService>();
            services.AddScoped <IBlFullCrud <HistoryDto, HistoryDto, Guid>, HistoryService>();

            services.AddSingleton <ILanguageConfiguration, LanguageConfiguration>();
            services.AddScoped <ILanguageService, LanguageService>();
            services.AddScoped <ISequenceService, SequenceService>();
            services.AddScoped <IUsersManagementService, UsersManagementService>();

            BackgroundServices(services, configuration);
        }