Aggiunta preliminare classe x elenco fatture
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SHERPA.BBM.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella Fatture - Documenti
|
||||
/// </summary>
|
||||
[Table("Fatture")]
|
||||
public class FattModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, Column("IdxFatt", Order = 0), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int IdxFatt { get; set; }
|
||||
|
||||
[Column("anno", Order = 1)]
|
||||
public int? anno { get; set; } = DateTime.Today.Year;
|
||||
|
||||
[Column("num", Order = 2)]
|
||||
public int? num { get; set; } = 0;
|
||||
|
||||
[Column("idxCli", Order = 3)]
|
||||
public int? idxCli { get; set; }
|
||||
|
||||
[Column("tipo", Order = 4), MaxLength(50)]
|
||||
public string tipo { get; set; } = "";
|
||||
|
||||
[Column("emesso", Order = 5)]
|
||||
public DateTime emesso { get; set; } = DateTime.Now;
|
||||
|
||||
[Column("ritenuta", Order = 6)]
|
||||
public float ritenuta { get; set; } = 0;
|
||||
|
||||
[Column("scelta", Order = 7)]
|
||||
public bool scelta { get; set; } = false;
|
||||
|
||||
[Column("dataPagam", Order = 8)]
|
||||
public DateTime? dataPagam { get; set; }
|
||||
|
||||
[Column("scadenza", Order = 9), DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public DateTime scadenza { get; set; }
|
||||
|
||||
[Column("token", Order = 10), MaxLength(250)]
|
||||
public string token { get; set; } = "";
|
||||
|
||||
[Column("new_id", Order = 11), MaxLength(50)]
|
||||
public string new_id { get; set; } = "";
|
||||
|
||||
[Column("dtEvent", Order = 12)]
|
||||
public DateTime dtEvent { get; set; }
|
||||
|
||||
[Column("changed", Order = 13)]
|
||||
public int changed { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Data.Entity.Infrastructure.MappingViews;
|
||||
|
||||
[assembly: DbMappingViewCacheTypeAttribute(
|
||||
typeof(SHERPA.BBM.FattDbContext),
|
||||
typeof(Edm_EntityMappingGeneratedViews.ViewsForBaseEntitySetsa98ba0b8c09d09077376bac5ee6a1952d01e61f4c783e65d3c07347567873c36))]
|
||||
|
||||
namespace Edm_EntityMappingGeneratedViews
|
||||
{
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Core.Metadata.Edm;
|
||||
|
||||
/// <summary>
|
||||
/// Implements a mapping view cache.
|
||||
/// </summary>
|
||||
[GeneratedCode("Entity Framework 6 Power Tools", "0.9.2.0")]
|
||||
internal sealed class ViewsForBaseEntitySetsa98ba0b8c09d09077376bac5ee6a1952d01e61f4c783e65d3c07347567873c36 : DbMappingViewCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a hash value computed over the mapping closure.
|
||||
/// </summary>
|
||||
public override string MappingHashValue
|
||||
{
|
||||
get { return "a98ba0b8c09d09077376bac5ee6a1952d01e61f4c783e65d3c07347567873c36"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a view corresponding to the specified extent.
|
||||
/// </summary>
|
||||
/// <param name="extent">The extent.</param>
|
||||
/// <returns>The mapping view, or null if the extent is not associated with a mapping view.</returns>
|
||||
public override DbMappingView GetView(EntitySetBase extent)
|
||||
{
|
||||
if (extent == null)
|
||||
{
|
||||
throw new ArgumentNullException("extent");
|
||||
}
|
||||
|
||||
var extentName = extent.EntityContainer.Name + "." + extent.Name;
|
||||
|
||||
if (extentName == "CodeFirstDatabase.FattModel")
|
||||
{
|
||||
return GetView0();
|
||||
}
|
||||
|
||||
if (extentName == "FattDbContext.DbSetFatture")
|
||||
{
|
||||
return GetView1();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for CodeFirstDatabase.FattModel.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView0()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing FattModel
|
||||
[CodeFirstDatabaseSchema.FattModel](T1.FattModel_IdxFatt, T1.FattModel_anno, T1.FattModel_num, T1.FattModel_idxCli, T1.FattModel_tipo, T1.FattModel_emesso, T1.FattModel_ritenuta, T1.FattModel_scelta, T1.FattModel_dataPagam, T1.FattModel_scadenza, T1.FattModel_token, T1.[FattModel.new_id], T1.FattModel_dtEvent, T1.FattModel_changed)
|
||||
FROM (
|
||||
SELECT
|
||||
T.IdxFatt AS FattModel_IdxFatt,
|
||||
T.anno AS FattModel_anno,
|
||||
T.num AS FattModel_num,
|
||||
T.idxCli AS FattModel_idxCli,
|
||||
T.tipo AS FattModel_tipo,
|
||||
T.emesso AS FattModel_emesso,
|
||||
T.ritenuta AS FattModel_ritenuta,
|
||||
T.scelta AS FattModel_scelta,
|
||||
T.dataPagam AS FattModel_dataPagam,
|
||||
T.scadenza AS FattModel_scadenza,
|
||||
T.token AS FattModel_token,
|
||||
T.new_id AS [FattModel.new_id],
|
||||
T.dtEvent AS FattModel_dtEvent,
|
||||
T.changed AS FattModel_changed,
|
||||
True AS _from0
|
||||
FROM FattDbContext.DbSetFatture AS T
|
||||
) AS T1");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view for FattDbContext.DbSetFatture.
|
||||
/// </summary>
|
||||
/// <returns>The mapping view.</returns>
|
||||
private static DbMappingView GetView1()
|
||||
{
|
||||
return new DbMappingView(@"
|
||||
SELECT VALUE -- Constructing DbSetFatture
|
||||
[SHERPA.BBM.FattModel](T1.FattModel_IdxFatt, T1.FattModel_anno, T1.FattModel_num, T1.FattModel_idxCli, T1.FattModel_tipo, T1.FattModel_emesso, T1.FattModel_ritenuta, T1.FattModel_scelta, T1.FattModel_dataPagam, T1.FattModel_scadenza, T1.FattModel_token, T1.[FattModel.new_id], T1.FattModel_dtEvent, T1.FattModel_changed)
|
||||
FROM (
|
||||
SELECT
|
||||
T.IdxFatt AS FattModel_IdxFatt,
|
||||
T.anno AS FattModel_anno,
|
||||
T.num AS FattModel_num,
|
||||
T.idxCli AS FattModel_idxCli,
|
||||
T.tipo AS FattModel_tipo,
|
||||
T.emesso AS FattModel_emesso,
|
||||
T.ritenuta AS FattModel_ritenuta,
|
||||
T.scelta AS FattModel_scelta,
|
||||
T.dataPagam AS FattModel_dataPagam,
|
||||
T.scadenza AS FattModel_scadenza,
|
||||
T.token AS FattModel_token,
|
||||
T.new_id AS [FattModel.new_id],
|
||||
T.dtEvent AS FattModel_dtEvent,
|
||||
T.changed AS FattModel_changed,
|
||||
True AS _from0
|
||||
FROM CodeFirstDatabase.FattModel AS T
|
||||
) AS T1");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data.Entity;
|
||||
|
||||
namespace SHERPA.BBM
|
||||
{
|
||||
public class FattDbContext : DbContext
|
||||
{
|
||||
// Il contesto è stato configurato per utilizzare una stringa di connessione 'BBMModel' dal file di configurazione
|
||||
// dell'applicazione (App.config o Web.config). Per impostazione predefinita, la stringa di connessione è destinata al
|
||||
// database 'BBMModel' nell'istanza di LocalDb.
|
||||
//
|
||||
// Per destinarla a un database o un provider di database differente, modificare la stringa di connessione 'BBMModel'
|
||||
// nel file di configurazione dell'applicazione.
|
||||
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
|
||||
//public DatabaseContext() : base("BBMModel")
|
||||
public FattDbContext() : base("Data Source=SQL2012DEV;Initial Catalog=SHERPA.Fatt;User ID=sa;Password=keyhammer16;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework")
|
||||
{
|
||||
}
|
||||
|
||||
public FattDbContext(string connectionString) : base(connectionString)
|
||||
{
|
||||
//Database.CreateIfNotExists();
|
||||
////Database.SetInitializer(new MigrateDatabaseToLatestVersion<StratonLocalizerDatabase, Migrations.Configuration>());
|
||||
//Database.Initialize(false);
|
||||
}
|
||||
|
||||
public virtual DbSet<DatabaseModels.FattModel> DbSetFatture { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,9 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\BBMController.cs" />
|
||||
<Compile Include="Costants.cs" />
|
||||
<Compile Include="DatabaseModels\FattModel.cs" />
|
||||
<Compile Include="FattDbContext.cs" />
|
||||
<Compile Include="FattDbContext.Views.cs" />
|
||||
<Compile Include="MainDbContext.cs" />
|
||||
<Compile Include="DatabaseModels\CustomersModel.cs" />
|
||||
<Compile Include="DatabaseModels\Fatt2DocModel.cs" />
|
||||
|
||||
Reference in New Issue
Block a user