public static TableCell AddTableCell(TableRow tableRow, string value, SourceTextType fieldType, string toolTip = "") { TableCell tableCell1 = new TableCell(); string valueToPrint = "NA"; switch (fieldType) { case SourceTextType.DateTime: if (!string.IsNullOrWhiteSpace(value)) { DateTime createdDate = DateTime.Now; createdDate = DateTime.Parse(value); valueToPrint = SCBasics.AuditTrail.Utils.DateTimeUtil.TimeAgo(createdDate); } else { valueToPrint = "NA"; } break; case SourceTextType.Text: valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA"; break; default: valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA"; break; } tableCell1.Text = valueToPrint; tableCell1.ToolTip = toolTip; tableRow.Cells.Add(tableCell1); return tableCell1; }
public static TableCell AddTableCell(TableRow tableRow, string value, SourceTextType fieldType, string toolTip = "") { TableCell tableCell1 = new TableCell(); string valueToPrint = "NA"; switch (fieldType) { case SourceTextType.DateTime: if (!string.IsNullOrWhiteSpace(value)) { DateTime createdDate = DateTime.Now; createdDate = DateTime.Parse(value); valueToPrint = SCBasics.AuditTrail.Utils.DateTimeUtil.TimeAgo(createdDate); } else { valueToPrint = "NA"; } break; case SourceTextType.Text: valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA"; break; default: valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA"; break; } tableCell1.Text = valueToPrint; tableCell1.ToolTip = toolTip; tableRow.Cells.Add(tableCell1); return(tableCell1); }