public SQLiteDataRepository(string connectionString, IProgressLogger progressLogger)
            : base(connectionString, progressLogger)
        {
            SQLiteConnectionStringBuilder cnBuilder = new SQLiteConnectionStringBuilder(connectionString);

            this._fileName = cnBuilder.DataSource;
        }
示例#2
0
 public LegislationService(IMapper mapper,
                           IProgressLogger progressLogger,
                           IRepository <Legislation, int> legislationsRepository,
                           IRepository <User, int> usersRepository)
 {
     _mapper                 = mapper;
     _progressLogger         = progressLogger;
     _legislationsRepository = legislationsRepository;
     _usersRepository        = usersRepository;
 }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgressMonitor"/> class.
        /// </summary>
        /// <param name="progressLogger">
        /// The progress logger.
        /// </param>
        public ProgressMonitor(IProgressLogger progressLogger)
        {
            this.cancellationTokenSource = new CancellationTokenSource();
            var token = this.cancellationTokenSource.Token;

            this.progressLogger = progressLogger;

            if (this.progressLogger != null)
            {
                this.backgroundTask = Task.Run(() => this.RunLogProgressTask(token), token);
            }
        }
示例#4
0
 public DebtorFilesService(IMapper mapper,
                           IProgressLogger progressLogger,
                           IRepository <DebtorFile, int> debtorFilesRepository,
                           IRepository <User, int> usersRepository,
                           ConfigurationService configurationService)
 {
     _mapper                = mapper;
     _progressLogger        = progressLogger;
     _debtorFilesRepository = debtorFilesRepository;
     _usersRepository       = usersRepository;
     _configurationService  = configurationService;
 }
示例#5
0
        public ProgressMonitor(IProgressLogger progressLogger)
        {
            _cancellationTokenSource = new CancellationTokenSource();
            var token = _cancellationTokenSource.Token;

            _progressLogger = progressLogger;

            if (_progressLogger != null)
            {
                _backgroundTask = Task.Run(() => LogProgress(token), token);
            }
        }
示例#6
0
		public PostsService(IRepository<Post, int> postsRepository,
			IPostViewRepository postsViewRepository,
			IRepository<User, int> usersRepository,
			IProgressLogger progressLogger,
			IMapper mapper)
		{
			_postsRepository = postsRepository;
			_postsViewRepository = postsViewRepository;
			_usersRepository = usersRepository;
			_progressLogger = progressLogger;
			_mapper = mapper;
		}
示例#7
0
 public AuthService(AuthSettings authSettings,
                    IPasswordHashService passwordHashService,
                    IProgressLogger progressLogger,
                    IRepository <User, int> userRepository,
                    IRepository <Role, int> rolesRepository,
                    IRepository <UserToRole, int> userToRolesRepository)
 {
     _authSettings          = authSettings;
     _passwordHashService   = passwordHashService;
     _progressLogger        = progressLogger;
     _userRepository        = userRepository;
     _rolesRepository       = rolesRepository;
     _userToRolesRepository = userToRolesRepository;
 }
示例#8
0
 public DocumentsService(IRepository <Document, int> documentsRepository,
                         IProgressLogger progressLogger,
                         IMapper mapper,
                         IRepository <User, int> usersRepository,
                         IViewRepository <DocumentView, int> documentViewsRepository,
                         ConfigurationService configurationService)
 {
     _documentsRepository = documentsRepository;
     _progressLogger      = progressLogger;
     _mapper                  = mapper;
     _usersRepository         = usersRepository;
     _documentViewsRepository = documentViewsRepository;
     _configurationService    = configurationService;
 }
示例#9
0
 public UsersService(IRepository <User, int> userRepository,
                     IRepository <Role, int> rolesRepository,
                     IRepository <UserToRole, int> userToRolesRepository,
                     IMapper mapper,
                     IPasswordHashService passwordHashService,
                     IProgressLogger progressLogger)
 {
     _userRepository        = userRepository;
     _rolesRepository       = rolesRepository;
     _userToRolesRepository = userToRolesRepository;
     _mapper = mapper;
     _passwordHashService = passwordHashService;
     _progressLogger      = progressLogger;
 }
示例#10
0
 public QuestionsService(IMapper mapper,
                         IProgressLogger progressLogger,
                         IRepository <Question, int> questionsRepository,
                         IViewRepository <QuestionView, int> questionsViewRepository,
                         IRepository <Choise, int> choisesRepository,
                         IRepository <UserToChoise, int> userToChoisesRepository,
                         IRepository <User, int> usersRepository)
 {
     _mapper                  = mapper;
     _progressLogger          = progressLogger;
     _questionsRepository     = questionsRepository;
     _questionsViewRepository = questionsViewRepository;
     _choisesRepository       = choisesRepository;
     _userToChoisesRepository = userToChoisesRepository;
     _usersRepository         = usersRepository;
 }
示例#11
0
 public AdvertisementsService(IMapper mapper,
                              IProgressLogger progressLogger,
                              IRepository <Advertisement, int> advertisementsRepository,
                              IRepository <AdvertisementFile, int> advertisementFilesRepository,
                              IViewRepository <AdvertisementView, int> advertisementViewsRepository,
                              IRepository <User, int> usersRepository,
                              ConfigurationService configurationService)
 {
     _mapper                       = mapper;
     _progressLogger               = progressLogger;
     _advertisementsRepository     = advertisementsRepository;
     _advertisementFilesRepository = advertisementFilesRepository;
     _advertisementViewsRepository = advertisementViewsRepository;
     _usersRepository              = usersRepository;
     _configurationService         = configurationService;
 }
        public async Task PerformOperations(
            IReadOnlyList <ICreateJob <string, GoogleContactVersion, GoogleContactWrapper> > createJobs,
            IReadOnlyList <IUpdateJob <string, GoogleContactVersion, GoogleContactWrapper> > updateJobs,
            IReadOnlyList <IDeleteJob <string, GoogleContactVersion> > deleteJobs,
            IProgressLogger progressLogger,
            IGoogleContactContext context)
        {
            var createRequestsAndJobs = await CreateCreateRequests(createJobs);

            var updateRequestsAndJobs = await CreateUpdateRequests(updateJobs);

            await Task.Run(() =>
            {
                AssignGroupsToContacts(createRequestsAndJobs.Item1, context.GroupCache);
                AssignGroupsToContacts(updateRequestsAndJobs.Item1.Values, context.GroupCache);

                try
                {
                    RunCreateBatch(createRequestsAndJobs);
                }
                catch (Exception x)
                {
                    s_logger.Error(null, x);
                }

                try
                {
                    RunUpdateBatch(updateRequestsAndJobs);
                }
                catch (Exception x)
                {
                    s_logger.Error(null, x);
                }

                try
                {
                    RunDeleteBatch(deleteJobs);
                }
                catch (Exception x)
                {
                    s_logger.Error(null, x);
                }
            });
        }
示例#13
0
 public TxtImporter(IDataRepository dataRepository, IProgressLogger progressLogger)
 {
     this._dataRepository = dataRepository;
     this._progressLogger = progressLogger;
 }
 public SQLiteDataRepository(string connectionString, IProgressLogger progressLogger)
     : base(connectionString, progressLogger)
 {
     SQLiteConnectionStringBuilder cnBuilder = new SQLiteConnectionStringBuilder(connectionString);
     this._fileName = cnBuilder.DataSource;
 }
示例#15
0
 /// <summary>
 /// Конструктор класса
 /// </summary>
 /// <param name="baseAddress">Базовый адрес</param>
 /// <param name="folder">Имя папки, с которой будем работать</param>
 /// <param name="progressLogger">Логгер (опционально)</param>
 public FileManager(string baseAddress, string folder, IProgressLogger progressLogger = null)
 {
     _baseAddress    = baseAddress;
     _folder         = folder;
     _progressLogger = progressLogger;
 }
示例#16
0
 public GovernmentService(IMapper mapper, IProgressLogger progressLogger, IRepository <User, int> usersRepository)
 {
     _mapper          = mapper;
     _progressLogger  = progressLogger;
     _usersRepository = usersRepository;
 }
 public async Task PerformOperations(IReadOnlyList <ICreateJob <TEntityId, TEntityVersion, TEntity> > createJobs, IReadOnlyList <IUpdateJob <TEntityId, TEntityVersion, TEntity> > updateJobs, IReadOnlyList <IDeleteJob <TEntityId, TEntityVersion> > deleteJobs, IProgressLogger progressLogger, TContext context)
 {
     await Task.Run(() => _batchWriteOnlyEntityRepositoryImplementation.PerformOperations(createJobs, updateJobs, deleteJobs, progressLogger, context));
 }
示例#18
0
 public TxtImporter(IDataRepository dataRepository, IProgressLogger progressLogger)
 {
     this._dataRepository = dataRepository;
     this._progressLogger = progressLogger;
 }
示例#19
0
 public DataRepositoryBase(string connectionString, IProgressLogger progressLogger)
 {
     this.ConnectionString = connectionString;
     this._progressLogger  = progressLogger;
 }
        public async Task PerformOperations(
            IReadOnlyList <ICreateJob <TEntityId, TEntityVersion, TEntity> > createJobs,
            IReadOnlyList <IUpdateJob <TEntityId, TEntityVersion, TEntity> > updateJobs,
            IReadOnlyList <IDeleteJob <TEntityId, TEntityVersion> > deleteJobs,
            IProgressLogger progressLogger,
            TContext context)
        {
            foreach (var job in createJobs)
            {
                try
                {
                    var result = await _inner.Create(job.InitializeEntity, context);

                    job.NotifyOperationSuceeded(result);
                }
                catch (Exception x)
                {
                    if (_exceptionHandlingStrategy.DoesGracefullyAbortSynchronization(x))
                    {
                        throw;
                    }
                    else
                    {
                        job.NotifyOperationFailed(x);
                    }
                }
                progressLogger.Increase();
            }

            foreach (var job in updateJobs)
            {
                try
                {
                    var result = await _inner.TryUpdate(job.EntityId, job.Version, job.EntityToUpdate, job.UpdateEntity, context);

                    if (result != null)
                    {
                        job.NotifyOperationSuceeded(result);
                    }
                    else
                    {
                        job.NotifyEntityNotFound();
                    }
                }
                catch (Exception x)
                {
                    if (_exceptionHandlingStrategy.DoesGracefullyAbortSynchronization(x))
                    {
                        throw;
                    }
                    else
                    {
                        job.NotifyOperationFailed(x);
                    }
                }
                progressLogger.Increase();
            }

            foreach (var job in deleteJobs)
            {
                try
                {
                    if (await _inner.TryDelete(job.EntityId, job.Version, context))
                    {
                        job.NotifyOperationSuceeded();
                    }
                    else
                    {
                        job.NotifyEntityNotFound();
                    }
                }
                catch (Exception x)
                {
                    if (_exceptionHandlingStrategy.DoesGracefullyAbortSynchronization(x))
                    {
                        throw;
                    }
                    else
                    {
                        job.NotifyOperationFailed(x);
                    }
                }
                progressLogger.Increase();
            }
        }
示例#21
0
 public ValuePairsService(IRepository <ValuePair, int> valuePairsRepository,
                          IProgressLogger progressLogger)
 {
     _valuePairsRepository = valuePairsRepository;
     _progressLogger       = progressLogger;
 }