1. Список говнокодов пользователя workgss

    Всего: 2

  2. SQL / Говнокод #2351

    −861.7

    1. 1
    2. 2
    3. 3
    select ...
    where ISNULL(e2e.ItemId, -1) = (case when @itemId < 1 then ISNULL(e2e.ItemId, -1) else @itemId end) 
    and ISNULL(e2e.LeftId, -1) = (case when @parentItemId < 1 then ISNULL(e2e.LeftId, -1) else @parentItemId) end

    workgss, 29 Декабря 2009

    Комментарии (3)
  3. C# / Говнокод #2350

    +132.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    var ChildListWithCondition =
                    (from list in ChildList
                     join requestedRelatedEntityIds in EntitiesIdInList on list.ParentEntityId equals requestedRelatedEntityIds
                     join requestedEntityType in EntityTypeIdToTake on list.EntityTypeId equals requestedEntityType)
                     .Select(list => 
                         new LayoutDataOutputStructure()
                         {
                             ParentEntityId = list.ParentEntityId,
                             EntityId = list.EntityId,
                             FieldId = list.FieldId,
                             FieldValue = list.FieldValue,
                             EntityTypeId = list.EntityTypeId,
                             RelationTypeToParent = list.RelationTypeToParent,
                             FieldValueId = list.FieldValueId
                         })
                    .GroupBy(item => item.ParentEntityId)
                    .Select(group => new
                        {
                            ParentEntityId = group.Key,
                            GroupEntityTypeId = group.GroupBy(item => item.EntityTypeId)
                                .Select(group2 => new
                                                     {
                                                        EntityTypeId = group2.Key,
                                                        EntityRelation = group2.Select(item => item.RelationTypeToParent).FirstOrDefault(),
                                                        GroupEntityId = group2.GroupBy(group3 => group3.EntityId)
                                                            .Select(group3 => new
                                                                                  {
                                                                                      EntityId = group3.Key, 
                                                                                      Fields = group3.GroupBy(group4 => group4.FieldId)
                                                                                        .Select(group4 => new { FieldId = group4.Key, FieldValues = group4 })
                                                                                        
                                                                                  })
                                                     }
                                    )
                        }
                    )
                    .ToList();

    workgss, 29 Декабря 2009

    Комментарии (8)