Update: Job Publishing - Repair Jobs

Repair jobs can also submit attachments to repairers via Disco ICT
Online Services.
This commit is contained in:
Gary Sharp
2014-07-24 21:27:24 +10:00
parent 7cbed23a74
commit 4d8fec2ced
7 changed files with 721 additions and 82 deletions
+19 -6
View File
@@ -18,6 +18,8 @@ namespace Disco.Web.Models.Job
public List<Disco.Models.BI.Config.OrganisationAddress> OrganisationAddresses { get; set; }
public Disco.Models.BI.Config.OrganisationAddress OrganisationAddress { get; set; }
public List<Disco.Models.Repository.JobAttachment> PublishAttachments { get; set; }
public Disco.Models.Repository.User TechUser { get; set; }
[Required]
@@ -28,6 +30,7 @@ namespace Disco.Web.Models.Job
public string RepairProviderId { get; set; }
[Required(ErrorMessage = "A fault description is required"), DataType(System.ComponentModel.DataAnnotations.DataType.MultilineText)]
public string RepairDescription { get; set; }
public List<int> PublishAttachmentIds { get; set; }
[Required]
public string SubmissionAction { get; set; }
@@ -77,16 +80,16 @@ namespace Disco.Web.Models.Job
try
{
UserService.GetUser(jobUserId, Database, true);
} catch (Exception) {}
}
catch (Exception) { }
}
Job = (from j in Database.Jobs.Include("Device.DeviceModel").Include("JobMetaNonWarranty").Include("JobSubTypes")
where (j.Id == JobId)
select j).FirstOrDefault();
Job = Database.Jobs.Include("Device.DeviceModel").Include("JobMetaWarranty").Include("JobSubTypes").Include("JobAttachments")
.Where(j => j.Id == JobId)
.FirstOrDefault();
if (Job == null)
{
throw new ArgumentException("Invalid Job Number Specified", "JobId");
}
}
// Update TechUser's Details [#12]
@@ -116,6 +119,16 @@ namespace Disco.Web.Models.Job
if (!string.IsNullOrEmpty(RepairDescription))
RepairDescription = RepairDescription.Trim();
if (PublishAttachmentIds == null)
{
PublishAttachmentIds = new List<int>();
PublishAttachments = new List<Disco.Models.Repository.JobAttachment>();
}
else
{
PublishAttachments = Job.JobAttachments.Where(ja => PublishAttachmentIds.Contains(ja.Id)).ToList();
}
}
}
}