You've already forked lazarus-ccr
tvplanit: Fix demo program storing only one task and one contact in case of inifile datastore.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4854 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -592,7 +592,7 @@ begin
|
|||||||
res := Resources.AddResource(resID);
|
res := Resources.AddResource(resID);
|
||||||
StrToResource(s, res);
|
StrToResource(s, res);
|
||||||
|
|
||||||
key := Format('ContactsOfResource%d', [resID]);
|
key := Format('Contacts of resource %d', [resID]);
|
||||||
L.Clear;
|
L.Clear;
|
||||||
ini.ReadSection(key, L);
|
ini.ReadSection(key, L);
|
||||||
for j:=0 to L.Count-1 do begin
|
for j:=0 to L.Count-1 do begin
|
||||||
@ -603,7 +603,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
key := Format('EventsOfResource%d', [resID]);
|
key := Format('Events of resource %d', [resID]);
|
||||||
L.Clear;
|
L.Clear;
|
||||||
ini.ReadSection(key, L);
|
ini.ReadSection(key, L);
|
||||||
for j:=0 to L.Count-1 do begin
|
for j:=0 to L.Count-1 do begin
|
||||||
@ -613,7 +613,7 @@ begin
|
|||||||
StrToEvent(s, event);
|
StrToEvent(s, event);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
key := Format('TasksOfResource%d', [resID]);
|
key := Format('Tasks of resource %d', [resID]);
|
||||||
L.Clear;
|
L.Clear;
|
||||||
ini.ReadSection(key, L);
|
ini.ReadSection(key, L);
|
||||||
for j:=0 to L.Count-1 do begin
|
for j:=0 to L.Count-1 do begin
|
||||||
@ -655,9 +655,9 @@ begin
|
|||||||
|
|
||||||
for i:=0 to Resources.Count-1 do begin
|
for i:=0 to Resources.Count-1 do begin
|
||||||
res := Resources.Items[i];
|
res := Resources.Items[i];
|
||||||
key := Format('ContactsOfResource%d', [res.ResourceID]);
|
key := Format('Contacts of resource %d', [res.ResourceID]);
|
||||||
for j:=0 to res.Contacts.Count-1 do begin
|
for j:=0 to res.Contacts.Count-1 do begin
|
||||||
contact := res.Contacts.GetContact(i);
|
contact := res.Contacts.GetContact(j);
|
||||||
if not contact.Deleted then
|
if not contact.Deleted then
|
||||||
ini.WriteString(key, IntToStr(contact.RecordID), ContactToStr(contact));
|
ini.WriteString(key, IntToStr(contact.RecordID), ContactToStr(contact));
|
||||||
end;
|
end;
|
||||||
@ -665,9 +665,9 @@ begin
|
|||||||
|
|
||||||
for i:=0 to Resources.Count-1 do begin
|
for i:=0 to Resources.Count-1 do begin
|
||||||
res := Resources.Items[i];
|
res := Resources.Items[i];
|
||||||
key := Format('TasksOfResource%d', [res.ResourceID]);
|
key := Format('Tasks of resource %d', [res.ResourceID]);
|
||||||
for j:=0 to res.Tasks.Count-1 do begin
|
for j:=0 to res.Tasks.Count-1 do begin
|
||||||
task := res.Tasks.GetTask(i);
|
task := res.Tasks.GetTask(j);
|
||||||
if not task.Deleted then
|
if not task.Deleted then
|
||||||
ini.WriteString(key, IntToStr(task.RecordID), TaskToStr(task));
|
ini.WriteString(key, IntToStr(task.RecordID), TaskToStr(task));
|
||||||
end;
|
end;
|
||||||
@ -675,7 +675,7 @@ begin
|
|||||||
|
|
||||||
for i:=0 to Resources.Count-1 do begin
|
for i:=0 to Resources.Count-1 do begin
|
||||||
res := Resources.Items[i];
|
res := Resources.Items[i];
|
||||||
key := Format('EventsOfResource%d', [res.ResourceID]);
|
key := Format('Events of resource %d', [res.ResourceID]);
|
||||||
for j:=0 to res.Schedule.EventCount-1 do begin
|
for j:=0 to res.Schedule.EventCount-1 do begin
|
||||||
event := res.Schedule.GetEvent(j);
|
event := res.Schedule.GetEvent(j);
|
||||||
if not event.Deleted then
|
if not event.Deleted then
|
||||||
|
@ -1480,6 +1480,7 @@ begin
|
|||||||
TaskDlg.Free;
|
TaskDlg.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
DataStore.PostTasks();
|
DataStore.PostTasks();
|
||||||
DataStore.NotifyDependents;
|
DataStore.NotifyDependents;
|
||||||
@ -1491,6 +1492,10 @@ begin
|
|||||||
DataStore.PostTasks;
|
DataStore.PostTasks;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Writeln(Datastore.Resource.Tasks.GetTask(0).RecordID);
|
||||||
|
WriteLn(Datastore.Resource.Tasks.GetTask(1).RecordID);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user