PhaseProperty.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. function GetZJJLPreText: string;
  25. procedure SetZJJLPreText(const Value: string);
  26. public
  27. constructor Create(AConnection: TADOConnection);
  28. destructor Destroy; override;
  29. procedure Open;
  30. procedure Save;
  31. property AuditCount: Integer read FAuditCount write SetAuditCount;
  32. property FinalAudit: Boolean read FFinalAudit write SetFinalAudit;
  33. property ZJJLType: Integer read GetZJJLType write SetZJJLType;
  34. property ZJJLPreText: string read GetZJJLPreText write SetZJJLPreText;
  35. property ZjjlVersion: Integer read GetZjjlVersion write SetZjjlVersion;
  36. end;
  37. implementation
  38. { TPhaseProperties }
  39. constructor TPhaseProperties.Create(AConnection: TADOConnection);
  40. begin
  41. CreateInqurity(AConnection);
  42. end;
  43. procedure TPhaseProperties.CreateInqurity(AConnection: TADOConnection);
  44. begin
  45. FPropertyInqurity := TPropertyInquiry.Create(AConnection);
  46. FPropertyInqurity.TableName := 'PhaseProperty';
  47. end;
  48. destructor TPhaseProperties.Destroy;
  49. begin
  50. FPropertyInqurity.Free;
  51. inherited;
  52. end;
  53. function TPhaseProperties.GetBoolPropertyDef(const AName: string;
  54. ADef: Boolean): Boolean;
  55. var
  56. vProperty: Variant;
  57. begin
  58. vProperty := FPropertyInqurity.Value[AName];
  59. if VarIsNull(vProperty) then
  60. Result := ADef
  61. else
  62. Result := Boolean(vProperty);
  63. end;
  64. function TPhaseProperties.GetFloatPropertyDef(const AName: string;
  65. ADef: Double): Double;
  66. var
  67. sValue: Variant;
  68. begin
  69. sValue := GetStrPropertyDef(AName, FloatToStr(ADef));
  70. Result := StrToFloatDef(sValue, ADef);
  71. end;
  72. function TPhaseProperties.GetIntPropertyDef(const AName: string;
  73. ADef: Integer): Integer;
  74. var
  75. sValue: Variant;
  76. begin
  77. sValue := GetStrPropertyDef(AName, IntToStr(ADef));
  78. Result := StrToIntDef(sValue, ADef);
  79. end;
  80. function TPhaseProperties.GetStrPropertyDef(const AName,
  81. ADef: string): string;
  82. var
  83. vProperty: Variant;
  84. begin
  85. vProperty := FPropertyInqurity.Value[AName];
  86. Result := VarToStrDef(vProperty, ADef);
  87. end;
  88. function TPhaseProperties.GetZJJLPreText: string;
  89. begin
  90. Result := GetStrPropertyDef('ZJJLPreText', '');
  91. end;
  92. function TPhaseProperties.GetZJJLType: Integer;
  93. begin
  94. Result := GetIntPropertyDef('ZJJLType', 0);
  95. end;
  96. function TPhaseProperties.GetZjjlVersion: Integer;
  97. begin
  98. Result := GetIntPropertyDef('ZjjlVersion', 0);
  99. end;
  100. procedure TPhaseProperties.LoadBaseProperties;
  101. begin
  102. FFinalAudit := GetBoolPropertyDef('FinalAudit', False);
  103. FAuditCount := GetIntPropertyDef('AuditCount', 0);
  104. end;
  105. procedure TPhaseProperties.Open;
  106. begin
  107. LoadBaseProperties;
  108. end;
  109. procedure TPhaseProperties.Save;
  110. begin
  111. end;
  112. procedure TPhaseProperties.SetAuditCount(const Value: Integer);
  113. begin
  114. FAuditCount := Value;
  115. FPropertyInqurity.Value['AuditCount'] := FAuditCount;
  116. end;
  117. procedure TPhaseProperties.SetFinalAudit(const Value: Boolean);
  118. begin
  119. FFinalAudit := Value;
  120. FPropertyInqurity.Value['FinalAudit'] := FFinalAudit;
  121. end;
  122. procedure TPhaseProperties.SetZJJLPreText(const Value: string);
  123. begin
  124. FPropertyInqurity.Value['ZJJLPreText'] := Value;
  125. end;
  126. procedure TPhaseProperties.SetZJJLType(const Value: Integer);
  127. begin
  128. FPropertyInqurity.Value['ZJJLType'] := Value;
  129. end;
  130. procedure TPhaseProperties.SetZjjlVersion(const Value: Integer);
  131. begin
  132. FPropertyInqurity.Value['ZjjlVersion'] := Value;
  133. end;
  134. end.