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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user