Fix: Managed Job Lists
updates locked and bug fixes
This commit is contained in:
@@ -21,13 +21,15 @@ namespace Disco.BI.Extensions
|
||||
var jobItems = Jobs.Select(j => new JobTableModel.JobTableItemModelIncludeStatus()
|
||||
{
|
||||
Id = j.Id,
|
||||
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
||||
OpenedDate = j.OpenedDate,
|
||||
ClosedDate = j.ClosedDate,
|
||||
TypeId = j.JobTypeId,
|
||||
TypeDescription = j.JobType.Description,
|
||||
DeviceSerialNumber = j.Device.SerialNumber,
|
||||
DeviceProfileId = j.Device.DeviceProfileId,
|
||||
DeviceModelId = j.Device.DeviceModelId,
|
||||
DeviceModelDescription = j.Device.DeviceModel.Description,
|
||||
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
||||
UserId = j.UserId,
|
||||
UserDisplayName = j.User.DisplayName,
|
||||
OpenedTechUserId = j.OpenedTechUserId,
|
||||
@@ -66,13 +68,15 @@ namespace Disco.BI.Extensions
|
||||
items = Jobs.Select(j => new JobTableModel.JobTableItemModel()
|
||||
{
|
||||
Id = j.Id,
|
||||
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
||||
OpenedDate = j.OpenedDate,
|
||||
ClosedDate = j.ClosedDate,
|
||||
TypeId = j.JobTypeId,
|
||||
TypeDescription = j.JobType.Description,
|
||||
DeviceSerialNumber = j.Device.SerialNumber,
|
||||
DeviceProfileId = j.Device.DeviceProfileId,
|
||||
DeviceModelId = j.Device.DeviceModelId,
|
||||
DeviceModelDescription = j.Device.DeviceModel.Description,
|
||||
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
||||
UserId = j.UserId,
|
||||
UserDisplayName = j.User.DisplayName,
|
||||
OpenedTechUserId = j.OpenedTechUserId,
|
||||
@@ -84,16 +88,13 @@ namespace Disco.BI.Extensions
|
||||
if (!model.ShowDeviceAddress.HasValue)
|
||||
model.ShowDeviceAddress = dbContext.DiscoConfiguration.MultiSiteMode;
|
||||
|
||||
if (model.ShowDeviceAddress.Value)
|
||||
{
|
||||
foreach (var j in items)
|
||||
if (j.DeviceAddressId.HasValue)
|
||||
j.DeviceAddress = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(j.DeviceAddressId.Value).Name;
|
||||
}
|
||||
foreach (var j in items)
|
||||
if (j.DeviceAddressId.HasValue)
|
||||
j.DeviceAddress = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(j.DeviceAddressId.Value).Name;
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
public static void Fill(this JobTableModel model, DiscoDataContext dbContext, IQueryable<Job> Jobs)
|
||||
{
|
||||
model.Items = model.DetermineItems(dbContext, Jobs);
|
||||
|
||||
@@ -30,17 +30,61 @@ namespace Disco.Models.BI.Job
|
||||
ShowTechnician = true;
|
||||
}
|
||||
|
||||
private JobTableModel CloneEmptyModel()
|
||||
{
|
||||
return new JobTableModel()
|
||||
{
|
||||
ShowId = this.ShowId,
|
||||
ShowDeviceAddress = this.ShowDeviceAddress,
|
||||
ShowDates = this.ShowDates,
|
||||
ShowType = this.ShowType,
|
||||
ShowDevice = this.ShowDevice,
|
||||
ShowUser = this.ShowUser,
|
||||
ShowTechnician = this.ShowTechnician,
|
||||
ShowLocation = this.ShowLocation,
|
||||
ShowStatus = this.ShowStatus,
|
||||
IsSmallTable = this.IsSmallTable,
|
||||
HideClosedJobs = this.HideClosedJobs
|
||||
};
|
||||
}
|
||||
|
||||
public IDictionary<string, JobTableModel> MultiCampusModels
|
||||
{
|
||||
get
|
||||
{
|
||||
var items = this.Items;
|
||||
if (items == null || items.Count > 0)
|
||||
{
|
||||
return items.OrderBy(i => i.DeviceAddress).GroupBy(i => i.DeviceAddress).ToDictionary(
|
||||
ig => ig.Key ?? string.Empty,
|
||||
ig =>
|
||||
{
|
||||
var jtm = this.CloneEmptyModel();
|
||||
jtm.Items = ig.ToList();
|
||||
return jtm;
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class JobTableItemModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int? DeviceAddressId { get; set; }
|
||||
public string DeviceAddress { get; set; }
|
||||
public DateTime OpenedDate { get; set; }
|
||||
public DateTime? ClosedDate { get; set; }
|
||||
public string TypeId { get; set; }
|
||||
public string TypeDescription { get; set; }
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
public int? DeviceModelId { get; set; }
|
||||
public string DeviceModelDescription { get; set; }
|
||||
public int? DeviceProfileId { get; set; }
|
||||
public int? DeviceAddressId { get; set; }
|
||||
public string DeviceAddress { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string UserDisplayName { get; set; }
|
||||
public string OpenedTechUserId { get; set; }
|
||||
|
||||
@@ -7,17 +7,15 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
var modelItems = Model.Items;
|
||||
var modelItemsGrouped = modelItems.OrderBy(i => i.DeviceAddress).GroupBy(i => i.DeviceAddress);
|
||||
foreach (var modelItemsGroup in modelItemsGrouped)
|
||||
var multiSiteModels = Model.MultiCampusModels;
|
||||
|
||||
foreach (var multiSiteModel in multiSiteModels)
|
||||
{
|
||||
Model.Items = modelItemsGroup.ToList();
|
||||
if (modelItemsGroup.Key != null)
|
||||
{
|
||||
<h3>
|
||||
@modelItemsGroup.Key</h3>
|
||||
if (!string.IsNullOrEmpty(multiSiteModel.Key))
|
||||
{
|
||||
<h3>@multiSiteModel.Key</h3>
|
||||
}
|
||||
@Html.Partial(MVC.Shared.Views._JobTableRender, Model, new ViewDataDictionary())
|
||||
@Html.Partial(MVC.Shared.Views._JobTableRender, multiSiteModel.Value, new ViewDataDictionary())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.17929
|
||||
// Runtime Version:4.0.30319.18033
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -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/_JobTable.cshtml")]
|
||||
public class JobTable : System.Web.Mvc.WebViewPage<Disco.Models.BI.Job.JobTableModel>
|
||||
public partial class JobTable : System.Web.Mvc.WebViewPage<Disco.Models.BI.Job.JobTableModel>
|
||||
{
|
||||
public JobTable()
|
||||
{
|
||||
@@ -61,24 +61,21 @@ WriteLiteral(">No Jobs Found</span>\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
var modelItems = Model.Items;
|
||||
var modelItemsGrouped = modelItems.OrderBy(i => i.DeviceAddress).GroupBy(i => i.DeviceAddress);
|
||||
foreach (var modelItemsGroup in modelItemsGrouped)
|
||||
var multiSiteModels = Model.MultiCampusModels;
|
||||
|
||||
foreach (var multiSiteModel in multiSiteModels)
|
||||
{
|
||||
Model.Items = modelItemsGroup.ToList();
|
||||
if (modelItemsGroup.Key != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(multiSiteModel.Key))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <h3>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
WriteLiteral(" <h3>");
|
||||
|
||||
|
||||
#line 18 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
Write(modelItemsGroup.Key);
|
||||
#line 16 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
Write(multiSiteModel.Key);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -86,22 +83,22 @@ WriteLiteral(" ");
|
||||
WriteLiteral("</h3>\r\n");
|
||||
|
||||
|
||||
#line 19 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
#line 17 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 20 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
Write(Html.Partial(MVC.Shared.Views._JobTableRender, Model, new ViewDataDictionary()));
|
||||
#line 18 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
Write(Html.Partial(MVC.Shared.Views._JobTableRender, multiSiteModel.Value, new ViewDataDictionary()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 20 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
|
||||
#line 18 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,14 +109,14 @@ else
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 26 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
#line 24 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
Write(Html.Partial(MVC.Shared.Views._JobTableRender, Model, new ViewDataDictionary()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 26 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
#line 24 "..\..\Views\Shared\_JobTable.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user