Skip to content

Instantly share code, notes, and snippets.

@WaYdotNET
Created April 17, 2012 10:59
Show Gist options
  • Save WaYdotNET/2405302 to your computer and use it in GitHub Desktop.
Save WaYdotNET/2405302 to your computer and use it in GitHub Desktop.
Nustache
var listaFatture = new List<Fatture>();
listaFatture.Add(new Fatture(15, "Fattura fittizzia", DateTime.Now));
listaFatture.Add(new Fatture(0, "Fattura FOOOO", DateTime.Now));
listaFatture.Add(new Fatture(35000, "BAAARRRRR", DateTime.Now));
var obb = new obbligatori();
obb.Descrizione = "descrizione sommaria";
obb.Nome = "che bel nome : fooo {{foo}}";
obb.Fattures = listaFatture;
Render.FileToFile("template.txt", obb, "out.html");
class Fatture
{
public int IdFattura { get; set; }
public string NomeFattura { get; set; }
public DateTime DataFattura { get; set; }
public Fatture(int id_fattura, string nome_fattura, DateTime data_fattura)
{
IdFattura = id_fattura;
NomeFattura = nome_fattura;
DataFattura = data_fattura;
}
}
class obbligatori
{
public string Nome { get; set; }
public string Descrizione { get; set; }
public List<Fatture> Fattures { get; set; }
public obbligatori(){}
public obbligatori(string nome, string descrizione, List<Fatture> fattures )
{
Nome = nome;
Descrizione = descrizione;
Fattures = fattures;
}
}
Questo template di obbligatori funziona!!
infatti la descrizione � "descrizione sommaria"
Il nome del documento. che bel nome : fooo {{foo}} ... bello come nome, non trovi ???
Mentre la lista delle fattura che vengono passate sono
-----------------------------------------
|-- Data : 17/04/2012 12:56:23 , Numero: 15
| Fattura fittizzia
-------------------------------------------
-----------------------------------------
|-- Data : 17/04/2012 12:56:23 , Numero: 0
| Fattura FOOOO
-------------------------------------------
-----------------------------------------
|-- Data : 17/04/2012 12:56:23 , Numero: 35000
| BAAARRRRR
-------------------------------------------
Questo template di obbligatori funziona!!
infatti la descrizione è "{{Descrizione}}"
Il nome del documento. {{Nome}} ... bello come nome, non trovi ???
Mentre la lista delle fattura che vengono passate sono
{{#Fattures}}
-----------------------------------------
|-- Data : {{DataFattura}} , Numero: {{IdFattura}}
| {{NomeFattura}}
-------------------------------------------
{{/Fattures}}
@WaYdotNET
Copy link
Author

Email generata pre invio
{{User}}

{{art_0}

{{art_1}

{{art_n}}

@WaYdotNET
Copy link
Author

Dictionary<string, string>

"art_0": "cod_codificato_con_id_mws_id_art_id_user"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment