Combine layouts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace MileageTraker.Web.Utility
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
public class ActionLogAttribute : ActionFilterAttribute
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MileageTraker.Web.Utility
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
public class DenyFutureDateAttribute : ValidationAttribute
|
||||
{
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MileageTraker.Web.Utility
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
public class DenyPreviousMonthDateAttribute : ValidationAttribute
|
||||
{
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class FormatHintAttribute : Attribute
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
|
||||
public FormatHintAttribute(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -2,8 +2,14 @@ using System;
|
||||
using System.Reflection;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace MileageTraker.Web.Utility
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Add to actions to use multiple submit buttons (back or save, for example)
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://blog.ashmind.com/2010/03/15/multiple-submit-buttons-with-asp-net-mvc-final-solution/
|
||||
/// </remarks>
|
||||
public class HttpParamActionAttribute : ActionNameSelectorAttribute
|
||||
{
|
||||
public override bool IsValidName(ControllerContext controllerContext, string actionName, MethodInfo methodInfo)
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class InputSizeAttribute : Attribute
|
||||
{
|
||||
public string Size { get; private set; }
|
||||
|
||||
public string ClassName { get { return "input-" + Size.ToLower(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Specify width of input element
|
||||
/// </summary>
|
||||
/// <param name="size">mini, small, medium, large, xlarge, xxlarge</param>
|
||||
public InputSizeAttribute(string size)
|
||||
{
|
||||
Size = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class NoEditLabelAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace MileageTraker.Web.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class UnitsAttribute : Attribute
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
|
||||
public UnitsAttribute(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,11 @@
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.form-login {
|
||||
max-width: 300px;
|
||||
padding: 19px 29px 29px;
|
||||
@@ -36,4 +41,13 @@
|
||||
legend {
|
||||
border-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.header {
|
||||
background: url(images/Header.login.mobile.png) no-repeat;
|
||||
height: 32px;
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
body {
|
||||
padding-top: 60px;
|
||||
}
|
||||
|
||||
.navbar.navbar-fixed-top {
|
||||
min-width: 979px
|
||||
}
|
||||
|
||||
.brand
|
||||
{
|
||||
background: url(images/Header.png) no-repeat left center;
|
||||
height: 28px;
|
||||
width: 266px;
|
||||
}
|
||||
|
||||
.navbar .brand {
|
||||
margin-left: 10px;
|
||||
margin-right: -20px;
|
||||
}
|
||||
|
||||
.nav li {
|
||||
line-height: 29px;
|
||||
}
|
||||
|
||||
.nav > li button.btn-link {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.navbar .nav > li button.btn-link {
|
||||
float: none;
|
||||
padding: 12px 15px 0;
|
||||
color: #777;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.navbar-inverse .nav > li button.btn-link {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.navbar-inverse .nav > li button.btn-link:hover {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.navbar .nav > li form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #101010;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.qtip-content dt {
|
||||
line-height: 10px;
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.qtip-content dd {
|
||||
line-height: 10px;
|
||||
margin-left: 120px;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.validation-summary-errors ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.report-calculation
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#log-title {
|
||||
background: url(images/glyphicons_026_road.png) no-repeat left center;
|
||||
display: inline;
|
||||
height: 24px;
|
||||
width: 28px;
|
||||
padding-left: 36px;
|
||||
}
|
||||
|
||||
#vehicle-title {
|
||||
background: url(images/glyphicons_005_car.png) no-repeat left center;
|
||||
display: inline;
|
||||
height: 24px;
|
||||
width: 28px;
|
||||
padding-left: 36px;
|
||||
}
|
||||
|
||||
.icon-car {
|
||||
background-image: url("images/glyphicons_005_car_half.png");
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
.dropdown-menu > li > a:hover > .icon-car {
|
||||
background-image: url("images/glyphicons_005_car_half_white.png");
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
dl.inline, dl.inline dt, dl.inline dd {
|
||||
float: left;
|
||||
}
|
||||
|
||||
dl.inline {
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
@media print {
|
||||
header,
|
||||
footer,
|
||||
.no-print
|
||||
{ display:none }
|
||||
}
|
||||
+167
-29
@@ -1,15 +1,13 @@
|
||||
body {
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: .5em 1em;
|
||||
position: relative;
|
||||
padding-top: 60px;
|
||||
}
|
||||
|
||||
.brand
|
||||
{
|
||||
background: url(images/Header.png) no-repeat left center;
|
||||
height: 28px;
|
||||
width: 266px;
|
||||
background: url(images/Header.png) no-repeat left center;
|
||||
height: 28px;
|
||||
width: 266px;
|
||||
}
|
||||
|
||||
.navbar .brand {
|
||||
@@ -21,16 +19,168 @@ body {
|
||||
line-height: 29px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.input-mini {
|
||||
width: 60px !important;
|
||||
}
|
||||
.input-small {
|
||||
width: 90px !important;
|
||||
.nav > li button.btn-link {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.navbar .nav > li button.btn-link {
|
||||
float: none;
|
||||
padding: 12px 15px 0;
|
||||
color: #777;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.navbar-inverse .nav > li button.btn-link {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.navbar-inverse .nav > li button.btn-link:hover {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.navbar .nav > li form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #101010;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.qtip-content dt {
|
||||
line-height: 10px;
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
.qtip-content dd {
|
||||
line-height: 10px;
|
||||
margin-left: 120px;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.validation-summary-errors ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.report-calculation
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#log-title {
|
||||
background: url(images/glyphicons_026_road.png) no-repeat left center;
|
||||
display: inline;
|
||||
height: 24px;
|
||||
width: 28px;
|
||||
padding-left: 36px;
|
||||
}
|
||||
|
||||
#vehicle-title {
|
||||
background: url(images/glyphicons_005_car.png) no-repeat left center;
|
||||
display: inline;
|
||||
height: 24px;
|
||||
width: 28px;
|
||||
padding-left: 36px;
|
||||
}
|
||||
|
||||
.icon-car {
|
||||
background-image: url("images/glyphicons_005_car_half.png");
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
#users-online {
|
||||
display: inline-block;
|
||||
margin-top: 10px;
|
||||
margin-left: 20px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.dropdown-menu > li > a:hover > .icon-car {
|
||||
background-image: url("images/glyphicons_005_car_half_white.png");
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
dl.inline, dl.inline dt, dl.inline dd {
|
||||
float: left;
|
||||
}
|
||||
|
||||
dl.inline {
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
@media print {
|
||||
header,
|
||||
footer,
|
||||
.no-print
|
||||
{ display:none }
|
||||
}
|
||||
|
||||
/* Responsive
|
||||
------------------*/
|
||||
|
||||
@media (min-width: 768px) and (max-width: 979px) {
|
||||
body {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
@media (max-width: 767px) {
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.container-fluid {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.input-mini {
|
||||
width: 60px !important;
|
||||
}
|
||||
|
||||
.input-small {
|
||||
width: 90px !important;
|
||||
}
|
||||
|
||||
.dl-horizontal dt {
|
||||
float: left;
|
||||
width: 110px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dl-horizontal dd {
|
||||
margin-left: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.container-fluid {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
|
||||
.brand {
|
||||
background: url(images/Header.mobile.png) no-repeat left center;
|
||||
height: 28px;
|
||||
width: 205px;
|
||||
}
|
||||
|
||||
.navbar .brand {
|
||||
margin-left: 5px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
margin-bottom: 0;
|
||||
@@ -50,23 +200,11 @@ body {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.form-horizontal .control-group.endOdometer {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-horizontal .control-group.endOdometer {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.employeeName input {
|
||||
width: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.dl-horizontal dt {
|
||||
float: left;
|
||||
width: 110px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dl-horizontal dd {
|
||||
margin-left: 120px;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -2,13 +2,12 @@
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
using MileageTraker.Web.Membership;
|
||||
using MileageTraker.Web.ViewModels;
|
||||
using MileageTraker.Web.ViewModels.Account;
|
||||
|
||||
namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class AccountController : Controller
|
||||
public class AccountController : ControllerBase
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public ActionResult Login(string returnUrl)
|
||||
@@ -40,7 +39,7 @@ namespace MileageTraker.Web.Controllers
|
||||
WebSecurity.Logout();
|
||||
|
||||
// TODO: send notification to user
|
||||
return RedirectToAction("Login");
|
||||
return RedirectToAction("Index", "CreateLog");
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.DAL;
|
||||
|
||||
namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
public class CityController : ControllerBase
|
||||
{
|
||||
private readonly DataService _dataService = new DataService();
|
||||
|
||||
public JsonResult Autocomplete(string term)
|
||||
{
|
||||
var cities = _dataService.GetCitiesAutocomplete(term);
|
||||
var cities = DataService.GetCitiesAutocomplete(term);
|
||||
return Json(cities, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.DAL;
|
||||
|
||||
namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
public class ControllerBase : Controller
|
||||
{
|
||||
protected readonly DataService DataService = new DataService();
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
DataService.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected override void OnException(ExceptionContext filterContext)
|
||||
{
|
||||
if (filterContext != null && filterContext.Exception != null)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.DAL;
|
||||
using MileageTraker.Web.Attributes;
|
||||
using MileageTraker.Web.Models;
|
||||
using MileageTraker.Web.Utility;
|
||||
using MileageTraker.Web.ViewModels;
|
||||
using MileageTraker.Web.ViewModels.CreateLog;
|
||||
|
||||
namespace MileageTraker.Web.Controllers
|
||||
@@ -13,7 +12,6 @@ namespace MileageTraker.Web.Controllers
|
||||
private const string CookieKeyEmployeename = "mr_employeeName";
|
||||
private const string CookeNameVehicleid = "mr_vehicleId";
|
||||
private const string CookieKeyLogtype = "mr_logType";
|
||||
private readonly DataService _dataService = new DataService();
|
||||
|
||||
public ViewResult Index()
|
||||
{
|
||||
@@ -61,7 +59,7 @@ namespace MileageTraker.Web.Controllers
|
||||
log.Source = HttpContext.Request.Url.AbsolutePath;
|
||||
log.UserHostAddress = HttpContext.Request.UserHostAddress;
|
||||
log.UserAgent = HttpContext.Request.UserAgent;
|
||||
_dataService.AddLog(log);
|
||||
DataService.AddLog(log);
|
||||
return View("Success", model);
|
||||
}
|
||||
|
||||
@@ -70,7 +68,7 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public PartialViewResult RecentLogs(string employeeName)
|
||||
{
|
||||
var logs = _dataService.GetRecentLogsByEmployee(employeeName);
|
||||
var logs = DataService.GetRecentLogsByEmployee(employeeName);
|
||||
ViewData["employeeName"] = employeeName;
|
||||
return PartialView(logs);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.DAL;
|
||||
|
||||
namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
public class EmployeeController : Controller
|
||||
public class EmployeeController : ControllerBase
|
||||
{
|
||||
private readonly DataService _dataService = new DataService();
|
||||
|
||||
public JsonResult Autocomplete(string term)
|
||||
{
|
||||
var employees = _dataService.GetEmployeeNamesAutocomplete(term);
|
||||
var employees = DataService.GetEmployeeNamesAutocomplete(term);
|
||||
return Json(employees, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.Attributes;
|
||||
using MileageTraker.Web.DAL;
|
||||
using MileageTraker.Web.Models;
|
||||
using MileageTraker.Web.Utility;
|
||||
@@ -13,24 +14,22 @@ namespace MileageTraker.Web.Controllers
|
||||
[Authorize(Roles = "Administrator, Developer")]
|
||||
public class LogController : ControllerBase
|
||||
{
|
||||
private readonly DataService _dataService = new DataService();
|
||||
|
||||
public ViewResult Index(LogQueryViewModel query)
|
||||
{
|
||||
var logs = _dataService.GetLogs();
|
||||
var logs = DataService.GetLogs();
|
||||
|
||||
var validLogYears = _dataService.GetValidLogYears().ToList();
|
||||
var validLogYears = DataService.GetValidLogYears().ToList();
|
||||
if (!validLogYears.Any())
|
||||
return View("Empty");
|
||||
if (!query.Year.HasValue)
|
||||
query.Year = validLogYears.FirstOrDefault();
|
||||
|
||||
var validLogMonths = _dataService.GetValidLogMonths(query.Year.Value).ToList();
|
||||
var validLogMonths = DataService.GetValidLogMonths(query.Year.Value).ToList();
|
||||
if (!query.Month.HasValue)
|
||||
query.Month = validLogMonths.FirstOrDefault();
|
||||
|
||||
var filteredLogs =
|
||||
from log in _dataService.GetLogIndexViewModels(DataService.FilterLogs(logs, query))
|
||||
from log in DataService.GetLogIndexViewModels(DataService.FilterLogs(logs, query))
|
||||
orderby log.Created descending
|
||||
select log;
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace MileageTraker.Web.Controllers
|
||||
[ActionLog]
|
||||
public ActionResult Export(LogQueryViewModel query)
|
||||
{
|
||||
var logs = _dataService.GetLogs();
|
||||
var logs = DataService.GetLogs();
|
||||
var name = string.Format(
|
||||
"MileageLogs{0}-{1}{2}",
|
||||
query.Year,
|
||||
@@ -66,7 +65,7 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public ViewResult MonthlyVehicleMileage(LogQueryViewModel query)
|
||||
{
|
||||
var items = _dataService.GetMonthlyVehicleMileageItems(query);
|
||||
var items = DataService.GetMonthlyVehicleMileageItems(query);
|
||||
|
||||
var report = new VehicleMileageViewModel (items, query);
|
||||
|
||||
@@ -75,7 +74,7 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public ActionResult MonthlyEmployeeMileage(LogQueryViewModel query)
|
||||
{
|
||||
var items = _dataService.GetMonthlyEmployeeMileageItems(query);
|
||||
var items = DataService.GetMonthlyEmployeeMileageItems(query);
|
||||
|
||||
var report = new EmployeeMileageViewModel(items, query);
|
||||
|
||||
@@ -84,13 +83,13 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public ViewResult Details(int id)
|
||||
{
|
||||
var log = _dataService.GetLog(id);
|
||||
var log = DataService.GetLog(id);
|
||||
return View(log);
|
||||
}
|
||||
|
||||
public ActionResult PreviousDetails(int id)
|
||||
{
|
||||
var log = _dataService.GetLog(id);
|
||||
var log = DataService.GetLog(id);
|
||||
int logId;
|
||||
if (log.VehiclePreviousLog != null)
|
||||
{
|
||||
@@ -106,7 +105,7 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public ActionResult NextDetails(int id)
|
||||
{
|
||||
var nextLog = _dataService.GetNextLog(id);
|
||||
var nextLog = DataService.GetNextLog(id);
|
||||
int logId;
|
||||
if (nextLog != null)
|
||||
{
|
||||
@@ -142,7 +141,7 @@ namespace MileageTraker.Web.Controllers
|
||||
log.UserHostAddress = HttpContext.Request.UserHostAddress;
|
||||
log.UserAgent = HttpContext.Request.UserAgent;
|
||||
|
||||
_dataService.AddLog(log);
|
||||
DataService.AddLog(log);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public ActionResult Edit(int id)
|
||||
{
|
||||
var log = _dataService.GetLog(id);
|
||||
var log = DataService.GetLog(id);
|
||||
return View(log);
|
||||
}
|
||||
|
||||
@@ -162,7 +161,7 @@ namespace MileageTraker.Web.Controllers
|
||||
RemoveModelStateErrors();
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_dataService.UpdateLog(log);
|
||||
DataService.UpdateLog(log);
|
||||
return RedirectToAction("Details", new{id = log.LogId});
|
||||
}
|
||||
return View(log);
|
||||
@@ -179,7 +178,7 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public ActionResult Delete(int id)
|
||||
{
|
||||
var log = _dataService.GetLog(id);
|
||||
var log = DataService.GetLog(id);
|
||||
return View(log);
|
||||
}
|
||||
|
||||
@@ -187,7 +186,7 @@ namespace MileageTraker.Web.Controllers
|
||||
[ActionLog]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
_dataService.DeleteLog(id);
|
||||
DataService.DeleteLog(id);
|
||||
|
||||
if (Session["LogPage"] != null)
|
||||
return Redirect((string) Session["LogPage"]);
|
||||
@@ -196,20 +195,14 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public JsonResult GetValidLogMonths(int year)
|
||||
{
|
||||
var validLogMonths = _dataService.GetValidLogMonths(year);
|
||||
var validLogMonths = DataService.GetValidLogMonths(year);
|
||||
return Json(validLogMonths, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
public PartialViewResult DetailsPartial(int id)
|
||||
{
|
||||
var log = _dataService.GetLog(id);
|
||||
var log = DataService.GetLog(id);
|
||||
return PartialView(new LogPartialDetails(log));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
_dataService.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.Models;
|
||||
using MileageTraker.Web.Context;
|
||||
using MileageTraker.Web.ViewModels.User;
|
||||
|
||||
namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
[Authorize(Roles = "Administrator, Developer")]
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View(DataService.GetUsers().ToList());
|
||||
}
|
||||
|
||||
public ActionResult Details(Guid id)
|
||||
{
|
||||
var user = DataService.GetUser(id);
|
||||
if (user == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(user);
|
||||
}
|
||||
|
||||
public ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Create(CreateUserViewModel createUserViewModel)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = createUserViewModel.CloneToUser();
|
||||
user.UserId = Guid.NewGuid();
|
||||
//db.Users.Add(user);
|
||||
//db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
return View(createUserViewModel);
|
||||
}
|
||||
|
||||
public ActionResult Edit(Guid id)
|
||||
{
|
||||
var user = DataService.GetUser(id);
|
||||
if (user == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(user);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Edit(User user)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
//db.Entry(user).State = EntityState.Modified;
|
||||
//db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.DAL;
|
||||
using MileageTraker.Web.Models;
|
||||
using MileageTraker.Web.ViewModels;
|
||||
using MileageTraker.Web.ViewModels.Vehicle;
|
||||
|
||||
namespace MileageTraker.Web.Controllers
|
||||
@@ -10,23 +9,21 @@ namespace MileageTraker.Web.Controllers
|
||||
[Authorize(Roles = "Administrator, Developer")]
|
||||
public class VehicleController : ControllerBase
|
||||
{
|
||||
private readonly DataService _ds = new DataService();
|
||||
|
||||
public ViewResult Index()
|
||||
{
|
||||
var vehicles = _ds.GetVehicles();
|
||||
var vehicles = DataService.GetVehicles();
|
||||
return View(vehicles);
|
||||
}
|
||||
|
||||
public ViewResult Details(string id)
|
||||
{
|
||||
var vehicle = _ds.GetVehicle(id);
|
||||
var vehicle = DataService.GetVehicle(id);
|
||||
return View(vehicle);
|
||||
}
|
||||
|
||||
public PartialViewResult DetailsPartial(string id)
|
||||
{
|
||||
var vehicle = _ds.GetVehicle(id);
|
||||
var vehicle = DataService.GetVehicle(id);
|
||||
return PartialView(new VehiclePartialDetails(vehicle));
|
||||
}
|
||||
|
||||
@@ -40,7 +37,7 @@ namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_ds.AddVehicle(vehicle);
|
||||
DataService.AddVehicle(vehicle);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
@@ -49,7 +46,7 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public ActionResult Edit(string id)
|
||||
{
|
||||
var vehicle = _ds.GetVehicle(id);
|
||||
var vehicle = DataService.GetVehicle(id);
|
||||
return View(vehicle);
|
||||
}
|
||||
|
||||
@@ -58,7 +55,7 @@ namespace MileageTraker.Web.Controllers
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_ds.UpdateVehicle(vehicle);
|
||||
DataService.UpdateVehicle(vehicle);
|
||||
return RedirectToAction("Details", new { id = vehicle.VehicleId });
|
||||
}
|
||||
return View(vehicle);
|
||||
@@ -66,21 +63,15 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
public JsonResult Exists(string vehicleId)
|
||||
{
|
||||
var vehicle = _ds.GetVehicle(vehicleId);
|
||||
var vehicle = DataService.GetVehicle(vehicleId);
|
||||
return Json(vehicle != null, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
public FileResult Export()
|
||||
{
|
||||
var vehicles = _ds.GetVehicles();
|
||||
var vehicles = DataService.GetVehicles();
|
||||
var export = VehicleImporter.Export(vehicles);
|
||||
return File(export, "application/ms-excel", string.Format("ETHRAVehicles{0:yyyy-MM-dd}.xls", DateTime.Today));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
_ds.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -17,6 +17,11 @@ namespace MileageTraker.Web.DAL
|
||||
{
|
||||
private readonly MileageTrakerContext _db = new MileageTrakerContext();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_db.Dispose();
|
||||
}
|
||||
|
||||
#region Log
|
||||
|
||||
public void AddLog(Log log)
|
||||
@@ -435,9 +440,16 @@ namespace MileageTraker.Web.DAL
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
public IQueryable<User> GetUsers()
|
||||
{
|
||||
_db.Dispose();
|
||||
return _db.Users;
|
||||
}
|
||||
|
||||
public User GetUser(Guid guid)
|
||||
{
|
||||
return _db.Users.Find(guid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -2,15 +2,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using AutoMapper;
|
||||
using MileageTraker.Web.Attributes;
|
||||
using MileageTraker.Web.DAL;
|
||||
using MileageTraker.Web.Utility;
|
||||
|
||||
namespace MileageTraker.Web
|
||||
{
|
||||
public class MvcApplication : System.Web.HttpApplication
|
||||
public class MvcApplication : HttpApplication
|
||||
{
|
||||
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Web;
|
||||
using System.Web.Security;
|
||||
using MileageTraker.Web.Context;
|
||||
using MileageTraker.Web.Models;
|
||||
using MileageTraker.Web.Utility;
|
||||
|
||||
namespace MileageTraker.Web.Membership
|
||||
{
|
||||
@@ -311,11 +312,7 @@ namespace MileageTraker.Web.Membership
|
||||
|
||||
public override int GetNumberOfUsersOnline()
|
||||
{
|
||||
var dateActive =
|
||||
DateTime.UtcNow.Subtract(
|
||||
TimeSpan.FromMinutes(
|
||||
Convert.ToDouble(
|
||||
System.Web.Security.Membership.UserIsOnlineTimeWindow)));
|
||||
var dateActive = CustomExtensions.UserOnlineThreshold();
|
||||
using (var context = new MileageTrakerContext())
|
||||
{
|
||||
return context.Users.Count(usr => usr.LastActivityDate > dateActive);
|
||||
@@ -360,7 +357,7 @@ namespace MileageTraker.Web.Membership
|
||||
var membershipUsers = new MembershipUserCollection();
|
||||
using (var context = new MileageTrakerContext())
|
||||
{
|
||||
totalRecords = context.Users.Count(Usr => Usr.Email == emailToMatch);
|
||||
totalRecords = context.Users.Count(user => user.Email == emailToMatch);
|
||||
var users =
|
||||
context.Users.Where(usr => usr.Email == emailToMatch)
|
||||
.OrderBy(usrn => usrn.Username)
|
||||
|
||||
@@ -101,10 +101,10 @@ namespace MileageTraker.Web.Membership
|
||||
return System.Web.Security.Membership.DeleteUser(username);
|
||||
}
|
||||
|
||||
public static int GetUserId(string userName)
|
||||
public static Guid GetUserId(string userName)
|
||||
{
|
||||
var user = System.Web.Security.Membership.GetUser(userName);
|
||||
return (int) user.ProviderUserKey;
|
||||
return (Guid) user.ProviderUserKey;
|
||||
}
|
||||
|
||||
public static string CreateAccount(string userName, string password)
|
||||
@@ -114,7 +114,7 @@ namespace MileageTraker.Web.Membership
|
||||
|
||||
public static string CreateAccount(string userName, string password, bool requireConfirmationToken = false)
|
||||
{
|
||||
var codeFirstMembership = System.Web.Security.Membership.Provider as CodeFirstMembershipProvider;
|
||||
var codeFirstMembership = (CodeFirstMembershipProvider)System.Web.Security.Membership.Provider;
|
||||
return codeFirstMembership.CreateAccount(userName, password, requireConfirmationToken);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace MileageTraker.Web.Membership
|
||||
private static string CreateUserAndAccount(string userName, string password, object propertyValues = null,
|
||||
bool requireConfirmationToken = false)
|
||||
{
|
||||
var codeFirstMembership = System.Web.Security.Membership.Provider as CodeFirstMembershipProvider;
|
||||
var codeFirstMembership = (CodeFirstMembershipProvider)System.Web.Security.Membership.Provider;
|
||||
|
||||
//IDictionary<string, object> values = null;
|
||||
//if (propertyValues != null)
|
||||
@@ -171,6 +171,5 @@ namespace MileageTraker.Web.Membership
|
||||
return
|
||||
System.Web.Security.Membership.GetAllUsers(pageIndex, pageSize, out totalRecords).Cast<MembershipUser>().ToList();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.Attributes;
|
||||
using MileageTraker.Web.DAL;
|
||||
using MileageTraker.Web.Utility;
|
||||
|
||||
|
||||
+25
-1
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace MileageTraker.Web.Models
|
||||
@@ -8,11 +9,16 @@ namespace MileageTraker.Web.Models
|
||||
public class User
|
||||
{
|
||||
[Key]
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public virtual Guid UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Email")]
|
||||
[DataType(DataType.EmailAddress)]
|
||||
public virtual String Username { get; set; }
|
||||
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
[DataType(DataType.EmailAddress)]
|
||||
public virtual String Email { get; set; }
|
||||
|
||||
[Required, DataType(DataType.Password)]
|
||||
@@ -24,21 +30,39 @@ namespace MileageTraker.Web.Models
|
||||
[DataType(DataType.MultilineText)]
|
||||
public virtual String Comment { get; set; }
|
||||
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public virtual Boolean IsApproved { get; set; }
|
||||
|
||||
[HiddenInput]
|
||||
public virtual int PasswordFailuresSinceLastSuccess { get; set; }
|
||||
|
||||
public virtual DateTime? LastPasswordFailureDate { get; set; }
|
||||
public virtual DateTime? LastActivityDate { get; set; }
|
||||
public virtual DateTime? LastLockoutDate { get; set; }
|
||||
public virtual DateTime? LastLoginDate { get; set; }
|
||||
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public virtual String ConfirmationToken { get; set; }
|
||||
|
||||
[HiddenInput]
|
||||
public virtual DateTime? CreateDate { get; set; }
|
||||
|
||||
[HiddenInput]
|
||||
public virtual Boolean IsLockedOut { get; set; }
|
||||
|
||||
[HiddenInput]
|
||||
public virtual DateTime? LastPasswordChangedDate { get; set; }
|
||||
|
||||
// TODO: change to Password Reset Token
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public virtual String PasswordVerificationToken { get; set; }
|
||||
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public virtual DateTime? PasswordVerificationTokenExpirationDate { get; set; }
|
||||
|
||||
[HiddenInput]
|
||||
public virtual ICollection<Role> Roles { get; set; }
|
||||
|
||||
|
||||
public MembershipUser CloneToMembershipUser(string providerName)
|
||||
{
|
||||
return new MembershipUser(providerName, Username, UserId,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MileageTraker.Web.Attributes;
|
||||
using MileageTraker.Web.Utility;
|
||||
|
||||
namespace MileageTraker.Web.Models
|
||||
|
||||
@@ -15,7 +15,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
<ObjectGroup Name="MileageTrakerContext" Order="1" Enabled="True">
|
||||
<Destination Path="Data Source=mileage;Initial Catalog=MileageTraker;User ID=MileageTrakerUser;Password=qwerty;Connect Timeout=60" Name="Data Source=mileage;Initial Catalog=MileageTraker;User Id=MileageTrakerUser;Password=qwerty;Connect Timeout=60" />
|
||||
<Object Type="DbCodeFirst">
|
||||
<Source Path="DBMigration" DbContext="MileageTraker.Web.Models.MileageTrakerContext, MileageTraker" MigrationConfiguration="MileageTraker.Web.Migrations.Configuration, MileageTraker" Origin="Configuration" />
|
||||
<Source Path="DBMigration" DbContext="MileageTraker.Web.Context.MileageTrakerContext, MileageTraker" MigrationConfiguration="MileageTraker.Web.Migrations.Configuration, MileageTraker" Origin="Configuration" />
|
||||
</Object>
|
||||
</ObjectGroup>
|
||||
</Objects>
|
||||
|
||||
@@ -48,7 +48,7 @@ $(function () {
|
||||
});
|
||||
});
|
||||
|
||||
$(".miles-unknown").addClass('ui-state-error').append(' <span class="muted">▴</span>')
|
||||
$(".miles-unknown").addClass('label label-warning').append(' <span class="muted">▴</span>')
|
||||
.each(function () {
|
||||
$(this).qtip({
|
||||
content: "No previous log for this vehicle",
|
||||
|
||||
@@ -2,10 +2,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using MileageTraker.Web.Models;
|
||||
|
||||
namespace MileageTraker.Web.Utility
|
||||
{
|
||||
@@ -13,7 +13,10 @@ namespace MileageTraker.Web.Utility
|
||||
{
|
||||
public static string Wordify(this string str)
|
||||
{
|
||||
return str.Aggregate(string.Empty, (current, c) => current + (char.IsUpper(c) ? " " + c : c.ToString()));
|
||||
return str.Aggregate(
|
||||
String.Empty,
|
||||
(current, c) =>
|
||||
current + (Char.IsUpper(c) ? " " + c : c.ToString()));
|
||||
}
|
||||
|
||||
private static T GetAttribute<T>(this Enum enumeration) where T : Attribute
|
||||
@@ -48,13 +51,14 @@ namespace MileageTraker.Web.Utility
|
||||
public static IEnumerable<SelectListItem> GetSelectListItems(this Enum enumeration)
|
||||
{
|
||||
var type = enumeration.GetType();
|
||||
return Enum.GetValues(type).OfType<Enum>().Select(e =>
|
||||
new SelectListItem
|
||||
{
|
||||
Text = e.GetDisplayName(),
|
||||
Value = e.ToString(),
|
||||
Selected = e.Equals(enumeration)
|
||||
});
|
||||
return Enum.GetValues(type)
|
||||
.OfType<Enum>().Select(e =>
|
||||
new SelectListItem
|
||||
{
|
||||
Text = e.GetDisplayName(),
|
||||
Value = e.ToString(),
|
||||
Selected = e.Equals(enumeration)
|
||||
});
|
||||
}
|
||||
|
||||
public static IEnumerable<SelectListItem> ToSelectList(this Type enumType, string selectedItem, string noItemSelected)
|
||||
@@ -148,12 +152,12 @@ namespace MileageTraker.Web.Utility
|
||||
public static string LowercaseFirst(string s)
|
||||
{
|
||||
// Check for empty string.
|
||||
if (string.IsNullOrEmpty(s))
|
||||
if (String.IsNullOrEmpty(s))
|
||||
{
|
||||
return string.Empty;
|
||||
return String.Empty;
|
||||
}
|
||||
// Return char and concat substring.
|
||||
return char.ToLower(s[0]) + s.Substring(1);
|
||||
return Char.ToLower(s[0]) + s.Substring(1);
|
||||
}
|
||||
|
||||
public static IEnumerable<int> GetNumbers()
|
||||
@@ -161,15 +165,22 @@ namespace MileageTraker.Web.Utility
|
||||
var i = 0;
|
||||
while (true) yield return i++;
|
||||
}
|
||||
|
||||
public static MvcHtmlString Concat(this MvcHtmlString f, MvcHtmlString s)
|
||||
{
|
||||
return MvcHtmlString.Create(f.ToString() + s);
|
||||
}
|
||||
|
||||
public static MvcHtmlString Concat(this MvcHtmlString f, string s)
|
||||
/// <summary>
|
||||
/// Users with activity date greater than this value are online
|
||||
/// </summary>
|
||||
public static DateTime UserOnlineThreshold()
|
||||
{
|
||||
return MvcHtmlString.Create(f + s);
|
||||
return DateTime.UtcNow.Subtract(
|
||||
TimeSpan.FromMinutes(
|
||||
Convert.ToDouble(
|
||||
System.Web.Security.Membership.UserIsOnlineTimeWindow)));
|
||||
}
|
||||
|
||||
public static bool IsOnline(this User user)
|
||||
{
|
||||
return user.LastActivityDate != null
|
||||
&& user.LastActivityDate > UserOnlineThreshold();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace MileageTraker.Web.Utility
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class FormatHintAttribute : Attribute
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
|
||||
public FormatHintAttribute(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class UnitsAttribute : Attribute
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
|
||||
public UnitsAttribute(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class InputSizeAttribute : Attribute
|
||||
{
|
||||
public string Size { get; private set; }
|
||||
|
||||
public string ClassName { get { return "input-" + Size.ToLower(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Specify width of input element
|
||||
/// </summary>
|
||||
/// <param name="size">mini, small, medium, large, xlarge, xxlarge</param>
|
||||
public InputSizeAttribute(string size)
|
||||
{
|
||||
Size = size;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class NoEditLabelAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MileageTraker.Web.Attributes;
|
||||
using MileageTraker.Web.Utility;
|
||||
|
||||
namespace MileageTraker.Web.ViewModels.Account
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Mvc;
|
||||
using AutoMapper;
|
||||
using MileageTraker.Web.Attributes;
|
||||
using MileageTraker.Web.DAL;
|
||||
using MileageTraker.Web.Models;
|
||||
using MileageTraker.Web.Utility;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Mvc;
|
||||
using AutoMapper;
|
||||
|
||||
namespace MileageTraker.Web.ViewModels.User
|
||||
{
|
||||
public class CreateUserViewModel
|
||||
{
|
||||
[Required]
|
||||
[DataType(DataType.EmailAddress)]
|
||||
[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", ErrorMessage = "Must be an email address")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(50, MinimumLength = 2)]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(50, MinimumLength = 2)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
public MultiSelectList Roles { get; set; }
|
||||
|
||||
static CreateUserViewModel()
|
||||
{
|
||||
Mapper.CreateMap<CreateUserViewModel, Models.User>();
|
||||
}
|
||||
|
||||
public Models.User CloneToUser()
|
||||
{
|
||||
var user = new Models.User();
|
||||
Mapper.Map(this, user);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace MileageTraker.Web.ViewModels.User
|
||||
{
|
||||
public class UserDetailsViewModel
|
||||
{
|
||||
public string Username { get; set; }
|
||||
|
||||
public string FirstName { get; set; }
|
||||
|
||||
public string LastName { get; set; }
|
||||
|
||||
public string[] Roles { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = @"{0:MM/dd/yyyy}")]
|
||||
public DateTime LastActivityDate { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = @"{0:MM/dd/yyyy}")]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
public bool IsLockedOut { get; set; }
|
||||
|
||||
[DisplayFormat(DataFormatString = @"{0:MM/dd/yyyy}")]
|
||||
public DateTime LastLockoutDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,6 @@
|
||||
ViewBag.Title = "Log in";
|
||||
Layout = "~/Views/Shared/_Layout.login.cshtml";
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
<link href="@Url.Content("~/Content/Account.Login.css")" rel="stylesheet" type="text/css" />
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Manage Account";
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
<h2>@ViewBag.Title</h2>
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Confirm";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
|
||||
@@ -2,17 +2,6 @@
|
||||
@{
|
||||
|
||||
ViewBag.Title = "Enter Mileage Log";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@using (Html.BeginForm("Index", "CreateLog", FormMethod.Post, new { @class = "form-horizontal" }))
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
@{
|
||||
|
||||
ViewBag.Title = "Success";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
@{
|
||||
|
||||
@@ -3,16 +3,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Create Log";
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToLogs"); }
|
||||
|
||||
|
||||
@@ -3,16 +3,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Edit Log";
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToLogs"); }
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using MileageTraker.Web.Utility
|
||||
@using MileageTraker.Web.ViewModels
|
||||
@model MileageTraker.Web.ViewModels.Log.LogResultsViewModel
|
||||
|
||||
@{
|
||||
@@ -7,13 +6,8 @@
|
||||
var grid = new WebGrid(Model.Logs, rowsPerPage: 45);
|
||||
}
|
||||
@section Styles {
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/VehicleColors.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
<h2 id="log-title">@ViewBag.Title</h2>
|
||||
|
||||
@@ -61,13 +55,12 @@
|
||||
grid.Column("Date", format: item => item.Date.ToString("d")),
|
||||
grid.Column("CityName", "City Name"),
|
||||
grid.Column("EmployeeName", "Employee Name"),
|
||||
grid.Column(format: item =>
|
||||
(new MvcHtmlString("<div class='btn-group'>"))
|
||||
.Concat(Html.ActionLink("Edit", "Edit", new { id = item.LogId }, new { @class = "btn btn-mini" }))
|
||||
.Concat(Html.ActionLink("Details", "Details", new { id = item.LogId }, new { @class = "btn btn-mini" }))
|
||||
.Concat(Html.ActionLink("Delete", "Delete", new { id = item.LogId }, new { @class = "btn btn-mini" }))
|
||||
.Concat("</div>")
|
||||
)
|
||||
grid.Column(format:
|
||||
@<div class='btn-group'>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.LogId }, new { @class = "btn btn-mini" })
|
||||
@Html.ActionLink("Details", "Details", new { id = item.LogId }, new { @class = "btn btn-mini" })
|
||||
@Html.ActionLink("Delete", "Delete", new { id = item.LogId }, new { @class = "btn btn-mini" })
|
||||
</div>)
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
|
||||
numericLinksCount: 20
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
else
|
||||
{
|
||||
<td colspan="2">
|
||||
<span class="ui-state-error">?</span>
|
||||
<span class="label label-warning">?</span>
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Employee Mileage Report";
|
||||
}
|
||||
@section Styles {
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToLogs"); }
|
||||
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Vehicle Mileage Report";
|
||||
}
|
||||
@section Styles {
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToLogs"); }
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@Html.Encode(Model)
|
||||
@@ -1,5 +1,10 @@
|
||||
@model DateTime
|
||||
@using System.Globalization
|
||||
@model DateTime
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
var val =
|
||||
ViewData.ModelMetadata.DisplayFormatString != null
|
||||
?string.Format(ViewData.ModelMetadata.DisplayFormatString, Model)
|
||||
: Model.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
@Html.Encode(string.Format(ViewData.ModelMetadata.DisplayFormatString, Model))
|
||||
@Html.Encode(val)
|
||||
@@ -1,5 +1,10 @@
|
||||
@model DateTime
|
||||
@using System.Globalization
|
||||
@model DateTime
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
var val =
|
||||
ViewData.ModelMetadata.DisplayFormatString != null
|
||||
?string.Format(ViewData.ModelMetadata.DisplayFormatString, Model)
|
||||
: Model.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
@Html.Encode(string.Format(ViewData.ModelMetadata.DisplayFormatString, Model))
|
||||
@Html.Encode(val)
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
<a href="mailto:@Model">@Html.Encode(Model)</a>
|
||||
@@ -0,0 +1,12 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@Html.TextArea("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
@@ -2,7 +2,18 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.ModelType.IsCollection()))
|
||||
|
||||
@foreach (var prop in ViewData.ModelMetadata.Properties)
|
||||
{
|
||||
@Html.Editor(prop.PropertyName)
|
||||
if (prop.ShowForEdit)
|
||||
{
|
||||
if (!prop.ModelType.IsCollection())
|
||||
{
|
||||
@Html.Editor(prop.PropertyName)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Error";
|
||||
if (Model.ControllerName == "CreateLog")
|
||||
{
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
}
|
||||
|
||||
<h2>
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mileage Traker - ETHRA - @ViewBag.Title</title>
|
||||
<link href="@Url.Content("~/Content/themes/custom-theme/jquery-ui-1.9.2.custom.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/bootstrap.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/Site.admin.css")" rel="stylesheet" type="text/css" />
|
||||
@RenderSection("Styles", false)
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||
<div class="navbar-inner">
|
||||
<span class="brand" ></span>
|
||||
<ul class="nav">
|
||||
<li id="log-nav">@Html.ActionLink("Logs", "Index", "Log")</li>
|
||||
<li id="vehicle-nav">@Html.ActionLink("Vehicles", "Index", "Vehicle")</li>
|
||||
<li>@Html.ActionLink("Enter Mileage Log", "Index", "CreateLog")</li>
|
||||
</ul>
|
||||
<section id="account-management">
|
||||
@Html.Partial("_Layout.authentication")
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="container-fluid">
|
||||
@RenderBody()
|
||||
</div>
|
||||
<footer>
|
||||
Mileage Traker © 2012 James Kolpack
|
||||
</footer>
|
||||
|
||||
<script src="@Url.Content("~/Scripts/jquery-1.8.3.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery-ui-1.9.2.custom.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/Shared/Site.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.numeric.js")" type="text/javascript"></script>
|
||||
@RenderSection("Scripts", false)
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
@if (Request.IsAuthenticated) {
|
||||
<ul class="nav pull-right">
|
||||
<li>
|
||||
@Html.ActionLink(User.Identity.Name, "Manage", "Account", null, new { @class = "username", title = "Manage" })
|
||||
</li>
|
||||
<li>
|
||||
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "form-logout" })) {
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn-link logoff">
|
||||
Log Off
|
||||
</button>
|
||||
}
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
@@ -6,28 +6,54 @@
|
||||
<link href="@Url.Content("~/Content/themes/custom-theme/jquery-ui-1.9.2.custom.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/bootstrap.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/bootstrap-responsive.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
|
||||
@RenderSection("Styles", false)
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<div class="navbar navbar-static-top navbar-inverse">
|
||||
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||
<div class="navbar-inner">
|
||||
<span class="brand" ></span>
|
||||
<div class="container-fluid">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<span class="brand"></span>
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
@if (Roles.IsUserInRole(User.Identity.Name, "Administrator")
|
||||
|| Roles.IsUserInRole(User.Identity.Name, "Developer"))
|
||||
{
|
||||
<li id="log-nav">@Html.ActionLink("Logs", "Index", "Log")</li>
|
||||
<li id="vehicle-nav">@Html.ActionLink("Vehicles", "Index", "Vehicle")</li>
|
||||
<li id="user-nav">@Html.ActionLink("Users", "Index", "User")</li>
|
||||
}
|
||||
<li>@Html.ActionLink("Enter Log", "Index", "CreateLog")</li>
|
||||
</ul>
|
||||
<section id="account-management">
|
||||
@Html.Partial("_NavAccountInfo")
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container-fluid">
|
||||
@RenderBody()
|
||||
</div>
|
||||
<footer>
|
||||
Mileage Traker © 2012 James Kolpack
|
||||
</footer>
|
||||
|
||||
<script src="@Url.Content("~/Scripts/jquery-1.8.3.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.numeric.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery-ui-1.9.2.custom.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.numeric.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/Shared/Site.js")" type="text/javascript"></script>
|
||||
@RenderSection("Scripts", false)
|
||||
</body>
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.numeric.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery-ui-1.9.2.custom.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/Shared/Site.js")" type="text/javascript"></script>
|
||||
@RenderSection("Scripts", false)
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<ul class="nav pull-right">
|
||||
@if (Request.IsAuthenticated)
|
||||
{
|
||||
<li>
|
||||
@Html.ActionLink(User.Identity.Name, "Manage", "Account", null, new {@class = "username", title = "Manage"})
|
||||
</li>
|
||||
<li>
|
||||
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new {id = "form-logout"}))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn-link">
|
||||
Log Off
|
||||
</button>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li>
|
||||
@Html.ActionLink("Login", "Login", "Account", null, new {title = "Login"})
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@@ -0,0 +1,5 @@
|
||||
<ul class="no-print breadcrumb">
|
||||
<li>
|
||||
<a href="@Url.Action("Index", "User")">← Back to Users</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,22 @@
|
||||
@model MileageTraker.Web.ViewModels.User.CreateUserViewModel
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create User";
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToUsers"); }
|
||||
|
||||
<h2>@ViewBag.Title</h2>
|
||||
|
||||
@using (Html.BeginForm("Create", "User", FormMethod.Post, new { @class = "form-horizontal" })) {
|
||||
@Html.Partial("_ValidationSummary")
|
||||
<fieldset>
|
||||
<legend></legend>
|
||||
@Html.EditorForModel()
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<input type="submit" value="Create" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
@model MileageTraker.Web.Models.User
|
||||
|
||||
@{
|
||||
ViewBag.Title = "User Details";
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToUsers"); }
|
||||
|
||||
<h2>@ViewBag.Title</h2>
|
||||
|
||||
@Html.DisplayFor(m => m.Username)
|
||||
@Html.DisplayFor(m => m.FirstName)
|
||||
@Html.DisplayFor(m => m.LastName)
|
||||
|
||||
<dl class="dl-horizontal roles">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(m => m.Roles)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.Encode(string.Join(", ", Roles.Provider.GetRolesForUser(Model.Username)))
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@Html.DisplayFor(m => m.IsLockedOut)
|
||||
@if (Model.IsLockedOut) {
|
||||
@Html.DisplayFor(m => m.LastLockoutDate)
|
||||
}
|
||||
|
||||
<div class="btn-toolbar">
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.UserId }, new { @class = "btn" })
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
@model MileageTraker.Web.Models.User
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit User";
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToUsers"); }
|
||||
|
||||
<h2>@ViewBag.Title</h2>
|
||||
|
||||
@using (Html.BeginForm("Edit", "User", FormMethod.Post, new { @class = "form-horizontal" }))
|
||||
{
|
||||
@Html.Partial("_ValidationSummary")
|
||||
|
||||
<fieldset>
|
||||
<legend></legend>
|
||||
|
||||
@Html.EditorForModel()
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<input type="submit" value="Save" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
@using MileageTraker.Web.Utility
|
||||
@model IEnumerable<MileageTraker.Web.Models.User>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Users";
|
||||
var grid = new WebGrid(Model, rowsPerPage: 45);
|
||||
}
|
||||
|
||||
<h2 id="user-title">@ViewBag.Title</h2>
|
||||
|
||||
<div class="btn-toolbar pull-left">
|
||||
@Html.ActionLink("Add new User", "Create", null, new{@class="btn"})
|
||||
|
||||
</div>
|
||||
|
||||
<div id="users-online">Users online now: <span class="badge badge-info">@Membership.GetNumberOfUsersOnline()</span></div>
|
||||
|
||||
@grid.GetHtml(columns:
|
||||
grid.Columns(
|
||||
grid.Column("Username", format:
|
||||
@<text>@Html.Encode(item.Username)
|
||||
@if (item.LastActivityDate > CustomExtensions.UserOnlineThreshold()) {
|
||||
<span class='label label-info'>Online</span>
|
||||
}
|
||||
@if (item.IsLockedOut) {
|
||||
<span class='label label-warning' title="@string.Format("Locked out on {0:d}", item.LastLockoutDate)">Locked Out</span>
|
||||
}</text> ),
|
||||
grid.Column("FirstName", "First Name"),
|
||||
grid.Column("LastName", "Last Name"),
|
||||
grid.Column("Roles", format: item =>
|
||||
string.Join(", ", Roles.Provider.GetRolesForUser(item.Username) )),
|
||||
grid.Column(format:
|
||||
@<div class='btn-group'>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.UserId }, new { @class = "btn btn-mini" })
|
||||
@Html.ActionLink("Details", "Details", new { id = item.UserId }, new { @class = "btn btn-mini" })
|
||||
</div>)
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
|
||||
numericLinksCount: 20
|
||||
)
|
||||
@@ -3,16 +3,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Create Vehicle";
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToVehicles"); }
|
||||
|
||||
@@ -22,7 +12,7 @@
|
||||
{
|
||||
@Html.Partial("_ValidationSummary")
|
||||
<fieldset>
|
||||
<label></label>
|
||||
<legend></legend>
|
||||
@Html.EditorForModel()
|
||||
|
||||
<div class="control-group">
|
||||
|
||||
@@ -3,16 +3,6 @@
|
||||
@{
|
||||
ViewBag.Title = "Edit Vehicle";
|
||||
}
|
||||
@section Styles
|
||||
{
|
||||
<link href="@Url.Content("~/Content/jquery.qtip.min.css")" rel="stylesheet" type="text/css" />
|
||||
}
|
||||
@section Scripts
|
||||
{
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
|
||||
<script src="@Url.Content("~/Scripts/jquery.qtip.min.js")" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@{ Html.RenderPartial("BackToVehicles"); }
|
||||
|
||||
@@ -22,7 +12,7 @@
|
||||
{
|
||||
@Html.Partial("_ValidationSummary")
|
||||
<fieldset>
|
||||
<label></label>
|
||||
<legend></legend>
|
||||
@Html.EditorForModel()
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using MileageTraker.Web.Utility
|
||||
@model IEnumerable<MileageTraker.Web.Models.Vehicle>
|
||||
@model IEnumerable<MileageTraker.Web.Models.Vehicle>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Vehicles";
|
||||
@@ -12,7 +11,7 @@
|
||||
<h2 id="vehicle-title">@ViewBag.Title</h2>
|
||||
|
||||
<div class="btn-toolbar">
|
||||
@Html.ActionLink("Add another vehicle", "Create", null, new{@class="btn"})
|
||||
@Html.ActionLink("Add Another Vehicle", "Create", null, new{@class="btn"})
|
||||
@Html.ActionLink("Export", "Export", null, new { @class = "btn" })
|
||||
</div>
|
||||
<table class="table table-striped table-bordered table-hover table-condensed">
|
||||
@@ -87,11 +86,10 @@
|
||||
@Html.DisplayTextFor(m => item.CurrentOdometer)
|
||||
</td>
|
||||
<td>
|
||||
@(new MvcHtmlString("<div class='btn-group'>")
|
||||
.Concat(Html.ActionLink("Edit", "Edit", new { id = item.VehicleId }, new { @class = "btn btn-mini" }))
|
||||
.Concat(Html.ActionLink("Details", "Details", new { id = item.VehicleId }, new { @class = "btn btn-mini" }))
|
||||
//.Concat(Html.ActionLink("New log", "Create", new { id = item.VehicleId }, new { @class = "btn btn-mini" }))
|
||||
.Concat("</div>"))
|
||||
<div class='btn-group'>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.VehicleId }, new { @class = "btn btn-mini" })
|
||||
@Html.ActionLink("Details", "Details", new { id = item.VehicleId }, new { @class = "btn btn-mini" })
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/_Layout.admin.cshtml";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
+29
-17
@@ -44,9 +44,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AutoMapper, Version=2.1.267.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<Reference Include="AutoMapper, Version=2.2.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\AutoMapper.2.1.267\lib\net40\AutoMapper.dll</HintPath>
|
||||
<HintPath>..\packages\AutoMapper.2.2.0\lib\net40\AutoMapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -64,9 +64,6 @@
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoreLinq, Version=1.0.11522.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\morelinq.1.0\lib\net35\MoreLinq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Data.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
@@ -107,11 +104,20 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Attributes\ActionLogAttribute.cs" />
|
||||
<Compile Include="Attributes\DenyFutureDateAttribute.cs" />
|
||||
<Compile Include="Attributes\DenyPreviousMonthDateAttribute.cs" />
|
||||
<Compile Include="Attributes\FormatHintAttribute.cs" />
|
||||
<Compile Include="Attributes\HttpParamActionAttribute.cs" />
|
||||
<Compile Include="Attributes\InputSizeAttribute.cs" />
|
||||
<Compile Include="Attributes\NoEditLabelAttribute.cs" />
|
||||
<Compile Include="Attributes\UnitsAttribute.cs" />
|
||||
<Compile Include="Context\MileageTrakerContext.cs" />
|
||||
<Compile Include="Controllers\AccountController.cs" />
|
||||
<Compile Include="Controllers\CityController.cs" />
|
||||
<Compile Include="Controllers\ControllerBase.cs" />
|
||||
<Compile Include="Controllers\EmployeeController.cs" />
|
||||
<Compile Include="Controllers\UserController.cs" />
|
||||
<Compile Include="Membership\CodeFirstMembershipProvider.cs" />
|
||||
<Compile Include="Membership\CodeFirstRoleProvider.cs" />
|
||||
<Compile Include="Membership\Crypto.cs" />
|
||||
@@ -131,8 +137,6 @@
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Models\Role.cs" />
|
||||
<Compile Include="Models\User.cs" />
|
||||
<Compile Include="Utility\ActionLogAttribute.cs" />
|
||||
<Compile Include="Utility\HttpParamActionAttribute.cs" />
|
||||
<Compile Include="ViewModels\Account\ChangePasswordViewModel.cs" />
|
||||
<Compile Include="ViewModels\Account\LoginViewModel.cs" />
|
||||
<Compile Include="ViewModels\Account\RegisterModel.cs" />
|
||||
@@ -140,10 +144,11 @@
|
||||
<Compile Include="ViewModels\EmployeeMileageViewModel.cs" />
|
||||
<Compile Include="ViewModels\Log\LogIndexViewModel.cs" />
|
||||
<Compile Include="ViewModels\Log\LogPartialDetails.cs" />
|
||||
<Compile Include="ViewModels\User\CreateUserViewModel.cs" />
|
||||
<Compile Include="ViewModels\User\UserDetailsViewModel.cs" />
|
||||
<Compile Include="ViewModels\Vehicle\VehicleMileageViewModel.cs" />
|
||||
<Compile Include="ViewModels\Vehicle\VehiclePartialDetails.cs" />
|
||||
<Compile Include="ViewModels\Vehicle\VehicleMileageItem.cs" />
|
||||
<Compile Include="Utility\FormatHintAttribute.cs" />
|
||||
<Compile Include="DAL\ChronologicalOrderException.cs" />
|
||||
<Compile Include="DAL\DataService.cs" />
|
||||
<Compile Include="Controllers\CreateLogController.cs" />
|
||||
@@ -166,8 +171,6 @@
|
||||
<Compile Include="Utility\TitleCaseFormatter.cs" />
|
||||
<Compile Include="ViewModels\CreateLog\ConfirmCreateLogViewModel.cs" />
|
||||
<Compile Include="ViewModels\CreateLog\CreateLogViewModel.cs" />
|
||||
<Compile Include="Utility\DenyFutureDateAttribute.cs" />
|
||||
<Compile Include="Utility\DenyPreviousMonthDateAttribute.cs" />
|
||||
<Compile Include="ViewModels\Log\LogQueryViewModel.cs" />
|
||||
<Compile Include="ViewModels\Log\LogResultsViewModel.cs" />
|
||||
</ItemGroup>
|
||||
@@ -178,6 +181,7 @@
|
||||
<Content Include="Content\bootstrap.css" />
|
||||
<Content Include="Content\bootstrap.min.css" />
|
||||
<Content Include="Content\CreateLog.Index.css" />
|
||||
<Content Include="Content\images\Header.login.mobile.png" />
|
||||
<Content Include="Content\images\glyphicons-halflings-white.png" />
|
||||
<Content Include="Content\images\glyphicons-halflings.png" />
|
||||
<Content Include="Content\images\glyphicons_005_car.png" />
|
||||
@@ -185,11 +189,11 @@
|
||||
<Content Include="Content\images\glyphicons_005_car_half_white.png" />
|
||||
<Content Include="Content\images\glyphicons_026_road.png" />
|
||||
<Content Include="Content\images\Header.login.png" />
|
||||
<Content Include="Content\images\Header.mobile.png" />
|
||||
<Content Include="Content\images\Header.png" />
|
||||
<Content Include="Content\jquery.qtip.min.css" />
|
||||
<Content Include="Content\images\Rainbow.png" />
|
||||
<Content Include="Content\images\spinner.gif" />
|
||||
<Content Include="Content\Site.admin.css" />
|
||||
<Content Include="Content\Site.css" />
|
||||
<Content Include="Content\themes\custom-theme\images\ui-bg_flat_0_aaaaaa_40x100.png" />
|
||||
<Content Include="Content\themes\custom-theme\images\ui-bg_flat_55_fbec88_40x100.png" />
|
||||
@@ -241,7 +245,7 @@
|
||||
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
|
||||
<Content Include="Views\_ViewStart.cshtml" />
|
||||
<Content Include="Views\Shared\Error.cshtml" />
|
||||
<Content Include="Views\Shared\_Layout.admin.cshtml" />
|
||||
<Content Include="Views\Shared\_Layout.cshtml" />
|
||||
<Content Include="Views\Web.config" />
|
||||
<Content Include="Views\Log\BackToLogs.cshtml" />
|
||||
<Content Include="Views\Vehicle\BackToVehicles.cshtml" />
|
||||
@@ -255,11 +259,22 @@
|
||||
<Content Include="Views\Shared\EditorTemplates\Password.cshtml" />
|
||||
<Content Include="Views\Shared\EditorTemplates\Boolean.cshtml" />
|
||||
<Content Include="Views\Shared\_Layout.login.cshtml" />
|
||||
<Content Include="Views\Shared\_Layout.authentication.cshtml" />
|
||||
<Content Include="Views\Shared\_NavAccountInfo.cshtml" />
|
||||
<Content Include="Views\Shared\_ValidationSummary.cshtml" />
|
||||
<Content Include="Views\User\Index.cshtml" />
|
||||
<Content Include="Views\User\Details.cshtml" />
|
||||
<Content Include="Views\User\Create.cshtml" />
|
||||
<Content Include="Views\User\Edit.cshtml" />
|
||||
<Content Include="Views\User\BackToUsers.cshtml" />
|
||||
<Content Include="Views\Shared\EditorTemplates\MultilineText.cshtml" />
|
||||
<Content Include="Views\Shared\EditorTemplates\EmailAddress.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\EmailAddress.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\Boolean.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="packages.config" />
|
||||
<Content Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Shared\EditorTemplates\DateTime.cshtml" />
|
||||
@@ -272,9 +287,6 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Log\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Shared\_Layout.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Vehicle\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AutoMapper" version="2.1.267" />
|
||||
<package id="AutoMapper" version="2.2.0" targetFramework="net40" />
|
||||
<package id="EntityFramework" version="4.3.1" />
|
||||
<package id="ExcelLibrary" version="1.2011.7.30" />
|
||||
<package id="jQuery" version="1.8.3" targetFramework="net40" />
|
||||
@@ -11,6 +11,5 @@
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.20715.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net40" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
|
||||
<package id="morelinq" version="1.0" />
|
||||
<package id="Twitter.Bootstrap" version="2.2.2" targetFramework="net40" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user