//Method for getting the right Sql command according to the user selected budget item(general expense, debt saving)
        private MySqlCommand getCorrectSqlCommand(BudgetItemType itemType, String startDate, String endDate)
        {
            MySqlCommand getTotalItemValueCommand = null;
            QueryData    paramContainer           = new QueryData.Builder(userID).addStartDate(startDate).addEndDate(endDate).build();

            switch (itemType)
            {
            //CHANGE(FROM EXPENSE TO GENERAL EXPENSE)!!!
            case BudgetItemType.GENERAL_EXPENSE:
                getTotalItemValueCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalExpenses, paramContainer);
                break;

            case BudgetItemType.DEBT:
                getTotalItemValueCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalDebts, paramContainer);
                break;

            case BudgetItemType.SAVING:
                getTotalItemValueCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalSavings, paramContainer);
                break;

            default:
                break;
            }

            return(getTotalItemValueCommand);
        }
        private String sqlStatementGetDebtorID      = @"SELECT debtorID FROM debtors WHERE debtorName = @paramTypeName";//Modify the getID method of DataInsertionUtils class to use a more generic record ID retrieval method from the SQLCommandBuilder class

        public int execute(QueryData paramContainer)
        {
            Guard.notNull(paramContainer, "parameter container");
            int executionResult = -1;

            //Retrieving the ID of the selected debtor
            int debtorID = DataInsertionUtils.getID(sqlStatementGetDebtorID, paramContainer.DebtorName);

            //Creating a new param container object that contains all the values from the param container received as argument plus the debtor ID(which will be necessary for inserting the new receivable record)
            QueryData updatedParamContainer = new QueryData.Builder(paramContainer.UserID)
                                              .addItemName(paramContainer.ItemName)
                                              .addItemValue(paramContainer.ItemValue)
                                              .addDebtorName(paramContainer.DebtorName)
                                              .addDebtorID(debtorID)
                                              .addStartDate(paramContainer.StartDate)
                                              .addEndDate(paramContainer.EndDate)
                                              .addIncomeSource(paramContainer.IncomeSource)
                                              .addPaidAmount(paramContainer.PaidAmount)
                                              .build();

            MySqlCommand insertReceivableCommand = SQLCommandBuilder.getReceivableInsertionCommand(sqlStatementInsertReceivable, updatedParamContainer);


            executionResult = DBConnectionManager.insertData(insertReceivableCommand);


            return(executionResult);
        }
        public int[] getTotalValuesForAllBudgetItems(String startDate, String endDate)
        {
            //Arguments checks
            if (startDate == null || endDate == null)
            {
                return(null);
            }

            if ("".Equals(startDate) || "".Equals(endDate))
            {
                return(null);
            }
            //Data container object and MySqlCommand creation
            QueryData    paramContainer = new QueryData.Builder(userID).addStartDate(startDate).addEndDate(endDate).build();
            MySqlCommand getTotalValuesForAllItemsCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalValuesForAllItems, paramContainer);

            DataTable itemsTotalValuesDataTable = DBConnectionManager.getData(getTotalValuesForAllItemsCommand);

            //Null and row count check on the resulted DataTable object
            if (itemsTotalValuesDataTable == null || itemsTotalValuesDataTable.Rows.Count <= 0)
            {
                return(null);
            }

            //DataTable values conversion to int
            int expensesTotalValue = itemsTotalValuesDataTable.Rows[0].ItemArray[0] != DBNull.Value ? Convert.ToInt32(itemsTotalValuesDataTable.Rows[0].ItemArray[0]) : 0;
            int debtsTotalValue    = itemsTotalValuesDataTable.Rows[0].ItemArray[1] != DBNull.Value ? Convert.ToInt32(itemsTotalValuesDataTable.Rows[0].ItemArray[1]) : 0;
            int savingsTotalValue  = itemsTotalValuesDataTable.Rows[0].ItemArray[2] != DBNull.Value ? Convert.ToInt32(itemsTotalValuesDataTable.Rows[0].ItemArray[2]) : 0;

            //Creating the array containing the total values for each budget item
            int[] budgetItemsTotals = new int[] { expensesTotalValue, debtsTotalValue, savingsTotalValue };

            return(budgetItemsTotals);
        }
        //Method for gathering the required data for budget plan creation(it returns an object of type QueryData which contains the data)
        private QueryData getDataForBudgetPlanCreation(int userID)
        {
            //The budget plan type name as it is defined in the plan_types table of the database
            String budgetPlanTypeName = oneMonthCheckBox.Checked == true ? "One month" : "Six months";
            //The actual name of the budget plan as it was specified by the user
            String budgetPlanName = planNameTextBox.Text;
            int    expenseLimit   = Convert.ToInt32(expensesNumericUpDown.Value);
            int    debtLimit      = Convert.ToInt32(debtsNumericUpDown.Value);
            int    savingLimit    = Convert.ToInt32(savingsNumericUpDown.Value);
            //The ID for the selected plan type
            int planTypeID = getBudgetTypeID(budgetPlanTypeName);
            //Indicates if the alarm is activated(0-false; 1-true)
            int alarmSelectionValue = getAlarmSelectionValue();
            //The limit at which the budget alarm will be triggered
            int thresholdPercentage = alarmCheckBox.Checked == true?Convert.ToInt32(thresholdNumericUpDown.Value) : 0;

            String startDate = getDate(getPlanType(), DateType.START_DATE);
            String endDate   = getDate(getPlanType(), DateType.END_DATE);

            QueryData paramContainer = new QueryData.Builder(userID)
                                       .addBudgetPlanName(budgetPlanName)
                                       .addExpenseLimit(expenseLimit)
                                       .addDebtLimit(debtLimit)
                                       .addSavingLimit(savingLimit)
                                       .addPlanTypeID(planTypeID)
                                       .addAlarmExistenceValue(alarmSelectionValue)
                                       .addThresholdPercentage(thresholdPercentage)
                                       .addStartDate(startDate)
                                       .addEndDate(endDate)
                                       .build(); //CHANGE


            return(paramContainer);
        }
Example #5
0
        //Method for inserting a new record in the saving account balance record table
        public int createBalanceRecord(int recordValue)
        {
            String    recordName     = createRecordName(date);
            QueryData paramContainer = new QueryData.Builder(userID).addItemName(recordName).addItemValue(recordValue).addMonth(balanceRecordMonth).addYear(balanceRecordYear).build();

            MySqlCommand createBalanceRecordCommand = SQLCommandBuilder.getBalanceRecordInsertUpdateCommand(sqlStatementCreateBalanceRecord, paramContainer);

            int executionResult = DBConnectionManager.insertData(createBalanceRecordCommand);

            return(executionResult);
        }
        private bool hasPlanForCurrenMonthSelection(int userID, int month)
        {
            int year = DateTime.Now.Year;
            int day  = 1;
            //Creates a DateTime object representing the first day of the selected month from the current year
            DateTime startDate = new DateTime(year, month, day);


            if (oneMonthCheckBox.Checked == true)
            {
                //Creates a data container which will be passed to the MySqlCommand builder method(the date is transformed into a string having the format required by the MySql database)
                QueryData paramContainer = new QueryData.Builder(userID).addStartDate(startDate.ToString("yyyy-MM-dd")).build(); //CHANGE

                MySqlCommand budgetPlanStartDateCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainer);

                //Executes a MySqlCommand for checking the existence of a budget plan for the selected interval
                DataTable budgetPlanDataTable = DBConnectionManager.getData(budgetPlanStartDateCheckCommand);

                //The DataTable object is checked to see if it contains any results
                if (budgetPlanDataTable != null && budgetPlanDataTable.Rows.Count > 0)
                {
                    return(true);
                }
            }
            else if (sixMonthsCheckBox.Checked == true)
            {
                //Gets the last month of the interval
                int endMonth = month + 6;
                //Gets the last day of the month
                int      lastDayOfEndMonth = DateTime.DaysInMonth(year, endMonth);
                DateTime endDate           = new DateTime(year, endMonth, lastDayOfEndMonth);

                //SQL commands are created for the start month and end month of the interval
                QueryData    paramContainerStartDate         = new QueryData.Builder(userID).addStartDate(startDate.ToString("yyyy-MM-dd")).build(); //CHANGE
                MySqlCommand budgetPlanStartDateCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainerStartDate);

                QueryData    paramContainerEndDate         = new QueryData.Builder(userID).addEndDate(endDate.ToString("yyyy-MM-dd")).build();//CHANGE
                MySqlCommand budgetPlanEndDateCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainerEndDate);

                //The commands are executed against the DB
                DataTable budgetPlanDataTableStart = DBConnectionManager.getData(budgetPlanStartDateCheckCommand);
                DataTable budgetPlanDataTableEnd   = DBConnectionManager.getData(budgetPlanEndDateCheckCommand);

                //If the start month or the end month is present in the interval specified by an existing budget plan then it means that the two plans overlap and the new plan will not be created.
                if (budgetPlanDataTableStart != null && budgetPlanDataTableStart.Rows.Count > 0 || budgetPlanDataTableEnd != null && budgetPlanDataTableEnd.Rows.Count > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
        //Method that retrieves the budget plan data(if the plan exists) based on the specified currentDate(it is actually the date that the user selects for the new entry which is checked to see if it overlaps any existing budget plan timespan)
        public DataTable getBudgetPlanData()
        {
            QueryData    paramContainer = new QueryData.Builder(userID).addStartDate(currentDate).build();
            MySqlCommand budgetPlanExistenceCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainer);

            DataTable budgetPlanDataTable = DBConnectionManager.getData(budgetPlanExistenceCheckCommand);

            if (budgetPlanDataTable != null && budgetPlanDataTable.Rows.Count == 1)
            {
                return(budgetPlanDataTable);
            }

            return(null);
        }
Example #8
0
        //Method for retrieving the record value from the saving account balance table
        public int getRecordValue()
        {
            int recordValue = -1;

            QueryData    paramContainer         = new QueryData.Builder(userID).addMonth(balanceRecordMonth).addYear(balanceRecordYear).build();
            MySqlCommand recordRetrievalCommand = SQLCommandBuilder.getSingleMonthCommand(sqlStatementCheckRecordExistence, paramContainer);

            DataTable resultDataTable = DBConnectionManager.getData(recordRetrievalCommand);

            if (resultDataTable != null && resultDataTable.Rows.Count == 1)
            {
                Object valueObject = resultDataTable.Rows[0].ItemArray[3];

                recordValue = valueObject != DBNull.Value ? Convert.ToInt32(valueObject) : -1;
            }

            return(recordValue);
        }
        //Method for retrieving the total income value for the specified interval
        public int getTotalIncomes(String startDate, String endDate)
        {
            String sqlFormatStartDate = DateTime.Parse(startDate).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
            String sqlFormatEndDate   = DateTime.Parse(endDate).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);


            QueryData    paramContainer         = new QueryData.Builder(userID).addStartDate(sqlFormatStartDate).addEndDate(sqlFormatEndDate).build();
            MySqlCommand getTotalIncomesCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalIncomes, paramContainer);

            //The DataTable object that contains the total incomes value for the specified time interval
            DataTable totalIncomesDataTable = DBConnectionManager.getData(getTotalIncomesCommand);

            if (totalIncomesDataTable != null && totalIncomesDataTable.Rows.Count == 1)
            {
                int totalIncomes = totalIncomesDataTable.Rows[0].ItemArray[0] != DBNull.Value ? Convert.ToInt32(totalIncomesDataTable.Rows[0].ItemArray[0]) : 0;

                return(totalIncomes);
            }

            return(-1);
        }
Example #10
0
        //Checks if there is any existing record for the specified month and year for the current user
        public bool hasBalanceRecord()
        {
            if (balanceRecordMonth <= 0 || balanceRecordMonth > 12)
            {
                return(false);
            }

            if (balanceRecordYear <= 0)
            {
                return(false);
            }

            QueryData    paramContainer = new QueryData.Builder(userID).addMonth(balanceRecordMonth).addYear(balanceRecordYear).build();
            MySqlCommand recordExistenceCheckCommand = SQLCommandBuilder.getSingleMonthCommand(sqlStatementCheckRecordExistence, paramContainer);

            DataTable resultDataTable = DBConnectionManager.getData(recordExistenceCheckCommand);

            if (resultDataTable != null && resultDataTable.Rows.Count == 1)
            {
                return(true);
            }

            return(false);
        }
Example #11
0
        private int performDataChecks()
        {
            int allChecksExecutionResult       = -1;
            int generalCheckExecutionResult    = -1;
            int budgetPlanCheckExecutionResult = -1;
            int dataInsertionExecutionResult   = -1;

            int    selectedIndex    = itemTypeSelectionComboBox.SelectedIndex;
            String selectedItemName = itemTypeSelectionComboBox.Text;

            QueryData paramContainerGeneralCheck = null;
            QueryData paramContainerBPCheck      = null;
            DataInsertionCheckerContext   dataInsertionCheckContext = null;
            GeneralInsertionCheckStrategy generalCheckStrategy      = null;
            int valueToInsert = 0;

            //Check if it can be improved
            if (!selectedItemName.Equals("Debtor") && !selectedItemName.Equals("Creditor") && !selectedItemName.Equals("Income"))
            {
                //Checks if the user has enough money left to insert the selected item value
                valueToInsert = Convert.ToInt32(itemValueTextBox.Text);
                int          selectedMonth = datePicker.Value.Month;
                int          selectedYear  = datePicker.Value.Year;
                IncomeSource incomeSource  = getIncomeSource();
                //QueryData paramContainer = new QueryData(userID, selectedMonth, selectedYear);
                //Query data parameter object for general checks
                paramContainerGeneralCheck = new QueryData.Builder(userID).addMonth(selectedMonth).addYear(selectedYear).addIncomeSource(incomeSource).build(); //CHANGE
                                                                                                                                                                //Query data parameter object for budget plan checks
                paramContainerBPCheck = new QueryData.Builder(userID).addItemCreationDate(datePicker.Value.ToString("yyyy-MM-dd")).addBudgetItemType(getSelectedType(itemTypeSelectionComboBox)).build();

                dataInsertionCheckContext = new DataInsertionCheckerContext();
                generalCheckStrategy      = new GeneralInsertionCheckStrategy();
            }
            switch (selectedIndex)
            {
            //Income
            case 0:
                allChecksExecutionResult = 0;
                break;

            //Expense
            case 1:
            //Debt
            case 2:

            //Saving
            case 4:
                dataInsertionCheckContext.setStrategy(generalCheckStrategy);

                generalCheckExecutionResult = dataInsertionCheckContext.invoke(paramContainerGeneralCheck, selectedItemName, valueToInsert);

                BudgetPlanCheckStrategy budgetPlanCheckStrategy = new BudgetPlanCheckStrategy();
                dataInsertionCheckContext.setStrategy(budgetPlanCheckStrategy);

                budgetPlanCheckExecutionResult = dataInsertionCheckContext.invoke(paramContainerBPCheck, selectedItemName, valueToInsert);

                //If the general check fails(not enough money) then the general check execution result will rmain -1 (no data can be inserted)
                //Else, if the general check is passed and the budget plan check returns -1 (fail because there might not be a budget plan in place) the data can be inserted
                //Otherwise the allChecksExecutionResult keeps its initial value(-1) and no data will be inserted(for example if a warning message is shown during budget plan checks due to the inserted value being higher than the value allowed by the budget plan item limit)
                if (generalCheckExecutionResult == -1)
                {
                    break;
                }
                else if (generalCheckExecutionResult == 0 && budgetPlanCheckExecutionResult == -1)
                {
                    allChecksExecutionResult = 0;
                }

                break;

            //Receivables
            case 3:
                //Checks if the start and end dates for the receivable are in chronological order
                if (checkReceivableDates() == -1)
                {
                    break;
                }
                dataInsertionCheckContext.setStrategy(generalCheckStrategy);
                generalCheckExecutionResult = dataInsertionCheckContext.invoke(paramContainerGeneralCheck, selectedItemName, valueToInsert);

                if (generalCheckExecutionResult == -1)
                {
                    break;
                }
                else
                {
                    allChecksExecutionResult = 0;
                }

                break;

            //Creditor
            case 5:
                allChecksExecutionResult = 0;
                break;

            //Debtor
            case 6:
                allChecksExecutionResult = 0;
                break;

            default:
                break;
            }

            return(allChecksExecutionResult);
        }
Example #12
0
        //Method for configuring the param container object for the insertion of different budget items
        private QueryData configureParamContainer(BudgetItemType selectedItemType)
        {
            QueryData paramContainer = null;

            switch (selectedItemType)
            {
            //Income insertion object configuration
            case BudgetItemType.INCOME:
                String incomeName     = itemNameTextBox.Text;
                String incomeTypeName = incomeTypeComboBox.Text;
                int    incomeValue    = Convert.ToInt32(itemValueTextBox.Text);
                String incomeDate     = datePicker.Value.ToString("yyyy-MM-dd");

                paramContainer = new QueryData.Builder(userID)
                                 .addItemName(incomeName)
                                 .addItemValue(incomeValue)
                                 .addTypeName(incomeTypeName)
                                 .addItemCreationDate(incomeDate)
                                 .build();
                break;

            //Expense insertion object configuration
            //Intentional fall-through the cases because both types need the same data
            case BudgetItemType.SAVING_ACCOUNT_EXPENSE:
            case BudgetItemType.GENERAL_EXPENSE:
                String expenseName = itemNameTextBox.Text;
                //int expenseTypeID = getID(sqlStatementSelectExpenseTypeID, expenseTypeComboBox.Text);
                String       expenseTypeName = expenseTypeComboBox.Text;
                int          expenseValue    = Convert.ToInt32(itemValueTextBox.Text);
                String       expenseDate     = datePicker.Value.ToString("yyyy-MM-dd");//Getting date as String
                IncomeSource incomeSource    = getIncomeSource();

                paramContainer = new QueryData.Builder(userID)

                                 .addItemName(expenseName)
                                 .addItemValue(expenseValue)
                                 .addTypeName(expenseTypeName)
                                 .addItemCreationDate(expenseDate)
                                 .addIncomeSource(incomeSource)
                                 .build();
                break;

            //Debt insertion object configuration
            case BudgetItemType.DEBT:
                //Getting the necessary data
                String debtName     = itemNameTextBox.Text;
                int    debtValue    = Convert.ToInt32(itemValueTextBox.Text);
                String creditorName = creditorNameComboBox.Text;
                String debtDate     = datePicker.Value.ToString("yyyy-MM-dd");

                paramContainer = new QueryData.Builder(userID)
                                 .addItemName(debtName)
                                 .addItemValue(debtValue)
                                 .addCreditorName(creditorName)
                                 .addItemCreationDate(debtDate)
                                 .build();
                break;

            //Receivable insertion object configuration
            case BudgetItemType.RECEIVABLE:
                String       receivableName         = itemNameTextBox.Text;
                int          receivableValue        = Convert.ToInt32(itemValueTextBox.Text);
                int          totalPaidAmount        = 0;//the total paid amount is set to 0 since this is a new record and there were no money paid yet
                String       debtorName             = debtorNameComboBox.Text;
                String       receivableStartDate    = datePicker.Value.ToString("yyy-MM-dd");
                String       receivableEndDate      = receivableDueDatePicker.Value.ToString("yyy-MM-dd");
                IncomeSource receivableIncomeSource = getIncomeSource();

                paramContainer = new QueryData.Builder(userID)
                                 .addItemName(receivableName)
                                 .addItemValue(receivableValue)
                                 .addDebtorName(debtorName)
                                 .addStartDate(receivableStartDate)
                                 .addEndDate(receivableEndDate)
                                 .addIncomeSource(receivableIncomeSource)
                                 .addPaidAmount(totalPaidAmount)
                                 .build();
                break;

            //Saving insertion object configuration
            case BudgetItemType.SAVING:
                //Getting the necessary data
                String savingName  = itemNameTextBox.Text;
                int    savingValue = Convert.ToInt32(itemValueTextBox.Text);
                String savingDate  = datePicker.Value.ToString("yyyy-MM-dd");

                paramContainer = new QueryData.Builder(userID)
                                 .addItemName(savingName)
                                 .addItemValue(savingValue)
                                 .addItemCreationDate(savingDate)
                                 .build();
                break;

            //Creditor insertion object configuration
            case BudgetItemType.CREDITOR:
                String insertedCreditorName = itemNameTextBox.Text;

                paramContainer = new QueryData.Builder(userID)
                                 .addCreditorName(insertedCreditorName)
                                 .build();
                break;

            //Debtor insertion object configuration
            case BudgetItemType.DEBTOR:
                String insertedDebtorName = itemNameTextBox.Text;

                paramContainer = new QueryData.Builder(userID)
                                 .addDebtorName(insertedDebtorName)
                                 .build();
                break;

            default:
                break;
            }

            return(paramContainer);
        }
Example #13
0
        //Method for sending the correct data to the controller acording to user timespan selection
        private void sendDataToController(DataUpdateControl pickerType, DateTimePicker dateTimePicker, bool hasClickedCell)
        {
            QueryData paramContainer = null;

            //If the month records checkbox is selected then the month and year is retrieved from the provided dateTimePicker and the QueryData object is created
            if (pickerType == DataUpdateControl.MONTHLY_PICKER)
            {
                //paramContainer = new QueryData.Builder(userID).addMonth(dateTimePicker.Value.Month).addYear(dateTimePicker.Value.Year).build();
                if (hasClickedCell)
                {
                    //string[] selectedPlanDates = getDatesFromSelectedRow(selectedRowIndex, dataGridViewBPManagement);
                    //CHANGE-DGW MANAGEMENT
                    string[] selectedPlanDates = gridViewManager.getDatesFromSelectedRow(selectedRowIndex, START_DATE_COLUMN_INDEX, END_DATE_COLUMN_INDEX);

                    if (selectedPlanDates == null)
                    {
                        return;
                    }

                    paramContainer = new QueryData.Builder(userID).addStartDate(selectedPlanDates[0]).addEndDate(selectedPlanDates[1]).build();
                }
                else
                {
                    //ParamContainer object created when the user has not selected a DataGridView cell(e.g the user just changes the DateTimePicker control value)
                    paramContainer = new QueryData.Builder(userID).addMonth(dateTimePicker.Value.Month).addYear(dateTimePicker.Value.Year).build();
                }
                //If the year record checkbox is selected then only the year is retrieved from the prvided dateTimePicker and the QueryData object is created
            }
            else if (pickerType == DataUpdateControl.YEARLY_PICKER)
            {
                //If a DataGridView cell was clicked  then it means that the start and end dates of the selected budget plan have to be retrieved in order to create the paramContainer object
                if (hasClickedCell)
                {
                    //string[] selectedPlanDates = getDatesFromSelectedRow(selectedRowIndex, dataGridViewBPManagement);
                    //CHANGE-DGW MANAGEMENT
                    string[] selectedPlanDates = gridViewManager.getDatesFromSelectedRow(selectedRowIndex, START_DATE_COLUMN_INDEX, END_DATE_COLUMN_INDEX);

                    if (selectedPlanDates == null)
                    {
                        return;
                    }

                    paramContainer = new QueryData.Builder(userID).addStartDate(selectedPlanDates[0]).addEndDate(selectedPlanDates[1]).build();
                }
                else
                {
                    //ParamContainer object created when the user has not selected a DataGridView cell(e.g the user just changes the DateTimePicker control value)
                    paramContainer = new QueryData.Builder(userID).addYear(dateTimePicker.Value.Year).build();
                }
            }

            QueryType option = getQueryTypeOption(hasClickedCell);

            //If there is no data in the paramContainer or the option is UNDEFINED then the control will return from the method and no data will be sent to the controller
            if (paramContainer == null || option == QueryType.UNDEFINED)
            {
                return;
            }

            controller.requestData(option, paramContainer);
        }
Example #14
0
        private void sendDataToController(DataUpdateControl updateControl, CheckBox checkBox, DateTimePicker startPicker, DateTimePicker endPicker)
        {
            //Checking the control type whose state was modified
            if (updateControl == DataUpdateControl.START_PICKER)
            {
                String tableName = getSelectedTableName(savingAccountComboBox);
                //If the interval checkbox is selected it means that multiple months data is being requested from the DB
                if (checkBox.Checked == true)
                {
                    //Selecting the multiple months option
                    QueryType option = QueryType.MULTIPLE_MONTHS;

                    //Retrieving the start and end date in the format used by the MySqL database
                    String startDate = getDateStringInSQLFormat(startPicker, DateType.START_DATE);
                    String endDate   = getDateStringInSQLFormat(endPicker, DateType.END_DATE);

                    //Configures the object that is used to store the parameter values for the SQL query and sends it to the controller alongside the type of the query that will be executed
                    QueryData paramContainer = new QueryData.Builder(userID).addStartDate(startDate).addEndDate(endDate).addTableName(tableName).build();

                    controller.requestData(option, paramContainer);
                }
                else
                {
                    //Otherwise single month data is selected
                    QueryType option = QueryType.SINGLE_MONTH;

                    //Retrieving the month and year values
                    int month = startPicker.Value.Month;
                    int year  = startPicker.Value.Year;

                    //Configures the object that is used to store the parameter values for the SQL query and sends it to the controller alongside the type of the query that will be executed
                    QueryData paramContainer = new QueryData.Builder(userID).addMonth(month).addYear(year).addTableName(tableName).build();

                    controller.requestData(option, paramContainer);
                }
            }
            else if (updateControl == DataUpdateControl.END_PICKER)
            {
                String tableName = getSelectedTableName(savingAccountComboBox);
                //Selecting multiple months data if the control whose state was modified is the DateTimePicker used to set the end month
                QueryType option = QueryType.MULTIPLE_MONTHS;

                String startDate = getDateStringInSQLFormat(startPicker, DateType.START_DATE);
                String endDate   = getDateStringInSQLFormat(endPicker, DateType.END_DATE);

                QueryData paramContainer = new QueryData.Builder(userID).addStartDate(startDate).addEndDate(endDate).addTableName(tableName).build(); //CHANGE
                controller.requestData(option, paramContainer);
            }
            else if (updateControl == DataUpdateControl.YEARLY_PICKER)
            {
                //Selecting the query type option that will sum the selected element values for each month of the selected year.
                QueryType option = QueryType.MONTHLY_TOTALS;

                //Just like before the month and year values are retrieved
                int month = startPicker.Value.Month;
                int year  = startPicker.Value.Year;

                //Creating the QueryData object and sending the data to the controller
                QueryData paramContainer = new QueryData.Builder(userID).addMonth(month).addYear(year).build(); //CHANGE
                controller.requestData(option, paramContainer);
            }
            else if (updateControl == DataUpdateControl.REFRESH_BUTTON)
            {
                //Current account balance is calculated based on multiple months data
                QueryType option = QueryType.TOTAL_VALUE;

                //Only the userID is needed since the current saving account balance calculation is always made from the first existing balance record to the record of the current month
                QueryData paramContainer = new QueryData.Builder(userID).build();

                controller.requestData(option, paramContainer);
            }
        }