c528a2be26
Only updates the text-box with the user id (instead of the full name), to avoid users not correctly selecting a item from the auto-complete list and then trying to submit the form.
540 lines
16 KiB
C#
540 lines
16 KiB
C#
#pragma warning disable 1591
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version:4.0.30319.34014
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace Disco.Web.Views.Device
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Helpers;
|
|
using System.Web.Mvc;
|
|
using System.Web.Mvc.Ajax;
|
|
using System.Web.Mvc.Html;
|
|
using System.Web.Routing;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.WebPages;
|
|
using Disco;
|
|
using Disco.BI.Extensions;
|
|
using Disco.Models.Repository;
|
|
using Disco.Services;
|
|
using Disco.Services.Authorization;
|
|
using Disco.Services.Web;
|
|
using Disco.Web;
|
|
using Disco.Web.Extensions;
|
|
|
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
|
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/AddOffline.cshtml")]
|
|
public partial class AddOffline : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.AddOfflineModel>
|
|
{
|
|
public AddOffline()
|
|
{
|
|
}
|
|
public override void Execute()
|
|
{
|
|
|
|
#line 2 "..\..\Views\Device\AddOffline.cshtml"
|
|
|
|
Authorization.Require(Claims.Device.Actions.EnrolDevices);
|
|
|
|
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Add Offline");
|
|
|
|
var hasAssetNumber = Authorization.Has(Claims.Device.Properties.AssetNumber);
|
|
var hasLocation = Authorization.Has(Claims.Device.Properties.Location);
|
|
var hasDeviceBatch = Authorization.Has(Claims.Device.Properties.DeviceBatch);
|
|
var hasDeviceProfile = Authorization.Has(Claims.Device.Properties.DeviceProfile);
|
|
var hasAssignUser = Authorization.Has(Claims.Device.Actions.AssignUser);
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
|
|
#line 14 "..\..\Views\Device\AddOffline.cshtml"
|
|
using (Html.BeginForm())
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 16 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.ValidationSummary(true));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 16 "..\..\Views\Device\AddOffline.cshtml"
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" class=\"form\"");
|
|
|
|
WriteLiteral(" style=\"width: 450px\"");
|
|
|
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>Serial Number:\r\n " +
|
|
" </th>\r\n <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 23 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.TextBoxFor(model => model.Device.SerialNumber));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<br />\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 24 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.ValidationMessageFor(model => model.Device.SerialNumber));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 27 "..\..\Views\Device\AddOffline.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 27 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasAssetNumber)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <th>Asset Number:\r\n " +
|
|
"</th>\r\n <td>");
|
|
|
|
|
|
#line 32 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.TextBoxFor(model => model.Device.AssetNumber));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<br />\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 33 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.ValidationMessageFor(model => model.Device.AssetNumber));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 36 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 37 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasLocation)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <th>Location:\r\n </th" +
|
|
">\r\n <td>");
|
|
|
|
|
|
#line 42 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.TextBoxFor(model => model.Device.Location));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<br />\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 43 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.ValidationMessageFor(model => model.Device.Location));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 46 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 47 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasDeviceBatch)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <th>Device Batch:\r\n " +
|
|
"</th>\r\n <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 53 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.DropDownListFor(model => model.Device.DeviceBatchId, Model.DeviceBatches.ToSelectListItems()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n <br />\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 55 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.ValidationMessageFor(model => model.Device.DeviceBatchId));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 58 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 59 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasDeviceProfile)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <th>Device Profile:\r\n " +
|
|
" </th>\r\n <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 65 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.DropDownListFor(model => model.Device.DeviceProfileId, Model.DeviceProfiles.ToSelectListItems(Model.DefaultDeviceProfileId)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<br />\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 66 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.ValidationMessageFor(model => model.Device.DeviceProfileId));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 69 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 70 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasAssignUser)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <th>Assigned User:\r\n " +
|
|
" </th>\r\n <td>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 76 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.TextBoxFor(model => model.Device.AssignedUserId));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<br />\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 77 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.ValidationMessageFor(model => model.Device.AssignedUserId));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 80 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </table>\r\n <p");
|
|
|
|
WriteLiteral(" class=\"actions\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 83 "..\..\Views\Device\AddOffline.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 83 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (!hasDeviceProfile)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 85 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Html.Hidden("Device.DeviceProfileId", Model.DefaultDeviceProfileId));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 85 "..\..\Views\Device\AddOffline.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n <input");
|
|
|
|
WriteLiteral(" type=\"submit\"");
|
|
|
|
WriteLiteral(" class=\"button\"");
|
|
|
|
WriteLiteral(" value=\"Add\"");
|
|
|
|
WriteLiteral(" />\r\n </p>\r\n <script");
|
|
|
|
WriteLiteral(" type=\"text/javascript\"");
|
|
|
|
WriteLiteral(">\r\n $(function () {\r\n var $SerialNumber = $(\'#D" +
|
|
"evice_SerialNumber\').focus();\r\n\r\n");
|
|
|
|
|
|
#line 94 "..\..\Views\Device\AddOffline.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 94 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasAssignUser)
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n $SerialNumber.keydown(function (e) {\r\n if (e" +
|
|
".which == 13) {\r\n $(\'#Device_AssignedUserId\').focus();\r\n " +
|
|
" return false;\r\n }\r\n });" +
|
|
"");
|
|
|
|
|
|
#line 101 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 102 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasAssetNumber)
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n $(\'#Device_AssetNumber\').keydown(function (e) {\r\n " +
|
|
" if (e.which == 13) {\r\n");
|
|
|
|
|
|
#line 106 "..\..\Views\Device\AddOffline.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 106 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasLocation)
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("$(\'#Device_Location\').focus(); return false;");
|
|
|
|
|
|
#line 107 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
else if (hasAssignUser)
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("$(\'#Device_AssignedUserId\').focus(); return false;");
|
|
|
|
|
|
#line 109 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" }\r\n });\r\n ");
|
|
|
|
|
|
#line 112 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 113 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasLocation && hasAssignUser)
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"
|
|
$('#Device_Location').keydown(function (e) {
|
|
if (e.which == 13) {
|
|
$('#Device_AssignedUserId').focus();
|
|
return false;
|
|
}
|
|
});
|
|
");
|
|
|
|
|
|
#line 121 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 122 "..\..\Views\Device\AddOffline.cshtml"
|
|
if (hasAssignUser)
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"
|
|
var $AssignedUserId = $('#Device_AssignedUserId');
|
|
$AssignedUserId
|
|
.watermark('Search Users')
|
|
.focus(function () { $AssignedUserId.select() })
|
|
.autocomplete({
|
|
source: '");
|
|
|
|
|
|
#line 129 "..\..\Views\Device\AddOffline.cshtml"
|
|
Write(Url.Action(MVC.API.Search.UsersUpstream()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(@"',
|
|
minLength: 2,
|
|
focus: function (e, ui) {
|
|
$AssignedUserId.val(ui.item.Id);
|
|
return false;
|
|
},
|
|
select: function (e, ui) {
|
|
$AssignedUserId.val(ui.item.Id).blur();
|
|
return false;
|
|
}
|
|
}).data('ui-autocomplete')._renderItem = function (ul, item) {
|
|
return $(""<li></li>"")
|
|
.data(""item.autocomplete"", item)
|
|
.append(""<a><strong>"" + item.DisplayName + ""</strong><br>"" + item.Id + "" ("" + item.Type + "")</a>"")
|
|
.appendTo(ul);
|
|
};
|
|
");
|
|
|
|
|
|
#line 145 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" });\r\n </script>\r\n </div>\r\n");
|
|
|
|
|
|
#line 149 "..\..\Views\Device\AddOffline.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore 1591
|