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()
|
var jobItems = Jobs.Select(j => new JobTableModel.JobTableItemModelIncludeStatus()
|
||||||
{
|
{
|
||||||
Id = j.Id,
|
Id = j.Id,
|
||||||
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
|
||||||
OpenedDate = j.OpenedDate,
|
OpenedDate = j.OpenedDate,
|
||||||
ClosedDate = j.ClosedDate,
|
ClosedDate = j.ClosedDate,
|
||||||
TypeId = j.JobTypeId,
|
TypeId = j.JobTypeId,
|
||||||
TypeDescription = j.JobType.Description,
|
TypeDescription = j.JobType.Description,
|
||||||
DeviceSerialNumber = j.Device.SerialNumber,
|
DeviceSerialNumber = j.Device.SerialNumber,
|
||||||
|
DeviceProfileId = j.Device.DeviceProfileId,
|
||||||
|
DeviceModelId = j.Device.DeviceModelId,
|
||||||
DeviceModelDescription = j.Device.DeviceModel.Description,
|
DeviceModelDescription = j.Device.DeviceModel.Description,
|
||||||
|
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
||||||
UserId = j.UserId,
|
UserId = j.UserId,
|
||||||
UserDisplayName = j.User.DisplayName,
|
UserDisplayName = j.User.DisplayName,
|
||||||
OpenedTechUserId = j.OpenedTechUserId,
|
OpenedTechUserId = j.OpenedTechUserId,
|
||||||
@@ -66,13 +68,15 @@ namespace Disco.BI.Extensions
|
|||||||
items = Jobs.Select(j => new JobTableModel.JobTableItemModel()
|
items = Jobs.Select(j => new JobTableModel.JobTableItemModel()
|
||||||
{
|
{
|
||||||
Id = j.Id,
|
Id = j.Id,
|
||||||
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
|
||||||
OpenedDate = j.OpenedDate,
|
OpenedDate = j.OpenedDate,
|
||||||
ClosedDate = j.ClosedDate,
|
ClosedDate = j.ClosedDate,
|
||||||
TypeId = j.JobTypeId,
|
TypeId = j.JobTypeId,
|
||||||
TypeDescription = j.JobType.Description,
|
TypeDescription = j.JobType.Description,
|
||||||
DeviceSerialNumber = j.Device.SerialNumber,
|
DeviceSerialNumber = j.Device.SerialNumber,
|
||||||
|
DeviceProfileId = j.Device.DeviceProfileId,
|
||||||
|
DeviceModelId = j.Device.DeviceModelId,
|
||||||
DeviceModelDescription = j.Device.DeviceModel.Description,
|
DeviceModelDescription = j.Device.DeviceModel.Description,
|
||||||
|
DeviceAddressId = j.Device.DeviceProfile.DefaultOrganisationAddress,
|
||||||
UserId = j.UserId,
|
UserId = j.UserId,
|
||||||
UserDisplayName = j.User.DisplayName,
|
UserDisplayName = j.User.DisplayName,
|
||||||
OpenedTechUserId = j.OpenedTechUserId,
|
OpenedTechUserId = j.OpenedTechUserId,
|
||||||
@@ -84,12 +88,9 @@ namespace Disco.BI.Extensions
|
|||||||
if (!model.ShowDeviceAddress.HasValue)
|
if (!model.ShowDeviceAddress.HasValue)
|
||||||
model.ShowDeviceAddress = dbContext.DiscoConfiguration.MultiSiteMode;
|
model.ShowDeviceAddress = dbContext.DiscoConfiguration.MultiSiteMode;
|
||||||
|
|
||||||
if (model.ShowDeviceAddress.Value)
|
foreach (var j in items)
|
||||||
{
|
if (j.DeviceAddressId.HasValue)
|
||||||
foreach (var j in items)
|
j.DeviceAddress = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(j.DeviceAddressId.Value).Name;
|
||||||
if (j.DeviceAddressId.HasValue)
|
|
||||||
j.DeviceAddress = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(j.DeviceAddressId.Value).Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,17 +30,61 @@ namespace Disco.Models.BI.Job
|
|||||||
ShowTechnician = true;
|
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 class JobTableItemModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int? DeviceAddressId { get; set; }
|
|
||||||
public string DeviceAddress { get; set; }
|
|
||||||
public DateTime OpenedDate { get; set; }
|
public DateTime OpenedDate { get; set; }
|
||||||
public DateTime? ClosedDate { get; set; }
|
public DateTime? ClosedDate { get; set; }
|
||||||
public string TypeId { get; set; }
|
public string TypeId { get; set; }
|
||||||
public string TypeDescription { get; set; }
|
public string TypeDescription { get; set; }
|
||||||
public string DeviceSerialNumber { get; set; }
|
public string DeviceSerialNumber { get; set; }
|
||||||
|
public int? DeviceModelId { get; set; }
|
||||||
public string DeviceModelDescription { 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 UserId { get; set; }
|
||||||
public string UserDisplayName { get; set; }
|
public string UserDisplayName { get; set; }
|
||||||
public string OpenedTechUserId { get; set; }
|
public string OpenedTechUserId { get; set; }
|
||||||
|
|||||||
@@ -7,17 +7,15 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var modelItems = Model.Items;
|
var multiSiteModels = Model.MultiCampusModels;
|
||||||
var modelItemsGrouped = modelItems.OrderBy(i => i.DeviceAddress).GroupBy(i => i.DeviceAddress);
|
|
||||||
foreach (var modelItemsGroup in modelItemsGrouped)
|
foreach (var multiSiteModel in multiSiteModels)
|
||||||
{
|
{
|
||||||
Model.Items = modelItemsGroup.ToList();
|
if (!string.IsNullOrEmpty(multiSiteModel.Key))
|
||||||
if (modelItemsGroup.Key != null)
|
|
||||||
{
|
{
|
||||||
<h3>
|
<h3>@multiSiteModel.Key</h3>
|
||||||
@modelItemsGroup.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>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// 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
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
@@ -31,9 +31,9 @@ namespace Disco.Web.Views.Shared
|
|||||||
using Disco.Web;
|
using Disco.Web;
|
||||||
using Disco.Web.Extensions;
|
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")]
|
[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()
|
public JobTable()
|
||||||
{
|
{
|
||||||
@@ -61,24 +61,21 @@ WriteLiteral(">No Jobs Found</span>\r\n");
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var modelItems = Model.Items;
|
var multiSiteModels = Model.MultiCampusModels;
|
||||||
var modelItemsGrouped = modelItems.OrderBy(i => i.DeviceAddress).GroupBy(i => i.DeviceAddress);
|
|
||||||
foreach (var modelItemsGroup in modelItemsGrouped)
|
foreach (var multiSiteModel in multiSiteModels)
|
||||||
{
|
{
|
||||||
Model.Items = modelItemsGroup.ToList();
|
if (!string.IsNullOrEmpty(multiSiteModel.Key))
|
||||||
if (modelItemsGroup.Key != null)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <h3>\r\n");
|
WriteLiteral(" <h3>");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
|
||||||
|
|
||||||
|
|
||||||
#line 18 "..\..\Views\Shared\_JobTable.cshtml"
|
#line 16 "..\..\Views\Shared\_JobTable.cshtml"
|
||||||
Write(modelItemsGroup.Key);
|
Write(multiSiteModel.Key);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -86,21 +83,21 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("</h3>\r\n");
|
WriteLiteral("</h3>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 19 "..\..\Views\Shared\_JobTable.cshtml"
|
#line 17 "..\..\Views\Shared\_JobTable.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 20 "..\..\Views\Shared\_JobTable.cshtml"
|
#line 18 "..\..\Views\Shared\_JobTable.cshtml"
|
||||||
Write(Html.Partial(MVC.Shared.Views._JobTableRender, Model, new ViewDataDictionary()));
|
Write(Html.Partial(MVC.Shared.Views._JobTableRender, multiSiteModel.Value, new ViewDataDictionary()));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 20 "..\..\Views\Shared\_JobTable.cshtml"
|
#line 18 "..\..\Views\Shared\_JobTable.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,14 +109,14 @@ else
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 26 "..\..\Views\Shared\_JobTable.cshtml"
|
#line 24 "..\..\Views\Shared\_JobTable.cshtml"
|
||||||
Write(Html.Partial(MVC.Shared.Views._JobTableRender, Model, new ViewDataDictionary()));
|
Write(Html.Partial(MVC.Shared.Views._JobTableRender, Model, new ViewDataDictionary()));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 26 "..\..\Views\Shared\_JobTable.cshtml"
|
#line 24 "..\..\Views\Shared\_JobTable.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user