Пример #1
0
    public static void AddSheetAtParticularIndex(string sheetName, int index, IUoW uow, int clientId, string sheetId, int apiKeySecretId = 20, int accountTypeId = 27)
    {
        try
        {
            var service = GetGoogleSpreadSheetService(uow, clientId, sheetId, apiKeySecretId, accountTypeId);
            // Add new Sheet
            var addSheetRequest = new AddSheetRequest();
            addSheetRequest.Properties       = new SheetProperties();
            addSheetRequest.Properties.Title = sheetName;
            addSheetRequest.Properties.Index = index;

            BatchUpdateSpreadsheetRequest batchUpdateSpreadsheetRequest = new BatchUpdateSpreadsheetRequest();
            batchUpdateSpreadsheetRequest.Requests = new List <Request>();
            batchUpdateSpreadsheetRequest.Requests.Add(new Request
            {
                AddSheet = addSheetRequest
            });

            var batchUpdateRequest = service.Spreadsheets.BatchUpdate(batchUpdateSpreadsheetRequest, sheetId);
            var response           = batchUpdateRequest.Execute();
        }
        catch (Exception ex)
        {
            throw;
        }
    }
Пример #2
0
    public SheetsService GetGoogleSpreadSheetService(IUoW uow, int clientId, string sheetId, int apiKeySecretId, int accountTypeId)
    {
        try
        {
            var clientAccount = uow.ClientAccountRepository
                                .Find(f => f.ClientId == clientId && f.AccountTypeId == accountTypeId && f.IsActive == true)
                                .FirstOrDefault();

            if (clientAccount != null)
            {
                var clientAPISecret = uow.ApiKeySecretRepository.Find(x => x.Id == apiKeySecretId).FirstOrDefault();
                if (clientAPISecret != null)
                {
                    var model = new GoogleUserCredential()
                    {
                        AccessToken     = clientAccount.AccessToken,
                        RefreshToken    = clientAccount.RefreshToken,
                        ClientId        = clientAPISecret.ClientId,
                        ClientSecret    = clientAPISecret.ClientSecret,
                        ApplicationName = "Flightdeck.Digital Service"
                    };
                    var serviceInitializer = Credential.GetGoogleServiceInitializer(model);
                    var service            = new SheetsService(serviceInitializer);
                    return(service);
                }
            }
        }
        catch (Exception ex)
        {
            GSheetReportingUtility.WriteLog($"GoogleSheet Service Error. Error Message is  {ex.Message}", GSheetReportingLogType.GSheetReportingService);
            //WriteLogException(ex, FDGoogleMyBusinessLogType.FDGoogleDataStudioService);
        }
        return(null);
    }
Пример #3
0
 public BaseAppService(IMediator mediator, IMapper mapper,
                       IUoW uow)
 {
     this.mediator = mediator;
     this.mapper   = mapper;
     UnitOfWork    = uow;
 }
Пример #4
0
 public BuyCattleHandler(IBusHandler bus,
                         IHandleMessages <DomainNotification> notifications,
                         IUoW uow,
                         IBuyCattleRepository buyCattleRepository) :
     base(bus, notifications, uow)
 {
     _buyCattleRepository = buyCattleRepository;
 }
Пример #5
0
 public UnicornController(
     IRepository <int, Unicorn> repository,
     IUoW uow)
 {
     //_logger = logger;
     _repository = repository;
     _uow        = uow;
 }
Пример #6
0
 public PhotoService(
     IUoW uow,
     IOptions <ImageOptionsModel> opt
     )
 {
     _unitOfWork   = uow;
     _widthOptions = opt;
 }
Пример #7
0
 public BankAccountHandler(IBusHandler bus,
                           IHandleMessages <DomainNotification> notifications,
                           IUoW uow,
                           IBankAccountRepository bankAccountRepository) :
     base(bus, notifications, uow)
 {
     _bankAccountRepository = bankAccountRepository;
 }
Пример #8
0
 public AccountController(
     IOptions <TokenOptions> jwtOptions,
     IUoW uow, ICustomerRepository repository) : base(uow)
 {
     _repository   = repository;
     _tokenOptions = jwtOptions.Value;
     ThrowIfInvalidOptions(_tokenOptions);
 }
Пример #9
0
 protected CommandHandler(IBusHandler bus,
                          IHandleMessages <DomainNotification> notifications,
                          IUoW uow)
 {
     _notifications = (DomainNotificationHandler)notifications;
     _bus           = bus;
     _uow           = uow;
 }
Пример #10
0
 public DailyExtractLotHandler(IBusHandler bus,
                               IHandleMessages <DomainNotification> notifications,
                               IUoW uow,
                               IDailyExtractLotCreateDomainService dailyExtractLotCreateDomainService,
                               IDailyExtractLotRepository dailyExtractLotRepository) :
     base(bus, notifications, uow)
 {
     _dailyExtractLotCreateDomainService = dailyExtractLotCreateDomainService;
     _dailyExtractLotRepository          = dailyExtractLotRepository;
 }
Пример #11
0
 public MapService(
     IUoW unitOfWork,
     IPhotoService photoService,
     IMapper mapper
     )
 {
     _unitOfWork   = unitOfWork;
     _photoService = photoService;
     _mapper       = mapper;
 }
Пример #12
0
 public DataBaseService(IEfGenericRepository <Movies> movies, IEfGenericRepository <Genres> genresRepo,
                        IEfGenericRepository <Comments> commentsRepo, IEfGenericRepository <Users> userRepo,
                        IEfGenericRepository <Likes> likesRepo, IEfGenericRepository <Dislikes> dislikesRepo, IUoW saver)
 {
     this.moviesRepo   = movies;
     this.genresRepo   = genresRepo;
     this.commentsRepo = commentsRepo;
     this.userRepo     = userRepo;
     this.likesRepo    = likesRepo;
     this.dislikesRepo = dislikesRepo;
     this.saver        = saver;
 }
Пример #13
0
        private void ConfigureDependencies()
        {
            var factory      = new NHibernateFactory();
            var factoryProxy = new NHibernateFactoryProxy();

            factoryProxy.Initialize(factory.GetConfiguration, factory.GetSessionFactory);

            var nHibernateSession = new NHibernateSession(factoryProxy);

            _uow     = new UoW(nHibernateSession);
            _service = new OrderService(_uow);
        }
Пример #14
0
        public AccountController(IOptions <TokenOptions> jwtOptions, IUoW uow, ICustumerRepository repository)
            : base(uow)
        {
            _repository   = repository;
            _tokenOptions = jwtOptions.Value;
            ThrowIfInvalidOptions(_tokenOptions);

            _serializerSettings = new JsonSerializerSettings
            {
                Formatting       = Formatting.Indented,
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
        }
Пример #15
0
 public UserService(
     IUoW uow,
     IMapper mapper,
     IMediator mediator,
     ICacheHelper cacheHelper,
     IPhotoService photoService)
 {
     _unitOfWork   = uow;
     _mapper       = mapper;
     _mediator     = mediator;
     _cacheHelper  = cacheHelper;
     _photoService = photoService;
 }
Пример #16
0
 public AuthService(
     IMapper mapper,
     IUserService userService,
     IJwtSigningEncodingKey signingEncodingKey,
     IConfiguration configuration,
     IUoW unitOfWork
     )
 {
     _mapper             = mapper;
     _userService        = userService;
     _signingEncodingKey = signingEncodingKey;
     _configuration      = configuration;
     _unitOfWork         = unitOfWork;
 }
    public DatabaseFixture()
    {
        var x      = Directory.GetCurrentDirectory();
        var config = new ConfigurationBuilder()
                     .AddJsonFile("appsettings.Tests.json", optional: true)
                     .Build();

        _options = new DbContextOptionsBuilder <ApplicationDbContext>()
                   .UseInMemoryDatabase(databaseName: "ProviderTests")
                   .Options;
        _context = new ApplicationDbContext(_options);
        _context.Database.EnsureCreated();
        Initialize();
        _uow = new UoW(_context);
    }
Пример #18
0
        public void TestInit()
        {
            kernel       = DependencyInjectionConfig.CreateKernel();
            context      = kernel.Get <IMoviesContext>();
            movies       = new EfGenericRepository <Movies>(context);
            genresRepo   = new EfGenericRepository <Genres>(context);
            commentsRepo = new EfGenericRepository <Comments>(context);
            userRepo     = new EfGenericRepository <Users>(context);
            likesRepo    = new EfGenericRepository <Likes>(context);
            dislikesRepo = new EfGenericRepository <Dislikes>(context);
            saver        = new UoW(context);

            context.Genres.Add(genre);
            context.SaveChanges();
        }
Пример #19
0
 public SeedController(
     IExameRepository exameRepository,
     IMedicoRepository medicoRepository,
     IOrdemServicoRepository ordemServicoRepository,
     IPacienteRepository pacienteRepository,
     IPostoColetaRepository postoColetaRepository,
     IUoW uow)
 {
     _exameRepository        = exameRepository;
     _medicoRepository       = medicoRepository;
     _ordemServicoRepository = ordemServicoRepository;
     _pacienteRepository     = pacienteRepository;
     _postoColetaRepository  = postoColetaRepository;
     _uow = uow;
 }
Пример #20
0
        public void SetUp()
        {
            var config = ContainerConfig.Configure();

            using (var scope = config.BeginLifetimeScope())
            {
                _testSettings = scope.Resolve <ApplicationConfiguration>().GetApplicationConfiguration <TestSettings>();
                _log          = scope.Resolve <ILog>();
                _browser      = scope.Resolve <IBrowserFactory>(new TypedParameter(typeof(ILog), _log));
                _browser.Start(_testSettings.Browser);
                _pages = scope.Resolve <IUoW>(new NamedParameter("_driver", _browser.GetDriver()),
                                              new NamedParameter("_testSettings", _testSettings),
                                              new NamedParameter("_log", _log));
            }
        }
Пример #21
0
    public static GoogleDataStudioResponse GetGoogleSpreadSheetDetail(IUoW uow, int clientId, string sheetId, int apiKeySecretId = 20, int accountTypeId = 27)
    {
        var response = new GoogleDataStudioResponse();

        try
        {
            var service     = GetGoogleSpreadSheetService(uow, clientId, sheetId, apiKeySecretId, accountTypeId);
            var spreadsheet = service.Spreadsheets.Get(sheetId).Execute();

            response.Spreadsheet   = spreadsheet;
            response.SheetFileName = spreadsheet.Properties.Title;
            response.SheetId       = spreadsheet.SpreadsheetId;
            response.HasError      = false;
        }
        catch (Exception ex)
        {
            response.HasError = true;
            WriteLogException(ex, FDGoogleMyBusinessLogType.FDGoogleDataStudioService);
        }
        return(response);
    }
Пример #22
0
 public HashesController(IUoW unit)
 {
     _unit = unit;
 }
 public UrlService(IUoW uow, IUrlhandler handler)
 {
     _uow     = uow;
     _handler = handler;
 }
Пример #24
0
 public ExceptionService()
 {
     db = new UoW();
 }
Пример #25
0
 public ExceptionService(IUoW <ApplicationContext> db)
 {
     this.db = db ?? new UoW();
 }
Пример #26
0
 public MoneyController(IBudgetRepository budgetRepository, IUoW uow, IClock clock)
 {
     _budgetRepository = budgetRepository;
     _uow   = uow;
     _clock = clock;
 }
 public UserServices(IUoW uow, IUserRepo userRepo)
 {
     _uow      = uow;
     _userRepo = userRepo;
 }
Пример #28
0
 public CourseController(IUoW uow)
     : base(uow)
 {
 }
Пример #29
0
 public AdminController(IRepository <int, Unicorn> repository, IOwnerRepository ownerRepository, IUoW uow)
 {
     _repository      = repository;
     _ownerRepository = ownerRepository;
     _uow             = uow;
 }
Пример #30
0
 protected PersistentRepository(IUoW uow)
 {
     this._uow = uow;
 }
Пример #31
0
 public InstructorController(IUoW uow)
     : base(uow)
 {
 }
Пример #32
0
 public CollectionViewModel()
 {
     _uoW  = Bootstrapper.Container.Resolve <IUoW>();
     Items = new ObservableCollection <T>();
 }