Upèdate LAND x gestione import web.config
This commit is contained in:
@@ -154,7 +154,7 @@ namespace MP.Controllers
|
||||
/// </summary>
|
||||
/// <param name="results"></param>
|
||||
/// <returns></returns>
|
||||
public ActionResult ConfigMan()
|
||||
public ActionResult ConfigMan(string sorgente)
|
||||
{
|
||||
ViewBag.Title = "Steamware's MAPO Suite - Configurations";
|
||||
|
||||
@@ -165,37 +165,47 @@ namespace MP.Controllers
|
||||
{
|
||||
ViewBag.Message = "File web.config presente";
|
||||
// leggo il file di conf caricato...
|
||||
System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/FileUpload/web.config");
|
||||
System.Configuration.Configuration rootWebConfig = WebConfigurationManager.OpenWebConfiguration("~/FileUpload/web.config");
|
||||
|
||||
// imposto sorgente !!!FARE!!!
|
||||
string sorgente = "MAPO";
|
||||
// resetto tab import
|
||||
memLayer.ML.taConfigTmp.reset(sorgente);
|
||||
// carico dati!
|
||||
var settings = rootWebConfig.AppSettings.Settings;
|
||||
foreach (var item in settings.AllKeys)
|
||||
if (sorgente != "" && sorgente != null)
|
||||
{
|
||||
memLayer.ML.taConfigTmp.insertQuery(sorgente, item, settings[item].Value, string.Format("{0}-{1}", sorgente, item));
|
||||
}
|
||||
// salvo in viewbag gli elenchi 0/1/2 (tutte, nuove, modificate)
|
||||
// resetto tab import
|
||||
memLayer.ML.taConfigTmp.reset(sorgente);
|
||||
// carico dati!
|
||||
var settings = rootWebConfig.AppSettings.Settings;
|
||||
foreach (var item in settings.AllKeys)
|
||||
{
|
||||
memLayer.ML.taConfigTmp.insertQuery(sorgente, item, settings[item].Value, string.Format("{0}-{1}", sorgente, item));
|
||||
}
|
||||
// salvo in viewbag gli elenchi 0/1/2 (tutte, nuove, modificate)
|
||||
|
||||
ViewBag.keyList = "CARICATO!";
|
||||
using (var ctx = new MoonProEntities())
|
||||
{
|
||||
try
|
||||
{
|
||||
// esegue stored procedure come function, recuperando chiave desiderata...
|
||||
var elConfig = ctx.ConfigTmp.ToList<ConfigTmp>();
|
||||
ViewBag.elConfig = elConfig;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
ViewBag.keyList = "CARICATO!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewBag.Message = "Attenzione: nessun file presente!";
|
||||
}
|
||||
// se c'è il file carico le info da importare...
|
||||
|
||||
|
||||
// VIEW!
|
||||
return View();
|
||||
return View((object)ViewBag.elConfig);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult UploadFile(HttpPostedFileBase file)
|
||||
public ActionResult UploadFile(HttpPostedFileBase file, string sorgente)
|
||||
{
|
||||
if (file != null && file.ContentLength > 0)
|
||||
if (file != null && file.ContentLength > 0 && sorgente != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -212,7 +222,7 @@ namespace MP.Controllers
|
||||
{
|
||||
ViewBag.Message = "Non è stato selezionato alcun file.";
|
||||
}
|
||||
return RedirectToAction("ConfigMan", "Home");
|
||||
return RedirectToAction("ConfigMan", "Home", new { sorgente });
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -136,6 +136,9 @@
|
||||
<Compile Include="Models\AnagraficaOperatori.cs">
|
||||
<DependentUpon>MPModel.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\ConfigTmp.cs">
|
||||
<DependentUpon>MPModel.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\MPModel.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
||||
@@ -19,5 +19,6 @@ namespace MP.Models
|
||||
public string Nome { get; set; }
|
||||
public Nullable<bool> isAdmin { get; set; }
|
||||
public string authKey { get; set; }
|
||||
public string CodOprExt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Codice generato da un modello.
|
||||
//
|
||||
// Le modifiche manuali a questo file potrebbero causare un comportamento imprevisto dell'applicazione.
|
||||
// Se il codice viene rigenerato, le modifiche manuali al file verranno sovrascritte.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MP.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ConfigTmp
|
||||
{
|
||||
public string sorgente { get; set; }
|
||||
public string chiave { get; set; }
|
||||
public string valore { get; set; }
|
||||
public string note { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ namespace MP.Models
|
||||
|
||||
public virtual DbSet<AnagKeyValue> AnagKeyValue { get; set; }
|
||||
public virtual DbSet<AnagraficaOperatori> AnagraficaOperatori { get; set; }
|
||||
public virtual DbSet<ConfigTmp> ConfigTmp { get; set; }
|
||||
|
||||
public virtual ObjectResult<AnagKeyValue> stp_AKV_getByKey(string nomeVar)
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Generazione del codice predefinita abilitata per il modello 'C:\Users\samuele\Documents\VisualStudioProjects\MoonPro_dotnet\MP\Models\MPModel.edmx'.
|
||||
// Generazione del codice predefinita abilitata per il modello 'C:\Users\samuele.steamw\Documents\VisualStudioProject\MoonPro_dotnet\MP-LAND\Models\MPModel.edmx'.
|
||||
// Per abilitare la generazione del codice legacy, modificare il valore della proprietà della finestra di progettazione 'Strategia di generazione del codice
|
||||
// su 'Legacy ObjectContext'. Questa proprietà è disponibile nella finestra Proprietà quando il modello è
|
||||
// aperto nella finestra di progettazione.
|
||||
|
||||
@@ -24,6 +24,17 @@
|
||||
<Property Name="Nome" Type="nvarchar" MaxLength="50" />
|
||||
<Property Name="isAdmin" Type="bit" />
|
||||
<Property Name="authKey" Type="nvarchar" MaxLength="50" />
|
||||
<Property Name="CodOprExt" Type="nvarchar" MaxLength="50" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="ConfigTmp">
|
||||
<Key>
|
||||
<PropertyRef Name="sorgente" />
|
||||
<PropertyRef Name="chiave" />
|
||||
</Key>
|
||||
<Property Name="sorgente" Type="nvarchar" MaxLength="50" Nullable="false" />
|
||||
<Property Name="chiave" Type="nvarchar" MaxLength="50" Nullable="false" />
|
||||
<Property Name="valore" Type="nvarchar" MaxLength="250" Nullable="false" />
|
||||
<Property Name="note" Type="nvarchar" MaxLength="250" Nullable="false" />
|
||||
</EntityType>
|
||||
<Function Name="stp_AKV_getByKey" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
|
||||
<Parameter Name="nomeVar" Type="nvarchar" Mode="In" />
|
||||
@@ -31,6 +42,7 @@
|
||||
<EntityContainer Name="MoonProModelStoreContainer">
|
||||
<EntitySet Name="AnagKeyValue" EntityType="Self.AnagKeyValue" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="AnagraficaOperatori" EntityType="Self.AnagraficaOperatori" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="ConfigTmp" EntityType="Self.ConfigTmp" Schema="dbo" store:Type="Tables" />
|
||||
</EntityContainer>
|
||||
</Schema></edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
@@ -52,6 +64,7 @@
|
||||
<Parameter Name="nomeVar" Mode="In" Type="String" />
|
||||
</FunctionImport>
|
||||
<EntitySet Name="AnagraficaOperatori" EntityType="MoonProModel.AnagraficaOperatori" />
|
||||
<EntitySet Name="ConfigTmp" EntityType="MoonProModel.ConfigTmp" />
|
||||
</EntityContainer>
|
||||
<ComplexType Name="stp_AKV_getByKey_Result">
|
||||
<Property Type="String" Name="nomeVar" Nullable="false" MaxLength="50" />
|
||||
@@ -69,6 +82,17 @@
|
||||
<Property Name="Nome" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
|
||||
<Property Name="isAdmin" Type="Boolean" />
|
||||
<Property Name="authKey" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
|
||||
<Property Name="CodOprExt" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
|
||||
</EntityType>
|
||||
<EntityType Name="ConfigTmp">
|
||||
<Key>
|
||||
<PropertyRef Name="sorgente" />
|
||||
<PropertyRef Name="chiave" />
|
||||
</Key>
|
||||
<Property Name="sorgente" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
|
||||
<Property Name="chiave" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
|
||||
<Property Name="valore" Type="String" Nullable="false" MaxLength="250" FixedLength="false" Unicode="true" />
|
||||
<Property Name="note" Type="String" Nullable="false" MaxLength="250" FixedLength="false" Unicode="true" />
|
||||
</EntityType>
|
||||
</Schema>
|
||||
</edmx:ConceptualModels>
|
||||
@@ -92,6 +116,7 @@
|
||||
<EntitySetMapping Name="AnagraficaOperatori">
|
||||
<EntityTypeMapping TypeName="MoonProModel.AnagraficaOperatori">
|
||||
<MappingFragment StoreEntitySet="AnagraficaOperatori">
|
||||
<ScalarProperty Name="CodOprExt" ColumnName="CodOprExt" />
|
||||
<ScalarProperty Name="authKey" ColumnName="authKey" />
|
||||
<ScalarProperty Name="isAdmin" ColumnName="isAdmin" />
|
||||
<ScalarProperty Name="Nome" ColumnName="Nome" />
|
||||
@@ -100,6 +125,16 @@
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="ConfigTmp">
|
||||
<EntityTypeMapping TypeName="MoonProModel.ConfigTmp">
|
||||
<MappingFragment StoreEntitySet="ConfigTmp">
|
||||
<ScalarProperty Name="note" ColumnName="note" />
|
||||
<ScalarProperty Name="valore" ColumnName="valore" />
|
||||
<ScalarProperty Name="chiave" ColumnName="chiave" />
|
||||
<ScalarProperty Name="sorgente" ColumnName="sorgente" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
</EntityContainerMapping>
|
||||
</Mapping>
|
||||
</edmx:Mappings>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<Diagram DiagramId="a6d61082f57a4ed79c7abe33c0053690" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="MoonProModel.AnagKeyValue" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="MoonProModel.AnagraficaOperatori" Width="1.5" PointX="3.375" PointY="0.75" />
|
||||
<EntityTypeShape EntityType="MoonProModel.ConfigTmp" Width="1.5" PointX="0.75" PointY="3.75" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<div class="container-fluid mt-4">
|
||||
@model IEnumerable<MP.Models.ConfigTmp>
|
||||
|
||||
<div class="container-fluid mt-4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@@ -39,6 +41,9 @@
|
||||
<h3>Step 1 - File Upload</h3>
|
||||
@using (Html.BeginForm("UploadFile", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
<label for="txtSorgente">SORGENTE web.config:</label>
|
||||
<input type="text" id="sorgente" name="sorgente" value="MAPO" />
|
||||
<br />
|
||||
<label for="file">Upload web.config file:</label>
|
||||
<input type="file" name="file" id="file" /><br><br>
|
||||
<input type="submit" value="Upload File" />
|
||||
@@ -49,17 +54,22 @@
|
||||
<div class="col-sm-12 mb-5 collapse" id="collapseStep02">
|
||||
<h3>Step 2 - File IMPORT</h3>
|
||||
@ViewBag.keyList
|
||||
@*@using (Html.BeginForm("ProcessFile",
|
||||
"Home",
|
||||
FormMethod.Post,
|
||||
new { enctype = "multipart/form-data" }))
|
||||
{
|
||||
<label for="file">Upload web.config file:</label>
|
||||
<input type="file" name="file" id="file" /><br><br>
|
||||
<input type="submit" value="Upload File" />
|
||||
<br><br>
|
||||
<div class="text-danger">@ViewBag.Message</div>
|
||||
}*@
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
@if (Model != null)
|
||||
{
|
||||
foreach (var item in Model)
|
||||
{
|
||||
<div class="col-6">
|
||||
@item.chiave
|
||||
</div>
|
||||
<div class="col-6">
|
||||
@item.valore
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user