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

    +110

    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
    this.pictureBox14.BeginInit();
          this.pictureBox15.BeginInit();
          this.pictureBox15.BeginInit();
          this.pictureBox21.BeginInit();
          this.pictureBox21.BeginInit();
          this.pictureBox22.BeginInit();
          this.pictureBox22.BeginInit();
          this.pictureBox23.BeginInit();
          this.pictureBox23.BeginInit();
          this.pictureBox24.BeginInit();
          this.pictureBox24.BeginInit();
          this.pictureBox16.BeginInit();
          this.pictureBox16.BeginInit();
          this.pictureBox17.BeginInit();
          this.pictureBox17.BeginInit();
          this.pictureBox18.BeginInit();
          this.pictureBox18.BeginInit();
          this.pictureBox19.BeginInit();
          this.pictureBox19.BeginInit();
          this.pictureBox20.BeginInit();
          this.pictureBox20.BeginInit();
          this.pictureBox9.BeginInit();
          this.pictureBox9.BeginInit();
          this.pictureBox6.BeginInit();
          this.pictureBox6.BeginInit();
          this.pictureBox5.BeginInit();
          this.pictureBox5.BeginInit();
          this.pictureBox7.BeginInit();
          this.pictureBox7.BeginInit();
          this.pictureBox10.BeginInit();
          this.pictureBox10.BeginInit();
          this.panel1.SuspendLayout();
          this.panel1.SuspendLayout();
          this.SuspendLayout();
          this.SuspendLayout();
          this.panel3.Location = new Point(140, 36);
          this.panel3.Location = new Point(140, 36);
          this.panel3.Name = "panel3";
          this.panel3.Name = "panel3";
          this.panel3.Size = new Size(740, 436);
          this.panel3.Size = new Size(740, 436);
          this.panel3.TabIndex = 4;
          this.panel3.TabIndex = 4;
          this.panel3.MouseDown += new MouseEventHandler(this.panel3_MouseDown);
          this.panel3.MouseDown += new MouseEventHandler(this.panel3_MouseDown);
          this.panel3.MouseUp += new MouseEventHandler(this.panel3_MouseUp);
          this.panel3.MouseUp += new MouseEventHandler(this.panel3_MouseUp);
          this.pictureBox2.BackColor = Color.Gray;
          this.pictureBox2.BackColor = Color.Gray;
          this.pictureBox2.Location = new Point(-11, 0);
          this.pictureBox2.Location = new Point(-11, 0);
          this.pictureBox2.Name = "pictureBox2";
          this.pictureBox2.Name = "pictureBox2";
          this.pictureBox2.Size = new Size(938, 36);
          this.pictureBox2.Size = new Size(938, 36);
          this.pictureBox2.TabIndex = 1;
          this.pictureBox2.TabIndex = 1;
          this.pictureBox2.TabStop = false;
          this.pictureBox2.TabStop = false;
          this.pictureBox3.BackColor = Color.Gray;
          this.pictureBox3.BackColor = Color.Gray;
          this.pictureBox3.Location = new Point(880, 12);
          this.pictureBox3.Location = new Point(880, 12);
          this.pictureBox3.Name = "pictureBox3";
          this.pictureBox3.Name = "pictureBox3";
          this.pictureBox3.Size = new Size(36, 466);
          this.pictureBox3.Size = new Size(36, 466);
          this.pictureBox3.TabIndex = 0;
          this.pictureBox3.TabIndex = 0;
          this.pictureBox3.TabStop = false;
          this.pictureBox3.TabStop = false;
          this.pictureBox1.BackColor = Color.Gray;
          this.pictureBox1.BackColor = Color.Gray;
          this.pictureBox1.Location = new Point(-4, 472);
          this.pictureBox1.Location = new Point(-4, 472);
          this.pictureBox1.Name = "pictureBox1";
          this.pictureBox1.Name = "pictureBox1";
          this.pictureBox1.Size = new Size(938, 36);
          this.pictureBox1.Size = new Size(938, 36);
          this.pictureBox1.TabIndex = 0;

    Полная версия: http://pastebin.com/KwDzLR4s

    P4R4, 18 Апреля 2012

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

    +111

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    private IEnumerable<Tuple<IList<string>, IList<string>>> GetFieldInfo(IField Field)
    {
    		foreach (var val in Field.Fields["info"].Values)
    		{
    				yield return new Tuple<IList<string>, IList<string>>(val["Id"].Values, val["ip"].Values);
    		}
    }

    beardeddev, 18 Апреля 2012

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

    +110

    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
    public  Operation.OperationStatus   OperState
            {
                get { return fOperState; }
                set
                {
                    fOperState  =   value;
                    // Надписи кнопок смены статуса
                    TOperation.TOperationState  
                        OperationState  =   TOperation.OperationState(value);
                    btnOldState.Text    =   OperationState.OldName;
                    btnNewState.Text    =   OperationState.NewName;
                    // Видимость кнопок смены статуса
                    switch (value)
                    {
                        case Operation.OperationStatus.New          :
                            btnOldState.Visible =   OperationState.OldName.Length > 0 && !ReadOnlyMode;
                            btnNewState.Visible =   OperationState.NewName.Length > 0 && OwnerOper.AccessInput && !ReadOnlyMode;
                            break;
    
                        case Operation.OperationStatus.DataInput    :
                            btnOldState.Visible =   OperationState.OldName.Length > 0 && OwnerOper.AccessInput && !ReadOnlyMode;
                            btnNewState.Visible =   OperationState.NewName.Length > 0 && OwnerOper.AccessCheck && !ReadOnlyMode;
                            break;
    
                        case Operation.OperationStatus.DataCheck    :
                            btnOldState.Visible =   OperationState.OldName.Length > 0 && OwnerOper.AccessCheck && !ReadOnlyMode;
                            btnNewState.Visible =   OperationState.NewName.Length > 0 && OwnerOper.AccessConfirm && !ReadOnlyMode;
                            break;
    
                        case Operation.OperationStatus.Closed       :
                            btnOldState.Visible =   OperationState.OldName.Length > 0 && OwnerOper.AccessConfirm && !ReadOnlyMode;
                            btnNewState.Visible =   OperationState.NewName.Length > 0 && !ReadOnlyMode;
                            break;
                    }
                }
            }
    public  static  TOperationState OperationState(Operation.OperationStatus pState)
            {
                TOperationState Result  =   new TOperationState();
                switch (pState)
                {
                    case Operation.OperationStatus.New          :
                        Result.OldName  =   "";
                        Result.NewName  =   "Данные введены";
                        break;
                    case Operation.OperationStatus.DataInput    :
                        Result.OldName  =   "Отменить \"Данные введены\"";
                        Result.NewName  =   "Данные проверены";
                        break;
                    case Operation.OperationStatus.DataCheck    :
                        Result.OldName  =   "Отменить \"Данные проверены\"";
                        Result.NewName  =   "Завершена";
                        break;
                    case Operation.OperationStatus.Closed       :
                        Result.OldName  =   "Отменить \"Завершена\"";
                        Result.NewName  =   "";
                        break;
                }
                return Result;
            }

    Не прям штобы очень, но шоколад есть...

    gcoder, 18 Апреля 2012

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

    +113

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    StringBuilder script = new StringBuilder();
    script.Append("<script type=text/javascript>alert('Данные не сохранены');</");
    script.Append("script>");
    
    Page.ClientScript.RegisterStartupScript(this.GetType(), "catchScript", script.ToString());

    Поддерживаю проект от других разработчиков.
    Если честно казалось бы придраться не к чему, все будет работать - но почему нужно было делать такой разрыв строки и посреди тега? Это меня в ступор вгоняет. Совпадений по проекту 83 таких.

    sergey_sh, 18 Апреля 2012

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

    +113

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    for (int i = 0; i < retries; i++)
    {
        if ((GetProductVersioningProvider() as IQueueProductVersion).IsVersionCommitted(version))
        {
            return true;
        }
        else
        {
            Thread.Sleep(checkDelay);
        }
    }

    Классика жанра же.

    abatishchev, 17 Апреля 2012

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

    +962

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (result != "")
    {
        Response.Write(result);
    }
    else
    {                                        
        Response.Write("");
    }

    Поддерживаю проект от других разработчиков. Хз что тут имелось ввиду.

    sergey_sh, 17 Апреля 2012

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

    +117

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    static double E( double epsilon )
    {
    	int n = 1, nf = 1;
    	double e = 0;
    	while (Math.Abs(e - Math.E) > epsilon)
    	{
    		e += 1.0 / nf;
    		nf *= n;
    		n++;
    	}
    	return e;
    }

    Вычисление числа e как суммы обратных факториалов. По мотивам реальных событий.

    Steve_Brown, 16 Апреля 2012

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

    +121

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    private static string GetShortDisciplineName(string longDsciplineName){
                string[] words = longDsciplineName.Split(' ');
                switch (words.Count()){
                    case 1:{
                        return longDsciplineName;
                        break;
                        }

    pm2t29jf47, 13 Апреля 2012

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

    +125

    1. 1
    2. 2
    3. 3
    4. 4
    if (FileAssociation.IsAssociated(".avi") || !FileAssociation.IsAssociated(".avi"))
                {
                    FileAssociation.Associate(".avi", "Flvplayer", ".avi", a, b);
                }

    http://www.cyberforum.ru/csharp-beginners/thread304416.html

    Somov, 12 Апреля 2012

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

    +959

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public static string ParseUrl(string url, HttpContextBase context = null)
    {
          context.Items[QueryStringField.Tabs.OnlyTabContent] = false;
          ...
    }

    beardeddev, 12 Апреля 2012

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