PhaseProperty.pas 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. unit PhaseProperty;
  2. interface
  3. uses
  4. ProjectProperty, ADODB, Variants, SysUtils;
  5. type
  6. TPhaseProperties = class
  7. private
  8. FPropertyInqurity: TPropertyInquiry;
  9. FFinalAudit: Boolean;
  10. FAuditCount: Integer;
  11. FPayablePrice: Double;
  12. function GetBoolPropertyDef(const AName: string; ADef: Boolean): Boolean;
  13. function GetIntPropertyDef(const AName: string; ADef: Integer): Integer;
  14. function GetStrPropertyDef(const AName, ADef: string): string;
  15. function GetFloatPropertyDef(const AName: string; ADef: Double): Double;
  16. procedure CreateInqurity(AConnection: TADOConnection);
  17. procedure LoadBaseProperties;
  18. procedure SetFinalAudit(const Value: Boolean);
  19. procedure SetAuditCount(const Value: Integer);
  20. function GetZJJLType: Integer;
  21. procedure SetZJJLType(const Value: Integer);
  22. procedure SetZjjlVersion(const Value: Integer);
  23. function GetZjjlVersion: Integer;
  24. public
  25. constructor Create(AConnection: TADOConnection);
  26. destructor Destroy; override;
  27. procedure Open;
  28. procedure Save;
  29. property AuditCount: Integer read FAuditCount write SetAuditCount;
  30. property FinalAudit: Boolean read FFinalAudit write SetFinalAudit;
  31. property ZJJLType: Integer read GetZJJLType write SetZJJLType;
  32. property ZjjlVersion: Integer read GetZjjlVersion write SetZjjlVersion;
  33. end;
  34. implementation
  35. { TPhaseProperties }
  36. constructor TPhaseProperties.Create(AConnection: TADOConnection);
  37. begin
  38. CreateInqurity(AConnection);
  39. end;
  40. procedure TPhaseProperties.CreateInqurity(AConnection: TADOConnection);
  41. begin
  42. FPropertyInqurity := TPropertyInquiry.Create(AConnection);
  43. FPropertyInqurity.TableName := 'PhaseProperty';
  44. end;
  45. destructor TPhaseProperties.Destroy;
  46. begin
  47. FPropertyInqurity.Free;
  48. inherited;
  49. end;
  50. function TPhaseProperties.GetBoolPropertyDef(const AName: string;
  51. ADef: Boolean): Boolean;
  52. var
  53. vProperty: Variant;
  54. begin
  55. vProperty := FPropertyInqurity.Value[AName];
  56. if VarIsNull(vProperty) then
  57. Result := ADef
  58. else
  59. Result := Boolean(vProperty);
  60. end;
  61. function TPhaseProperties.GetFloatPropertyDef(const AName: string;
  62. ADef: Double): Double;
  63. var
  64. sValue: Variant;
  65. begin
  66. sValue := GetStrPropertyDef(AName, FloatToStr(ADef));
  67. Result := StrToFloatDef(sValue, ADef);
  68. end;
  69. function TPhaseProperties.GetIntPropertyDef(const AName: string;
  70. ADef: Integer): Integer;
  71. var
  72. sValue: Variant;
  73. begin
  74. sValue := GetStrPropertyDef(AName, IntToStr(ADef));
  75. Result := StrToIntDef(sValue, ADef);
  76. end;
  77. function TPhaseProperties.GetStrPropertyDef(const AName,
  78. ADef: string): string;
  79. var
  80. vProperty: Variant;
  81. begin
  82. vProperty := FPropertyInqurity.Value[AName];
  83. Result := VarToStrDef(vProperty, ADef);
  84. end;
  85. function TPhaseProperties.GetZJJLType: Integer;
  86. begin
  87. Result := GetIntPropertyDef('ZJJLType', 0);
  88. end;
  89. function TPhaseProperties.GetZjjlVersion: Integer;
  90. begin
  91. Result := GetIntPropertyDef('ZjjlVersion', 0);
  92. end;
  93. procedure TPhaseProperties.LoadBaseProperties;
  94. begin
  95. FFinalAudit := GetBoolPropertyDef('FinalAudit', False);
  96. FAuditCount := GetIntPropertyDef('AuditCount', 0);
  97. end;
  98. procedure TPhaseProperties.Open;
  99. begin
  100. LoadBaseProperties;
  101. end;
  102. procedure TPhaseProperties.Save;
  103. begin
  104. end;
  105. procedure TPhaseProperties.SetAuditCount(const Value: Integer);
  106. begin
  107. FAuditCount := Value;
  108. FPropertyInqurity.Value['AuditCount'] := FAuditCount;
  109. end;
  110. procedure TPhaseProperties.SetFinalAudit(const Value: Boolean);
  111. begin
  112. FFinalAudit := Value;
  113. FPropertyInqurity.Value['FinalAudit'] := FFinalAudit;
  114. end;
  115. procedure TPhaseProperties.SetZJJLType(const Value: Integer);
  116. begin
  117. FPropertyInqurity.Value['ZJJLType'] := Value;
  118. end;
  119. procedure TPhaseProperties.SetZjjlVersion(const Value: Integer);
  120. begin
  121. FPropertyInqurity.Value['ZjjlVersion'] := Value;
  122. end;
  123. end.