qol: remove this
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Disco.Web.Models.Device
|
||||
|
||||
public int StatisticImportRecords
|
||||
{
|
||||
get { return this.StatisticNewRecords + StatisticModifiedRecords; }
|
||||
get { return StatisticNewRecords + StatisticModifiedRecords; }
|
||||
}
|
||||
|
||||
public IEnumerable<Tuple<DeviceImportFieldTypes, string>> HeaderTypes { get; set; }
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace Disco.Web.Models.InitialConfig
|
||||
public DatabaseModel()
|
||||
{
|
||||
// Set Defaults
|
||||
this.Server = "(local)";
|
||||
this.DatabaseName = "Disco";
|
||||
this.AuthMethod = "SSPI";
|
||||
Server = "(local)";
|
||||
DatabaseName = "Disco";
|
||||
AuthMethod = "SSPI";
|
||||
}
|
||||
|
||||
public static DatabaseModel FromConnectionString(string ConnectionString)
|
||||
@@ -51,11 +51,11 @@ namespace Disco.Web.Models.InitialConfig
|
||||
{
|
||||
var csb = new SqlConnectionStringBuilder()
|
||||
{
|
||||
DataSource = this.Server,
|
||||
InitialCatalog = this.DatabaseName,
|
||||
IntegratedSecurity = (this.AuthMethod.Equals("SSPI", StringComparison.OrdinalIgnoreCase)),
|
||||
UserID = (this.AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? this.Auth_SQL_Username : string.Empty,
|
||||
Password = (this.AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? this.Auth_SQL_Password : string.Empty,
|
||||
DataSource = Server,
|
||||
InitialCatalog = DatabaseName,
|
||||
IntegratedSecurity = (AuthMethod.Equals("SSPI", StringComparison.OrdinalIgnoreCase)),
|
||||
UserID = (AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? Auth_SQL_Username : string.Empty,
|
||||
Password = (AuthMethod.Equals("SQL", StringComparison.OrdinalIgnoreCase)) ? Auth_SQL_Password : string.Empty,
|
||||
ApplicationName = "Disco ICT WebApp",
|
||||
MultipleActiveResultSets = true,
|
||||
Pooling = true
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace Disco.Web.Models.InitialConfig
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(FileStoreLocation))
|
||||
{
|
||||
var branches = this.FileStoreLocation.ToUpper().Split(Path.DirectorySeparatorChar);
|
||||
var branchesCase = this.FileStoreLocation.Split(Path.DirectorySeparatorChar);
|
||||
var branches = FileStoreLocation.ToUpper().Split(Path.DirectorySeparatorChar);
|
||||
var branchesCase = FileStoreLocation.Split(Path.DirectorySeparatorChar);
|
||||
FileStoreDirectoryModel branchModel;
|
||||
FileStoreDirectoryModel branchParent = this.DirectoryModel;
|
||||
FileStoreDirectoryModel branchParent = DirectoryModel;
|
||||
for (int i = 0; i < branches.Length; i++)
|
||||
{
|
||||
var branch = branches[i];
|
||||
@@ -154,10 +154,10 @@ namespace Disco.Web.Models.InitialConfig
|
||||
|
||||
internal void ExpandSubDirectories()
|
||||
{
|
||||
if (this.SubDirectories == null)
|
||||
if (SubDirectories == null)
|
||||
{
|
||||
this.SubDirectories = new Dictionary<string, FileStoreDirectoryModel>();
|
||||
if (!this.IsNew)
|
||||
SubDirectories = new Dictionary<string, FileStoreDirectoryModel>();
|
||||
if (!IsNew)
|
||||
{
|
||||
var dirInfo = new DirectoryInfo(Path);
|
||||
if (dirInfo.Exists)
|
||||
@@ -167,13 +167,13 @@ namespace Disco.Web.Models.InitialConfig
|
||||
if (((subDir.Attributes & FileAttributes.System) != FileAttributes.System) &&
|
||||
((subDir.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden))
|
||||
{
|
||||
this.SubDirectories.Add(subDir.Name.ToUpper(), FileStoreDirectoryModel.FromInfo(subDir));
|
||||
SubDirectories.Add(subDir.Name.ToUpper(), FileStoreDirectoryModel.FromInfo(subDir));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.IsNew = true;
|
||||
IsNew = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Disco.Web.Models.InitialConfig
|
||||
{
|
||||
if (_OrganisationNameCache != null)
|
||||
{
|
||||
this.OrganisationName = _OrganisationNameCache;
|
||||
OrganisationName = _OrganisationNameCache;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace Disco.Web.Models.InitialConfig
|
||||
|
||||
if (whoAmIResult != null && !string.IsNullOrWhiteSpace(whoAmIResult.Item2))
|
||||
{
|
||||
this.OrganisationName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(whoAmIResult.Item2);
|
||||
_OrganisationNameCache = this.OrganisationName;
|
||||
OrganisationName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(whoAmIResult.Item2);
|
||||
_OrganisationNameCache = OrganisationName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,24 +42,24 @@ namespace Disco.Web.Models.Job
|
||||
|
||||
public void UpdateModel(DiscoDataContext Database, AuthorizationToken Authorization)
|
||||
{
|
||||
if (this.JobTypes == null)
|
||||
this.JobTypes = Database.JobTypes.Include("JobSubTypes.JobQueues").FilterCreatableTypePermissions(Authorization).ToList();
|
||||
if (JobTypes == null)
|
||||
JobTypes = Database.JobTypes.Include("JobSubTypes.JobQueues").FilterCreatableTypePermissions(Authorization).ToList();
|
||||
|
||||
if (!string.IsNullOrEmpty(DeviceSerialNumber))
|
||||
{
|
||||
this.Device = Database.Devices.Include("DeviceModel").Where(d => d.SerialNumber == DeviceSerialNumber).FirstOrDefault();
|
||||
if (this.Device == null)
|
||||
Device = Database.Devices.Include("DeviceModel").Where(d => d.SerialNumber == DeviceSerialNumber).FirstOrDefault();
|
||||
if (Device == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid Device Serial Number Specified", "DeviceSerialNumber");
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.UserId) && !string.IsNullOrEmpty(this.Device.AssignedUserId))
|
||||
if (string.IsNullOrEmpty(UserId) && !string.IsNullOrEmpty(Device.AssignedUserId))
|
||||
{
|
||||
this.UserId = this.Device.AssignedUserId;
|
||||
UserId = Device.AssignedUserId;
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = this.JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.HWar) ? Disco.Models.Repository.JobType.JobTypeIds.HWar : this.JobTypes.First().Id;
|
||||
if (string.IsNullOrEmpty(Type))
|
||||
Type = JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.HWar) ? Disco.Models.Repository.JobType.JobTypeIds.HWar : JobTypes.First().Id;
|
||||
|
||||
if (string.IsNullOrEmpty(this.UserId))
|
||||
if (string.IsNullOrEmpty(UserId))
|
||||
{
|
||||
// No User - Remove User Types
|
||||
foreach (var jobType in JobTypes.ToArray())
|
||||
@@ -94,20 +94,20 @@ namespace Disco.Web.Models.Job
|
||||
}
|
||||
|
||||
// Set Default Job Type for Users
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = this.JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.SApp) ? Disco.Models.Repository.JobType.JobTypeIds.SApp : this.JobTypes.First().Id;
|
||||
if (string.IsNullOrEmpty(Type))
|
||||
Type = JobTypes.Any(jt => jt.Id == Disco.Models.Repository.JobType.JobTypeIds.SApp) ? Disco.Models.Repository.JobType.JobTypeIds.SApp : JobTypes.First().Id;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(UserId))
|
||||
{
|
||||
this.User = Database.Users.Find(UserId);
|
||||
if (this.User == null)
|
||||
User = Database.Users.Find(UserId);
|
||||
if (User == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid User Id Specified", "UserId");
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.Type))
|
||||
this.Type = Disco.Models.Repository.JobType.JobTypeIds.SApp;
|
||||
if (string.IsNullOrEmpty(Type))
|
||||
Type = Disco.Models.Repository.JobType.JobTypeIds.SApp;
|
||||
}
|
||||
if (this.User == null && this.Device == null)
|
||||
if (User == null && Device == null)
|
||||
{
|
||||
throw new InvalidOperationException("A Job must reference a Device and/or a User");
|
||||
}
|
||||
@@ -118,9 +118,9 @@ namespace Disco.Web.Models.Job
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.Type))
|
||||
if (!string.IsNullOrEmpty(Type))
|
||||
{
|
||||
return this.JobTypes.FirstOrDefault(m => m.Id == this.Type);
|
||||
return JobTypes.FirstOrDefault(m => m.Id == Type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -131,8 +131,8 @@ namespace Disco.Web.Models.Job
|
||||
{
|
||||
if (SubTypes != null)
|
||||
{
|
||||
var subTypes = this.SubTypes;
|
||||
return this.JobTypes.SelectMany(jt => jt.JobSubTypes).Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
|
||||
var subTypes = SubTypes;
|
||||
return JobTypes.SelectMany(jt => jt.JobSubTypes).Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace Disco.Web.Models.Job
|
||||
public Dictionary<string, string> ProviderProperties()
|
||||
{
|
||||
Dictionary<string, string> p = default(Dictionary<string, string>);
|
||||
if (!string.IsNullOrEmpty(this.ProviderPropertiesJson))
|
||||
if (!string.IsNullOrEmpty(ProviderPropertiesJson))
|
||||
{
|
||||
try
|
||||
{
|
||||
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(this.ProviderPropertiesJson);
|
||||
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(ProviderPropertiesJson);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ namespace Disco.Web.Models.Job
|
||||
}
|
||||
|
||||
// Update TechUser's Details [#12]
|
||||
this.TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
|
||||
TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
|
||||
|
||||
RepairProviders = Plugins.GetPluginFeatures(typeof(RepairProviderFeature));
|
||||
|
||||
@@ -113,16 +113,16 @@ namespace Disco.Web.Models.Job
|
||||
if (!string.IsNullOrEmpty(RepairProviderId) && RepairProviderId != "MANUAL")
|
||||
RepairProvider = Plugins.GetPluginFeature(RepairProviderId, typeof(RepairProviderFeature));
|
||||
|
||||
this.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
|
||||
OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
|
||||
|
||||
if (!IsPostBack && !this.OrganisationAddressId.HasValue)
|
||||
if (!IsPostBack && !OrganisationAddressId.HasValue)
|
||||
{
|
||||
OrganisationAddressId = Job.Device.DeviceProfile.DefaultOrganisationAddress;
|
||||
if (!OrganisationAddressId.HasValue && OrganisationAddresses.Count == 1)
|
||||
OrganisationAddressId = OrganisationAddresses[0].Id;
|
||||
}
|
||||
if (this.OrganisationAddressId.HasValue)
|
||||
this.OrganisationAddress = this.OrganisationAddresses.FirstOrDefault(oa => oa.Id == this.OrganisationAddressId.Value);
|
||||
if (OrganisationAddressId.HasValue)
|
||||
OrganisationAddress = OrganisationAddresses.FirstOrDefault(oa => oa.Id == OrganisationAddressId.Value);
|
||||
|
||||
if (!string.IsNullOrEmpty(RepairDescription))
|
||||
RepairDescription = RepairDescription.Trim();
|
||||
|
||||
@@ -51,11 +51,11 @@ namespace Disco.Web.Models.Job
|
||||
public Dictionary<string, string> ProviderProperties()
|
||||
{
|
||||
Dictionary<string, string> p = default(Dictionary<string, string>);
|
||||
if (!string.IsNullOrEmpty(this.ProviderPropertiesJson))
|
||||
if (!string.IsNullOrEmpty(ProviderPropertiesJson))
|
||||
{
|
||||
try
|
||||
{
|
||||
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(this.ProviderPropertiesJson);
|
||||
p = JsonConvert.DeserializeObject<Dictionary<string, string>>(ProviderPropertiesJson);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ namespace Disco.Web.Models.Job
|
||||
}
|
||||
|
||||
// Update TechUser's Details [#12]
|
||||
this.TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
|
||||
TechUser = UserService.GetUser(UserService.CurrentUserId, Database, true);
|
||||
|
||||
WarrantyProviders = Plugins.GetPluginFeatures(typeof(WarrantyProviderFeature));
|
||||
|
||||
@@ -113,16 +113,16 @@ namespace Disco.Web.Models.Job
|
||||
if (!string.IsNullOrEmpty(WarrantyProviderId) && WarrantyProviderId != "MANUAL")
|
||||
WarrantyProvider = Plugins.GetPluginFeature(WarrantyProviderId, typeof(WarrantyProviderFeature));
|
||||
|
||||
this.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
|
||||
OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses.OrderBy(a => a.Name).ToList();
|
||||
|
||||
if (!IsPostBack && !this.OrganisationAddressId.HasValue)
|
||||
if (!IsPostBack && !OrganisationAddressId.HasValue)
|
||||
{
|
||||
OrganisationAddressId = Job.Device.DeviceProfile.DefaultOrganisationAddress;
|
||||
if (!OrganisationAddressId.HasValue && OrganisationAddresses.Count == 1)
|
||||
OrganisationAddressId = OrganisationAddresses[0].Id;
|
||||
}
|
||||
if (this.OrganisationAddressId.HasValue)
|
||||
this.OrganisationAddress = this.OrganisationAddresses.FirstOrDefault(oa => oa.Id == this.OrganisationAddressId.Value);
|
||||
if (OrganisationAddressId.HasValue)
|
||||
OrganisationAddress = OrganisationAddresses.FirstOrDefault(oa => oa.Id == OrganisationAddressId.Value);
|
||||
|
||||
if (!string.IsNullOrEmpty(FaultDescription))
|
||||
FaultDescription = FaultDescription.Trim();
|
||||
|
||||
Reference in New Issue
Block a user