Feature: MS Excel (xlsx) Import/Export
Microsoft Excel files can be used to import/export devices. Several import bugs were also fixed in the process.
This commit is contained in:
@@ -11,6 +11,7 @@ using Disco.Services.Interop;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Users;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web.Extensions;
|
||||
using Disco.Web.Models.Device;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -611,15 +612,15 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
#region Importing
|
||||
internal const string ImportSessionCacheKey = "DeviceImportContext_{0}";
|
||||
|
||||
internal static void Import_StoreContext(DeviceImportContext Context)
|
||||
internal static void Import_StoreContext(IDeviceImportContext Context)
|
||||
{
|
||||
string key = string.Format(ImportSessionCacheKey, Context.SessionId);
|
||||
HttpRuntime.Cache.Insert(key, Context, null, DateTime.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null);
|
||||
}
|
||||
internal static DeviceImportContext Import_RetrieveContext(string SessionId, bool Remove = false)
|
||||
internal static IDeviceImportContext Import_RetrieveContext(string SessionId, bool Remove = false)
|
||||
{
|
||||
string key = string.Format(ImportSessionCacheKey, SessionId);
|
||||
DeviceImportContext context = HttpRuntime.Cache.Get(key) as DeviceImportContext;
|
||||
IDeviceImportContext context = HttpRuntime.Cache.Get(key) as IDeviceImportContext;
|
||||
|
||||
if (Remove && context != null)
|
||||
HttpRuntime.Cache.Remove(key);
|
||||
@@ -654,7 +655,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
if (context == null)
|
||||
throw new ArgumentException("The Import Session Id is invalid or the session timed out (60 minutes), try importing again", "Id");
|
||||
|
||||
context.UpdateHeaderTypes(Headers);
|
||||
context.UpdateColumnTypes(Headers);
|
||||
|
||||
var status = DeviceImportParseTask.ScheduleNow(context);
|
||||
|
||||
@@ -729,12 +730,25 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
if (context == null)
|
||||
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", "Id");
|
||||
|
||||
if (context.Result == null || context.Result.CsvResult == null)
|
||||
if (context.Result == null || context.Result.Result == null)
|
||||
throw new ArgumentException("The export session is still running, or failed to complete successfully", "Id");
|
||||
|
||||
var filename = string.Format("DiscoDeviceExport-{0:yyyyMMdd-HHmmss}.csv", context.TaskStatus.StartedTimestamp.Value);
|
||||
string filename;
|
||||
string mimeType;
|
||||
if (context.Options.ExcelFormat)
|
||||
{
|
||||
filename = $"DiscoDeviceExport-{context.TaskStatus.StartedTimestamp.Value:yyyyMMdd-HHmmss}.xlsx";
|
||||
mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = $"DiscoDeviceExport-{context.TaskStatus.StartedTimestamp.Value:yyyyMMdd-HHmmss}.csv";
|
||||
mimeType = "text/csv";
|
||||
}
|
||||
|
||||
return File(context.Result.CsvResult.ToArray(), "text/csv", filename);
|
||||
var fileStream = context.Result.Result;
|
||||
|
||||
return this.File(fileStream.GetBuffer(), 0, (int)fileStream.Length, mimeType, filename);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Disco.Web.Models.Device
|
||||
{
|
||||
public class ImportModel : DeviceImportModel
|
||||
{
|
||||
[Required, Display(Name = "CSV Import File")]
|
||||
[Required, Display(Name = "Import File")]
|
||||
public HttpPostedFileBase ImportFile { get; set; }
|
||||
|
||||
[Required, Display(Name = "Has Header")]
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td>
|
||||
@Html.CheckBoxFor(m => m.Options.ExcelCsvFormat) <label for="Options_ExcelCsvFormat">Microsoft Excel CSV Format</label>
|
||||
@Html.CheckBoxFor(m => m.Options.ExcelFormat) <label for="Options_ExcelFormat">Microsoft Excel Format</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -27,7 +27,6 @@ namespace Disco.Web.Views.Device
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
#line 2 "..\..\Views\Device\Export.cshtml"
|
||||
@@ -173,17 +172,17 @@ WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 38 "..\..\Views\Device\Export.cshtml"
|
||||
Write(Html.CheckBoxFor(m => m.Options.ExcelCsvFormat));
|
||||
Write(Html.CheckBoxFor(m => m.Options.ExcelFormat));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <label");
|
||||
|
||||
WriteLiteral(" for=\"Options_ExcelCsvFormat\"");
|
||||
WriteLiteral(" for=\"Options_ExcelFormat\"");
|
||||
|
||||
WriteLiteral(">Microsoft Excel CSV Format</label>\r\n </td>\r\n <" +
|
||||
"/tr>\r\n </table>\r\n </div>\r\n");
|
||||
WriteLiteral(">Microsoft Excel Format</label>\r\n </td>\r\n </tr>" +
|
||||
"\r\n </table>\r\n </div>\r\n");
|
||||
|
||||
WriteLiteral(" <div");
|
||||
|
||||
@@ -311,40 +310,40 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <li");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3833), Tuple.Create("\"", 3864)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3823), Tuple.Create("\"", 3854)
|
||||
|
||||
#line 66 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3841), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
||||
, Tuple.Create(Tuple.Create("", 3831), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3841), false)
|
||||
, 3831), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"checkbox\"");
|
||||
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 3946), Tuple.Create("\"", 3983)
|
||||
, Tuple.Create(Tuple.Create("", 3951), Tuple.Create("Options_", 3951), true)
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 3936), Tuple.Create("\"", 3973)
|
||||
, Tuple.Create(Tuple.Create("", 3941), Tuple.Create("Options_", 3941), true)
|
||||
|
||||
#line 67 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3959), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
, Tuple.Create(Tuple.Create("", 3949), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3959), false)
|
||||
, 3949), false)
|
||||
);
|
||||
|
||||
WriteAttribute("name", Tuple.Create(" name=\"", 3984), Tuple.Create("\"", 4023)
|
||||
, Tuple.Create(Tuple.Create("", 3991), Tuple.Create("Options.", 3991), true)
|
||||
WriteAttribute("name", Tuple.Create(" name=\"", 3974), Tuple.Create("\"", 4013)
|
||||
, Tuple.Create(Tuple.Create("", 3981), Tuple.Create("Options.", 3981), true)
|
||||
|
||||
#line 67 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3999), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
, Tuple.Create(Tuple.Create("", 3989), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3999), false)
|
||||
, 3989), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" value=\"true\"");
|
||||
@@ -360,15 +359,15 @@ WriteLiteral(" ");
|
||||
#line hidden
|
||||
WriteLiteral("/><label");
|
||||
|
||||
WriteAttribute("for", Tuple.Create(" for=\"", 4093), Tuple.Create("\"", 4131)
|
||||
, Tuple.Create(Tuple.Create("", 4099), Tuple.Create("Options_", 4099), true)
|
||||
WriteAttribute("for", Tuple.Create(" for=\"", 4083), Tuple.Create("\"", 4121)
|
||||
, Tuple.Create(Tuple.Create("", 4089), Tuple.Create("Options_", 4089), true)
|
||||
|
||||
#line 67 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4107), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
, Tuple.Create(Tuple.Create("", 4097), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4107), false)
|
||||
, 4097), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
@@ -416,40 +415,40 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <li");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 4666), Tuple.Create("\"", 4697)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 4656), Tuple.Create("\"", 4687)
|
||||
|
||||
#line 75 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4674), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
||||
, Tuple.Create(Tuple.Create("", 4664), Tuple.Create<System.Object, System.Int32>(optionItem.Description
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4674), false)
|
||||
, 4664), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"checkbox\"");
|
||||
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 4779), Tuple.Create("\"", 4816)
|
||||
, Tuple.Create(Tuple.Create("", 4784), Tuple.Create("Options_", 4784), true)
|
||||
WriteAttribute("id", Tuple.Create(" id=\"", 4769), Tuple.Create("\"", 4806)
|
||||
, Tuple.Create(Tuple.Create("", 4774), Tuple.Create("Options_", 4774), true)
|
||||
|
||||
#line 76 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4792), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
, Tuple.Create(Tuple.Create("", 4782), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4792), false)
|
||||
, 4782), false)
|
||||
);
|
||||
|
||||
WriteAttribute("name", Tuple.Create(" name=\"", 4817), Tuple.Create("\"", 4856)
|
||||
, Tuple.Create(Tuple.Create("", 4824), Tuple.Create("Options.", 4824), true)
|
||||
WriteAttribute("name", Tuple.Create(" name=\"", 4807), Tuple.Create("\"", 4846)
|
||||
, Tuple.Create(Tuple.Create("", 4814), Tuple.Create("Options.", 4814), true)
|
||||
|
||||
#line 76 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4832), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
, Tuple.Create(Tuple.Create("", 4822), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4832), false)
|
||||
, 4822), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" value=\"true\"");
|
||||
@@ -465,15 +464,15 @@ WriteLiteral(" ");
|
||||
#line hidden
|
||||
WriteLiteral("/><label");
|
||||
|
||||
WriteAttribute("for", Tuple.Create(" for=\"", 4926), Tuple.Create("\"", 4964)
|
||||
, Tuple.Create(Tuple.Create("", 4932), Tuple.Create("Options_", 4932), true)
|
||||
WriteAttribute("for", Tuple.Create(" for=\"", 4916), Tuple.Create("\"", 4954)
|
||||
, Tuple.Create(Tuple.Create("", 4922), Tuple.Create("Options_", 4922), true)
|
||||
|
||||
#line 76 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4940), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
, Tuple.Create(Tuple.Create("", 4930), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4940), false)
|
||||
, 4930), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
@@ -604,14 +603,14 @@ WriteLiteral(" record");
|
||||
#line hidden
|
||||
WriteLiteral(" were successfully exported.</h4>\r\n <a");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 9307), Tuple.Create("\"", 9379)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 9297), Tuple.Create("\"", 9369)
|
||||
|
||||
#line 177 "..\..\Views\Device\Export.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 9314), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))
|
||||
, Tuple.Create(Tuple.Create("", 9304), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 9314), false)
|
||||
, 9304), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
|
||||
@@ -55,10 +55,16 @@
|
||||
</script>
|
||||
}
|
||||
<div id="Devices_Import_Documentation">
|
||||
<h3>CSV Import Specification</h3>
|
||||
<h3>XLSX/CSV Import Specification</h3>
|
||||
<h4>Format</h4>
|
||||
<ul>
|
||||
<li>The import file must be in <strong>comma-separated values format</strong> (<a href="http://en.wikipedia.org/wiki/Comma-separated_values" target="_blank">CSV Reference</a>).</li>
|
||||
<li>
|
||||
The import file must be in either:
|
||||
<ul>
|
||||
<li><strong>CSV (comma-separated values) format</strong> (<a href="http://en.wikipedia.org/wiki/Comma-separated_values" target="_blank">CSV Reference</a>), or</li>
|
||||
<li><strong>XLSX (Microsoft Excel) format</strong></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Be conscious of editors removing leading zeros from serial numbers (ie: Microsoft Excel).</li>
|
||||
</ul>
|
||||
<h4>Fields</h4>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -27,7 +27,6 @@ namespace Disco.Web.Views.Device
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
#line 2 "..\..\Views\Device\Import.cshtml"
|
||||
@@ -211,17 +210,27 @@ WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"Devices_Import_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(@">
|
||||
<h3>XLSX/CSV Import Specification</h3>
|
||||
<h4>Format</h4>
|
||||
<ul>
|
||||
<li>
|
||||
The import file must be in either:
|
||||
<ul>
|
||||
<li><strong>CSV (comma-separated values) format</strong> (<a");
|
||||
|
||||
WriteLiteral(" href=\"http://en.wikipedia.org/wiki/Comma-separated_values\"");
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
|
||||
WriteLiteral(">CSV Reference</a>).</li>\r\n <li>Be conscious of editors removing leadi" +
|
||||
"ng zeros from serial numbers (ie: Microsoft Excel).</li>\r\n </ul>\r\n " +
|
||||
" <h4>Fields</h4>\r\n <div");
|
||||
WriteLiteral(@">CSV Reference</a>), or</li>
|
||||
<li><strong>XLSX (Microsoft Excel) format</strong></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Be conscious of editors removing leading zeros from serial numbers (ie: Microsoft Excel).</li>
|
||||
</ul>
|
||||
<h4>Fields</h4>
|
||||
<div");
|
||||
|
||||
WriteLiteral(" class=\"smallMessage\"");
|
||||
|
||||
@@ -239,13 +248,13 @@ WriteLiteral(">Field Name</th>\r\n <th>Description</th>\r\n
|
||||
"\r\n </thead>\r\n <tbody>\r\n");
|
||||
|
||||
|
||||
#line 74 "..\..\Views\Device\Import.cshtml"
|
||||
#line 80 "..\..\Views\Device\Import.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 74 "..\..\Views\Device\Import.cshtml"
|
||||
#line 80 "..\..\Views\Device\Import.cshtml"
|
||||
foreach (var field in Model.HeaderTypes)
|
||||
{
|
||||
|
||||
@@ -255,7 +264,7 @@ WriteLiteral(">Field Name</th>\r\n <th>Description</th>\r\n
|
||||
WriteLiteral(" <tr>\r\n <th>");
|
||||
|
||||
|
||||
#line 77 "..\..\Views\Device\Import.cshtml"
|
||||
#line 83 "..\..\Views\Device\Import.cshtml"
|
||||
Write(field.Item2);
|
||||
|
||||
|
||||
@@ -266,7 +275,7 @@ WriteLiteral("</th>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 79 "..\..\Views\Device\Import.cshtml"
|
||||
#line 85 "..\..\Views\Device\Import.cshtml"
|
||||
Write(field.Item3);
|
||||
|
||||
|
||||
@@ -275,13 +284,13 @@ WriteLiteral(" ");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 80 "..\..\Views\Device\Import.cshtml"
|
||||
#line 86 "..\..\Views\Device\Import.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 80 "..\..\Views\Device\Import.cshtml"
|
||||
#line 86 "..\..\Views\Device\Import.cshtml"
|
||||
if (field.Item1 == DeviceImportFieldTypes.DeviceSerialNumber.ToString())
|
||||
{
|
||||
|
||||
@@ -291,7 +300,7 @@ WriteLiteral("\r\n");
|
||||
WriteLiteral(" <strong>Required</strong>\r\n");
|
||||
|
||||
|
||||
#line 83 "..\..\Views\Device\Import.cshtml"
|
||||
#line 89 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
else if (field.Item1 == DeviceImportFieldTypes.ModelId.ToString())
|
||||
{
|
||||
@@ -308,7 +317,7 @@ WriteLiteral(" id=\"Devices_Import_Documentation_DeviceModels_Button\"");
|
||||
WriteLiteral(">Show IDs</a>)</span>\r\n");
|
||||
|
||||
|
||||
#line 87 "..\..\Views\Device\Import.cshtml"
|
||||
#line 93 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
else if (field.Item1 == DeviceImportFieldTypes.ProfileId.ToString())
|
||||
{
|
||||
@@ -325,7 +334,7 @@ WriteLiteral(" id=\"Devices_Import_Documentation_DeviceProfiles_Button\"");
|
||||
WriteLiteral(">Show IDs</a>)</span>\r\n");
|
||||
|
||||
|
||||
#line 91 "..\..\Views\Device\Import.cshtml"
|
||||
#line 97 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
else if (field.Item1 == DeviceImportFieldTypes.BatchId.ToString())
|
||||
{
|
||||
@@ -342,7 +351,7 @@ WriteLiteral(" id=\"Devices_Import_Documentation_DeviceBatches_Button\"");
|
||||
WriteLiteral(">Show IDs</a>)</span>\r\n");
|
||||
|
||||
|
||||
#line 95 "..\..\Views\Device\Import.cshtml"
|
||||
#line 101 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -351,7 +360,7 @@ WriteLiteral(">Show IDs</a>)</span>\r\n");
|
||||
WriteLiteral("\r\n </td>\r\n </tr> \r\n");
|
||||
|
||||
|
||||
#line 99 "..\..\Views\Device\Import.cshtml"
|
||||
#line 105 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -382,13 +391,13 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 115 "..\..\Views\Device\Import.cshtml"
|
||||
#line 121 "..\..\Views\Device\Import.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 115 "..\..\Views\Device\Import.cshtml"
|
||||
#line 121 "..\..\Views\Device\Import.cshtml"
|
||||
foreach (var dm in Model.DeviceModels)
|
||||
{
|
||||
|
||||
@@ -398,7 +407,7 @@ WriteLiteral(@">
|
||||
WriteLiteral(" <tr>\r\n <td>");
|
||||
|
||||
|
||||
#line 118 "..\..\Views\Device\Import.cshtml"
|
||||
#line 124 "..\..\Views\Device\Import.cshtml"
|
||||
Write(Html.ActionLink(dm.Id.ToString(), MVC.Config.DeviceModel.Index(dm.Id)));
|
||||
|
||||
|
||||
@@ -407,7 +416,7 @@ WriteLiteral(" <tr>\r\n <td>")
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 119 "..\..\Views\Device\Import.cshtml"
|
||||
#line 125 "..\..\Views\Device\Import.cshtml"
|
||||
Write(dm.ToString());
|
||||
|
||||
|
||||
@@ -416,7 +425,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 120 "..\..\Views\Device\Import.cshtml"
|
||||
#line 126 "..\..\Views\Device\Import.cshtml"
|
||||
Write(dm.Manufacturer);
|
||||
|
||||
|
||||
@@ -425,7 +434,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 121 "..\..\Views\Device\Import.cshtml"
|
||||
#line 127 "..\..\Views\Device\Import.cshtml"
|
||||
Write(dm.Model);
|
||||
|
||||
|
||||
@@ -434,7 +443,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 123 "..\..\Views\Device\Import.cshtml"
|
||||
#line 129 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -465,13 +474,13 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 139 "..\..\Views\Device\Import.cshtml"
|
||||
#line 145 "..\..\Views\Device\Import.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 139 "..\..\Views\Device\Import.cshtml"
|
||||
#line 145 "..\..\Views\Device\Import.cshtml"
|
||||
foreach (var dp in Model.DeviceProfiles)
|
||||
{
|
||||
|
||||
@@ -481,7 +490,7 @@ WriteLiteral(@">
|
||||
WriteLiteral(" <tr>\r\n <td>");
|
||||
|
||||
|
||||
#line 142 "..\..\Views\Device\Import.cshtml"
|
||||
#line 148 "..\..\Views\Device\Import.cshtml"
|
||||
Write(Html.ActionLink(dp.Id.ToString(), MVC.Config.DeviceProfile.Index(dp.Id)));
|
||||
|
||||
|
||||
@@ -490,7 +499,7 @@ WriteLiteral(" <tr>\r\n <td>")
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 143 "..\..\Views\Device\Import.cshtml"
|
||||
#line 149 "..\..\Views\Device\Import.cshtml"
|
||||
Write(dp.Name);
|
||||
|
||||
|
||||
@@ -499,7 +508,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 144 "..\..\Views\Device\Import.cshtml"
|
||||
#line 150 "..\..\Views\Device\Import.cshtml"
|
||||
Write(dp.ShortName);
|
||||
|
||||
|
||||
@@ -508,7 +517,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 145 "..\..\Views\Device\Import.cshtml"
|
||||
#line 151 "..\..\Views\Device\Import.cshtml"
|
||||
Write(dp.Description);
|
||||
|
||||
|
||||
@@ -517,7 +526,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 147 "..\..\Views\Device\Import.cshtml"
|
||||
#line 153 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -547,13 +556,13 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 162 "..\..\Views\Device\Import.cshtml"
|
||||
#line 168 "..\..\Views\Device\Import.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 162 "..\..\Views\Device\Import.cshtml"
|
||||
#line 168 "..\..\Views\Device\Import.cshtml"
|
||||
foreach (var db in Model.DeviceBatches)
|
||||
{
|
||||
|
||||
@@ -563,7 +572,7 @@ WriteLiteral(@">
|
||||
WriteLiteral(" <tr>\r\n <td>");
|
||||
|
||||
|
||||
#line 165 "..\..\Views\Device\Import.cshtml"
|
||||
#line 171 "..\..\Views\Device\Import.cshtml"
|
||||
Write(Html.ActionLink(db.Id.ToString(), MVC.Config.DeviceBatch.Index(db.Id)));
|
||||
|
||||
|
||||
@@ -572,7 +581,7 @@ WriteLiteral(" <tr>\r\n <td>")
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 166 "..\..\Views\Device\Import.cshtml"
|
||||
#line 172 "..\..\Views\Device\Import.cshtml"
|
||||
Write(db.Name);
|
||||
|
||||
|
||||
@@ -581,7 +590,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n <td>");
|
||||
|
||||
|
||||
#line 167 "..\..\Views\Device\Import.cshtml"
|
||||
#line 173 "..\..\Views\Device\Import.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(db.PurchaseDate));
|
||||
|
||||
|
||||
@@ -590,7 +599,7 @@ WriteLiteral("</td>\r\n <td>");
|
||||
WriteLiteral("</td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 169 "..\..\Views\Device\Import.cshtml"
|
||||
#line 175 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -620,7 +629,7 @@ WriteLiteral(" </tbody>\r\n </table>\r\n </div>
|
||||
" </script>\r\n </div>\r\n</div>\r\n");
|
||||
|
||||
|
||||
#line 210 "..\..\Views\Device\Import.cshtml"
|
||||
#line 216 "..\..\Views\Device\Import.cshtml"
|
||||
if (Model.CompletedImportSessionContext != null)
|
||||
{
|
||||
|
||||
@@ -642,7 +651,7 @@ WriteLiteral(" class=\"fa fa-lg fa-check\"");
|
||||
WriteLiteral("></i>Successfully imported/updated ");
|
||||
|
||||
|
||||
#line 213 "..\..\Views\Device\Import.cshtml"
|
||||
#line 219 "..\..\Views\Device\Import.cshtml"
|
||||
Write(Model.CompletedImportSessionContext.AffectedRecords);
|
||||
|
||||
|
||||
@@ -651,7 +660,7 @@ WriteLiteral("></i>Successfully imported/updated ");
|
||||
WriteLiteral(" device");
|
||||
|
||||
|
||||
#line 213 "..\..\Views\Device\Import.cshtml"
|
||||
#line 219 "..\..\Views\Device\Import.cshtml"
|
||||
Write(Model.CompletedImportSessionContext.AffectedRecords != 1 ? "s" : null);
|
||||
|
||||
|
||||
@@ -660,7 +669,7 @@ WriteLiteral(" device");
|
||||
WriteLiteral(".</h3>\r\n <div>File: <code>");
|
||||
|
||||
|
||||
#line 214 "..\..\Views\Device\Import.cshtml"
|
||||
#line 220 "..\..\Views\Device\Import.cshtml"
|
||||
Write(Model.CompletedImportSessionContext.Filename);
|
||||
|
||||
|
||||
@@ -687,7 +696,7 @@ WriteLiteral(@" <script>
|
||||
");
|
||||
|
||||
|
||||
#line 232 "..\..\Views\Device\Import.cshtml"
|
||||
#line 238 "..\..\Views\Device\Import.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
@{
|
||||
Authorization.Require(Claims.Device.Actions.Import);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.Filename));
|
||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.DatasetName));
|
||||
}
|
||||
<div id="Devices_Import_Headers">
|
||||
|
||||
<h2>Define Import Columns</h2>
|
||||
|
||||
@if (Model.Context.RawData.Count > 10)
|
||||
@if (Model.Context.RecordCount > 10)
|
||||
{
|
||||
<h4 class="alert">@Model.Context.RawData.Count records were loaded, only the first 10 are shown here.</h4>
|
||||
<h4 class="alert">@Model.Context.RecordCount records were loaded, only the first 10 are shown here.</h4>
|
||||
}
|
||||
|
||||
<h4 id="Devices_Import_Headers_DeviceSerialNumberRequired" class="error">The Device Serial Number column must be defined.</h4>
|
||||
@@ -19,17 +19,17 @@
|
||||
<table class="tableData">
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach (var header in Model.Context.Header.Select((h, i) => Tuple.Create(h, i)))
|
||||
@foreach (var header in Model.Context.Columns)
|
||||
{
|
||||
<th data-headerindex="@header.Item2" class="header@(header.Item1.Item2.ToString())">@header.Item1.Item1</th>
|
||||
<th data-headerindex="@header.Index" class="header@(header.Type.ToString())">@header.Name</th>
|
||||
}
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach (var header in Model.Context.Header.Select((h, i) => Tuple.Create(h, i)))
|
||||
@foreach (var header in Model.Context.Columns)
|
||||
{
|
||||
<td data-headerindex="@header.Item2" class="header@(header.Item1.Item2.ToString())">
|
||||
<ul class="importHeaderType" data-headerindex="@header.Item2" data-headertype="@header.Item1.Item2.ToString()">
|
||||
<li><a href="#"><span class="headerTypeTitle">@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Item1.Item2).Item2)</span></a>
|
||||
<td data-headerindex="@header.Index" class="header@(header.Type.ToString())">
|
||||
<ul class="importHeaderType" data-headerindex="@header.Index" data-headertype="@header.Type.ToString()">
|
||||
<li><a href="#"><span class="headerTypeTitle">@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2)</span></a>
|
||||
<ul>
|
||||
@foreach (var headerType in Model.HeaderTypes)
|
||||
{
|
||||
@@ -43,14 +43,18 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in Model.Context.RawData.Take(10))
|
||||
@using (var dataReader = Model.Context.GetDataReader())
|
||||
{
|
||||
<tr>
|
||||
@foreach (var field in record.Select((h, i) => Tuple.Create(h, i)))
|
||||
{
|
||||
<td data-headerindex="@field.Item2">@field.Item1</td>
|
||||
}
|
||||
</tr>
|
||||
for (int r = 0; r < Math.Min(10, Model.Context.RecordCount); r++)
|
||||
{
|
||||
dataReader.Read();
|
||||
<tr>
|
||||
@for (int c = 0; c < Model.Context.ColumnCount; c++)
|
||||
{
|
||||
<td data-headerindex="@c">@dataReader.GetString(c)</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -27,7 +27,6 @@ namespace Disco.Web.Views.Device
|
||||
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;
|
||||
@@ -49,7 +48,7 @@ namespace Disco.Web.Views.Device
|
||||
|
||||
Authorization.Require(Claims.Device.Actions.Import);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.Filename));
|
||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.DatasetName));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -68,7 +67,7 @@ WriteLiteral(">\r\n\r\n <h2>Define Import Columns</h2>\r\n\r\n");
|
||||
#line hidden
|
||||
|
||||
#line 11 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
if (Model.Context.RawData.Count > 10)
|
||||
if (Model.Context.RecordCount > 10)
|
||||
{
|
||||
|
||||
|
||||
@@ -82,7 +81,7 @@ WriteLiteral(">");
|
||||
|
||||
|
||||
#line 13 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(Model.Context.RawData.Count);
|
||||
Write(Model.Context.RecordCount);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -120,7 +119,7 @@ WriteLiteral(">\r\n <thead>\r\n <tr>\r\n");
|
||||
#line hidden
|
||||
|
||||
#line 22 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
foreach (var header in Model.Context.Header.Select((h, i) => Tuple.Create(h, i)))
|
||||
foreach (var header in Model.Context.Columns)
|
||||
{
|
||||
|
||||
|
||||
@@ -132,29 +131,29 @@ WriteLiteral(" data-headerindex=\"");
|
||||
|
||||
|
||||
#line 24 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(header.Item2);
|
||||
Write(header.Index);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 984), Tuple.Create("\"", 1030)
|
||||
, Tuple.Create(Tuple.Create("", 992), Tuple.Create("header", 992), true)
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 947), Tuple.Create("\"", 986)
|
||||
, Tuple.Create(Tuple.Create("", 955), Tuple.Create("header", 955), true)
|
||||
|
||||
#line 24 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 998), Tuple.Create<System.Object, System.Int32>(header.Item1.Item2.ToString()
|
||||
, Tuple.Create(Tuple.Create("", 961), Tuple.Create<System.Object, System.Int32>(header.Type.ToString()
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 998), false)
|
||||
, 961), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 24 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(header.Item1.Item1);
|
||||
Write(header.Name);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -178,7 +177,7 @@ WriteLiteral(" </tr>\r\n <tr>\r\n");
|
||||
#line hidden
|
||||
|
||||
#line 28 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
foreach (var header in Model.Context.Header.Select((h, i) => Tuple.Create(h, i)))
|
||||
foreach (var header in Model.Context.Columns)
|
||||
{
|
||||
|
||||
|
||||
@@ -190,22 +189,22 @@ WriteLiteral(" data-headerindex=\"");
|
||||
|
||||
|
||||
#line 30 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(header.Item2);
|
||||
Write(header.Index);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 1313), Tuple.Create("\"", 1359)
|
||||
, Tuple.Create(Tuple.Create("", 1321), Tuple.Create("header", 1321), true)
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 1226), Tuple.Create("\"", 1265)
|
||||
, Tuple.Create(Tuple.Create("", 1234), Tuple.Create("header", 1234), true)
|
||||
|
||||
#line 30 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1327), Tuple.Create<System.Object, System.Int32>(header.Item1.Item2.ToString()
|
||||
, Tuple.Create(Tuple.Create("", 1240), Tuple.Create<System.Object, System.Int32>(header.Type.ToString()
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1327), false)
|
||||
, 1240), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <ul");
|
||||
@@ -216,7 +215,7 @@ WriteLiteral(" data-headerindex=\"");
|
||||
|
||||
|
||||
#line 31 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(header.Item2);
|
||||
Write(header.Index);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -227,7 +226,7 @@ WriteLiteral(" data-headertype=\"");
|
||||
|
||||
|
||||
#line 31 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(header.Item1.Item2.ToString());
|
||||
Write(header.Type.ToString());
|
||||
|
||||
|
||||
#line default
|
||||
@@ -246,7 +245,7 @@ WriteLiteral(">");
|
||||
|
||||
|
||||
#line 32 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Item1.Item2).Item2);
|
||||
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -322,35 +321,38 @@ WriteLiteral(" </tr>\r\n </thead>\r\n <tbod
|
||||
#line hidden
|
||||
|
||||
#line 46 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
foreach (var record in Model.Context.RawData.Take(10))
|
||||
using (var dataReader = Model.Context.GetDataReader())
|
||||
{
|
||||
for (int r = 0; r < Math.Min(10, Model.Context.RecordCount); r++)
|
||||
{
|
||||
dataReader.Read();
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n");
|
||||
WriteLiteral(" <tr>\r\n");
|
||||
|
||||
|
||||
#line 49 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
|
||||
#line 52 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 49 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
foreach (var field in record.Select((h, i) => Tuple.Create(h, i)))
|
||||
{
|
||||
#line 52 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
for (int c = 0; c < Model.Context.ColumnCount; c++)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <td");
|
||||
WriteLiteral(" <td");
|
||||
|
||||
WriteLiteral(" data-headerindex=\"");
|
||||
|
||||
|
||||
#line 51 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(field.Item2);
|
||||
#line 54 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(c);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -360,8 +362,8 @@ WriteLiteral("\"");
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 51 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(field.Item1);
|
||||
#line 54 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(dataReader.GetString(c));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -369,16 +371,17 @@ WriteLiteral(">");
|
||||
WriteLiteral("</td>\r\n");
|
||||
|
||||
|
||||
#line 52 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
}
|
||||
#line 55 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </tr>\r\n");
|
||||
WriteLiteral(" </tr>\r\n");
|
||||
|
||||
|
||||
#line 54 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 57 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -391,13 +394,13 @@ WriteLiteral(" class=\"actionBar\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 59 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 63 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 59 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 63 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
using (Html.BeginForm(MVC.API.Device.ImportParse(Model.Context.SessionId, null)))
|
||||
{
|
||||
|
||||
@@ -415,7 +418,7 @@ WriteLiteral(" class=\"button\"");
|
||||
WriteLiteral(">Parse Device Import</a> \r\n");
|
||||
|
||||
|
||||
#line 62 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 66 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -439,13 +442,13 @@ WriteLiteral("></i>Parsing device import...</h4>\r\n</div>\r\n<script>\r\n $(
|
||||
" var headerTypes = {\r\n");
|
||||
|
||||
|
||||
#line 71 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 75 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 71 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 75 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
foreach (var h in Model.HeaderTypes)
|
||||
{
|
||||
|
||||
@@ -457,7 +460,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral("\'");
|
||||
|
||||
|
||||
#line 73 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 77 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(h.Item1);
|
||||
|
||||
|
||||
@@ -466,7 +469,7 @@ WriteLiteral("\'");
|
||||
WriteLiteral("\': \'");
|
||||
|
||||
|
||||
#line 73 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 77 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
Write(h.Item2);
|
||||
|
||||
|
||||
@@ -477,7 +480,7 @@ WriteLiteral("\',");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 74 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
#line 78 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,17 +64,17 @@
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Row</th>
|
||||
@foreach (var header in Model.Context.ParsedHeaders)
|
||||
@foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
|
||||
{
|
||||
<th>@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Item2).Item2)</th>
|
||||
<th>@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2)</th>
|
||||
}
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
@foreach (var header in Model.Context.ParsedHeaders)
|
||||
@foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
|
||||
{
|
||||
<th>@header.Item1</th>
|
||||
<th>@header.Name</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -164,244 +164,3 @@
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@*
|
||||
<div id="deviceImportReview">
|
||||
@if (Model.ImportDevices.Count > 0)
|
||||
{
|
||||
<h2>Parsed @Model.ImportDevices.Count Device Record@(Model.ImportDevices.Count != 1 ? "s" : null)</h2>
|
||||
<h4>
|
||||
@importDeviceOkCount of @Model.ImportDevices.Count Device@(Model.ImportDevices.Count != 1 ? "s" : null) are ready for import.
|
||||
</h4>
|
||||
if (importDeviceErrorCount > 0)
|
||||
{
|
||||
<h4 id="errorMessage">
|
||||
@(importDeviceErrorCount) Record@(importDeviceErrorCount != 1 ? "s" : null) will be skipped if the import continues
|
||||
</h4>
|
||||
}
|
||||
|
||||
<div id="devicesNavigation">
|
||||
<ul class="none">
|
||||
@if (importDeviceNewCount > 0)
|
||||
{<li class="statusNew">
|
||||
<input id="devicesNavigationNew" type="checkbox" checked="checked" /><label for="devicesNavigationNew">Show New Devices (@(Model.ImportDevices.Count(id => id.Errors.Count == 0 && id.Device == null)))</label>
|
||||
</li>}@if (importDeviceUpdateCount > 0)
|
||||
{<li class="statusUpdate">
|
||||
<input id="devicesNavigationUpdate" type="checkbox" checked="checked" /><label for="devicesNavigationUpdate">Show Updates (@(Model.ImportDevices.Count(id => id.Errors.Count == 0 && id.Device != null)))</label>
|
||||
</li>}@if (importDeviceErrorCount > 0)
|
||||
{<li class="statusError">
|
||||
<input id="devicesNavigationError" type="checkbox" checked="checked" /><label for="devicesNavigationError">Show Errors (@(Model.ImportDevices.Count(id => id.Errors.Count != 0)))</label>
|
||||
</li>}
|
||||
</ul>
|
||||
<script>
|
||||
$(function () {
|
||||
$devices = $('#devices');
|
||||
$rows = $devices.children('tbody').children('tr');
|
||||
|
||||
$('#devicesNavigationNew').change(function () {
|
||||
if ($(this).is(':checked'))
|
||||
$rows.filter('.statusNew').show();
|
||||
else
|
||||
$rows.filter('.statusNew').hide();
|
||||
});
|
||||
|
||||
$('#devicesNavigationUpdate').change(function () {
|
||||
if ($(this).is(':checked'))
|
||||
$rows.filter('.statusUpdate').show();
|
||||
else
|
||||
$rows.filter('.statusUpdate').hide();
|
||||
});
|
||||
|
||||
$('#devicesNavigationError').change(function () {
|
||||
if ($(this).is(':checked'))
|
||||
$rows.filter('.statusError').show();
|
||||
else
|
||||
$rows.filter('.statusError').hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<table id="devices">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="row">Row</th>
|
||||
<th class="action">Action</th>
|
||||
<th class="serialNumber">Serial Number</th>
|
||||
<th class="model">Model</th>
|
||||
<th class="profile">Profile</th>
|
||||
<th class="batch">Batch</th>
|
||||
<th class="assignedUser">Assigned User</th>
|
||||
<th class="location">Location</th>
|
||||
<th class="assetNumber">Asset Number</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var device in Model.ImportDevices)
|
||||
{
|
||||
bool isUpdate = device.Device != null;
|
||||
string error;
|
||||
<tr class="status@(device.ImportStatus())">
|
||||
<td class="row">
|
||||
@((Model.ImportDevices.IndexOf(device) + 1))
|
||||
</td>
|
||||
<td class="action">
|
||||
@(device.ImportStatus())
|
||||
</td>
|
||||
<td class="serialNumber">
|
||||
@if (device.Device == null)
|
||||
{
|
||||
@device.SerialNumber
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.ActionLink(device.SerialNumber, MVC.Device.Show(device.SerialNumber), new { target = "_blank" })
|
||||
}
|
||||
|
||||
@if (device.Errors.TryGetValue("SerialNumber", out error))
|
||||
{
|
||||
<div class="error">@error</div>
|
||||
}
|
||||
</td>
|
||||
<td class="model">
|
||||
@if (device.Errors.TryGetValue("DeviceModelId", out error))
|
||||
{
|
||||
<div class="error">@error</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isUpdate || device.DeviceModelId != device.Device.DeviceModelId)
|
||||
{
|
||||
<img class="modelImage" alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(device.DeviceModel.Id, device.DeviceModel.ImageHash()))" />
|
||||
@device.DeviceModel.ToString()
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="smallMessage">No Change</span>
|
||||
}
|
||||
}</td>
|
||||
<td class="profile">
|
||||
@if (device.Errors.TryGetValue("DeviceProfileId", out error))
|
||||
{
|
||||
<div class="error">@error</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isUpdate || device.DeviceProfileId != device.Device.DeviceProfileId)
|
||||
{
|
||||
@device.DeviceProfile.ToString()
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="smallMessage">No Change</span>
|
||||
}
|
||||
}</td>
|
||||
<td class="batch">
|
||||
@if (device.Errors.TryGetValue("DeviceBatchId", out error))
|
||||
{
|
||||
<div class="error">@error</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isUpdate || device.DeviceBatchId != device.Device.DeviceBatchId)
|
||||
{
|
||||
if (device.DeviceBatch == null)
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
else
|
||||
{
|
||||
@device.DeviceBatch.ToString()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="smallMessage">No Change</span>
|
||||
}
|
||||
}</td>
|
||||
<td class="assignedUser">
|
||||
@if (device.Errors.TryGetValue("AssignedUserId", out error))
|
||||
{
|
||||
<div class="error">@error</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isUpdate || device.AssignedUserId != device.Device.AssignedUserId)
|
||||
{
|
||||
if (device.AssignedUser == null)
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
else
|
||||
{
|
||||
@device.AssignedUser.ToString()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="smallMessage">No Change</span>
|
||||
}
|
||||
}</td>
|
||||
<td class="location">
|
||||
@if (device.Errors.TryGetValue("Location", out error))
|
||||
{
|
||||
<div class="error">@error</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isUpdate || device.Location != device.Device.Location)
|
||||
{
|
||||
if (device.Location == null)
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
else
|
||||
{
|
||||
@device.Location
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="smallMessage">No Change</span>
|
||||
}
|
||||
}</td>
|
||||
<td class="assetNumber">
|
||||
@if (device.Errors.TryGetValue("AssetNumber", out error))
|
||||
{
|
||||
<div class="error">@error</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isUpdate || device.AssetNumber != device.Device.AssetNumber)
|
||||
{
|
||||
if (device.AssetNumber == null)
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
else
|
||||
{
|
||||
@device.AssetNumber
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="smallMessage">No Change</span>
|
||||
}
|
||||
}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
if (importDeviceOkCount > 0)
|
||||
{
|
||||
<div class="actionBar">
|
||||
@Html.ActionLinkButton(string.Format("Import {0} Device{1}", importDeviceOkCount, importDeviceOkCount != 1 ? "s" : null), MVC.API.Device.ImportProcess(Model.ImportParseTaskId))
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<h2>No Devices were found in this file</h2>
|
||||
}
|
||||
</div>*@
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -33,7 +33,6 @@ namespace Disco.Web.Views.Device
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
#line 2 "..\..\Views\Device\ImportReview.cshtml"
|
||||
@@ -377,7 +376,7 @@ WriteLiteral(">\r\n <thead>\r\n <tr>\r\n
|
||||
#line hidden
|
||||
|
||||
#line 67 "..\..\Views\Device\ImportReview.cshtml"
|
||||
foreach (var header in Model.Context.ParsedHeaders)
|
||||
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
|
||||
{
|
||||
|
||||
|
||||
@@ -387,7 +386,7 @@ WriteLiteral(" <th>");
|
||||
|
||||
|
||||
#line 69 "..\..\Views\Device\ImportReview.cshtml"
|
||||
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Item2).Item2);
|
||||
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -412,7 +411,7 @@ WriteLiteral(" </tr>\r\n <tr>\r\n
|
||||
#line hidden
|
||||
|
||||
#line 75 "..\..\Views\Device\ImportReview.cshtml"
|
||||
foreach (var header in Model.Context.ParsedHeaders)
|
||||
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
|
||||
{
|
||||
|
||||
|
||||
@@ -422,7 +421,7 @@ WriteLiteral(" <th>");
|
||||
|
||||
|
||||
#line 77 "..\..\Views\Device\ImportReview.cshtml"
|
||||
Write(header.Item1);
|
||||
Write(header.Name);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -455,15 +454,15 @@ WriteLiteral(" </tr>\r\n </thead>\r\n <tbod
|
||||
#line hidden
|
||||
WriteLiteral(" <tr");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 4299), Tuple.Create("\"", 4335)
|
||||
, Tuple.Create(Tuple.Create("", 4307), Tuple.Create("action", 4307), true)
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 4401), Tuple.Create("\"", 4437)
|
||||
, Tuple.Create(Tuple.Create("", 4409), Tuple.Create("action", 4409), true)
|
||||
|
||||
#line 85 "..\..\Views\Device\ImportReview.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4313), Tuple.Create<System.Object, System.Int32>(record.RecordAction
|
||||
, Tuple.Create(Tuple.Create("", 4415), Tuple.Create<System.Object, System.Int32>(record.RecordAction
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4313), false)
|
||||
, 4415), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
@@ -502,23 +501,23 @@ WriteLiteral("</td>\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <td");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 4663), Tuple.Create("\"", 4772)
|
||||
, Tuple.Create(Tuple.Create("", 4671), Tuple.Create("header", 4671), true)
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 4765), Tuple.Create("\"", 4874)
|
||||
, Tuple.Create(Tuple.Create("", 4773), Tuple.Create("header", 4773), true)
|
||||
|
||||
#line 91 "..\..\Views\Device\ImportReview.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4677), Tuple.Create<System.Object, System.Int32>(field.FieldType
|
||||
, Tuple.Create(Tuple.Create("", 4779), Tuple.Create<System.Object, System.Int32>(field.FieldType
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4677), false)
|
||||
, Tuple.Create(Tuple.Create(" ", 4695), Tuple.Create("action", 4696), true)
|
||||
, 4779), false)
|
||||
, Tuple.Create(Tuple.Create(" ", 4797), Tuple.Create("action", 4798), true)
|
||||
|
||||
#line 91 "..\..\Views\Device\ImportReview.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4702), Tuple.Create<System.Object, System.Int32>(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error"
|
||||
, Tuple.Create(Tuple.Create("", 4804), Tuple.Create<System.Object, System.Int32>(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4702), false)
|
||||
, 4804), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-previousvalue=\"");
|
||||
@@ -671,14 +670,14 @@ WriteLiteral(">\r\n <a");
|
||||
|
||||
WriteLiteral(" id=\"Devices_Import_Review_ChangeHeaders\"");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 6466), Tuple.Create("\"", 6535)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 6568), Tuple.Create("\"", 6637)
|
||||
|
||||
#line 115 "..\..\Views\Device\ImportReview.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 6473), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))
|
||||
, Tuple.Create(Tuple.Create("", 6575), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 6473), false)
|
||||
, 6575), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
@@ -730,14 +729,14 @@ WriteLiteral(" <a");
|
||||
|
||||
WriteLiteral(" id=\"Devices_Import_Review_Apply\"");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 6897), Tuple.Create("\"", 6968)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 6999), Tuple.Create("\"", 7070)
|
||||
|
||||
#line 122 "..\..\Views\Device\ImportReview.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 6904), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))
|
||||
, Tuple.Create(Tuple.Create("", 7006), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 6904), false)
|
||||
, 7006), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" class=\"button\"");
|
||||
@@ -781,9 +780,7 @@ WriteLiteral(" </div>\r\n</div>\r\n<script>\r\n $(function () {\r\n
|
||||
"em><None></em>\';\r\n }\r\n }\r\n }," +
|
||||
"\r\n position: {\r\n my: \"left top\",\r\n at: " +
|
||||
"\"left bottom\",\r\n collision: \"flipfit flip\"\r\n }\r\n " +
|
||||
" });\r\n\r\n });\r\n</script>\r\n\r\n");
|
||||
|
||||
WriteLiteral("\r\n");
|
||||
" });\r\n\r\n });\r\n</script>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user