📄 databindingobjs.pas
字号:
Result := AttributeNodes['logo-url'].Text;
end;
procedure TXMLCinemaType.SetLogoUrl(Value: WideString);
begin
SetAttribute('logo-url', Value);
end;
function TXMLCinemaType.GetUrl: WideString;
begin
Result := AttributeNodes['url'].Text;
end;
procedure TXMLCinemaType.SetUrl(Value: WideString);
begin
SetAttribute('url', Value);
end;
function TXMLCinemaType.GetName: WideString;
begin
Result := ChildNodes['name'].Text;
end;
procedure TXMLCinemaType.SetName(Value: WideString);
begin
ChildNodes['name'].NodeValue := Value;
end;
function TXMLCinemaType.GetPhone: WideString;
begin
Result := ChildNodes['phone'].Text;
end;
procedure TXMLCinemaType.SetPhone(Value: WideString);
begin
ChildNodes['phone'].NodeValue := Value;
end;
function TXMLCinemaType.GetAddress: WideString;
function AddText(Node: IXMLNode): WideString; // KW
var
Index: Integer;
begin
if (Node.NodeType in [ntText, ntCData]) then
Result := Result + Node.NodeValue;
for Index := 0 to Node.ChildNodes.Count - 1 do
Result := Result + AddText(Node.ChildNodes.Get(Index));
end;
begin
Result := AddText(ChildNodes['address']); // KW
end;
procedure TXMLCinemaType.SetAddress(Value: WideString);
begin
ChildNodes['address'].Text := Value;
end;
function TXMLCinemaType.GetDirections: WideString;
begin
Result := ChildNodes['directions'].Text;
end;
procedure TXMLCinemaType.SetDirections(Value: WideString);
begin
ChildNodes['directions'].NodeValue := Value;
end;
function TXMLCinemaType.GetFacilities: IXMLFacilitiesType;
begin
Result := ChildNodes['facilities'] as IXMLFacilitiesType;
end;
function TXMLCinemaType.GetPricing: IXMLPricingType;
begin
Result := ChildNodes['pricing'] as IXMLPricingType;
end;
{ TXMLFacilitiesType }
function TXMLFacilitiesType.GetCandyBar: Boolean;
begin
Result := Assigned(ChildNodes.FindNode('candy-bar')); // KW
end;
procedure TXMLFacilitiesType.SetCandyBar(Value: Boolean);
begin
if Value then // KW
begin
if not GetCandyBar then
AddChild('candy-bar');
end
else
ChildNodes.Delete('candy-bar');
end;
function TXMLFacilitiesType.GetDisabledAccess: Boolean;
begin
Result := Assigned(ChildNodes.FindNode('disabled-access')); // KW
end;
procedure TXMLFacilitiesType.SetDisabledAccess(Value: Boolean);
begin
if Value then // KW
begin
if not GetDisabledAccess then
AddChild('disabled-access');
end
else
ChildNodes.Delete('disabled-access');
end;
{ TXMLPricingType }
procedure TXMLPricingType.AfterConstruction;
begin
RegisterChildNode('prices', TXMLPricesType);
ItemTag := 'prices';
ItemInterface := IXMLPricesType;
inherited;
end;
function TXMLPricingType.GetPrices(Index: Integer): IXMLPricesType;
begin
Result := List[Index] as IXMLPricesType;
end;
function TXMLPricingType.Add: IXMLPricesType;
begin
Result := AddItem(-1) as IXMLPricesType;
end;
function TXMLPricingType.Insert(const Index: Integer): IXMLPricesType;
begin
Result := AddItem(Index) as IXMLPricesType;
end;
{ TXMLPricesType }
function TXMLPricesType.GetId: WideString;
begin
Result := AttributeNodes['id'].Text;
end;
procedure TXMLPricesType.SetId(Value: WideString);
begin
SetAttribute('id', Value);
end;
function TXMLPricesType.GetName: WideString;
begin
Result := ChildNodes['name'].Text;
end;
procedure TXMLPricesType.SetName(Value: WideString);
begin
ChildNodes['name'].NodeValue := Value;
end;
function TXMLPricesType.GetPeriod: WideString;
begin
Result := ChildNodes['period'].Text;
end;
procedure TXMLPricesType.SetPeriod(Value: WideString);
begin
ChildNodes['period'].NodeValue := Value;
end;
function TXMLPricesType.GetAdult: Double;
begin
Result := ChildNodes['adult'].NodeValue;
end;
procedure TXMLPricesType.SetAdult(Value: Double);
begin
ChildNodes['adult'].NodeValue := Value;
end;
function TXMLPricesType.GetChild: Double;
begin
Result := ChildNodes['child'].NodeValue;
end;
procedure TXMLPricesType.SetChild(Value: Double);
begin
ChildNodes['child'].NodeValue := Value;
end;
function TXMLPricesType.GetDiscount: Double;
var
Value: OleVariant;
begin
Value := ChildNodes['discount'].NodeValue;
if VarIsNull(Value) then // KW
Result := 0.00
else
Result := Value;
end;
procedure TXMLPricesType.SetDiscount(Value: Double);
begin
if Value <> 0.00 then // KW
ChildNodes['discount'].NodeValue := Value
else
ChildNodes.Delete('discount');
end;
{ TXMLScreeningsType }
procedure TXMLScreeningsType.AfterConstruction;
begin
RegisterChildNode('screening', TXMLScreeningType);
ItemTag := 'screening';
ItemInterface := IXMLScreeningType;
inherited;
end;
function TXMLScreeningsType.GetScreening(Index: Integer): IXMLScreeningType;
begin
Result := List[Index] as IXMLScreeningType;
end;
function TXMLScreeningsType.Add: IXMLScreeningType;
begin
Result := AddItem(-1) as IXMLScreeningType;
end;
function TXMLScreeningsType.Insert(const Index: Integer): IXMLScreeningType;
begin
Result := AddItem(Index) as IXMLScreeningType;
end;
{ TXMLScreeningType }
procedure TXMLScreeningType.AfterConstruction;
begin
RegisterChildNode('features', TXMLFeaturesType);
RegisterChildNode('restrictions', TXMLRestrictionsType);
RegisterChildNode('sessions', TXMLSessionsType);
inherited;
end;
function TXMLScreeningType.GetMovieId: WideString;
begin
Result := AttributeNodes['movie-id'].Text;
end;
procedure TXMLScreeningType.SetMovieId(Value: WideString);
begin
SetAttribute('movie-id', Value);
end;
function TXMLScreeningType.GetCinemaId: WideString;
begin
Result := AttributeNodes['cinema-id'].Text;
end;
procedure TXMLScreeningType.SetCinemaId(Value: WideString);
begin
SetAttribute('cinema-id', Value);
end;
function TXMLScreeningType.GetStartDate: TDateTime;
begin
Result := StrToDate(ChildNodes['start-date'].NodeValue); // KW
end;
procedure TXMLScreeningType.SetStartDate(Value: TDateTime);
begin
ChildNodes['start-date'].NodeValue := DateToStr(Value); // KW
end;
function TXMLScreeningType.GetEndDate: TDateTime;
begin
Result := StrToDate(ChildNodes['end-date'].NodeValue); // KW
end;
procedure TXMLScreeningType.SetEndDate(Value: TDateTime);
begin
ChildNodes['end-date'].NodeValue := DateToStr(Value); // KW
end;
function TXMLScreeningType.GetFeatures: IXMLFeaturesType;
begin
Result := ChildNodes['features'] as IXMLFeaturesType;
end;
function TXMLScreeningType.GetRestrictions: IXMLRestrictionsType;
begin
Result := ChildNodes['restrictions'] as IXMLRestrictionsType;
end;
function TXMLScreeningType.GetSessions: IXMLSessionsType;
begin
Result := ChildNodes['sessions'] as IXMLSessionsType;
end;
{ TXMLFeaturesType }
function TXMLFeaturesType.GetDigitalSound: WideString;
begin
Result := ChildNodes['digital-sound'].Text;
end;
procedure TXMLFeaturesType.SetDigitalSound(Value: WideString);
begin
ChildNodes['digital-sound'].NodeValue := Value;
end;
{ TXMLRestrictionsType }
function TXMLRestrictionsType.GetNoPasses: Boolean;
begin
Result := Assigned(ChildNodes.FindNode('no-passes')); // KW
end;
procedure TXMLRestrictionsType.SetNoPasses(Value: Boolean);
begin
if Value then // KW
begin
if not GetNoPasses then
AddChild('no-passes');
end
else
ChildNodes.Delete('no-passes');
end;
{ TXMLSessionsType }
procedure TXMLSessionsType.AfterConstruction;
begin
RegisterChildNode('session', TXMLSessionType);
ItemTag := 'session';
ItemInterface := IXMLSessionType;
inherited;
end;
function TXMLSessionsType.GetSession(Index: Integer): IXMLSessionType;
begin
Result := List[Index] as IXMLSessionType;
end;
function TXMLSessionsType.Add: IXMLSessionType;
begin
Result := AddItem(-1) as IXMLSessionType;
end;
function TXMLSessionsType.Insert(const Index: Integer): IXMLSessionType;
begin
Result := AddItem(Index) as IXMLSessionType;
end;
{ TXMLSessionType }
function TXMLSessionType.GetPriceId: WideString;
begin
Result := AttributeNodes['price-id'].Text;
end;
procedure TXMLSessionType.SetPriceId(Value: WideString);
begin
SetAttribute('price-id', Value);
end;
function TXMLSessionType.GetTime: TDateTime; // KW
begin
Result := StrToTime(GetText);
end;
procedure TXMLSessionType.SetTime(Value: TDateTime); // KW
begin
SetText(TimeToStr(Value));
end;
initialization
ShortDateFormat := 'MM/dd/yyyy'; // XML is in US fomat
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -