Exemplo n.º 1
0
        //TODO: add it for a Lottery name, if it doesn't exists, create and initialize it (write the header)
        public void addEntryForWinningNumber(int day, int month, int year, string winningNumber)
        {
            ExcelSheet sheet   = this.file.getSheet(1);
            int        lastRow = sheet.getLastUsedRowNumber();
            int        newRow  = lastRow + 1;

            sheet.setCellText(newRow, 1, day.ToString());
            sheet.setCellText(newRow, 2, this.getMonthAsString(month) + "-" + year.ToString());
            sheet.setCellText(newRow, 3, winningNumber);

            while (this.isRowAnEmptyEntry(sheet, lastRow) && lastRow > 1)
            {
                lastRow--;
            }

            for (int i = 4; i <= 13; i++)
            {
                if (this.columnsToNumbersMap[i].Equals(winningNumber))
                {
                    sheet.setCellText(newRow, i, "SALIO");
                    sheet.setCellColor(newRow, i, 0, 255, 255);
                    this.drawnNumbers[i - 4] = true;
                }
                else
                {
                    if (this.numberHasBeenDrawn(i - 4))
                    {
                        this.addNonWinningEntry(lastRow, i, newRow, sheet);
                    }
                    else
                    {
                        sheet.setCellColor(newRow, i, 0, 0, 0);
                    }
                }
            }
            this.file.save();
        }
Exemplo n.º 2
0
 private bool isRowAnEmptyEntry(ExcelSheet sheet, int row)
 {
     return((sheet.getCellText(row, 3).Equals("")) || (sheet.getCellText(row, 3).Equals("DOMINGO")));
 }
Exemplo n.º 3
0
 private void colorizeCellAccordingToDaysPassed(int row, int column, int numberOfDays, ExcelSheet sheet)
 {
     if (this.numberIsInBetween(numberOfDays, 1, 7))
     {
         sheet.setCellColor(row, column, 153, 255, 102);
     }
     else if (this.numberIsInBetween(numberOfDays, 8, 14))
     {
         sheet.setCellColor(row, column, 255, 255, 102);
     }
     else if (this.numberIsInBetween(numberOfDays, 15, 28))
     {
         sheet.setCellColor(row, column, 83, 142, 213);
     }
     else if (28 <= numberOfDays)
     {
         sheet.setCellColor(row, column, 255, 0, 0);
     }
 }