1. Pascal / Говнокод #21385

    −186

    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
    procedure TAdd.Button1Click(Sender: TObject);
     var
     a,b,c,d,e,f,g,g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,g11,g12:string;
     a1,a2,a3,a4,a5,a6,a7,a8,a9,b1:string;
     photo:string;
     begin   // проверяем и даём имена нашим ошибкам из всех полей
      If (label30.Caption='X') or (label31.Caption='X') or (label32.Caption='X')
       or (label33.Caption='X') or (label34.Caption='X') or (label36.Caption='X')
       or (label37.Caption='X') or (label38.Caption='X') or (label39.Caption='X')
       or (label42.Caption='X') or (label40.Caption='?1') or (label41.Caption='?2')
       or (label35.Caption='X') or (label49.Caption='X')  or (label50.Caption='X')
       or (label53.Caption='X') or (label54.Caption='X')
      then
       begin
        if Edit1Err='on' then begin a:=' '+Label1.Caption+' ';  Edit1.SetFocus; end;
        if Edit2Err='on' then begin b:=' '+Label2.Caption+' ';  Edit2.SetFocus; end;
        if Edit3Err='on' then begin c:=' '+Label3.Caption+' ';  Edit3.SetFocus; end;
        if Edit4Err='on' then begin d:=' '+Label4.Caption+' ';  Edit4.SetFocus; end;
        if Edit5Err='on' then begin e:=' '+Label5.Caption+' ';  Edit5.SetFocus; end;
        if Edit9Err='on' then begin f:=' '+Label11.Caption+' '; Edit9.SetFocus; end;
        if Edit10Err='on' then begin g:=' '+Label12.Caption+' '; Edit10.SetFocus; end;
        if Edit7Err='on'  then begin g1:=' '+Label7.Caption+' '; Edit7.SetFocus; end;
        if Edit8Err='on'  then begin g2:=' '+Label8.Caption+' '; Edit8.SetFocus; end;
        if Edit11Err='on' then begin g3:=' '+Label11.Caption+' '; Edit11.SetFocus; end;
        if label40.Caption='?1' then begin g4:=' '+Label9.Caption+' '; ComboBox1.SetFocus; end;
        if label41.Caption='?2' then begin g5:=' '+Label10.Caption+' '; ComboBox2.SetFocus; end;
        if Edit11Err='on' then begin g6:=' '+Label13.Caption+' '; Edit11.SetFocus; end;
        if Edit6Err='on' then begin g7:=' '+Label6.Caption+' '; Edit6.SetFocus; end;
        if Edit12Err='on' then begin g8:=' '+Label14.Caption+'"'+LAbel15.Caption+'"'+' '; Edit12.SetFocus; end;
        if Edit13Err='on' then begin g9:=' '+Label14.Caption+'"'+LAbel43.Caption+'"'+' '; Edit13.SetFocus; end;
        if Edit15Err='on' then begin g10:=' '+Label16.Caption+'"'+LAbel17.Caption+'"'+' '; Edit15.SetFocus; end;
        if Edit16Err='on' then begin g11:=' '+Label16.Caption+'"'+LAbel18.Caption+'"'+' '; Edit16.SetFocus; end;
        Raise Exception.Create('Ошибка в поле: '+a+b+c+d+e+f+g+g1+g2+g3+g4+g5+g6+g7+g8+g9+g10+g11);// выдаём мессагу какие ошибы
       end;
       If (label34.Caption='0') or (label30.Caption='0') or (label31.Caption='0')
        or (label32.Caption='0') or (label33.Caption='0') or (label35.Caption='0')
        or (label36.Caption='0') or (label38.Caption='0')  or (label39.Caption='0')
        then
        begin
         if Edit1Empty='on' then begin a1:=' '+Label1.Caption+' '; Edit1.SetFocus; end;
         if Edit5Empty='on' then begin a2:=' '+Label5.Caption+' '; Edit5.SetFocus; end;
         if Edit2Empty='on' then begin a3:=' '+Label2.Caption+' '; Edit2.SetFocus; end;
         if Edit3Empty='on' then begin a4:=' '+Label3.Caption+' '; Edit3.SetFocus; end;
         if Edit4Empty='on' then begin a5:=' '+Label4.Caption+' '; Edit4.SetFocus; end;
         if Edit6Empty='on' then begin a6:=' '+Label6.Caption+' '; Edit6.SetFocus; end;
         if Edit9Empty='on' then begin a7:=' '+Label11.Caption+' '; Edit9.SetFocus; end;
         if Edit7Empty='on' then begin a8:=' '+Label7.Caption+' '; Edit7.SetFocus; end;
         if Edit8Empty='on' then begin a9:=' '+Label8.Caption+' '; Edit8.SetFocus; end;
         Raise Exception.Create('Обнаружено пустое значение в поле:'+a1+a2+a3+a4+a5+a6+a7+a8+a9); // даём юзеру инфо о пустых полях
        end;
      { If (Edit12.EditText='0') and (Edit13.EditText='0') then SpeedAfter:='off'; // разрешаем добавить запись, если будет ноль
       If (Edit15.EditText='0') and (Edit16.EditText='0') then GasAfter:='off'; }
       If SpeedAfter='on' then // ругаемся на показания спидометра
        begin
         if StrToInt(Edit12.Text)>=StrToInt(Edit13.Text)  then Raise Exception.Create('Ошибка в показаниях спидометра: Значение "ДО" не должно превышать "ПОСЛЕ" или быть равным');
         Edit12.SetFocus;
        end;
       If GasAfter='on' then // ругаемся на показания топлива
        begin
         if StrToInt(Edit15.Text)<=StrToInt(Edit16.Text) then Raise Exception.Create('Ошибка в показаниях топлива: Значение "ПОСЛЕ" не должно превышать "ДО" или быть равным');
         Edit16.SetFocus;
        end;
       if Edit12.Text='' then  //пробег + топливо
        begin
         Edit12.EditText:='0';
        end;
       if Edit13.Text='' then
        begin
         Edit13.EditText:='0';
        end;
       if Edit15.Text='' then
        begin
         Edit15.EditText:='0';
        end;
       if Edit16.Text='' then
        begin
         Edit16.EditText:='0';
        end;

    что-то здесь определённо не так...

    Запостил: justlikeheaven, 09 Октября 2016

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

    Добавить комментарий