Refactoring

This commit is contained in:
2013-01-17 20:14:04 -05:00
parent dccadd3d42
commit ffb6961fe0
7 changed files with 26 additions and 54 deletions
+9 -38
View File
@@ -1,5 +1,4 @@
@using MileageTraker.Web.Utility
@model MileageTraker.Web.Models.User
@model MileageTraker.Web.Models.User
@{
ViewBag.Title = "User Details";
@@ -49,15 +48,8 @@
@Html.DisplayNameFor(m => m.LastActivityDate)
</dt>
<dd>
@if (!Model.LastActivityDate.IsSqlMinValue())
{
@Html.Encode(Model.LastActivityDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastActivityDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>No Activity</span>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastActivityDate, "No Activity"))
</dd>
</dl>
@@ -66,15 +58,8 @@
@Html.DisplayNameFor(m => m.LastLoginDate)
</dt>
<dd>
@if (!Model.LastLoginDate.IsSqlMinValue())
{
@Html.Encode(Model.LastLoginDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastLoginDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>Never Logged In</span>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastLoginDate, "Never Logged In"))
</dd>
</dl>
@@ -83,15 +68,8 @@
@Html.DisplayNameFor(m => m.LastPasswordChangedDate)
</dt>
<dd>
@if (!Model.LastPasswordChangedDate.IsSqlMinValue())
{
@Html.Encode(Model.LastPasswordChangedDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastPasswordChangedDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>Never Changed</span>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastPasswordChangedDate, "Never Changed"))
</dd>
</dl>
@@ -101,15 +79,8 @@
Lockout Password Date
</dt>
<dd>
@if (!Model.LastLockoutDate.IsSqlMinValue())
{
@Html.Encode(Model.LastLockoutDate)
<span class="muted">(@Html.Encode((DateTime.Now - Model.LastLockoutDate).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>Never Locked (?)</span>
}
@Html.Partial("_DateTimeHistoric",
new Tuple<DateTime,string>(Model.LastLockoutDate, "Never Locked (?)"))
</dd>
</dl>
}
+1 -1
View File
@@ -57,7 +57,7 @@
</text>),
grid.Column("LastActivityDate", "Last Activity",
@<text>
@Html.Partial("_LastActivity", (DateTime)item.LastActivityDate)
@Html.Partial("_DateTimeHistoric", new Tuple<DateTime,string>((DateTime)item.LastActivityDate, "No Activity"))
</text>),
grid.Column(format:
@<div class='btn-group'>
+12
View File
@@ -0,0 +1,12 @@
@using MileageTraker.Web.Utility
@model Tuple<DateTime,string>
@if (!Model.Item1.IsSqlMinValue())
{
@Html.Encode((DateTime.Now - Model.Item1).ToVerboseStringHistoric())
<span class="muted">(@Html.Encode(Model.Item1))</span>
}
else
{
<span class='label label-info'>@Model.Item2</span>
}
-12
View File
@@ -1,12 +0,0 @@
@using MileageTraker.Web.Utility
@model DateTime
@if (!Model.IsSqlMinValue())
{
@Html.Encode(Model)
<span class="muted">(@Html.Encode((DateTime.Now - Model).ToVerboseStringHistoric()))</span>
}
else
{
<span class='label label-info'>No Activity</span>
}