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
+31 -31
View File
@@ -1,32 +1,32 @@
@* Generator: WebPagesHelper *@
@using Disco.BI.Extensions;
@using Disco.Web;
@using Disco.Web.Extensions;
@helper AjaxLoader(string id = null)
{
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
<span @(id!=null ? new HtmlString(string.Format("id=\"{0}_loading\"", id)) : new HtmlString(string.Empty)) class="ajaxHelperIcon ajaxLoading" title="Loading..."></span><span @(id != null ? new HtmlString(string.Format("id=\"{0}_ok\"", id)) : new HtmlString(string.Empty)) class="ajaxHelperIcon ajaxOk"
title="Ok"></span>
}
@helper AjaxSave()
{
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
<span class="ajaxHelperIcon ajaxSave" title="Save Changes"></span>
}
@helper AjaxRemove()
{
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
<span class="ajaxHelperIcon ajaxRemove" title="Remove"></span>
}
@helper JsonDate(DateTime? date)
{
if (date.HasValue)
{
var d = date.Value;
@(new HtmlString(string.Format("new Date({0}, {1}, {2}, {3}, {4}, {5})", d.Year, d.Month - 1, d.Day, d.Hour, d.Minute, d.Second)))
}
else
{
@(new HtmlString("null"))
}
@* Generator: WebPagesHelper *@
@using Disco.BI.Extensions;
@using Disco.Web;
@using Disco.Web.Extensions;
@helper AjaxLoader(string id = null)
{
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
<span @(id!=null ? new HtmlString(string.Format("id=\"{0}_loading\"", id)) : new HtmlString(string.Empty)) class="ajaxHelperIcon ajaxLoading" title="Loading..."></span><span @(id != null ? new HtmlString(string.Format("id=\"{0}_ok\"", id)) : new HtmlString(string.Empty)) class="ajaxHelperIcon ajaxOk"
title="Ok"></span>
}
@helper AjaxSave()
{
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
<span class="ajaxHelperIcon ajaxSave" title="Save Changes"></span>
}
@helper AjaxRemove()
{
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
<span class="ajaxHelperIcon ajaxRemove" title="Remove"></span>
}
@helper JsonDate(DateTime? date)
{
if (date.HasValue)
{
var d = date.Value;
@(new HtmlString(string.Format("new Date({0}, {1}, {2}, {3}, {4}, {5})", d.Year, d.Month - 1, d.Day, d.Hour, d.Minute, d.Second)))
}
else
{
@(new HtmlString("null"))
}
}
+211 -211
View File
@@ -1,211 +1,211 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web
{
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.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
#line 2 "..\..\App_Code\AjaxHelpers.cshtml"
using Disco.BI.Extensions;
#line default
#line hidden
#line 3 "..\..\App_Code\AjaxHelpers.cshtml"
using Disco.Web;
#line default
#line hidden
#line 4 "..\..\App_Code\AjaxHelpers.cshtml"
using Disco.Web.Extensions;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
public class AjaxHelpers : System.Web.WebPages.HelperPage
{
public static System.Web.WebPages.HelperResult AjaxLoader(string id = null)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 6 "..\..\App_Code\AjaxHelpers.cshtml"
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <span ");
#line 8 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, id!=null ? new HtmlString(string.Format("id=\"{0}_loading\"", id)) : new HtmlString(string.Empty));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " class=\"ajaxHelperIcon ajaxLoading\" title=\"Loading...\"></span>");
WriteLiteralTo(@__razor_helper_writer, "<span ");
#line 8 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, id != null ? new HtmlString(string.Format("id=\"{0}_ok\"", id)) : new HtmlString(string.Empty));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " class=\"ajaxHelperIcon ajaxOk\"\r\n title=\"Ok\"></span>\r\n");
#line 10 "..\..\App_Code\AjaxHelpers.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult AjaxSave()
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 12 "..\..\App_Code\AjaxHelpers.cshtml"
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <span class=\"ajaxHelperIcon ajaxSave\" title=\"Save Changes\"></span>\r\n");
#line 15 "..\..\App_Code\AjaxHelpers.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult AjaxRemove()
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 17 "..\..\App_Code\AjaxHelpers.cshtml"
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <span class=\"ajaxHelperIcon ajaxRemove\" title=\"Remove\"></span>\r\n");
#line 20 "..\..\App_Code\AjaxHelpers.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult JsonDate(DateTime? date)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 22 "..\..\App_Code\AjaxHelpers.cshtml"
if (date.HasValue)
{
var d = date.Value;
#line default
#line hidden
#line 26 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, new HtmlString(string.Format("new Date({0}, {1}, {2}, {3}, {4}, {5})", d.Year, d.Month - 1, d.Day, d.Hour, d.Minute, d.Second)));
#line default
#line hidden
#line 26 "..\..\App_Code\AjaxHelpers.cshtml"
}
else
{
#line default
#line hidden
#line 30 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, new HtmlString("null"));
#line default
#line hidden
#line 30 "..\..\App_Code\AjaxHelpers.cshtml"
}
#line default
#line hidden
});
}
public AjaxHelpers()
{
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web
{
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.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
#line 2 "..\..\App_Code\AjaxHelpers.cshtml"
using Disco.BI.Extensions;
#line default
#line hidden
#line 3 "..\..\App_Code\AjaxHelpers.cshtml"
using Disco.Web;
#line default
#line hidden
#line 4 "..\..\App_Code\AjaxHelpers.cshtml"
using Disco.Web.Extensions;
#line default
#line hidden
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
public class AjaxHelpers : System.Web.WebPages.HelperPage
{
public static System.Web.WebPages.HelperResult AjaxLoader(string id = null)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 6 "..\..\App_Code\AjaxHelpers.cshtml"
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <span ");
#line 8 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, id!=null ? new HtmlString(string.Format("id=\"{0}_loading\"", id)) : new HtmlString(string.Empty));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " class=\"ajaxHelperIcon ajaxLoading\" title=\"Loading...\"></span>");
WriteLiteralTo(@__razor_helper_writer, "<span ");
#line 8 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, id != null ? new HtmlString(string.Format("id=\"{0}_ok\"", id)) : new HtmlString(string.Empty));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " class=\"ajaxHelperIcon ajaxOk\"\r\n title=\"Ok\"></span>\r\n");
#line 10 "..\..\App_Code\AjaxHelpers.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult AjaxSave()
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 12 "..\..\App_Code\AjaxHelpers.cshtml"
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <span class=\"ajaxHelperIcon ajaxSave\" title=\"Save Changes\"></span>\r\n");
#line 15 "..\..\App_Code\AjaxHelpers.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult AjaxRemove()
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 17 "..\..\App_Code\AjaxHelpers.cshtml"
Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <span class=\"ajaxHelperIcon ajaxRemove\" title=\"Remove\"></span>\r\n");
#line 20 "..\..\App_Code\AjaxHelpers.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult JsonDate(DateTime? date)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 22 "..\..\App_Code\AjaxHelpers.cshtml"
if (date.HasValue)
{
var d = date.Value;
#line default
#line hidden
#line 26 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, new HtmlString(string.Format("new Date({0}, {1}, {2}, {3}, {4}, {5})", d.Year, d.Month - 1, d.Day, d.Hour, d.Minute, d.Second)));
#line default
#line hidden
#line 26 "..\..\App_Code\AjaxHelpers.cshtml"
}
else
{
#line default
#line hidden
#line 30 "..\..\App_Code\AjaxHelpers.cshtml"
WriteTo(@__razor_helper_writer, new HtmlString("null"));
#line default
#line hidden
#line 30 "..\..\App_Code\AjaxHelpers.cshtml"
}
#line default
#line hidden
});
}
public AjaxHelpers()
{
}
}
}
#pragma warning restore 1591
+131 -131
View File
@@ -1,132 +1,132 @@
@* Generator: WebPagesHelper *@
@using Disco.BI.Extensions;
@using Disco.Models.Repository;
@using Disco.Web;
@using System.Web.Mvc
@using System.Web.Mvc.Html;
@using Disco.Web.Extensions;
@helper FriendlyDate(DateTime d)
{
<span title="@d.ToFullDateTime()" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy()</span>
}
@helper FriendlyDate(DateTime? d, string NullValue = "N/A")
{
<span title="@d.ToFullDateTime(NullValue)" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy(NullValue)</span>
}
@helper RadioButtonList(string id, List<System.Web.Mvc.SelectListItem> items, int columns = 1)
{
@ItemList("radio", id, items, columns)
}
@helper CheckBoxList(string id, List<System.Web.Mvc.SelectListItem> items, int columns = 1, bool alignEven = true, int? forceUniqueIds = null)
{
@ItemList("checkbox", id, items, columns, alignEven, forceUniqueIds)
}
@helper ItemList(string inputType, string id, List<System.Web.Mvc.SelectListItem> items, int columns = 1, bool alignEven = true, int? forceUniqueIds = null)
{
int itemsPerColumn = items.Count / columns;
int columnWidth = (100 / columns);
var itemNextId = 0;
<table class="none">
<tr>
@for (int i = 0; i < columns; i++)
{
<td@(alignEven ? new HtmlString(string.Format(" style=\"width: {0}%\"", columnWidth)) : new HtmlString(string.Empty))>
<ul class="none">
@{
int itemsForThisColumn = itemsPerColumn + (items.Count % columns > i ? 1 : 0);
for (int i2 = 0; i2 < itemsForThisColumn && itemNextId < items.Count; i2++)
{
var item = items[itemNextId];
itemNextId++;
var itemId = forceUniqueIds.HasValue ? string.Format("{0}_{1}_{2}", id, item.Value, forceUniqueIds++) : string.Format("{0}_{1}", id, item.Value);
<li>
<input id="@itemId" name="@id" value="@item.Value" type="@inputType" @(item.Selected ? "checked=\"checked\" " : " ")/><label for="@itemId">@item.Text</label></li>
}
}
</ul>
</td>
}
</tr>
</table>
}
@helper FriendlyDateAndUser(DateTime? d, User u, string DateNullValue = "N/A")
{
@FriendlyDate(d, DateNullValue);
@FriendlyUser(u, null, "by");
}
@helper FriendlyDateAndUser(DateTime d, User u)
{
@FriendlyDate(d);
@FriendlyUser(u, null, "by");
}
@helper FriendlyDateAndTitleUser(DateTime? d, User u, string DateNullValue = "N/A")
{
<span title="@d.ToFullDateTime(DateNullValue) by @u" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy(DateNullValue)</span>
}
@helper FriendlyDateAndTitleUser(DateTime d, User u)
{
<span title="@d.ToFullDateTime() by @u" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy()</span>
}
@helper FriendlyUser(User u, string nullValue = null, string prepend = null)
{
if (u != null)
{
@prepend <span title="@u">@u.Id</span>
}
else
{
<span>@nullValue</span>
}
}
@helper Breadcrumbs(List<Tuple<string, ActionResult>> BreadCrumbs)
{
for (int index = 0; index < BreadCrumbs.Count; index++)
{
var breadCrumb = BreadCrumbs[index];
if (index != 0)
{
<span>&gt;</span>
}
if (breadCrumb.Item2 == null)
{
@breadCrumb.Item1
}
else
{
@Html.GetPageHelper().ActionLink(breadCrumb.Item1, breadCrumb.Item2)
}
}
}
@helper Breadcrumbs(string Title)
{
@Title
}
@helper BreadcrumbsTitle(List<Tuple<string, ActionResult>> BreadCrumbs)
{
for (int index = 0; index < BreadCrumbs.Count; index++)
{
var breadCrumb = BreadCrumbs[index];
if (index != 0)
{
@(new HtmlString(" > "))
}
@breadCrumb.Item1
}
}
@helper BreadcrumbsTitle(string Title)
{
@Title
}
@helper CheckboxBulkSelect(string BulkSelectContainerId, string ParentJQuerySelector = null)
{Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
<span id="@BulkSelectContainerId" class="checkboxBulkSelectContainer">
@if (string.IsNullOrWhiteSpace(ParentJQuerySelector))
{
<script type="text/javascript">$(function () { $('#@(BulkSelectContainerId)').checkboxBulkSelect(); });</script>
}
else
{
<script type="text/javascript">$(function () { $('#@(BulkSelectContainerId)').checkboxBulkSelect({ parentSelector: '@(ParentJQuerySelector)' }); });</script>
}
</span>
@* Generator: WebPagesHelper *@
@using Disco.BI.Extensions;
@using Disco.Models.Repository;
@using Disco.Web;
@using System.Web.Mvc
@using System.Web.Mvc.Html;
@using Disco.Web.Extensions;
@helper FriendlyDate(DateTime d)
{
<span title="@d.ToFullDateTime()" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy()</span>
}
@helper FriendlyDate(DateTime? d, string NullValue = "N/A")
{
<span title="@d.ToFullDateTime(NullValue)" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy(NullValue)</span>
}
@helper RadioButtonList(string id, List<System.Web.Mvc.SelectListItem> items, int columns = 1)
{
@ItemList("radio", id, items, columns)
}
@helper CheckBoxList(string id, List<System.Web.Mvc.SelectListItem> items, int columns = 1, bool alignEven = true, int? forceUniqueIds = null)
{
@ItemList("checkbox", id, items, columns, alignEven, forceUniqueIds)
}
@helper ItemList(string inputType, string id, List<System.Web.Mvc.SelectListItem> items, int columns = 1, bool alignEven = true, int? forceUniqueIds = null)
{
int itemsPerColumn = items.Count / columns;
int columnWidth = (100 / columns);
var itemNextId = 0;
<table class="none">
<tr>
@for (int i = 0; i < columns; i++)
{
<td@(alignEven ? new HtmlString(string.Format(" style=\"width: {0}%\"", columnWidth)) : new HtmlString(string.Empty))>
<ul class="none">
@{
int itemsForThisColumn = itemsPerColumn + (items.Count % columns > i ? 1 : 0);
for (int i2 = 0; i2 < itemsForThisColumn && itemNextId < items.Count; i2++)
{
var item = items[itemNextId];
itemNextId++;
var itemId = forceUniqueIds.HasValue ? string.Format("{0}_{1}_{2}", id, item.Value, forceUniqueIds++) : string.Format("{0}_{1}", id, item.Value);
<li>
<input id="@itemId" name="@id" value="@item.Value" type="@inputType" @(item.Selected ? "checked=\"checked\" " : " ")/><label for="@itemId">@item.Text</label></li>
}
}
</ul>
</td>
}
</tr>
</table>
}
@helper FriendlyDateAndUser(DateTime? d, User u, string DateNullValue = "N/A")
{
@FriendlyDate(d, DateNullValue);
@FriendlyUser(u, null, "by");
}
@helper FriendlyDateAndUser(DateTime d, User u)
{
@FriendlyDate(d);
@FriendlyUser(u, null, "by");
}
@helper FriendlyDateAndTitleUser(DateTime? d, User u, string DateNullValue = "N/A")
{
<span title="@d.ToFullDateTime(DateNullValue) by @u" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy(DateNullValue)</span>
}
@helper FriendlyDateAndTitleUser(DateTime d, User u)
{
<span title="@d.ToFullDateTime() by @u" data-discodatetime="@d.ToSortableDateTime()" class="date nowrap">@d.ToFuzzy()</span>
}
@helper FriendlyUser(User u, string nullValue = null, string prepend = null)
{
if (u != null)
{
@prepend <span title="@u">@u.Id</span>
}
else
{
<span>@nullValue</span>
}
}
@helper Breadcrumbs(List<Tuple<string, ActionResult>> BreadCrumbs)
{
for (int index = 0; index < BreadCrumbs.Count; index++)
{
var breadCrumb = BreadCrumbs[index];
if (index != 0)
{
<span>&gt;</span>
}
if (breadCrumb.Item2 == null)
{
@breadCrumb.Item1
}
else
{
@Html.GetPageHelper().ActionLink(breadCrumb.Item1, breadCrumb.Item2)
}
}
}
@helper Breadcrumbs(string Title)
{
@Title
}
@helper BreadcrumbsTitle(List<Tuple<string, ActionResult>> BreadCrumbs)
{
for (int index = 0; index < BreadCrumbs.Count; index++)
{
var breadCrumb = BreadCrumbs[index];
if (index != 0)
{
@(new HtmlString(" > "))
}
@breadCrumb.Item1
}
}
@helper BreadcrumbsTitle(string Title)
{
@Title
}
@helper CheckboxBulkSelect(string BulkSelectContainerId, string ParentJQuerySelector = null)
{Html.GetPageHelper().BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
<span id="@BulkSelectContainerId" class="checkboxBulkSelectContainer">
@if (string.IsNullOrWhiteSpace(ParentJQuerySelector))
{
<script type="text/javascript">$(function () { $('#@(BulkSelectContainerId)').checkboxBulkSelect(); });</script>
}
else
{
<script type="text/javascript">$(function () { $('#@(BulkSelectContainerId)').checkboxBulkSelect({ parentSelector: '@(ParentJQuerySelector)' }); });</script>
}
</span>
}
File diff suppressed because it is too large Load Diff
+51 -51
View File
@@ -1,52 +1,52 @@
using System.IO;
using System.Web;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Disco.Web.Extensions.MvcExtensions.Bundles;
namespace Disco.Web
{
public class BundleConfig
{
public static void RegisterBundles()
{
// Styles - Site Core
BundleTable.Add(new Bundle("~/Style/Site", Links.ClientSource.Style.BundleSite_min_css));
// Styles - Targeted
BundleTable.Add(new Bundle("~/Style/Config", Links.ClientSource.Style.Config_min_css));
BundleTable.Add(new Bundle("~/Style/Device", Links.ClientSource.Style.Device_min_css));
BundleTable.Add(new Bundle("~/Style/Dialog", Links.ClientSource.Style.Dialog_min_css));
BundleTable.Add(new Bundle("~/Style/Job", Links.ClientSource.Style.Job_min_css));
BundleTable.Add(new Bundle("~/Style/User", Links.ClientSource.Style.User_min_css));
BundleTable.Add(new Bundle("~/Style/Credits", Links.ClientSource.Style.Credits_min_css));
BundleTable.Add(new Bundle("~/Style/InitialConfig", Links.ClientSource.Style.InitialConfig_min_css));
BundleTable.Add(new Bundle("~/Style/jQueryUI/dynatree", Links.ClientSource.Style.jQueryUI.dynatree.ui_dynatree_min_css));
BundleTable.Add(new Bundle("~/Style/Shadowbox", Links.ClientSource.Style.Shadowbox_min_css));
BundleTable.Add(new Bundle("~/Style/Timeline", Links.ClientSource.Style.Timeline_min_css));
// Styles - Public Targeted
BundleTable.Add(new Bundle("~/Style/Public/UserHeldDevices", Links.ClientSource.Style.Public.UserHeldDevices_min_css));
BundleTable.Add(new Bundle("~/Style/Public/UserHeldDevicesNoticeboard", Links.ClientSource.Style.Public.UserHeldDevicesNoticeboard_min_css));
// Scripts - Core
#if DEBUG
BundleTable.Add(new Bundle("~/ClientScripts/Core", Links.ClientSource.Scripts.Core_js));
#else
BundleTable.Add(new Bundle("~/ClientScripts/Core", Links.ClientSource.Scripts.Core_min_js));
#endif
// Scripts - Modules
#if DEBUG
foreach (FileInfo f in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ClientSource/Scripts/Modules")).EnumerateFiles("*.js", SearchOption.TopDirectoryOnly))
BundleTable.Add(new Bundle(string.Format("~/ClientScripts/Modules/{0}", f.Name.Substring(0, f.Name.Length - 3)), f.FullName));
#else
foreach (FileInfo f in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ClientSource/Scripts/Modules")).EnumerateFiles("*.min.js", SearchOption.TopDirectoryOnly))
BundleTable.Add(new Bundle(string.Format("~/ClientScripts/Modules/{0}", f.Name.Substring(0, f.Name.Length - 7)), f.FullName));
#endif
}
}
using System.IO;
using System.Web;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Disco.Web.Extensions.MvcExtensions.Bundles;
namespace Disco.Web
{
public class BundleConfig
{
public static void RegisterBundles()
{
// Styles - Site Core
BundleTable.Add(new Bundle("~/Style/Site", Links.ClientSource.Style.BundleSite_min_css));
// Styles - Targeted
BundleTable.Add(new Bundle("~/Style/Config", Links.ClientSource.Style.Config_min_css));
BundleTable.Add(new Bundle("~/Style/Device", Links.ClientSource.Style.Device_min_css));
BundleTable.Add(new Bundle("~/Style/Dialog", Links.ClientSource.Style.Dialog_min_css));
BundleTable.Add(new Bundle("~/Style/Job", Links.ClientSource.Style.Job_min_css));
BundleTable.Add(new Bundle("~/Style/User", Links.ClientSource.Style.User_min_css));
BundleTable.Add(new Bundle("~/Style/Credits", Links.ClientSource.Style.Credits_min_css));
BundleTable.Add(new Bundle("~/Style/InitialConfig", Links.ClientSource.Style.InitialConfig_min_css));
BundleTable.Add(new Bundle("~/Style/jQueryUI/dynatree", Links.ClientSource.Style.jQueryUI.dynatree.ui_dynatree_min_css));
BundleTable.Add(new Bundle("~/Style/Shadowbox", Links.ClientSource.Style.Shadowbox_min_css));
BundleTable.Add(new Bundle("~/Style/Timeline", Links.ClientSource.Style.Timeline_min_css));
// Styles - Public Targeted
BundleTable.Add(new Bundle("~/Style/Public/UserHeldDevices", Links.ClientSource.Style.Public.UserHeldDevices_min_css));
BundleTable.Add(new Bundle("~/Style/Public/UserHeldDevicesNoticeboard", Links.ClientSource.Style.Public.UserHeldDevicesNoticeboard_min_css));
// Scripts - Core
#if DEBUG
BundleTable.Add(new Bundle("~/ClientScripts/Core", Links.ClientSource.Scripts.Core_js));
#else
BundleTable.Add(new Bundle("~/ClientScripts/Core", Links.ClientSource.Scripts.Core_min_js));
#endif
// Scripts - Modules
#if DEBUG
foreach (FileInfo f in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ClientSource/Scripts/Modules")).EnumerateFiles("*.js", SearchOption.TopDirectoryOnly))
BundleTable.Add(new Bundle(string.Format("~/ClientScripts/Modules/{0}", f.Name.Substring(0, f.Name.Length - 3)), f.FullName));
#else
foreach (FileInfo f in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ClientSource/Scripts/Modules")).EnumerateFiles("*.min.js", SearchOption.TopDirectoryOnly))
BundleTable.Add(new Bundle(string.Format("~/ClientScripts/Modules/{0}", f.Name.Substring(0, f.Name.Length - 7)), f.FullName));
#endif
}
}
}
+12 -12
View File
@@ -1,13 +1,13 @@
using System.Web;
using System.Web.Mvc;
namespace Disco.Web
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
//filters.Add(new HandleErrorAttribute());
}
}
using System.Web;
using System.Web.Mvc;
namespace Disco.Web
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
//filters.Add(new HandleErrorAttribute());
}
}
}
+22 -22
View File
@@ -1,22 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace Disco.Web
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Migrate to WebAPI Eventually...
//config.Routes.MapHttpRoute(
// name: "DefaultApi",
// routeTemplate: "api/{controller}/{id}",
// defaults: new { id = RouteParameter.Optional }
//);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace Disco.Web
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Migrate to WebAPI Eventually...
//config.Routes.MapHttpRoute(
// name: "DefaultApi",
// routeTemplate: "api/{controller}/{id}",
// defaults: new { id = RouteParameter.Optional }
//);
}
}
}
+38 -38
View File
@@ -1,38 +1,38 @@
using System.Web.Mvc;
using System.Web.Routing;
using SignalR;
namespace Disco.Web.Areas.API
{
public class APIAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "API";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.Routes.MapConnection<Disco.Services.Logging.Targets.LogLiveContext>(
"API_Logging_Notifications", "API/Logging/Notifications/{*operation}");
context.Routes.MapConnection<Disco.Services.Tasks.ScheduledTasksLiveStatusService>(
"API_Logging_TaskStatusNotifications", "API/Logging/TaskStatusNotifications/{*operation}");
context.MapRoute(
"API_Update",
"API/{controller}/Update/{id}/{key}",
new { action = "Update" }
);
context.MapRoute(
"API_default",
"API/{controller}/{action}/{id}",
new { id = UrlParameter.Optional }
);
}
}
}
using System.Web.Mvc;
using System.Web.Routing;
using SignalR;
namespace Disco.Web.Areas.API
{
public class APIAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "API";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.Routes.MapConnection<Disco.Services.Logging.Targets.LogLiveContext>(
"API_Logging_Notifications", "API/Logging/Notifications/{*operation}");
context.Routes.MapConnection<Disco.Services.Tasks.ScheduledTasksLiveStatusService>(
"API_Logging_TaskStatusNotifications", "API/Logging/TaskStatusNotifications/{*operation}");
context.MapRoute(
"API_Update",
"API/{controller}/Update/{id}/{key}",
new { action = "Update" }
);
context.MapRoute(
"API_default",
"API/{controller}/{action}/{id}",
new { id = UrlParameter.Optional }
);
}
}
}
@@ -1,55 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.API.Controllers
{
public partial class BootstrapperController : dbAdminController
{
public virtual ActionResult MacSshUsername(string MacSshUsername)
{
try
{
if (!string.IsNullOrWhiteSpace(MacSshUsername))
{
dbContext.DiscoConfiguration.Bootstrapper.MacSshUsername = MacSshUsername;
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 MacSshPassword(string MacSshPassword)
{
try
{
if (!string.IsNullOrWhiteSpace(MacSshPassword))
{
dbContext.DiscoConfiguration.Bootstrapper.MacSshPassword = MacSshPassword;
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);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.API.Controllers
{
public partial class BootstrapperController : dbAdminController
{
public virtual ActionResult MacSshUsername(string MacSshUsername)
{
try
{
if (!string.IsNullOrWhiteSpace(MacSshUsername))
{
dbContext.DiscoConfiguration.Bootstrapper.MacSshUsername = MacSshUsername;
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 MacSshPassword(string MacSshPassword)
{
try
{
if (!string.IsNullOrWhiteSpace(MacSshPassword))
{
dbContext.DiscoConfiguration.Bootstrapper.MacSshPassword = MacSshPassword;
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);
}
}
}
}
@@ -1,469 +1,469 @@
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.Models.Repository;
using Disco.Web.Extensions;
using System.Drawing;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceBatchController : dbAdminController
{
const string pName = "name";
const string pPurchaseDate = "purchasedate";
const string pSupplier = "supplier";
const string pPurchaseDetails = "purchasedetails";
const string pUnitCost = "unitcost";
const string pUnitQuantity = "unitquantity";
const string pDefaultDeviceModelId = "defaultdevicemodelid";
const string pWarrantyValidUntil = "warrantyvaliduntil";
const string pWarrantyDetails = "warrantydetails";
const string pInsuredDate = "insureddate";
const string pInsuranceSupplier = "insurancesupplier";
const string pInsuredUntil = "insureduntil";
const string pInsuranceDetails = "insurancedetails";
const string pComments = "comments";
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceBatch = dbContext.DeviceBatches.Find(id);
if (deviceBatch != null)
{
switch (key.ToLower())
{
case pName:
UpdateName(deviceBatch, value);
break;
case pPurchaseDate:
UpdatePurchaseDate(deviceBatch, value);
break;
case pSupplier:
UpdateSupplier(deviceBatch, value);
break;
case pPurchaseDetails:
UpdatePurchaseDetails(deviceBatch, value);
break;
case pUnitCost:
UpdateUnitCost(deviceBatch, value);
break;
case pUnitQuantity:
UpdateUnitQuantity(deviceBatch, value);
break;
case pDefaultDeviceModelId:
UpdateDefaultDeviceModelId(deviceBatch, value);
break;
case pWarrantyValidUntil:
UpdateWarrantyValidUntil(deviceBatch, value);
break;
case pWarrantyDetails:
UpdateWarrantyDetails(deviceBatch, value);
break;
case pInsuredDate:
UpdateInsuredDate(deviceBatch, value);
break;
case pInsuranceSupplier:
UpdateInsuranceSupplier(deviceBatch, value);
break;
case pInsuredUntil:
UpdateInsuredUntil(deviceBatch, value);
break;
case pInsuranceDetails:
UpdateInsuranceDetails(deviceBatch, value);
break;
case pComments:
UpdateComments(deviceBatch, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
return Json("Invalid Device Batch Id", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceBatch.Index(deviceBatch.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateName(int id, string BatchName = null, bool redirect = false)
{
return Update(id, pName, BatchName, redirect);
}
public virtual ActionResult UpdatePurchaseDate(int id, string PurchaseDate = null, bool redirect = false)
{
return Update(id, pPurchaseDate, PurchaseDate, redirect);
}
public virtual ActionResult UpdateSupplier(int id, string Supplier = null, bool redirect = false)
{
return Update(id, pSupplier, Supplier, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdatePurchaseDetails(int id, string PurchaseDetails = null, bool redirect = false)
{
return Update(id, pPurchaseDetails, PurchaseDetails, redirect);
}
public virtual ActionResult UpdateUnitCost(int id, string UnitCost = null, bool redirect = false)
{
return Update(id, pUnitCost, UnitCost, redirect);
}
public virtual ActionResult UpdateUnitQuantity(int id, string UnitQuantity = null, bool redirect = false)
{
return Update(id, pUnitQuantity, UnitQuantity, redirect);
}
public virtual ActionResult UpdateDefaultDeviceModelId(int id, string DefaultDeviceModelId = null, bool redirect = false)
{
return Update(id, pDefaultDeviceModelId, DefaultDeviceModelId, redirect);
}
public virtual ActionResult UpdateWarrantyValidUntil(int id, string WarrantyValidUntil = null, bool redirect = false)
{
return Update(id, pWarrantyValidUntil, WarrantyValidUntil, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdateWarrantyDetails(int id, string WarrantyDetails = null, bool redirect = false)
{
return Update(id, pWarrantyDetails, WarrantyDetails, redirect);
}
public virtual ActionResult UpdateInsuredDate(int id, string InsuredDate = null, bool redirect = false)
{
return Update(id, pInsuredDate, InsuredDate, redirect);
}
public virtual ActionResult UpdateInsuranceSupplier(int id, string InsuranceSupplier = null, bool redirect = false)
{
return Update(id, pInsuranceSupplier, InsuranceSupplier, redirect);
}
public virtual ActionResult UpdateInsuredUntil(int id, string InsuredUntil = null, bool redirect = false)
{
return Update(id, pInsuredUntil, InsuredUntil, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdateInsuranceDetails(int id, string InsuranceDetails = null, bool redirect = false)
{
return Update(id, pInsuranceDetails, InsuranceDetails, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdateComments(int id, string Comments = null, bool redirect = false)
{
return Update(id, pComments, Comments, redirect);
}
#endregion
#region Update Properties
private void UpdateName(DeviceBatch deviceBatch, string Name)
{
if (string.IsNullOrWhiteSpace(Name))
throw new ArgumentNullException("Name", "Device Batch Name is required");
else
{
// Check for Duplicates
var d = dbContext.DeviceBatches.Where(db => db.Id != deviceBatch.Id && db.Name == Name).Count();
if (d > 0)
{
throw new Exception("A Device Batch with that name already exists");
}
deviceBatch.Name = Name;
}
dbContext.SaveChanges();
}
private void UpdatePurchaseDate(DeviceBatch deviceBatch, string PurchaseDate)
{
if (string.IsNullOrEmpty(PurchaseDate))
throw new ArgumentNullException("PurchaseDate", "A Device Batch Purchase Date is required");
else
{
DateTime ecd;
if (DateTime.TryParse(PurchaseDate, out ecd))
{
deviceBatch.PurchaseDate = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateSupplier(DeviceBatch deviceBatch, string Supplier)
{
if (string.IsNullOrWhiteSpace(Supplier))
deviceBatch.Supplier = null;
else
deviceBatch.Supplier = Supplier;
dbContext.SaveChanges();
}
private void UpdatePurchaseDetails(DeviceBatch deviceBatch, string PurchaseDetails)
{
if (string.IsNullOrWhiteSpace(PurchaseDetails))
deviceBatch.PurchaseDetails = null;
else
deviceBatch.PurchaseDetails = PurchaseDetails;
dbContext.SaveChanges();
}
private void UpdateUnitCost(DeviceBatch deviceBatch, string UnitCost)
{
if (string.IsNullOrWhiteSpace(UnitCost))
deviceBatch.UnitCost = null;
else
{
decimal unitCost;
if (decimal.TryParse(UnitCost, out unitCost))
{
deviceBatch.UnitCost = unitCost;
}
else
{
throw new Exception("Invalid Currency Format");
}
}
dbContext.SaveChanges();
}
private void UpdateUnitQuantity(DeviceBatch deviceBatch, string UnitQuantity)
{
if (string.IsNullOrWhiteSpace(UnitQuantity))
deviceBatch.UnitQuantity = null;
else
{
int unitQuantity;
if (int.TryParse(UnitQuantity, out unitQuantity))
{
deviceBatch.UnitQuantity = unitQuantity;
}
else
{
throw new Exception("Invalid Number");
}
}
dbContext.SaveChanges();
}
private void UpdateDefaultDeviceModelId(DeviceBatch deviceBatch, string DefaultDeviceModelId)
{
if (!string.IsNullOrEmpty(DefaultDeviceModelId))
{
int bId;
if (int.TryParse(DefaultDeviceModelId, out bId))
{
var dm = dbContext.DeviceModels.Find(bId);
if (dm != null)
{
deviceBatch.DefaultDeviceModelId = dm.Id;
deviceBatch.DefaultDeviceModel = dm;
dbContext.SaveChanges();
return;
}
}
}
else
{
// Null Id - No Batch
deviceBatch.DefaultDeviceModelId = null;
deviceBatch.DefaultDeviceModel = null;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Device Model Id");
}
private void UpdateWarrantyValidUntil(DeviceBatch deviceBatch, string WarrantyValidUntil)
{
if (string.IsNullOrEmpty(WarrantyValidUntil))
deviceBatch.WarrantyValidUntil = null;
else
{
DateTime ecd;
if (DateTime.TryParse(WarrantyValidUntil, out ecd))
{
deviceBatch.WarrantyValidUntil = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateWarrantyDetails(DeviceBatch deviceBatch, string WarrantyDetails)
{
if (string.IsNullOrWhiteSpace(WarrantyDetails))
deviceBatch.WarrantyDetails = null;
else
deviceBatch.WarrantyDetails = WarrantyDetails;
dbContext.SaveChanges();
}
private void UpdateInsuredDate(DeviceBatch deviceBatch, string InsuredDate)
{
if (string.IsNullOrEmpty(InsuredDate))
deviceBatch.InsuredDate = null;
else
{
DateTime ecd;
if (DateTime.TryParse(InsuredDate, out ecd))
{
deviceBatch.InsuredDate = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateInsuranceSupplier(DeviceBatch deviceBatch, string InsuranceSupplier)
{
if (string.IsNullOrWhiteSpace(InsuranceSupplier))
deviceBatch.InsuranceSupplier = null;
else
deviceBatch.InsuranceSupplier = InsuranceSupplier;
dbContext.SaveChanges();
}
private void UpdateInsuredUntil(DeviceBatch deviceBatch, string InsuredUntil)
{
if (string.IsNullOrEmpty(InsuredUntil))
deviceBatch.InsuredUntil = null;
else
{
DateTime ecd;
if (DateTime.TryParse(InsuredUntil, out ecd))
{
deviceBatch.InsuredUntil = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateInsuranceDetails(DeviceBatch deviceBatch, string InsuranceDetails)
{
if (string.IsNullOrWhiteSpace(InsuranceDetails))
deviceBatch.InsuranceDetails = null;
else
deviceBatch.InsuranceDetails = InsuranceDetails;
dbContext.SaveChanges();
}
private void UpdateComments(DeviceBatch deviceBatch, string Comments)
{
if (string.IsNullOrWhiteSpace(Comments))
deviceBatch.Comments = null;
else
deviceBatch.Comments = Comments;
dbContext.SaveChanges();
}
#endregion
#region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var db = dbContext.DeviceBatches.Find(id);
if (db != null)
{
db.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceBatch.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Batch Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Index
public virtual ActionResult Index(int? id)
{
if (id.HasValue)
{
dbContext.Configuration.ProxyCreationEnabled = false;
DeviceBatch deviceBatch = dbContext.DeviceBatches.FirstOrDefault(db => db.Id == id);
return Json(deviceBatch, JsonRequestBehavior.AllowGet);
}
else
{
var deviceBatches = dbContext.DeviceBatches.ToArray();
return Json(deviceBatches, JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Timeline
public virtual ActionResult Timeline()
{
var batchesInformation = dbContext.DeviceBatches.Select(db => new
{
Name = db.Name,
Comments = db.Comments,
PurchaseDate = db.PurchaseDate,
WarrantyValidUntil = db.WarrantyValidUntil,
DeviceCount = db.Devices.Count(),
DefaultModelId = db.DefaultDeviceModelId,
DefaultModelDescription = db.DefaultDeviceModel.Description
}).ToArray();
Color warningColour = Color.FromArgb(225, 70, 0);
Color normalColour = Color.FromArgb(88, 160, 220);
Color highlightColour = Color.FromArgb(0, 140, 0);
double mostDevices = batchesInformation.Max(bi => bi.DeviceCount);
var events = new List<Models.DeviceBatch.DeviceBatchTimelineEvent>();
foreach (var bi in batchesInformation)
{
var color = warningColour; // No Devices
if (bi.DeviceCount > 0)
color = normalColour.InterpolateColours(highlightColour, bi.DeviceCount / mostDevices);
events.Add(new Models.DeviceBatch.DeviceBatchTimelineEvent()
{
start = bi.PurchaseDate,
end = bi.WarrantyValidUntil,
caption = bi.DefaultModelDescription,
title = string.Format("{0} [{1} x{2}]", bi.Name, bi.DefaultModelDescription, bi.DeviceCount),
textColor = "#000",
description = bi.Comments ?? string.Empty,
color = ColorTranslator.ToHtml(color),
image = Url.Action(MVC.API.DeviceModel.Image(bi.DefaultModelId)),
link = Url.Action(MVC.Config.DeviceBatch.Index(bi.DefaultModelId))
});
}
return this.JsonNet(new Models.DeviceBatch.DeviceBatchTimelineEventSource() { events = events.ToArray() }, JsonRequestBehavior.AllowGet);
}
#endregion
}
}
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.Models.Repository;
using Disco.Web.Extensions;
using System.Drawing;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceBatchController : dbAdminController
{
const string pName = "name";
const string pPurchaseDate = "purchasedate";
const string pSupplier = "supplier";
const string pPurchaseDetails = "purchasedetails";
const string pUnitCost = "unitcost";
const string pUnitQuantity = "unitquantity";
const string pDefaultDeviceModelId = "defaultdevicemodelid";
const string pWarrantyValidUntil = "warrantyvaliduntil";
const string pWarrantyDetails = "warrantydetails";
const string pInsuredDate = "insureddate";
const string pInsuranceSupplier = "insurancesupplier";
const string pInsuredUntil = "insureduntil";
const string pInsuranceDetails = "insurancedetails";
const string pComments = "comments";
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceBatch = dbContext.DeviceBatches.Find(id);
if (deviceBatch != null)
{
switch (key.ToLower())
{
case pName:
UpdateName(deviceBatch, value);
break;
case pPurchaseDate:
UpdatePurchaseDate(deviceBatch, value);
break;
case pSupplier:
UpdateSupplier(deviceBatch, value);
break;
case pPurchaseDetails:
UpdatePurchaseDetails(deviceBatch, value);
break;
case pUnitCost:
UpdateUnitCost(deviceBatch, value);
break;
case pUnitQuantity:
UpdateUnitQuantity(deviceBatch, value);
break;
case pDefaultDeviceModelId:
UpdateDefaultDeviceModelId(deviceBatch, value);
break;
case pWarrantyValidUntil:
UpdateWarrantyValidUntil(deviceBatch, value);
break;
case pWarrantyDetails:
UpdateWarrantyDetails(deviceBatch, value);
break;
case pInsuredDate:
UpdateInsuredDate(deviceBatch, value);
break;
case pInsuranceSupplier:
UpdateInsuranceSupplier(deviceBatch, value);
break;
case pInsuredUntil:
UpdateInsuredUntil(deviceBatch, value);
break;
case pInsuranceDetails:
UpdateInsuranceDetails(deviceBatch, value);
break;
case pComments:
UpdateComments(deviceBatch, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
return Json("Invalid Device Batch Id", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceBatch.Index(deviceBatch.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateName(int id, string BatchName = null, bool redirect = false)
{
return Update(id, pName, BatchName, redirect);
}
public virtual ActionResult UpdatePurchaseDate(int id, string PurchaseDate = null, bool redirect = false)
{
return Update(id, pPurchaseDate, PurchaseDate, redirect);
}
public virtual ActionResult UpdateSupplier(int id, string Supplier = null, bool redirect = false)
{
return Update(id, pSupplier, Supplier, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdatePurchaseDetails(int id, string PurchaseDetails = null, bool redirect = false)
{
return Update(id, pPurchaseDetails, PurchaseDetails, redirect);
}
public virtual ActionResult UpdateUnitCost(int id, string UnitCost = null, bool redirect = false)
{
return Update(id, pUnitCost, UnitCost, redirect);
}
public virtual ActionResult UpdateUnitQuantity(int id, string UnitQuantity = null, bool redirect = false)
{
return Update(id, pUnitQuantity, UnitQuantity, redirect);
}
public virtual ActionResult UpdateDefaultDeviceModelId(int id, string DefaultDeviceModelId = null, bool redirect = false)
{
return Update(id, pDefaultDeviceModelId, DefaultDeviceModelId, redirect);
}
public virtual ActionResult UpdateWarrantyValidUntil(int id, string WarrantyValidUntil = null, bool redirect = false)
{
return Update(id, pWarrantyValidUntil, WarrantyValidUntil, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdateWarrantyDetails(int id, string WarrantyDetails = null, bool redirect = false)
{
return Update(id, pWarrantyDetails, WarrantyDetails, redirect);
}
public virtual ActionResult UpdateInsuredDate(int id, string InsuredDate = null, bool redirect = false)
{
return Update(id, pInsuredDate, InsuredDate, redirect);
}
public virtual ActionResult UpdateInsuranceSupplier(int id, string InsuranceSupplier = null, bool redirect = false)
{
return Update(id, pInsuranceSupplier, InsuranceSupplier, redirect);
}
public virtual ActionResult UpdateInsuredUntil(int id, string InsuredUntil = null, bool redirect = false)
{
return Update(id, pInsuredUntil, InsuredUntil, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdateInsuranceDetails(int id, string InsuranceDetails = null, bool redirect = false)
{
return Update(id, pInsuranceDetails, InsuranceDetails, redirect);
}
[ValidateInput(false)]
public virtual ActionResult UpdateComments(int id, string Comments = null, bool redirect = false)
{
return Update(id, pComments, Comments, redirect);
}
#endregion
#region Update Properties
private void UpdateName(DeviceBatch deviceBatch, string Name)
{
if (string.IsNullOrWhiteSpace(Name))
throw new ArgumentNullException("Name", "Device Batch Name is required");
else
{
// Check for Duplicates
var d = dbContext.DeviceBatches.Where(db => db.Id != deviceBatch.Id && db.Name == Name).Count();
if (d > 0)
{
throw new Exception("A Device Batch with that name already exists");
}
deviceBatch.Name = Name;
}
dbContext.SaveChanges();
}
private void UpdatePurchaseDate(DeviceBatch deviceBatch, string PurchaseDate)
{
if (string.IsNullOrEmpty(PurchaseDate))
throw new ArgumentNullException("PurchaseDate", "A Device Batch Purchase Date is required");
else
{
DateTime ecd;
if (DateTime.TryParse(PurchaseDate, out ecd))
{
deviceBatch.PurchaseDate = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateSupplier(DeviceBatch deviceBatch, string Supplier)
{
if (string.IsNullOrWhiteSpace(Supplier))
deviceBatch.Supplier = null;
else
deviceBatch.Supplier = Supplier;
dbContext.SaveChanges();
}
private void UpdatePurchaseDetails(DeviceBatch deviceBatch, string PurchaseDetails)
{
if (string.IsNullOrWhiteSpace(PurchaseDetails))
deviceBatch.PurchaseDetails = null;
else
deviceBatch.PurchaseDetails = PurchaseDetails;
dbContext.SaveChanges();
}
private void UpdateUnitCost(DeviceBatch deviceBatch, string UnitCost)
{
if (string.IsNullOrWhiteSpace(UnitCost))
deviceBatch.UnitCost = null;
else
{
decimal unitCost;
if (decimal.TryParse(UnitCost, out unitCost))
{
deviceBatch.UnitCost = unitCost;
}
else
{
throw new Exception("Invalid Currency Format");
}
}
dbContext.SaveChanges();
}
private void UpdateUnitQuantity(DeviceBatch deviceBatch, string UnitQuantity)
{
if (string.IsNullOrWhiteSpace(UnitQuantity))
deviceBatch.UnitQuantity = null;
else
{
int unitQuantity;
if (int.TryParse(UnitQuantity, out unitQuantity))
{
deviceBatch.UnitQuantity = unitQuantity;
}
else
{
throw new Exception("Invalid Number");
}
}
dbContext.SaveChanges();
}
private void UpdateDefaultDeviceModelId(DeviceBatch deviceBatch, string DefaultDeviceModelId)
{
if (!string.IsNullOrEmpty(DefaultDeviceModelId))
{
int bId;
if (int.TryParse(DefaultDeviceModelId, out bId))
{
var dm = dbContext.DeviceModels.Find(bId);
if (dm != null)
{
deviceBatch.DefaultDeviceModelId = dm.Id;
deviceBatch.DefaultDeviceModel = dm;
dbContext.SaveChanges();
return;
}
}
}
else
{
// Null Id - No Batch
deviceBatch.DefaultDeviceModelId = null;
deviceBatch.DefaultDeviceModel = null;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Device Model Id");
}
private void UpdateWarrantyValidUntil(DeviceBatch deviceBatch, string WarrantyValidUntil)
{
if (string.IsNullOrEmpty(WarrantyValidUntil))
deviceBatch.WarrantyValidUntil = null;
else
{
DateTime ecd;
if (DateTime.TryParse(WarrantyValidUntil, out ecd))
{
deviceBatch.WarrantyValidUntil = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateWarrantyDetails(DeviceBatch deviceBatch, string WarrantyDetails)
{
if (string.IsNullOrWhiteSpace(WarrantyDetails))
deviceBatch.WarrantyDetails = null;
else
deviceBatch.WarrantyDetails = WarrantyDetails;
dbContext.SaveChanges();
}
private void UpdateInsuredDate(DeviceBatch deviceBatch, string InsuredDate)
{
if (string.IsNullOrEmpty(InsuredDate))
deviceBatch.InsuredDate = null;
else
{
DateTime ecd;
if (DateTime.TryParse(InsuredDate, out ecd))
{
deviceBatch.InsuredDate = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateInsuranceSupplier(DeviceBatch deviceBatch, string InsuranceSupplier)
{
if (string.IsNullOrWhiteSpace(InsuranceSupplier))
deviceBatch.InsuranceSupplier = null;
else
deviceBatch.InsuranceSupplier = InsuranceSupplier;
dbContext.SaveChanges();
}
private void UpdateInsuredUntil(DeviceBatch deviceBatch, string InsuredUntil)
{
if (string.IsNullOrEmpty(InsuredUntil))
deviceBatch.InsuredUntil = null;
else
{
DateTime ecd;
if (DateTime.TryParse(InsuredUntil, out ecd))
{
deviceBatch.InsuredUntil = ecd.Date;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateInsuranceDetails(DeviceBatch deviceBatch, string InsuranceDetails)
{
if (string.IsNullOrWhiteSpace(InsuranceDetails))
deviceBatch.InsuranceDetails = null;
else
deviceBatch.InsuranceDetails = InsuranceDetails;
dbContext.SaveChanges();
}
private void UpdateComments(DeviceBatch deviceBatch, string Comments)
{
if (string.IsNullOrWhiteSpace(Comments))
deviceBatch.Comments = null;
else
deviceBatch.Comments = Comments;
dbContext.SaveChanges();
}
#endregion
#region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var db = dbContext.DeviceBatches.Find(id);
if (db != null)
{
db.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceBatch.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Batch Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Index
public virtual ActionResult Index(int? id)
{
if (id.HasValue)
{
dbContext.Configuration.ProxyCreationEnabled = false;
DeviceBatch deviceBatch = dbContext.DeviceBatches.FirstOrDefault(db => db.Id == id);
return Json(deviceBatch, JsonRequestBehavior.AllowGet);
}
else
{
var deviceBatches = dbContext.DeviceBatches.ToArray();
return Json(deviceBatches, JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Timeline
public virtual ActionResult Timeline()
{
var batchesInformation = dbContext.DeviceBatches.Select(db => new
{
Name = db.Name,
Comments = db.Comments,
PurchaseDate = db.PurchaseDate,
WarrantyValidUntil = db.WarrantyValidUntil,
DeviceCount = db.Devices.Count(),
DefaultModelId = db.DefaultDeviceModelId,
DefaultModelDescription = db.DefaultDeviceModel.Description
}).ToArray();
Color warningColour = Color.FromArgb(225, 70, 0);
Color normalColour = Color.FromArgb(88, 160, 220);
Color highlightColour = Color.FromArgb(0, 140, 0);
double mostDevices = batchesInformation.Max(bi => bi.DeviceCount);
var events = new List<Models.DeviceBatch.DeviceBatchTimelineEvent>();
foreach (var bi in batchesInformation)
{
var color = warningColour; // No Devices
if (bi.DeviceCount > 0)
color = normalColour.InterpolateColours(highlightColour, bi.DeviceCount / mostDevices);
events.Add(new Models.DeviceBatch.DeviceBatchTimelineEvent()
{
start = bi.PurchaseDate,
end = bi.WarrantyValidUntil,
caption = bi.DefaultModelDescription,
title = string.Format("{0} [{1} x{2}]", bi.Name, bi.DefaultModelDescription, bi.DeviceCount),
textColor = "#000",
description = bi.Comments ?? string.Empty,
color = ColorTranslator.ToHtml(color),
image = Url.Action(MVC.API.DeviceModel.Image(bi.DefaultModelId)),
link = Url.Action(MVC.Config.DeviceBatch.Index(bi.DefaultModelId))
});
}
return this.JsonNet(new Models.DeviceBatch.DeviceBatchTimelineEventSource() { events = events.ToArray() }, JsonRequestBehavior.AllowGet);
}
#endregion
}
}
@@ -1,468 +1,468 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
using Disco.BI;
using Disco.BI.Interop.ActiveDirectory;
using System.IO;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceController : dbAdminController
{
const string pDeviceProfileId = "deviceprofileid";
const string pDeviceBatchId = "devicebatchid";
const string pAssetNumber = "assetnumber";
const string pAssignedUserId = "assigneduserid";
const string pLocation = "location";
const string pAllowUnauthenticatedEnrol = "allowunauthenticatedenrol";
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
{
dbContext.Configuration.LazyLoadingEnabled = true;
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var device = dbContext.Devices.Find(id);
if (device != null)
{
switch (key.ToLower())
{
case pDeviceProfileId:
UpdateDeviceProfileId(device, value);
break;
case pDeviceBatchId:
UpdateDeviceBatchId(device, value);
break;
case pAssetNumber:
UpdateAssetNumber(device, value);
break;
case pAssignedUserId:
UpdateAssignedUserId(device, value);
break;
case pLocation:
UpdateLocation(device, value);
break;
case pAllowUnauthenticatedEnrol:
UpdateAllowUnauthenticatedEnrol(device, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Serial Number or Device Profile Id");
}
if (redirect)
return RedirectToAction(MVC.Device.Show(device.SerialNumber));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDeviceProfileId(string id, string DeviceProfileId = null, bool redirect = false)
{
return Update(id, pDeviceProfileId, DeviceProfileId, redirect);
}
public virtual ActionResult UpdateDeviceBatchId(string id, string DeviceBatchId = null, bool redirect = false)
{
return Update(id, pDeviceBatchId, DeviceBatchId, redirect);
}
public virtual ActionResult UpdateAssetNumber(string id, string AssetNumber = null, bool redirect = false)
{
return Update(id, pAssetNumber, AssetNumber, redirect);
}
public virtual ActionResult UpdateLocation(string id, string Location = null, bool redirect = false)
{
return Update(id, pLocation, Location, redirect);
}
public virtual ActionResult UpdateAssignedUserId(string id, string AssignedUserId = null, bool redirect = false)
{
return Update(id, pAssignedUserId, AssignedUserId, redirect);
}
public virtual ActionResult UpdateAllowUnauthenticatedEnrol(string id, string AllowUnauthenticatedEnrol = null, bool redirect = false)
{
return Update(id, pAllowUnauthenticatedEnrol, AllowUnauthenticatedEnrol, redirect);
}
#endregion
#region Update Properties
private void UpdateDeviceProfileId(Disco.Models.Repository.Device device, string DeviceProfileId)
{
if (!string.IsNullOrEmpty(DeviceProfileId))
{
int pId;
if (int.TryParse(DeviceProfileId, out pId))
{
var p = dbContext.DeviceProfiles.Find(pId);
if (p != null)
{
device.DeviceProfileId = p.Id;
device.DeviceProfile = p;
// Update AD Account
if (!string.IsNullOrEmpty(device.ComputerName) && device.ComputerName.Length <= 24)
{
var adMachineAccount = ActiveDirectory.GetMachineAccount(device.ComputerName);
if (adMachineAccount != null)
adMachineAccount.SetDescription(device);
}
dbContext.SaveChanges();
return;
}
}
}
throw new Exception("Invalid Device Profile Id");
}
private void UpdateDeviceBatchId(Disco.Models.Repository.Device device, string DeviceBatchId)
{
if (!string.IsNullOrEmpty(DeviceBatchId))
{
int bId;
if (int.TryParse(DeviceBatchId, out bId))
{
var b = dbContext.DeviceBatches.Find(bId);
if (b != null)
{
device.DeviceBatchId = b.Id;
device.DeviceBatch = b;
dbContext.SaveChanges();
return;
}
}
}
else
{
// Null Id - No Batch
device.DeviceBatchId = null;
device.DeviceBatch = null;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Device Batch Id");
}
private void UpdateAssetNumber(Disco.Models.Repository.Device device, string AssetNumber)
{
if (string.IsNullOrWhiteSpace(AssetNumber))
device.AssetNumber = null;
else
device.AssetNumber = AssetNumber.Trim();
dbContext.SaveChanges();
}
private void UpdateLocation(Disco.Models.Repository.Device device, string Location)
{
if (string.IsNullOrWhiteSpace(Location))
device.Location = null;
else
device.Location = Location.Trim();
dbContext.SaveChanges();
}
private void UpdateAssignedUserId(Disco.Models.Repository.Device device, string UserId)
{
var daus = dbContext.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == device.SerialNumber && m.UnassignedDate == null);
Disco.Models.Repository.User u = null;
if (!string.IsNullOrEmpty(UserId))
{
// Changed 2012-12-13 G# - Stop error when assigning user - Force Refresh
// http://www.discoict.com.au/forum/support/2012/11/error-when-assigning-multiple-devices-to-single-user.aspx
//u = BI.UserBI.UserCache.GetUser(UserId, dbContext);
u = BI.UserBI.UserCache.GetUser(UserId, dbContext, true);
// End Changed 2012-12-13 G#
if (u == null)
{
throw new Exception("Invalid Username");
}
}
device.AssignDevice(dbContext, u);
dbContext.SaveChanges();
}
private void UpdateAllowUnauthenticatedEnrol(Disco.Models.Repository.Device device, string AllowUnauthenticatedEnrol)
{
bool bAllowUnauthenticatedEnrol;
if (string.IsNullOrEmpty(AllowUnauthenticatedEnrol) || !bool.TryParse(AllowUnauthenticatedEnrol, out bAllowUnauthenticatedEnrol))
{
throw new Exception("Invalid AllowUnauthenticatedEnrol Value");
}
if (device.AllowUnauthenticatedEnrol != bAllowUnauthenticatedEnrol)
{
device.AllowUnauthenticatedEnrol = bAllowUnauthenticatedEnrol;
dbContext.SaveChanges();
}
}
#endregion
#region Device Actions
public virtual ActionResult Decommission(string id, bool redirect)
{
var d = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
if (d != null)
{
if (d.CanDecommission())
{
d.OnDecommission();
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Show(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
return Json("Device's state doesn't allow this action", JsonRequestBehavior.AllowGet);
}
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Recommission(string id, bool redirect)
{
var d = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
if (d != null)
{
if (d.CanRecommission())
{
d.OnRecommission();
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Show(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
return Json("Device's state doesn't allow this action", JsonRequestBehavior.AllowGet);
}
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Delete(string id, bool redirect)
{
var j = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
if (j != null)
{
if (j.CanDelete())
{
j.OnDelete(dbContext);
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Index());
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet);
}
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
#endregion
public virtual ActionResult GeneratePdf(string id, string DocumentTemplateId)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DocumentTemplateId))
throw new ArgumentNullException("AttachmentTypeId");
var device = dbContext.Devices.Find(id);
if (device != null)
{
var documentTemplate = dbContext.DocumentTemplates.Find(DocumentTemplateId);
if (documentTemplate != null)
{
var timeStamp = DateTime.Now;
Stream pdf;
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState()){
pdf = documentTemplate.GeneratePdf(dbContext, device, DiscoApplication.CurrentUser, timeStamp, generationState);
}
dbContext.SaveChanges();
return File(pdf, "application/pdf", string.Format("{0}_{1}_{2:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, device.SerialNumber, timeStamp));
}
else
{
throw new ArgumentException("Invalid Document Template Id", "id");
}
}
else
{
throw new ArgumentException("Invalid Serial Number", "id");
}
}
public virtual ActionResult LastNetworkLogonDate(string id)
{
var device = dbContext.Devices.Find(id);
if (device == null)
{
return HttpNotFound("Invalid Device Serial Number");
}
if (device.UpdateLastNetworkLogonDate())
dbContext.SaveChanges();
var result = new
{
Timestamp = device.LastNetworkLogonDate,
Friendly = device.LastNetworkLogonDate.ToFuzzy("Unknown"),
Formatted = device.LastNetworkLogonDate.ToFullDateTime("Unknown")
};
return Json(result, JsonRequestBehavior.AllowGet);
}
#region Device Attachements
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
{
var da = dbContext.DeviceAttachments.Find(id);
if (da != null)
{
var filePath = da.RepositoryFilename(dbContext);
if (System.IO.File.Exists(filePath))
{
return File(filePath, da.MimeType, da.Filename);
}
else
{
return HttpNotFound("Attachment reference exists, but file not found");
}
}
return HttpNotFound("Invalid Attachment Number");
}
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
var da = dbContext.DeviceAttachments.Find(id);
if (da != null)
{
var thumbPath = da.RepositoryThumbnailFilename(dbContext);
if (System.IO.File.Exists(thumbPath))
{
if (thumbPath.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
return File(thumbPath, "image/png");
else
return File(thumbPath, "image/jpg");
}
else
return File(ClientSource.Style.Images.AttachmentTypes.MimeTypeIcons.Icon(da.MimeType), "image/png");
}
return HttpNotFound("Invalid Attachment Number");
}
public virtual ActionResult AttachmentUpload(string id, string Comments)
{
var d = dbContext.Devices.Find(id);
if (d != null)
{
if (Request.Files.Count > 0)
{
var file = Request.Files.Get(0);
if (file.ContentLength > 0)
{
var contentType = file.ContentType;
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.InvariantCultureIgnoreCase))
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
var da = new Disco.Models.Repository.DeviceAttachment()
{
DeviceSerialNumber = d.SerialNumber,
TechUserId = DiscoApplication.CurrentUser.Id,
Filename = file.FileName,
MimeType = contentType,
Timestamp = DateTime.Now,
Comments = Comments
};
dbContext.DeviceAttachments.Add(da);
dbContext.SaveChanges();
da.SaveAttachment(dbContext, file.InputStream);
da.GenerateThumbnail(dbContext);
return Json(da.Id, JsonRequestBehavior.AllowGet);
}
}
throw new Exception("No Attachment Uploaded");
}
throw new Exception("Invalid Device Serial Number");
}
public virtual ActionResult Attachment(int id)
{
var da = dbContext.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (da != null)
{
var m = new Models.Attachment.AttachmentModel()
{
Attachment = Models.Attachment._AttachmentModel.FromAttachment(da),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Attachments(string id)
{
var d = dbContext.Devices.Include("DeviceAttachments.TechUser").Where(m => m.SerialNumber == id).FirstOrDefault();
if (d != null)
{
var m = new Models.Attachment.AttachmentsModel()
{
Attachments = d.DeviceAttachments.Select(ua => Models.Attachment._AttachmentModel.FromAttachment(ua)).ToList(),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid Device Serial Number" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult AttachmentRemove(int id)
{
var da = dbContext.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (da != null)
{
// 2012-02-17 G# Remove - 'Delete Own Comments' policy
//if (da.TechUserId == DiscoApplication.CurrentUser.Id)
//{
da.OnDelete(dbContext);
dbContext.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
//}
//else
//{
// return Json("You can only delete your own attachments.", JsonRequestBehavior.AllowGet);
//}
}
return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
using Disco.BI;
using Disco.BI.Interop.ActiveDirectory;
using System.IO;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceController : dbAdminController
{
const string pDeviceProfileId = "deviceprofileid";
const string pDeviceBatchId = "devicebatchid";
const string pAssetNumber = "assetnumber";
const string pAssignedUserId = "assigneduserid";
const string pLocation = "location";
const string pAllowUnauthenticatedEnrol = "allowunauthenticatedenrol";
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
{
dbContext.Configuration.LazyLoadingEnabled = true;
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var device = dbContext.Devices.Find(id);
if (device != null)
{
switch (key.ToLower())
{
case pDeviceProfileId:
UpdateDeviceProfileId(device, value);
break;
case pDeviceBatchId:
UpdateDeviceBatchId(device, value);
break;
case pAssetNumber:
UpdateAssetNumber(device, value);
break;
case pAssignedUserId:
UpdateAssignedUserId(device, value);
break;
case pLocation:
UpdateLocation(device, value);
break;
case pAllowUnauthenticatedEnrol:
UpdateAllowUnauthenticatedEnrol(device, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Serial Number or Device Profile Id");
}
if (redirect)
return RedirectToAction(MVC.Device.Show(device.SerialNumber));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDeviceProfileId(string id, string DeviceProfileId = null, bool redirect = false)
{
return Update(id, pDeviceProfileId, DeviceProfileId, redirect);
}
public virtual ActionResult UpdateDeviceBatchId(string id, string DeviceBatchId = null, bool redirect = false)
{
return Update(id, pDeviceBatchId, DeviceBatchId, redirect);
}
public virtual ActionResult UpdateAssetNumber(string id, string AssetNumber = null, bool redirect = false)
{
return Update(id, pAssetNumber, AssetNumber, redirect);
}
public virtual ActionResult UpdateLocation(string id, string Location = null, bool redirect = false)
{
return Update(id, pLocation, Location, redirect);
}
public virtual ActionResult UpdateAssignedUserId(string id, string AssignedUserId = null, bool redirect = false)
{
return Update(id, pAssignedUserId, AssignedUserId, redirect);
}
public virtual ActionResult UpdateAllowUnauthenticatedEnrol(string id, string AllowUnauthenticatedEnrol = null, bool redirect = false)
{
return Update(id, pAllowUnauthenticatedEnrol, AllowUnauthenticatedEnrol, redirect);
}
#endregion
#region Update Properties
private void UpdateDeviceProfileId(Disco.Models.Repository.Device device, string DeviceProfileId)
{
if (!string.IsNullOrEmpty(DeviceProfileId))
{
int pId;
if (int.TryParse(DeviceProfileId, out pId))
{
var p = dbContext.DeviceProfiles.Find(pId);
if (p != null)
{
device.DeviceProfileId = p.Id;
device.DeviceProfile = p;
// Update AD Account
if (!string.IsNullOrEmpty(device.ComputerName) && device.ComputerName.Length <= 24)
{
var adMachineAccount = ActiveDirectory.GetMachineAccount(device.ComputerName);
if (adMachineAccount != null)
adMachineAccount.SetDescription(device);
}
dbContext.SaveChanges();
return;
}
}
}
throw new Exception("Invalid Device Profile Id");
}
private void UpdateDeviceBatchId(Disco.Models.Repository.Device device, string DeviceBatchId)
{
if (!string.IsNullOrEmpty(DeviceBatchId))
{
int bId;
if (int.TryParse(DeviceBatchId, out bId))
{
var b = dbContext.DeviceBatches.Find(bId);
if (b != null)
{
device.DeviceBatchId = b.Id;
device.DeviceBatch = b;
dbContext.SaveChanges();
return;
}
}
}
else
{
// Null Id - No Batch
device.DeviceBatchId = null;
device.DeviceBatch = null;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Device Batch Id");
}
private void UpdateAssetNumber(Disco.Models.Repository.Device device, string AssetNumber)
{
if (string.IsNullOrWhiteSpace(AssetNumber))
device.AssetNumber = null;
else
device.AssetNumber = AssetNumber.Trim();
dbContext.SaveChanges();
}
private void UpdateLocation(Disco.Models.Repository.Device device, string Location)
{
if (string.IsNullOrWhiteSpace(Location))
device.Location = null;
else
device.Location = Location.Trim();
dbContext.SaveChanges();
}
private void UpdateAssignedUserId(Disco.Models.Repository.Device device, string UserId)
{
var daus = dbContext.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == device.SerialNumber && m.UnassignedDate == null);
Disco.Models.Repository.User u = null;
if (!string.IsNullOrEmpty(UserId))
{
// Changed 2012-12-13 G# - Stop error when assigning user - Force Refresh
// http://www.discoict.com.au/forum/support/2012/11/error-when-assigning-multiple-devices-to-single-user.aspx
//u = BI.UserBI.UserCache.GetUser(UserId, dbContext);
u = BI.UserBI.UserCache.GetUser(UserId, dbContext, true);
// End Changed 2012-12-13 G#
if (u == null)
{
throw new Exception("Invalid Username");
}
}
device.AssignDevice(dbContext, u);
dbContext.SaveChanges();
}
private void UpdateAllowUnauthenticatedEnrol(Disco.Models.Repository.Device device, string AllowUnauthenticatedEnrol)
{
bool bAllowUnauthenticatedEnrol;
if (string.IsNullOrEmpty(AllowUnauthenticatedEnrol) || !bool.TryParse(AllowUnauthenticatedEnrol, out bAllowUnauthenticatedEnrol))
{
throw new Exception("Invalid AllowUnauthenticatedEnrol Value");
}
if (device.AllowUnauthenticatedEnrol != bAllowUnauthenticatedEnrol)
{
device.AllowUnauthenticatedEnrol = bAllowUnauthenticatedEnrol;
dbContext.SaveChanges();
}
}
#endregion
#region Device Actions
public virtual ActionResult Decommission(string id, bool redirect)
{
var d = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
if (d != null)
{
if (d.CanDecommission())
{
d.OnDecommission();
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Show(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
return Json("Device's state doesn't allow this action", JsonRequestBehavior.AllowGet);
}
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Recommission(string id, bool redirect)
{
var d = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
if (d != null)
{
if (d.CanRecommission())
{
d.OnRecommission();
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Show(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
return Json("Device's state doesn't allow this action", JsonRequestBehavior.AllowGet);
}
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Delete(string id, bool redirect)
{
var j = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
if (j != null)
{
if (j.CanDelete())
{
j.OnDelete(dbContext);
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Index());
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet);
}
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
#endregion
public virtual ActionResult GeneratePdf(string id, string DocumentTemplateId)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DocumentTemplateId))
throw new ArgumentNullException("AttachmentTypeId");
var device = dbContext.Devices.Find(id);
if (device != null)
{
var documentTemplate = dbContext.DocumentTemplates.Find(DocumentTemplateId);
if (documentTemplate != null)
{
var timeStamp = DateTime.Now;
Stream pdf;
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState()){
pdf = documentTemplate.GeneratePdf(dbContext, device, DiscoApplication.CurrentUser, timeStamp, generationState);
}
dbContext.SaveChanges();
return File(pdf, "application/pdf", string.Format("{0}_{1}_{2:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, device.SerialNumber, timeStamp));
}
else
{
throw new ArgumentException("Invalid Document Template Id", "id");
}
}
else
{
throw new ArgumentException("Invalid Serial Number", "id");
}
}
public virtual ActionResult LastNetworkLogonDate(string id)
{
var device = dbContext.Devices.Find(id);
if (device == null)
{
return HttpNotFound("Invalid Device Serial Number");
}
if (device.UpdateLastNetworkLogonDate())
dbContext.SaveChanges();
var result = new
{
Timestamp = device.LastNetworkLogonDate,
Friendly = device.LastNetworkLogonDate.ToFuzzy("Unknown"),
Formatted = device.LastNetworkLogonDate.ToFullDateTime("Unknown")
};
return Json(result, JsonRequestBehavior.AllowGet);
}
#region Device Attachements
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
{
var da = dbContext.DeviceAttachments.Find(id);
if (da != null)
{
var filePath = da.RepositoryFilename(dbContext);
if (System.IO.File.Exists(filePath))
{
return File(filePath, da.MimeType, da.Filename);
}
else
{
return HttpNotFound("Attachment reference exists, but file not found");
}
}
return HttpNotFound("Invalid Attachment Number");
}
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
var da = dbContext.DeviceAttachments.Find(id);
if (da != null)
{
var thumbPath = da.RepositoryThumbnailFilename(dbContext);
if (System.IO.File.Exists(thumbPath))
{
if (thumbPath.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
return File(thumbPath, "image/png");
else
return File(thumbPath, "image/jpg");
}
else
return File(ClientSource.Style.Images.AttachmentTypes.MimeTypeIcons.Icon(da.MimeType), "image/png");
}
return HttpNotFound("Invalid Attachment Number");
}
public virtual ActionResult AttachmentUpload(string id, string Comments)
{
var d = dbContext.Devices.Find(id);
if (d != null)
{
if (Request.Files.Count > 0)
{
var file = Request.Files.Get(0);
if (file.ContentLength > 0)
{
var contentType = file.ContentType;
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.InvariantCultureIgnoreCase))
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
var da = new Disco.Models.Repository.DeviceAttachment()
{
DeviceSerialNumber = d.SerialNumber,
TechUserId = DiscoApplication.CurrentUser.Id,
Filename = file.FileName,
MimeType = contentType,
Timestamp = DateTime.Now,
Comments = Comments
};
dbContext.DeviceAttachments.Add(da);
dbContext.SaveChanges();
da.SaveAttachment(dbContext, file.InputStream);
da.GenerateThumbnail(dbContext);
return Json(da.Id, JsonRequestBehavior.AllowGet);
}
}
throw new Exception("No Attachment Uploaded");
}
throw new Exception("Invalid Device Serial Number");
}
public virtual ActionResult Attachment(int id)
{
var da = dbContext.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (da != null)
{
var m = new Models.Attachment.AttachmentModel()
{
Attachment = Models.Attachment._AttachmentModel.FromAttachment(da),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Attachments(string id)
{
var d = dbContext.Devices.Include("DeviceAttachments.TechUser").Where(m => m.SerialNumber == id).FirstOrDefault();
if (d != null)
{
var m = new Models.Attachment.AttachmentsModel()
{
Attachments = d.DeviceAttachments.Select(ua => Models.Attachment._AttachmentModel.FromAttachment(ua)).ToList(),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid Device Serial Number" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult AttachmentRemove(int id)
{
var da = dbContext.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (da != null)
{
// 2012-02-17 G# Remove - 'Delete Own Comments' policy
//if (da.TechUserId == DiscoApplication.CurrentUser.Id)
//{
da.OnDelete(dbContext);
dbContext.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
//}
//else
//{
// return Json("You can only delete your own attachments.", JsonRequestBehavior.AllowGet);
//}
}
return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet);
}
#endregion
}
}
@@ -1,338 +1,338 @@
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.Models.Repository;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.WarrantyProvider;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceModelController : dbAdminController
{
const string pDescription = "description";
const string pDefaultPurchaseDate = "defaultpurchasedate";
const string pDefaultWarrantyProvider = "defaultwarrantyprovider";
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceModel = dbContext.DeviceModels.Find(id);
if (deviceModel != null)
{
switch (key.ToLower())
{
case pDescription:
UpdateDescription(deviceModel, value);
break;
case pDefaultPurchaseDate:
UpdateDefaultPurchaseDate(deviceModel, value);
break;
case pDefaultWarrantyProvider:
UpdateDefaultWarrantyProvider(deviceModel, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index(deviceModel.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDescription(int id, string Description = null, bool redirect = false)
{
return Update(id, pDescription, Description, redirect);
}
public virtual ActionResult UpdateDefaultPurchaseDate(int id, string DefaultPurchaseDate = null, bool redirect = false)
{
return Update(id, pDefaultPurchaseDate, DefaultPurchaseDate, redirect);
}
public virtual ActionResult UpdateDefaultWarrantyProvider(int id, string DefaultWarrantyProvider = null, bool redirect = false)
{
return Update(id, pDefaultWarrantyProvider, DefaultWarrantyProvider, redirect);
}
#endregion
#region Update Properties
private void UpdateDescription(Disco.Models.Repository.DeviceModel deviceModel, string Description)
{
if (string.IsNullOrWhiteSpace(Description))
deviceModel.Description = null;
else
deviceModel.Description = Description;
dbContext.SaveChanges();
}
private void UpdateDefaultPurchaseDate(Disco.Models.Repository.DeviceModel deviceModel, string DefaultPurchaseDate)
{
if (string.IsNullOrEmpty(DefaultPurchaseDate))
{
deviceModel.DefaultPurchaseDate = null;
}
else
{
DateTime d;
if (DateTime.TryParse(DefaultPurchaseDate, out d))
{
deviceModel.DefaultPurchaseDate = d;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateDefaultWarrantyProvider(Disco.Models.Repository.DeviceModel deviceModel, string DefaultWarrantyProvider)
{
if (string.IsNullOrEmpty(DefaultWarrantyProvider))
{
deviceModel.DefaultWarrantyProvider = null;
}
else
{
// Validate
var WarrantyProvider = Plugins.GetPluginFeature(DefaultWarrantyProvider, typeof(WarrantyProviderFeature));
deviceModel.DefaultWarrantyProvider = WarrantyProvider.Id;
}
dbContext.SaveChanges();
}
#endregion
#region ModelImage
[OutputCache(Duration = 31536000, Location = System.Web.UI.OutputCacheLocation.Any, VaryByParam = "*")]
public virtual ActionResult Image(int? id, string v = null)
{
if (id.HasValue)
{
var m = dbContext.DeviceModels.Find(id.Value);
if (m != null)
{
// Try From DataStore
var deviceModelImage = m.Image();
if (deviceModelImage != null)
return File(deviceModelImage, "image/png");
//if ( m.Image != null)
//{
// return File(m.Image, "image/png");
//}
//else
//{
// DataStore Failed - Use Generic Images
if (m.ModelType != null)
{
var modelTypePath = Server.MapPath(string.Format("~/Content/Images/DeviceTypes/{0}.png", m.ModelType));
if (System.IO.File.Exists(modelTypePath))
{
return File(modelTypePath, "image/png");
}
}
//}
}
}
return File(Links.ClientSource.Style.Images.DeviceTypes.Unknown_png, "image/png");
}
[HttpPost]
public virtual ActionResult Image(int id, bool redirect, HttpPostedFileBase Image)
{
if (Image != null && Image.ContentLength > 0)
{
var dm = dbContext.DeviceModels.Find(id);
if (dm != null)
{
if (dm.ImageImport(Image.InputStream))
{
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
else
return Json("Invalid Image Format", JsonRequestBehavior.AllowGet);
}
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index());
else
return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index());
else
return Json("No Image Supplied", JsonRequestBehavior.AllowGet);
}
#endregion
#region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var dm = dbContext.DeviceModels.Find(id);
if (dm != null)
{
dm.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceModel.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Model Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Device Model Components
public virtual ActionResult Component(int id)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentAdd(int? id, string Description, string Cost)
{
DeviceModel dm = null;
if (id.HasValue)
{
dm = dbContext.DeviceModels.Find(id.Value);
if (dm == null)
{
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Model Id" }, JsonRequestBehavior.AllowGet);
}
}
decimal cost = 0;
if (string.IsNullOrEmpty(Description))
Description = "?";
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
decimal.TryParse(Cost, out cost);
var dc = new Disco.Models.Repository.DeviceComponent()
{
Description = Description,
Cost = cost
};
if (dm != null)
{
dc.DeviceModelId = dm.Id;
}
dc.JobSubTypes = new List<JobSubType>();
dbContext.DeviceComponents.Add(dc);
dbContext.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentUpdateJobSubTypes(int id, List<string> JobSubTypes)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
dc.JobSubTypes.Clear();
if (JobSubTypes != null)
{
var jsts = dbContext.JobSubTypes.Where(jst => JobSubTypes.Contains(jst.JobTypeId + "_" + jst.Id));
foreach (var jst in jsts)
{
dc.JobSubTypes.Add(jst);
}
}
dbContext.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentUpdate(int id, string Description, string Cost)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
decimal cost = 0;
if (string.IsNullOrEmpty(Description))
Description = "?";
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
decimal.TryParse(Cost, out cost);
dc.Description = Description;
dc.Cost = cost;
dbContext.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentRemove(int id)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(c => c.Id == id).FirstOrDefault();
if (dc != null)
{
dc.JobSubTypes.Clear();
dbContext.DeviceComponents.Remove(dc);
dbContext.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
}
return Json("Invalid Device Component Id", JsonRequestBehavior.AllowGet);
}
#endregion
#region Index
public virtual ActionResult Index()
{
var deviceModels = dbContext.DeviceModels.ToArray().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToArray();
return Json(deviceModels, JsonRequestBehavior.AllowGet);
}
#endregion
}
}
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.Models.Repository;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.WarrantyProvider;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceModelController : dbAdminController
{
const string pDescription = "description";
const string pDefaultPurchaseDate = "defaultpurchasedate";
const string pDefaultWarrantyProvider = "defaultwarrantyprovider";
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceModel = dbContext.DeviceModels.Find(id);
if (deviceModel != null)
{
switch (key.ToLower())
{
case pDescription:
UpdateDescription(deviceModel, value);
break;
case pDefaultPurchaseDate:
UpdateDefaultPurchaseDate(deviceModel, value);
break;
case pDefaultWarrantyProvider:
UpdateDefaultWarrantyProvider(deviceModel, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index(deviceModel.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDescription(int id, string Description = null, bool redirect = false)
{
return Update(id, pDescription, Description, redirect);
}
public virtual ActionResult UpdateDefaultPurchaseDate(int id, string DefaultPurchaseDate = null, bool redirect = false)
{
return Update(id, pDefaultPurchaseDate, DefaultPurchaseDate, redirect);
}
public virtual ActionResult UpdateDefaultWarrantyProvider(int id, string DefaultWarrantyProvider = null, bool redirect = false)
{
return Update(id, pDefaultWarrantyProvider, DefaultWarrantyProvider, redirect);
}
#endregion
#region Update Properties
private void UpdateDescription(Disco.Models.Repository.DeviceModel deviceModel, string Description)
{
if (string.IsNullOrWhiteSpace(Description))
deviceModel.Description = null;
else
deviceModel.Description = Description;
dbContext.SaveChanges();
}
private void UpdateDefaultPurchaseDate(Disco.Models.Repository.DeviceModel deviceModel, string DefaultPurchaseDate)
{
if (string.IsNullOrEmpty(DefaultPurchaseDate))
{
deviceModel.DefaultPurchaseDate = null;
}
else
{
DateTime d;
if (DateTime.TryParse(DefaultPurchaseDate, out d))
{
deviceModel.DefaultPurchaseDate = d;
}
else
{
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
}
private void UpdateDefaultWarrantyProvider(Disco.Models.Repository.DeviceModel deviceModel, string DefaultWarrantyProvider)
{
if (string.IsNullOrEmpty(DefaultWarrantyProvider))
{
deviceModel.DefaultWarrantyProvider = null;
}
else
{
// Validate
var WarrantyProvider = Plugins.GetPluginFeature(DefaultWarrantyProvider, typeof(WarrantyProviderFeature));
deviceModel.DefaultWarrantyProvider = WarrantyProvider.Id;
}
dbContext.SaveChanges();
}
#endregion
#region ModelImage
[OutputCache(Duration = 31536000, Location = System.Web.UI.OutputCacheLocation.Any, VaryByParam = "*")]
public virtual ActionResult Image(int? id, string v = null)
{
if (id.HasValue)
{
var m = dbContext.DeviceModels.Find(id.Value);
if (m != null)
{
// Try From DataStore
var deviceModelImage = m.Image();
if (deviceModelImage != null)
return File(deviceModelImage, "image/png");
//if ( m.Image != null)
//{
// return File(m.Image, "image/png");
//}
//else
//{
// DataStore Failed - Use Generic Images
if (m.ModelType != null)
{
var modelTypePath = Server.MapPath(string.Format("~/Content/Images/DeviceTypes/{0}.png", m.ModelType));
if (System.IO.File.Exists(modelTypePath))
{
return File(modelTypePath, "image/png");
}
}
//}
}
}
return File(Links.ClientSource.Style.Images.DeviceTypes.Unknown_png, "image/png");
}
[HttpPost]
public virtual ActionResult Image(int id, bool redirect, HttpPostedFileBase Image)
{
if (Image != null && Image.ContentLength > 0)
{
var dm = dbContext.DeviceModels.Find(id);
if (dm != null)
{
if (dm.ImageImport(Image.InputStream))
{
dbContext.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
{
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
else
return Json("Invalid Image Format", JsonRequestBehavior.AllowGet);
}
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index());
else
return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index());
else
return Json("No Image Supplied", JsonRequestBehavior.AllowGet);
}
#endregion
#region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var dm = dbContext.DeviceModels.Find(id);
if (dm != null)
{
dm.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceModel.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Model Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Device Model Components
public virtual ActionResult Component(int id)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentAdd(int? id, string Description, string Cost)
{
DeviceModel dm = null;
if (id.HasValue)
{
dm = dbContext.DeviceModels.Find(id.Value);
if (dm == null)
{
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Model Id" }, JsonRequestBehavior.AllowGet);
}
}
decimal cost = 0;
if (string.IsNullOrEmpty(Description))
Description = "?";
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
decimal.TryParse(Cost, out cost);
var dc = new Disco.Models.Repository.DeviceComponent()
{
Description = Description,
Cost = cost
};
if (dm != null)
{
dc.DeviceModelId = dm.Id;
}
dc.JobSubTypes = new List<JobSubType>();
dbContext.DeviceComponents.Add(dc);
dbContext.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentUpdateJobSubTypes(int id, List<string> JobSubTypes)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
dc.JobSubTypes.Clear();
if (JobSubTypes != null)
{
var jsts = dbContext.JobSubTypes.Where(jst => JobSubTypes.Contains(jst.JobTypeId + "_" + jst.Id));
foreach (var jst in jsts)
{
dc.JobSubTypes.Add(jst);
}
}
dbContext.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentUpdate(int id, string Description, string Cost)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
decimal cost = 0;
if (string.IsNullOrEmpty(Description))
Description = "?";
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
decimal.TryParse(Cost, out cost);
dc.Description = Description;
dc.Cost = cost;
dbContext.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ComponentRemove(int id)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(c => c.Id == id).FirstOrDefault();
if (dc != null)
{
dc.JobSubTypes.Clear();
dbContext.DeviceComponents.Remove(dc);
dbContext.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
}
return Json("Invalid Device Component Id", JsonRequestBehavior.AllowGet);
}
#endregion
#region Index
public virtual ActionResult Index()
{
var deviceModels = dbContext.DeviceModels.ToArray().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToArray();
return Json(deviceModels, JsonRequestBehavior.AllowGet);
}
#endregion
}
}
@@ -1,393 +1,393 @@
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.Data.Configuration.Modules;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceProfileController : dbAdminController
{
const string pDescription = "description";
const string pName = "name";
const string pShortName = "shortname";
const string pDistributionType = "distributiontype";
const string pCertificateProviderId = "certificateproviderid";
const string pOrganisationalUnit = "organisationalunit";
const string pDefaultOrganisationAddress = "defaultorganisationaddress";
const string pComputerNameTemplate = "computernametemplate";
const string pEnforceComputerNameConvention = "enforcecomputernameconvention";
const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
const string pProvisionADAccount = "provisionadaccount";
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceProfile = dbContext.DeviceProfiles.Find(id);
if (deviceProfile != null)
{
switch (key.ToLower())
{
case pDescription:
UpdateDescription(deviceProfile, value);
break;
case pName:
UpdateName(deviceProfile, value);
break;
case pShortName:
UpdateShortName(deviceProfile, value);
break;
case pDistributionType:
UpdateDistributionType(deviceProfile, value);
break;
case pCertificateProviderId:
UpdateCertificateProviderId(deviceProfile, value);
break;
case pOrganisationalUnit:
UpdateOrganisationalUnit(deviceProfile, value);
break;
case pDefaultOrganisationAddress:
UpdateDefaultOrganisationAddress(deviceProfile, value);
break;
case pComputerNameTemplate:
UpdateComputerNameTemplate(deviceProfile, value);
break;
case pEnforceComputerNameConvention:
UpdateEnforceComputerNameConvention(deviceProfile, value);
break;
case pEnforceOrganisationalUnit:
UpdateEnforceOrganisationalUnit(deviceProfile, value);
break;
case pProvisionADAccount:
UpdateProvisionADAccount(deviceProfile, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Device Profile Number");
}
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceModel.Index(deviceProfile.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null)
{
return Update(id, pDescription, Description, redirect);
}
public virtual ActionResult UpdateName(int id, string ProfileName = null, Nullable<bool> redirect = null)
{
return Update(id, pName, ProfileName, redirect);
}
public virtual ActionResult UpdateShortName(int id, string ShortName = null, Nullable<bool> redirect = null)
{
return Update(id, pShortName, ShortName, redirect);
}
public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, Nullable<bool> redirect = null)
{
return Update(id, pDistributionType, DistributionType, redirect);
}
public virtual ActionResult UpdateCertificateProviderId(int id, string CertificateProviderId = null, Nullable<bool> redirect = null)
{
return Update(id, pCertificateProviderId, CertificateProviderId, redirect);
}
public virtual ActionResult UpdateOrganisationalUnit(int id, string OrganisationalUnit = null, Nullable<bool> redirect = null)
{
return Update(id, pOrganisationalUnit, OrganisationalUnit, redirect);
}
public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, Nullable<bool> redirect = null)
{
return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect);
}
public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, Nullable<bool> redirect = null)
{
return Update(id, pComputerNameTemplate, ComputerNameTemplate, redirect);
}
// Added 2012-06-14 G#
public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, Nullable<bool> redirect = null)
{
return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect);
}
// Added 2012-06-14 G#
public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, Nullable<bool> redirect = null)
{
return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect);
}
// Added 2012-06-28 G#
public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, Nullable<bool> redirect = null)
{
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
}
#endregion
#region Update Properties
private void UpdateDescription(Disco.Models.Repository.DeviceProfile deviceProfile, string Description)
{
if (string.IsNullOrWhiteSpace(Description))
deviceProfile.Description = null;
else
deviceProfile.Description = Description;
dbContext.SaveChanges();
}
private void UpdateName(Disco.Models.Repository.DeviceProfile deviceProfile, string Name)
{
if (string.IsNullOrWhiteSpace(Name))
throw new Exception("Profile name cannot be empty");
else
deviceProfile.Name = Name;
dbContext.SaveChanges();
}
private void UpdateShortName(Disco.Models.Repository.DeviceProfile deviceProfile, string ShortName)
{
if (string.IsNullOrWhiteSpace(ShortName))
throw new Exception("Profile short name cannot be empty");
else
deviceProfile.ShortName = ShortName;
dbContext.SaveChanges();
}
private void UpdateDistributionType(Disco.Models.Repository.DeviceProfile deviceProfile, string DistributionType)
{
int iDt;
if (int.TryParse(DistributionType, out iDt))
{
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).DistributionType = (DeviceProfileConfiguration.DeviceProfileDistributionTypes)iDt;
deviceProfile.DistributionType = (Disco.Models.Repository.DeviceProfile.DistributionTypes)iDt;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Distribution Type Number");
}
private void UpdateCertificateProviderId(Disco.Models.Repository.DeviceProfile deviceProfile, string CertificateProviderId)
{
if (string.IsNullOrWhiteSpace(CertificateProviderId))
{
deviceProfile.CertificateProviderId = null;
}
else
{
// Validate
var featureManifest = Disco.Services.Plugins.Plugins.GetPluginFeature(CertificateProviderId, typeof(Disco.Services.Plugins.Features.CertificateProvider.CertificateProviderFeature));
if (featureManifest == null)
throw new Exception(string.Format("Invalid Certificate Provider Plugin Id: [{0}]", CertificateProviderId));
else
deviceProfile.CertificateProviderId = featureManifest.Id;
}
dbContext.SaveChanges();
}
private void UpdateOrganisationalUnit(Disco.Models.Repository.DeviceProfile deviceProfile, string OrganisationalUnit)
{
if (string.IsNullOrWhiteSpace(OrganisationalUnit))
OrganisationalUnit = null;
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).OrganisationalUnit = OrganisationalUnit;
deviceProfile.OrganisationalUnit = OrganisationalUnit;
dbContext.SaveChanges();
}
private void UpdateComputerNameTemplate(Disco.Models.Repository.DeviceProfile deviceProfile, string ComputerNameTemplate)
{
if (string.IsNullOrWhiteSpace(ComputerNameTemplate))
throw new Exception("ComputerNameTemplate is Required");
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).ComputerNameTemplate = ComputerNameTemplate;
deviceProfile.ComputerNameTemplate = ComputerNameTemplate;
dbContext.SaveChanges();
}
private void UpdateDefaultOrganisationAddress(Disco.Models.Repository.DeviceProfile deviceProfile, string DefaultOrganisationAddress)
{
if (string.IsNullOrEmpty(DefaultOrganisationAddress))
{
deviceProfile.DefaultOrganisationAddress = null;
}
else
{
// Validate
int daoId;
if (int.TryParse(DefaultOrganisationAddress, out daoId))
{
var oa = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId);
if (oa != null)
{
deviceProfile.DefaultOrganisationAddress = oa.Id;
}
else
{
throw new Exception("Invalid Default Organisation Address Id (No such Id)");
}
}
else
{
throw new Exception("Invalid Default Organisation Address Id (Not Integer)");
}
}
dbContext.SaveChanges();
}
// Added 2012-06-14 G#
private void UpdateEnforceComputerNameConvention(Disco.Models.Repository.DeviceProfile deviceProfile, string EnforceComputerNameConvention)
{
bool bValue;
if (bool.TryParse(EnforceComputerNameConvention, out bValue))
{
deviceProfile.EnforceComputerNameConvention = bValue;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
// Added 2012-06-14 G#
private void UpdateEnforceOrganisationalUnit(Disco.Models.Repository.DeviceProfile deviceProfile, string EnforceOrganisationalUnit)
{
bool bValue;
if (bool.TryParse(EnforceOrganisationalUnit, out bValue))
{
deviceProfile.EnforceOrganisationalUnit = bValue;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
// Added 2012-06-28 G#
private void UpdateProvisionADAccount(Disco.Models.Repository.DeviceProfile deviceProfile, string ProvisionADAccount)
{
bool bValue;
if (bool.TryParse(ProvisionADAccount, out bValue))
{
deviceProfile.ProvisionADAccount = bValue;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
#endregion
public virtual ActionResult OrganisationalUnits()
{
var OUs = BI.Interop.ActiveDirectory.ActiveDirectory.GetOrganisationalUnitStructure();
return Json(OUs, JsonRequestBehavior.AllowGet);
}
#region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var dp = dbContext.DeviceProfiles.Find(id);
if (dp != null)
{
dp.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Profile Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Defaults
public virtual ActionResult Default(int id, Nullable<bool> redirect = null)
{
try
{
var dp = dbContext.DeviceProfiles.Find(id);
if (dp != null)
{
dbContext.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId = dp.Id;
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Profile Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
public virtual ActionResult DefaultAddDeviceOffline(int id, Nullable<bool> redirect = false)
{
try
{
int defaultValue = 0;
if (id > 0)
{
var dp = dbContext.DeviceProfiles.Find(id);
if (dp != null)
{
defaultValue = dp.Id;
}
else
{
throw new Exception("Invalid Device Profile Number");
}
}
dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId = defaultValue;
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
}
}
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.Data.Configuration.Modules;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceProfileController : dbAdminController
{
const string pDescription = "description";
const string pName = "name";
const string pShortName = "shortname";
const string pDistributionType = "distributiontype";
const string pCertificateProviderId = "certificateproviderid";
const string pOrganisationalUnit = "organisationalunit";
const string pDefaultOrganisationAddress = "defaultorganisationaddress";
const string pComputerNameTemplate = "computernametemplate";
const string pEnforceComputerNameConvention = "enforcecomputernameconvention";
const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
const string pProvisionADAccount = "provisionadaccount";
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceProfile = dbContext.DeviceProfiles.Find(id);
if (deviceProfile != null)
{
switch (key.ToLower())
{
case pDescription:
UpdateDescription(deviceProfile, value);
break;
case pName:
UpdateName(deviceProfile, value);
break;
case pShortName:
UpdateShortName(deviceProfile, value);
break;
case pDistributionType:
UpdateDistributionType(deviceProfile, value);
break;
case pCertificateProviderId:
UpdateCertificateProviderId(deviceProfile, value);
break;
case pOrganisationalUnit:
UpdateOrganisationalUnit(deviceProfile, value);
break;
case pDefaultOrganisationAddress:
UpdateDefaultOrganisationAddress(deviceProfile, value);
break;
case pComputerNameTemplate:
UpdateComputerNameTemplate(deviceProfile, value);
break;
case pEnforceComputerNameConvention:
UpdateEnforceComputerNameConvention(deviceProfile, value);
break;
case pEnforceOrganisationalUnit:
UpdateEnforceOrganisationalUnit(deviceProfile, value);
break;
case pProvisionADAccount:
UpdateProvisionADAccount(deviceProfile, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Device Profile Number");
}
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceModel.Index(deviceProfile.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null)
{
return Update(id, pDescription, Description, redirect);
}
public virtual ActionResult UpdateName(int id, string ProfileName = null, Nullable<bool> redirect = null)
{
return Update(id, pName, ProfileName, redirect);
}
public virtual ActionResult UpdateShortName(int id, string ShortName = null, Nullable<bool> redirect = null)
{
return Update(id, pShortName, ShortName, redirect);
}
public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, Nullable<bool> redirect = null)
{
return Update(id, pDistributionType, DistributionType, redirect);
}
public virtual ActionResult UpdateCertificateProviderId(int id, string CertificateProviderId = null, Nullable<bool> redirect = null)
{
return Update(id, pCertificateProviderId, CertificateProviderId, redirect);
}
public virtual ActionResult UpdateOrganisationalUnit(int id, string OrganisationalUnit = null, Nullable<bool> redirect = null)
{
return Update(id, pOrganisationalUnit, OrganisationalUnit, redirect);
}
public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, Nullable<bool> redirect = null)
{
return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect);
}
public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, Nullable<bool> redirect = null)
{
return Update(id, pComputerNameTemplate, ComputerNameTemplate, redirect);
}
// Added 2012-06-14 G#
public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, Nullable<bool> redirect = null)
{
return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect);
}
// Added 2012-06-14 G#
public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, Nullable<bool> redirect = null)
{
return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect);
}
// Added 2012-06-28 G#
public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, Nullable<bool> redirect = null)
{
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
}
#endregion
#region Update Properties
private void UpdateDescription(Disco.Models.Repository.DeviceProfile deviceProfile, string Description)
{
if (string.IsNullOrWhiteSpace(Description))
deviceProfile.Description = null;
else
deviceProfile.Description = Description;
dbContext.SaveChanges();
}
private void UpdateName(Disco.Models.Repository.DeviceProfile deviceProfile, string Name)
{
if (string.IsNullOrWhiteSpace(Name))
throw new Exception("Profile name cannot be empty");
else
deviceProfile.Name = Name;
dbContext.SaveChanges();
}
private void UpdateShortName(Disco.Models.Repository.DeviceProfile deviceProfile, string ShortName)
{
if (string.IsNullOrWhiteSpace(ShortName))
throw new Exception("Profile short name cannot be empty");
else
deviceProfile.ShortName = ShortName;
dbContext.SaveChanges();
}
private void UpdateDistributionType(Disco.Models.Repository.DeviceProfile deviceProfile, string DistributionType)
{
int iDt;
if (int.TryParse(DistributionType, out iDt))
{
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).DistributionType = (DeviceProfileConfiguration.DeviceProfileDistributionTypes)iDt;
deviceProfile.DistributionType = (Disco.Models.Repository.DeviceProfile.DistributionTypes)iDt;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Distribution Type Number");
}
private void UpdateCertificateProviderId(Disco.Models.Repository.DeviceProfile deviceProfile, string CertificateProviderId)
{
if (string.IsNullOrWhiteSpace(CertificateProviderId))
{
deviceProfile.CertificateProviderId = null;
}
else
{
// Validate
var featureManifest = Disco.Services.Plugins.Plugins.GetPluginFeature(CertificateProviderId, typeof(Disco.Services.Plugins.Features.CertificateProvider.CertificateProviderFeature));
if (featureManifest == null)
throw new Exception(string.Format("Invalid Certificate Provider Plugin Id: [{0}]", CertificateProviderId));
else
deviceProfile.CertificateProviderId = featureManifest.Id;
}
dbContext.SaveChanges();
}
private void UpdateOrganisationalUnit(Disco.Models.Repository.DeviceProfile deviceProfile, string OrganisationalUnit)
{
if (string.IsNullOrWhiteSpace(OrganisationalUnit))
OrganisationalUnit = null;
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).OrganisationalUnit = OrganisationalUnit;
deviceProfile.OrganisationalUnit = OrganisationalUnit;
dbContext.SaveChanges();
}
private void UpdateComputerNameTemplate(Disco.Models.Repository.DeviceProfile deviceProfile, string ComputerNameTemplate)
{
if (string.IsNullOrWhiteSpace(ComputerNameTemplate))
throw new Exception("ComputerNameTemplate is Required");
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).ComputerNameTemplate = ComputerNameTemplate;
deviceProfile.ComputerNameTemplate = ComputerNameTemplate;
dbContext.SaveChanges();
}
private void UpdateDefaultOrganisationAddress(Disco.Models.Repository.DeviceProfile deviceProfile, string DefaultOrganisationAddress)
{
if (string.IsNullOrEmpty(DefaultOrganisationAddress))
{
deviceProfile.DefaultOrganisationAddress = null;
}
else
{
// Validate
int daoId;
if (int.TryParse(DefaultOrganisationAddress, out daoId))
{
var oa = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId);
if (oa != null)
{
deviceProfile.DefaultOrganisationAddress = oa.Id;
}
else
{
throw new Exception("Invalid Default Organisation Address Id (No such Id)");
}
}
else
{
throw new Exception("Invalid Default Organisation Address Id (Not Integer)");
}
}
dbContext.SaveChanges();
}
// Added 2012-06-14 G#
private void UpdateEnforceComputerNameConvention(Disco.Models.Repository.DeviceProfile deviceProfile, string EnforceComputerNameConvention)
{
bool bValue;
if (bool.TryParse(EnforceComputerNameConvention, out bValue))
{
deviceProfile.EnforceComputerNameConvention = bValue;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
// Added 2012-06-14 G#
private void UpdateEnforceOrganisationalUnit(Disco.Models.Repository.DeviceProfile deviceProfile, string EnforceOrganisationalUnit)
{
bool bValue;
if (bool.TryParse(EnforceOrganisationalUnit, out bValue))
{
deviceProfile.EnforceOrganisationalUnit = bValue;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
// Added 2012-06-28 G#
private void UpdateProvisionADAccount(Disco.Models.Repository.DeviceProfile deviceProfile, string ProvisionADAccount)
{
bool bValue;
if (bool.TryParse(ProvisionADAccount, out bValue))
{
deviceProfile.ProvisionADAccount = bValue;
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
#endregion
public virtual ActionResult OrganisationalUnits()
{
var OUs = BI.Interop.ActiveDirectory.ActiveDirectory.GetOrganisationalUnitStructure();
return Json(OUs, JsonRequestBehavior.AllowGet);
}
#region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var dp = dbContext.DeviceProfiles.Find(id);
if (dp != null)
{
dp.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Profile Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Defaults
public virtual ActionResult Default(int id, Nullable<bool> redirect = null)
{
try
{
var dp = dbContext.DeviceProfiles.Find(id);
if (dp != null)
{
dbContext.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId = dp.Id;
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Device Profile Number");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
public virtual ActionResult DefaultAddDeviceOffline(int id, Nullable<bool> redirect = false)
{
try
{
int defaultValue = 0;
if (id > 0)
{
var dp = dbContext.DeviceProfiles.Find(id);
if (dp != null)
{
defaultValue = dp.Id;
}
else
{
throw new Exception("Invalid Device Profile Number");
}
}
dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId = defaultValue;
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
}
}
@@ -1,469 +1,469 @@
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.Models.Repository;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DocumentTemplateController : dbAdminController
{
const string pDescription = "description";
const string pScope = "scope";
const string pFilterExpression = "filterexpression";
const string pFlattenForm = "flattenform";
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate != null)
{
switch (key.ToLower())
{
case pDescription:
UpdateDescription(documentTemplate, value);
break;
case pScope:
UpdateScope(documentTemplate, value);
break;
case pFilterExpression:
UpdateFilterExpression(documentTemplate, value);
break;
case pFlattenForm:
UpdateFlattenForm(documentTemplate, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Document Template Id");
}
if (redirect)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
[HttpGet]
public virtual ActionResult Template(string id)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
var filename = documentTemplate.RepositoryFilename(dbContext);
if (System.IO.File.Exists(filename))
{
return File(filename, DocumentTemplate.PdfMimeType, string.Format("{0}.pdf", documentTemplate.Id));
}
else
{
throw new InvalidOperationException("Template not found");
}
}
[HttpPost]
public virtual ActionResult Template(string id, bool redirect, HttpPostedFileBase Template)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
documentTemplate.SavePdfTemplate(dbContext, Template.InputStream);
if (redirect)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false)
{
return Update(id, pDescription, Description, redirect);
}
public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false)
{
return Update(id, pFilterExpression, FilterExpression, redirect);
}
public virtual ActionResult UpdateFlattenForm(string id, string FlattenForm = null, bool redirect = false)
{
return Update(id, pFlattenForm, FlattenForm, redirect);
}
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
{
return Update(id, pScope, Scope, redirect);
}
public virtual ActionResult UpdateSubTypes(string id, List<string> SubTypes = null)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
UpdateSubTypes(documentTemplate, SubTypes);
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Update Properties
private void UpdateDescription(Disco.Models.Repository.DocumentTemplate documentTemplate, string Description)
{
if (!string.IsNullOrWhiteSpace(Description))
{
documentTemplate.Description = Description.Trim();
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Description");
}
private void UpdateScope(Disco.Models.Repository.DocumentTemplate documentTemplate, string Scope)
{
if (!string.IsNullOrWhiteSpace(Scope))
{
if (Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList().Contains(Scope))
{
dbContext.Configuration.LazyLoadingEnabled = true;
documentTemplate.Scope = Scope;
if (documentTemplate.Scope != Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job &&
documentTemplate.JobSubTypes != null)
{
foreach (var st in documentTemplate.JobSubTypes.ToArray())
documentTemplate.JobSubTypes.Remove(st);
}
dbContext.SaveChanges();
return;
}
}
throw new Exception("Invalid Scope");
}
private void UpdateFilterExpression(Disco.Models.Repository.DocumentTemplate documentTemplate, string FilterExpression)
{
if (string.IsNullOrWhiteSpace(FilterExpression))
{
documentTemplate.FilterExpression = null;
}
else
{
documentTemplate.FilterExpression = FilterExpression.Trim();
}
// Invalidate Cache
documentTemplate.FilterExpressionInvalidateCache();
dbContext.SaveChanges();
}
private void UpdateFlattenForm(Disco.Models.Repository.DocumentTemplate documentTemplate, string FlattenForm)
{
if (string.IsNullOrWhiteSpace(FlattenForm))
{
documentTemplate.FlattenForm = false;
}
else
{
bool ff = default(bool);
if (bool.TryParse(FlattenForm, out ff))
documentTemplate.FlattenForm = ff;
else
throw new Exception("Invalid Boolean Format");
}
dbContext.SaveChanges();
}
private void UpdateSubTypes(Disco.Models.Repository.DocumentTemplate documentTemplate, List<string> SubTypes)
{
dbContext.Configuration.LazyLoadingEnabled = true;
// Remove All Existing
if (documentTemplate.JobSubTypes != null)
{
foreach (var st in documentTemplate.JobSubTypes.ToArray())
documentTemplate.JobSubTypes.Remove(st);
}
// Add New
if (SubTypes != null && SubTypes.Count > 0)
{
var subTypes = new List<Disco.Models.Repository.JobSubType>();
foreach (var stId in SubTypes)
{
var typeId = stId.Substring(0, stId.IndexOf("_"));
var subTypeId = stId.Substring(stId.IndexOf("_") + 1);
var subType = dbContext.JobSubTypes.FirstOrDefault(jst => jst.JobTypeId == typeId && jst.Id == subTypeId);
subTypes.Add(subType);
}
documentTemplate.JobSubTypes = subTypes;
}
dbContext.SaveChanges();
}
#endregion
#region Actions
[OutputCache(NoStore = true, Duration = 0)]
public virtual ActionResult ImporterThumbnail(string SessionId, int PageNumber)
{
// Load from Cache
//var cacheKey = string.Format("Disco.BI.DocumentImporter-{0}-{1}", SessionId, PageNumber);
//var cacheValue = HttpContext.Cache.Get(cacheKey);
//if (cacheValue != null)
//{
// var cacheFile = cacheValue as byte[];
// if (cacheFile != null)
// {
// return File(cacheFile, "image/png");
// }
//}
var dataStoreSessionPagesCacheLocation = DataStore.CreateLocation(dbContext, "Cache\\DocumentDropBox_SessionPages");
var filename = System.IO.Path.Combine(dataStoreSessionPagesCacheLocation, string.Format("{0}-{1}", SessionId, PageNumber));
if (System.IO.File.Exists(filename))
return File(filename, "image/png");
else
return File("~/Content/Images/Status/fileBroken256.png", "image/png");
}
public virtual ActionResult ImporterUndetectedFiles()
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var undetectedDirectory = new System.IO.DirectoryInfo(undetectedLocation);
var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new Models.DocumentTemplate.ImporterUndetectedFilesModel()
{
Id = System.IO.Path.GetFileNameWithoutExtension(f.Name),
Timestamp = f.CreationTime.ToString(),
TimestampFuzzy = f.CreationTime.ToFuzzy()
}).ToArray();
return Json(m);
}
public virtual ActionResult ImporterUndetectedDataIdLookup(string id, string term, int limitCount = 20)
{
if (!string.IsNullOrEmpty(id) && !string.IsNullOrWhiteSpace(term))
{
string searchScope;
if (id.StartsWith("--"))
{
switch (id.ToUpper())
{
case "--DEVICE":
searchScope = DocumentTemplate.DocumentTemplateScopes.Device;
break;
case "--JOB":
searchScope = DocumentTemplate.DocumentTemplateScopes.Job;
break;
case "--USER":
searchScope = DocumentTemplate.DocumentTemplateScopes.User;
break;
default:
searchScope = null;
break;
}
}
else
{
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate != null)
searchScope = documentTemplate.Scope;
else
searchScope = null;
}
if (searchScope != null)
{
Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel[] results;
switch (searchScope)
{
case DocumentTemplate.DocumentTemplateScopes.Device:
results = BI.DeviceBI.Searching.Search(dbContext, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
case DocumentTemplate.DocumentTemplateScopes.Job:
results = BI.JobBI.Searching.Search(dbContext, term, limitCount, false).Items.Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
case DocumentTemplate.DocumentTemplateScopes.User:
results = BI.UserBI.Searching.Search(dbContext, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
default:
results = null;
break;
}
if (results != null)
return Json(results, JsonRequestBehavior.AllowGet);
}
}
return Json(null, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ImporterUndetectedFile(string id, Nullable<bool> Source, Nullable<bool> Thumbnail)
{
if (!string.IsNullOrEmpty(id))
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
if (Source.HasValue && Source.Value)
{
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (System.IO.File.Exists(filename))
return File(filename, DocumentTemplate.PdfMimeType);
else
return HttpNotFound();
}
else
{
if (Thumbnail.HasValue && Thumbnail.Value)
{
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png"));
if (System.IO.File.Exists(filename))
return File(filename, "image/png");
else
return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png");
}
else
{
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg"));
if (System.IO.File.Exists(filename))
return File(filename, "image/jpeg");
else
return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png");
}
}
}
return HttpNotFound();
}
public virtual ActionResult ImporterUndetectedAssign(string id, string DocumentTemplateId, string DataId)
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (BI.Interop.Pdf.PdfImporter.ProcessPdfAttachment(filename, dbContext, DocumentTemplateId, DataId, DiscoApplication.CurrentUser.Id, DateTime.Now))
{
// Delete File
System.IO.File.Delete(filename);
// Delete Thumbnail/Preview
var thumbnailFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png"));
if (System.IO.File.Exists(thumbnailFilename))
System.IO.File.Delete(thumbnailFilename);
var previewFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg"));
if (System.IO.File.Exists(previewFilename))
System.IO.File.Delete(previewFilename);
return Json("OK");
}
else
{
return Json("Unable to Import File with the supplied parameters");
}
}
public virtual ActionResult ImporterUndetectedDelete(string id)
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (System.IO.File.Exists(filename))
{
// Delete File
System.IO.File.Delete(filename);
// Delete Thumbnail/Preview
var thumbnailFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png"));
if (System.IO.File.Exists(thumbnailFilename))
System.IO.File.Delete(thumbnailFilename);
var previewFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg"));
if (System.IO.File.Exists(previewFilename))
System.IO.File.Delete(previewFilename);
return Json("OK");
}
else
{
return Json("File Not Found");
}
}
public virtual ActionResult BulkGenerate(string id, string DataIds = null)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DataIds))
throw new ArgumentNullException("DataIds");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
var dataIds = DataIds.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
var timeStamp = DateTime.Now;
var pdf = documentTemplate.GeneratePdfBulk(dbContext, DiscoApplication.CurrentUser, timeStamp, dataIds);
return File(pdf, "application/pdf", string.Format("{0}_Bulk_{1:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, timeStamp));
}
public virtual ActionResult Delete(string id, Nullable<bool> redirect = false)
{
try
{
var at = dbContext.DocumentTemplates.Include("JobSubTypes").FirstOrDefault(a => a.Id == id);
if (at != null)
{
at.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Document Template Id");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
}
}
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.Models.Repository;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DocumentTemplateController : dbAdminController
{
const string pDescription = "description";
const string pScope = "scope";
const string pFilterExpression = "filterexpression";
const string pFlattenForm = "flattenform";
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate != null)
{
switch (key.ToLower())
{
case pDescription:
UpdateDescription(documentTemplate, value);
break;
case pScope:
UpdateScope(documentTemplate, value);
break;
case pFilterExpression:
UpdateFilterExpression(documentTemplate, value);
break;
case pFlattenForm:
UpdateFlattenForm(documentTemplate, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Document Template Id");
}
if (redirect)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
[HttpGet]
public virtual ActionResult Template(string id)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
var filename = documentTemplate.RepositoryFilename(dbContext);
if (System.IO.File.Exists(filename))
{
return File(filename, DocumentTemplate.PdfMimeType, string.Format("{0}.pdf", documentTemplate.Id));
}
else
{
throw new InvalidOperationException("Template not found");
}
}
[HttpPost]
public virtual ActionResult Template(string id, bool redirect, HttpPostedFileBase Template)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
documentTemplate.SavePdfTemplate(dbContext, Template.InputStream);
if (redirect)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false)
{
return Update(id, pDescription, Description, redirect);
}
public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false)
{
return Update(id, pFilterExpression, FilterExpression, redirect);
}
public virtual ActionResult UpdateFlattenForm(string id, string FlattenForm = null, bool redirect = false)
{
return Update(id, pFlattenForm, FlattenForm, redirect);
}
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
{
return Update(id, pScope, Scope, redirect);
}
public virtual ActionResult UpdateSubTypes(string id, List<string> SubTypes = null)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
UpdateSubTypes(documentTemplate, SubTypes);
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Update Properties
private void UpdateDescription(Disco.Models.Repository.DocumentTemplate documentTemplate, string Description)
{
if (!string.IsNullOrWhiteSpace(Description))
{
documentTemplate.Description = Description.Trim();
dbContext.SaveChanges();
return;
}
throw new Exception("Invalid Description");
}
private void UpdateScope(Disco.Models.Repository.DocumentTemplate documentTemplate, string Scope)
{
if (!string.IsNullOrWhiteSpace(Scope))
{
if (Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList().Contains(Scope))
{
dbContext.Configuration.LazyLoadingEnabled = true;
documentTemplate.Scope = Scope;
if (documentTemplate.Scope != Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job &&
documentTemplate.JobSubTypes != null)
{
foreach (var st in documentTemplate.JobSubTypes.ToArray())
documentTemplate.JobSubTypes.Remove(st);
}
dbContext.SaveChanges();
return;
}
}
throw new Exception("Invalid Scope");
}
private void UpdateFilterExpression(Disco.Models.Repository.DocumentTemplate documentTemplate, string FilterExpression)
{
if (string.IsNullOrWhiteSpace(FilterExpression))
{
documentTemplate.FilterExpression = null;
}
else
{
documentTemplate.FilterExpression = FilterExpression.Trim();
}
// Invalidate Cache
documentTemplate.FilterExpressionInvalidateCache();
dbContext.SaveChanges();
}
private void UpdateFlattenForm(Disco.Models.Repository.DocumentTemplate documentTemplate, string FlattenForm)
{
if (string.IsNullOrWhiteSpace(FlattenForm))
{
documentTemplate.FlattenForm = false;
}
else
{
bool ff = default(bool);
if (bool.TryParse(FlattenForm, out ff))
documentTemplate.FlattenForm = ff;
else
throw new Exception("Invalid Boolean Format");
}
dbContext.SaveChanges();
}
private void UpdateSubTypes(Disco.Models.Repository.DocumentTemplate documentTemplate, List<string> SubTypes)
{
dbContext.Configuration.LazyLoadingEnabled = true;
// Remove All Existing
if (documentTemplate.JobSubTypes != null)
{
foreach (var st in documentTemplate.JobSubTypes.ToArray())
documentTemplate.JobSubTypes.Remove(st);
}
// Add New
if (SubTypes != null && SubTypes.Count > 0)
{
var subTypes = new List<Disco.Models.Repository.JobSubType>();
foreach (var stId in SubTypes)
{
var typeId = stId.Substring(0, stId.IndexOf("_"));
var subTypeId = stId.Substring(stId.IndexOf("_") + 1);
var subType = dbContext.JobSubTypes.FirstOrDefault(jst => jst.JobTypeId == typeId && jst.Id == subTypeId);
subTypes.Add(subType);
}
documentTemplate.JobSubTypes = subTypes;
}
dbContext.SaveChanges();
}
#endregion
#region Actions
[OutputCache(NoStore = true, Duration = 0)]
public virtual ActionResult ImporterThumbnail(string SessionId, int PageNumber)
{
// Load from Cache
//var cacheKey = string.Format("Disco.BI.DocumentImporter-{0}-{1}", SessionId, PageNumber);
//var cacheValue = HttpContext.Cache.Get(cacheKey);
//if (cacheValue != null)
//{
// var cacheFile = cacheValue as byte[];
// if (cacheFile != null)
// {
// return File(cacheFile, "image/png");
// }
//}
var dataStoreSessionPagesCacheLocation = DataStore.CreateLocation(dbContext, "Cache\\DocumentDropBox_SessionPages");
var filename = System.IO.Path.Combine(dataStoreSessionPagesCacheLocation, string.Format("{0}-{1}", SessionId, PageNumber));
if (System.IO.File.Exists(filename))
return File(filename, "image/png");
else
return File("~/Content/Images/Status/fileBroken256.png", "image/png");
}
public virtual ActionResult ImporterUndetectedFiles()
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var undetectedDirectory = new System.IO.DirectoryInfo(undetectedLocation);
var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new Models.DocumentTemplate.ImporterUndetectedFilesModel()
{
Id = System.IO.Path.GetFileNameWithoutExtension(f.Name),
Timestamp = f.CreationTime.ToString(),
TimestampFuzzy = f.CreationTime.ToFuzzy()
}).ToArray();
return Json(m);
}
public virtual ActionResult ImporterUndetectedDataIdLookup(string id, string term, int limitCount = 20)
{
if (!string.IsNullOrEmpty(id) && !string.IsNullOrWhiteSpace(term))
{
string searchScope;
if (id.StartsWith("--"))
{
switch (id.ToUpper())
{
case "--DEVICE":
searchScope = DocumentTemplate.DocumentTemplateScopes.Device;
break;
case "--JOB":
searchScope = DocumentTemplate.DocumentTemplateScopes.Job;
break;
case "--USER":
searchScope = DocumentTemplate.DocumentTemplateScopes.User;
break;
default:
searchScope = null;
break;
}
}
else
{
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate != null)
searchScope = documentTemplate.Scope;
else
searchScope = null;
}
if (searchScope != null)
{
Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel[] results;
switch (searchScope)
{
case DocumentTemplate.DocumentTemplateScopes.Device:
results = BI.DeviceBI.Searching.Search(dbContext, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
case DocumentTemplate.DocumentTemplateScopes.Job:
results = BI.JobBI.Searching.Search(dbContext, term, limitCount, false).Items.Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
case DocumentTemplate.DocumentTemplateScopes.User:
results = BI.UserBI.Searching.Search(dbContext, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
default:
results = null;
break;
}
if (results != null)
return Json(results, JsonRequestBehavior.AllowGet);
}
}
return Json(null, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult ImporterUndetectedFile(string id, Nullable<bool> Source, Nullable<bool> Thumbnail)
{
if (!string.IsNullOrEmpty(id))
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
if (Source.HasValue && Source.Value)
{
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (System.IO.File.Exists(filename))
return File(filename, DocumentTemplate.PdfMimeType);
else
return HttpNotFound();
}
else
{
if (Thumbnail.HasValue && Thumbnail.Value)
{
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png"));
if (System.IO.File.Exists(filename))
return File(filename, "image/png");
else
return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png");
}
else
{
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg"));
if (System.IO.File.Exists(filename))
return File(filename, "image/jpeg");
else
return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png");
}
}
}
return HttpNotFound();
}
public virtual ActionResult ImporterUndetectedAssign(string id, string DocumentTemplateId, string DataId)
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (BI.Interop.Pdf.PdfImporter.ProcessPdfAttachment(filename, dbContext, DocumentTemplateId, DataId, DiscoApplication.CurrentUser.Id, DateTime.Now))
{
// Delete File
System.IO.File.Delete(filename);
// Delete Thumbnail/Preview
var thumbnailFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png"));
if (System.IO.File.Exists(thumbnailFilename))
System.IO.File.Delete(thumbnailFilename);
var previewFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg"));
if (System.IO.File.Exists(previewFilename))
System.IO.File.Delete(previewFilename);
return Json("OK");
}
else
{
return Json("Unable to Import File with the supplied parameters");
}
}
public virtual ActionResult ImporterUndetectedDelete(string id)
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (System.IO.File.Exists(filename))
{
// Delete File
System.IO.File.Delete(filename);
// Delete Thumbnail/Preview
var thumbnailFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png"));
if (System.IO.File.Exists(thumbnailFilename))
System.IO.File.Delete(thumbnailFilename);
var previewFilename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".jpg"));
if (System.IO.File.Exists(previewFilename))
System.IO.File.Delete(previewFilename);
return Json("OK");
}
else
{
return Json("File Not Found");
}
}
public virtual ActionResult BulkGenerate(string id, string DataIds = null)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DataIds))
throw new ArgumentNullException("DataIds");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
var dataIds = DataIds.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
var timeStamp = DateTime.Now;
var pdf = documentTemplate.GeneratePdfBulk(dbContext, DiscoApplication.CurrentUser, timeStamp, dataIds);
return File(pdf, "application/pdf", string.Format("{0}_Bulk_{1:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, timeStamp));
}
public virtual ActionResult Delete(string id, Nullable<bool> redirect = false)
{
try
{
var at = dbContext.DocumentTemplates.Include("JobSubTypes").FirstOrDefault(a => a.Id == id);
if (at != null)
{
at.Delete(dbContext);
dbContext.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Document Template Id");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
}
}
@@ -1,17 +1,17 @@
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 ExpressionsController : dbAdminController
{
public virtual ActionResult ValidateExpression(string Expression)
{
var part = new BI.Expressions.EvaluateExpressionPart(Expression);
return Json(Models.Expressions.ValidateExpressionModel.FromEvaluateExpressionPart(part), JsonRequestBehavior.AllowGet);
}
}
}
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 ExpressionsController : dbAdminController
{
public virtual ActionResult ValidateExpression(string Expression)
{
var part = new BI.Expressions.EvaluateExpressionPart(Expression);
return Json(Models.Expressions.ValidateExpressionModel.FromEvaluateExpressionPart(part), JsonRequestBehavior.AllowGet);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,62 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
using Disco.Services.Logging;
using Disco.Services.Tasks;
namespace Disco.Web.Areas.API.Controllers
{
public partial class LoggingController : dbAdminController
{
public virtual ActionResult Modules()
{
var m = LogContext.LogModules.Values.Select(lm => Models.Logs.LogModuleModel.FromLogModule(lm)).ToList();
return Json(m, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult RetrieveEvents(string Format, DateTime? Start = null, DateTime? End = null, int? ModuleId = null, List<int> EventTypeIds = null, int? Take = null)
{
var logRetriever = new ReadLogContext()
{
Start = Start,
End = End,
Module = ModuleId,
EventTypes = EventTypeIds,
Take = Take
};
var results = logRetriever.Query(dbContext);
switch (Format.ToLower())
{
case "json":
{
return Json(results, JsonRequestBehavior.AllowGet);
}
case "csv":
{
return File(results.ToCsv(), "text/csv", "DiscoLogs.csv");
}
default:
{
throw new ArgumentException("Unknown Format", "Format");
}
}
}
public virtual ActionResult ScheduledTaskStatus(string id)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var status = ScheduledTasks.GetTaskStatus(id);
if (status == null)
throw new ArgumentException("Invalid ScheduledTask SessionId", "id");
return Json(ScheduledTaskStatusLive.FromScheduledTaskStatus(status, null), JsonRequestBehavior.AllowGet);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
using Disco.Services.Logging;
using Disco.Services.Tasks;
namespace Disco.Web.Areas.API.Controllers
{
public partial class LoggingController : dbAdminController
{
public virtual ActionResult Modules()
{
var m = LogContext.LogModules.Values.Select(lm => Models.Logs.LogModuleModel.FromLogModule(lm)).ToList();
return Json(m, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult RetrieveEvents(string Format, DateTime? Start = null, DateTime? End = null, int? ModuleId = null, List<int> EventTypeIds = null, int? Take = null)
{
var logRetriever = new ReadLogContext()
{
Start = Start,
End = End,
Module = ModuleId,
EventTypes = EventTypeIds,
Take = Take
};
var results = logRetriever.Query(dbContext);
switch (Format.ToLower())
{
case "json":
{
return Json(results, JsonRequestBehavior.AllowGet);
}
case "csv":
{
return File(results.ToCsv(), "text/csv", "DiscoLogs.csv");
}
default:
{
throw new ArgumentException("Unknown Format", "Format");
}
}
}
public virtual ActionResult ScheduledTaskStatus(string id)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var status = ScheduledTasks.GetTaskStatus(id);
if (status == null)
throw new ArgumentException("Invalid ScheduledTask SessionId", "id");
return Json(ScheduledTaskStatusLive.FromScheduledTaskStatus(status, null), JsonRequestBehavior.AllowGet);
}
}
}
+180 -180
View File
@@ -1,180 +1,180 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using System.IO;
namespace Disco.Web.Areas.API.Controllers
{
public partial class UserController : dbAdminController
{
public virtual ActionResult UpstreamUsers(string term)
{
return Json(BI.UserBI.Searching.SearchUpstream(term), JsonRequestBehavior.AllowGet);
}
#region User Attachements
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
{
var ua = dbContext.UserAttachments.Find(id);
if (ua != null)
{
var filePath = ua.RepositoryFilename(dbContext);
if (System.IO.File.Exists(filePath))
{
return File(filePath, ua.MimeType, ua.Filename);
}
else
{
return HttpNotFound("Attachment reference exists, but file not found");
}
}
return HttpNotFound("Invalid Attachment Number");
}
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
var ua = dbContext.UserAttachments.Find(id);
if (ua != null)
{
var thumbPath = ua.RepositoryThumbnailFilename(dbContext);
if (System.IO.File.Exists(thumbPath))
{
if (thumbPath.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
return File(thumbPath, "image/png");
else
return File(thumbPath, "image/jpg");
}
else
return File(ClientSource.Style.Images.AttachmentTypes.MimeTypeIcons.Icon(ua.MimeType), "image/png");
}
return HttpNotFound("Invalid Attachment Number");
}
public virtual ActionResult AttachmentUpload(string id, string Comments)
{
var u = dbContext.Users.Find(id);
if (u != null)
{
if (Request.Files.Count > 0)
{
var file = Request.Files.Get(0);
if (file.ContentLength > 0)
{
var contentType = file.ContentType;
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.InvariantCultureIgnoreCase))
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
var ua = new Disco.Models.Repository.UserAttachment()
{
UserId = u.Id,
TechUserId = DiscoApplication.CurrentUser.Id,
Filename = file.FileName,
MimeType = contentType,
Timestamp = DateTime.Now,
Comments = Comments
};
dbContext.UserAttachments.Add(ua);
dbContext.SaveChanges();
ua.SaveAttachment(dbContext, file.InputStream);
ua.GenerateThumbnail(dbContext);
return Json(ua.Id, JsonRequestBehavior.AllowGet);
}
}
throw new Exception("No Attachment Uploaded");
}
throw new Exception("Invalid User Id");
}
public virtual ActionResult Attachment(int id)
{
var ua = dbContext.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (ua != null)
{
var m = new Models.Attachment.AttachmentModel()
{
Attachment = Models.Attachment._AttachmentModel.FromAttachment(ua),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Attachments(string id)
{
var u = dbContext.Users.Include("UserAttachments.TechUser").Where(m => m.Id == id).FirstOrDefault();
if (u != null)
{
var m = new Models.Attachment.AttachmentsModel()
{
Attachments = u.UserAttachments.Select(ua => Models.Attachment._AttachmentModel.FromAttachment(ua)).ToList(),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid User Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult AttachmentRemove(int id)
{
var ua = dbContext.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (ua != null)
{
// 2012-02-17 G# Remove - 'Delete Own Comments' policy
//if (ua.TechUserId == DiscoApplication.CurrentUser.Id)
//{
ua.OnDelete(dbContext);
dbContext.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
//}
//else
//{
// return Json("You can only delete your own attachments.", JsonRequestBehavior.AllowGet);
//}
}
return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet);
}
#endregion
public virtual ActionResult GeneratePdf(string id, string DocumentTemplateId)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DocumentTemplateId))
throw new ArgumentNullException("AttachmentTypeId");
var user = dbContext.Users.Find(id);
if (user != null)
{
var documentTemplate = dbContext.DocumentTemplates.Find(DocumentTemplateId);
if (documentTemplate != null)
{
var timeStamp = DateTime.Now;
Stream pdf;
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState())
{
pdf = documentTemplate.GeneratePdf(dbContext, user, DiscoApplication.CurrentUser, timeStamp, generationState);
}
dbContext.SaveChanges();
return File(pdf, "application/pdf", string.Format("{0}_{1}_{2:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, user.Id, timeStamp));
}
else
{
throw new ArgumentException("Invalid Document Template Id", "id");
}
}
else
{
throw new ArgumentException("Invalid User Id", "id");
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using System.IO;
namespace Disco.Web.Areas.API.Controllers
{
public partial class UserController : dbAdminController
{
public virtual ActionResult UpstreamUsers(string term)
{
return Json(BI.UserBI.Searching.SearchUpstream(term), JsonRequestBehavior.AllowGet);
}
#region User Attachements
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
{
var ua = dbContext.UserAttachments.Find(id);
if (ua != null)
{
var filePath = ua.RepositoryFilename(dbContext);
if (System.IO.File.Exists(filePath))
{
return File(filePath, ua.MimeType, ua.Filename);
}
else
{
return HttpNotFound("Attachment reference exists, but file not found");
}
}
return HttpNotFound("Invalid Attachment Number");
}
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
var ua = dbContext.UserAttachments.Find(id);
if (ua != null)
{
var thumbPath = ua.RepositoryThumbnailFilename(dbContext);
if (System.IO.File.Exists(thumbPath))
{
if (thumbPath.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
return File(thumbPath, "image/png");
else
return File(thumbPath, "image/jpg");
}
else
return File(ClientSource.Style.Images.AttachmentTypes.MimeTypeIcons.Icon(ua.MimeType), "image/png");
}
return HttpNotFound("Invalid Attachment Number");
}
public virtual ActionResult AttachmentUpload(string id, string Comments)
{
var u = dbContext.Users.Find(id);
if (u != null)
{
if (Request.Files.Count > 0)
{
var file = Request.Files.Get(0);
if (file.ContentLength > 0)
{
var contentType = file.ContentType;
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.InvariantCultureIgnoreCase))
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
var ua = new Disco.Models.Repository.UserAttachment()
{
UserId = u.Id,
TechUserId = DiscoApplication.CurrentUser.Id,
Filename = file.FileName,
MimeType = contentType,
Timestamp = DateTime.Now,
Comments = Comments
};
dbContext.UserAttachments.Add(ua);
dbContext.SaveChanges();
ua.SaveAttachment(dbContext, file.InputStream);
ua.GenerateThumbnail(dbContext);
return Json(ua.Id, JsonRequestBehavior.AllowGet);
}
}
throw new Exception("No Attachment Uploaded");
}
throw new Exception("Invalid User Id");
}
public virtual ActionResult Attachment(int id)
{
var ua = dbContext.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (ua != null)
{
var m = new Models.Attachment.AttachmentModel()
{
Attachment = Models.Attachment._AttachmentModel.FromAttachment(ua),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Attachments(string id)
{
var u = dbContext.Users.Include("UserAttachments.TechUser").Where(m => m.Id == id).FirstOrDefault();
if (u != null)
{
var m = new Models.Attachment.AttachmentsModel()
{
Attachments = u.UserAttachments.Select(ua => Models.Attachment._AttachmentModel.FromAttachment(ua)).ToList(),
Result = "OK"
};
return Json(m, JsonRequestBehavior.AllowGet);
}
return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid User Id" }, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult AttachmentRemove(int id)
{
var ua = dbContext.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (ua != null)
{
// 2012-02-17 G# Remove - 'Delete Own Comments' policy
//if (ua.TechUserId == DiscoApplication.CurrentUser.Id)
//{
ua.OnDelete(dbContext);
dbContext.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
//}
//else
//{
// return Json("You can only delete your own attachments.", JsonRequestBehavior.AllowGet);
//}
}
return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet);
}
#endregion
public virtual ActionResult GeneratePdf(string id, string DocumentTemplateId)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DocumentTemplateId))
throw new ArgumentNullException("AttachmentTypeId");
var user = dbContext.Users.Find(id);
if (user != null)
{
var documentTemplate = dbContext.DocumentTemplates.Find(DocumentTemplateId);
if (documentTemplate != null)
{
var timeStamp = DateTime.Now;
Stream pdf;
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState())
{
pdf = documentTemplate.GeneratePdf(dbContext, user, DiscoApplication.CurrentUser, timeStamp, generationState);
}
dbContext.SaveChanges();
return File(pdf, "application/pdf", string.Format("{0}_{1}_{2:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, user.Id, timeStamp));
}
else
{
throw new ArgumentException("Invalid Document Template Id", "id");
}
}
else
{
throw new ArgumentException("Invalid User Id", "id");
}
}
}
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Attachment
{
public class AttachmentModel
{
public _AttachmentModel Attachment { get; set; }
public string Result { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Attachment
{
public class AttachmentModel
{
public _AttachmentModel Attachment { get; set; }
public string Result { get; set; }
}
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Attachment
{
public class AttachmentsModel
{
public List<_AttachmentModel> Attachments { get; set; }
public string Result { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Attachment
{
public class AttachmentsModel
{
public List<_AttachmentModel> Attachments { get; set; }
public string Result { get; set; }
}
}
@@ -1,79 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.BI;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.API.Models.Attachment
{
public class _AttachmentModel
{
public int Id { get; set; }
public string Author { get; set; }
public DateTime Timestamp { get; set; }
public string Comments { get; set; }
public string Filename { get; set; }
public string MimeType { get; set; }
public string TimestampFuzzy
{
get
{
return Timestamp.ToFuzzy();
}
set
{
// Ignore
}
}
public string TimestampFull
{
get
{
return Timestamp.ToFullDateTime();
}
set
{
// Ignore
}
}
public static _AttachmentModel FromAttachment(Disco.Models.Repository.UserAttachment ua)
{
return new _AttachmentModel
{
Id = ua.Id,
Author = ua.TechUser.ToString(),
Timestamp = ua.Timestamp,
Comments = ua.Comments,
Filename = ua.Filename,
MimeType = ua.MimeType
};
}
public static _AttachmentModel FromAttachment(Disco.Models.Repository.JobAttachment ja)
{
return new _AttachmentModel
{
Id = ja.Id,
Author = ja.TechUser.ToString(),
Timestamp = ja.Timestamp,
Comments = ja.Comments,
Filename = ja.Filename,
MimeType = ja.MimeType
};
}
public static _AttachmentModel FromAttachment(Disco.Models.Repository.DeviceAttachment da)
{
return new _AttachmentModel
{
Id = da.Id,
Author = da.TechUser.ToString(),
Timestamp = da.Timestamp,
Comments = da.Comments,
Filename = da.Filename,
MimeType = da.MimeType
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.BI;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.API.Models.Attachment
{
public class _AttachmentModel
{
public int Id { get; set; }
public string Author { get; set; }
public DateTime Timestamp { get; set; }
public string Comments { get; set; }
public string Filename { get; set; }
public string MimeType { get; set; }
public string TimestampFuzzy
{
get
{
return Timestamp.ToFuzzy();
}
set
{
// Ignore
}
}
public string TimestampFull
{
get
{
return Timestamp.ToFullDateTime();
}
set
{
// Ignore
}
}
public static _AttachmentModel FromAttachment(Disco.Models.Repository.UserAttachment ua)
{
return new _AttachmentModel
{
Id = ua.Id,
Author = ua.TechUser.ToString(),
Timestamp = ua.Timestamp,
Comments = ua.Comments,
Filename = ua.Filename,
MimeType = ua.MimeType
};
}
public static _AttachmentModel FromAttachment(Disco.Models.Repository.JobAttachment ja)
{
return new _AttachmentModel
{
Id = ja.Id,
Author = ja.TechUser.ToString(),
Timestamp = ja.Timestamp,
Comments = ja.Comments,
Filename = ja.Filename,
MimeType = ja.MimeType
};
}
public static _AttachmentModel FromAttachment(Disco.Models.Repository.DeviceAttachment da)
{
return new _AttachmentModel
{
Id = da.Id,
Author = da.TechUser.ToString(),
Timestamp = da.Timestamp,
Comments = da.Comments,
Filename = da.Filename,
MimeType = da.MimeType
};
}
}
}
@@ -1,31 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceBatch
{
public class DeviceBatchTimelineEvent
{
public string id { get; set; }
public DateTime start { get; set; }
public DateTime? end { get; set; }
public DateTime? latestStart { get; set; }
public DateTime? earliestEnd { get; set; }
public bool instant { get; set; }
public string title { get; set; }
public string description { get; set; }
public string image { get; set; }
public string link { get; set; }
public string icon { get; set; }
public string color { get; set; }
public string textColor { get; set; }
public string hoverText { get; set; }
public string classname { get; set; }
public string tapeImage { get; set; }
public bool tapeRepeat { get; set; }
public string caption { get; set; }
public string eventID { get; set; }
public string trackNum { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceBatch
{
public class DeviceBatchTimelineEvent
{
public string id { get; set; }
public DateTime start { get; set; }
public DateTime? end { get; set; }
public DateTime? latestStart { get; set; }
public DateTime? earliestEnd { get; set; }
public bool instant { get; set; }
public string title { get; set; }
public string description { get; set; }
public string image { get; set; }
public string link { get; set; }
public string icon { get; set; }
public string color { get; set; }
public string textColor { get; set; }
public string hoverText { get; set; }
public string classname { get; set; }
public string tapeImage { get; set; }
public bool tapeRepeat { get; set; }
public string caption { get; set; }
public string eventID { get; set; }
public string trackNum { get; set; }
}
}
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceBatch
{
public class DeviceBatchTimelineEventSource
{
public string wikiURL { get; set; }
public string wikiSection { get; set; }
public string dateTimeFormat { get { return "iso8601"; } }
public DeviceBatchTimelineEvent[] events { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceBatch
{
public class DeviceBatchTimelineEventSource
{
public string wikiURL { get; set; }
public string wikiSection { get; set; }
public string dateTimeFormat { get { return "iso8601"; } }
public DeviceBatchTimelineEvent[] events { get; set; }
}
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceModel
{
public class ComponentModel
{
public _ComponentModel Component { get; set; }
public string Result { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceModel
{
public class ComponentModel
{
public _ComponentModel Component { get; set; }
public string Result { get; set; }
}
}
@@ -1,27 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceModel
{
public class _ComponentModel
{
public int Id { get; set; }
public string Description { get; set; }
public string Cost { get; set; }
public List<string> JobSubTypes { get; set; }
public static _ComponentModel FromDeviceComponent(Disco.Models.Repository.DeviceComponent dc)
{
return new _ComponentModel
{
Id = dc.Id,
Description = dc.Description,
Cost = dc.Cost.ToString("C"),
JobSubTypes = dc.JobSubTypes.Select(j => string.Format("{0}_{1}", j.JobTypeId, j.Id)).ToList()
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceModel
{
public class _ComponentModel
{
public int Id { get; set; }
public string Description { get; set; }
public string Cost { get; set; }
public List<string> JobSubTypes { get; set; }
public static _ComponentModel FromDeviceComponent(Disco.Models.Repository.DeviceComponent dc)
{
return new _ComponentModel
{
Id = dc.Id,
Description = dc.Description,
Cost = dc.Cost.ToString("C"),
JobSubTypes = dc.JobSubTypes.Select(j => string.Format("{0}_{1}", j.JobTypeId, j.Id)).ToList()
};
}
}
}
@@ -1,28 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceModel
{
public class _DeviceModel
{
public int Id { get; set; }
public string Description { get; set; }
public string Manufacturer { get; set; }
public string Model { get; set; }
public string ModelType { get; set; }
public static _DeviceModel FromDeviceModel(Disco.Models.Repository.DeviceModel dm)
{
return new _DeviceModel()
{
Id = dm.Id,
Description = dm.Description,
Manufacturer = dm.Manufacturer,
Model = dm.Model,
ModelType = dm.ModelType
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DeviceModel
{
public class _DeviceModel
{
public int Id { get; set; }
public string Description { get; set; }
public string Manufacturer { get; set; }
public string Model { get; set; }
public string ModelType { get; set; }
public static _DeviceModel FromDeviceModel(Disco.Models.Repository.DeviceModel dm)
{
return new _DeviceModel()
{
Id = dm.Id,
Description = dm.Description,
Manufacturer = dm.Manufacturer,
Model = dm.Model,
ModelType = dm.ModelType
};
}
}
}
@@ -1,39 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DocumentTemplate
{
public class ImporterUndetectedDataIdLookupModel
{
public string value { get; set; }
public string label { get; set; }
public static ImporterUndetectedDataIdLookupModel FromSearchResultItem(Disco.Models.BI.Search.DeviceSearchResultItem item)
{
return new ImporterUndetectedDataIdLookupModel
{
value = item.SerialNumber,
label = string.Format("{0} - {1} - {2}", item.SerialNumber, item.ComputerName, item.DeviceModelDescription)
};
}
public static ImporterUndetectedDataIdLookupModel FromSearchResultItem(Disco.Models.BI.Job.JobTableModel.JobTableItemModel item)
{
return new ImporterUndetectedDataIdLookupModel
{
value = item.Id.ToString(),
label = string.Format("{0} ({1}; {2})", item.Id, item.DeviceSerialNumber, item.UserDisplayName)
};
}
public static ImporterUndetectedDataIdLookupModel FromSearchResultItem(Disco.Models.BI.Search.UserSearchResultItem item)
{
return new ImporterUndetectedDataIdLookupModel
{
value = item.Id,
label = string.Format("{0} - {1}", item.Id, item.DisplayName)
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DocumentTemplate
{
public class ImporterUndetectedDataIdLookupModel
{
public string value { get; set; }
public string label { get; set; }
public static ImporterUndetectedDataIdLookupModel FromSearchResultItem(Disco.Models.BI.Search.DeviceSearchResultItem item)
{
return new ImporterUndetectedDataIdLookupModel
{
value = item.SerialNumber,
label = string.Format("{0} - {1} - {2}", item.SerialNumber, item.ComputerName, item.DeviceModelDescription)
};
}
public static ImporterUndetectedDataIdLookupModel FromSearchResultItem(Disco.Models.BI.Job.JobTableModel.JobTableItemModel item)
{
return new ImporterUndetectedDataIdLookupModel
{
value = item.Id.ToString(),
label = string.Format("{0} ({1}; {2})", item.Id, item.DeviceSerialNumber, item.UserDisplayName)
};
}
public static ImporterUndetectedDataIdLookupModel FromSearchResultItem(Disco.Models.BI.Search.UserSearchResultItem item)
{
return new ImporterUndetectedDataIdLookupModel
{
value = item.Id,
label = string.Format("{0} - {1}", item.Id, item.DisplayName)
};
}
}
}
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DocumentTemplate
{
public class ImporterUndetectedFilesModel
{
public string Id { get; set; }
public string Timestamp { get; set; }
public string TimestampFuzzy { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.DocumentTemplate
{
public class ImporterUndetectedFilesModel
{
public string Id { get; set; }
public string Timestamp { get; set; }
public string TimestampFuzzy { get; set; }
}
}
@@ -1,37 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.BI.Expressions;
namespace Disco.Web.Areas.API.Models.Expressions
{
public class ValidateExpressionModel
{
public string Expression { get; set; }
public bool ExpressionValid { get; set; }
public int PositionRow { get; set; }
public int PositionColumn { get; set; }
public string Message { get; set; }
public string MessageHtmlEncoded { get; set; }
public static ValidateExpressionModel FromEvaluateExpressionPart(EvaluateExpressionPart part)
{
var parseException = part.ParseException;
if (parseException != null)
{
return new ValidateExpressionModel()
{
Expression = part.Source,
ExpressionValid = false,
Message = parseException.Message,
MessageHtmlEncoded = HttpUtility.HtmlEncode(parseException.Message),
PositionRow = parseException.PositionRow,
PositionColumn = parseException.PositionColumn
};
}
else
return new ValidateExpressionModel() { Expression = part.Source, ExpressionValid = true };
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.BI.Expressions;
namespace Disco.Web.Areas.API.Models.Expressions
{
public class ValidateExpressionModel
{
public string Expression { get; set; }
public bool ExpressionValid { get; set; }
public int PositionRow { get; set; }
public int PositionColumn { get; set; }
public string Message { get; set; }
public string MessageHtmlEncoded { get; set; }
public static ValidateExpressionModel FromEvaluateExpressionPart(EvaluateExpressionPart part)
{
var parseException = part.ParseException;
if (parseException != null)
{
return new ValidateExpressionModel()
{
Expression = part.Source,
ExpressionValid = false,
Message = parseException.Message,
MessageHtmlEncoded = HttpUtility.HtmlEncode(parseException.Message),
PositionRow = parseException.PositionRow,
PositionColumn = parseException.PositionColumn
};
}
else
return new ValidateExpressionModel() { Expression = part.Source, ExpressionValid = true };
}
}
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class CommentPostModel
{
public string Result { get; set; }
public _CommentModel Comment { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class CommentPostModel
{
public string Result { get; set; }
public _CommentModel Comment { get; set; }
}
}
+12 -12
View File
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class CommentsModel
{
public string Result { get; set; }
public List<_CommentModel> Comments { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class CommentsModel
{
public string Result { get; set; }
public List<_CommentModel> Comments { get; set; }
}
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class ComponentModel
{
public _ComponentModel Component { get; set; }
public string Result { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class ComponentModel
{
public _ComponentModel Component { get; set; }
public string Result { get; set; }
}
}
+50 -50
View File
@@ -1,51 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.BI;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.API.Models.Job
{
public class _CommentModel
{
public int Id { get; set; }
public string Author { get; set; }
public DateTime Timestamp { get; set; }
public string Comments { get; set; }
public string TimestampFuzzy
{
get
{
return Timestamp.ToFuzzy();
}
set
{
// Ignore
}
}
public string TimestampFull
{
get
{
return Timestamp.ToFullDateTime();
}
set
{
// Ignore
}
}
public static _CommentModel FromJobLog(Disco.Models.Repository.JobLog jl)
{
return new _CommentModel
{
Id = jl.Id,
Author = jl.TechUser.ToString(),
Timestamp = jl.Timestamp,
Comments = jl.Comments
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.BI;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.API.Models.Job
{
public class _CommentModel
{
public int Id { get; set; }
public string Author { get; set; }
public DateTime Timestamp { get; set; }
public string Comments { get; set; }
public string TimestampFuzzy
{
get
{
return Timestamp.ToFuzzy();
}
set
{
// Ignore
}
}
public string TimestampFull
{
get
{
return Timestamp.ToFullDateTime();
}
set
{
// Ignore
}
}
public static _CommentModel FromJobLog(Disco.Models.Repository.JobLog jl)
{
return new _CommentModel
{
Id = jl.Id,
Author = jl.TechUser.ToString(),
Timestamp = jl.Timestamp,
Comments = jl.Comments
};
}
}
}
@@ -1,24 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class _ComponentModel
{
public int Id { get; set; }
public string Description { get; set; }
public string Cost { get; set; }
public static _ComponentModel FromJobComponent(Disco.Models.Repository.JobComponent jc)
{
return new _ComponentModel
{
Id = jc.Id,
Description = jc.Description,
Cost = jc.Cost.ToString("C")
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class _ComponentModel
{
public int Id { get; set; }
public string Description { get; set; }
public string Cost { get; set; }
public static _ComponentModel FromJobComponent(Disco.Models.Repository.JobComponent jc)
{
return new _ComponentModel
{
Id = jc.Id,
Description = jc.Description,
Cost = jc.Cost.ToString("C")
};
}
}
}
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class _DateChangeModel
{
public int Id { get; set; }
public string Result { get; set; }
public string UserDescription { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.Job
{
public class _DateChangeModel
{
public int Id { get; set; }
public string Result { get; set; }
public string UserDescription { get; set; }
}
}
@@ -1,25 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Logging.Models;
namespace Disco.Web.Areas.API.Models.Logs
{
public class LogEventTypeModel
{
public int Id { get; set; }
public string Name { get; set; }
public int Severity { get; set; }
public static LogEventTypeModel FromLogEventType(LogEventType EventType)
{
return new LogEventTypeModel()
{
Id = EventType.Id,
Name = EventType.Name,
Severity = EventType.Severity
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Logging.Models;
namespace Disco.Web.Areas.API.Models.Logs
{
public class LogEventTypeModel
{
public int Id { get; set; }
public string Name { get; set; }
public int Severity { get; set; }
public static LogEventTypeModel FromLogEventType(LogEventType EventType)
{
return new LogEventTypeModel()
{
Id = EventType.Id,
Name = EventType.Name,
Severity = EventType.Severity
};
}
}
}
@@ -1,29 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Logging;
using System.Web.WebPages.Html;
namespace Disco.Web.Areas.API.Models.Logs
{
public class LogModuleModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public List<LogEventTypeModel> EventTypes { get; set; }
public static LogModuleModel FromLogModule(LogBase LogModule)
{
return new LogModuleModel()
{
Id = LogModule.ModuleId,
Name = LogModule.ModuleName,
Description = LogModule.ModuleDescription,
EventTypes = LogModule.EventTypes.Values.Select(et => LogEventTypeModel.FromLogEventType(et)).ToList()
};
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Logging;
using System.Web.WebPages.Html;
namespace Disco.Web.Areas.API.Models.Logs
{
public class LogModuleModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public List<LogEventTypeModel> EventTypes { get; set; }
public static LogModuleModel FromLogModule(LogBase LogModule)
{
return new LogModuleModel()
{
Id = LogModule.ModuleId,
Name = LogModule.ModuleName,
Description = LogModule.ModuleDescription,
EventTypes = LogModule.EventTypes.Values.Select(et => LogEventTypeModel.FromLogEventType(et)).ToList()
};
}
}
}
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.System
{
public class UpdateLastNetworkLogonDatesModel
{
public string Result { get; set; }
public int UpdateCount { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.System
{
public class UpdateLastNetworkLogonDatesModel
{
public string Result { get; set; }
public int UpdateCount { get; set; }
}
}
@@ -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();
}
}
}
}
@@ -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; }
}
}
@@ -1,87 +1,87 @@
@model Disco.Web.Areas.Config.Models.Config.IndexModel
@{
ViewBag.Title = "Configuration";
}
<table id="pageMenu">
<tr>
<td>
<div class="pageMenuArea">
<h2>Hosting</h2>
@Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config")
<div class="pageMenuBlurb">
Update system configuration, such as the Data Storage Location and Proxy settings.
</div>
@Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config")
<div class="pageMenuBlurb">
Update the Organisation Name, Logo and Addresses associated with this organisation.
</div>
@Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config")
<div class="pageMenuBlurb">
Export Log files from various Disco Modules and view Live Logging.
</div>
</div>
</td>
<td>
<div class="pageMenuArea">
<h2>Devices</h2>
@Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config")
<div class="pageMenuBlurb">
Configure Components, Product Images and default settings for Device Models.
</div>
@Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config")
<div class="pageMenuBlurb">
Create and Configure Device Batches.
</div>
@Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config")
<div class="pageMenuBlurb">
Configure Device Profiles including computer name generation, distribution and Active
Directory OU layout.
</div>
@Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config")
<div class="pageMenuBlurb">
Configure Enrolment settings including secure credentials.
</div>
</div>
</td>
<td>
<div class="pageMenuArea">
<h2>Features</h2>
@Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config")
<div class="pageMenuBlurb">
Create, Update and Bulk Generate documents based on PDF Templates for Jobs, Devices
and Users.
</div>
@Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config")
<div class="pageMenuBlurb">
Manage extensions to the Disco platform.
</div>
</div>
</td>
</tr>
</table>
@{
if (Model.UpdateAvailable)
{
<div id="updateAvailableContainer">
<div>An updated version of Disco is available</div>
<a href="@Model.UpdateResponse.UrlLink" target="_blank">Download Disco v@(Model.UpdateResponse.Version)</a>
</div>
<script>
(function () {
$(function () {
var layout_PageHeading = $('#layout_PageHeading').height(80);
var updateAvailableContainer = $('#updateAvailableContainer');
updateAvailableContainer.appendTo(layout_PageHeading);
@{
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-7))
{
<text>
updateAvailableContainer.effect("shake", { times: 3 }, 100);
</text>
}
}
});
})();
</script>
}
@model Disco.Web.Areas.Config.Models.Config.IndexModel
@{
ViewBag.Title = "Configuration";
}
<table id="pageMenu">
<tr>
<td>
<div class="pageMenuArea">
<h2>Hosting</h2>
@Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config")
<div class="pageMenuBlurb">
Update system configuration, such as the Data Storage Location and Proxy settings.
</div>
@Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config")
<div class="pageMenuBlurb">
Update the Organisation Name, Logo and Addresses associated with this organisation.
</div>
@Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config")
<div class="pageMenuBlurb">
Export Log files from various Disco Modules and view Live Logging.
</div>
</div>
</td>
<td>
<div class="pageMenuArea">
<h2>Devices</h2>
@Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config")
<div class="pageMenuBlurb">
Configure Components, Product Images and default settings for Device Models.
</div>
@Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config")
<div class="pageMenuBlurb">
Create and Configure Device Batches.
</div>
@Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config")
<div class="pageMenuBlurb">
Configure Device Profiles including computer name generation, distribution and Active
Directory OU layout.
</div>
@Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config")
<div class="pageMenuBlurb">
Configure Enrolment settings including secure credentials.
</div>
</div>
</td>
<td>
<div class="pageMenuArea">
<h2>Features</h2>
@Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config")
<div class="pageMenuBlurb">
Create, Update and Bulk Generate documents based on PDF Templates for Jobs, Devices
and Users.
</div>
@Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config")
<div class="pageMenuBlurb">
Manage extensions to the Disco platform.
</div>
</div>
</td>
</tr>
</table>
@{
if (Model.UpdateAvailable)
{
<div id="updateAvailableContainer">
<div>An updated version of Disco is available</div>
<a href="@Model.UpdateResponse.UrlLink" target="_blank">Download Disco v@(Model.UpdateResponse.Version)</a>
</div>
<script>
(function () {
$(function () {
var layout_PageHeading = $('#layout_PageHeading').height(80);
var updateAvailableContainer = $('#updateAvailableContainer');
updateAvailableContainer.appendTo(layout_PageHeading);
@{
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-7))
{
<text>
updateAvailableContainer.effect("shake", { times: 3 }, 100);
</text>
}
}
});
})();
</script>
}
}
@@ -1,304 +1,304 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.Config
{
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("~/Areas/Config/Views/Config/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Config.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\Config\Index.cshtml"
ViewBag.Title = "Configuration";
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" id=\"pageMenu\"");
WriteLiteral(">\r\n <tr>\r\n <td>\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Hosting</h2>\r\n");
WriteLiteral(" ");
#line 10 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Update system configuration, such as the Data Storage Loca" +
"tion and Proxy settings.\r\n </div>\r\n");
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Update the Organisation Name, Logo and Addresses associate" +
"d with this organisation.\r\n </div>\r\n");
WriteLiteral(" ");
#line 18 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Export Log files from various Disco Modules and view Live " +
"Logging.\r\n </div>\r\n </div>\r\n </td>\r\n <td" +
">\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Devices</h2>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Components, Product Images and default settings " +
"for Device Models.\r\n </div>\r\n");
WriteLiteral(" ");
#line 31 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create and Configure Device Batches.\r\n </di" +
"v>\r\n");
WriteLiteral(" ");
#line 35 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Device Profiles including computer name generati" +
"on, distribution and Active\r\n Directory OU layout.\r\n " +
" </div>\r\n");
WriteLiteral(" ");
#line 40 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Enrolment settings including secure credentials." +
"\r\n </div>\r\n </div>\r\n </td>\r\n <td>\r\n " +
" <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Features</h2>\r\n");
WriteLiteral(" ");
#line 49 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create, Update and Bulk Generate documents based on PDF Te" +
"mplates for Jobs, Devices\r\n and Users.\r\n </div" +
">\r\n");
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Manage extensions to the Disco platform.\r\n " +
"</div>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n");
#line 62 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateAvailable)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"updateAvailableContainer\"");
WriteLiteral(">\r\n <div>An updated version of Disco is available</div>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 3034), Tuple.Create("\"", 3070)
#line 67 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 3041), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line default
#line hidden
, 3041), false)
);
WriteLiteral(" target=\"_blank\"");
WriteLiteral(">Download Disco v");
#line 67 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Model.UpdateResponse.Version);
#line default
#line hidden
WriteLiteral("</a>\r\n </div>\r\n");
WriteLiteral(@" <script>
(function () {
$(function () {
var layout_PageHeading = $('#layout_PageHeading').height(80);
var updateAvailableContainer = $('#updateAvailableContainer');
updateAvailableContainer.appendTo(layout_PageHeading);
");
#line 75 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-7))
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("\r\n updateAvailableContainer.effect(\"shake\", { times: 3 }, 100);\r\n " +
" ");
WriteLiteral("\r\n");
#line 81 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n });\r\n })();\r\n </script>\r\n");
#line 86 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.Config
{
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("~/Areas/Config/Views/Config/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Config.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\Config\Index.cshtml"
ViewBag.Title = "Configuration";
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" id=\"pageMenu\"");
WriteLiteral(">\r\n <tr>\r\n <td>\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Hosting</h2>\r\n");
WriteLiteral(" ");
#line 10 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Update system configuration, such as the Data Storage Loca" +
"tion and Proxy settings.\r\n </div>\r\n");
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Update the Organisation Name, Logo and Addresses associate" +
"d with this organisation.\r\n </div>\r\n");
WriteLiteral(" ");
#line 18 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Export Log files from various Disco Modules and view Live " +
"Logging.\r\n </div>\r\n </div>\r\n </td>\r\n <td" +
">\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Devices</h2>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Components, Product Images and default settings " +
"for Device Models.\r\n </div>\r\n");
WriteLiteral(" ");
#line 31 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create and Configure Device Batches.\r\n </di" +
"v>\r\n");
WriteLiteral(" ");
#line 35 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Device Profiles including computer name generati" +
"on, distribution and Active\r\n Directory OU layout.\r\n " +
" </div>\r\n");
WriteLiteral(" ");
#line 40 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Enrolment settings including secure credentials." +
"\r\n </div>\r\n </div>\r\n </td>\r\n <td>\r\n " +
" <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Features</h2>\r\n");
WriteLiteral(" ");
#line 49 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create, Update and Bulk Generate documents based on PDF Te" +
"mplates for Jobs, Devices\r\n and Users.\r\n </div" +
">\r\n");
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Manage extensions to the Disco platform.\r\n " +
"</div>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n");
#line 62 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateAvailable)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"updateAvailableContainer\"");
WriteLiteral(">\r\n <div>An updated version of Disco is available</div>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 3034), Tuple.Create("\"", 3070)
#line 67 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 3041), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line default
#line hidden
, 3041), false)
);
WriteLiteral(" target=\"_blank\"");
WriteLiteral(">Download Disco v");
#line 67 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Model.UpdateResponse.Version);
#line default
#line hidden
WriteLiteral("</a>\r\n </div>\r\n");
WriteLiteral(@" <script>
(function () {
$(function () {
var layout_PageHeading = $('#layout_PageHeading').height(80);
var updateAvailableContainer = $('#updateAvailableContainer');
updateAvailableContainer.appendTo(layout_PageHeading);
");
#line 75 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-7))
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("\r\n updateAvailableContainer.effect(\"shake\", { times: 3 }, 100);\r\n " +
" ");
WriteLiteral("\r\n");
#line 81 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n });\r\n })();\r\n </script>\r\n");
#line 86 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -1,39 +1,39 @@
@model Disco.Models.Repository.DeviceBatch
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
}
@using (Html.BeginForm())
{
<div class="form" style="width: 450px">
<table>
<tr>
<th>
Name:
</th>
<td>
@Html.EditorFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
</td>
</tr>
<tr>
<th>
Purchase Date:
</th>
<td>@Html.EditorFor(model => model.PurchaseDate)<br />@Html.ValidationMessageFor(model => model.PurchaseDate)
</td>
</tr>
</table>
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
</div>
<script type="text/javascript">
$(function () {
$('#Name').focus().select();
$('#PurchaseDate').datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
});
</script>
}
@model Disco.Models.Repository.DeviceBatch
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
}
@using (Html.BeginForm())
{
<div class="form" style="width: 450px">
<table>
<tr>
<th>
Name:
</th>
<td>
@Html.EditorFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
</td>
</tr>
<tr>
<th>
Purchase Date:
</th>
<td>@Html.EditorFor(model => model.PurchaseDate)<br />@Html.ValidationMessageFor(model => model.PurchaseDate)
</td>
</tr>
</table>
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
</div>
<script type="text/javascript">
$(function () {
$('#Name').focus().select();
$('#PurchaseDate').datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
});
</script>
}
@@ -1,148 +1,148 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceBatch
{
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("~/Areas/Config/Views/DeviceBatch/Create.cshtml")]
public class Create : System.Web.Mvc.WebViewPage<Disco.Models.Repository.DeviceBatch>
{
public Create()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
"ame:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.EditorFor(model => model.Name));
#line default
#line hidden
WriteLiteral("<br />");
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.Name));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Purchase Date:\r\n </th>\r\n <t" +
"d>");
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.EditorFor(model => model.PurchaseDate));
#line default
#line hidden
WriteLiteral("<br />");
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.PurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Create\"");
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#Name').focus().select();
$('#PurchaseDate').datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
});
</script>
");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceBatch
{
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("~/Areas/Config/Views/DeviceBatch/Create.cshtml")]
public class Create : System.Web.Mvc.WebViewPage<Disco.Models.Repository.DeviceBatch>
{
public Create()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
"ame:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.EditorFor(model => model.Name));
#line default
#line hidden
WriteLiteral("<br />");
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.Name));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Purchase Date:\r\n </th>\r\n <t" +
"d>");
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.EditorFor(model => model.PurchaseDate));
#line default
#line hidden
WriteLiteral("<br />");
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.PurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Create\"");
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#Name').focus().select();
$('#PurchaseDate').datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
});
</script>
");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -1,69 +1,69 @@
@model Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
}
<table class="tableData">
<tr>
<th>
Name
</th>
<th>
Default Model
</th>
<th>
Purchase Date
</th>
<th>
Warranty Expires
</th>
<th>
Insurance Expires
</th>
<th>
Device Count
</th>
</tr>
@foreach (var item in Model.DeviceBatches)
{
<tr>
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id))
</td>
<td>
@item.DefaultDeviceModel
</td>
<td>
@CommonHelpers.FriendlyDate(item.PurchaseDate)
</td>
<td>
@CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown")
</td>
<td>
@CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown")
@(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier))
</td>
<td>
@if (item.PurchaseUnitQuantity.HasValue)
{
<span>@item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0"))</span>
}
else
{
@item.DeviceCount.ToString("n0")
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount) Decommissioned">
(@(item.DeviceDecommissionedCount))</span>
}
</td>
</tr>
}
</table>
<div class="actionBar">
@if (Model.DeviceBatches.Count > 0)
{
@Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline())
}
@Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create())
</div>
@model Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
}
<table class="tableData">
<tr>
<th>
Name
</th>
<th>
Default Model
</th>
<th>
Purchase Date
</th>
<th>
Warranty Expires
</th>
<th>
Insurance Expires
</th>
<th>
Device Count
</th>
</tr>
@foreach (var item in Model.DeviceBatches)
{
<tr>
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id))
</td>
<td>
@item.DefaultDeviceModel
</td>
<td>
@CommonHelpers.FriendlyDate(item.PurchaseDate)
</td>
<td>
@CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown")
</td>
<td>
@CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown")
@(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier))
</td>
<td>
@if (item.PurchaseUnitQuantity.HasValue)
{
<span>@item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0"))</span>
}
else
{
@item.DeviceCount.ToString("n0")
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount) Decommissioned">
(@(item.DeviceDecommissionedCount))</span>
}
</td>
</tr>
}
</table>
<div class="actionBar">
@if (Model.DeviceBatches.Count > 0)
{
@Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline())
}
@Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create())
</div>
@@ -1,319 +1,319 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceBatch
{
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("~/Areas/Config/Views/DeviceBatch/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(@">
<tr>
<th>
Name
</th>
<th>
Default Model
</th>
<th>
Purchase Date
</th>
<th>
Warranty Expires
</th>
<th>
Insurance Expires
</th>
<th>
Device Count
</th>
</tr>
");
#line 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
foreach (var item in Model.DeviceBatches)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DefaultDeviceModel);
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.PurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 42 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 43 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.PurchaseUnitQuantity.HasValue)
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("/");
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
#line default
#line hidden
WriteLiteral("</span>\r\n");
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1775), Tuple.Create("\"", 1831)
#line 56 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1783), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
#line default
#line hidden
, 1783), false)
, Tuple.Create(Tuple.Create(" ", 1816), Tuple.Create("Decommissioned", 1817), true)
);
WriteLiteral(">\r\n (");
#line 57 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceDecommissionedCount);
#line default
#line hidden
WriteLiteral(")</span>\r\n");
#line 58 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 61 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</table>\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Model.DeviceBatches.Count > 0)
{
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceBatch
{
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("~/Areas/Config/Views/DeviceBatch/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(@">
<tr>
<th>
Name
</th>
<th>
Default Model
</th>
<th>
Purchase Date
</th>
<th>
Warranty Expires
</th>
<th>
Insurance Expires
</th>
<th>
Device Count
</th>
</tr>
");
#line 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
foreach (var item in Model.DeviceBatches)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DefaultDeviceModel);
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.PurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 42 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 43 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.PurchaseUnitQuantity.HasValue)
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("/");
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
#line default
#line hidden
WriteLiteral("</span>\r\n");
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1775), Tuple.Create("\"", 1831)
#line 56 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1783), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
#line default
#line hidden
, 1783), false)
, Tuple.Create(Tuple.Create(" ", 1816), Tuple.Create("Decommissioned", 1817), true)
);
WriteLiteral(">\r\n (");
#line 57 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceDecommissionedCount);
#line default
#line hidden
WriteLiteral(")</span>\r\n");
#line 58 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 61 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</table>\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Model.DeviceBatches.Count > 0)
{
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,122 +1,122 @@
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
Html.BundleDeferred("~/Style/Timeline");
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
}
<div id="deviceBatchesTimeline" style="height: 550px;">
</div>
<script type="text/javascript">
(function () {
var dataUrl = '@(Url.Action(MVC.API.DeviceBatch.Timeline()))';
var tl;
$(function () {
var eventSource = new Timeline.DefaultEventSource();
var currentDate = new Date();
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDay(), 10, 0, 0);
var tomorrowDate = new Date();
tomorrowDate.setDate(currentDate.getDate() + 1);
var sixMonthsDate = new Date();
sixMonthsDate.setDate(currentDate.getDate());
sixMonthsDate.setMonth(currentDate.getMonth() + 6);
var hotZoneStart1 = new Date(currentDate.getFullYear(), 0, 1, 10, 0, 0);
var hotZoneEnd1 = new Date(currentDate.getFullYear(), 11, 31, 10, 0, 0);
var hotZoneStart2 = new Date(currentDate.getFullYear() + 1, 0, 1, 10, 0, 0);
var hotZoneEnd2 = new Date(currentDate.getFullYear() + 1, 11, 31, 10, 0, 0);
//hotZoneEnd.setDate(hotZoneEnd.getDate() - 1);
//hotZoneStart = hotZoneStart.toLocaleDateString();
//hotZoneEnd = hotZoneEnd.toLocaleDateString();
var bandInfos = [
Timeline.createHotZoneBandInfo({
zones: [
{
start: hotZoneStart1,
end: hotZoneEnd1,
magnify: 4,
unit: Timeline.DateTime.MONTH
},
{
start: hotZoneStart2,
end: hotZoneEnd2,
magnify: 4,
unit: Timeline.DateTime.MONTH
}
],
eventSource: eventSource,
width: "85%",
intervalUnit: Timeline.DateTime.YEAR,
intervalPixels: 150,
timeZone: 10,
date: sixMonthsDate
}),
Timeline.createBandInfo({
eventSource: eventSource,
width: "15%",
intervalUnit: Timeline.DateTime.YEAR,
intervalPixels: 150,
overview: true,
timeZone: 10,
date: sixMonthsDate
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
for (var i = 0; i < bandInfos.length; i++) {
bandInfos[i].decorators = [
new Timeline.SpanHighlightDecorator({
startDate: currentDate,
endDate: tomorrowDate,
color: "#CC2222",
opacity: 50
}),
new Timeline.SpanHighlightDecorator({
startDate: hotZoneStart1,
endDate: hotZoneEnd1,
color: "#CEA5A5",
opacity: 50
}),
new Timeline.SpanHighlightDecorator({
startDate: hotZoneStart2,
endDate: hotZoneEnd2,
color: "#CCB7B7",
opacity: 50
})
];
}
tl = Timeline.create($('#deviceBatchesTimeline')[0], bandInfos);
var tlResizeLayoutHandle = null;
$(window).resize(function () {
if (tlResizeLayoutHandle)
window.clearTimeout(tlResizeLayoutHandle);
tlResizeLayoutHandle = window.setTimeout(function () {
tlResizeLayoutHandle = null;
tl.layout();
}, 500);
});
// Load Events
$.ajax({
url: dataUrl,
dataType: 'json',
type: 'POST',
success: function (data) {
eventSource.loadJSON(data, dataUrl);
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to load Timeline Data: ' + errorThrown);
}
});
});
})();
</script>
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
Html.BundleDeferred("~/Style/Timeline");
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
}
<div id="deviceBatchesTimeline" style="height: 550px;">
</div>
<script type="text/javascript">
(function () {
var dataUrl = '@(Url.Action(MVC.API.DeviceBatch.Timeline()))';
var tl;
$(function () {
var eventSource = new Timeline.DefaultEventSource();
var currentDate = new Date();
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDay(), 10, 0, 0);
var tomorrowDate = new Date();
tomorrowDate.setDate(currentDate.getDate() + 1);
var sixMonthsDate = new Date();
sixMonthsDate.setDate(currentDate.getDate());
sixMonthsDate.setMonth(currentDate.getMonth() + 6);
var hotZoneStart1 = new Date(currentDate.getFullYear(), 0, 1, 10, 0, 0);
var hotZoneEnd1 = new Date(currentDate.getFullYear(), 11, 31, 10, 0, 0);
var hotZoneStart2 = new Date(currentDate.getFullYear() + 1, 0, 1, 10, 0, 0);
var hotZoneEnd2 = new Date(currentDate.getFullYear() + 1, 11, 31, 10, 0, 0);
//hotZoneEnd.setDate(hotZoneEnd.getDate() - 1);
//hotZoneStart = hotZoneStart.toLocaleDateString();
//hotZoneEnd = hotZoneEnd.toLocaleDateString();
var bandInfos = [
Timeline.createHotZoneBandInfo({
zones: [
{
start: hotZoneStart1,
end: hotZoneEnd1,
magnify: 4,
unit: Timeline.DateTime.MONTH
},
{
start: hotZoneStart2,
end: hotZoneEnd2,
magnify: 4,
unit: Timeline.DateTime.MONTH
}
],
eventSource: eventSource,
width: "85%",
intervalUnit: Timeline.DateTime.YEAR,
intervalPixels: 150,
timeZone: 10,
date: sixMonthsDate
}),
Timeline.createBandInfo({
eventSource: eventSource,
width: "15%",
intervalUnit: Timeline.DateTime.YEAR,
intervalPixels: 150,
overview: true,
timeZone: 10,
date: sixMonthsDate
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
for (var i = 0; i < bandInfos.length; i++) {
bandInfos[i].decorators = [
new Timeline.SpanHighlightDecorator({
startDate: currentDate,
endDate: tomorrowDate,
color: "#CC2222",
opacity: 50
}),
new Timeline.SpanHighlightDecorator({
startDate: hotZoneStart1,
endDate: hotZoneEnd1,
color: "#CEA5A5",
opacity: 50
}),
new Timeline.SpanHighlightDecorator({
startDate: hotZoneStart2,
endDate: hotZoneEnd2,
color: "#CCB7B7",
opacity: 50
})
];
}
tl = Timeline.create($('#deviceBatchesTimeline')[0], bandInfos);
var tlResizeLayoutHandle = null;
$(window).resize(function () {
if (tlResizeLayoutHandle)
window.clearTimeout(tlResizeLayoutHandle);
tlResizeLayoutHandle = window.setTimeout(function () {
tlResizeLayoutHandle = null;
tl.layout();
}, 500);
});
// Load Events
$.ajax({
url: dataUrl,
dataType: 'json',
type: 'POST',
success: function (data) {
eventSource.loadJSON(data, dataUrl);
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to load Timeline Data: ' + errorThrown);
}
});
});
})();
</script>
@@ -1,131 +1,131 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceBatch
{
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("~/Areas/Config/Views/DeviceBatch/Timeline.cshtml")]
public class Timeline : System.Web.Mvc.WebViewPage<dynamic>
{
public Timeline()
{
}
public override void Execute()
{
#line 1 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
Html.BundleDeferred("~/Style/Timeline");
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"deviceBatchesTimeline\"");
WriteLiteral(" style=\"height: 550px;\"");
WriteLiteral(">\r\n</div>\r\n<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n (function () {\r\n var dataUrl = \'");
#line 10 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
Write(Url.Action(MVC.API.DeviceBatch.Timeline()));
#line default
#line hidden
WriteLiteral("\';\r\n var tl;\r\n\r\n $(function () {\r\n\r\n var eventSource = n" +
"ew Timeline.DefaultEventSource();\r\n\r\n var currentDate = new Date();\r\n" +
" currentDate = new Date(currentDate.getFullYear(), currentDate.getMon" +
"th(), currentDate.getDay(), 10, 0, 0);\r\n var tomorrowDate = new Date(" +
");\r\n tomorrowDate.setDate(currentDate.getDate() + 1);\r\n va" +
"r sixMonthsDate = new Date();\r\n sixMonthsDate.setDate(currentDate.get" +
"Date());\r\n sixMonthsDate.setMonth(currentDate.getMonth() + 6);\r\n " +
" \r\n var hotZoneStart1 = new Date(currentDate.getFullYear(), 0, " +
"1, 10, 0, 0);\r\n var hotZoneEnd1 = new Date(currentDate.getFullYear()," +
" 11, 31, 10, 0, 0);\r\n var hotZoneStart2 = new Date(currentDate.getFul" +
"lYear() + 1, 0, 1, 10, 0, 0);\r\n var hotZoneEnd2 = new Date(currentDat" +
"e.getFullYear() + 1, 11, 31, 10, 0, 0);\r\n //hotZoneEnd.setDate(hotZon" +
"eEnd.getDate() - 1);\r\n\r\n //hotZoneStart = hotZoneStart.toLocaleDateSt" +
"ring();\r\n //hotZoneEnd = hotZoneEnd.toLocaleDateString();\r\n\r\n\r\n " +
" var bandInfos = [\r\n Timeline.createHotZoneBandInfo({\r\n " +
" zones: [\r\n {\r\n start: h" +
"otZoneStart1,\r\n end: hotZoneEnd1,\r\n " +
" magnify: 4,\r\n unit: Timeline.DateTime.MONTH\r\n " +
" },\r\n {\r\n start: hotZoneStart" +
"2,\r\n end: hotZoneEnd2,\r\n magnify: " +
"4,\r\n unit: Timeline.DateTime.MONTH\r\n }" +
"\r\n ],\r\n eventSource: eventSource,\r\n " +
" width: \"85%\",\r\n intervalUnit: Timeline.DateTime." +
"YEAR,\r\n intervalPixels: 150,\r\n timeZone: 1" +
"0,\r\n date: sixMonthsDate\r\n }),\r\n " +
" Timeline.createBandInfo({\r\n eventSource: eventSource,\r\n " +
" width: \"15%\",\r\n intervalUnit: Timeline.DateTi" +
"me.YEAR,\r\n intervalPixels: 150,\r\n overview" +
": true,\r\n timeZone: 10,\r\n date: sixMonthsD" +
"ate\r\n })\r\n ];\r\n bandInfos[1].syncWith = 0;\r" +
"\n bandInfos[1].highlight = true;\r\n\r\n for (var i = 0; i < b" +
"andInfos.length; i++) {\r\n bandInfos[i].decorators = [\r\n " +
" new Timeline.SpanHighlightDecorator({\r\n startDa" +
"te: currentDate,\r\n endDate: tomorrowDate,\r\n " +
" color: \"#CC2222\",\r\n opacity: 50\r\n " +
" }),\r\n new Timeline.SpanHighlightDecorator({\r\n " +
" startDate: hotZoneStart1,\r\n endDate: hotZon" +
"eEnd1,\r\n color: \"#CEA5A5\",\r\n opaci" +
"ty: 50\r\n }),\r\n new Timeline.SpanHighlightD" +
"ecorator({\r\n startDate: hotZoneStart2,\r\n " +
" endDate: hotZoneEnd2,\r\n color: \"#CCB7B7\",\r\n " +
" opacity: 50\r\n })\r\n ];\r\n " +
" }\r\n\r\n tl = Timeline.create($(\'#deviceBatchesTimeline\')[0], band" +
"Infos);\r\n\r\n var tlResizeLayoutHandle = null;\r\n $(window).r" +
"esize(function () {\r\n if (tlResizeLayoutHandle)\r\n " +
" window.clearTimeout(tlResizeLayoutHandle);\r\n tlResizeLayoutHa" +
"ndle = window.setTimeout(function () {\r\n tlResizeLayoutHandle" +
" = null;\r\n tl.layout();\r\n }, 500);\r\n " +
" });\r\n\r\n // Load Events\r\n $.ajax({\r\n url: " +
"dataUrl,\r\n dataType: \'json\',\r\n type: \'POST\',\r\n " +
" success: function (data) {\r\n eventSource.loadJSON" +
"(data, dataUrl);\r\n },\r\n error: function (jqXHR, te" +
"xtStatus, errorThrown) {\r\n alert(\'Unable to load Timeline Dat" +
"a: \' + errorThrown);\r\n }\r\n });\r\n });\r\n\r\n })(" +
");\r\n\r\n</script>\r\n");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceBatch
{
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("~/Areas/Config/Views/DeviceBatch/Timeline.cshtml")]
public class Timeline : System.Web.Mvc.WebViewPage<dynamic>
{
public Timeline()
{
}
public override void Execute()
{
#line 1 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
Html.BundleDeferred("~/Style/Timeline");
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"deviceBatchesTimeline\"");
WriteLiteral(" style=\"height: 550px;\"");
WriteLiteral(">\r\n</div>\r\n<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n (function () {\r\n var dataUrl = \'");
#line 10 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
Write(Url.Action(MVC.API.DeviceBatch.Timeline()));
#line default
#line hidden
WriteLiteral("\';\r\n var tl;\r\n\r\n $(function () {\r\n\r\n var eventSource = n" +
"ew Timeline.DefaultEventSource();\r\n\r\n var currentDate = new Date();\r\n" +
" currentDate = new Date(currentDate.getFullYear(), currentDate.getMon" +
"th(), currentDate.getDay(), 10, 0, 0);\r\n var tomorrowDate = new Date(" +
");\r\n tomorrowDate.setDate(currentDate.getDate() + 1);\r\n va" +
"r sixMonthsDate = new Date();\r\n sixMonthsDate.setDate(currentDate.get" +
"Date());\r\n sixMonthsDate.setMonth(currentDate.getMonth() + 6);\r\n " +
" \r\n var hotZoneStart1 = new Date(currentDate.getFullYear(), 0, " +
"1, 10, 0, 0);\r\n var hotZoneEnd1 = new Date(currentDate.getFullYear()," +
" 11, 31, 10, 0, 0);\r\n var hotZoneStart2 = new Date(currentDate.getFul" +
"lYear() + 1, 0, 1, 10, 0, 0);\r\n var hotZoneEnd2 = new Date(currentDat" +
"e.getFullYear() + 1, 11, 31, 10, 0, 0);\r\n //hotZoneEnd.setDate(hotZon" +
"eEnd.getDate() - 1);\r\n\r\n //hotZoneStart = hotZoneStart.toLocaleDateSt" +
"ring();\r\n //hotZoneEnd = hotZoneEnd.toLocaleDateString();\r\n\r\n\r\n " +
" var bandInfos = [\r\n Timeline.createHotZoneBandInfo({\r\n " +
" zones: [\r\n {\r\n start: h" +
"otZoneStart1,\r\n end: hotZoneEnd1,\r\n " +
" magnify: 4,\r\n unit: Timeline.DateTime.MONTH\r\n " +
" },\r\n {\r\n start: hotZoneStart" +
"2,\r\n end: hotZoneEnd2,\r\n magnify: " +
"4,\r\n unit: Timeline.DateTime.MONTH\r\n }" +
"\r\n ],\r\n eventSource: eventSource,\r\n " +
" width: \"85%\",\r\n intervalUnit: Timeline.DateTime." +
"YEAR,\r\n intervalPixels: 150,\r\n timeZone: 1" +
"0,\r\n date: sixMonthsDate\r\n }),\r\n " +
" Timeline.createBandInfo({\r\n eventSource: eventSource,\r\n " +
" width: \"15%\",\r\n intervalUnit: Timeline.DateTi" +
"me.YEAR,\r\n intervalPixels: 150,\r\n overview" +
": true,\r\n timeZone: 10,\r\n date: sixMonthsD" +
"ate\r\n })\r\n ];\r\n bandInfos[1].syncWith = 0;\r" +
"\n bandInfos[1].highlight = true;\r\n\r\n for (var i = 0; i < b" +
"andInfos.length; i++) {\r\n bandInfos[i].decorators = [\r\n " +
" new Timeline.SpanHighlightDecorator({\r\n startDa" +
"te: currentDate,\r\n endDate: tomorrowDate,\r\n " +
" color: \"#CC2222\",\r\n opacity: 50\r\n " +
" }),\r\n new Timeline.SpanHighlightDecorator({\r\n " +
" startDate: hotZoneStart1,\r\n endDate: hotZon" +
"eEnd1,\r\n color: \"#CEA5A5\",\r\n opaci" +
"ty: 50\r\n }),\r\n new Timeline.SpanHighlightD" +
"ecorator({\r\n startDate: hotZoneStart2,\r\n " +
" endDate: hotZoneEnd2,\r\n color: \"#CCB7B7\",\r\n " +
" opacity: 50\r\n })\r\n ];\r\n " +
" }\r\n\r\n tl = Timeline.create($(\'#deviceBatchesTimeline\')[0], band" +
"Infos);\r\n\r\n var tlResizeLayoutHandle = null;\r\n $(window).r" +
"esize(function () {\r\n if (tlResizeLayoutHandle)\r\n " +
" window.clearTimeout(tlResizeLayoutHandle);\r\n tlResizeLayoutHa" +
"ndle = window.setTimeout(function () {\r\n tlResizeLayoutHandle" +
" = null;\r\n tl.layout();\r\n }, 500);\r\n " +
" });\r\n\r\n // Load Events\r\n $.ajax({\r\n url: " +
"dataUrl,\r\n dataType: \'json\',\r\n type: \'POST\',\r\n " +
" success: function (data) {\r\n eventSource.loadJSON" +
"(data, dataUrl);\r\n },\r\n error: function (jqXHR, te" +
"xtStatus, errorThrown) {\r\n alert(\'Unable to load Timeline Dat" +
"a: \' + errorThrown);\r\n }\r\n });\r\n });\r\n\r\n })(" +
");\r\n\r\n</script>\r\n");
}
}
}
#pragma warning restore 1591
@@ -1,5 +1,5 @@
@model Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
}
@model Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
}
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model)
@@ -1,63 +1,63 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceModel
{
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("~/Areas/Config/Views/DeviceModel/GenericComponents.cshtml")]
public class GenericComponents : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel>
{
public GenericComponents()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model));
#line default
#line hidden
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceModel
{
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("~/Areas/Config/Views/DeviceModel/GenericComponents.cshtml")]
public class GenericComponents : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.DeviceComponentsModel>
{
public GenericComponents()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model));
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -1,46 +1,46 @@
@model Disco.Web.Areas.Config.Models.DeviceModel.IndexModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
}
<table class="tableData">
<tr>
<th>
Name/Description
</th>
<th>
Manufacturer
</th>
<th>
Model
</th>
<th>
Type
</th>
<th>
Device Count
</th>
</tr>
@foreach (var item in Model.DeviceModels)
{
<tr>
<td>
@Html.ActionLink(item.ToString(), MVC.Config.DeviceModel.Index(item.Id))
</td>
<td>
@Html.DisplayFor(modelItem => item.Manufacturer)
</td>
<td>
@Html.DisplayFor(modelItem => item.Model)
</td>
<td>
@Html.DisplayFor(modelItem => item.ModelType)
</td>
<td>
@item.DeviceCount.ToString("n0")
</td>
</tr>
}
</table>
<div class="actionBar">
@Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents())
@model Disco.Web.Areas.Config.Models.DeviceModel.IndexModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
}
<table class="tableData">
<tr>
<th>
Name/Description
</th>
<th>
Manufacturer
</th>
<th>
Model
</th>
<th>
Type
</th>
<th>
Device Count
</th>
</tr>
@foreach (var item in Model.DeviceModels)
{
<tr>
<td>
@Html.ActionLink(item.ToString(), MVC.Config.DeviceModel.Index(item.Id))
</td>
<td>
@Html.DisplayFor(modelItem => item.Manufacturer)
</td>
<td>
@Html.DisplayFor(modelItem => item.Model)
</td>
<td>
@Html.DisplayFor(modelItem => item.ModelType)
</td>
<td>
@item.DeviceCount.ToString("n0")
</td>
</tr>
}
</table>
<div class="actionBar">
@Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents())
</div>
@@ -1,173 +1,173 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceModel
{
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("~/Areas/Config/Views/DeviceModel/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(@">
<tr>
<th>
Name/Description
</th>
<th>
Manufacturer
</th>
<th>
Model
</th>
<th>
Type
</th>
<th>
Device Count
</th>
</tr>
");
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
foreach (var item in Model.DeviceModels)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLink(item.ToString(), MVC.Config.DeviceModel.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Manufacturer));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Model));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.ModelType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</table>\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 45 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents()));
#line default
#line hidden
WriteLiteral("\r\n</div>");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceModel
{
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("~/Areas/Config/Views/DeviceModel/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(@">
<tr>
<th>
Name/Description
</th>
<th>
Manufacturer
</th>
<th>
Model
</th>
<th>
Type
</th>
<th>
Device Count
</th>
</tr>
");
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
foreach (var item in Model.DeviceModels)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLink(item.ToString(), MVC.Config.DeviceModel.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Manufacturer));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Model));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.ModelType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</table>\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 45 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents()));
#line default
#line hidden
WriteLiteral("\r\n</div>");
}
}
}
#pragma warning restore 1591
@@ -1,205 +1,205 @@
@model Disco.Web.Areas.Config.Models.DeviceModel.ShowModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
}
<div class="form" style="width: 530px">
<table>
<tr>
<th style="width: 150px">
Id:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Id)
</td>
</tr>
<tr>
<th>
Description:
</th>
<td>@Html.EditorFor(model => model.DeviceModel.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
</td>
</tr>
<tr>
<th>
Manufacturer:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Manufacturer)
</td>
</tr>
<tr>
<th>
Model:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Model)
</td>
</tr>
<tr>
<th>
Default Purchase Date:
</th>
<td>
@Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate)
@AjaxHelpers.AjaxLoader()
</td>
</tr>
<tr>
<th>
Default Warranty Provider:
</th>
<td>
@Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None"))
@AjaxHelpers.AjaxLoader()
</td>
</tr>
<tr>
<th>
Type:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.ModelType)
</td>
</tr>
<tr>
<th>
Image:
</th>
<td>
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))" />
</td>
</tr>
<tr>
<th>
<label for="DeviceModel_Image">
Update Image:
</label>
</th>
<td>
@using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="Image" id="Image" style="width: 250px;" />
<input class="button" type="submit" value="Update" />
}
</td>
</tr>
</table>
<script type="text/javascript">
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
<script type="text/javascript">
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('@(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
<script type="text/javascript">
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
</div>
<h2>
Components</h2>
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel)
<div class="actionBar">
@if (Model.CanDelete)
{
@Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete")
}
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
</div>
@model Disco.Web.Areas.Config.Models.DeviceModel.ShowModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
}
<div class="form" style="width: 530px">
<table>
<tr>
<th style="width: 150px">
Id:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Id)
</td>
</tr>
<tr>
<th>
Description:
</th>
<td>@Html.EditorFor(model => model.DeviceModel.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
</td>
</tr>
<tr>
<th>
Manufacturer:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Manufacturer)
</td>
</tr>
<tr>
<th>
Model:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Model)
</td>
</tr>
<tr>
<th>
Default Purchase Date:
</th>
<td>
@Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate)
@AjaxHelpers.AjaxLoader()
</td>
</tr>
<tr>
<th>
Default Warranty Provider:
</th>
<td>
@Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None"))
@AjaxHelpers.AjaxLoader()
</td>
</tr>
<tr>
<th>
Type:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.ModelType)
</td>
</tr>
<tr>
<th>
Image:
</th>
<td>
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))" />
</td>
</tr>
<tr>
<th>
<label for="DeviceModel_Image">
Update Image:
</label>
</th>
<td>
@using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="Image" id="Image" style="width: 250px;" />
<input class="button" type="submit" value="Update" />
}
</td>
</tr>
</table>
<script type="text/javascript">
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
<script type="text/javascript">
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('@(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
<script type="text/javascript">
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
</div>
<h2>
Components</h2>
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel)
<div class="actionBar">
@if (Model.CanDelete)
{
@Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete")
}
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
</div>
@@ -1,458 +1,458 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceModel
{
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("~/Areas/Config/Views/DeviceModel/Show.cshtml")]
public class Show : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ShowModel>
{
public Show()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 150px\"");
WriteLiteral(">\r\n Id:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 12 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Id));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Description:\r\n </th>\r\n <td>");
#line 19 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.EditorFor(model => model.DeviceModel.Description));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 20 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 21 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Manufacturer:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 29 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Manufacturer));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Model:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 37 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Model));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Default Purchase Date:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 45 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 46 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Default Warranty Provider:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None")));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 55 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Type:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 63 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.ModelType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Image:\r\n </th>\r\n <td>\r\n <img");
WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2151), Tuple.Create("\"", 2248)
#line 71 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
, Tuple.Create(Tuple.Create("", 2157), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))
#line default
#line hidden
, 2157), false)
);
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" <label");
WriteLiteral(" for=\"DeviceModel_Image\"");
WriteLiteral(">\r\n Update Image:\r\n </label>\r\n </th>" +
"\r\n <td>\r\n");
#line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" type=\"file\"");
WriteLiteral(" name=\"Image\"");
WriteLiteral(" id=\"Image\"");
WriteLiteral(" style=\"width: 250px;\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <input");
WriteLiteral(" class=\"button\"");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" value=\"Update\"");
WriteLiteral(" />\r\n");
#line 85 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '");
#line 109 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('");
#line 151 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '");
#line 176 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
</div>
<h2>
Components</h2>
");
#line 198 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel));
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 200 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 200 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (Model.CanDelete)
{
#line default
#line hidden
#line 202 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete"));
#line default
#line hidden
#line 202 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 204 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceModel
{
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("~/Areas/Config/Views/DeviceModel/Show.cshtml")]
public class Show : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ShowModel>
{
public Show()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 150px\"");
WriteLiteral(">\r\n Id:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 12 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Id));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Description:\r\n </th>\r\n <td>");
#line 19 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.EditorFor(model => model.DeviceModel.Description));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 20 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 21 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Manufacturer:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 29 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Manufacturer));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Model:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 37 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Model));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Default Purchase Date:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 45 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 46 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Default Warranty Provider:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None")));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 55 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Type:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 63 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.ModelType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Image:\r\n </th>\r\n <td>\r\n <img");
WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2151), Tuple.Create("\"", 2248)
#line 71 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
, Tuple.Create(Tuple.Create("", 2157), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))
#line default
#line hidden
, 2157), false)
);
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" <label");
WriteLiteral(" for=\"DeviceModel_Image\"");
WriteLiteral(">\r\n Update Image:\r\n </label>\r\n </th>" +
"\r\n <td>\r\n");
#line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" type=\"file\"");
WriteLiteral(" name=\"Image\"");
WriteLiteral(" id=\"Image\"");
WriteLiteral(" style=\"width: 250px;\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <input");
WriteLiteral(" class=\"button\"");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" value=\"Update\"");
WriteLiteral(" />\r\n");
#line 85 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '");
#line 109 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('");
#line 151 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
<script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '");
#line 176 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
</div>
<h2>
Components</h2>
");
#line 198 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel));
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 200 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 200 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (Model.CanDelete)
{
#line default
#line hidden
#line 202 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete"));
#line default
#line hidden
#line 202 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 204 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -1,43 +1,43 @@
@model Disco.Models.Repository.DeviceProfile
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create");
}
@using (Html.BeginForm())
{
<div class="form" style="width: 450px">
<table>
<tr>
<th>
Name:
</th>
<td>
@Html.TextBoxFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
</td>
</tr>
<tr>
<th>
Short Name:
</th>
<td>@Html.TextBoxFor(model => model.ShortName)<br />@Html.ValidationMessageFor(model => model.ShortName)
</td>
</tr>
<tr>
<th>
Description:
</th>
<td>@Html.TextBoxFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
</td>
</tr>
</table>
<input type="hidden" name="ComputerNameTemplate" value="DeviceProfile.ShortName + '-' + SerialNumber" />
<input type="hidden" name="ProvisionADAccount" value="True" />
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
</div>
<script type="text/javascript">
$(function () {
$('#Name').focus().select();
});
</script>
}
@model Disco.Models.Repository.DeviceProfile
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create");
}
@using (Html.BeginForm())
{
<div class="form" style="width: 450px">
<table>
<tr>
<th>
Name:
</th>
<td>
@Html.TextBoxFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
</td>
</tr>
<tr>
<th>
Short Name:
</th>
<td>@Html.TextBoxFor(model => model.ShortName)<br />@Html.ValidationMessageFor(model => model.ShortName)
</td>
</tr>
<tr>
<th>
Description:
</th>
<td>@Html.TextBoxFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
</td>
</tr>
</table>
<input type="hidden" name="ComputerNameTemplate" value="DeviceProfile.ShortName + '-' + SerialNumber" />
<input type="hidden" name="ProvisionADAccount" value="True" />
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
</div>
<script type="text/javascript">
$(function () {
$('#Name').focus().select();
});
</script>
}
@@ -1,174 +1,174 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/Create.cshtml")]
public class Create : System.Web.Mvc.WebViewPage<Disco.Models.Repository.DeviceProfile>
{
public Create()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
"ame:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.Name));
#line default
#line hidden
WriteLiteral("<br />");
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.Name));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Short Name:\r\n </th>\r\n <td>");
#line 21 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.ShortName));
#line default
#line hidden
WriteLiteral("<br />");
#line 21 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.ShortName));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Description:\r\n </th>\r\n <td>" +
"");
#line 28 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.Description));
#line default
#line hidden
WriteLiteral("<br />");
#line 28 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.Description));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <input");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"ComputerNameTemplate\"");
WriteLiteral(" value=\"DeviceProfile.ShortName + \'-\' + SerialNumber\"");
WriteLiteral(" />\r\n <input");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"ProvisionADAccount\"");
WriteLiteral(" value=\"True\"");
WriteLiteral(" />\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Create\"");
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" +
"\r\n </script>\r\n");
#line 43 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/Create.cshtml")]
public class Create : System.Web.Mvc.WebViewPage<Disco.Models.Repository.DeviceProfile>
{
public Create()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
"ame:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.Name));
#line default
#line hidden
WriteLiteral("<br />");
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.Name));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Short Name:\r\n </th>\r\n <td>");
#line 21 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.ShortName));
#line default
#line hidden
WriteLiteral("<br />");
#line 21 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.ShortName));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">\r\n Description:\r\n </th>\r\n <td>" +
"");
#line 28 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.Description));
#line default
#line hidden
WriteLiteral("<br />");
#line 28 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.Description));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <input");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"ComputerNameTemplate\"");
WriteLiteral(" value=\"DeviceProfile.ShortName + \'-\' + SerialNumber\"");
WriteLiteral(" />\r\n <input");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"ProvisionADAccount\"");
WriteLiteral(" value=\"True\"");
WriteLiteral(" />\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Create\"");
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" +
"\r\n </script>\r\n");
#line 43 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -1,60 +1,60 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
}
<div class="form" style="width: 600px">
<table>
<tr>
<th class="name" style="width: 230px">
Default Profile:
</th>
<td class="value">
@Html.DropDownListFor(m => m.Default, Model.DeviceProfiles.ToSelectListItems(Model.Default))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#Default').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.Default()))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
<tr>
<th class="name">
Default Add Device Offline Profile:
</th>
<td class="value">
@Html.DropDownListFor(m => m.DefaultAddDeviceOffline, Model.DeviceProfilesAndNone.ToSelectListItems(Model.DefaultAddDeviceOffline))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DefaultAddDeviceOffline').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Add Device Offline Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
</table>
</div>
@model Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
}
<div class="form" style="width: 600px">
<table>
<tr>
<th class="name" style="width: 230px">
Default Profile:
</th>
<td class="value">
@Html.DropDownListFor(m => m.Default, Model.DeviceProfiles.ToSelectListItems(Model.Default))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#Default').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.Default()))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
<tr>
<th class="name">
Default Add Device Offline Profile:
</th>
<td class="value">
@Html.DropDownListFor(m => m.DefaultAddDeviceOffline, Model.DeviceProfilesAndNone.ToSelectListItems(Model.DefaultAddDeviceOffline))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DefaultAddDeviceOffline').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Add Device Offline Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
</table>
</div>
@@ -1,192 +1,192 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/Defaults.cshtml")]
public class Defaults : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel>
{
public Defaults()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 600px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" class=\"name\"");
WriteLiteral(" style=\"width: 230px\"");
WriteLiteral(">\r\n Default Profile:\r\n </th>\r\n <td");
WriteLiteral(" class=\"value\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 12 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Html.DropDownListFor(m => m.Default, Model.DeviceProfiles.ToSelectListItems(Model.Default)));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 13 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#Default').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('");
#line 20 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.Default()));
#line default
#line hidden
WriteLiteral(@"', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
<tr>
<th");
WriteLiteral(" class=\"name\"");
WriteLiteral(">\r\n Default Add Device Offline Profile:\r\n </th>\r\n " +
" <td");
WriteLiteral(" class=\"value\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Html.DropDownListFor(m => m.DefaultAddDeviceOffline, Model.DeviceProfilesAndNone.ToSelectListItems(Model.DefaultAddDeviceOffline)));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#DefaultAddDeviceOffline').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('");
#line 46 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()));
#line default
#line hidden
WriteLiteral(@"', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Add Device Offline Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
</table>
</div>
");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/Defaults.cshtml")]
public class Defaults : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel>
{
public Defaults()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 600px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" class=\"name\"");
WriteLiteral(" style=\"width: 230px\"");
WriteLiteral(">\r\n Default Profile:\r\n </th>\r\n <td");
WriteLiteral(" class=\"value\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 12 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Html.DropDownListFor(m => m.Default, Model.DeviceProfiles.ToSelectListItems(Model.Default)));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 13 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#Default').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('");
#line 20 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.Default()));
#line default
#line hidden
WriteLiteral(@"', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
<tr>
<th");
WriteLiteral(" class=\"name\"");
WriteLiteral(">\r\n Default Add Device Offline Profile:\r\n </th>\r\n " +
" <td");
WriteLiteral(" class=\"value\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Html.DropDownListFor(m => m.DefaultAddDeviceOffline, Model.DeviceProfilesAndNone.ToSelectListItems(Model.DefaultAddDeviceOffline)));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#DefaultAddDeviceOffline').change(function () {
$this = $(this);
$ajaxLoading = $this.next('.ajaxLoading').show();
var data = { id: $this.val() };
$.getJSON('");
#line 46 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()));
#line default
#line hidden
WriteLiteral(@"', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Default Add Device Offline Device Profile:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
</script>
</td>
</tr>
</table>
</div>
");
}
}
}
#pragma warning restore 1591
@@ -1,9 +1,9 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles");
}
@Html.Partial(MVC.Config.DeviceProfile.Views._Table, Model, new ViewDataDictionary())
<div class="actionBar">
@Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults())
@Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create())
</div>
@model Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel
@{
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles");
}
@Html.Partial(MVC.Config.DeviceProfile.Views._Table, Model, new ViewDataDictionary())
<div class="actionBar">
@Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults())
@Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create())
</div>
@@ -1,91 +1,91 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._Table, Model, new ViewDataDictionary()));
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults()));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 8 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create()));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles");
#line default
#line hidden
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._Table, Model, new ViewDataDictionary()));
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults()));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 8 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create()));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,15 +1,15 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel
@if (DiscoApplication.MultiSiteMode)
{
var deviceProfilesGrouped = Model.DeviceProfiles.OrderBy(i => i.AddressName).GroupBy(i => i.AddressName);
foreach (var deviceProfilesGroup in deviceProfilesGrouped)
{
if (deviceProfilesGroup.Key != null)
{ <h2>@deviceProfilesGroup.Key</h2> }
@Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, deviceProfilesGroup, new ViewDataDictionary())
}
}
else
{
@Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, Model.DeviceProfiles, new ViewDataDictionary())
}
@model Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel
@if (DiscoApplication.MultiSiteMode)
{
var deviceProfilesGrouped = Model.DeviceProfiles.OrderBy(i => i.AddressName).GroupBy(i => i.AddressName);
foreach (var deviceProfilesGroup in deviceProfilesGrouped)
{
if (deviceProfilesGroup.Key != null)
{ <h2>@deviceProfilesGroup.Key</h2> }
@Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, deviceProfilesGroup, new ViewDataDictionary())
}
}
else
{
@Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, Model.DeviceProfiles, new ViewDataDictionary())
}
@@ -1,109 +1,109 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/_Table.cshtml")]
public class Table : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
{
public Table()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
if (DiscoApplication.MultiSiteMode)
{
var deviceProfilesGrouped = Model.DeviceProfiles.OrderBy(i => i.AddressName).GroupBy(i => i.AddressName);
foreach (var deviceProfilesGroup in deviceProfilesGrouped)
{
if (deviceProfilesGroup.Key != null)
{
#line default
#line hidden
WriteLiteral(" <h2>");
#line 8 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(deviceProfilesGroup.Key);
#line default
#line hidden
WriteLiteral("</h2> ");
#line 8 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, deviceProfilesGroup, new ViewDataDictionary()));
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
}
else
{
#line default
#line hidden
#line 14 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, Model.DeviceProfiles, new ViewDataDictionary()));
#line default
#line hidden
#line 14 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/_Table.cshtml")]
public class Table : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
{
public Table()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
if (DiscoApplication.MultiSiteMode)
{
var deviceProfilesGrouped = Model.DeviceProfiles.OrderBy(i => i.AddressName).GroupBy(i => i.AddressName);
foreach (var deviceProfilesGroup in deviceProfilesGrouped)
{
if (deviceProfilesGroup.Key != null)
{
#line default
#line hidden
WriteLiteral(" <h2>");
#line 8 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(deviceProfilesGroup.Key);
#line default
#line hidden
WriteLiteral("</h2> ");
#line 8 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, deviceProfilesGroup, new ViewDataDictionary()));
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
}
else
{
#line default
#line hidden
#line 14 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, Model.DeviceProfiles, new ViewDataDictionary()));
#line default
#line hidden
#line 14 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -1,39 +1,39 @@
@model IEnumerable<Disco.Web.Areas.Config.Models.DeviceProfile._IndexModelDeviceProfile>
<table class="tableData deviceProfileTable">
<tr>
<th class="name">
Name
</th>
<th class="description">
Description
</th>
<th class="type">
Type
</th>
<th class="deviceCount">
Device Count
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceProfile.Index(item.Id))
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.DistributionType)
</td>
<td>
@item.DeviceCount.ToString("n0")
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount) Decommissioned">
(@(item.DeviceDecommissionedCount))</span>
}
</td>
</tr>
}
</table>
@model IEnumerable<Disco.Web.Areas.Config.Models.DeviceProfile._IndexModelDeviceProfile>
<table class="tableData deviceProfileTable">
<tr>
<th class="name">
Name
</th>
<th class="description">
Description
</th>
<th class="type">
Type
</th>
<th class="deviceCount">
Device Count
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceProfile.Index(item.Id))
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.DistributionType)
</td>
<td>
@item.DeviceCount.ToString("n0")
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount) Decommissioned">
(@(item.DeviceDecommissionedCount))</span>
}
</td>
</tr>
}
</table>
@@ -1,186 +1,186 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/_TableRender.cshtml")]
public class TableRender : System.Web.Mvc.WebViewPage<IEnumerable<Disco.Web.Areas.Config.Models.DeviceProfile._IndexModelDeviceProfile>>
{
public TableRender()
{
}
public override void Execute()
{
WriteLiteral("<table");
WriteLiteral(" class=\"tableData deviceProfileTable\"");
WriteLiteral(">\r\n <tr>\r\n <th");
WriteLiteral(" class=\"name\"");
WriteLiteral(">\r\n Name\r\n </th>\r\n <th");
WriteLiteral(" class=\"description\"");
WriteLiteral(">\r\n Description\r\n </th>\r\n <th");
WriteLiteral(" class=\"type\"");
WriteLiteral(">\r\n Type\r\n </th>\r\n <th");
WriteLiteral(" class=\"deviceCount\"");
WriteLiteral(">\r\n Device Count\r\n </th>\r\n </tr>\r\n");
#line 17 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
foreach (var item in Model)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 21 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceProfile.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 24 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.DisplayFor(modelItem => item.Description));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.DisplayFor(modelItem => item.DistributionType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("\r\n");
#line 31 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 31 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1005), Tuple.Create("\"", 1061)
#line 33 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
, Tuple.Create(Tuple.Create("", 1013), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
#line default
#line hidden
, 1013), false)
, Tuple.Create(Tuple.Create(" ", 1046), Tuple.Create("Decommissioned", 1047), true)
);
WriteLiteral(">\r\n (");
#line 34 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceDecommissionedCount);
#line default
#line hidden
WriteLiteral(")</span>\r\n");
#line 35 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
#line default
#line hidden
WriteLiteral("</table>\r\n");
}
}
}
#pragma warning restore 1591
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
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("~/Areas/Config/Views/DeviceProfile/_TableRender.cshtml")]
public class TableRender : System.Web.Mvc.WebViewPage<IEnumerable<Disco.Web.Areas.Config.Models.DeviceProfile._IndexModelDeviceProfile>>
{
public TableRender()
{
}
public override void Execute()
{
WriteLiteral("<table");
WriteLiteral(" class=\"tableData deviceProfileTable\"");
WriteLiteral(">\r\n <tr>\r\n <th");
WriteLiteral(" class=\"name\"");
WriteLiteral(">\r\n Name\r\n </th>\r\n <th");
WriteLiteral(" class=\"description\"");
WriteLiteral(">\r\n Description\r\n </th>\r\n <th");
WriteLiteral(" class=\"type\"");
WriteLiteral(">\r\n Type\r\n </th>\r\n <th");
WriteLiteral(" class=\"deviceCount\"");
WriteLiteral(">\r\n Device Count\r\n </th>\r\n </tr>\r\n");
#line 17 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
foreach (var item in Model)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 21 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceProfile.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 24 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.DisplayFor(modelItem => item.Description));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.DisplayFor(modelItem => item.DistributionType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
WriteLiteral("\r\n");
#line 31 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 31 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1005), Tuple.Create("\"", 1061)
#line 33 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
, Tuple.Create(Tuple.Create("", 1013), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
#line default
#line hidden
, 1013), false)
, Tuple.Create(Tuple.Create(" ", 1046), Tuple.Create("Decommissioned", 1047), true)
);
WriteLiteral(">\r\n (");
#line 34 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceDecommissionedCount);
#line default
#line hidden
WriteLiteral(")</span>\r\n");
#line 35 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
#line default
#line hidden
WriteLiteral("</table>\r\n");
}
}
}
#pragma warning restore 1591

Some files were not shown because too many files have changed in this diff Show More