Last active
April 8, 2018 02:37
-
-
Save luizhenriquesoares/5c477a443e75ea4ff69985fda6e84ec5 to your computer and use it in GitHub Desktop.
convert result regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static DataTable ConvertResultRegex(DataTable regexList) | |
{ | |
DataTable result = new DataTable(); | |
result.Columns.Add("descricao"); | |
foreach(DataRow row in regexList.Rows) | |
{ | |
foreach(DataColumn column in regexList.Columns) | |
{ | |
string name = column.ToString(); | |
if(name.Equals("Campos")) | |
{ | |
string fields = row[column].ToString(); | |
if(fields.Equals("descricao")) | |
{ | |
DataRow Row = result.NewRow(); | |
Row["descricao"] = row[3].ToString(); | |
result.Rows.Add(Row); | |
} else if(fields.Equals("identificador_multa")) | |
{ | |
DataRow Row = result.NewRow(); | |
Row["identificador_multa"] = row[3].ToString(); | |
result.Rows.Add(Row); | |
} | |
else if (fields.Equals("data_infracao")) | |
{ | |
DataRow Row = result.NewRow(); | |
Row["data_infracao"] = row[3].ToString(); | |
result.Rows.Add(Row); | |
} | |
else if (fields.Equals("vencimento")) | |
{ | |
DataRow Row = result.NewRow(); | |
Row["vencimento"] = row[3].ToString(); | |
result.Rows.Add(Row); | |
} | |
else if (fields.Equals("valor")) | |
{ | |
DataRow Row = result.NewRow(); | |
Row["valor"] = row[3].ToString(); | |
result.Rows.Add(Row); | |
} | |
else if (fields.Equals("cod_barras")) | |
{ | |
DataRow Row = result.NewRow(); | |
Row["cod_barras"] = row[3].ToString(); | |
result.Rows.Add(Row); | |
} | |
else if (fields.Equals("desconto")) | |
{ | |
DataRow Row = result.NewRow(); | |
Row["desconto"] = row[3].ToString(); | |
result.Rows.Add(Row); | |
} | |
} | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment