http://img7.imageshack.us/img7/3050/downtime.pngtableau croisé dynamique dynamique LinqToSQL requête
J'ai deux ramasseurs de calendrier (vers et à partir), je dois construire le Année1 -> 4 dynamicly. Je reçois également des enregistrements dupliqués pour 1 articles qui ont des valeurs pour 2006 et 2009. Ils peuvent choisir 100 ans s'ils le voulaient aussi. Vérifiez l'image ci-jointe.
public ActionResult DownTimeSummaryTabular(int Start,int End)
{
var q = from item in new iSppms.Models.iSppmsDataContext().Incidents
group item by new
{
item.Supplier.Id,
item.Supplier.Name,
item.SupplierPlant,item.DownTime
}
into supplier
select new
{
SupplierId = supplier.Key.Id,
SupplierName = supplier.Key.Name,
SupplierPlant = supplier.Key.SupplierPlant.Plant,
Years = from incident in supplier
let year = incident.IncidentDate.Year
where year <= End and year >= Start
group incident by year into incidentForYear
select incidentForYear.DownTime
};
return View();
}
hmmm Je reçois des erreurs sur ce code? –
où l'année <= Fin et année> = Démarrer –
sélectionnez incident.DownTime.ToIntOrDefault() –