Fix #12: Update users when logging warranty

Job User is updated when available.
This commit is contained in:
Gary Sharp
2013-09-02 18:37:30 +10:00
parent 3596d325eb
commit 37810656fd
+13 -1
View File
@@ -62,6 +62,17 @@ namespace Disco.Web.Models.Job
dbContext.Configuration.LazyLoadingEnabled = true;
if (Job == null)
{
// Update Job User's Details [#12]
string jobUserId = dbContext.Jobs.Where(j => j.Id == JobId).Select(j => j.UserId).FirstOrDefault();
if (jobUserId != null)
{
// Ignore update errors (Most commonly when the User Id no longer exists in AD)
try
{
Disco.BI.UserBI.UserCache.GetUser(jobUserId, dbContext, true);
} catch (Exception) {}
}
Job = (from j in dbContext.Jobs.Include("Device.DeviceModel").Include("JobMetaWarranty").Include("JobSubTypes")
where (j.Id == JobId)
select j).FirstOrDefault();
@@ -71,7 +82,8 @@ namespace Disco.Web.Models.Job
}
}
this.TechUser = DiscoApplication.CurrentUser;
// Update TechUser's Details [#12]
this.TechUser = Disco.BI.UserBI.UserCache.GetUser(DiscoApplication.CurrentUser.Id, dbContext, true);
WarrantyProviders = Plugins.GetPluginFeatures(typeof(WarrantyProviderFeature));