Esempio n. 1
0
        public static bool ImportSpssAll(StudyUnitVM studyUnit, MainWindowVM mainWindow)
        {
            string path = IOUtils.QueryOpenPathName(SPSS_FILTER);

            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }
            try
            {
                SpssReader reader = new SpssReader();
                if (!reader.ImportVariables(path, studyUnit))
                {
                    return(false);
                }
                StudyUnit studyUnitModel = studyUnit.StudyUnitModel;
                mainWindow.RecreateViewModels();
                RawData rawData = reader.LoadRawData(path);
                if (rawData == null)
                {
                    return(false);
                }

                StudyUnitVM           newStudyUnit    = mainWindow.GetStudyUnit(studyUnitModel);
                List <StatisticsInfo> statisticsInfos = StatisticsUtils.CreateStatisticsInfos(rawData, newStudyUnit);
                studyUnitModel.StatisticsInfos = statisticsInfos;
                mainWindow.RecreateViewModels();
                return(true);
            }
            catch (Exception ex)
            {
                EDOUtils.ShowUnexpectedError(ex);
            }
            return(false);
        }
Esempio n. 2
0
        public static bool ImportData(StudyUnitVM studyUnit)
        {
            string path = IOUtils.QueryOpenPathName(Resources.DataFilter);

            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }
            bool result = false;

            try
            {
                Mouse.OverrideCursor = Cursors.Wait;

                string  extension = Path.GetExtension(path);
                RawData rawData   = null;
                if (extension == ".sav")
                {
                    SpssReader reader = new SpssReader();
                    rawData = reader.LoadRawData(path);
                }
                else if (extension == ".xlsx")
                {
                    ExcelReader reader = new ExcelReader();
                    rawData = reader.LoadRawData(path);
                }
                else if (extension == ".csv")
                {
                    CsvReader reader = new CsvReader();
                    rawData = reader.LoadRawData(path);
                }


                if (rawData != null)
                {
                    List <StatisticsInfo> statisticsInfos = StatisticsUtils.CreateStatisticsInfos(rawData, studyUnit);
                    studyUnit.StudyUnitModel.StatisticsInfos = statisticsInfos;
                    result = true;
                }
            }
            catch (Exception ex)
            {
                EDOUtils.ShowUnexpectedError(ex);
            }
            finally
            {
                Mouse.OverrideCursor = null;
            }
            return(result);
        }
Esempio n. 3
0
        public static bool ImportSpssVariables(StudyUnitVM studyUnit)
        {
            string path = IOUtils.QueryOpenPathName(SPSS_FILTER);

            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }
            try
            {
                SpssReader reader = new SpssReader();
                return(reader.ImportVariables(path, studyUnit));
            }
            catch (Exception ex)
            {
                EDOUtils.ShowUnexpectedError(ex);
            }
            return(false);
        }
Esempio n. 4
0
 public static bool ImportSpss(StudyUnitVM studyUnit)
 {
     string path = IOUtils.QueryOpenPathName(SPSS_FILTER);
     if (string.IsNullOrEmpty(path))
     {
         return false;
     }
     try
     {
         SpssReader reader = new SpssReader();
         return reader.Read(path, studyUnit);
     }
     catch (Exception ex)
     {
         EDOUtils.ShowUnexpectedError(ex);
     }
     return false;
 }