@@ -140,5 +140,23 @@ namespace Disco.BI.Extensions
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyBattery, Battery);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Keyboard
|
||||
/// <summary>
|
||||
/// Gets the Keyboard Device Detail Value
|
||||
/// </summary>
|
||||
/// <returns>The Keyboard or null</returns>
|
||||
public static string Keyboard(this IEnumerable<DeviceDetail> details)
|
||||
{
|
||||
return details.GetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyKeyboard);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the Keyboard Device Detail Value
|
||||
/// </summary>
|
||||
public static void Keyboard(this IEnumerable<DeviceDetail> details, Device device, string Keyboard)
|
||||
{
|
||||
device.SetDetail(DeviceDetail.ScopeHardware, DeviceDetail.HardwareKeyKeyboard, Keyboard);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Disco.Models.Repository
|
||||
public const string HardwareKeyWLanMacAddress = "WLanMacAddress";
|
||||
public const string HardwareKeyACAdapter = "ACAdapter";
|
||||
public const string HardwareKeyBattery = "Battery";
|
||||
public const string HardwareKeyKeyboard = "Keyboard";
|
||||
|
||||
[Column(Order = 0), Key]
|
||||
public string DeviceSerialNumber { get; set; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Models.Services.Devices.Importing;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Devices.Exporting;
|
||||
@@ -28,6 +29,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
const string pAllowUnauthenticatedEnrol = "allowunauthenticatedenrol";
|
||||
const string pDetailACAdapter = "detailacadapter";
|
||||
const string pDetailBattery = "detailbattery";
|
||||
const string pDetailKeyboard = "detailkeyboard";
|
||||
|
||||
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
||||
{
|
||||
@@ -76,6 +78,10 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
Authorization.Require(Claims.Device.Properties.Details);
|
||||
UpdateDetailBattery(device, value);
|
||||
break;
|
||||
case pDetailKeyboard:
|
||||
Authorization.Require(Claims.Device.Properties.Details);
|
||||
UpdateDetailKeyboard(device, value);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Invalid Update Key");
|
||||
}
|
||||
@@ -156,10 +162,16 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return Update(id, pDetailBattery, DetailBattery, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Device.Properties.Details)]
|
||||
public virtual ActionResult UpdateDetailKeyboard(string id, string DetailKeyboard = null, bool redirect = false)
|
||||
{
|
||||
return Update(id, pDetailKeyboard, DetailKeyboard, redirect);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Update Properties
|
||||
private void UpdateDeviceProfileId(Disco.Models.Repository.Device device, string DeviceProfileId)
|
||||
private void UpdateDeviceProfileId(Device device, string DeviceProfileId)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(DeviceProfileId))
|
||||
{
|
||||
@@ -187,7 +199,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
throw new Exception("Invalid Device Profile Id");
|
||||
}
|
||||
private void UpdateDeviceBatchId(Disco.Models.Repository.Device device, string DeviceBatchId)
|
||||
private void UpdateDeviceBatchId(Device device, string DeviceBatchId)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(DeviceBatchId))
|
||||
{
|
||||
@@ -216,7 +228,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
throw new Exception("Invalid Device Batch Id");
|
||||
}
|
||||
private void UpdateAssetNumber(Disco.Models.Repository.Device device, string AssetNumber)
|
||||
private void UpdateAssetNumber(Device device, string AssetNumber)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(AssetNumber))
|
||||
device.AssetNumber = null;
|
||||
@@ -224,7 +236,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
device.AssetNumber = AssetNumber.Trim();
|
||||
Database.SaveChanges();
|
||||
}
|
||||
private void UpdateLocation(Disco.Models.Repository.Device device, string Location)
|
||||
private void UpdateLocation(Device device, string Location)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Location))
|
||||
device.Location = null;
|
||||
@@ -232,10 +244,10 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
device.Location = Location.Trim();
|
||||
Database.SaveChanges();
|
||||
}
|
||||
private void UpdateAssignedUserId(Disco.Models.Repository.Device device, string UserId)
|
||||
private void UpdateAssignedUserId(Device device, string UserId)
|
||||
{
|
||||
var daus = Database.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == device.SerialNumber && m.UnassignedDate == null);
|
||||
Disco.Models.Repository.User u = null;
|
||||
User u = null;
|
||||
if (!string.IsNullOrEmpty(UserId))
|
||||
{
|
||||
u = UserService.GetUser(UserId, Database, true);
|
||||
@@ -247,7 +259,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
device.AssignDevice(Database, u);
|
||||
Database.SaveChanges();
|
||||
}
|
||||
private void UpdateAllowUnauthenticatedEnrol(Disco.Models.Repository.Device device, string AllowUnauthenticatedEnrol)
|
||||
private void UpdateAllowUnauthenticatedEnrol(Device device, string AllowUnauthenticatedEnrol)
|
||||
{
|
||||
bool bAllowUnauthenticatedEnrol;
|
||||
if (string.IsNullOrEmpty(AllowUnauthenticatedEnrol) || !bool.TryParse(AllowUnauthenticatedEnrol, out bAllowUnauthenticatedEnrol))
|
||||
@@ -261,7 +273,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
Database.SaveChanges();
|
||||
}
|
||||
}
|
||||
private void UpdateDetailACAdapter(Disco.Models.Repository.Device device, string ACAdapter)
|
||||
private void UpdateDetailACAdapter(Device device, string ACAdapter)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ACAdapter))
|
||||
device.DeviceDetails.ACAdapter(device, null);
|
||||
@@ -269,7 +281,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
device.DeviceDetails.ACAdapter(device, ACAdapter.Trim());
|
||||
Database.SaveChanges();
|
||||
}
|
||||
private void UpdateDetailBattery(Disco.Models.Repository.Device device, string Battery)
|
||||
private void UpdateDetailBattery(Device device, string Battery)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Battery))
|
||||
device.DeviceDetails.Battery(device, null);
|
||||
@@ -277,6 +289,14 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
device.DeviceDetails.Battery(device, Battery.Trim());
|
||||
Database.SaveChanges();
|
||||
}
|
||||
private void UpdateDetailKeyboard(Device device, string Keyboard)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Keyboard))
|
||||
device.DeviceDetails.Keyboard(device, null);
|
||||
else
|
||||
device.DeviceDetails.Keyboard(device, Keyboard.Trim());
|
||||
Database.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Device Actions
|
||||
@@ -290,7 +310,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
if (d.CanDecommission())
|
||||
{
|
||||
d.OnDecommission((Disco.Models.Repository.DecommissionReasons)Reason);
|
||||
d.OnDecommission((DecommissionReasons)Reason);
|
||||
|
||||
Database.SaveChanges();
|
||||
if (redirect)
|
||||
@@ -472,7 +492,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.OrdinalIgnoreCase))
|
||||
contentType = BI.Interop.MimeTypes.ResolveMimeType(file.FileName);
|
||||
|
||||
var da = new Disco.Models.Repository.DeviceAttachment()
|
||||
var da = new DeviceAttachment()
|
||||
{
|
||||
DeviceSerialNumber = d.SerialNumber,
|
||||
TechUserId = UserService.CurrentUserId,
|
||||
|
||||
+35
-2
@@ -300,7 +300,8 @@ namespace Links
|
||||
private const string URLPATH = "~/ClientSource/Scripts/Modules/jQuery-SignalR";
|
||||
public static string Url() { return T4MVCHelpers.ProcessVirtualPath(URLPATH); }
|
||||
public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(URLPATH + "/" + fileName); }
|
||||
public static readonly string jquery_signalR_1_1_2_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery.signalR-1.1.2.min.js") ? Url("jquery.signalR-1.1.2.min.js") : Url("jquery.signalR-1.1.2.js");
|
||||
public static readonly string disco_hubs_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/disco-hubs.min.js") ? Url("disco-hubs.min.js") : Url("disco-hubs.js");
|
||||
public static readonly string jquery_signalR_2_0_3_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery.signalR-2.0.3.min.js") ? Url("jquery.signalR-2.0.3.min.js") : Url("jquery.signalR-2.0.3.js");
|
||||
}
|
||||
|
||||
public static readonly string jQuery_SignalR_js_bundle = Url("jQuery-SignalR.js.bundle");
|
||||
@@ -336,7 +337,7 @@ namespace Links
|
||||
private const string URLPATH = "~/ClientSource/Scripts/Modules/Knockout";
|
||||
public static string Url() { return T4MVCHelpers.ProcessVirtualPath(URLPATH); }
|
||||
public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(URLPATH + "/" + fileName); }
|
||||
public static readonly string knockout_2_3_0_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/knockout-2.3.0.min.js") ? Url("knockout-2.3.0.min.js") : Url("knockout-2.3.0.js");
|
||||
public static readonly string knockout_3_1_0_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/knockout-3.1.0.min.js") ? Url("knockout-3.1.0.min.js") : Url("knockout-3.1.0.js");
|
||||
}
|
||||
|
||||
public static readonly string Knockout_js_bundle = Url("Knockout.js.bundle");
|
||||
@@ -3549,6 +3550,12 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
[NonAction]
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public virtual System.Web.Mvc.ActionResult UpdateDetailKeyboard()
|
||||
{
|
||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDetailKeyboard);
|
||||
}
|
||||
[NonAction]
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public virtual System.Web.Mvc.ActionResult Decommission()
|
||||
{
|
||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Decommission);
|
||||
@@ -3668,6 +3675,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
public readonly string UpdateAllowUnauthenticatedEnrol = "UpdateAllowUnauthenticatedEnrol";
|
||||
public readonly string UpdateDetailACAdapter = "UpdateDetailACAdapter";
|
||||
public readonly string UpdateDetailBattery = "UpdateDetailBattery";
|
||||
public readonly string UpdateDetailKeyboard = "UpdateDetailKeyboard";
|
||||
public readonly string Decommission = "Decommission";
|
||||
public readonly string Recommission = "Recommission";
|
||||
public readonly string Delete = "Delete";
|
||||
@@ -3699,6 +3707,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
public const string UpdateAllowUnauthenticatedEnrol = "UpdateAllowUnauthenticatedEnrol";
|
||||
public const string UpdateDetailACAdapter = "UpdateDetailACAdapter";
|
||||
public const string UpdateDetailBattery = "UpdateDetailBattery";
|
||||
public const string UpdateDetailKeyboard = "UpdateDetailKeyboard";
|
||||
public const string Decommission = "Decommission";
|
||||
public const string Recommission = "Recommission";
|
||||
public const string Delete = "Delete";
|
||||
@@ -3811,6 +3820,16 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
public readonly string DetailBattery = "DetailBattery";
|
||||
public readonly string redirect = "redirect";
|
||||
}
|
||||
static readonly ActionParamsClass_UpdateDetailKeyboard s_params_UpdateDetailKeyboard = new ActionParamsClass_UpdateDetailKeyboard();
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public ActionParamsClass_UpdateDetailKeyboard UpdateDetailKeyboardParams { get { return s_params_UpdateDetailKeyboard; } }
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public class ActionParamsClass_UpdateDetailKeyboard
|
||||
{
|
||||
public readonly string id = "id";
|
||||
public readonly string DetailKeyboard = "DetailKeyboard";
|
||||
public readonly string redirect = "redirect";
|
||||
}
|
||||
static readonly ActionParamsClass_Decommission s_params_Decommission = new ActionParamsClass_Decommission();
|
||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||
public ActionParamsClass_Decommission DecommissionParams { get { return s_params_Decommission; } }
|
||||
@@ -4076,6 +4095,18 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return callInfo;
|
||||
}
|
||||
|
||||
partial void UpdateDetailKeyboardOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, string DetailKeyboard, bool redirect);
|
||||
|
||||
public override System.Web.Mvc.ActionResult UpdateDetailKeyboard(string id, string DetailKeyboard, bool redirect)
|
||||
{
|
||||
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDetailKeyboard);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DetailKeyboard", DetailKeyboard);
|
||||
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
|
||||
UpdateDetailKeyboardOverride(callInfo, id, DetailKeyboard, redirect);
|
||||
return callInfo;
|
||||
}
|
||||
|
||||
partial void DecommissionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, int Reason, bool redirect);
|
||||
|
||||
public override System.Web.Mvc.ActionResult Decommission(string id, int Reason, bool redirect)
|
||||
@@ -11592,8 +11623,10 @@ namespace T4MVC.Config
|
||||
public class _ViewNamesClass
|
||||
{
|
||||
public readonly string LogEvents = "LogEvents";
|
||||
public readonly string TaskStatus = "TaskStatus";
|
||||
}
|
||||
public readonly string LogEvents = "~/Areas/Config/Views/Shared/LogEvents.cshtml";
|
||||
public readonly string TaskStatus = "~/Areas/Config/Views/Shared/TaskStatus.cshtml";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,23 @@
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Keyboard</th>
|
||||
<td>@if (canConfig)
|
||||
{
|
||||
@Html.TextBox("DeviceDetail_Keyboard", Model.Device.DeviceDetails.Keyboard()) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
|
||||
<script>
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper($('#DeviceDetail_Keyboard'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateDetailKeyboard(Model.Device.SerialNumber, null))', 'DetailKeyboard');
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
@(Model.Device.DeviceDetails.Keyboard() ?? "Unknown")
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -277,6 +277,95 @@ WriteLiteral("\', \'DetailBattery\');\r\n });\r\n
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n " +
|
||||
" <th>Keyboard</th>\r\n <td>");
|
||||
|
||||
|
||||
#line 60 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
if (canConfig)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 62 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
Write(Html.TextBox("DeviceDetail_Keyboard", Model.Device.DeviceDetails.Keyboard()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 62 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 62 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
Write(AjaxHelpers.AjaxSave());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 62 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 62 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 62 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <script>\r\n $(function () {\r\n " +
|
||||
" document.DiscoFunctions.PropertyChangeHelper($(\'#D" +
|
||||
"eviceDetail_Keyboard\'), \'Unknown\', \'");
|
||||
|
||||
|
||||
#line 65 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.UpdateDetailKeyboard(Model.Device.SerialNumber, null)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\', \'DetailKeyboard\');\r\n });\r\n <" +
|
||||
"/script>\r\n");
|
||||
|
||||
|
||||
#line 68 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 71 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
Write(Model.Device.DeviceDetails.Keyboard() ?? "Unknown");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 71 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n </tr>\r\n </tbody>\r\n <" +
|
||||
|
||||
Reference in New Issue
Block a user