Exemplo n.º 1
0
        private List <FileRow> ParseDataContent(bool skipFirstLine)
        {
            switch (SourceType)
            {
            case SourceType.Excel:
            case SourceType.Text:
                if (!File.Exists(txtFilePath.Text))
                {
                    throw new Exception("Specified file does not exist");
                }
                break;
            }

            switch (SourceType)
            {
            case SourceType.Excel:
                return(ExcelParser.GetValues(txtFilePath.Text, cboSheetName.Text, skipFirstLine));

            case SourceType.Text:
                return(TextParser.GetValues(txtFilePath.Text, GetDelimiter(), skipFirstLine));

            case SourceType.Sql:
                return(SqlParser.GetValues(cboConnectionSource.SelectedValue.ToString(), cboTableNameSource.SelectedValue.ToString(), txtFilter.Text));

            default:
                throw new Exception($"SourceType={SourceType} is not handled");
            }
        }