db73cc1a12
AD Interop moved to Disco.Services; Supports multi-domain environments, sites, and searching restricted with OUs.
585 lines
18 KiB
C#
585 lines
18 KiB
C#
#pragma warning disable 1591
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version:4.0.30319.34011
|
|
//
|
|
// 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/ImportExport.cshtml")]
|
|
public partial class ImportExport : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ImportModel>
|
|
{
|
|
public ImportExport()
|
|
{
|
|
}
|
|
public override void Execute()
|
|
{
|
|
|
|
#line 2 "..\..\Views\Device\ImportExport.cshtml"
|
|
|
|
Authorization.RequireAny(Claims.Device.Actions.Import, Claims.Device.Actions.Export);
|
|
|
|
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import/Export Devices");
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n");
|
|
|
|
|
|
#line 7 "..\..\Views\Device\ImportExport.cshtml"
|
|
if (Authorization.Has(Claims.Device.Actions.Import)){
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<div");
|
|
|
|
WriteLiteral(" id=\"deviceImport\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 9 "..\..\Views\Device\ImportExport.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 9 "..\..\Views\Device\ImportExport.cshtml"
|
|
using (Html.BeginForm(MVC.API.Device.ImportParse(), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 11 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.ValidationSummary());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 11 "..\..\Views\Device\ImportExport.cshtml"
|
|
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" id=\"importDialog\"");
|
|
|
|
WriteLiteral(" class=\"form\"");
|
|
|
|
WriteLiteral(" style=\"width: 450px\"");
|
|
|
|
WriteLiteral(">\r\n <h2>Import Devices</h2>\r\n <table>\r\n <tr>" +
|
|
"\r\n <th>\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 17 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.LabelFor(m => m.ImportFile));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n </th>\r\n <td>\r\n <i" +
|
|
"nput");
|
|
|
|
WriteLiteral(" id=\"ImportFile\"");
|
|
|
|
WriteLiteral(" name=\"ImportFile\"");
|
|
|
|
WriteLiteral(" type=\"file\"");
|
|
|
|
WriteLiteral(" data-val=\"true\"");
|
|
|
|
WriteLiteral(" data-val-required=\"An Import File is required.\"");
|
|
|
|
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=\"Import\"");
|
|
|
|
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
|
|
|
|
|
|
#line 28 "..\..\Views\Device\ImportExport.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" id=\"documentation\"");
|
|
|
|
WriteLiteral(">\r\n <h3>CSV Import Specification</h3>\r\n <h4>Format</h4>\r\n <u" +
|
|
"l>\r\n <li>The import file must be in <strong>comma-separated values fo" +
|
|
"rmat</strong> (<a");
|
|
|
|
WriteLiteral(" href=\"http://en.wikipedia.org/wiki/Comma-separated_values\"");
|
|
|
|
WriteLiteral(" target=\"_blank\"");
|
|
|
|
WriteLiteral(@">CSV Reference</a>).</li>
|
|
<li>The <strong>first line will be ignored</strong> (it is assumed the file includes headers).</li>
|
|
<li>Be conscious of editors removing leading zeros from serial numbers (ie: Microsoft Excel).</li>
|
|
</ul>
|
|
<h4>Fields</h4>
|
|
<div");
|
|
|
|
WriteLiteral(" class=\"smallMessage\"");
|
|
|
|
WriteLiteral(">The following fields/columns are available for to the import file. The <strong>o" +
|
|
"rder of the fields</strong> must be as shown below.</div>\r\n <table");
|
|
|
|
WriteLiteral(" class=\"tableData\"");
|
|
|
|
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n <th");
|
|
|
|
WriteLiteral(" style=\"width: 100px;\"");
|
|
|
|
WriteLiteral(@">Field Name</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th>Serial Number</th>
|
|
<td><strong>Required</strong> - must contain the device serial number (maximum of 60 characters).
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Device Model</th>
|
|
<td>The <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral(">ID</span> for the Device Model (<a");
|
|
|
|
WriteLiteral(" href=\"#\"");
|
|
|
|
WriteLiteral(" id=\"showDeviceModels\"");
|
|
|
|
WriteLiteral(">Show IDs</a>). <em>Default: <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral(">1</span> [");
|
|
|
|
|
|
#line 54 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.ActionLink(Model.DeviceModels[0].ToString(), MVC.Config.DeviceModel.Index(Model.DeviceModels[0].Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("]</em>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
|
|
" <th>Device Profile</th>\r\n <td>The <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral(">ID</span> for the Device Profile (<a");
|
|
|
|
WriteLiteral(" href=\"#\"");
|
|
|
|
WriteLiteral(" id=\"showDeviceProfiles\"");
|
|
|
|
WriteLiteral(">Show IDs</a>). <em>Default: <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral(">1</span> [");
|
|
|
|
|
|
#line 59 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.ActionLink(Model.DeviceProfiles[0].ToString(), MVC.Config.DeviceProfile.Index(Model.DeviceProfiles[0].Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("]</em>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
|
|
" <th>Device Batch</th>\r\n <td>The <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral(">ID</span> for the Device Batch (<a");
|
|
|
|
WriteLiteral(" href=\"#\"");
|
|
|
|
WriteLiteral(" id=\"showDeviceBatches\"");
|
|
|
|
WriteLiteral(">Show IDs</a>). <em>Default: <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral("><None></span></em>\r\n </td>\r\n </tr>\r\n " +
|
|
" <tr>\r\n <th>Assigned User</th>\r\n " +
|
|
" <td>The <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral(">ID</span> for the User assigned to the device. <em>Default: <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral("><None></span></em>\r\n </td>\r\n </tr>\r\n " +
|
|
" <tr>\r\n <th>Location</th>\r\n <td" +
|
|
">Updates the Location of the device. Maximum of 250 characters. <em>Default: <sp" +
|
|
"an");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral("><None></span></em>\r\n </td>\r\n </tr>\r\n " +
|
|
" <tr>\r\n <th>Asset Number</th>\r\n " +
|
|
" <td>Updates the Asset Number of the device. Maximum of 40 characters. <em>Defau" +
|
|
"lt: <span");
|
|
|
|
WriteLiteral(" class=\"code\"");
|
|
|
|
WriteLiteral("><None></span></em>\r\n </td>\r\n </tr>\r\n " +
|
|
" </tbody>\r\n </table>\r\n\r\n\r\n <div");
|
|
|
|
WriteLiteral(" id=\"showDeviceModelsDialog\"");
|
|
|
|
WriteLiteral(" class=\"hiddenDialog\"");
|
|
|
|
WriteLiteral(" title=\"Disco Device Model Ids\"");
|
|
|
|
WriteLiteral(">\r\n <table");
|
|
|
|
WriteLiteral(" class=\"tableData\"");
|
|
|
|
WriteLiteral(@">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Description</th>
|
|
<th>Manufacturer</th>
|
|
<th>Model</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
");
|
|
|
|
|
|
#line 97 "..\..\Views\Device\ImportExport.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 97 "..\..\Views\Device\ImportExport.cshtml"
|
|
foreach (var dm in Model.DeviceModels)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <td>");
|
|
|
|
|
|
#line 100 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.ActionLink(dm.Id.ToString(), MVC.Config.DeviceModel.Index(dm.Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 101 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(dm.ToString());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 102 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(dm.Manufacturer);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 103 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(dm.Model);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 105 "..\..\Views\Device\ImportExport.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n\r\n <div");
|
|
|
|
WriteLiteral(" id=\"showDeviceProfilesDialog\"");
|
|
|
|
WriteLiteral(" class=\"hiddenDialog\"");
|
|
|
|
WriteLiteral(" title=\"Disco Device Profile Ids\"");
|
|
|
|
WriteLiteral(">\r\n <table");
|
|
|
|
WriteLiteral(" class=\"tableData\"");
|
|
|
|
WriteLiteral(@">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Name</th>
|
|
<th>Short Name</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
");
|
|
|
|
|
|
#line 121 "..\..\Views\Device\ImportExport.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 121 "..\..\Views\Device\ImportExport.cshtml"
|
|
foreach (var dp in Model.DeviceProfiles)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <td>");
|
|
|
|
|
|
#line 124 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.ActionLink(dp.Id.ToString(), MVC.Config.DeviceProfile.Index(dp.Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 125 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(dp.Name);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 126 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(dp.ShortName);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 127 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(dp.Description);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 129 "..\..\Views\Device\ImportExport.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n\r\n <div");
|
|
|
|
WriteLiteral(" id=\"showDeviceBatchesDialog\"");
|
|
|
|
WriteLiteral(" class=\"hiddenDialog\"");
|
|
|
|
WriteLiteral(" title=\"Disco Device Batch Ids\"");
|
|
|
|
WriteLiteral(">\r\n <table");
|
|
|
|
WriteLiteral(" class=\"tableData\"");
|
|
|
|
WriteLiteral(@">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Name</th>
|
|
<th>Purchase Date</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
");
|
|
|
|
|
|
#line 144 "..\..\Views\Device\ImportExport.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 144 "..\..\Views\Device\ImportExport.cshtml"
|
|
foreach (var db in Model.DeviceBatches)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <tr>\r\n <td>");
|
|
|
|
|
|
#line 147 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.ActionLink(db.Id.ToString(), MVC.Config.DeviceBatch.Index(db.Id)));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 148 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(db.Name);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n <td>");
|
|
|
|
|
|
#line 149 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(CommonHelpers.FriendlyDate(db.PurchaseDate));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</td>\r\n </tr>\r\n");
|
|
|
|
|
|
#line 151 "..\..\Views\Device\ImportExport.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n\r\n <script" +
|
|
">\r\n $(function () {\r\n var dialogOptions = {\r\n " +
|
|
" width: 700,\r\n height: 600,\r\n re" +
|
|
"sizable: false,\r\n modal: true,\r\n autoOpen:" +
|
|
" false\r\n },\r\n $showDeviceModelsDialog = null,\r\n " +
|
|
" $showDeviceProfilesDialog = null,\r\n $showDeviceBatch" +
|
|
"esDialog = null;\r\n\r\n $(\'#showDeviceModels\').click(function (e) {\r" +
|
|
"\n e.preventDefault();\r\n if (!$showDeviceMo" +
|
|
"delsDialog)\r\n $showDeviceModelsDialog = $(\'#showDeviceMod" +
|
|
"elsDialog\').dialog(dialogOptions);\r\n $showDeviceModelsDialog." +
|
|
"dialog(\'open\');\r\n });\r\n\r\n $(\'#showDeviceProfiles\')" +
|
|
".click(function (e) {\r\n e.preventDefault();\r\n " +
|
|
" if (!$showDeviceProfilesDialog)\r\n $showDeviceProfiles" +
|
|
"Dialog = $(\'#showDeviceProfilesDialog\').dialog(dialogOptions);\r\n " +
|
|
" $showDeviceProfilesDialog.dialog(\'open\');\r\n });\r\n " +
|
|
" $(\'#showDeviceBatches\').click(function (e) {\r\n e.preventD" +
|
|
"efault();\r\n if (!$showDeviceBatchesDialog)\r\n " +
|
|
" $showDeviceBatchesDialog = $(\'#showDeviceBatchesDialog\').dialog(dialogOpt" +
|
|
"ions);\r\n $showDeviceBatchesDialog.dialog(\'open\');\r\n " +
|
|
" });\r\n });\r\n </script>\r\n </div>\r\n</div>\r\n");
|
|
|
|
|
|
#line 192 "..\..\Views\Device\ImportExport.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 193 "..\..\Views\Device\ImportExport.cshtml"
|
|
if (Authorization.Has(Claims.Device.Actions.Export)){
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<div");
|
|
|
|
WriteLiteral(" class=\"actionBar\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 195 "..\..\Views\Device\ImportExport.cshtml"
|
|
Write(Html.ActionLinkButton("Export All Devices", MVC.API.Device.ExportAllDevices()));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n</div>\r\n");
|
|
|
|
|
|
#line 197 "..\..\Views\Device\ImportExport.cshtml"
|
|
}
|
|
|
|
#line default
|
|
#line hidden
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore 1591
|