Update: Plugin UI Extensions
Add additional Results; Implemented UI Extensions on Device, Job and User Controllers
This commit is contained in:
@@ -1,114 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.Repository;
|
||||
using System.Data.Objects.SqlClient;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
|
||||
namespace Disco.Web.Controllers
|
||||
{
|
||||
public partial class DeviceController : dbAdminController
|
||||
{
|
||||
#region Index
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Add Offline
|
||||
public virtual ActionResult AddOffline()
|
||||
{
|
||||
var m = new Models.Device.AddOfflineModel()
|
||||
{
|
||||
DefaultDeviceProfileId = dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
|
||||
};
|
||||
m.DeviceBatches = dbContext.DeviceBatches.ToSelectListItems();
|
||||
m.DeviceProfiles = dbContext.DeviceProfiles.ToList();
|
||||
if (m.DefaultDeviceProfileId == 0)
|
||||
{
|
||||
m.DeviceProfiles.Insert(0, new DeviceProfile() { Id = 0, Name = "Select a Device Profile" });
|
||||
}
|
||||
|
||||
return View(m);
|
||||
}
|
||||
[HttpPost]
|
||||
public virtual ActionResult AddOffline(Models.Device.AddOfflineModel m)
|
||||
{
|
||||
// Trim Serial Number & Error Check
|
||||
m.Device.SerialNumber = m.Device.SerialNumber.Trim();
|
||||
if (string.IsNullOrEmpty(m.Device.SerialNumber))
|
||||
{
|
||||
ModelState.AddModelError("Device.SerialNumber", "The Serial Number is Required");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure Existing Device Doesn't Exist
|
||||
if (!string.IsNullOrEmpty(m.Device.SerialNumber) && dbContext.Devices.Count(d => d.SerialNumber == m.Device.SerialNumber) > 0)
|
||||
ModelState.AddModelError("Device.SerialNumber", "A Device what this Serial Number already exists");
|
||||
}
|
||||
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var d = m.Device.AddOffline(dbContext);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Device.Show(d.SerialNumber));
|
||||
}
|
||||
return AddOffline();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Show
|
||||
public virtual ActionResult Show(string id)
|
||||
{
|
||||
var m = new Models.Device.ShowModel();
|
||||
|
||||
dbContext.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
m.Device = dbContext.Devices
|
||||
.Where(d => d.SerialNumber == id)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (m.Device == null)
|
||||
throw new ArgumentException(string.Format("Unknown Device: [{0}]", id), "id");
|
||||
|
||||
// Removed 2012-07-03 G#
|
||||
// Deferred to Ajax call - improve load performance
|
||||
// Update Device LastNetworkLogonDate
|
||||
//if (m.Device.UpdateLastNetworkLogonDate())
|
||||
// dbContext.SaveChanges();
|
||||
|
||||
// No Necessary - Yet...
|
||||
//if (!string.IsNullOrWhiteSpace(m.Device.ComputerName))
|
||||
//{
|
||||
// var adMachineAccount = BI.Interop.ActiveDirectory.ActiveDirectory.GetMachineAccount(m.Device.ComputerName);
|
||||
// if (adMachineAccount != null)
|
||||
// {
|
||||
// m.OrganisationUnit = adMachineAccount.ParentDistinguishedName;
|
||||
// }
|
||||
//}
|
||||
|
||||
m.DeviceProfiles = dbContext.DeviceProfiles.ToList();
|
||||
|
||||
m.DeviceBatches = dbContext.DeviceBatches.ToSelectListItems(m.Device.DeviceBatchId);
|
||||
|
||||
m.Jobs = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true, ShowDevice = false, IsSmallTable = true, HideClosedJobs = true };
|
||||
m.Jobs.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.DeviceSerialNumber == m.Device.SerialNumber));
|
||||
|
||||
m.Certificates = dbContext.DeviceCertificates.Where(c => c.DeviceSerialNumber == m.Device.SerialNumber).ToList();
|
||||
|
||||
//m.AttachmentTypes = dbContext.AttachmentTypes.Where(at => at.Scope == AttachmentType.AttachmentTypeScopes.Device).ToList();
|
||||
m.DocumentTemplates = m.Device.AvailableDocumentTemplates(dbContext, DiscoApplication.CurrentUser, DateTime.Now);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.Repository;
|
||||
using System.Data.Objects.SqlClient;
|
||||
using Disco.Web.Extensions;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Models.UI.Device;
|
||||
|
||||
|
||||
namespace Disco.Web.Controllers
|
||||
{
|
||||
public partial class DeviceController : dbAdminController
|
||||
{
|
||||
#region Index
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
Models.Device.IndexModel m = new Models.Device.IndexModel();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<DeviceIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Add Offline
|
||||
public virtual ActionResult AddOffline()
|
||||
{
|
||||
var m = new Models.Device.AddOfflineModel()
|
||||
{
|
||||
DefaultDeviceProfileId = dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
|
||||
};
|
||||
m.DeviceBatches = dbContext.DeviceBatches.ToSelectListItems();
|
||||
m.DeviceProfiles = dbContext.DeviceProfiles.ToList();
|
||||
if (m.DefaultDeviceProfileId == 0)
|
||||
{
|
||||
m.DeviceProfiles.Insert(0, new DeviceProfile() { Id = 0, Name = "Select a Device Profile" });
|
||||
}
|
||||
|
||||
return View(m);
|
||||
}
|
||||
[HttpPost]
|
||||
public virtual ActionResult AddOffline(Models.Device.AddOfflineModel m)
|
||||
{
|
||||
// Trim Serial Number & Error Check
|
||||
m.Device.SerialNumber = m.Device.SerialNumber.Trim();
|
||||
if (string.IsNullOrEmpty(m.Device.SerialNumber))
|
||||
{
|
||||
ModelState.AddModelError("Device.SerialNumber", "The Serial Number is Required");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure Existing Device Doesn't Exist
|
||||
if (!string.IsNullOrEmpty(m.Device.SerialNumber) && dbContext.Devices.Count(d => d.SerialNumber == m.Device.SerialNumber) > 0)
|
||||
ModelState.AddModelError("Device.SerialNumber", "A Device what this Serial Number already exists");
|
||||
}
|
||||
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var d = m.Device.AddOffline(dbContext);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Device.Show(d.SerialNumber));
|
||||
}
|
||||
return AddOffline();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Show
|
||||
public virtual ActionResult Show(string id)
|
||||
{
|
||||
var m = new Models.Device.ShowModel();
|
||||
|
||||
dbContext.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
m.Device = dbContext.Devices
|
||||
.Where(d => d.SerialNumber == id)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (m.Device == null)
|
||||
throw new ArgumentException(string.Format("Unknown Device: [{0}]", id), "id");
|
||||
|
||||
// Removed 2012-07-03 G#
|
||||
// Deferred to Ajax call - improve load performance
|
||||
// Update Device LastNetworkLogonDate
|
||||
//if (m.Device.UpdateLastNetworkLogonDate())
|
||||
// dbContext.SaveChanges();
|
||||
|
||||
// No Necessary - Yet...
|
||||
//if (!string.IsNullOrWhiteSpace(m.Device.ComputerName))
|
||||
//{
|
||||
// var adMachineAccount = BI.Interop.ActiveDirectory.ActiveDirectory.GetMachineAccount(m.Device.ComputerName);
|
||||
// if (adMachineAccount != null)
|
||||
// {
|
||||
// m.OrganisationUnit = adMachineAccount.ParentDistinguishedName;
|
||||
// }
|
||||
//}
|
||||
|
||||
m.DeviceProfiles = dbContext.DeviceProfiles.ToList();
|
||||
|
||||
m.DeviceBatches = dbContext.DeviceBatches.ToList();
|
||||
|
||||
m.Jobs = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true, ShowDevice = false, IsSmallTable = true, HideClosedJobs = true };
|
||||
m.Jobs.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.DeviceSerialNumber == m.Device.SerialNumber));
|
||||
|
||||
m.Certificates = dbContext.DeviceCertificates.Where(c => c.DeviceSerialNumber == m.Device.SerialNumber).ToList();
|
||||
|
||||
//m.AttachmentTypes = dbContext.AttachmentTypes.Where(at => at.Scope == AttachmentType.AttachmentTypeScopes.Device).ToList();
|
||||
m.DocumentTemplates = m.Device.AvailableDocumentTemplates(dbContext, DiscoApplication.CurrentUser, DateTime.Now);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<DeviceShowModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ using Disco.Models.Repository;
|
||||
using System.Web.Script.Serialization;
|
||||
using Disco.Services.Plugins.Features.WarrantyProvider;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.Services.UIExtensions;
|
||||
using Disco.Models.UI.Job;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
|
||||
namespace Disco.Web.Controllers
|
||||
{
|
||||
@@ -64,6 +64,10 @@ namespace Disco.Web.Controllers
|
||||
// closedThreshold = closedThreshold.AddDays(-1);
|
||||
//m.RecentlyClosedJobs = new Disco.Models.BI.Job.JobTableModel();
|
||||
//m.RecentlyClosedJobs.Fill(BI.JobTableModelBI.BuildQuery(dbContext).Where(j => j.ClosedDate > closedThreshold));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
#endregion
|
||||
@@ -75,6 +79,10 @@ namespace Disco.Web.Controllers
|
||||
var m = new Models.Job.ListModel() { Title = "All Open Jobs" };
|
||||
m.JobTable = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true };
|
||||
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.ClosedDate == null).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
public virtual ActionResult DevicesReadyForReturn()
|
||||
@@ -86,6 +94,10 @@ namespace Disco.Web.Controllers
|
||||
&& j.DeviceHeld != null && j.DeviceReturnedDate == null && j.DeviceReadyForReturn != null &&
|
||||
((!j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue && !j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue) || j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue)
|
||||
&& j.ClosedDate == null).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
public virtual ActionResult DevicesAwaitingRepair()
|
||||
@@ -98,6 +110,10 @@ namespace Disco.Web.Controllers
|
||||
(j.JobMetaNonWarranty.RepairerLoggedDate != null && j.JobMetaNonWarranty.RepairerCompletedDate == null) ||
|
||||
(j.JobMetaWarranty.ExternalLoggedDate != null && j.JobMetaWarranty.ExternalCompletedDate == null)
|
||||
)).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
|
||||
@@ -114,6 +130,10 @@ namespace Disco.Web.Controllers
|
||||
(j.JobTypeId == JobType.JobTypeIds.HNWar && (!j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue || !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue)) ||
|
||||
(j.JobTypeId == JobType.JobTypeIds.UMgmt && (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement == (j.Flags & (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement))
|
||||
)));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
|
||||
@@ -126,6 +146,9 @@ namespace Disco.Web.Controllers
|
||||
(j.JobTypeId == JobType.JobTypeIds.HNWar && (j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue && (!j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue && !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue)))
|
||||
).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
public virtual ActionResult AwaitingFinancePayment()
|
||||
@@ -136,6 +159,10 @@ namespace Disco.Web.Controllers
|
||||
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.ClosedDate == null &&
|
||||
(j.JobTypeId == JobType.JobTypeIds.HNWar && (!j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue || !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue))
|
||||
).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
public virtual ActionResult AwaitingFinanceInsuranceProcessing()
|
||||
@@ -146,6 +173,10 @@ namespace Disco.Web.Controllers
|
||||
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.ClosedDate == null &&
|
||||
(j.JobTypeId == JobType.JobTypeIds.HNWar && (j.JobMetaNonWarranty.IsInsuranceClaim && !j.JobMetaInsurance.ClaimFormSentDate.HasValue))
|
||||
).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
public virtual ActionResult AwaitingFinanceAgreementBreach()
|
||||
@@ -156,6 +187,10 @@ namespace Disco.Web.Controllers
|
||||
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.ClosedDate == null &&
|
||||
(j.JobTypeId == JobType.JobTypeIds.UMgmt && (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement == (j.Flags & (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement))
|
||||
).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
|
||||
@@ -168,6 +203,10 @@ namespace Disco.Web.Controllers
|
||||
m.JobTable = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true };
|
||||
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => (j.WaitingForUserAction.HasValue || (j.JobMetaNonWarranty.AccountingChargeAddedDate != null && j.JobMetaNonWarranty.AccountingChargePaidDate == null))
|
||||
&& j.ClosedDate == null).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
public virtual ActionResult RecentlyClosed()
|
||||
@@ -183,6 +222,10 @@ namespace Disco.Web.Controllers
|
||||
if (dateTimeNow.DayOfWeek == DayOfWeek.Tuesday)
|
||||
closedThreshold = closedThreshold.AddDays(-1);
|
||||
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.ClosedDate > closedThreshold).OrderBy(j => j.Id));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
public virtual ActionResult Locations()
|
||||
@@ -191,6 +234,10 @@ namespace Disco.Web.Controllers
|
||||
var m = new Models.Job.ListModel() { Title = "Held Device Locations" };
|
||||
m.JobTable = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true, ShowLocation = true, ShowTechnician = false, ShowType = false };
|
||||
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.ClosedDate == null && j.DeviceHeld.HasValue && !j.DeviceReturnedDate.HasValue).OrderBy(j => j.DeviceHeldLocation));
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
|
||||
|
||||
return View(Views.List, m);
|
||||
}
|
||||
|
||||
@@ -232,6 +279,9 @@ namespace Disco.Web.Controllers
|
||||
};
|
||||
m.UpdateModel(dbContext);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobCreateModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
[HttpPost]
|
||||
@@ -241,6 +291,9 @@ namespace Disco.Web.Controllers
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<JobCreateModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,51 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.BI.Extensions;
|
||||
|
||||
namespace Disco.Web.Controllers
|
||||
{
|
||||
public partial class UserController : dbAdminController
|
||||
{
|
||||
#region Index
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Show
|
||||
public virtual ActionResult Show(string id)
|
||||
{
|
||||
var m = new Models.User.ShowModel();
|
||||
|
||||
dbContext.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
// Update User Cache
|
||||
// Do this first so the Database is updated if necessary
|
||||
try
|
||||
{
|
||||
Disco.BI.UserBI.UserCache.GetUser(id, dbContext, true);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// Ignore if User not in Active Directory anymore
|
||||
}
|
||||
|
||||
|
||||
m.User = dbContext.Users.Where(um => um.Id == id).FirstOrDefault();
|
||||
|
||||
m.Jobs = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true, ShowDevice = true, ShowUser = false, IsSmallTable = true, HideClosedJobs = true };
|
||||
m.Jobs.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.UserId == id));
|
||||
|
||||
m.DocumentTemplates = m.User.AvailableDocumentTemplates(dbContext, DiscoApplication.CurrentUser, DateTime.Now);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Models.UI.User;
|
||||
|
||||
namespace Disco.Web.Controllers
|
||||
{
|
||||
public partial class UserController : dbAdminController
|
||||
{
|
||||
#region Index
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var m = new Models.User.IndexModel();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<UserIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Show
|
||||
public virtual ActionResult Show(string id)
|
||||
{
|
||||
var m = new Models.User.ShowModel();
|
||||
|
||||
dbContext.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
// Update User Cache
|
||||
// Do this first so the Database is updated if necessary
|
||||
try
|
||||
{
|
||||
Disco.BI.UserBI.UserCache.GetUser(id, dbContext, true);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// Ignore if User not in Active Directory anymore
|
||||
}
|
||||
|
||||
|
||||
m.User = dbContext.Users.Where(um => um.Id == id).FirstOrDefault();
|
||||
|
||||
m.Jobs = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true, ShowDevice = true, ShowUser = false, IsSmallTable = true, HideClosedJobs = true };
|
||||
m.Jobs.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.UserId == id));
|
||||
|
||||
m.DocumentTemplates = m.User.AvailableDocumentTemplates(dbContext, DiscoApplication.CurrentUser, DateTime.Now);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<UserShowModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,6 +466,7 @@
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Device\AddOfflineModel.cs" />
|
||||
<Compile Include="Models\Device\IndexModel.cs" />
|
||||
<Compile Include="Models\Device\ShowModel.cs" />
|
||||
<Compile Include="Models\InitialConfig\CompleteModel.cs" />
|
||||
<Compile Include="Models\InitialConfig\DatabaseModel.cs" />
|
||||
@@ -480,6 +481,7 @@
|
||||
<Compile Include="Models\Job\WarrantyProviderJobDetailsModel.cs" />
|
||||
<Compile Include="Models\Search\QueryModel.cs" />
|
||||
<Compile Include="Models\Update\IndexModel.cs" />
|
||||
<Compile Include="Models\User\IndexModel.cs" />
|
||||
<Compile Include="Models\User\ShowModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="T4MVC.cs">
|
||||
@@ -1835,7 +1837,7 @@
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
<UserProperties BuildVersion_StartDate="2001/1/1" BuildVersion_BuildAction="ReBuild" BuildVersion_UseGlobalSettings="True" BuildVersion_DetectChanges="False" />
|
||||
<UserProperties BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="True" BuildVersion_BuildAction="ReBuild" BuildVersion_StartDate="2001/1/1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Models.UI.Device;
|
||||
|
||||
namespace Disco.Web.Models.Device
|
||||
{
|
||||
public class IndexModel : DeviceIndexModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
namespace Disco.Web.Models.Device
|
||||
{
|
||||
public class ShowModel
|
||||
{
|
||||
public Disco.Models.Repository.Device Device { get; set; }
|
||||
|
||||
|
||||
public List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; }
|
||||
public List<SelectListItem> DeviceBatches { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel Jobs { get; set; }
|
||||
public List<Disco.Models.Repository.DeviceCertificate> Certificates { get; set; }
|
||||
|
||||
public string OrganisationUnit { get; set; }
|
||||
|
||||
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
|
||||
|
||||
public List<SelectListItem> DocumentTemplatesSelectListItems
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new List<SelectListItem>();
|
||||
list.Add(new SelectListItem() { Selected = true, Value = string.Empty, Text = "Select a Document to Generate" });
|
||||
list.AddRange(this.DocumentTemplates.ToSelectListItems());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.UI.Device;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
namespace Disco.Web.Models.Device
|
||||
{
|
||||
public class ShowModel : DeviceShowModel
|
||||
{
|
||||
public Disco.Models.Repository.Device Device { get; set; }
|
||||
|
||||
public List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; }
|
||||
public List<Disco.Models.Repository.DeviceBatch> DeviceBatches { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel Jobs { get; set; }
|
||||
public List<Disco.Models.Repository.DeviceCertificate> Certificates { get; set; }
|
||||
|
||||
public string OrganisationUnit { get; set; }
|
||||
|
||||
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
|
||||
|
||||
public List<SelectListItem> DocumentTemplatesSelectListItems
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new List<SelectListItem>();
|
||||
list.Add(new SelectListItem() { Selected = true, Value = string.Empty, Text = "Select a Document to Generate" });
|
||||
list.AddRange(this.DocumentTemplates.ToSelectListItems());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+181
-183
@@ -1,184 +1,182 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Web.Models.Job
|
||||
{
|
||||
[CustomValidation(typeof(CreateModel), "ValidateCreateModel")]
|
||||
public class CreateModel
|
||||
{
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
public string UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Type { get; set; }
|
||||
[Required]
|
||||
public List<string> SubTypes { get; set; }
|
||||
|
||||
[DataType(System.ComponentModel.DataAnnotations.DataType.MultilineText)]
|
||||
public string Comments { get; set; }
|
||||
|
||||
//public string AssignedUserId { get; set; }
|
||||
//public DateTime? AssignedUserTargetCompletionDate { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Please specify whether the device is held or not")]
|
||||
public bool? DeviceHeld { get; set; }
|
||||
|
||||
public string QuickLogDestinationUrl { get; set; }
|
||||
|
||||
[Display(Description = "Automatically close this job")]
|
||||
public bool? QuickLog { get; set; }
|
||||
public int? QuickLogTaskTimeMinutes { get; set; }
|
||||
public int? QuickLogTaskTimeMinutesOther { get; set; }
|
||||
|
||||
#region Helpers & Model Logic
|
||||
// View Required Data
|
||||
public Disco.Models.Repository.Device Device { get; set; }
|
||||
public Disco.Models.Repository.User User { get; set; }
|
||||
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
|
||||
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
|
||||
public void UpdateModel(DiscoDataContext dbContext)
|
||||
{
|
||||
if (this.JobTypes == null)
|
||||
JobTypes = dbContext.JobTypes.ToList();
|
||||
if (this.JobSubTypes == null)
|
||||
JobSubTypes = dbContext.JobSubTypes.ToList();
|
||||
|
||||
if (!string.IsNullOrEmpty(DeviceSerialNumber))
|
||||
{
|
||||
this.Device = dbContext.Devices.Include("DeviceModel").Where(d => d.SerialNumber == DeviceSerialNumber).FirstOrDefault();
|
||||
if (this.Device == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid Device Serial Number Specified", "DeviceSerialNumber");
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.UserId) && !string.IsNullOrEmpty(this.Device.AssignedUserId))
|
||||
{
|
||||
this.UserId = this.Device.AssignedUserId;
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = this.JobTypes.First(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.HWar).Id;
|
||||
|
||||
if (string.IsNullOrEmpty(this.UserId))
|
||||
{
|
||||
// No User - Remove User Types
|
||||
foreach (var jobType in JobTypes.ToArray())
|
||||
{
|
||||
switch (jobType.Id)
|
||||
{
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.UMgmt:
|
||||
JobTypes.Remove(jobType);
|
||||
JobSubTypes.RemoveAll(jst => jst.JobType == jobType);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No Device - Remove Hardware Types
|
||||
foreach (var jobType in JobTypes.ToArray())
|
||||
{
|
||||
switch (jobType.Id)
|
||||
{
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.HMisc:
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.HNWar:
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.HWar:
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.SImg:
|
||||
JobTypes.Remove(jobType);
|
||||
JobSubTypes.RemoveAll(jst => jst.JobType == jobType);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set Default Job Type for Users
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = this.JobTypes.First(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.SApp).Id;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(UserId))
|
||||
{
|
||||
this.User = dbContext.Users.Find(UserId);
|
||||
if (this.User == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid User Id Specified", "UserId");
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = Disco.Models.Repository.JobType.JobTypeIds.SApp;
|
||||
}
|
||||
if (this.User == null && this.Device == null)
|
||||
{
|
||||
throw new InvalidOperationException("A Job must reference a Device and/or a User");
|
||||
}
|
||||
}
|
||||
|
||||
// Job Type Helpers
|
||||
public Disco.Models.Repository.JobType GetJobType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.Type))
|
||||
{
|
||||
return this.JobTypes.FirstOrDefault(m => m.Id == this.Type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public List<Disco.Models.Repository.JobSubType> GetJobSubTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SubTypes != null)
|
||||
{
|
||||
var subTypes = this.SubTypes;
|
||||
return this.JobSubTypes.Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ValidationResult ValidateCreateModel(CreateModel model)
|
||||
{
|
||||
// Device && User both can't be null
|
||||
if (string.IsNullOrEmpty(model.DeviceSerialNumber) && string.IsNullOrEmpty(model.UserId))
|
||||
return new ValidationResult("A Job must reference a Device and/or a User");
|
||||
|
||||
if (!string.IsNullOrEmpty(model.Type) && model.SubTypes != null)
|
||||
{
|
||||
var typeId = string.Format("{0}_", model.Type);
|
||||
model.SubTypes = model.SubTypes.Where(m => m.StartsWith(typeId)).ToList();
|
||||
if (model.SubTypes.Count == 0)
|
||||
{
|
||||
model.SubTypes = null;
|
||||
return new ValidationResult("At least one Sub Type is required", new string[] { "SubTypes" });
|
||||
}
|
||||
}
|
||||
|
||||
// Enforce Behaviour
|
||||
if (model.DeviceHeld.HasValue && model.DeviceHeld.Value)
|
||||
{
|
||||
model.QuickLog = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.QuickLog.HasValue && model.QuickLog.Value)
|
||||
{
|
||||
if (!model.QuickLogTaskTimeMinutes.HasValue || model.QuickLogTaskTimeMinutes.Value <= 0)
|
||||
if (model.QuickLogTaskTimeMinutesOther.HasValue && model.QuickLogTaskTimeMinutesOther.Value > 0)
|
||||
model.QuickLogTaskTimeMinutes = model.QuickLogTaskTimeMinutesOther.Value;
|
||||
else
|
||||
model.QuickLogTaskTimeMinutes = 10; // Default to 10 Minutes
|
||||
}
|
||||
}
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.UI.Job;
|
||||
|
||||
namespace Disco.Web.Models.Job
|
||||
{
|
||||
[CustomValidation(typeof(CreateModel), "ValidateCreateModel")]
|
||||
public class CreateModel : JobCreateModel
|
||||
{
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
public string UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Type { get; set; }
|
||||
[Required]
|
||||
public List<string> SubTypes { get; set; }
|
||||
|
||||
[DataType(System.ComponentModel.DataAnnotations.DataType.MultilineText)]
|
||||
public string Comments { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Please specify whether the device is held or not")]
|
||||
public bool? DeviceHeld { get; set; }
|
||||
|
||||
public string QuickLogDestinationUrl { get; set; }
|
||||
|
||||
[Display(Description = "Automatically close this job")]
|
||||
public bool? QuickLog { get; set; }
|
||||
public int? QuickLogTaskTimeMinutes { get; set; }
|
||||
public int? QuickLogTaskTimeMinutesOther { get; set; }
|
||||
|
||||
#region Helpers & Model Logic
|
||||
// View Required Data
|
||||
public Disco.Models.Repository.Device Device { get; set; }
|
||||
public Disco.Models.Repository.User User { get; set; }
|
||||
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
|
||||
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
|
||||
public void UpdateModel(DiscoDataContext dbContext)
|
||||
{
|
||||
if (this.JobTypes == null)
|
||||
JobTypes = dbContext.JobTypes.ToList();
|
||||
if (this.JobSubTypes == null)
|
||||
JobSubTypes = dbContext.JobSubTypes.ToList();
|
||||
|
||||
if (!string.IsNullOrEmpty(DeviceSerialNumber))
|
||||
{
|
||||
this.Device = dbContext.Devices.Include("DeviceModel").Where(d => d.SerialNumber == DeviceSerialNumber).FirstOrDefault();
|
||||
if (this.Device == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid Device Serial Number Specified", "DeviceSerialNumber");
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.UserId) && !string.IsNullOrEmpty(this.Device.AssignedUserId))
|
||||
{
|
||||
this.UserId = this.Device.AssignedUserId;
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = this.JobTypes.First(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.HWar).Id;
|
||||
|
||||
if (string.IsNullOrEmpty(this.UserId))
|
||||
{
|
||||
// No User - Remove User Types
|
||||
foreach (var jobType in JobTypes.ToArray())
|
||||
{
|
||||
switch (jobType.Id)
|
||||
{
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.UMgmt:
|
||||
JobTypes.Remove(jobType);
|
||||
JobSubTypes.RemoveAll(jst => jst.JobType == jobType);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No Device - Remove Hardware Types
|
||||
foreach (var jobType in JobTypes.ToArray())
|
||||
{
|
||||
switch (jobType.Id)
|
||||
{
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.HMisc:
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.HNWar:
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.HWar:
|
||||
case Disco.Models.Repository.JobType.JobTypeIds.SImg:
|
||||
JobTypes.Remove(jobType);
|
||||
JobSubTypes.RemoveAll(jst => jst.JobType == jobType);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set Default Job Type for Users
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = this.JobTypes.First(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.SApp).Id;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(UserId))
|
||||
{
|
||||
this.User = dbContext.Users.Find(UserId);
|
||||
if (this.User == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid User Id Specified", "UserId");
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = Disco.Models.Repository.JobType.JobTypeIds.SApp;
|
||||
}
|
||||
if (this.User == null && this.Device == null)
|
||||
{
|
||||
throw new InvalidOperationException("A Job must reference a Device and/or a User");
|
||||
}
|
||||
}
|
||||
|
||||
// Job Type Helpers
|
||||
public Disco.Models.Repository.JobType GetJobType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.Type))
|
||||
{
|
||||
return this.JobTypes.FirstOrDefault(m => m.Id == this.Type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public List<Disco.Models.Repository.JobSubType> GetJobSubTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SubTypes != null)
|
||||
{
|
||||
var subTypes = this.SubTypes;
|
||||
return this.JobSubTypes.Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ValidationResult ValidateCreateModel(CreateModel model)
|
||||
{
|
||||
// Device && User both can't be null
|
||||
if (string.IsNullOrEmpty(model.DeviceSerialNumber) && string.IsNullOrEmpty(model.UserId))
|
||||
return new ValidationResult("A Job must reference a Device and/or a User");
|
||||
|
||||
if (!string.IsNullOrEmpty(model.Type) && model.SubTypes != null)
|
||||
{
|
||||
var typeId = string.Format("{0}_", model.Type);
|
||||
model.SubTypes = model.SubTypes.Where(m => m.StartsWith(typeId)).ToList();
|
||||
if (model.SubTypes.Count == 0)
|
||||
{
|
||||
model.SubTypes = null;
|
||||
return new ValidationResult("At least one Sub Type is required", new string[] { "SubTypes" });
|
||||
}
|
||||
}
|
||||
|
||||
// Enforce Behaviour
|
||||
if (model.DeviceHeld.HasValue && model.DeviceHeld.Value)
|
||||
{
|
||||
model.QuickLog = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.QuickLog.HasValue && model.QuickLog.Value)
|
||||
{
|
||||
if (!model.QuickLogTaskTimeMinutes.HasValue || model.QuickLogTaskTimeMinutes.Value <= 0)
|
||||
if (model.QuickLogTaskTimeMinutesOther.HasValue && model.QuickLogTaskTimeMinutesOther.Value > 0)
|
||||
model.QuickLogTaskTimeMinutes = model.QuickLogTaskTimeMinutesOther.Value;
|
||||
else
|
||||
model.QuickLogTaskTimeMinutes = 10; // Default to 10 Minutes
|
||||
}
|
||||
}
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Models.Job
|
||||
{
|
||||
public class IndexModel
|
||||
{
|
||||
public Disco.Models.BI.Job.JobTableModel OpenJobs { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel LongRunningJobs { get; set; }
|
||||
//public Disco.Models.BI.Job.JobTableModel WaitingForUserActionJobs { get; set; }
|
||||
//public Disco.Models.BI.Job.JobTableModel ReadyForReturnJobs { get; set; }
|
||||
//public Disco.Models.BI.Job.JobTableModel RecentlyClosedJobs { get; set; }
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Models.UI.Job;
|
||||
|
||||
namespace Disco.Web.Models.Job
|
||||
{
|
||||
public class IndexModel : JobIndexModel
|
||||
{
|
||||
public Disco.Models.BI.Job.JobTableModel OpenJobs { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel LongRunningJobs { get; set; }
|
||||
//public Disco.Models.BI.Job.JobTableModel WaitingForUserActionJobs { get; set; }
|
||||
//public Disco.Models.BI.Job.JobTableModel ReadyForReturnJobs { get; set; }
|
||||
//public Disco.Models.BI.Job.JobTableModel RecentlyClosedJobs { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Web.Models.Job
|
||||
{
|
||||
public class ListModel
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel JobTable { get; set; }
|
||||
|
||||
public string PageTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0} ({1})", Title, JobTable.Items.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Models.UI.Job;
|
||||
|
||||
namespace Disco.Web.Models.Job
|
||||
{
|
||||
public class ListModel : JobListModel
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel JobTable { get; set; }
|
||||
|
||||
public string PageTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0} ({1})", Title, JobTable.Items.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Models.UI.User;
|
||||
|
||||
namespace Disco.Web.Models.User
|
||||
{
|
||||
public class IndexModel : UserIndexModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Interop.ActiveDirectory;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
namespace Disco.Web.Models.User
|
||||
{
|
||||
public class ShowModel
|
||||
{
|
||||
public Disco.Models.Repository.User User { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel Jobs { get; set; }
|
||||
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
|
||||
|
||||
public List<SelectListItem> DocumentTemplatesSelectListItems
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new List<SelectListItem>();
|
||||
list.Add(new SelectListItem() { Selected = true, Value = string.Empty, Text = "Select a Document to Generate" });
|
||||
list.AddRange(this.DocumentTemplates.ToSelectListItems());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public string PrimaryDeviceSerialNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
var assignedDevice = User.DeviceUserAssignments.Where(d => !d.UnassignedDate.HasValue).FirstOrDefault();
|
||||
if (assignedDevice == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return assignedDevice.DeviceSerialNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Interop.ActiveDirectory;
|
||||
using Disco.Models.UI.User;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
namespace Disco.Web.Models.User
|
||||
{
|
||||
public class ShowModel : UserShowModel
|
||||
{
|
||||
public Disco.Models.Repository.User User { get; set; }
|
||||
public Disco.Models.BI.Job.JobTableModel Jobs { get; set; }
|
||||
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
|
||||
|
||||
public List<SelectListItem> DocumentTemplatesSelectListItems
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new List<SelectListItem>();
|
||||
list.Add(new SelectListItem() { Selected = true, Value = string.Empty, Text = "Select a Document to Generate" });
|
||||
list.AddRange(this.DocumentTemplates.ToSelectListItems());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public string PrimaryDeviceSerialNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
var assignedDevice = User.DeviceUserAssignments.Where(d => !d.UnassignedDate.HasValue).FirstOrDefault();
|
||||
if (assignedDevice == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return assignedDevice.DeviceSerialNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.2.0221.1820")]
|
||||
[assembly: AssemblyFileVersion("1.2.0221.1820")]
|
||||
[assembly: AssemblyVersion("1.2.0225.1951")]
|
||||
[assembly: AssemblyFileVersion("1.2.0225.1951")]
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
Batch:
|
||||
</th>
|
||||
<td class="value">
|
||||
@Html.DropDownListFor(m => m.Device.DeviceBatchId, Model.DeviceBatches)
|
||||
@Html.DropDownListFor(m => m.Device.DeviceBatchId, Model.DeviceBatches.ToSelectListItems(Model.Device.DeviceBatchId))
|
||||
@AjaxHelpers.AjaxLoader() <span id="deviceBatchDetails" class="icon16" title="Batch Details"></span>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace Disco.Web.Views.Device
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/Show.cshtml")]
|
||||
public class Show : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
public partial class Show : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
{
|
||||
public Show()
|
||||
{
|
||||
@@ -300,7 +300,7 @@ WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 106 "..\..\Views\Device\Show.cshtml"
|
||||
Write(Html.DropDownListFor(m => m.Device.DeviceBatchId, Model.DeviceBatches));
|
||||
Write(Html.DropDownListFor(m => m.Device.DeviceBatchId, Model.DeviceBatches.ToSelectListItems(Model.Device.DeviceBatchId)));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -662,14 +662,14 @@ WriteLiteral(" <a");
|
||||
|
||||
WriteLiteral(" class=\"unlocked16\"");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 15388), Tuple.Create("\"", 15496)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 15434), Tuple.Create("\"", 15542)
|
||||
|
||||
#line 261 "..\..\Views\Device\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 15395), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "false", true))
|
||||
, Tuple.Create(Tuple.Create("", 15441), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "false", true))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 15395), false)
|
||||
, 15441), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" title=\"Unauthenticated Enrolment is Allowed\"");
|
||||
@@ -689,14 +689,14 @@ WriteLiteral(" <a");
|
||||
|
||||
WriteLiteral(" class=\"locked16\"");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 15721), Tuple.Create("\"", 15828)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 15767), Tuple.Create("\"", 15874)
|
||||
|
||||
#line 266 "..\..\Views\Device\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 15728), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "true", true))
|
||||
, Tuple.Create(Tuple.Create("", 15774), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, "true", true))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 15728), false)
|
||||
, 15774), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" title=\"Unauthenticated Enrolment is Blocked\"");
|
||||
@@ -1040,14 +1040,14 @@ WriteLiteral(" <tr");
|
||||
|
||||
WriteLiteral(" id=\"Device_AssignedUser_History_Host\"");
|
||||
|
||||
WriteAttribute("style", Tuple.Create(" style=\"", 25515), Tuple.Create("\"", 25589)
|
||||
WriteAttribute("style", Tuple.Create(" style=\"", 25561), Tuple.Create("\"", 25635)
|
||||
|
||||
#line 424 "..\..\Views\Device\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 25523), Tuple.Create<System.Object, System.Int32>(Model.Device.DecommissionedDate.HasValue ? "" : "display: none"
|
||||
, Tuple.Create(Tuple.Create("", 25569), Tuple.Create<System.Object, System.Int32>(Model.Device.DecommissionedDate.HasValue ? "" : "display: none"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 25523), false)
|
||||
, 25569), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
@@ -1058,14 +1058,14 @@ WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"Device_AssignedUser_History\"");
|
||||
|
||||
WriteAttribute("style", Tuple.Create(" style=\"", 25692), Tuple.Create("\"", 25766)
|
||||
WriteAttribute("style", Tuple.Create(" style=\"", 25738), Tuple.Create("\"", 25812)
|
||||
|
||||
#line 426 "..\..\Views\Device\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 25700), Tuple.Create<System.Object, System.Int32>(Model.Device.DecommissionedDate.HasValue ? "" : "display: none"
|
||||
, Tuple.Create(Tuple.Create("", 25746), Tuple.Create<System.Object, System.Int32>(Model.Device.DecommissionedDate.HasValue ? "" : "display: none"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 25700), false)
|
||||
, 25746), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <h2>\r\n Assigned Use" +
|
||||
@@ -1144,26 +1144,26 @@ WriteLiteral(">\r\n <img");
|
||||
|
||||
WriteLiteral(" alt=\"Model Image\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 27421), Tuple.Create("\"", 27531)
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 27467), Tuple.Create("\"", 27577)
|
||||
|
||||
#line 460 "..\..\Views\Device\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 27427), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))
|
||||
, Tuple.Create(Tuple.Create("", 27473), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 27427), false)
|
||||
, 27473), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n <h2>\r\n <a");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 27597), Tuple.Create("\"", 27675)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 27643), Tuple.Create("\"", 27721)
|
||||
|
||||
#line 462 "..\..\Views\Device\Show.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 27604), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DeviceModel.Index(Model.Device.DeviceModelId))
|
||||
, Tuple.Create(Tuple.Create("", 27650), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DeviceModel.Index(Model.Device.DeviceModelId))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 27604), false)
|
||||
, 27650), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
@@ -104,6 +104,6 @@
|
||||
href="http://discoict.com.au/" target="_blank">discoict.com.au</a> | @Html.ActionLink("Credits", MVC.Public.Public.Credits()) | @Html.ActionLink("Licence", MVC.Public.Public.Licence())
|
||||
</footer>
|
||||
</div>
|
||||
@{ Disco.Services.UIExtensions.UIExtensions.ExecuteExtensionResult(this); }
|
||||
@{ Disco.Services.Plugins.Features.UIExtension.UIExtensions.ExecuteExtensionResult(this); }
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace Disco.Web.Views.Shared
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Shared/_Layout.cshtml")]
|
||||
public class Layout : System.Web.Mvc.WebViewPage<dynamic>
|
||||
public partial class Layout : System.Web.Mvc.WebViewPage<dynamic>
|
||||
{
|
||||
public Layout()
|
||||
{
|
||||
@@ -488,7 +488,7 @@ WriteLiteral("\r\n </footer>\r\n </div>\r\n");
|
||||
#line hidden
|
||||
|
||||
#line 107 "..\..\Views\Shared\_Layout.cshtml"
|
||||
Disco.Services.UIExtensions.UIExtensions.ExecuteExtensionResult(this);
|
||||
Disco.Services.Plugins.Features.UIExtension.UIExtensions.ExecuteExtensionResult(this);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
Reference in New Issue
Block a user