I have the following unit I have used for some Delphi versions. But now I am testing XE8 and I get an error in
function THolydayList.TEnglishNameCollection.ToArray: TArray<string>;
begin
Result := ToArrayImpl(fList.Count);
end;
I think is has to do with the fact that System.Generics.Collections is rewritten in XE8. But pressed for time I haven't had the opportunity to look into that. My question is: has anybody looked into this and can guide me in a direction as of what to look for.
An example of my use of this unit could be the following where I update a table with dates related to an employer for a given year
procedure TsCalendarYearHolyday(aEmployer: string; aYear: integer);
var
STDDato: TStdDato;
HolyDay : THolyDay;
Query: TUniQuery;
begin
Query := frmUniConn.CreateQuery;
STDDato := TStdDato.Create;
STDDato.Year := aYear;
STDDato.Country := Denmark;
STDDato.MarkSunday := False;
STDDato.Language := hdNative;
STDDato.MakeHoliDays(0);
try
Query.SQL.Clear;
Query.SQL.Add('UPDATE ' + TableTsCalendarYear);
Query.SQL.Add(' SET flddayspecial = :flddayspecial');
Query.SQL.Add(' ,flddaydesc = :flddaydesc');
Query.SQL.Add(' ,flddaynormal = :flddaynormal');
Query.SQL.Add(' WHERE (flddate = :flddate)');
Query.SQL.Add(' AND (fldemployer = :fldemployer)');
for HolyDay in STDDato.Liste do
begin
try
Query.ParamByName('flddayspecial').AsBoolean := True;
Query.ParamByName('flddaydesc').AsString := Holyday.NativeName;
Query.ParamByName('flddaynormal').AsFloat := 0;
Query.ParamByName('flddate').AsDate := HolyDay.Date;
Query.ParamByName('fldemployer').AsString := aEmployer;
Query.Execute;
except
on E: exception do
Logfile.Error('U_TsCalendars.TsCalendarYearHolyday: ' + E.Message);
end;
end;
finally
FreeAndNil(STDDato);
Query.Free;
end;
end;