qol: interpolated strings
This commit is contained in:
@@ -240,7 +240,7 @@ namespace Disco.Web.Controllers
|
||||
.FirstOrDefault(d => d.SerialNumber == id);
|
||||
|
||||
if (m.Device == null)
|
||||
throw new ArgumentException(string.Format("Unknown Device: [{0}]", id), "id");
|
||||
throw new ArgumentException($"Unknown Device: [{id}]", "id");
|
||||
|
||||
// No Necessary - Yet...
|
||||
//if (!string.IsNullOrWhiteSpace(m.Device.ComputerName))
|
||||
|
||||
@@ -150,11 +150,11 @@ namespace Disco.Web.Controllers
|
||||
|
||||
if (sqlException != null)
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, string.Format("Unable to create or migrate the database to the latest version: [{0}] {1}", sqlException.GetType().Name, sqlException.Message));
|
||||
ModelState.AddModelError(string.Empty, $"Unable to create or migrate the database to the latest version: [{sqlException.GetType().Name}] {sqlException.Message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, string.Format("Unable to create or migrate the database to the latest version: [{0}] {1}", innermostException.GetType().Name, innermostException.Message));
|
||||
ModelState.AddModelError(string.Empty, $"Unable to create or migrate the database to the latest version: [{innermostException.GetType().Name}] {innermostException.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace Disco.Web.Controllers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, string.Format("Unable to extract File Store template: [{0}] {1}", ex.GetType().Name, ex.Message));
|
||||
ModelState.AddModelError(string.Empty, $"Unable to extract File Store template: [{ex.GetType().Name}] {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace Disco.Web.Controllers
|
||||
var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList();
|
||||
|
||||
if (invalidSubjects.Count > 0)
|
||||
throw new ArgumentException(string.Format("Subjects not found: {0}", string.Join(", ", invalidSubjects)), "Subjects");
|
||||
throw new ArgumentException($"Subjects not found: {string.Join(", ", invalidSubjects)}", "Subjects");
|
||||
|
||||
proposedSubjects = subjects.Select(s => s.Item2.Id).OrderBy(s => s).ToArray();
|
||||
var currentSubjects = UserService.AdministratorSubjectIds;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Disco.Web.Controllers
|
||||
if (queueToken == null)
|
||||
throw new ArgumentException("Invalid Job Queue Id", "id");
|
||||
|
||||
var m = new Models.Job.ListModel() { Title = string.Format("Queue: {0}", queueToken.JobQueue.Name) };
|
||||
var m = new Models.Job.ListModel() { Title = $"Queue: {queueToken.JobQueue.Name}" };
|
||||
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j => j.ActiveJobQueues.Any(jqj => jqj.QueueId == queueToken.JobQueue.Id)));
|
||||
|
||||
// UI Extensions
|
||||
@@ -326,7 +326,7 @@ namespace Disco.Web.Controllers
|
||||
.FirstOrDefault(j => j.Id == id.Value);
|
||||
|
||||
if (m.Job == null)
|
||||
throw new ArgumentException(string.Format("Unknown Job: [{0}]", id), "id");
|
||||
throw new ArgumentException($"Unknown Job: [{id}]", "id");
|
||||
|
||||
// Validate Authorization
|
||||
switch (m.Job.JobTypeId)
|
||||
@@ -695,14 +695,14 @@ namespace Disco.Web.Controllers
|
||||
else
|
||||
{
|
||||
model.JobDetailsSupported = false;
|
||||
model.JobDetailsNotSupportedMessage = string.Format("Plugin '{0} ({1})' (Warranty Provider for '{2}') doesn't support Job Details", providerInstance.Manifest.Name, providerInstance.Manifest.Id, providerInstance.WarrantyProviderId);
|
||||
model.JobDetailsNotSupportedMessage = $"Plugin '{providerInstance.Manifest.Name} ({providerInstance.Manifest.Id})' (Warranty Provider for '{providerInstance.WarrantyProviderId}') doesn't support Job Details";
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model.JobDetailsSupported = false;
|
||||
model.JobDetailsNotSupportedMessage = string.Format("Warranty Provider '{0}' is not integrated with Disco ICT", job.JobMetaWarranty.ExternalName);
|
||||
model.JobDetailsNotSupportedMessage = $"Warranty Provider '{job.JobMetaWarranty.ExternalName}' is not integrated with Disco ICT";
|
||||
return View(model);
|
||||
}
|
||||
else
|
||||
@@ -874,14 +874,14 @@ namespace Disco.Web.Controllers
|
||||
else
|
||||
{
|
||||
model.JobDetailsSupported = false;
|
||||
model.JobDetailsNotSupportedMessage = string.Format("Plugin '{0} ({1})' (Repair Provider for '{2}') doesn't support Job Details", providerInstance.Manifest.Name, providerInstance.Manifest.Id, providerInstance.ProviderId);
|
||||
model.JobDetailsNotSupportedMessage = $"Plugin '{providerInstance.Manifest.Name} ({providerInstance.Manifest.Id})' (Repair Provider for '{providerInstance.ProviderId}') doesn't support Job Details";
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model.JobDetailsSupported = false;
|
||||
model.JobDetailsNotSupportedMessage = string.Format("Repair Provider '{0}' is not integrated with Disco ICT", job.JobMetaNonWarranty.RepairerName);
|
||||
model.JobDetailsNotSupportedMessage = $"Repair Provider '{job.JobMetaNonWarranty.RepairerName}' is not integrated with Disco ICT";
|
||||
return View(model);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Disco.Web.Controllers
|
||||
catch (AccessDeniedException accessDeniedException)
|
||||
{
|
||||
if (UserService.CurrentUserId != null)
|
||||
AuthorizationLog.LogAccessDenied(UserService.CurrentUserId, string.Format("{0} [{1}]", accessDeniedException.Resource, Request.RawUrl), accessDeniedException.Message);
|
||||
AuthorizationLog.LogAccessDenied(UserService.CurrentUserId, $"{accessDeniedException.Resource} [{Request.RawUrl}]", accessDeniedException.Message);
|
||||
|
||||
return new HttpUnauthorizedResult();
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Disco.Web.Controllers
|
||||
break;
|
||||
}
|
||||
}
|
||||
m.FriendlyTerm = string.Format("Device Model: {0}", term);
|
||||
m.FriendlyTerm = $"Device Model: {term}";
|
||||
m.Success = false;
|
||||
m.ErrorMessage = "Invalid Device Model Id";
|
||||
break;
|
||||
@@ -105,7 +105,7 @@ namespace Disco.Web.Controllers
|
||||
break;
|
||||
}
|
||||
}
|
||||
m.FriendlyTerm = string.Format("Device Profile: {0}", term);
|
||||
m.FriendlyTerm = $"Device Profile: {term}";
|
||||
m.Success = false;
|
||||
m.ErrorMessage = "Invalid Device Profile Id";
|
||||
break;
|
||||
@@ -122,7 +122,7 @@ namespace Disco.Web.Controllers
|
||||
break;
|
||||
}
|
||||
}
|
||||
m.FriendlyTerm = string.Format("Device Batch: {0}", term);
|
||||
m.FriendlyTerm = $"Device Batch: {term}";
|
||||
m.Success = false;
|
||||
m.ErrorMessage = "Invalid Device Batch Id";
|
||||
break;
|
||||
@@ -239,7 +239,7 @@ namespace Disco.Web.Controllers
|
||||
var flag = Database.UserFlags.Find(userFlagId);
|
||||
if (flag != null)
|
||||
{
|
||||
m.FriendlyTerm = string.Format("User Flag: {0}", flag.ToString());
|
||||
m.FriendlyTerm = $"User Flag: {flag.ToString()}";
|
||||
m.Users = Services.Searching.Search.SearchUserFlag(Database, flag.Id);
|
||||
break;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ namespace Disco.Web.Controllers
|
||||
var flag = Database.DeviceFlags.Find(deviceFlagId);
|
||||
if (flag != null)
|
||||
{
|
||||
m.FriendlyTerm = string.Format("Device Flag: {0}", flag.ToString());
|
||||
m.FriendlyTerm = $"Device Flag: {flag.ToString()}";
|
||||
m.Devices = Services.Searching.Search.SearchDeviceFlag(Database, flag.Id);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user