oqtane.framework/Oqtane.Client/Modules/Controls/AuditInfo.razor
2019-09-29 18:59:17 +02:00

82 lines
2.1 KiB
Plaintext

@namespace Oqtane.Modules.Controls
@inherits ModuleBase
@if (text != "")
{
@((MarkupString)@text)
}
@code {
[Parameter]
public string CreatedBy { get; set; }
[Parameter]
public DateTime CreatedOn { get; set; }
[Parameter]
public string ModifiedBy { get; set; }
[Parameter]
public DateTime ModifiedOn { get; set; }
[Parameter]
public string DeletedBy { get; set; }
[Parameter]
public DateTime? DeletedOn { get; set; }
[Parameter]
public bool IsDeleted { get; set; }
[Parameter]
public string Style { get; set; }
string text = "";
protected override void OnParametersSet()
{
text = "";
if (!String.IsNullOrEmpty(CreatedBy) || CreatedOn != null)
{
text += "<p style=\"" + Style + "\">Created ";
if (!String.IsNullOrEmpty(CreatedBy))
{
text += " by <b>" + CreatedBy + "</b>";
}
if (CreatedOn != null)
{
text += " on <b>" + CreatedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
}
text += "</p>";
}
if (!String.IsNullOrEmpty(ModifiedBy) || ModifiedOn != null)
{
text += "<p style=\"" + Style + "\">Last modified ";
if (!String.IsNullOrEmpty(ModifiedBy))
{
text += " by <b>" + ModifiedBy + "</b>";
}
if (ModifiedOn != null)
{
text += " on <b>" + ModifiedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
}
text += "</p>";
}
if (!String.IsNullOrEmpty(DeletedBy) || DeletedOn.HasValue)
{
text += "<p style=\"" + Style + "\">Deleted ";
if (!String.IsNullOrEmpty(DeletedBy))
{
text += " by <b>" + DeletedBy + "</b>";
}
if (DeletedOn != null)
{
text += " on <b>" + DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
}
text += "</p>";
}
}
}