root/trunk/Units/unit_Globals.pas

464465
243
    property FirstName: string read FFirstName write SetFirstName;
243
    property FirstName: string read FFirstName write SetFirstName;
244
    property MiddleName: string read FMiddleName write SetMiddleName;
244
    property MiddleName: string read FMiddleName write SetMiddleName;
245
    property LastName: string read FLastName write SetLastName;
245
    property LastName: string read FLastName write SetLastName;
246
247
    class function FormatName(
248
      const lastName: string;
249
      const firstName: string;
250
      const middleName: string;
251
      const nickName: string = ''
252
    ): string; static;
246
  end;
253
  end;
247
254
248
  TBookRecord = record
255
  TBookRecord = record
...
...
255
262
256
    Authors: array of TAuthorRecord;
263
    Authors: array of TAuthorRecord;
257
    Genres: array of TGenreRecord;
264
    Genres: array of TGenreRecord;
258
    RootGenre: string;
265
    RootGenre: TGenreRecord;
259
266
260
    Code: Integer;
267
    Code: Integer;
261
    Size: Integer;
268
    Size: Integer;
...
...
593
600
594
{ TAuthorRecord }
601
{ TAuthorRecord }
595
602
596
function TAuthorRecord.GetFullName: string;
603
class function TAuthorRecord.FormatName(
604
  const lastName: string;
605
  const firstName: string;
606
  const middleName: string;
607
  const nickName: string = ''): string;
597
begin
608
begin
598
  Assert(LastName <> '');
609
  Result := lastName;
599
610
600
  Result := LastName;
611
  if firstName <> '' then
612
    Result := Result + ' ' + firstName;
601
613
602
  if FirstName <> '' then
614
  if middleName <> '' then
603
    Result := Result + ' ' + FirstName;
615
    Result := Result + ' ' + middleName;
604
616
605
  if MiddleName <> '' then
617
  if nickName <> '' then
606
    Result := Result + ' ' + MiddleName;
618
  begin
619
    if Result = '' then
620
      Result := nickName
621
    else
622
      Result := Result +  '(' + nickName + ')';
623
  end;
607
end;
624
end;
608
625
626
function TAuthorRecord.GetFullName: string;
627
begin
628
  Assert(LastName <> '');
629
630
  Result := FormatName(LastName, FirstName, MiddleName);
631
end;
632
609
procedure TAuthorRecord.SetFirstName(const Value: string);
633
procedure TAuthorRecord.SetFirstName(const Value: string);
610
begin
634
begin
611
  FFirstName := Trim(Value);
635
  FFirstName := Trim(Value);