123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- unit PhaseProperty;
- interface
- uses
- ProjectProperty, ADODB, Variants, SysUtils;
- type
- TPhaseProperties = class
- private
- FPropertyInqurity: TPropertyInquiry;
- FFinalAudit: Boolean;
- FAuditCount: Integer;
- FPayablePrice: Double;
- function GetBoolPropertyDef(const AName: string; ADef: Boolean): Boolean;
- function GetIntPropertyDef(const AName: string; ADef: Integer): Integer;
- function GetStrPropertyDef(const AName, ADef: string): string;
- function GetFloatPropertyDef(const AName: string; ADef: Double): Double;
- procedure CreateInqurity(AConnection: TADOConnection);
- procedure LoadBaseProperties;
- procedure SetFinalAudit(const Value: Boolean);
- procedure SetAuditCount(const Value: Integer);
- function GetZJJLType: Integer;
- procedure SetZJJLType(const Value: Integer);
- public
- constructor Create(AConnection: TADOConnection);
- destructor Destroy; override;
- procedure Open;
- procedure Save;
- property AuditCount: Integer read FAuditCount write SetAuditCount;
- property FinalAudit: Boolean read FFinalAudit write SetFinalAudit;
- property ZJJLType: Integer read GetZJJLType write SetZJJLType;
- end;
- implementation
- { TPhaseProperties }
- constructor TPhaseProperties.Create(AConnection: TADOConnection);
- begin
- CreateInqurity(AConnection);
- end;
- procedure TPhaseProperties.CreateInqurity(AConnection: TADOConnection);
- begin
- FPropertyInqurity := TPropertyInquiry.Create(AConnection);
- FPropertyInqurity.TableName := 'PhaseProperty';
- end;
- destructor TPhaseProperties.Destroy;
- begin
- FPropertyInqurity.Free;
- inherited;
- end;
- function TPhaseProperties.GetBoolPropertyDef(const AName: string;
- ADef: Boolean): Boolean;
- var
- vProperty: Variant;
- begin
- vProperty := FPropertyInqurity.Value[AName];
- if VarIsNull(vProperty) then
- Result := ADef
- else
- Result := Boolean(vProperty);
- end;
- function TPhaseProperties.GetFloatPropertyDef(const AName: string;
- ADef: Double): Double;
- var
- sValue: Variant;
- begin
- sValue := GetStrPropertyDef(AName, FloatToStr(ADef));
- Result := StrToFloatDef(sValue, ADef);
- end;
- function TPhaseProperties.GetIntPropertyDef(const AName: string;
- ADef: Integer): Integer;
- var
- sValue: Variant;
- begin
- sValue := GetStrPropertyDef(AName, IntToStr(ADef));
- Result := StrToIntDef(sValue, ADef);
- end;
- function TPhaseProperties.GetStrPropertyDef(const AName,
- ADef: string): string;
- var
- vProperty: Variant;
- begin
- vProperty := FPropertyInqurity.Value[AName];
- Result := VarToStrDef(vProperty, ADef);
- end;
- function TPhaseProperties.GetZJJLType: Integer;
- begin
- Result := GetIntPropertyDef('ZJJLType', 0);
- end;
- procedure TPhaseProperties.LoadBaseProperties;
- begin
- FFinalAudit := GetBoolPropertyDef('FinalAudit', False);
- FAuditCount := GetIntPropertyDef('AuditCount', 0);
- end;
- procedure TPhaseProperties.Open;
- begin
- LoadBaseProperties;
- end;
- procedure TPhaseProperties.Save;
- begin
- end;
- procedure TPhaseProperties.SetAuditCount(const Value: Integer);
- begin
- FAuditCount := Value;
- FPropertyInqurity.Value['AuditCount'] := FAuditCount;
- end;
- procedure TPhaseProperties.SetFinalAudit(const Value: Boolean);
- begin
- FFinalAudit := Value;
- FPropertyInqurity.Value['FinalAudit'] := FFinalAudit;
- end;
- procedure TPhaseProperties.SetZJJLType(const Value: Integer);
- begin
- FPropertyInqurity.Value['ZJJLType'] := Value;
- end;
- end.
|