static void DefaultOnExcelDataSourceBeforeFill(object sender, ExcelDataSourceBeforeFillWebEventArgs args)
 {
     using (var googleSheets = new GoogleSheetsService(ClientInfo, AccessToken)) {
         Stream fileStream = googleSheets.GetFileStream(args.DataSourceConnectionName);
         args.Stream = fileStream;
         args.StreamDocumentFormat = ExcelDocumentFormat.Xlsx;
     }
 }
        public void AddExpense()
        {
            Expense             = new Expense();
            Expense.Date        = DateTime.Now;
            Expense.Amount      = this.Amount;
            Expense.Description = this.Description;
            Expense.Category    = SelectedCategory;

            var stop = 0;

            GoogleSheetsService.UpdateRequest(Expense, SelectedSheet);
        }
Exemple #3
0
        public Program()
        {
            _googleSheetsService = new GoogleSheetsService();
            _coinspotService     = new CoinspotService();

            PrepareUpdateTimer();
            AddActions();
            ShowHelp(null);

            WriteLine();
            ShowBalances(null);
            Colored(() => ShowStatus(null), ConsoleColor.Yellow);
        }
 public DistributionBotSheetsService(ITelegramBotClient client,
                                     ILogger <GoogleSheetsService> logger,
                                     GoogleSheetsService googleSheetsService,
                                     CultureService cultureService,
                                     Context context,
                                     IHostEnvironment env)
 {
     _client = client;
     _logger = logger;
     _googleSheetsService = googleSheetsService;
     _cultureService      = cultureService;
     _context             = context;
     _env = env;
 }
 public WorkerService(GoogleSheetsService sheetsService,
                      CultureService cultureService,
                      Context context,
                      IOptions <DataOptions> options,
                      ITelegramBotClient client,
                      IMailClient mailClient)
 {
     _sheetsService  = sheetsService;
     _cultureService = cultureService;
     _context        = context;
     _client         = client;
     _mailClient     = mailClient;
     _data           = options.Value.Data;
 }
 public GuestsBotScheduler(ITelegramBotClient client,
                           Context context,
                           ILogger <GoogleSheetsService> logger,
                           GoogleSheetsService googleSheetsService,
                           CultureService cultureService,
                           IHostEnvironment env)
 {
     _env                 = env;
     _client              = client;
     _context             = context;
     _logger              = logger;
     _googleSheetsService = googleSheetsService;
     _cultureService      = cultureService;
 }
        public ActionResult ChooseFile()
        {
            if (DashboardConfig.AccessToken == null || GoogleOAuth.ValidateToken(DashboardConfig.AccessToken).Error != null)
            {
                return(RedirectToAction("Index"));
            }

            const string excelMimeType = "application/vnd.google-apps.spreadsheet";

            using (var googleSheets = new GoogleSheetsService(DashboardConfig.ClientInfo, DashboardConfig.AccessToken)) {
                ViewBag.Files = googleSheets.ListFiles().Files.Where(f => f.MimeType == excelMimeType).ToArray();
            }

            return(View("ChooseFile"));
        }
        private static async void AddGooogle(this IMutableDependencyResolver services, IReadonlyDependencyResolver resolver)
        {
            var config = Design.IsDesignMode ? new AppConfig {
                GoogleEnabled = true
            } : resolver.GetRequiredService <AppConfig>();

            if (config.GoogleEnabled)
            {
                var service = new GoogleSheetsService();

                if (!Design.IsDesignMode)
                {
                    await service.Init();
                }
                services.Register <ISheetsService>(() => service);
            }
        }
        public ActionResult ChooseSheet(string id)
        {
            if (DashboardConfig.AccessToken == null || GoogleOAuth.ValidateToken(DashboardConfig.AccessToken).Error != null)
            {
                return(RedirectToAction("Index"));
            }

            using (var googleSheets = new GoogleSheetsService(DashboardConfig.ClientInfo, DashboardConfig.AccessToken)) {
                Stream fileStream = googleSheets.GetFileStream(id);
                using (ISpreadsheetSource spreadsheetSource = ExcelDataLoaderHelper.CreateSource(fileStream, ExcelDocumentFormat.Xlsx, null, new ExcelSourceOptions())) {
                    ViewBag.Sheets = spreadsheetSource.Worksheets.Select(f => f.Name).ToArray();
                    ViewBag.Tables = spreadsheetSource.Tables.Select(t => t.Name).ToArray();
                    ViewBag.Ranges = spreadsheetSource.DefinedNames.Where(dn => !dn.IsHidden).ToArray();
                    ViewBag.FileID = id;
                }
            }

            return(View("ChooseSheet"));
        }
Exemple #10
0
 public GuideImportService()
 {
     _googleSheetsService      = new GoogleSheetsService();
     _spawnsAndItemSheetParser = new SpawnsAndItemSheetParser();
 }
Exemple #11
0
        public IEnumerable <Nes> GetNesGames()
        {
            var service = new GoogleSheetsService();

            return(service.ReadEntries("NES", "A2:K"));
        }