Torna al Thread
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;
using System.Runtime.Serialization;
namespace FamigliaProdotti
{
[DataContract]
public class Famiglia
{
[XmlElement(ElementName = "FamigliaProdotto", IsNullable = true)]
public string FamigliaProdotto { get; set; }
[XmlElement(ElementName = "Id_FamigliaProdotti", IsNullable = true)]
public string Id_FamigliaProdotti { get; set; }
}
[DataContract]
public class FamigliaCollection : ILoader
{
[XmlArray(ElementName = "Collection", IsNullable = true)]
public List<Famiglia> Collection { get; set; }
[XmlElement(ElementName = "Result", IsNullable = true)]
public Result Result { get; set; }
public FamigliaCollection() {
this.Result = new Result();
}
#region ILoader Members
public void Load(System.Data.SqlClient.SqlDataReader reader)
{
this.Collection = new List<Famiglia>();
while (reader.Read())
{
Famiglia item = new Famiglia();
item.FamigliaProdotto = SQLRequester.GetDataFromReader(reader, "Famiglia");
item.Id_FamigliaProdotti = SQLRequester.GetDataFromReader(reader, "Id_FamigliaProdotti");
this.Collection.Add(item);
}
}
public void SetResult(Result result)
{
this.Result.Cod = result.Cod;
this.Result.Description = result.Description;
this.Result.LongDescription = result.LongDescription;
}
#endregion
}
}