diff --git a/Disco.Services/App_Start/RazorGeneratorMvcStart.cs b/Disco.Services/App_Start/RazorGeneratorMvcStart.cs deleted file mode 100644 index 42440fc8..00000000 --- a/Disco.Services/App_Start/RazorGeneratorMvcStart.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Web; -using System.Web.Mvc; -using System.Web.WebPages; -using RazorGenerator.Mvc; - -[assembly: WebActivator.PostApplicationStartMethod(typeof(Disco.Services.App_Start.RazorGeneratorMvcStart), "Start")] - -namespace Disco.Services.App_Start { - public static class RazorGeneratorMvcStart { - public static void Start() { - var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { - UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal - }; - - ViewEngines.Engines.Insert(0, engine); - - // StartPage lookups are done by WebPages. - VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); - } - } -} diff --git a/Disco.Web/Areas/API/Controllers/DeviceCertificateController.cs b/Disco.Web/Areas/API/Controllers/DeviceCertificateController.cs new file mode 100644 index 00000000..dd0bbc5a --- /dev/null +++ b/Disco.Web/Areas/API/Controllers/DeviceCertificateController.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace Disco.Web.Areas.API.Controllers +{ + public partial class DeviceCertificateController : dbAdminController + { + + public virtual ActionResult Download(int id) + { + var wc = dbContext.DeviceCertificates.Find(id); + if (wc == null) + { + throw new Exception("Invalid Device Certificate Id"); + } + return File(wc.Content, "application/x-pkcs12", string.Format("{0}.pfx", wc.Name)); + } + + } +} diff --git a/Disco.Web/Areas/API/Controllers/WirelessCertificateController.cs b/Disco.Web/Areas/API/Controllers/WirelessCertificateController.cs deleted file mode 100644 index dfdc7c66..00000000 --- a/Disco.Web/Areas/API/Controllers/WirelessCertificateController.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; - -namespace Disco.Web.Areas.API.Controllers -{ - public partial class WirelessCertificateController : dbAdminController - { - - public virtual ActionResult Download(int id) - { - var wc = dbContext.DeviceCertificates.Find(id); - if (wc == null) - { - throw new Exception("Invalid Wireless Certificate Number"); - } - return File(wc.Content, "application/x-pkcs12", string.Format("{0}.pfx", wc.Name)); - } - - //public virtual ActionResult DownloadLog() - //{ - // //var path = BI.Wireless.BaseWirelessProvider.LoggingPath; - // //if (path != null && System.IO.File.Exists(path)) - // //{ - // // System.IO.MemoryStream ms = new System.IO.MemoryStream(); - // // using (var s = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite)) - // // { - // // s.CopyTo(ms); - // // } - // // ms.Position = 0; - // // return File(ms, "text/plain", "WirelessCertificateLog.txt"); - // //} - // //return HttpNotFound(); - //} - - public virtual ActionResult FillBuffer(int Value, Nullable redirect = null) - { - throw new NotImplementedException(); - //try - //{ - // if (Value >= 0) - // { - // if (!WirelessCertificatesLog.IsCertificateRetrievalProcessing) - // { - // BaseWirelessProvider.GetProvider(dbContext).FillCertificateBuffer(Value); - // if (redirect.HasValue && redirect.Value) - // return RedirectToAction(MVC.Config.WirelessCertificate.Index()); - // else - // return Json("OK", JsonRequestBehavior.AllowGet); - // } - // else - // { - // throw new Exception("Buffer is already processing"); - // } - // } - // else - // { - // throw new Exception("The value must be >= 0"); - // } - //} - //catch (Exception ex) - //{ - // if (redirect.HasValue && redirect.Value) - // throw; - // else - // return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet); - //} - } - - //#region Auto Buffer - - //public virtual ActionResult AutoBufferMax(int Value, Nullable redirect = null) - //{ - // try - // { - // if (Value >= 0) - // { - // dbContext.DiscoConfiguration.Wireless.CertificateAutoBufferMax = Value; - // dbContext.SaveChanges(); - // if (redirect.HasValue && redirect.Value) - // return RedirectToAction(MVC.Config.WirelessCertificate.Index()); - // else - // return Json("OK", JsonRequestBehavior.AllowGet); - // } - // else - // { - // throw new Exception("The value must be >= 0"); - // } - // } - // catch (Exception ex) - // { - // if (redirect.HasValue && redirect.Value) - // throw; - // else - // return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet); - // } - //} - //public virtual ActionResult AutoBufferLow(int Value, Nullable redirect = null) - //{ - // try - // { - // if (Value >= 0) - // { - // dbContext.DiscoConfiguration.Wireless.CertificateAutoBufferLow = Value; - // dbContext.SaveChanges(); - // if (redirect.HasValue && redirect.Value) - // return RedirectToAction(MVC.Config.WirelessCertificate.Index()); - // else - // return Json("OK", JsonRequestBehavior.AllowGet); - // } - // else - // { - // throw new Exception("The value must be >= 0"); - // } - // } - // catch (Exception ex) - // { - // if (redirect.HasValue && redirect.Value) - // throw; - // else - // return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet); - // } - //} - - //#endregion - - //#region eduSTAR Credentials - - //public virtual ActionResult eduSTAR_SchoolId(string SchoolId) - //{ - // try - // { - // if (!string.IsNullOrWhiteSpace(SchoolId)) - // { - // dbContext.DiscoConfiguration.Wireless.eduSTAR_ServiceAccountSchoolId = SchoolId; - // dbContext.SaveChanges(); - // return Json("OK", JsonRequestBehavior.AllowGet); - // } - // else - // { - // throw new Exception("The SchoolId cannot be null or empty"); - // } - // } - // catch (Exception ex) - // { - // return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet); - // } - //} - //public virtual ActionResult eduSTAR_Username(string Username) - //{ - // try - // { - // if (!string.IsNullOrWhiteSpace(Username)) - // { - // dbContext.DiscoConfiguration.Wireless.eduSTAR_ServiceAccountUsername = Username; - // dbContext.SaveChanges(); - // return Json("OK", JsonRequestBehavior.AllowGet); - // } - // else - // { - // throw new Exception("The Username cannot be null or empty"); - // } - // } - // catch (Exception ex) - // { - // return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet); - // } - //} - //public virtual ActionResult eduSTAR_Password(string Password) - //{ - // try - // { - // if (!string.IsNullOrWhiteSpace(Password)) - // { - // dbContext.DiscoConfiguration.Wireless.eduSTAR_ServiceAccountPassword = Password; - // dbContext.SaveChanges(); - // return Json("OK", JsonRequestBehavior.AllowGet); - // } - // else - // { - // throw new Exception("The Password cannot be null or empty"); - // } - // } - // catch (Exception ex) - // { - // return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet); - // } - //} - - //#endregion - - } -} diff --git a/Disco.Web/Views/Device/_CertificateTable.cshtml b/Disco.Web/Views/Device/_CertificateTable.cshtml index db7896fe..98ca5f2e 100644 --- a/Disco.Web/Views/Device/_CertificateTable.cshtml +++ b/Disco.Web/Views/Device/_CertificateTable.cshtml @@ -1,43 +1,43 @@ -@model IEnumerable -
- @if (Model.Count() > 0) - { - - - - - - - - @foreach (var item in Model) - { - - - - - - - } -
- Name - - Enabled - - Allocated - - Expires -
- @Html.ActionLink(item.Name, MVC.API.WirelessCertificate.Download(item.Id)) - - @item.Enabled - - @CommonHelpers.FriendlyDate(item.AllocatedDate) - - @CommonHelpers.FriendlyDate(item.ExpirationDate) -
- } - else - { - No Certificates Allocated - } -
+@model IEnumerable +
+ @if (Model.Count() > 0) + { + + + + + + + + @foreach (var item in Model) + { + + + + + + + } +
+ Name + + Enabled + + Allocated + + Expires +
+ @Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id)) + + @item.Enabled + + @CommonHelpers.FriendlyDate(item.AllocatedDate) + + @CommonHelpers.FriendlyDate(item.ExpirationDate) +
+ } + else + { + No Certificates Allocated + } +
diff --git a/Disco.Web/Views/Device/_CertificateTable.generated.cs b/Disco.Web/Views/Device/_CertificateTable.generated.cs index 60b5608b..bd6e6243 100644 --- a/Disco.Web/Views/Device/_CertificateTable.generated.cs +++ b/Disco.Web/Views/Device/_CertificateTable.generated.cs @@ -1,180 +1,180 @@ -#pragma warning disable 1591 -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.17929 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Disco.Web.Views.Device -{ - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Text; - using System.Web; - using System.Web.Helpers; - using System.Web.Mvc; - using System.Web.Mvc.Ajax; - using System.Web.Mvc.Html; - using System.Web.Routing; - using System.Web.Security; - using System.Web.UI; - using System.Web.WebPages; - using Disco.BI.Extensions; - using Disco.Models.Repository; - using Disco.Web; - using Disco.Web.Extensions; - - [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")] - [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/_CertificateTable.cshtml")] - public class CertificateTable : System.Web.Mvc.WebViewPage> - { - public CertificateTable() - { - } - public override void Execute() - { -WriteLiteral("\r\n"); - - - #line 3 "..\..\Views\Device\_CertificateTable.cshtml" - - - #line default - #line hidden - - #line 3 "..\..\Views\Device\_CertificateTable.cshtml" - if (Model.Count() > 0) - { - - - #line default - #line hidden -WriteLiteral(" - - - Name - - - Enabled - - - Allocated - - - Expires - - -"); - - - #line 20 "..\..\Views\Device\_CertificateTable.cshtml" - - - #line default - #line hidden - - #line 20 "..\..\Views\Device\_CertificateTable.cshtml" - foreach (var item in Model) - { - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" "); - - - #line 24 "..\..\Views\Device\_CertificateTable.cshtml" - Write(Html.ActionLink(item.Name, MVC.API.WirelessCertificate.Download(item.Id))); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n"); - -WriteLiteral(" "); - - - #line 27 "..\..\Views\Device\_CertificateTable.cshtml" - Write(item.Enabled); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n"); - -WriteLiteral(" "); - - - #line 30 "..\..\Views\Device\_CertificateTable.cshtml" - Write(CommonHelpers.FriendlyDate(item.AllocatedDate)); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n"); - -WriteLiteral(" "); - - - #line 33 "..\..\Views\Device\_CertificateTable.cshtml" - Write(CommonHelpers.FriendlyDate(item.ExpirationDate)); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n"); - - - #line 36 "..\..\Views\Device\_CertificateTable.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n"); - - - #line 38 "..\..\Views\Device\_CertificateTable.cshtml" - } - else - { - - - #line default - #line hidden -WriteLiteral(" No Certificates Allocated\r\n"); - - - #line 42 "..\..\Views\Device\_CertificateTable.cshtml" - } - - - #line default - #line hidden -WriteLiteral("\r\n"); - - } - } -} -#pragma warning restore 1591 +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17929 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Disco.Web.Views.Device +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Text; + using System.Web; + using System.Web.Helpers; + using System.Web.Mvc; + using System.Web.Mvc.Ajax; + using System.Web.Mvc.Html; + using System.Web.Routing; + using System.Web.Security; + using System.Web.UI; + using System.Web.WebPages; + using Disco.BI.Extensions; + using Disco.Models.Repository; + using Disco.Web; + using Disco.Web.Extensions; + + [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")] + [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/_CertificateTable.cshtml")] + public class CertificateTable : System.Web.Mvc.WebViewPage> + { + public CertificateTable() + { + } + public override void Execute() + { +WriteLiteral("\r\n"); + + + #line 3 "..\..\Views\Device\_CertificateTable.cshtml" + + + #line default + #line hidden + + #line 3 "..\..\Views\Device\_CertificateTable.cshtml" + if (Model.Count() > 0) + { + + + #line default + #line hidden +WriteLiteral(" + + + Name + + + Enabled + + + Allocated + + + Expires + + +"); + + + #line 20 "..\..\Views\Device\_CertificateTable.cshtml" + + + #line default + #line hidden + + #line 20 "..\..\Views\Device\_CertificateTable.cshtml" + foreach (var item in Model) + { + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n"); + +WriteLiteral(" "); + + + #line 24 "..\..\Views\Device\_CertificateTable.cshtml" + Write(Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id))); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n"); + +WriteLiteral(" "); + + + #line 27 "..\..\Views\Device\_CertificateTable.cshtml" + Write(item.Enabled); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n"); + +WriteLiteral(" "); + + + #line 30 "..\..\Views\Device\_CertificateTable.cshtml" + Write(CommonHelpers.FriendlyDate(item.AllocatedDate)); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n"); + +WriteLiteral(" "); + + + #line 33 "..\..\Views\Device\_CertificateTable.cshtml" + Write(CommonHelpers.FriendlyDate(item.ExpirationDate)); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n"); + + + #line 36 "..\..\Views\Device\_CertificateTable.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n"); + + + #line 38 "..\..\Views\Device\_CertificateTable.cshtml" + } + else + { + + + #line default + #line hidden +WriteLiteral(" No Certificates Allocated\r\n"); + + + #line 42 "..\..\Views\Device\_CertificateTable.cshtml" + } + + + #line default + #line hidden +WriteLiteral("\r\n"); + + } + } +} +#pragma warning restore 1591