Add service reminder migration Add Completed Service button to vehicle
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
namespace MileageTraker.Web.Attributes
|
||||||
|
{
|
||||||
|
public class RequireRequestValueAttribute : ActionMethodSelectorAttribute
|
||||||
|
{
|
||||||
|
public RequireRequestValueAttribute(string valueName)
|
||||||
|
{
|
||||||
|
ValueName = valueName;
|
||||||
|
}
|
||||||
|
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
|
||||||
|
{
|
||||||
|
return (controllerContext.HttpContext.Request[ValueName] != null);
|
||||||
|
}
|
||||||
|
public string ValueName { get; private set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ namespace MileageTraker.Web.Context
|
|||||||
public DbSet<PurposeType> PurposeTypes { get; set; }
|
public DbSet<PurposeType> PurposeTypes { get; set; }
|
||||||
public DbSet<FuelLog> FuelLogs { get; set; }
|
public DbSet<FuelLog> FuelLogs { get; set; }
|
||||||
public DbSet<VehicleService> VehicleServices { get; set; }
|
public DbSet<VehicleService> VehicleServices { get; set; }
|
||||||
|
public DbSet<ServiceReminder> ServiceReminders { get; set; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WebSecurity.Register("Demo", "123456", "demo@demo.com", true, "Demo", "Demo");
|
* WebSecurity.Register("Demo", "123456", "demo@demo.com", true, "Demo", "Demo");
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace MileageTraker.Web.Controllers
|
|||||||
[ActionLog]
|
[ActionLog]
|
||||||
public ActionResult Export(FuelLogQueryViewModel query)
|
public ActionResult Export(FuelLogQueryViewModel query)
|
||||||
{
|
{
|
||||||
|
query.Unmatched = false; // override unmatched for export, export them all!
|
||||||
var validLogYearMonths = DataService.GetValidFuelLogMonths();
|
var validLogYearMonths = DataService.GetValidFuelLogMonths();
|
||||||
|
|
||||||
// default parameter processing
|
// default parameter processing
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ namespace MileageTraker.Web.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RequireRequestValue("vehicleId")]
|
||||||
|
public ActionResult Create(string vehicleId)
|
||||||
|
{
|
||||||
|
return View(new VehicleServiceViewModel{VehicleId = vehicleId});
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ActionLog]
|
[ActionLog]
|
||||||
public ActionResult Create(VehicleServiceViewModel viewModel)
|
public ActionResult Create(VehicleServiceViewModel viewModel)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.Entity;
|
using System.Data.Entity;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
namespace MileageTraker.Web.Migrations
|
||||||
|
{
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
using System.Data.Entity.Migrations.Infrastructure;
|
||||||
|
using System.Resources;
|
||||||
|
|
||||||
|
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
|
||||||
|
public sealed partial class ServiceReminder : IMigrationMetadata
|
||||||
|
{
|
||||||
|
private readonly ResourceManager Resources = new ResourceManager(typeof(ServiceReminder));
|
||||||
|
|
||||||
|
string IMigrationMetadata.Id
|
||||||
|
{
|
||||||
|
get { return "201510150220550_ServiceReminder"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Source
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMigrationMetadata.Target
|
||||||
|
{
|
||||||
|
get { return Resources.GetString("Target"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
namespace MileageTraker.Web.Migrations
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
|
||||||
|
public partial class ServiceReminder : DbMigration
|
||||||
|
{
|
||||||
|
public override void Up()
|
||||||
|
{
|
||||||
|
CreateTable(
|
||||||
|
"dbo.ServiceReminder",
|
||||||
|
c => new
|
||||||
|
{
|
||||||
|
ServiceReminderId = c.Int(nullable: false, identity: true),
|
||||||
|
TargetOdometer = c.Int(nullable: false),
|
||||||
|
Description = c.String(maxLength: 64),
|
||||||
|
Vehicle_VehicleId = c.String(nullable: false, maxLength: 6),
|
||||||
|
})
|
||||||
|
.PrimaryKey(t => t.ServiceReminderId)
|
||||||
|
.ForeignKey("dbo.Vehicle", t => t.Vehicle_VehicleId, cascadeDelete: true)
|
||||||
|
.Index(t => t.Vehicle_VehicleId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Down()
|
||||||
|
{
|
||||||
|
DropForeignKey("dbo.ServiceReminder", "Vehicle_VehicleId", "dbo.Vehicle");
|
||||||
|
DropIndex("dbo.ServiceReminder", new[] { "Vehicle_VehicleId" });
|
||||||
|
DropTable("dbo.ServiceReminder");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using MileageTraker.Web.Attributes;
|
||||||
|
|
||||||
|
namespace MileageTraker.Web.Models
|
||||||
|
{
|
||||||
|
public class ServiceReminder
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int ServiceReminderId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public virtual Vehicle Vehicle { get; set; }
|
||||||
|
|
||||||
|
[InputSize("small")]
|
||||||
|
public int TargetOdometer { get; set; }
|
||||||
|
|
||||||
|
[StringLength(64)]
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,5 +88,7 @@ namespace MileageTraker.Web.Models
|
|||||||
public int? CurrentOdometer { get; set; }
|
public int? CurrentOdometer { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Log> Logs { get; set; }
|
public virtual ICollection<Log> Logs { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<ServiceReminder> ServiceReminders { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,5 +28,6 @@
|
|||||||
{
|
{
|
||||||
@Html.ActionLink("Reactivate", "SetActive", new {id = Model.VehicleId}, new {@class = "btn"})
|
@Html.ActionLink("Reactivate", "SetActive", new {id = Model.VehicleId}, new {@class = "btn"})
|
||||||
}
|
}
|
||||||
|
@Html.ActionLink("Add Completed Service", "Create", "VehicleService", new { VehicleId = Model.VehicleId }, new { @class = "btn" })
|
||||||
@Html.ActionLink("Logs", "Index", "Log", new { Model.VehicleId}, new { @class = "btn" })
|
@Html.ActionLink("Logs", "Index", "Log", new { Model.VehicleId}, new { @class = "btn" })
|
||||||
</div>
|
</div>
|
||||||
@@ -130,6 +130,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Attributes\ActionLogAttribute.cs" />
|
<Compile Include="Attributes\ActionLogAttribute.cs" />
|
||||||
|
<Compile Include="Attributes\RequireRequestValueAttribute.cs" />
|
||||||
<Compile Include="Attributes\CurrencyAttribute.cs" />
|
<Compile Include="Attributes\CurrencyAttribute.cs" />
|
||||||
<Compile Include="Attributes\DenyFutureDateAttribute.cs" />
|
<Compile Include="Attributes\DenyFutureDateAttribute.cs" />
|
||||||
<Compile Include="Attributes\DenyPreviousMonthDateAttribute.cs" />
|
<Compile Include="Attributes\DenyPreviousMonthDateAttribute.cs" />
|
||||||
@@ -221,10 +222,15 @@
|
|||||||
<Compile Include="Migrations\201510070326593_VehicleService.Designer.cs">
|
<Compile Include="Migrations\201510070326593_VehicleService.Designer.cs">
|
||||||
<DependentUpon>201510070326593_VehicleService.cs</DependentUpon>
|
<DependentUpon>201510070326593_VehicleService.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Migrations\201510150220550_ServiceReminder.cs" />
|
||||||
|
<Compile Include="Migrations\201510150220550_ServiceReminder.Designer.cs">
|
||||||
|
<DependentUpon>201510150220550_ServiceReminder.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Migrations\Configuration.cs" />
|
<Compile Include="Migrations\Configuration.cs" />
|
||||||
<Compile Include="Models\DomainRules.cs" />
|
<Compile Include="Models\DomainRules.cs" />
|
||||||
<Compile Include="Models\FuelLog.cs" />
|
<Compile Include="Models\FuelLog.cs" />
|
||||||
<Compile Include="Models\PurposeType.cs" />
|
<Compile Include="Models\PurposeType.cs" />
|
||||||
|
<Compile Include="Models\ServiceReminder.cs" />
|
||||||
<Compile Include="Utility\NameNormalizer.cs" />
|
<Compile Include="Utility\NameNormalizer.cs" />
|
||||||
<Compile Include="ViewModels\Account\ResetPasswordViewModel.cs" />
|
<Compile Include="ViewModels\Account\ResetPasswordViewModel.cs" />
|
||||||
<Compile Include="Models\Role.cs" />
|
<Compile Include="Models\Role.cs" />
|
||||||
@@ -571,6 +577,9 @@
|
|||||||
<EmbeddedResource Include="Migrations\201510070326593_VehicleService.resx">
|
<EmbeddedResource Include="Migrations\201510070326593_VehicleService.resx">
|
||||||
<DependentUpon>201510070326593_VehicleService.cs</DependentUpon>
|
<DependentUpon>201510070326593_VehicleService.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Migrations\201510150220550_ServiceReminder.resx">
|
||||||
|
<DependentUpon>201510150220550_ServiceReminder.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
|
|||||||
Reference in New Issue
Block a user