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

    −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
    protected void ASPxUploadControl1_FilesUploadComplete(object sender, DevExpress.Web.ASPxUploadControl.FilesUploadCompleteEventArgs e)
            {
                if (Request.Cookies["LID"] != null)
                {
                    int ListId = Convert.ToInt32(Request.Cookies["LID"].Value);
                    Response.Cookies["LID"].Expires = DateTime.Now.AddDays(-1);
                    foreach (DevExpress.Web.ASPxUploadControl.UploadedFile uf in ASPxUploadControl1.UploadedFiles)
                    {
                        uf.SaveAs(@"C:\TEMP\ListUploads\" + uf.FileName, true);
                        ListInfo.ImportList(Convert.ToInt16(ListId), @"C:\TEMP\ListUploads\" + uf.FileName);
                    }
                }
            }

    блять, это же каким инвалидом надо быть, чтобы так сделать загрузку файла в базу?

    Lokich, 06 Июня 2017

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

    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
    OleDbCommand command = new OleDbCommand("select * from Прейскурант where ID = 1", bd);
                    OleDbDataReader dataReader1 = command.ExecuteReader();
                    string st;
                    dataReader1.Read();
    
                    int i = 0;
    
                    while (i < dataReader1.FieldCount)
                    {
                        st = dataReader1.GetValue(i).ToString();
                        switch (i)
                        {
                            case 0:
                                textBox1.Text = st;
                                break;
                            case 1:
                                textBox2.Text = st;
                                break;
                            case 2:
                                textBox3.Text = st;
                                break;
                            case 3:
                                textBox4.Text = st;
                                break;
                            case 4:
                                textBox5.Text = st;
                                break;
                            case 5:
                                textBox6.Text = st;
                                break;
                            case 6:
                                textBox7.Text = st;
                                break;
                            case 7:
                                textBox8.Text = st;
                                break;
                            case 8:
                                textBox9.Text = st;
                                break;
                            case 9:
                                textBox10.Text = st;
                                break;
                            case 10:
                                textBox11.Text = st;
                                break;
                            case 11:
                                textBox12.Text = st;
                                break;
                            case 12:
                                textBox13.Text = st;
                                break;
                            case 13:
                                textBox14.Text = st;
                                break;
                            case 14:
                                textBox15.Text = st;
                                break;
                        }
                        i++;
    
    
                    }
                    dataReader1.Close();
                    bd.Close();

    Заполнение текстбоксов WinForms данными из бд. Пацан на 4-м курсе.

    IWillBeHokage, 30 Мая 2017

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

    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
    GUI.backgroundColor = Color.magenta;
    
                prop = parametersObject.GetIterator();
                var skip = true;
    
                while (prop.NextVisible(true))
                {
                    //Script object Field
                    if (skip)
                    {
                        skip = false;
                        continue;
                    }
    
                    if (prop.depth == 0)
                    {
                        position.height = propertyHeight;
                        EditorGUI.PropertyField(position, prop);
                        position.y += propertyWithSpaceHeight;
                    }
                }
    
                if (EditorGUI.EndChangeCheck())
                {
                    if (parametersObject != null && parametersObject.targetObject != null)
                    {
                        parametersObject.ApplyModifiedProperties();
                        EditorUtility.SetDirty(parametersObject.targetObject);
                    }
                }
    
                parametersProperty.stringValue = JsonUtility.ToJson(parametersObject.targetObject);
    
                GUI.backgroundColor = Color.white;

    //Код исполняется 60 раз в секунду ((((

    huran438, 28 Мая 2017

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

    −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
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    GUI.backgroundColor = Color.magenta;
    
                prop = parametersObject.GetIterator();
                var skip = true;
    
                while (prop.NextVisible(true))
                {
                    //Script object Field
                    if (skip)
                    {
                        skip = false;
                        continue;
                    }
    
                    if (prop.depth == 0)
                    {
                        position.height = propertyHeight;
                        EditorGUI.PropertyField(position, prop);
                        position.y += propertyWithSpaceHeight;
                    }
                }
    
                if (EditorGUI.EndChangeCheck())
                {
                    if (parametersObject != null && parametersObject.targetObject != null)
                    {
                        parametersObject.ApplyModifiedProperties();
                        EditorUtility.SetDirty(parametersObject.targetObject);
                    }
                }
    
                parametersProperty.stringValue = JsonUtility.ToJson(parametersObject.targetObject);
    
                GUI.backgroundColor = Color.white;

    //Код исполняется 60 раз в секунду ((((

    huran438, 28 Мая 2017

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

    −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
    if (this.btn1.Content.ToString() == this.currentSide.ToString() && this.btn2.Content.ToString() == this.currentSide.ToString() && this.btn3.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn4.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn6.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn7.Content.ToString() == this.currentSide.ToString() && this.btn8.Content.ToString() == this.currentSide.ToString() && this.btn9.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn1.Content.ToString() == this.currentSide.ToString() && this.btn4.Content.ToString() == this.currentSide.ToString() && this.btn7.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn2.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn8.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn3.Content.ToString() == this.currentSide.ToString() && this.btn6.Content.ToString() == this.currentSide.ToString() && this.btn9.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn1.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn9.Content.ToString() == this.currentSide.ToString())
    this.Victory();
    else if (this.btn3.Content.ToString() == this.currentSide.ToString() && this.btn5.Content.ToString() == this.currentSide.ToString() && this.btn7.Content.ToString() == this.currentSide.ToString())
    this.Victory();

    Проверка на победу в крестиках-ноликах.

    fedor-analplay, 22 Мая 2017

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

    +1412

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    counter++;
                        if (counter == 10)
                        {
                            Console.WriteLine();
                            counter = 0;
                        }

    Не сразу понял, что делает этот код.

    Langnasen_Dora, 07 Мая 2017

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

    −236

    1. 1
    2. 2
    string str = "trial evaluation license agreement expire about... looking for these words? I work like a fool to deliver high quality software and make a living of it and raise my children. Please support me if you want me to continue adding features";
            str = string.Concat(str, str);

    интересненькое из ndepend.core.dll

    reversemyass, 10 Октября 2016

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

    −12

    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
    using System;
    
    
    namespace Aquapear.StringTools
    {
    	
    	/// <summary> Объединяет строки, вставляя между ними разделитель, но в конце разделитель не ставится. </summary>
    	public static class StringsJoiner
    	{
    		
    		public static String Join(String[] bits, String separator) {
    			/*if(separator.Length==0) {
    				int bitsLength = bits.Length;
    				StringBuilder builder = new StringBuilder(bits.Length);
    					for(int i = 0; i < bitsLength; i++) {
    						builder.AddLast( bits[i] );
    					}
    				return builder.Build();
    			}*/
    			return String.Join(separator, bits);
    			/*
    			int bitsLength = bits.Length;
    
    			if(bitsLength == 0) return "";
    			if(separator.Length==0) return CloseJoin(bits);
    			
    			int allCharsLength = separator.Length*(bits.Length-1);
    			for(int i = 0; i < bitsLength; i++) {
    				allCharsLength += bits[i].Length;
    			}						
    			char[] chrs = new char[allCharsLength];
    			int wordIndex = 0, wordProgress = 0;
    			bool separatorMode = false;
    
    			string word = bits[0];
    			int wordLength = word.Length;
    				
    				for(int i = 0; i < allCharsLength; i++) {
    					if(separatorMode) {
    						chrs[i] = word[wordProgress];
    						wordProgress++;
    						if(wordProgress>=wordLength) {
    							separatorMode = false;
    							wordProgress = 0;
    							word = bits[wordIndex];
    							wordLength = word.Length;
    						}
    
    					} else {
    						chrs[i] = (wordLength >= 1) ? word[wordProgress] : '\0';
    						wordProgress++;
    						if(wordProgress >= wordLength) {
    							separatorMode = true;
    							wordProgress = 0;
    							wordIndex++;
    							if(word.Length == 0) i--;
    							word = separator;
    							wordLength = word.Length;
    						}
    					}
    				}
    			return new String(chrs); */
    		}
    
    
    		static String CloseJoin(String[] bits) {
    			return String.Join("", bits);
    		}
    
    	}
    }

    d_fomenok, 07 Октября 2016

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

    −234

    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 Class Form1
        Dim x01, x02, f01, f02, f01i, f02i, x11, x12, f12, f11, f11i, f12i, x21, x22, z1, z2, f21, f22, f21i, f22i, x31, x32 As Double
        Dim f31, f32, f31i, f32i, x41, x42, f41, f42, f41i, f42i, x51, x52, f51, f52, f51i, f52i, x61, x62, f61, f62, f61i, f62i, x71, x72 As Double
        Dim f71, f72, f71i, f72i, x81, x82, f81, f82, f81i, f82i, x91, x92, f91, f92, f91i, f92i, x101, x102, f101, f102, f101i, f102i, x111, x112, f111, f112, f111i, f112i, x121, x122 As Double
        Dim f121, f122, f121i, f122i, x131, x132, f131, f132, f131i, f132i, x141, x142, f141, f142, f141i, f142i, x151, x152, f151, f152, f151i, f152i, x161, x162, f161, f162, f161i, f162i, x171, x172 As Double
        Dim f171, f172, f171i, f172i, x181, x182, f181, f182, f181i, f182i, x191, x192, f191, f192, f191i, f192i, x201, x202, f201, f202, f201i, f202i, x211, x222, f211, f212, f211i, f212i, x221, x212, f221, f222, f221i, f222i, x231, x232 As Double
        Dim f231, f232, f231i, f232i, x241, x242, f241, f242, f241i, f242i, x251, x252, f251, f252, f251i, f252i, x261, x262, f261, f262, f261i, f262i, x271, x272, f271, f272, f271i, f272i, x281, x282, f281, f282, f281i, f282i, x291, x292 As Double
        Dim f291, f292, f291i, f292i, x301, x302, f301, f302, f301i, f302i, x311, x312, f311, f312, f311i, f312i, x321, x322 As Double
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            x01 = TextBox1.Text
            x02 = TextBox2.Text
     
            f01 = x01 - 0.5 * Math.Sin(0.3 * Math.Cos(x01) / 3) - 1
            f02 = -x02 + 0.3 * Math.Cos((0.5 * Math.Sin(x02 / 3) + 1))
            f01i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x01)) / 3) * Math.Sin(x01)
            f02i = 1 + (0.3 * Math.Sin(0.5 * Math.Sin(x02)) / 3) * (Math.Cos(x02) / 3) * 0.5 / 3
            x11 = x01 + f01 / f01i
            x12 = x02 + f02 / f02i
     
            Label7.Text = "x11= " & x11
            Label8.Text = "x12= " & x12
     
     
            f11 = x11 - 0.5 * Math.Sin(0.3 * Math.Cos(x11) / 3) - 1
            f12 = -x12 + 0.3 * Math.Cos((0.5 * Math.Sin(x12 / 3) + 1))
            f11i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x11)) / 3) * Math.Sin(x11)
            f12i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x12)) / 3) * (Math.Cos(x12) / 3) * 0.5 / 3
            x21 = x11 + f11 / f11i
            x22 = x12 + f12 / f12i
            Label9.Text = "x21= " & x21
            Label10.Text = "x22= " & x22
     
     
     
            f21 = x21 - 0.5 * Math.Sin(0.3 * Math.Cos(x21) / 3) - 1
            f22 = -x22 + 0.3 * Math.Cos((0.5 * Math.Sin(x22 / 3) + 1))
            f21i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x21)) / 3) * Math.Sin(x21)
            f22i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x22)) / 3) * (Math.Cos(x22) / 3) * 0.5 / 3
            x31 = x21 + f21 / f21i
            x32 = x22 + f22 / f22i
            Label15.Text = "x31= " & x31
            Label16.Text = "x32= " & x32
     
     
     
            f31 = x31 - 0.5 * Math.Sin(0.3 * Math.Cos(x31) / 3) - 1
            f32 = -x32 + 0.3 * Math.Cos((0.5 * Math.Sin(x32 / 3) + 1))
            f31i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x31)) / 3) * Math.Sin(x31)
            f32i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x32)) / 3) * (Math.Cos(x32) / 3) * 0.5 / 3
            x41 = x31 + f31 / f31i
            x42 = x32 + f32 / f32i
            Label17.Text = "x41= " & x41
            Label18.Text = "x42= " & x42
     
     
     
            f41 = x41 - 0.5 * Math.Sin(0.3 * Math.Cos(x41) / 3) - 1
            f42 = -x42 + 0.3 * Math.Cos((0.5 * Math.Sin(x42 / 3) + 1))
            f41i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x41)) / 3) * Math.Sin(x41)
            f42i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x42)) / 3) * (Math.Cos(x42) / 3) * 0.5 / 3
            x51 = x41 + f41 / f41i
            x52 = x42 + f42 / f42i
            Label19.Text = "x51= " & x51
            Label20.Text = "x52= " & x52
     
     
     
            f51 = x51 - 0.5 * Math.Sin(0.3 * Math.Cos(x51) / 3) - 1
            f52 = -x52 + 0.3 * Math.Cos((0.5 * Math.Sin(x52 / 3) + 1))
            f51i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x51)) / 3) * Math.Sin(x51)
            f52i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x52)) / 3) * (Math.Cos(x52) / 3) * 0.5 / 3
            x61 = x51 + f51 / f51i
            x62 = x52 + f52 / f52i
            Label21.Text = "x61= " & x61
            Label22.Text = "x62= " & x62
     
     
            f61 = x61 - 0.5 * Math.Sin(0.3 * Math.Cos(x61) / 3) - 1
            f62 = -x62 + 0.3 * Math.Cos((0.5 * Math.Sin(x62 / 3) + 1))
            f61i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x61)) / 3) * Math.Sin(x61)
            f62i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x62)) / 3) * (Math.Cos(x62) / 3) * 0.5 / 3
            x71 = x61 - f61 / f61i
            x72 = x62 + f62 / f62i
            Label23.Text = "x61= " & x71
            Label24.Text = "x62= " & x72
     
     
            f71 = x71 - 0.5 * Math.Sin(0.3 * Math.Cos(x71) / 3) - 1
            f72 = -x62 + 0.3 * Math.Cos((0.5 * Math.Sin(x72 / 3) + 1))
            f71i = 1 + 0.5 * (Math.Cos(0.3 * Math.Cos(x71)) / 3) * Math.Sin(x71)
            f72i = 1 - (0.3 * Math.Sin(0.5 * Math.Sin(x72)) / 3) * (Math.Cos(x72) / 3) * 0.5 / 3
            x81 = x71 + f71 / f71i
            x82 = x72 - f72 / f72i
            Label25.Text = "x81= " & x81
            Label26.Text = "x82= " & x82
     
     
     
            f81 = x81 - 0.5 * Math.Sin(0.3 * Math.Cos(x81) / 3) - 1
            f82 = -x82 + 0.3 * Math.Cos((0.5 * Math.Sin(x82 / 3) + 1))

    cyberforum.ru/pascalabc/thread844601.html

    d_fomenok, 07 Октября 2016

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

    +99

    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
    // enum WithdrawalRequestStatus {... }
    
    // WithdrawalRequestStatus withdrawalRequestStatus = [...]
    
     switch (Convert.ToInt32(withdrawalRequestStatus))
                        {
                            case 0:
                                requestStatus = "New";
                                break;
                            case 1:
                                requestStatus = "Canceled";
                                break;
                            case 2:
                                requestStatus = "Rejected";
                                break;
                            case 3:
                                requestStatus = "Additional Info Required";
                                break;
                            case 4:
                                requestStatus = "Ready For Approval";
                                break;
                            case 5:
                                requestStatus = "Approved For Payout";
                                break;
                            case 6:
                                requestStatus = "Paid Out";
                                break;
                        }

    cowpoo, 02 Сентября 2016

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