Bonjour à tous,

Est ce que vous voyez un moyen de faire ces 2 requêtes LINQ en 1X ?
La 1ère requête me remonte les points manquants, la 2ème me remonte les points avec une puissance différente.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
 
List<GTMPoint> newListPoint = (from gtmPtInList in listPointWithout25H
                                               join gtmPtInDb in listPointDbWithout25H on gtmPtInList.IIdTypePoint equals gtmPtInDb.IIdTypePoint into sameTypePt
                                               join gtmPtInDb in listPointDbWithout25H on gtmPtInList.LIdCounter equals gtmPtInDb.LIdCounter into sameCptId
                                               join gtmPtInDb in listPointDbWithout25H on gtmPtInList.DtPoint equals gtmPtInDb.DtPoint into sameDatePoint
                                               from t in sameDatePoint.DefaultIfEmpty()
                                               where t == null
                                               select new GTMPoint(
                                                   gtmPtInList.LIdCounter,
                                                   (GTMEnum.GTMTypePt)gtmPtInList.IIdTypePoint,
                                                   1,
                                                   gtmPtInList.DPuissance,
                                                   gtmPtInList.DtPoint,
                                                   gtmPtInList.DtVersion,
                                                   gtmPtInList.CValidation,
                                                   gtmPtInList.GtmGranularite
                                               )).ToList();
 
 
List<GTMPoint> updatedListPoint = (from gtmPtInList in listPointWithout25H
                                                   join gtmPtInDb in listPointDbWithout25H on gtmPtInList.IIdTypePoint equals gtmPtInDb.IIdTypePoint into sameTypePt
                                                   join gtmPtInDb in listPointDbWithout25H on gtmPtInList.LIdCounter equals gtmPtInDb.LIdCounter into sameCptId
                                                   join gtmPtInDb in listPointDbWithout25H on gtmPtInList.DtPoint equals gtmPtInDb.DtPoint into sameDatePoint
                                                   from t in sameDatePoint.DefaultIfEmpty()
                                                   where t != null && (float)gtmPtInList.DPuissance != (float)t.DPuissance
                                                   select new GTMPoint(
                                                       t.LIdCounter,
                                                       (GTMEnum.GTMTypePt)t.IIdTypePoint,
                                                       t.IVersion + 1,
                                                       gtmPtInList.DPuissance,
                                                       gtmPtInList.DtPoint,
                                                       gtmPtInList.DtVersion,
                                                       gtmPtInList.CValidation,
                                                       gtmPtInList.GtmGranularite
                                                   )).ToList();