This commit is contained in:
2023-11-02 14:41:32 -07:00
parent 3dd4034a84
commit 03bd20fc8c
16 changed files with 142 additions and 143 deletions

View File

@ -52,7 +52,7 @@ public class ExportController : Controller
[Route("/ExportData")]
public ActionResult ExportData(Export model)
{
ToolType toolType = null;
ToolType? toolType = null;
if (string.IsNullOrEmpty(model.ToolType))
ModelState.AddModelError("Exception", "Invalid selection");
else
@ -66,7 +66,7 @@ public class ExportController : Controller
else if (string.IsNullOrWhiteSpace(toolType.ExportSPName))
ModelState.AddModelError("ToolType", "Tool type is not exportable");
}
if (ModelState.IsValid)
if (ModelState.IsValid && toolType?.ToolTypeName is not null && toolType.ExportSPName is not null)
{
try
{
@ -114,10 +114,13 @@ public class ExportController : Controller
{
if (i > 0)
_ = r.Append(',');
object v = dr[i];
if (!Convert.IsDBNull(v))
_ = r.Append(FormatForCSV(Convert.ToString(v)));
{
string? c = Convert.ToString(v);
if (c is not null)
_ = r.Append(FormatForCSV(c));
}
}
return r.ToString();
}