GIT: perform LF normalization
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class ConfigController : dbAdminController
|
||||
{
|
||||
//
|
||||
// GET: /Config/Config/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
|
||||
var m = new Models.Config.IndexModel()
|
||||
{
|
||||
UpdateResponse = dbContext.DiscoConfiguration.UpdateLastCheck
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class ConfigController : dbAdminController
|
||||
{
|
||||
//
|
||||
// GET: /Config/Config/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
|
||||
var m = new Models.Config.IndexModel()
|
||||
{
|
||||
UpdateResponse = dbContext.DiscoConfiguration.UpdateLastCheck
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
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.Controllers
|
||||
{
|
||||
public partial class DeviceBatchController : dbAdminController
|
||||
{
|
||||
|
||||
public virtual ActionResult Index(int? id)
|
||||
{
|
||||
dbContext.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
if (id.HasValue)
|
||||
{
|
||||
var m = new Models.DeviceBatch.ShowModel()
|
||||
{
|
||||
DeviceBatch = dbContext.DeviceBatches.Find(id)
|
||||
};
|
||||
if (m.DeviceBatch == null)
|
||||
{
|
||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(null));
|
||||
}
|
||||
m.CanDelete = m.DeviceBatch.CanDelete(dbContext);
|
||||
|
||||
m.DeviceCount = m.DeviceBatch.Devices.Count();
|
||||
m.DeviceDecommissionedCount = m.DeviceBatch.Devices.Count(d => d.DecommissionedDate.HasValue);
|
||||
|
||||
m.DeviceModels = dbContext.DeviceModels.ToSelectListItems();
|
||||
|
||||
return View(MVC.Config.DeviceBatch.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceBatch.IndexModel.Build(dbContext));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
// Default Batch
|
||||
var m = BI.DeviceBI.BatchUtilities.DefaultNewDeviceBatch(dbContext);
|
||||
return View(m);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Disco.Models.Repository.DeviceBatch model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DeviceBatches.Where(m => m.Name == model.Name).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
dbContext.DeviceBatches.Add(model);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(model.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError("Name", "A Device Batch with this name already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public virtual ActionResult Timeline()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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.Controllers
|
||||
{
|
||||
public partial class DeviceBatchController : dbAdminController
|
||||
{
|
||||
|
||||
public virtual ActionResult Index(int? id)
|
||||
{
|
||||
dbContext.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
if (id.HasValue)
|
||||
{
|
||||
var m = new Models.DeviceBatch.ShowModel()
|
||||
{
|
||||
DeviceBatch = dbContext.DeviceBatches.Find(id)
|
||||
};
|
||||
if (m.DeviceBatch == null)
|
||||
{
|
||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(null));
|
||||
}
|
||||
m.CanDelete = m.DeviceBatch.CanDelete(dbContext);
|
||||
|
||||
m.DeviceCount = m.DeviceBatch.Devices.Count();
|
||||
m.DeviceDecommissionedCount = m.DeviceBatch.Devices.Count(d => d.DecommissionedDate.HasValue);
|
||||
|
||||
m.DeviceModels = dbContext.DeviceModels.ToSelectListItems();
|
||||
|
||||
return View(MVC.Config.DeviceBatch.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceBatch.IndexModel.Build(dbContext));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
// Default Batch
|
||||
var m = BI.DeviceBI.BatchUtilities.DefaultNewDeviceBatch(dbContext);
|
||||
return View(m);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Disco.Models.Repository.DeviceBatch model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DeviceBatches.Where(m => m.Name == model.Name).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
dbContext.DeviceBatches.Add(model);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(model.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError("Name", "A Device Batch with this name already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public virtual ActionResult Timeline()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Services.Plugins.Features.WarrantyProvider;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.BI.Extensions;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class DeviceModelController : dbAdminController
|
||||
{
|
||||
public virtual ActionResult Index(int? id)
|
||||
{
|
||||
if (id.HasValue)
|
||||
{
|
||||
var m = new Models.DeviceModel.ShowModel()
|
||||
{
|
||||
DeviceModel = dbContext.DeviceModels.Include("DeviceComponents.JobSubTypes").Where(dm => dm.Id == id.Value).FirstOrDefault(),
|
||||
WarrantyProviders = Plugins.GetPluginFeatures(typeof(WarrantyProviderFeature))
|
||||
};
|
||||
|
||||
m.DeviceComponentsModel = new Models.DeviceModel.DeviceComponentsModel()
|
||||
{
|
||||
DeviceModelId = m.DeviceModel.Id,
|
||||
DeviceComponents = m.DeviceModel.DeviceComponents.ToList(),
|
||||
JobSubTypes = dbContext.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
|
||||
};
|
||||
|
||||
m.CanDelete = m.DeviceModel.CanDelete(dbContext);
|
||||
|
||||
//m.Devices = BI.DeviceBI.SelectDeviceSearchResultItem(dbContext.Devices.Where(d => d.DeviceModelId == m.DeviceModel.Id));
|
||||
|
||||
//m.Devices = dbContext.Devices.Include("DeviceModel").Include("DeviceProfile").Include("AssignedUser")
|
||||
// .Where(d => d.DeviceModelId == m.DeviceModel.Id).ToList();
|
||||
|
||||
return View(MVC.Config.DeviceModel.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceModel.IndexModel.Build(dbContext));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult GenericComponents()
|
||||
{
|
||||
var m = new Models.DeviceModel.DeviceComponentsModel()
|
||||
{
|
||||
DeviceComponents = dbContext.DeviceComponents.Include("JobSubTypes").Where(dc => !dc.DeviceModelId.HasValue).ToList(),
|
||||
JobSubTypes = dbContext.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Services.Plugins.Features.WarrantyProvider;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.BI.Extensions;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class DeviceModelController : dbAdminController
|
||||
{
|
||||
public virtual ActionResult Index(int? id)
|
||||
{
|
||||
if (id.HasValue)
|
||||
{
|
||||
var m = new Models.DeviceModel.ShowModel()
|
||||
{
|
||||
DeviceModel = dbContext.DeviceModels.Include("DeviceComponents.JobSubTypes").Where(dm => dm.Id == id.Value).FirstOrDefault(),
|
||||
WarrantyProviders = Plugins.GetPluginFeatures(typeof(WarrantyProviderFeature))
|
||||
};
|
||||
|
||||
m.DeviceComponentsModel = new Models.DeviceModel.DeviceComponentsModel()
|
||||
{
|
||||
DeviceModelId = m.DeviceModel.Id,
|
||||
DeviceComponents = m.DeviceModel.DeviceComponents.ToList(),
|
||||
JobSubTypes = dbContext.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
|
||||
};
|
||||
|
||||
m.CanDelete = m.DeviceModel.CanDelete(dbContext);
|
||||
|
||||
//m.Devices = BI.DeviceBI.SelectDeviceSearchResultItem(dbContext.Devices.Where(d => d.DeviceModelId == m.DeviceModel.Id));
|
||||
|
||||
//m.Devices = dbContext.Devices.Include("DeviceModel").Include("DeviceProfile").Include("AssignedUser")
|
||||
// .Where(d => d.DeviceModelId == m.DeviceModel.Id).ToList();
|
||||
|
||||
return View(MVC.Config.DeviceModel.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceModel.IndexModel.Build(dbContext));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult GenericComponents()
|
||||
{
|
||||
var m = new Models.DeviceModel.DeviceComponentsModel()
|
||||
{
|
||||
DeviceComponents = dbContext.DeviceComponents.Include("JobSubTypes").Where(dc => !dc.DeviceModelId.HasValue).ToList(),
|
||||
JobSubTypes = dbContext.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Data.Configuration;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Services.Plugins.Features.CertificateProvider;
|
||||
using Disco.Services.Plugins;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class DeviceProfileController : dbAdminController
|
||||
{
|
||||
public virtual ActionResult Index(int? id)
|
||||
{
|
||||
if (id.HasValue)
|
||||
{
|
||||
var m = new Models.DeviceProfile.ShowModel()
|
||||
{
|
||||
DeviceProfile = dbContext.DeviceProfiles.Find(id.Value),
|
||||
OrganisationAddresses = dbContext.DiscoConfiguration.OrganisationAddresses.Addresses,
|
||||
CertificateProviders = Plugins.GetPluginFeatures(typeof(CertificateProviderFeature))
|
||||
};
|
||||
|
||||
//m.Devices = BI.DeviceBI.SelectDeviceSearchResultItem(dbContext.Devices.Where(d => d.DeviceProfileId == m.DeviceProfile.Id));
|
||||
|
||||
var DistributionValues = Enum.GetValues(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes));
|
||||
m.DeviceProfileDistributionTypes = new List<SelectListItem>();
|
||||
foreach (int value in DistributionValues)
|
||||
{
|
||||
m.DeviceProfileDistributionTypes.Add(new SelectListItem()
|
||||
{
|
||||
Value = value.ToString(),
|
||||
Text = Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), value),
|
||||
Selected = ((int)m.DeviceProfile.DistributionType == value)
|
||||
});
|
||||
}
|
||||
m.CanDelete = m.DeviceProfile.CanDelete(dbContext);
|
||||
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//var config = m.DeviceProfile.Configuration(dbContext);
|
||||
//m.AllocateWirelessCertificate = m.DeviceProfile.AllocateWirelessCertificate;
|
||||
//m.OrganisationalUnit = m.DeviceProfile.OrganisationalUnit;
|
||||
//m.ComputerNameTemplate = m.DeviceProfile.ComputerNameTemplate;
|
||||
|
||||
return View(MVC.Config.DeviceProfile.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceProfile.IndexModel.Build(dbContext));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Disco.Models.Repository.DeviceProfile model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DeviceProfiles.Where(m => m.Name == model.Name).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
model.ProvisionADAccount = true;
|
||||
|
||||
dbContext.DeviceProfiles.Add(model);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(model.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError("Name", "A Device Profile with this name already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public virtual ActionResult Defaults()
|
||||
{
|
||||
var m = new Models.DeviceProfile.DefaultsModel()
|
||||
{
|
||||
DeviceProfiles = dbContext.DeviceProfiles.ToList(),
|
||||
Default = dbContext.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId,
|
||||
DefaultAddDeviceOffline = dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
|
||||
};
|
||||
m.DeviceProfilesAndNone = m.DeviceProfiles.ToList();
|
||||
m.DeviceProfilesAndNone.Insert(0, new Disco.Models.Repository.DeviceProfile() { Id = 0, Name = "<No Default>" });
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Data.Configuration;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Services.Plugins.Features.CertificateProvider;
|
||||
using Disco.Services.Plugins;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class DeviceProfileController : dbAdminController
|
||||
{
|
||||
public virtual ActionResult Index(int? id)
|
||||
{
|
||||
if (id.HasValue)
|
||||
{
|
||||
var m = new Models.DeviceProfile.ShowModel()
|
||||
{
|
||||
DeviceProfile = dbContext.DeviceProfiles.Find(id.Value),
|
||||
OrganisationAddresses = dbContext.DiscoConfiguration.OrganisationAddresses.Addresses,
|
||||
CertificateProviders = Plugins.GetPluginFeatures(typeof(CertificateProviderFeature))
|
||||
};
|
||||
|
||||
//m.Devices = BI.DeviceBI.SelectDeviceSearchResultItem(dbContext.Devices.Where(d => d.DeviceProfileId == m.DeviceProfile.Id));
|
||||
|
||||
var DistributionValues = Enum.GetValues(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes));
|
||||
m.DeviceProfileDistributionTypes = new List<SelectListItem>();
|
||||
foreach (int value in DistributionValues)
|
||||
{
|
||||
m.DeviceProfileDistributionTypes.Add(new SelectListItem()
|
||||
{
|
||||
Value = value.ToString(),
|
||||
Text = Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), value),
|
||||
Selected = ((int)m.DeviceProfile.DistributionType == value)
|
||||
});
|
||||
}
|
||||
m.CanDelete = m.DeviceProfile.CanDelete(dbContext);
|
||||
|
||||
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
|
||||
//var config = m.DeviceProfile.Configuration(dbContext);
|
||||
//m.AllocateWirelessCertificate = m.DeviceProfile.AllocateWirelessCertificate;
|
||||
//m.OrganisationalUnit = m.DeviceProfile.OrganisationalUnit;
|
||||
//m.ComputerNameTemplate = m.DeviceProfile.ComputerNameTemplate;
|
||||
|
||||
return View(MVC.Config.DeviceProfile.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceProfile.IndexModel.Build(dbContext));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Disco.Models.Repository.DeviceProfile model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DeviceProfiles.Where(m => m.Name == model.Name).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
model.ProvisionADAccount = true;
|
||||
|
||||
dbContext.DeviceProfiles.Add(model);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(model.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError("Name", "A Device Profile with this name already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public virtual ActionResult Defaults()
|
||||
{
|
||||
var m = new Models.DeviceProfile.DefaultsModel()
|
||||
{
|
||||
DeviceProfiles = dbContext.DeviceProfiles.ToList(),
|
||||
Default = dbContext.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId,
|
||||
DefaultAddDeviceOffline = dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
|
||||
};
|
||||
m.DeviceProfilesAndNone = m.DeviceProfiles.ToList();
|
||||
m.DeviceProfilesAndNone.Insert(0, new Disco.Models.Repository.DeviceProfile() { Id = 0, Name = "<No Default>" });
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,123 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class DocumentTemplateController : dbAdminController
|
||||
{
|
||||
|
||||
public virtual ActionResult Index(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
var m = new Models.DocumentTemplate.IndexModel() { DocumentTemplates = dbContext.DocumentTemplates.ToList() };
|
||||
return View(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
var m = new Models.DocumentTemplate.ShowModel()
|
||||
{
|
||||
DocumentTemplate = dbContext.DocumentTemplates.Include("JobSubTypes").Where(at => at.Id == id).FirstOrDefault()
|
||||
};
|
||||
m.TemplateExpressions = m.DocumentTemplate.ExtractPdfExpressions(dbContext);
|
||||
m.UpdateModel(dbContext);
|
||||
return View(MVC.Config.DocumentTemplate.Views.Show, m);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult ImportStatus()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public virtual ActionResult UndetectedPages()
|
||||
{
|
||||
var m = new Models.DocumentTemplate.UndetectedPagesModel()
|
||||
{
|
||||
DocumentTemplates = dbContext.DocumentTemplates.ToList()
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
var m = new Models.DocumentTemplate.CreateModel();
|
||||
m.UpdateModel(dbContext);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Models.DocumentTemplate.CreateModel model)
|
||||
{
|
||||
model.UpdateModel(dbContext);
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DocumentTemplates.Where(m => m.Id == model.DocumentTemplate.Id).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
|
||||
dbContext.DocumentTemplates.Add(model.DocumentTemplate);
|
||||
|
||||
if (model.DocumentTemplate.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job)
|
||||
{
|
||||
var jobSubTypes = new List<Disco.Models.Repository.JobSubType>();
|
||||
jobSubTypes.AddRange(model.GetJobSubTypes);
|
||||
model.DocumentTemplate.JobSubTypes = jobSubTypes;
|
||||
//foreach (var jobSubType in model.GetJobSubTypes)
|
||||
// model.AttachmentType.JobSubTypes.Add(jobSubType);
|
||||
}
|
||||
|
||||
dbContext.SaveChanges();
|
||||
|
||||
// Save Template
|
||||
model.DocumentTemplate.SavePdfTemplate(dbContext, model.Template.InputStream);
|
||||
|
||||
return RedirectToAction(MVC.Config.DocumentTemplate.Index(model.DocumentTemplate.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError("Name", "A Document Template with this Name already exists.");
|
||||
}
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public virtual ActionResult ExpressionBrowser(string type, bool StaticDeclaredMembersOnly = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(type))
|
||||
{
|
||||
var m = new Models.DocumentTemplate.ExpressionBrowserModel()
|
||||
{
|
||||
DeviceType = typeof(Disco.Models.Repository.Device).AssemblyQualifiedName,
|
||||
JobType = typeof(Disco.Models.Repository.Job).AssemblyQualifiedName,
|
||||
UserType = typeof(Disco.Models.Repository.User).AssemblyQualifiedName,
|
||||
Variables = BI.Expressions.Expression.StandardVariableTypes(),
|
||||
ExtensionLibraries = BI.Expressions.Expression.ExtensionLibraryTypes()
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
var t = Type.GetType(type);
|
||||
if (t != null)
|
||||
{
|
||||
return Json(BI.Expressions.ExpressionTypeDescriptor.Build(t, StaticDeclaredMembersOnly), JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json("Invalid Type Specified", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class DocumentTemplateController : dbAdminController
|
||||
{
|
||||
|
||||
public virtual ActionResult Index(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
var m = new Models.DocumentTemplate.IndexModel() { DocumentTemplates = dbContext.DocumentTemplates.ToList() };
|
||||
return View(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
var m = new Models.DocumentTemplate.ShowModel()
|
||||
{
|
||||
DocumentTemplate = dbContext.DocumentTemplates.Include("JobSubTypes").Where(at => at.Id == id).FirstOrDefault()
|
||||
};
|
||||
m.TemplateExpressions = m.DocumentTemplate.ExtractPdfExpressions(dbContext);
|
||||
m.UpdateModel(dbContext);
|
||||
return View(MVC.Config.DocumentTemplate.Views.Show, m);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult ImportStatus()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public virtual ActionResult UndetectedPages()
|
||||
{
|
||||
var m = new Models.DocumentTemplate.UndetectedPagesModel()
|
||||
{
|
||||
DocumentTemplates = dbContext.DocumentTemplates.ToList()
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
var m = new Models.DocumentTemplate.CreateModel();
|
||||
m.UpdateModel(dbContext);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Models.DocumentTemplate.CreateModel model)
|
||||
{
|
||||
model.UpdateModel(dbContext);
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DocumentTemplates.Where(m => m.Id == model.DocumentTemplate.Id).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
|
||||
dbContext.DocumentTemplates.Add(model.DocumentTemplate);
|
||||
|
||||
if (model.DocumentTemplate.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job)
|
||||
{
|
||||
var jobSubTypes = new List<Disco.Models.Repository.JobSubType>();
|
||||
jobSubTypes.AddRange(model.GetJobSubTypes);
|
||||
model.DocumentTemplate.JobSubTypes = jobSubTypes;
|
||||
//foreach (var jobSubType in model.GetJobSubTypes)
|
||||
// model.AttachmentType.JobSubTypes.Add(jobSubType);
|
||||
}
|
||||
|
||||
dbContext.SaveChanges();
|
||||
|
||||
// Save Template
|
||||
model.DocumentTemplate.SavePdfTemplate(dbContext, model.Template.InputStream);
|
||||
|
||||
return RedirectToAction(MVC.Config.DocumentTemplate.Index(model.DocumentTemplate.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
ModelState.AddModelError("Name", "A Document Template with this Name already exists.");
|
||||
}
|
||||
}
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public virtual ActionResult ExpressionBrowser(string type, bool StaticDeclaredMembersOnly = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(type))
|
||||
{
|
||||
var m = new Models.DocumentTemplate.ExpressionBrowserModel()
|
||||
{
|
||||
DeviceType = typeof(Disco.Models.Repository.Device).AssemblyQualifiedName,
|
||||
JobType = typeof(Disco.Models.Repository.Job).AssemblyQualifiedName,
|
||||
UserType = typeof(Disco.Models.Repository.User).AssemblyQualifiedName,
|
||||
Variables = BI.Expressions.Expression.StandardVariableTypes(),
|
||||
ExtensionLibraries = BI.Expressions.Expression.ExtensionLibraryTypes()
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
var t = Type.GetType(type);
|
||||
if (t != null)
|
||||
{
|
||||
return Json(BI.Expressions.ExpressionTypeDescriptor.Build(t, StaticDeclaredMembersOnly), JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json("Invalid Type Specified", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class EnrolmentController : dbAdminController
|
||||
{
|
||||
//
|
||||
// GET: /Config/Bootstrapper/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var m = new Models.Enrolment.IndexModel()
|
||||
{
|
||||
MacSshUsername = dbContext.DiscoConfiguration.Bootstrapper.MacSshUsername
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
public virtual ActionResult Status()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class EnrolmentController : dbAdminController
|
||||
{
|
||||
//
|
||||
// GET: /Config/Bootstrapper/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var m = new Models.Enrolment.IndexModel()
|
||||
{
|
||||
MacSshUsername = dbContext.DiscoConfiguration.Bootstrapper.MacSshUsername
|
||||
};
|
||||
|
||||
return View(m);
|
||||
}
|
||||
public virtual ActionResult Status()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class ExpressionsController : Controller
|
||||
{
|
||||
//
|
||||
// GET: /Config/Expressions/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
return View(Views.Editor, new Models.Expressions.EditorModel()
|
||||
{
|
||||
Expression = @"JobComponentsTotalCost() < 100 ? JobComponentsTotalCost().ToString('c') : '$100.00'"
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class ExpressionsController : Controller
|
||||
{
|
||||
//
|
||||
// GET: /Config/Expressions/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
return View(Views.Editor, new Models.Expressions.EditorModel()
|
||||
{
|
||||
Expression = @"JobComponentsTotalCost() < 100 ? JobComponentsTotalCost().ToString('c') : '$100.00'"
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class OrganisationController : dbAdminController
|
||||
{
|
||||
//
|
||||
// GET: /Config/Organisation/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var viewModel = new Models.Organisation.IndexModel();
|
||||
|
||||
viewModel.OrganisationName = dbContext.DiscoConfiguration.OrganisationName;
|
||||
viewModel.MultiSiteMode = dbContext.DiscoConfiguration.MultiSiteMode;
|
||||
viewModel.OrganisationAddresses = dbContext.DiscoConfiguration.OrganisationAddresses.Addresses;
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class OrganisationController : dbAdminController
|
||||
{
|
||||
//
|
||||
// GET: /Config/Organisation/
|
||||
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var viewModel = new Models.Organisation.IndexModel();
|
||||
|
||||
viewModel.OrganisationName = dbContext.DiscoConfiguration.OrganisationName;
|
||||
viewModel.MultiSiteMode = dbContext.DiscoConfiguration.MultiSiteMode;
|
||||
viewModel.OrganisationAddresses = dbContext.DiscoConfiguration.OrganisationAddresses.Addresses;
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class SystemConfigController : dbAdminController
|
||||
{
|
||||
[HttpGet]
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var m = Models.SystemConfig.IndexModel.FromConfiguration(dbContext.DiscoConfiguration);
|
||||
return View(m);
|
||||
}
|
||||
[HttpPost]
|
||||
public virtual ActionResult Index(Models.SystemConfig.IndexModel config)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
config.ToConfiguration(dbContext);
|
||||
return RedirectToAction(MVC.Config.Config.Index());
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
public partial class SystemConfigController : dbAdminController
|
||||
{
|
||||
[HttpGet]
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var m = Models.SystemConfig.IndexModel.FromConfiguration(dbContext.DiscoConfiguration);
|
||||
return View(m);
|
||||
}
|
||||
[HttpPost]
|
||||
public virtual ActionResult Index(Models.SystemConfig.IndexModel config)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
config.ToConfiguration(dbContext);
|
||||
return RedirectToAction(MVC.Config.Config.Index());
|
||||
}
|
||||
else
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user