Exemplo n.º 1
0
        private void AddAlternatingRows()
        {
            var firstColor = new Color()
            {
                Alpha = 1,
                Red   = 1,
                Green = 1,
                Blue  = 1,
            };
            var secondColor = new Color()
            {
                Alpha = 1,
                Red   = (float)0xe8 / 256,
                Green = (float)0xe7 / 256,
                Blue  = (float)0xfc / 256,
            };

            foreach (var category in _budget.Categories)
            {
                var            subcategoriesInCategory = _budget.Subcategories.Where(x => x.CategoryId == category.Id);
                SubcategoryDto firstSubcategory        = subcategoriesInCategory.FirstOrDefault();
                SubcategoryDto lastsSubcategory        = subcategoriesInCategory.LastOrDefault();
                int            firstRow = _subcategoryRows.FirstOrDefault(x => x.Id == firstSubcategory.Id)?.RowIndex ?? 0;
                int            lastRow  = _subcategoryRows.FirstOrDefault(x => x.Id == lastsSubcategory.Id)?.RowIndex + 1 ?? 1;

                _googleSheetService.AddBandedRange(0, 4, firstRow, lastRow, firstColor, secondColor);
            }
        }