Feature #2: Implement Repair Provider
Logging Repair for Non-Warranty jobs has been brought into line with Logging Warranty. RepairProviderFeature implemented which allows plugins to be used in submitting jobs to third-parties for repair.
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Data.Repository;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Disco.BI;
|
||||
using System.Web.Script.Serialization;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.Services.Plugins.Features.WarrantyProvider;
|
||||
using Newtonsoft.Json;
|
||||
using Disco.Services.Users;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
||||
namespace Disco.Web.Models.Job
|
||||
{
|
||||
@@ -32,29 +29,29 @@ namespace Disco.Web.Models.Job
|
||||
[Required(ErrorMessage = "A fault description is required"), DataType(System.ComponentModel.DataAnnotations.DataType.MultilineText)]
|
||||
public string FaultDescription { get; set; }
|
||||
[Required]
|
||||
public string WarrantyAction { get; set; }
|
||||
public string SubmissionAction { get; set; }
|
||||
|
||||
public bool IsCustomProvider
|
||||
public bool IsManualProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
return WarrantyProviderId == "CUSTOM";
|
||||
return WarrantyProviderId == "MANUAL";
|
||||
}
|
||||
}
|
||||
public string CustomProviderName { get; set; }
|
||||
public string CustomProviderReference { get; set; }
|
||||
public string ManualProviderName { get; set; }
|
||||
public string ManualProviderReference { get; set; }
|
||||
|
||||
public Type WarrantyProviderSubmitJobViewType { get; set; }
|
||||
public object WarrantyProviderSubmitJobModel { get; set; }
|
||||
public string WarrantyProviderPropertiesJson { get; set; }
|
||||
public Dictionary<string, string> WarrantyProviderProperties()
|
||||
public string ProviderPropertiesJson { get; set; }
|
||||
public Dictionary<string, string> ProviderProperties()
|
||||
{
|
||||
Dictionary<string, string> p = default(Dictionary<string, string>);
|
||||
if (!string.IsNullOrEmpty(this.WarrantyProviderPropertiesJson))
|
||||
if (!string.IsNullOrEmpty(this.ProviderPropertiesJson))
|
||||
{
|
||||
try
|
||||
{
|
||||
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(this.WarrantyProviderPropertiesJson);
|
||||
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(this.ProviderPropertiesJson);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -101,9 +98,12 @@ namespace Disco.Web.Models.Job
|
||||
if (!IsPostBack && string.IsNullOrEmpty(WarrantyProviderId))
|
||||
{
|
||||
WarrantyProviderId = Job.Device.DeviceModel.DefaultWarrantyProvider;
|
||||
|
||||
if (string.IsNullOrEmpty(WarrantyProviderId))
|
||||
WarrantyProviderId = "MANUAL";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(WarrantyProviderId) && WarrantyProviderId != "CUSTOM")
|
||||
if (!string.IsNullOrEmpty(WarrantyProviderId) && WarrantyProviderId != "MANUAL")
|
||||
WarrantyProvider = Plugins.GetPluginFeature(WarrantyProviderId, typeof(WarrantyProviderFeature));
|
||||
|
||||
this.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
|
||||
|
||||
Reference in New Issue
Block a user