This commit is contained in:
Rick Falkvinge
2017-10-24 18:51:06 +02:00
parent b3a9ae7375
commit 3f06a7e22a
+31 -1
View File
@@ -123,7 +123,37 @@ namespace Swarmops.Database
}
}
}
public int GetVatReportIdFromGuid(string guid)
{
return GetVatReportIdFromStringField("Guid", guid);
}
private int GetVatReportIdFromStringField(string stringFieldName, string stringValue)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
GetDbCommand(
"SELECT VatReportId FROM VatReports WHERE " + stringFieldName + "=@stringValue;", connection);
AddParameterWithName(command, "stringValue", stringValue);
using (DbDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
return reader.GetInt32(0);
}
return 0;
}
}
}
public BasicVatReport[] GetVatReports(params object[] conditions)