GIT: perform LF normalization

This commit is contained in:
Gary Sharp
2013-02-28 17:15:46 +11:00
parent 989f08a24d
commit 7d9be5620d
729 changed files with 300734 additions and 300712 deletions
@@ -1,26 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Models.BI.Interop.Community;
namespace Disco.Web.Areas.Config.Models.Config
{
public class IndexModel
{
public bool UpdateAvailable
{
get
{
if (UpdateResponse != null)
{
var updateVersion = Version.Parse(UpdateResponse.Version);
return (updateVersion > typeof(DiscoApplication).Assembly.GetName().Version);
}
return false;
}
}
public UpdateResponse UpdateResponse { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Models.BI.Interop.Community;
namespace Disco.Web.Areas.Config.Models.Config
{
public class IndexModel
{
public bool UpdateAvailable
{
get
{
if (UpdateResponse != null)
{
var updateVersion = Version.Parse(UpdateResponse.Version);
return (updateVersion > typeof(DiscoApplication).Assembly.GetName().Version);
}
return false;
}
}
public UpdateResponse UpdateResponse { get; set; }
}
}
@@ -1,34 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public class IndexModel
{
public List<_IndexModelDeviceBatch> DeviceBatches { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
{
var m = new IndexModel();
m.DeviceBatches = dbContext.DeviceBatches.OrderBy(db => db.Name).Select(db => new _IndexModelDeviceBatch()
{
Id = db.Id,
Name = db.Name,
PurchaseDate = db.PurchaseDate,
PurchaseUnitQuantity = db.UnitQuantity,
DeviceCount = db.Devices.Count,
DeviceDecommissionedCount = db.Devices.Count(d=> d.DecommissionedDate.HasValue),
DefaultDeviceModel = db.DefaultDeviceModel.Description,
WarrantyExpires = db.WarrantyValidUntil,
InsuranceSupplier = db.InsuranceSupplier,
InsuredUntil = db.InsuredUntil
}).ToList();
return m;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public class IndexModel
{
public List<_IndexModelDeviceBatch> DeviceBatches { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
{
var m = new IndexModel();
m.DeviceBatches = dbContext.DeviceBatches.OrderBy(db => db.Name).Select(db => new _IndexModelDeviceBatch()
{
Id = db.Id,
Name = db.Name,
PurchaseDate = db.PurchaseDate,
PurchaseUnitQuantity = db.UnitQuantity,
DeviceCount = db.Devices.Count,
DeviceDecommissionedCount = db.Devices.Count(d=> d.DecommissionedDate.HasValue),
DefaultDeviceModel = db.DefaultDeviceModel.Description,
WarrantyExpires = db.WarrantyValidUntil,
InsuranceSupplier = db.InsuranceSupplier,
InsuredUntil = db.InsuredUntil
}).ToList();
return m;
}
}
}
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public class ShowModel
{
public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
public List<SelectListItem> DeviceModels { get; set; }
public int DeviceCount { get; set; }
public int DeviceDecommissionedCount { get; set; }
public bool CanDelete { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public class ShowModel
{
public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
public List<SelectListItem> DeviceModels { get; set; }
public int DeviceCount { get; set; }
public int DeviceDecommissionedCount { get; set; }
public bool CanDelete { get; set; }
}
}
@@ -1,23 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public class _IndexModelDeviceBatch
{
public int Id { get; set; }
public string Name { get; set; }
[Required(), DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd}", HtmlEncode = false)]
public DateTime PurchaseDate { get; set; }
public int DeviceCount { get; set; }
public int DeviceDecommissionedCount { get; set; }
public int? PurchaseUnitQuantity { get; set; }
public string DefaultDeviceModel { get; set; }
public DateTime? WarrantyExpires { get; set; }
public DateTime? InsuredUntil { get; set; }
public string InsuranceSupplier { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public class _IndexModelDeviceBatch
{
public int Id { get; set; }
public string Name { get; set; }
[Required(), DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd}", HtmlEncode = false)]
public DateTime PurchaseDate { get; set; }
public int DeviceCount { get; set; }
public int DeviceDecommissionedCount { get; set; }
public int? PurchaseUnitQuantity { get; set; }
public string DefaultDeviceModel { get; set; }
public DateTime? WarrantyExpires { get; set; }
public DateTime? InsuredUntil { get; set; }
public string InsuranceSupplier { get; set; }
}
}
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class DeviceComponentsModel
{
public int? DeviceModelId { get; set; }
public List<Disco.Models.Repository.DeviceComponent> DeviceComponents { get; set; }
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class DeviceComponentsModel
{
public int? DeviceModelId { get; set; }
public List<Disco.Models.Repository.DeviceComponent> DeviceComponents { get; set; }
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
}
}
@@ -1,30 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class IndexModel
{
public List<_IndexModelDeviceModel> DeviceModels { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
{
var m = new IndexModel();
m.DeviceModels = dbContext.DeviceModels.OrderBy(dm => dm.Description).Select(dm => new _IndexModelDeviceModel()
{
Id = dm.Id,
Name = dm.Description,
Manufacturer = dm.Manufacturer,
Model = dm.Model,
ModelType = dm.ModelType,
DeviceCount = dm.Devices.Count
}).ToList();
return m;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class IndexModel
{
public List<_IndexModelDeviceModel> DeviceModels { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
{
var m = new IndexModel();
m.DeviceModels = dbContext.DeviceModels.OrderBy(dm => dm.Description).Select(dm => new _IndexModelDeviceModel()
{
Id = dm.Id,
Name = dm.Description,
Manufacturer = dm.Manufacturer,
Model = dm.Model,
ModelType = dm.ModelType,
DeviceCount = dm.Devices.Count
}).ToList();
return m;
}
}
}
@@ -1,19 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Plugins;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class ShowModel
{
public Disco.Models.Repository.DeviceModel DeviceModel { get; set; }
public Models.DeviceModel.DeviceComponentsModel DeviceComponentsModel { get; set; }
public List<PluginFeatureManifest> WarrantyProviders { get; set; }
public bool CanDelete { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Plugins;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class ShowModel
{
public Disco.Models.Repository.DeviceModel DeviceModel { get; set; }
public Models.DeviceModel.DeviceComponentsModel DeviceComponentsModel { get; set; }
public List<PluginFeatureManifest> WarrantyProviders { get; set; }
public bool CanDelete { get; set; }
}
}
@@ -1,26 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class _IndexModelDeviceModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Manufacturer { get; set; }
public string Model { get; set; }
public string ModelType { get; set; }
public int DeviceCount { get; set; }
public override string ToString()
{
if (string.IsNullOrEmpty(Name))
return string.Format("{0} {1}", Manufacturer, Model);
else
return Name;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public class _IndexModelDeviceModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Manufacturer { get; set; }
public string Model { get; set; }
public string ModelType { get; set; }
public int DeviceCount { get; set; }
public override string ToString()
{
if (string.IsNullOrEmpty(Name))
return string.Format("{0} {1}", Manufacturer, Model);
else
return Name;
}
}
}
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class DefaultsModel
{
public List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; }
public List<Disco.Models.Repository.DeviceProfile> DeviceProfilesAndNone { get; set; }
public int Default { get; set; }
public int DefaultAddDeviceOffline { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class DefaultsModel
{
public List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; }
public List<Disco.Models.Repository.DeviceProfile> DeviceProfilesAndNone { get; set; }
public int Default { get; set; }
public int DefaultAddDeviceOffline { get; set; }
}
}
@@ -1,40 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class IndexModel
{
public List<_IndexModelDeviceProfile> DeviceProfiles { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
{
var m = new IndexModel();
m.DeviceProfiles = dbContext.DeviceProfiles.OrderBy(dp => dp.Name).Select(dp => new _IndexModelDeviceProfile()
{
Id = dp.Id,
Name = dp.Name,
ShortName = dp.ShortName,
Address = dp.DefaultOrganisationAddress,
Description = dp.Description,
DistributionTypeId = dp.DistributionTypeDb,
DeviceCount = dp.Devices.Count,
DeviceDecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue)
}).ToList();
if (DiscoApplication.MultiSiteMode)
{
foreach (var dp in m.DeviceProfiles)
if (dp.Address.HasValue)
dp.AddressName = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(dp.Address.Value).Name;
}
return m;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class IndexModel
{
public List<_IndexModelDeviceProfile> DeviceProfiles { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
{
var m = new IndexModel();
m.DeviceProfiles = dbContext.DeviceProfiles.OrderBy(dp => dp.Name).Select(dp => new _IndexModelDeviceProfile()
{
Id = dp.Id,
Name = dp.Name,
ShortName = dp.ShortName,
Address = dp.DefaultOrganisationAddress,
Description = dp.Description,
DistributionTypeId = dp.DistributionTypeDb,
DeviceCount = dp.Devices.Count,
DeviceDecommissionedCount = dp.Devices.Count(d => d.DecommissionedDate.HasValue)
}).ToList();
if (DiscoApplication.MultiSiteMode)
{
foreach (var dp in m.DeviceProfiles)
if (dp.Address.HasValue)
dp.AddressName = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(dp.Address.Value).Name;
}
return m;
}
}
}
@@ -1,20 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class ShowModel
{
public Disco.Models.Repository.DeviceProfile DeviceProfile { get; set; }
public List<SelectListItem> DeviceProfileDistributionTypes { get; set; }
public List<Disco.Models.BI.Config.OrganisationAddress> OrganisationAddresses { get; set; }
public List<PluginFeatureManifest> CertificateProviders { get; set; }
public bool CanDelete { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class ShowModel
{
public Disco.Models.Repository.DeviceProfile DeviceProfile { get; set; }
public List<SelectListItem> DeviceProfileDistributionTypes { get; set; }
public List<Disco.Models.BI.Config.OrganisationAddress> OrganisationAddresses { get; set; }
public List<PluginFeatureManifest> CertificateProviders { get; set; }
public bool CanDelete { get; set; }
}
}
@@ -1,32 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Disco.Web.Extensions;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class _IndexModelDeviceProfile
{
public int Id { get; set; }
public string Name { get; set; }
public string ShortName { get; set; }
public int? Address { get; set; }
//public string AddressShortName { get; set; }
public string AddressName { get; set; }
public string Description { get; set; }
public int DistributionTypeId { get; set; }
public string DistributionType
{
get
{
return Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), this.DistributionTypeId);
}
}
public int DeviceCount { get; set; }
public int DeviceDecommissionedCount { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Disco.Web.Extensions;
namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public class _IndexModelDeviceProfile
{
public int Id { get; set; }
public string Name { get; set; }
public string ShortName { get; set; }
public int? Address { get; set; }
//public string AddressShortName { get; set; }
public string AddressName { get; set; }
public string Description { get; set; }
public int DistributionTypeId { get; set; }
public string DistributionType
{
get
{
return Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), this.DistributionTypeId);
}
}
public int DeviceCount { get; set; }
public int DeviceDecommissionedCount { get; set; }
}
}
@@ -1,87 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Disco.Data.Repository;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
[CustomValidation(typeof(CreateModelValidation), "ValidateCreateModel")]
public class CreateModel
{
public Disco.Models.Repository.DocumentTemplate DocumentTemplate { get; set; }
[Required]
public HttpPostedFileBase Template { get; set; }
public List<string> Types { get; set; }
public List<string> SubTypes { get; set; }
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
public List<string> Scopes
{
get
{
return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
}
}
public List<Disco.Models.Repository.JobType> GetJobTypes
{
get
{
if (Types != null)
{
var types = this.Types;
return this.JobTypes.Where(m => types.Contains(m.Id)).ToList();
}
return null;
}
}
public List<Disco.Models.Repository.JobSubType> GetJobSubTypes
{
get
{
if (SubTypes != null)
{
var subTypes = this.SubTypes;
return this.JobSubTypes.Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
}
return null;
}
}
public void UpdateModel(DiscoDataContext dbContext)
{
if (this.JobTypes == null)
JobTypes = dbContext.JobTypes.ToList();
if (this.JobSubTypes == null)
JobSubTypes = dbContext.JobSubTypes.ToList();
}
}
public class CreateModelValidation
{
public static ValidationResult ValidateCreateModel(CreateModel model)
{
if (model.DocumentTemplate != null && model.DocumentTemplate.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job)
{
if (model.Types != null && model.SubTypes != null)
{
var typeId = string.Format("{0}_", model.Types);
model.SubTypes = model.SubTypes.Where(m => model.Types.Contains(m.Substring(0, m.IndexOf("_")))).ToList();
}
}
return ValidationResult.Success;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Disco.Data.Repository;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
[CustomValidation(typeof(CreateModelValidation), "ValidateCreateModel")]
public class CreateModel
{
public Disco.Models.Repository.DocumentTemplate DocumentTemplate { get; set; }
[Required]
public HttpPostedFileBase Template { get; set; }
public List<string> Types { get; set; }
public List<string> SubTypes { get; set; }
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
public List<string> Scopes
{
get
{
return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
}
}
public List<Disco.Models.Repository.JobType> GetJobTypes
{
get
{
if (Types != null)
{
var types = this.Types;
return this.JobTypes.Where(m => types.Contains(m.Id)).ToList();
}
return null;
}
}
public List<Disco.Models.Repository.JobSubType> GetJobSubTypes
{
get
{
if (SubTypes != null)
{
var subTypes = this.SubTypes;
return this.JobSubTypes.Where(m => subTypes.Contains(String.Format("{0}_{1}", m.JobTypeId, m.Id))).ToList();
}
return null;
}
}
public void UpdateModel(DiscoDataContext dbContext)
{
if (this.JobTypes == null)
JobTypes = dbContext.JobTypes.ToList();
if (this.JobSubTypes == null)
JobSubTypes = dbContext.JobSubTypes.ToList();
}
}
public class CreateModelValidation
{
public static ValidationResult ValidateCreateModel(CreateModel model)
{
if (model.DocumentTemplate != null && model.DocumentTemplate.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job)
{
if (model.Types != null && model.SubTypes != null)
{
var typeId = string.Format("{0}_", model.Types);
model.SubTypes = model.SubTypes.Where(m => model.Types.Contains(m.Substring(0, m.IndexOf("_")))).ToList();
}
}
return ValidationResult.Success;
}
}
}
@@ -1,21 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class ExpressionBrowserModel
{
public string DeviceType { get; set; }
public string UserType { get; set; }
public string JobType { get; set; }
//public string DataExtType { get; set; }
//public string DeviceExtType { get; set; }
//public string UserExtType { get; set; }
public Dictionary<string, string> Variables { get; set; }
public Dictionary<string, string> ExtensionLibraries { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class ExpressionBrowserModel
{
public string DeviceType { get; set; }
public string UserType { get; set; }
public string JobType { get; set; }
//public string DataExtType { get; set; }
//public string DeviceExtType { get; set; }
//public string UserExtType { get; set; }
public Dictionary<string, string> Variables { get; set; }
public Dictionary<string, string> ExtensionLibraries { get; set; }
}
}
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class IndexModel
{
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class IndexModel
{
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
}
}
@@ -1,74 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
using Disco.Models.Repository;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class ShowModel
{
public Disco.Models.Repository.DocumentTemplate DocumentTemplate { get; set; }
public int StoredInstanceCount { get; set; }
public List<Disco.BI.Expressions.Expression> TemplateExpressions { get; set; }
public List<string> Types { get; set; }
public List<string> SubTypes { get; set; }
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
public ShowModel()
{
this.Types = new List<string>();
this.SubTypes = new List<string>();
}
public List<string> Scopes
{
get
{
return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
}
}
public void UpdateModel(DiscoDataContext dbContext)
{
switch (this.DocumentTemplate.Scope)
{
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Device:
this.StoredInstanceCount = dbContext.DeviceAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job:
this.StoredInstanceCount = dbContext.JobAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.User:
this.StoredInstanceCount = dbContext.UserAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
}
if (this.JobTypes == null)
JobTypes = dbContext.JobTypes.ToList();
if (this.JobSubTypes == null)
JobSubTypes = dbContext.JobSubTypes.ToList();
if (DocumentTemplate != null)
{
if (DocumentTemplate.JobSubTypes != null)
{
foreach (var jst in DocumentTemplate.JobSubTypes)
{
if (!Types.Contains(jst.JobTypeId))
Types.Add(jst.JobTypeId);
SubTypes.Add(string.Format("{0}_{1}", jst.JobTypeId, jst.Id));
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
using Disco.Models.Repository;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class ShowModel
{
public Disco.Models.Repository.DocumentTemplate DocumentTemplate { get; set; }
public int StoredInstanceCount { get; set; }
public List<Disco.BI.Expressions.Expression> TemplateExpressions { get; set; }
public List<string> Types { get; set; }
public List<string> SubTypes { get; set; }
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
public ShowModel()
{
this.Types = new List<string>();
this.SubTypes = new List<string>();
}
public List<string> Scopes
{
get
{
return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
}
}
public void UpdateModel(DiscoDataContext dbContext)
{
switch (this.DocumentTemplate.Scope)
{
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Device:
this.StoredInstanceCount = dbContext.DeviceAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job:
this.StoredInstanceCount = dbContext.JobAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.User:
this.StoredInstanceCount = dbContext.UserAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
}
if (this.JobTypes == null)
JobTypes = dbContext.JobTypes.ToList();
if (this.JobSubTypes == null)
JobSubTypes = dbContext.JobSubTypes.ToList();
if (DocumentTemplate != null)
{
if (DocumentTemplate.JobSubTypes != null)
{
foreach (var jst in DocumentTemplate.JobSubTypes)
{
if (!Types.Contains(jst.JobTypeId))
Types.Add(jst.JobTypeId);
SubTypes.Add(string.Format("{0}_{1}", jst.JobTypeId, jst.Id));
}
}
}
}
}
}
@@ -1,30 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Web.Extensions;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class UndetectedPagesModel
{
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
public List<SelectListItem> DocumentTemplatesSelectListItems
{
get
{
var list = new List<SelectListItem>();
list.Add(new SelectListItem() { Selected = false, Value = "--DEVICE", Text = "<Generic Device Document>" });
list.Add(new SelectListItem() { Selected = true, Value = "--JOB", Text = "<Generic Job Document>" });
list.Add(new SelectListItem() { Selected = false, Value = "--USER", Text = "<Generic User Document>" });
list.AddRange(this.DocumentTemplates.ToSelectListItems());
return list;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Web.Extensions;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class UndetectedPagesModel
{
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
public List<SelectListItem> DocumentTemplatesSelectListItems
{
get
{
var list = new List<SelectListItem>();
list.Add(new SelectListItem() { Selected = false, Value = "--DEVICE", Text = "<Generic Device Document>" });
list.Add(new SelectListItem() { Selected = true, Value = "--JOB", Text = "<Generic Job Document>" });
list.Add(new SelectListItem() { Selected = false, Value = "--USER", Text = "<Generic User Document>" });
list.AddRange(this.DocumentTemplates.ToSelectListItems());
return list;
}
}
}
}
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Enrolment
{
public class IndexModel
{
public string MacSshUsername { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Enrolment
{
public class IndexModel
{
public string MacSshUsername { get; set; }
}
}
@@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Expressions
{
public class EditorModel
{
public string Expression { get; set; }
public Disco.Web.Areas.API.Models.Expressions.ValidateExpressionModel ExpressionException { get; set; }
public string TestScope { get; set; }
public string TestScopeDataType { get; set; }
public string TestScopeDataId { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Expressions
{
public class EditorModel
{
public string Expression { get; set; }
public Disco.Web.Areas.API.Models.Expressions.ValidateExpressionModel ExpressionException { get; set; }
public string TestScope { get; set; }
public string TestScopeDataType { get; set; }
public string TestScopeDataId { get; set; }
}
}
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
namespace Disco.Web.Areas.Config.Models.Logging
{
public class IndexModel
{
public Dictionary<LogBase, List<LogEventType>> LogModules { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
namespace Disco.Web.Areas.Config.Models.Logging
{
public class IndexModel
{
public Dictionary<LogBase, List<LogEventType>> LogModules { get; set; }
}
}
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Logging
{
public class TaskStatusModel
{
public string SessionId { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Logging
{
public class TaskStatusModel
{
public string SessionId { get; set; }
}
}
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Models.BI.Config;
using System.ComponentModel.DataAnnotations;
namespace Disco.Web.Areas.Config.Models.Organisation
{
public class IndexModel
{
public string OrganisationName { get; set; }
[Display(Name="Enabled")]
public bool MultiSiteMode { get; set; }
public List<OrganisationAddress> OrganisationAddresses { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Models.BI.Config;
using System.ComponentModel.DataAnnotations;
namespace Disco.Web.Areas.Config.Models.Organisation
{
public class IndexModel
{
public string OrganisationName { get; set; }
[Display(Name="Enabled")]
public bool MultiSiteMode { get; set; }
public List<OrganisationAddress> OrganisationAddresses { get; set; }
}
}
@@ -1,20 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Shared
{
public class LogEventsModel
{
public bool IsLive { get; set; }
public Disco.Services.Logging.LogBase ModuleFilter { get; set; }
public IEnumerable<Disco.Services.Logging.Models.LogEventType> EventTypesFilter { get; set; }
public int? TakeFilter { get; set; }
public DateTime? StartFilter { get; set; }
public DateTime? EndFilter { get; set; }
public int? ViewPortHeight { get; set; }
public int? ViewPortWidth { get; set; }
public string JavascriptLiveEventFunctionName { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.Shared
{
public class LogEventsModel
{
public bool IsLive { get; set; }
public Disco.Services.Logging.LogBase ModuleFilter { get; set; }
public IEnumerable<Disco.Services.Logging.Models.LogEventType> EventTypesFilter { get; set; }
public int? TakeFilter { get; set; }
public DateTime? StartFilter { get; set; }
public DateTime? EndFilter { get; set; }
public int? ViewPortHeight { get; set; }
public int? ViewPortWidth { get; set; }
public string JavascriptLiveEventFunctionName { get; set; }
}
}
@@ -1,126 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Configuration;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlClient;
using Disco.Data.Repository;
using Disco.Models.BI.Interop.Community;
using Disco.Services.Tasks;
namespace Disco.Web.Areas.Config.Models.SystemConfig
{
public class IndexModel
{
public Version DiscoVersion { get; set; }
public DateTime? DiscoVersionBuilt
{
get
{
var v = DiscoVersion;
if (v != null)
{
try
{
return new DateTime(v.Minor + 2011, v.Build / 100, v.Build % 100, v.Revision / 100, v.Revision % 100, 0);
}
catch (Exception)
{
return null;
}
}
else
return null;
}
}
public string DataStoreLocation { get; set; }
#region Database Connection
private Lazy<SqlConnectionStringBuilder> DatabaseConnectionString = new Lazy<SqlConnectionStringBuilder>(() =>
{
return new SqlConnectionStringBuilder(Disco.Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString);
});
public string DatabaseServer
{
get
{
return this.DatabaseConnectionString.Value.DataSource;
}
}
public string DatabaseName
{
get
{
return this.DatabaseConnectionString.Value.InitialCatalog;
}
}
public string DatabaseAuthentication
{
get
{
return this.DatabaseConnectionString.Value.IntegratedSecurity ? "Integrated Authentication" : "SQL Authentication";
}
}
public string DatabaseSqlAuthUsername
{
get
{
return this.DatabaseConnectionString.Value.IntegratedSecurity ? null : this.DatabaseConnectionString.Value.UserID;
}
}
#endregion
#region Proxy
public string ProxyAddress { get; set; }
public int ProxyPort { get; set; }
public string ProxyUsername { get; set; }
[DataType(DataType.Password)]
public string ProxyPassword { get; set; }
#endregion
public ScheduledTaskStatus UpdateRunningStatus { get; set; }
public DateTime? UpdateNextScheduled { get; set; }
public UpdateResponse UpdateLatestResponse { get; set; }
public bool UpdateBetaDeployment { get; set; }
public static IndexModel FromConfiguration(ConfigurationContext config)
{
return new IndexModel()
{
DiscoVersion = typeof(DiscoApplication).Assembly.GetName().Version,
DataStoreLocation = config.DataStoreLocation,
ProxyAddress = config.ProxyAddress,
ProxyPort = config.ProxyPort,
ProxyUsername = config.ProxyUsername,
ProxyPassword = config.ProxyPassword,
UpdateLatestResponse = config.UpdateLastCheck,
UpdateRunningStatus = Disco.BI.Interop.Community.UpdateCheckTask.RunningStatus,
UpdateNextScheduled = Disco.BI.Interop.Community.UpdateCheckTask.NextScheduled,
UpdateBetaDeployment = config.UpdateBetaDeployment
};
}
public void ToConfiguration(DiscoDataContext db)
{
ConfigurationContext config = db.DiscoConfiguration;
//config.DataStoreLocation = DataStoreLocation;
config.ProxyAddress = ProxyAddress;
config.ProxyPort = ProxyPort;
config.ProxyUsername = ProxyUsername;
config.ProxyPassword = ProxyPassword;
DiscoApplication.SetGlobalProxy(ProxyAddress, ProxyPort, ProxyUsername, ProxyPassword);
db.SaveChanges();
// Try and check for updates if needed - After Proxy Changed
if (db.DiscoConfiguration.UpdateLastCheck == null
|| db.DiscoConfiguration.UpdateLastCheck.ResponseTimestamp < DateTime.Now.AddDays(-1))
{
Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Configuration;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlClient;
using Disco.Data.Repository;
using Disco.Models.BI.Interop.Community;
using Disco.Services.Tasks;
namespace Disco.Web.Areas.Config.Models.SystemConfig
{
public class IndexModel
{
public Version DiscoVersion { get; set; }
public DateTime? DiscoVersionBuilt
{
get
{
var v = DiscoVersion;
if (v != null)
{
try
{
return new DateTime(v.Minor + 2011, v.Build / 100, v.Build % 100, v.Revision / 100, v.Revision % 100, 0);
}
catch (Exception)
{
return null;
}
}
else
return null;
}
}
public string DataStoreLocation { get; set; }
#region Database Connection
private Lazy<SqlConnectionStringBuilder> DatabaseConnectionString = new Lazy<SqlConnectionStringBuilder>(() =>
{
return new SqlConnectionStringBuilder(Disco.Data.Repository.DiscoDatabaseConnectionFactory.DiscoDataContextConnectionString);
});
public string DatabaseServer
{
get
{
return this.DatabaseConnectionString.Value.DataSource;
}
}
public string DatabaseName
{
get
{
return this.DatabaseConnectionString.Value.InitialCatalog;
}
}
public string DatabaseAuthentication
{
get
{
return this.DatabaseConnectionString.Value.IntegratedSecurity ? "Integrated Authentication" : "SQL Authentication";
}
}
public string DatabaseSqlAuthUsername
{
get
{
return this.DatabaseConnectionString.Value.IntegratedSecurity ? null : this.DatabaseConnectionString.Value.UserID;
}
}
#endregion
#region Proxy
public string ProxyAddress { get; set; }
public int ProxyPort { get; set; }
public string ProxyUsername { get; set; }
[DataType(DataType.Password)]
public string ProxyPassword { get; set; }
#endregion
public ScheduledTaskStatus UpdateRunningStatus { get; set; }
public DateTime? UpdateNextScheduled { get; set; }
public UpdateResponse UpdateLatestResponse { get; set; }
public bool UpdateBetaDeployment { get; set; }
public static IndexModel FromConfiguration(ConfigurationContext config)
{
return new IndexModel()
{
DiscoVersion = typeof(DiscoApplication).Assembly.GetName().Version,
DataStoreLocation = config.DataStoreLocation,
ProxyAddress = config.ProxyAddress,
ProxyPort = config.ProxyPort,
ProxyUsername = config.ProxyUsername,
ProxyPassword = config.ProxyPassword,
UpdateLatestResponse = config.UpdateLastCheck,
UpdateRunningStatus = Disco.BI.Interop.Community.UpdateCheckTask.RunningStatus,
UpdateNextScheduled = Disco.BI.Interop.Community.UpdateCheckTask.NextScheduled,
UpdateBetaDeployment = config.UpdateBetaDeployment
};
}
public void ToConfiguration(DiscoDataContext db)
{
ConfigurationContext config = db.DiscoConfiguration;
//config.DataStoreLocation = DataStoreLocation;
config.ProxyAddress = ProxyAddress;
config.ProxyPort = ProxyPort;
config.ProxyUsername = ProxyUsername;
config.ProxyPassword = ProxyPassword;
DiscoApplication.SetGlobalProxy(ProxyAddress, ProxyPort, ProxyUsername, ProxyPassword);
db.SaveChanges();
// Try and check for updates if needed - After Proxy Changed
if (db.DiscoConfiguration.UpdateLastCheck == null
|| db.DiscoConfiguration.UpdateLastCheck.ResponseTimestamp < DateTime.Now.AddDays(-1))
{
Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
}
}
}
}
@@ -1,21 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.WirelessCertificate
{
public class IndexModel
{
public int Total { get; set; }
public int Unallocated { get; set; }
public int Allocated { get; set; }
public string Provider { get; set; }
public int AutoBufferMax { get; set; }
public int AutoBufferLow { get; set; }
public bool Processing { get; set; }
public string eduSTAR_SchoolId { get; set; }
public string eduSTAR_Username { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.WirelessCertificate
{
public class IndexModel
{
public int Total { get; set; }
public int Unallocated { get; set; }
public int Allocated { get; set; }
public string Provider { get; set; }
public int AutoBufferMax { get; set; }
public int AutoBufferLow { get; set; }
public bool Processing { get; set; }
public string eduSTAR_SchoolId { get; set; }
public string eduSTAR_Username { get; set; }
}
}