Update: Job Entity -> Enum Support

This commit is contained in:
Gary Sharp
2013-09-05 12:45:23 +10:00
parent 090322126a
commit f3efa56750
6 changed files with 12 additions and 12 deletions
@@ -499,9 +499,9 @@ namespace Disco.Web.Areas.API.Controllers
}
else
{
if (!job.Flags.HasValue || job.Flags.Value != flags)
if (!job.Flags.HasValue || (long)job.Flags.Value != flags)
{
job.Flags = flags;
job.Flags = (Disco.Models.Repository.Job.UserManagementFlags)flags;
dbContext.SaveChanges();
}
}
@@ -1391,7 +1391,7 @@ namespace Disco.Web.Areas.API.Controllers
if (job == null)
throw new Exception("Invalid Job Id");
long flag = Flag.Value;
var flag = Flag.Value;
var validFlags = job.ValidFlags();
Tuple<string, bool> flagStatus;
if (validFlags.TryGetValue((flag < 0 ? flag * -1 : flag), out flagStatus))
@@ -1400,7 +1400,7 @@ namespace Disco.Web.Areas.API.Controllers
{ // Remove Flag
if (flagStatus.Item2)
{
job.Flags = (job.Flags ?? 0) ^ (flag * -1);
job.Flags = (Disco.Models.Repository.Job.UserManagementFlags)((long)(job.Flags ?? 0) ^ (flag * -1));
dbContext.SaveChanges();
}
}
@@ -1408,7 +1408,7 @@ namespace Disco.Web.Areas.API.Controllers
{ // Add Flag
if (!flagStatus.Item2)
{
job.Flags = (job.Flags ?? 0) | flag;
job.Flags = (Disco.Models.Repository.Job.UserManagementFlags)((long)(job.Flags ?? 0) | flag);
}
// Write Reason
JobLog jobLog = new JobLog()
@@ -22,7 +22,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
ShortName = dp.ShortName,
Address = dp.DefaultOrganisationAddress,
Description = dp.Description,
DistributionTypeId = dp.DistributionTypeDb,
DistributionTypeId = (int)dp.DistributionType,
DeviceCount = dp.Devices.Count,
DeviceDecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue)
}).ToArray().Cast<ConfigDeviceProfileIndexModelItem>().ToList();
+2 -2
View File
@@ -137,7 +137,7 @@ namespace Disco.Web.Controllers
(j.JobTypeId == JobType.JobTypeIds.HNWar && (j.JobMetaNonWarranty.IsInsuranceClaim && !j.JobMetaInsurance.ClaimFormSentDate.HasValue)) ||
(j.JobTypeId == JobType.JobTypeIds.HNWar && (j.JobMetaNonWarranty.AccountingChargeRequiredDate.HasValue && (!j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue && !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue))) ||
(j.JobTypeId == JobType.JobTypeIds.HNWar && (!j.JobMetaNonWarranty.AccountingChargeAddedDate.HasValue || !j.JobMetaNonWarranty.AccountingChargePaidDate.HasValue)) ||
(j.JobTypeId == JobType.JobTypeIds.UMgmt && (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement == (j.Flags & (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement))
(j.JobTypeId == JobType.JobTypeIds.UMgmt && Job.UserManagementFlags.Infringement_BreachFinancialAgreement == (j.Flags & Job.UserManagementFlags.Infringement_BreachFinancialAgreement))
)));
// UI Extensions
@@ -194,7 +194,7 @@ namespace Disco.Web.Controllers
var m = new Models.Job.ListModel() { Title = "Jobs Awaiting Finance - Agreement Breach" };
m.JobTable = new Disco.Models.BI.Job.JobTableModel() { ShowStatus = true };
m.JobTable.Fill(dbContext, BI.JobBI.Searching.BuildJobTableModel(dbContext).Where(j => j.ClosedDate == null &&
(j.JobTypeId == JobType.JobTypeIds.UMgmt && (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement == (j.Flags & (long)Job.UserManagementFlags.Infringement_BreachFinancialAgreement))
(j.JobTypeId == JobType.JobTypeIds.UMgmt && Job.UserManagementFlags.Infringement_BreachFinancialAgreement == (j.Flags & Job.UserManagementFlags.Infringement_BreachFinancialAgreement))
).OrderBy(j => j.Id));
// UI Extensions