Пример #1
0
        public void requestData(QueryType option, QueryData paramContainer)
        {
            //NOTE:
            //DYNAMIC_DATASOURCE_1 - used when requesting the list of budget plans for a month/ year(first position in the DataSources array)
            //DYNAMIC_DATASOURCE_2 - used when requesting info about the selected budget plan(second position in the DataSources array)


            //Retrieving the DataTable object containing the data from the DB
            //DataTable staticDataTable = model.getNewData(option, paramContainer, SelectedDataSource.STATIC_DATASOURCE);

            //Updating the data when the budget plan display is requested(single month/full year)
            if (option == QueryType.SINGLE_MONTH || option == QueryType.FULL_YEAR)
            {
                DataTable dynamicDataTable = model.getNewData(option, paramContainer, SelectedDataSource.DYNAMIC_DATASOURCE_1);

                DataTable[] updatedDataSources = model.DataSources;
                updatedDataSources[0] = dynamicDataTable;
                model.DataSources     = updatedDataSources;//Assigns the updated DataTable array to the DataSources array reference of the model, which triggers the update of the View through the notifyObservers() method

                //Updating the data when info about the selected budget plan is requested
            }
            else if (option == QueryType.BUDGET_PLAN_INFO)
            {
                DataTable dynamicDataTable2 = model.getNewData(option, paramContainer, SelectedDataSource.DYNAMIC_DATASOURCE_2);

                DataTable[] updatedDataSources = model.DataSources;
                updatedDataSources[1] = dynamicDataTable2;
                model.DataSources     = updatedDataSources;
            }
        }
        public void requestData(QueryType option, QueryData paramContainer)
        {
            DataTable staticDataTable = model.getNewData(option, paramContainer, SelectedDataSource.STATIC_DATASOURCE);

            DataTable[] updatedDataSources = model.DataSources;
            updatedDataSources[0] = staticDataTable;

            model.DataSources = updatedDataSources;
        }