1. C# / Говнокод #24396

    0

    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
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    try 
    { 
    docdate = po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].PaperCredentials[0].IssueDate; 
    } 
    catch 
    { 
    docdate = "01.01.1900"; 
    } 
    
    
    
    try 
    { 
    docwho = po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].PaperCredentials[0].Issuer; 
    } 
    catch 
    { 
    docwho = ""; 
    } 
    
    try 
    { 
    dockod = po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].PaperCredentials[0].IssuerCode; 
    } 
    catch 
    { 
    dockod = ""; 
    } 
    
    phone = po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].Phone; 
    
    try 
    { 
    docser = po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].PaperCredentials[0].SerialNumber; 
    } 
    catch 
    { 
    docser = ""; 
    } 
    
    try 
    { 
    docnom = po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].PaperCredentials[0].CNumber; 
    } 
    catch 
    { 
    docnom = ""; 
    } 
    
    birthplace = ""; 
    try 
    { 
    birthplace = po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].Registry[5].PValue.ToString().Trim(); 
    } 
    catch 
    { 
    birthplace = ""; 
    } 
    
    
    try 
    { 
    birthplace = birthplace + ", " + po.Items[0].ReqSendTransferList[0].TransferData[0].Payer[0].Registry[6].PValue.ToString().Trim(); 
    } 
    catch 
    { 
    s = ""; 
    }

    NullReference - нет, не слышал

    awesome3000, 20 Июня 2018

    Комментарии (4)
  2. C# / Говнокод #24278

    −2

    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
    public class Parameter
    {
      public string Name { get; }
      public int Value { get; }
    
      private Parameter(string name, int value)
      {
        Name = name;
        Value = value;
      }
    
      public static Func<int, Parameter> GetDeferredConstructor(string name)
      {
        return value => new Parameter(name, value);
      }
    }
    
    public class Program
    {
      public static void Main(string[] args)
      {
        var dc = Parameter.GetDeferredConstructor("param");
        var p = dc(5);
      }
    }

    mazhuravlev, 17 Мая 2018

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

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public override bool IsViewFromObject(View view, Java.Lang.Object @object)
    		{
    			// actually... i don't know
    			return true;
    		}

    Прод код одного ведро-приложения, адаптер к листалке

    cherepets, 09 Мая 2018

    Комментарии (0)
  4. C# / Говнокод #24212

    0

    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
    private static bool IsOnlyServiceWindowsFile(string directory)
    {
    	string[] ignoredFiles = { "Thumbs.db", "Desktop.ini" };
    	var files = Directory.GetFiles(directory);
    	foreach (var file in files)
    	{
    		var filename = Path.GetFileName(file);
    		foreach (var ignored in ignoredFiles)
    		{
    			if (string.Equals(filename, ignored, StringComparison.OrdinalIgnoreCase))
    			{
    				goto NEXT;
    			}
    		}
    		return false;
    		NEXT: ;
    	}
    	return true;
    }

    Пришёл в C# из Java, где есть замечательная фича под названием Label.
    В C# для вложенных циклов оказался лишь GOTO.
    Метод проверяет наличие в каталоге только сервисных файлов винды.

    brnovk, 01 Мая 2018

    Комментарии (8)
  5. C# / Говнокод #24197

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    using (var stream = File.Open(inFile, FileMode.Open))
    using (var reader = new StreamReader(stream))
    using (var csvReader = new CsvReader(reader, new Configuration
    {
    HeaderValidated = HeaderValidated,
    MissingFieldFound = null,
    PrepareHeaderForMatch = header =>
        CultureInfo.CurrentCulture.TextInfo.ToTitleCase(header)
    }))
    using (var outStream = File.Open(outFile, FileMode.CreateNew, FileAccess.Write, FileShare.Read))
    using (var writer = new StreamWriter(outStream))
    using (var csvWriter = new CsvWriter(writer))

    mazhuravlev, 26 Апреля 2018

    Комментарии (43)
  6. C# / Говнокод #24189

    +1

    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
    public static class MyExtensions {
      private static Random _random = new Random(); 
      
      public static bool IsMnogo(this object value) {
        try {
          var n = double.Parse(value.ToString());
          return n > 9999999999;
        } catch {
          return true;
        }
      }
      
      public static bool IsDavno(this DateTime value) {
        return value < new DateTime(1900 + _random.Next(10, 90), 04, 17);
      }
    }

    mazhuravlev, 21 Апреля 2018

    Комментарии (4)
  7. C# / Говнокод #24090

    +3

    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
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    namespace CarsKursova
    {
        public static class Car
        {
            public static int x1, x2, x3, x4, x5, x6, x7, x8, x9, x10,
                                x11, x12, x13, x14, x15, x16, x17, x18, x19, x20,
                                x21, x22, x23, x24, x25, x26, x27, x28, x29, x30,
                                x31, x32, x33, x34, x35, x36, x37, x38, x39, x40,
                                x41, x42, x43, x44, x45, x46, x47, x48, x49, x50,
                                x51, x52, x53, x54, x55, x56, x57, x58, x59, x60,
                                x61, x62, x63, x64, x65, x66, x67, x68, x69, x70,
                                x71, x72, x73, x74, x75, x76, x77, x78, x79, x80,
                                x81, x82, x83, x84,
                                y1, y2, y3, y4, y5, y6, y7, y8, y9, y10,
                                y11, y12, y13, y14, y15, y16, y17, y18, y19, y20,
                                y21, y22, y23, y24, y25, y26, y27, y28, y29, y30,
                                y31, y32, y33, y34, y35, y36, y37, y38, y39, y40,
                                y41, y42, y43, y44, y45, y46, y47, y48, y49, y50,
                                y51, y52, y53, y54, y55, y56, y57, y58, y59, y60,
                                y61, y62, y63, y64, y65, y66, y67, y68, y69, y70,
                                y71, y72, y73, y74, y75, y76, y77, y78, y79, y80,
                                y81, y82, y83, y84;
            public static string car = " ";
            public static bool game_over = false;
            public static bool fix = true;
            public static int score = 0;
            public static char[,] game_grond = new char[35, 29];
            public static char[,] game_gr = new char[35, 29];
    ....
    }
     public static void RisovPole()
            {
                p = Console.CursorTop;
                z = Console.CursorLeft;
                Console.ForegroundColor = ConsoleColor.Cyan;
                WriteAt("|*|", 29, 0);
                WriteAt("|*|", 29, 1);
                WriteAt("|*|", 29, 2);
                WriteAt("|*|", 29, 3);
                WriteAt("|*|", 29, 4);
                WriteAt("|*|", 29, 5);
                WriteAt("|*|", 29, 6);
                WriteAt("|*|", 29, 7);
                WriteAt("|*|", 29, 8);
                WriteAt("|*|", 29, 9);
                WriteAt("|*|", 29, 10);
                WriteAt("|*|", 29, 11);
                WriteAt("|*|", 29, 12);
                WriteAt("|*|", 29, 13);
                WriteAt("|*|", 29, 14);
                WriteAt("|*|", 29, 15);
                WriteAt("|*|", 29, 16);
                WriteAt("|*|", 29, 17);
                WriteAt("|*|", 29, 18);
                WriteAt("|*|", 29, 19);
                WriteAt("|*|", 29, 20);
                WriteAt("|*|", 29, 21);
                WriteAt("|*|", 29, 22);
                WriteAt("|*|", 29, 23);
                WriteAt("|*|", 29, 24);
                WriteAt("|*|", 29, 25);
                WriteAt("|*|", 29, 26);
                WriteAt("|*|", 29, 27);
                WriteAt("|*|", 29, 28);
                WriteAt("|*|", 29, 29);
                WriteAt("|*|", 29, 30);
                WriteAt("|*|", 29, 31);
                WriteAt("|*|", 29, 32);
                WriteAt("|*|", 29, 33);
                WriteAt("|*|", 29, 34);
                WriteAt("-----------------------------+*|", 0, 35);
                WriteAt("*******************************|", 0, 36);
                WriteAt("-------------------------------+\n\n\n\n\n\n\n\n\n\n\n", 0, 37);
                Console.ResetColor();
            }
    public static void carplins()
            {
                y1 = 27; x1 = 13; y22 = 31; x22 = 13;
                y2 = 27; x2 = 14; y23 = 31; x23 = 14;
                y3 = 27; x3 = 15; y24 = 31; x24 = 15;
                y4 = 28; x4 = 13; y25 = 32; x25 = 13;
                y5 = 28; x5 = 14; y26 = 32; x26 = 14;
                y6 = 28; x6 = 15; y27 = 32; x27 = 15;
     
                y7 = 29; x7 = 10; y28 = 33; x28 = 10;
                y8 = 29; x8 = 11; y29 = 33; x29 = 11;
                y9 = 29; x9 = 12; y30 = 33; x30 = 12;
                y10 = 29; x10 = 13; y31 = 33; x31 = 13;
                y11 = 29; x11 = 14; y32 = 33; x32 = 14;
                y12 = 29; x12 = 15; y33 = 33; x33 = 15;
                y13 = 29; x13 = 16; y34 = 33; x34 = 16;
                y14 = 29; x14 = 17; y35 = 33; x35 = 17;
                y15 = 29; x15 = 18; y36 = 33; x36 = 18;
     
                y16 = 30; x16 = 10; y37 = 34; x37 = 10;
                y17 = 30; x17 = 11; y38 = 34; x38 = 11;
                y18 = 30; x18 = 12; y39 = 34; x39 = 12;
                y19 = 30; x19 = 16; y40 = 34; x40 = 16;
                y20 = 30; x20 = 17; y41 = 34; x41 = 17;

    Тетрисные гонки в консоли.
    По ссылке - дермомонстр на 400 строк - http://www.cyberforum.ru/csharp-beginners/thread2169797.html

    ikekyourmom, 07 Апреля 2018

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

    +4

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    namespace Namespace1MClasses {
    class Class5767fc98348a4db08bb9d3060952a635{}
    class Class75ab2af2b74a47938afdae2bd872200a{}
    class Class260cb81210034110becbb597bdcc6998{}
    class Class6c59a9e949854eac83af6ea9d518940d{}
    class Class35cfa32cfd3147c98f8ed82636ac4b48{}
    class Class7f1737ab1b2f4309be88e2341f14e2d4{}
    class Classd06c3c37d79046baabff72e3836a87a1{}
    class Class5f08fa4449ec43b5a50279e5e902fa02{}
    class Class565ecbffda51402a99f36c8a2f821a25{}
    class Classf19f1cf5f40045e2a55e6a6c17d405c1{}
    class Class6e101b41d48f4e87afd97b1da46fba6c{}
    class Classbb7d03f31b244f6eb24620c33afae769{}
    class Class913c65ac3eea4b229ea8bd276e28223c{}
    class Class3e385f5cbe5e4b02a161aca344db9c98{}
    class Class3836b56fcaca446ab24b2275d90b8b8a{}
    class Class2213bd25c3b141b6b95b9f9e819fb79e{}
    class Classbd827de0d34d4a5ebb349ae0f0a75851{}
    class Classe6d589e1fe4e4642a05c9106b62b117a{}
    class Classbfcefe3a68cd44b7a19230c0296779a5{}
    class Classa3c64035fbfc40f5afe89f797388aa05{}
    class Classf8d5f0976ee542299c8d73c485cdb556{}
    class Classadb1ff5394d544fe910765e2625bed5e{}
    class Class7af9b84c9ead4beba8644dbd97def2dd{}
    class Class12856419b46e4958bf996026d559f601{}
    class Class5b8a6aa0be4a4a02a84fafcdcbf3294f{}
    class Classa1874e9d89f9454cbe5c40baaefe83d2{}
    class Classc0587bf7da9f4aa1b36cf0160867c6ab{}
    class Classaa9e86dc75b44dfeb3cdc421053bfdd8{}
    class Classf43b6eaf931e479ea54e9c6bd57f129d{}
    class Class92034bfae0c04ec293dc4f5479d6bcde{}
    class Class3e32c4d44e5940eb8d6bae757d99ef29{}
    class Classde3618ec5f3a462ea9796a53466bb687{}
    class Class2c6e66647c8245078b4f1ec569862034{}
    class Class2546e87bc2cd4a98a866fae9eb81bcb0{}
    class Class341aea5c2b6147268568e704a91bb17b{}
    class Classcd1a2fc791d64c25ae8a664aaae92a2f{}
    class Class2abbca20a77141308608575808165f5a{}
    class Class20af1b0bb09547119e12dd179cc98a2a{}
    class Class709b25e5e6c34ef18ea196b7bfe8efaf{}
    class Class56fdcc53dc9240849129b2b1ddd3324b{}
    class Class791d67bb198d47c9a50dc59841f9b8bb{}
    class Class7c7a325869144be5a5a14a3b98390bd5{}
    class Class47f3bef481f142ea973f8789f48c4fbb{}
    class Class18563daa230e48ddb020cc1394e4a412{}
    class Class703ef4c7f9aa49eea9abac5d57f1beac{}
    class Class12ab7b29fcc2441fb1604a9e55dde515{}
    class Class877f0e7bee3648bba781d2aeb9bd5622{}
    class Class6e2e216871ec42a3a9e80c1d83117447{}
    class Classab8eb86e7f244dfa94cc3d3781224b2b{}
    class Classaacd9d9bff7141b39d1d17ab58eae4f5{}
    class Class69fa8652a2984cc1897abcc19e4372c1{}
    class Class7d6ad8b7cdd04ff0a6c3c9b183f5beac{}
    class Class6c145606b8a94ccbac0dfd25a6ba0197{}
    class Class253ce178fc45423cbf4339108c51a4a2{}
    class Class04983d42c46c481cab900b96db9fc2e1{}
    class Class1ab1c4328c91462b85eadad32ae13f6c{}
    class Classf2bead396ab249a7a3e4f61b60e995f6{}
    class Class73e3103c8d074b29af226af66f304c2b{}
    class Class500fc4b0583748c3a50e9d8f48d7e234{}
    class Classb6b604e530a541ababc6c6750fba1046{}
    class Class318c287a84d54928976dfb428cdc105c{}
    class Classa1cc4f9bebd74addac381e93f617e4f9{}
    class Classb9f272959e4349b5aa22c97be5c0e18a{}
    class Class94984d16b194465e91d9e24a898e83f2{}
    class Class534092502cfa4889bba53021c69e6920{}
    class Classfac52b74ad734f9ba33d4ecc37a3f8a8{}
    class Class8bc35286ec454be6bf48b228afb79d5c{}
    class Class5d500533615d42dcba75f8e43597cbc2{}
    class Class554bbe4d4a0740faa8f2ad2cbadeed61{}
    class Classf80510ff691f4f93862aea7b53d3d4e1{}
    class Classa83763ffb2704de791122ae361f97608{}
    class Class3fb85c7bc8d847678ddad621c289c976{}
    class Class23e7bb3156b64a7eb40f0161c845c290{}
    class Class5ef39f49cb0a4f628c9e6f5111956bd6{}
    class Classd6865e226afb4907aca657d913c8c6e3{}
    class Class58c4e4c7d678440781a5c296c4f0487c{}
    class Class9b908bff3f954e4cb102cc2a625a7087{}
    class Classf79c858cb7da41ab8f4a52f815cb136c{}
    class Classd649f76c58d947e0b07926133b27c9b0{}
    class Class64d42b7b35714c64ad1858ff100128e8{}
    class Class4dac3551ad72416788a27c490c2f09e1{}
    class Class430cc255295f40e7ae0e4ce8bb78485a{}
    class Classffff24bfb81a402586ae1b0e0b378f12{}
    class Class6f28a470deb04dc1bcb227ea53ae5484{}
    class Class55fe212aeded4c5aa9240a7d2aeaed07{}
    class Class7558ac2c1d7d4b0da15c885ecbedfe66{}
    class Classae9fd410f3a149a6a0c2a83d5eaa8956{}
    class Class6124283b1d934c75a5f98264537227ef{}
    class Classaca17e04d35b492d86dda4359f95568c{}
    class Class956a1301d5b24e3b9a9ae1a9e2a2e1c8{}
    class Classe00a485a2629483d81eaaa6d642a2e7b{}
    class Class09185376764c40d49dd03ce13ed36ebe{}
    class Classe006ec8603484d8f876431723527beb2{}
    class Class6f3be3b31b12475abd78b6c2f686e824{}
    class Class0b0fcd2c6e6e451c9954e769f494093d{}
    class Class845b5c7cf0fd40c08d7b60e0b1aa6d83{}
    class Classb47acedf712140c194908dfc6bd4cf57{}
    class Classc7b969ddd5cb44c58b55438dece1bd1d{}
    class Class9f6d3bc78d9b4343af65fb481c4a4800{}

    mazhuravlev, 05 Апреля 2018

    Комментарии (12)
  9. C# / Говнокод #24017

    0

    1. 1
    2. 2
    3. 3
    4. 4
    catch
    {
        Assert.IsTrue(false);
    }

    Код в нутри теста

    AleXK, 27 Марта 2018

    Комментарии (18)
  10. C# / Говнокод #24001

    0

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    public List<SpecialtyToCollege> SpecialtyToCollegeForKcp(int collegeID)
    {
    			List<SpecialtyToCollege> result = new List<SpecialtyToCollege>();
    			var allKcp = _dataContext.fkcKcp.Where(el => el.CollegeId == collegeID && el.Deleted == null && el.Year == 18 && el.Count != 0 && el.OrgId != 1382).ToList();
    			var lisitems = _dataContext.fkcListItems.ToList();
    			foreach (fkcKcp t in allKcp)
    			{
    				var LevelIds = _dataContext.fkcSpecialties.SingleOrDefault(el => el.id == t.SpecId).LevelID;
    
    				string FormTitle = "";
    				if (t.FormId == 7)
    				{
    					FormTitle = _dataContext.fkcListItems.SingleOrDefault(el => el.id == 8).Title;
    				}
    				else if (t.FormId == 8)
    				{
    					FormTitle = _dataContext.fkcListItems.SingleOrDefault(el => el.id == 7).Title;
    				}
    				else
    				{
    					FormTitle = _dataContext.fkcListItems.SingleOrDefault(el => el.id == t.FormId).Title;
    				}
    
    				fkcSpecialty spec = _dataContext.fkcSpecialties.SingleOrDefault(el => el.id == t.SpecId);
    				fkcOrganisation org = _dataContext.fkcOrganisation.SingleOrDefault(el => el.id == t.OrgId);
    
    				if (spec != null && org != null)
    				{
    					string LevelTitle = lisitems.SingleOrDefault(el => el.id == LevelIds).Title;
    					int? Region = _dataContext.fkcOrganisation.SingleOrDefault(el => el.id == t.OrgId).SubRegionID;
    					string OrgRegion = lisitems.SingleOrDefault(el => el.id == Region).Title;
    
    					result.Add(new SpecialtyToCollege(
    						t,
    						LevelIds,
    						LevelTitle,
    						spec.Code,
    						spec.Title,
    						org.Title,
    						org.lCity,
    						OrgRegion,
    						FormTitle
    						)
    					);
    				}
    			}
    			return result;
    		}
    
    		public List<SpecialtyAndFormKcp> SpecialtyFormKcp()
    		{
    			List<SpecialtyAndFormKcp> result = new List<SpecialtyAndFormKcp>();
    			var allKcp = _dataContext.fkcKcp.Where(el => el.Deleted == null && el.Year == 18 && el.Count != 0 && el.OrgId != 1382).ToList();
    			var lisitems = _dataContext.fkcListItems.ToList();
    			foreach (fkcKcp t in allKcp)
    			{
    				var LevelIds = _dataContext.fkcSpecialties.SingleOrDefault(el => el.id == t.SpecId).LevelID;
    				string LevelTitle = "";
    				string Code = "";
    				string SpecTitle = "";
    				string FormTitle = "";
    				int FormId;
    				int SpecId;
    				if (t.FormId == 7)
    				{
    					FormTitle = _dataContext.fkcListItems.SingleOrDefault(el => el.id == 8).Title;
    				}
    				else if (t.FormId == 8)
    				{
    					FormTitle = _dataContext.fkcListItems.SingleOrDefault(el => el.id == 7).Title;
    				}
    				else
    				{
    					FormTitle = _dataContext.fkcListItems.SingleOrDefault(el => el.id == t.FormId).Title;
    				}
    				FormId = t.FormId;
    				LevelTitle = lisitems.SingleOrDefault(el => el.id == LevelIds).Title;
    				Code = _dataContext.fkcSpecialties.SingleOrDefault(el => el.id == t.SpecId).Code;
    				SpecId = _dataContext.fkcSpecialties.SingleOrDefault(el => el.id == t.SpecId).id;
    				SpecTitle = _dataContext.fkcSpecialties.SingleOrDefault(el => el.id == t.SpecId).Title;
    				if (result.SingleOrDefault(el => el.SpecId == SpecId && el.FormTitle == FormTitle) == null)
    				{
    					result.Add(new SpecialtyAndFormKcp(SpecId, FormId, LevelTitle, Code, SpecTitle, FormTitle));
    				}
    			}
    
    			return result;
    		}
    
    		public List<KcpSpecOrgCollege> KcpSpecOrgCollege(int specID, int formID)
    		{
    			List<KcpSpecOrgCollege> result = new List<KcpSpecOrgCollege>();
    			var allKcp = _dataContext.fkcKcp
    				.Where(el => el.SpecId == specID && el.FormId == formID && el.Deleted == null && el.Year == 18 && el.Count != 0 && el.OrgId != 1382).ToList();
    			var lisitems = _dataContext.fkcListItems.ToList();
    			foreach (fkcKcp t in allKcp)
    			{
    				var SpecID = _dataContext.fkcSpecialties.SingleOrDefault(el => el.id == t.SpecId).id;
    				var CollegeRegionID = _dataContext.fkcCollege.SingleOrDefault(el => el.id == t.CollegeId).RegionID;
    				string CollegeTitle = "";

    hadouken247, 26 Марта 2018

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