object NeedApptsQuery: TQuery
DatabaseName = 'UTF'
SQL.Strings = (
'Select * From GroupLink, GroupAppt'
' Where (SchedName = :SchedName)'
' And (GroupLink.ApptID = GroupAppt.ApptID)'
' And ((StartDate >= :D1) and (EndDate <= :D2))')
Left = 392
Top = 560
ParamData = <
item
DataType = ftString
Name = 'SchedName'
ParamType = ptUnknown
end
item
DataType = ftDate
Name = 'D1'
ParamType = ptUnknown
end
item
DataType = ftDate
Name = 'D2'
ParamType = ptUnknown
end>
end
object ApptSchedulesQuery: TQuery
DatabaseName = 'UTF'
RequestLive = True
SQL.Strings = (
'Select * From GroupLink'
' Where ApptID = :ApptID')
Left = 424
Top = 560
ParamData = <
item
DataType = ftString
Name = 'ApptID'
ParamType = ptUnknown
end>
end
object GetApptQuery: TQuery
DatabaseName = 'UTF'
RequestLive = True
SQL.Strings = (
'Select * From GroupAppt'
' Where ApptID = :ApptID')
Left = 456
Top = 560
ParamData = <
item
DataType = ftString
Name = 'ApptID'
ParamType = ptUnknown
end>
end
object DeleteApptLinkQuery: TQuery
DatabaseName = 'UTF'
SQL.Strings = (
'Delete From GroupLink'
' Where ApptID = :ApptID')
Left = 488
Top = 560
ParamData = <
item
DataType = ftString
Name = 'ApptID'
ParamType = ptUnknown
end>
end
object DeleteApptQuery: TQuery
DatabaseName = 'UTF'
SQL.Strings = (
'Delete From GroupAppt'
' Where ApptID = :ApptID')
Left = 520
Top = 560
ParamData = <
item
DataType = ftString
Name = 'ApptID'
ParamType = ptUnknown
end>
end
object SchedulesQuery: TQuery
DatabaseName = 'UTF'
SQL.Strings = (
'Select Distinct(SchedName) From GroupLink')
Left = 552
Top = 560
end
object dbUTF: TDatabase
DatabaseName = 'UTF'
DriverName = 'STANDARD'
LoginPrompt = False
Params.Strings = (
'DEFAULT DRIVER=PARADOX'
'ENABLE BCD=FALSE')
SessionName = 'Default'
Left = 448
Top = 528
end
end
(*---------------------------------------------------*)
procedure TMainForm.utfSchedMgrDeleteAppt(Sender: TObject; Appt: TJvTFAppt);
begin
With DeleteApptQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
ExecSQL;
End;
With DeleteApptLinkQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
ExecSQL;
End;
end;
(*---------------------------------------------------*)
procedure TMainForm.utfSchedMgrLoadBatch(Sender: TObject; BatchName: string;
BatchStartDate, BatchEndDate: TDate);
var
Appt : TJvTFAppt;
NewAppt : Boolean;
begin
With NeedApptsQuery do
Begin
ParamByName('D1').AsDate := BatchStartDate;
ParamByName('D2').AsDate := BatchEndDate;
ParamByName('SchedName').AsString := BatchName;
Open;
First;
While not EOF do
Begin
utfSchedMgr.RequestAppt(FieldByName('ApptID').AsString,
Appt, NewAppt);
If NewAppt Then
Begin
Appt.SetStartEnd(FieldByName('StartDate').AsDateTime,
FieldByName('StartTime').AsDateTime,
FieldByName('EndDate').AsDateTime,
FieldByName('EndTime').AsDateTime);
Appt.Description := FieldByName('Description').AsString;
Appt.AlarmEnabled := FieldByName('AlarmEnabled').AsBoolean;
Appt.AlarmAdvance := FieldByName('AlarmAdvance').AsInteger;
With ApptSchedulesQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
Open;
First;
While not EOF do
Begin
Appt.AddSchedule(FieldByName('SchedName').AsString);
Next;
End;
Close;
End;
End;
Next;
End;
Close;
End;
end;
(*---------------------------------------------------*)
procedure TMainForm.utfSchedMgrPostAppt(Sender: TObject; Appt: TJvTFAppt);
var
I : Integer;
begin
With GetApptQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
Open;
If RecordCount > 0 Then
Edit
Else
Begin
Insert;
FieldByName('ApptID').AsString := Appt.ID;
End;
FieldByName('StartDate').AsDateTime := Appt.StartDate;
FieldByName('StartTime').AsDateTime := Appt.StartTime;
FieldByName('EndDate').AsDateTime := Appt.EndDate;
FieldByName('EndTime').AsDateTime := Appt.EndTime;
FieldByName('Description').AsString := Appt.Description;
FieldByName('AlarmEnabled').AsBoolean := Appt.AlarmEnabled;
FieldByName('AlarmAdvance').AsInteger := Appt.AlarmAdvance;
Post;
Close;
End;
With DeleteApptLinkQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
ExecSQL;
End;
With ApptSchedulesQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
Open;
For I := 0 to Appt.ScheduleCount - 1 do
Begin
Insert;
FieldByName('ApptID').AsString := Appt.ID;
FieldByName('SchedName').AsString := Appt.Schedules[I];
Post;
End;
Close;
End;
end;
(*---------------------------------------------------*)
procedure TMainForm.utfSchedMgrRefreshAppt(Sender: TObject; Appt: TJvTFAppt);
begin
With GetApptQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
Open;
If RecordCount = 1 Then
Begin
Appt.SetStartEnd(FieldByName('StartDate').AsDateTime,
FieldByName('StartTime').AsDateTime,
FieldByName('EndDate').AsDateTime,
FieldByName('EndTime').AsDateTime);
Appt.Description := FieldByName('Description').AsString;
Appt.AlarmEnabled := FieldByName('AlarmEnabled').AsBoolean;
Appt.AlarmAdvance := FieldByName('AlarmAdvance').AsInteger;
End;
Close;
End;
Appt.ClearSchedules;
With ApptSchedulesQuery do
Begin
ParamByName('ApptID').AsString := Appt.ID;
Open;
First;
While not EOF do
Begin
Appt.AddSchedule(FieldByName('SchedName').AsString);
Next;
End;
Close;
End;
end;
(*---------------------------------------------------*)
|