Ejemplo n.º 1
0
 void importDataAction()
 {
     var dataImporter = new GetValuesFromReport()
     {
         fileName = lblSelectedFile.Text, SelectedProject = CurrentProjectName
     }.DoDataImport(CurrentProjectName);
 }
Ejemplo n.º 2
0
        //ProjectName _currentProjectName = ProjectName.None;

        void ReadDataFiles(List <FileDetails> files, ProjectName projectName)
        {
            if (ExcelDataValues == null)
            {
                ExcelDataValues = new List <DataValue>();
            }
            else
            {
                ExcelDataValues.Clear();
            }
            var connBuilder = DbFactory.GetDefaultConnection(CurrentProjectName);

            if (connBuilder == null)
            {
                return;
            }

            foreach (var file in files)
            {
                IQueryHelper <List <DataValue> > worker = null;
                if (projectName == ProjectName.DOD)
                {
                    worker = new GetDodDataFromExcel()
                    {
                        fileName          = file.FileName,
                        SelectedProject   = projectName,
                        ageGroupsProvider = new AgegroupsProvider()
                        {
                            DB = new DbHelper(connBuilder)
                        }
                        //locationDetail = processedFilesInfo.LocationDetails,
                        //worksheetName = Constants.INCOUNTRY_ION_EXPENSES
                    };
                }
                else
                {
                    worker = new GetValuesFromReport()
                    {
                        fileName = file.FileName, SelectedProject = projectName
                    };
                }
                worker.progressDisplayHelper = new WaitDialog()
                {
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner
                };

                var intermediateResults = worker.Execute();
                if (intermediateResults == null)
                {
                    //we skip and alert the user of the error
                    continue;
                }

                ExcelDataValues.AddRange(intermediateResults);
            }

            //we update the display
            ShowGridDisplayPort(ExcelDataValues);
            return;
        }