TvPlanIt: Deletion of a resource deletes also the associated events, contacts and tasks. Tested with all database datastores. Update datastore sample projects.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8947 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-10-10 22:24:46 +00:00
parent f54a1641df
commit f0d8344fee
19 changed files with 611 additions and 692 deletions

View File

@ -6,8 +6,8 @@ object Form1: TForm1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 686 ClientHeight = 686
ClientWidth = 980 ClientWidth = 980
LCLVersion = '3.99.0.0'
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '2.3.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 34 Height = 34
@ -47,8 +47,8 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'New resource' Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1 TabOrder = 1
OnClick = BtnNewResClick
end end
object BtnEditRes: TButton object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes AnchorSideLeft.Control = BtnNewRes
@ -64,8 +64,25 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'Edit resource' Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2 TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 416
Height = 25
Top = 5
Width = 107
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
@ -86,18 +103,13 @@ object Form1: TForm1
Height = 624 Height = 624
Top = 0 Top = 0
Width = 301 Width = 301
PopupMenu = VpDayView1.default
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12 Font.Height = -12
ParentFont = False ParentFont = False
Align = alLeft Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0 TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllDayEventAttributes.Font.Height = -12 AllDayEventAttributes.Font.Height = -12
AllowDragAndDrop = True AllowDragAndDrop = True
ShowEventTimes = False ShowEventTimes = False
@ -109,17 +121,10 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00 TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00 TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13 HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24 RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12 RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end end
object Panel2: TPanel object Panel2: TPanel
Left = 306 Left = 306
@ -137,31 +142,24 @@ object Form1: TForm1
Height = 378 Height = 378
Top = 0 Top = 0
Width = 386 Width = 386
PopupMenu = VpWeekView1.default
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12 Font.Height = -12
ParentFont = False ParentFont = False
AllDayEventAttributes.BackgroundColor = clWindow AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllDayEventAttributes.Font.Height = -12 AllDayEventAttributes.Font.Height = -12
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd' DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventFont.Height = -12 EventFont.Height = -12
HeadAttributes.Font.Height = -12 HeadAttributes.Font.Height = -12
HeadAttributes.Color = clBtnFace
LineColor = clGray LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday WeekStartsOn = dtMonday
Align = alClient Align = alClient
TabStop = True
TabOrder = 0 TabOrder = 0
end end
object VpMonthView1: TVpMonthView object VpMonthView1: TVpMonthView
@ -169,34 +167,22 @@ object Form1: TForm1
Height = 241 Height = 241
Top = 383 Top = 383
Width = 386 Width = 386
PopupMenu = VpMonthView1.default
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12 Font.Height = -12
ParentFont = False ParentFont = False
Align = alBottom Align = alBottom
TabStop = True
TabOrder = 1 TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DayNumberFont.Height = -12 DayNumberFont.Height = -12
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventDayStyle = []
EventFont.Height = -12 EventFont.Height = -12
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3 TodayAttributes.BorderPen.Width = 3
WeekStartsOn = dtSunday
end end
object Splitter2: TSplitter object Splitter2: TSplitter
Cursor = crVSplit Cursor = crVSplit
@ -213,31 +199,18 @@ object Form1: TForm1
Height = 624 Height = 624
Top = 0 Top = 0
Width = 275 Width = 275
PopupMenu = VpTaskList1.default
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12 Font.Height = -12
ParentFont = False ParentFont = False
Align = alClient Align = alClient
TabStop = True
TabOrder = 2 TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = False
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray DrawingStyle = dsFlat
LineColor = clGray LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver TaskHeadAttributes.Color = clSilver
TaskHeadAttributes.Font.Height = -12 TaskHeadAttributes.Font.Height = -12
DrawingStyle = dsFlat
ShowResourceName = True
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 692 Left = 692
@ -270,18 +243,12 @@ object Form1: TForm1
Height = 624 Height = 624
Top = 0 Top = 0
Width = 932 Width = 932
PopupMenu = VpContactGrid1.default
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
end end
end end
@ -297,7 +264,7 @@ object Form1: TForm1
Top = 264 Top = 264
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.8.0'
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
@ -309,33 +276,19 @@ object Form1: TForm1
Top = 335 Top = 335
end end
object VpBufDSDataStore1: TVpBufDSDataStore object VpBufDSDataStore1: TVpBufDSDataStore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0' CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1' CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2' CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3' CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4' CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5' CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6' CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7' CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8' CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9' CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
AutoConnect = True AutoConnect = True
AutoCreate = True
DayBuffer = 31
UseAutoIncFields = False UseAutoIncFields = False
Left = 136 Left = 136
Top = 192 Top = 192

View File

@ -14,6 +14,7 @@ type
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
BtnDeleteRes: TButton;
BtnNewRes: TButton; BtnNewRes: TButton;
BtnEditRes: TButton; BtnEditRes: TButton;
PageControl1: TPageControl; PageControl1: TPageControl;
@ -34,6 +35,7 @@ type
VpResourceEditDialog1: TVpResourceEditDialog; VpResourceEditDialog1: TVpResourceEditDialog;
VpTaskList1: TVpTaskList; VpTaskList1: TVpTaskList;
VpWeekView1: TVpWeekView; VpWeekView1: TVpWeekView;
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject); procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
@ -70,6 +72,22 @@ begin
VpResourceEditDialog1.Execute; VpResourceEditDialog1.Execute;
end; end;
// Deletes the selected resource and associated events, contacts and tasks
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
// Load the last resource. // Load the last resource.
procedure TForm1.FormCreate(Sender: TObject); procedure TForm1.FormCreate(Sender: TObject);
var var

View File

@ -6,9 +6,9 @@ object Form1: TForm1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 686 ClientHeight = 686
ClientWidth = 895 ClientWidth = 895
LCLVersion = '3.99.0.0'
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
LCLVersion = '2.3.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 33 Height = 33
@ -22,9 +22,10 @@ object Form1: TForm1
TabOrder = 0 TabOrder = 0
object VpResourceCombo1: TVpResourceCombo object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
Left = 4 Left = 4
Height = 23 Height = 23
Top = 5 Top = 4
Width = 208 Width = 208
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
Style = csDropDownList Style = csDropDownList
@ -35,6 +36,7 @@ object Form1: TForm1
object BtnNewRes: TButton object BtnNewRes: TButton
AnchorSideLeft.Control = VpResourceCombo1 AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 216 Left = 216
Height = 25 Height = 25
Top = 4 Top = 4
@ -44,12 +46,13 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'New resource' Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1 TabOrder = 1
OnClick = BtnNewResClick
end end
object BtnEditRes: TButton object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 318 Left = 318
Height = 25 Height = 25
Top = 4 Top = 4
@ -59,8 +62,24 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'Edit resource' Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2 TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 416
Height = 25
Top = 4
Width = 107
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
@ -81,16 +100,11 @@ object Form1: TForm1
Height = 625 Height = 625
Top = 0 Top = 0
Width = 283 Width = 283
PopupMenu = VpDayView1.default
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alLeft Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0 TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllowDragAndDrop = True AllowDragAndDrop = True
ShowEventTimes = False ShowEventTimes = False
DrawingStyle = dsFlat DrawingStyle = dsFlat
@ -101,17 +115,10 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00 TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00 TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13 HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24 RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12 RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end end
object Panel2: TPanel object Panel2: TPanel
Left = 288 Left = 288
@ -129,26 +136,19 @@ object Form1: TForm1
Height = 379 Height = 379
Top = 0 Top = 0
Width = 339 Width = 339
PopupMenu = VpWeekView1.default
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
AllDayEventAttributes.BackgroundColor = clWindow AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd' DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
HeadAttributes.Color = clBtnFace
LineColor = clGray LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday WeekStartsOn = dtMonday
Align = alClient Align = alClient
TabStop = True
TabOrder = 0 TabOrder = 0
end end
object VpMonthView1: TVpMonthView object VpMonthView1: TVpMonthView
@ -156,30 +156,18 @@ object Form1: TForm1
Height = 241 Height = 241
Top = 384 Top = 384
Width = 339 Width = 339
PopupMenu = VpMonthView1.default
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alBottom Align = alBottom
TabStop = True
TabOrder = 1 TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3 TodayAttributes.BorderPen.Width = 3
WeekStartsOn = dtSunday
end end
object Splitter2: TSplitter object Splitter2: TSplitter
Cursor = crVSplit Cursor = crVSplit
@ -196,28 +184,15 @@ object Form1: TForm1
Height = 625 Height = 625
Top = 0 Top = 0
Width = 255 Width = 255
PopupMenu = VpTaskList1.default
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 2 TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = False
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat DrawingStyle = dsFlat
ShowResourceName = True LineColor = clGray
TaskHeadAttributes.Color = clSilver
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 627 Left = 627
@ -250,18 +225,12 @@ object Form1: TForm1
Height = 625 Height = 625
Top = 0 Top = 0
Width = 847 Width = 847
PopupMenu = VpContactGrid1.default
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
end end
end end
@ -277,7 +246,7 @@ object Form1: TForm1
Top = 264 Top = 264
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.8.0'
DataStore = VpFirebirdDatastore1 DataStore = VpFirebirdDatastore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
@ -296,34 +265,20 @@ object Form1: TForm1
Top = 120 Top = 120
end end
object VpFirebirdDatastore1: TVpFirebirdDatastore object VpFirebirdDatastore1: TVpFirebirdDatastore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0' CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1' CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2' CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3' CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4' CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5' CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6' CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7' CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8' CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9' CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
Connection = IBConnection1 Connection = IBConnection1
AutoConnect = False
AutoCreate = False AutoCreate = False
DayBuffer = 31
Left = 136 Left = 136
Top = 200 Top = 200
end end

View File

@ -17,6 +17,7 @@ type
TForm1 = class(TForm) TForm1 = class(TForm)
BtnNewRes: TButton; BtnNewRes: TButton;
BtnEditRes: TButton; BtnEditRes: TButton;
BtnDeleteRes: TButton;
IBConnection1: TIBConnection; IBConnection1: TIBConnection;
PageControl1: TPageControl; PageControl1: TPageControl;
Panel1: TPanel; Panel1: TPanel;
@ -38,6 +39,7 @@ type
VpResourceEditDialog1: TVpResourceEditDialog; VpResourceEditDialog1: TVpResourceEditDialog;
VpTaskList1: TVpTaskList; VpTaskList1: TVpTaskList;
VpWeekView1: TVpWeekView; VpWeekView1: TVpWeekView;
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject); procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
@ -69,6 +71,21 @@ begin
VpResourceEditDialog1.AddNewResource; VpResourceEditDialog1.AddNewResource;
end; end;
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
// Edits the currently selected resource // Edits the currently selected resource
procedure TForm1.BtnEditResClick(Sender: TObject); procedure TForm1.BtnEditResClick(Sender: TObject);
begin begin

View File

@ -6,25 +6,27 @@ object Form1: TForm1
Caption = 'VpFlexDatastore demo (MS Access via ODBC)' Caption = 'VpFlexDatastore demo (MS Access via ODBC)'
ClientHeight = 686 ClientHeight = 686
ClientWidth = 980 ClientWidth = 980
LCLVersion = '3.99.0.0'
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
LCLVersion = '2.3.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 33 Height = 34
Top = 0 Top = 0
Width = 980 Width = 980
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 33 ClientHeight = 34
ClientWidth = 980 ClientWidth = 980
TabOrder = 0 TabOrder = 0
object VpResourceCombo1: TVpResourceCombo object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 4 Left = 4
Height = 23 Height = 23
Top = 5 Top = 6
Width = 208 Width = 208
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
Style = csDropDownList Style = csDropDownList
@ -35,38 +37,59 @@ object Form1: TForm1
object BtnNewRes: TButton object BtnNewRes: TButton
AnchorSideLeft.Control = VpResourceCombo1 AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 216 Left = 216
Height = 25 Height = 25
Top = 4 Top = 5
Width = 98 Width = 98
AutoSize = True AutoSize = True
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'New resource' Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1 TabOrder = 1
OnClick = BtnNewResClick
end end
object BtnEditRes: TButton object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 318 Left = 318
Height = 25 Height = 25
Top = 4 Top = 5
Width = 94 Width = 94
AutoSize = True AutoSize = True
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'Edit resource' Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2 TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 416
Height = 25
Top = 5
Width = 107
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 653 Height = 652
Top = 33 Top = 34
Width = 980 Width = 980
ActivePage = TabSheet1 ActivePage = TabSheet1
Align = alClient Align = alClient
@ -75,23 +98,18 @@ object Form1: TForm1
OnChange = PageControl1Change OnChange = PageControl1Change
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Events and tasks' Caption = 'Events and tasks'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 972 ClientWidth = 972
object VpDayView1: TVpDayView object VpDayView1: TVpDayView
Left = 0 Left = 0
Height = 625 Height = 624
Top = 0 Top = 0
Width = 301 Width = 301
PopupMenu = VpDayView1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alLeft Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0 TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllowDragAndDrop = True AllowDragAndDrop = True
ShowEventTimes = False ShowEventTimes = False
DrawingStyle = dsFlat DrawingStyle = dsFlat
@ -102,81 +120,56 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00 TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00 TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13 HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24 RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12 RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end end
object Panel2: TPanel object Panel2: TPanel
Left = 306 Left = 306
Height = 625 Height = 624
Top = 0 Top = 0
Width = 386 Width = 386
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'Panel2' Caption = 'Panel2'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 386 ClientWidth = 386
TabOrder = 1 TabOrder = 1
object VpWeekView1: TVpWeekView object VpWeekView1: TVpWeekView
Left = 0 Left = 0
Height = 379 Height = 378
Top = 0 Top = 0
Width = 386 Width = 386
PopupMenu = VpWeekView1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
AllDayEventAttributes.BackgroundColor = clWindow AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd' DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
HeadAttributes.Color = clBtnFace
LineColor = clGray LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday WeekStartsOn = dtMonday
Align = alClient Align = alClient
TabStop = True
TabOrder = 0 TabOrder = 0
end end
object VpMonthView1: TVpMonthView object VpMonthView1: TVpMonthView
Left = 0 Left = 0
Height = 241 Height = 241
Top = 384 Top = 383
Width = 386 Width = 386
PopupMenu = VpMonthView1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alBottom Align = alBottom
TabStop = True
TabOrder = 1 TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3 TodayAttributes.BorderPen.Width = 3
@ -186,7 +179,7 @@ object Form1: TForm1
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 379 Top = 378
Width = 386 Width = 386
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
@ -194,52 +187,40 @@ object Form1: TForm1
end end
object VpTaskList1: TVpTaskList object VpTaskList1: TVpTaskList
Left = 697 Left = 697
Height = 625 Height = 624
Top = 0 Top = 0
Width = 275 Width = 275
PopupMenu = VpTaskList1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 2 TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = True DisplayOptions.ShowAll = True
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat DrawingStyle = dsFlat
ShowResourceName = True LineColor = clGray
TaskHeadAttributes.Color = clSilver
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 692 Left = 692
Height = 625 Height = 624
Top = 0 Top = 0
Width = 5 Width = 5
end end
object Splitter3: TSplitter object Splitter3: TSplitter
Left = 301 Left = 301
Height = 625 Height = 624
Top = 0 Top = 0
Width = 5 Width = 5
end end
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'Contacts' Caption = 'Contacts'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 972 ClientWidth = 972
object VpContactButtonBar1: TVpContactButtonBar object VpContactButtonBar1: TVpContactButtonBar
Left = 0 Left = 0
Height = 625 Height = 624
Top = 0 Top = 0
Width = 40 Width = 40
DrawingStyle = dsFlat DrawingStyle = dsFlat
@ -248,27 +229,21 @@ object Form1: TForm1
end end
object VpContactGrid1: TVpContactGrid object VpContactGrid1: TVpContactGrid
Left = 40 Left = 40
Height = 625 Height = 624
Top = 0 Top = 0
Width = 932 Width = 932
PopupMenu = VpContactGrid1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
end end
end end
object TabSheet3: TTabSheet object TabSheet3: TTabSheet
Caption = 'Grids' Caption = 'Grids'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 972 ClientWidth = 972
object TabControl1: TTabControl object TabControl1: TTabControl
AnchorSideLeft.Control = TabSheet3 AnchorSideLeft.Control = TabSheet3
@ -279,7 +254,7 @@ object Form1: TForm1
AnchorSideBottom.Control = TabSheet3 AnchorSideBottom.Control = TabSheet3
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 8 Left = 8
Height = 576 Height = 575
Top = 41 Top = 41
Width = 956 Width = 956
OnChange = TabControl1Change OnChange = TabControl1Change
@ -295,7 +270,7 @@ object Form1: TForm1
TabOrder = 0 TabOrder = 0
object Grid: TDBGrid object Grid: TDBGrid
Left = 2 Left = 2
Height = 551 Height = 550
Top = 23 Top = 23
Width = 952 Width = 952
Align = alClient Align = alClient
@ -338,8 +313,8 @@ object Form1: TForm1
Width = 120 Width = 120
BorderSpacing.Left = 8 BorderSpacing.Left = 8
Caption = 'Apply to planner' Caption = 'Apply to planner'
OnClick = BtnApplyToPlannerClick
TabOrder = 2 TabOrder = 2
OnClick = BtnApplyToPlannerClick
end end
end end
end end
@ -354,7 +329,7 @@ object Form1: TForm1
Top = 168 Top = 168
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.8.0'
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
@ -366,38 +341,22 @@ object Form1: TForm1
Top = 232 Top = 232
end end
object VpFlexDataStore1: TVpFlexDataStore object VpFlexDataStore1: TVpFlexDataStore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0' CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1' CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2' CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3' CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4' CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5' CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6' CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7' CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8' CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9' CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
AutoConnect = False
AutoCreate = True
DayBuffer = 31
DataSources.ResourceDataSource = DsResources DataSources.ResourceDataSource = DsResources
DataSources.EventsDataSource = DsEvents DataSources.EventsDataSource = DsEvents
DataSources.ContactsDataSource = DsContacts DataSources.ContactsDataSource = DsContacts
DataSources.TasksDataSource = DsTasks DataSources.TasksDataSource = DsTasks
ResourceID = 0
OnCreateTable = VpFlexDataStore1CreateTable OnCreateTable = VpFlexDataStore1CreateTable
Left = 136 Left = 136
Top = 101 Top = 101

View File

@ -19,6 +19,7 @@ type
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
BtnDeleteRes: TButton;
BtnNewRes: TButton; BtnNewRes: TButton;
BtnEditRes: TButton; BtnEditRes: TButton;
BtnApplyToPlanner: TButton; BtnApplyToPlanner: TButton;
@ -62,6 +63,7 @@ type
VpResourceEditDialog1: TVpResourceEditDialog; VpResourceEditDialog1: TVpResourceEditDialog;
VpTaskList1: TVpTaskList; VpTaskList1: TVpTaskList;
VpWeekView1: TVpWeekView; VpWeekView1: TVpWeekView;
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject); procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject);
procedure BtnApplyToPlannerClick(Sender: TObject); procedure BtnApplyToPlannerClick(Sender: TObject);
@ -118,6 +120,22 @@ begin
VpResourceEditDialog1.Execute; VpResourceEditDialog1.Execute;
end; end;
// Deletes the selected resource and associated events, contacts and tasks
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
procedure TForm1.BtnApplyToPlannerClick(Sender: TObject); procedure TForm1.BtnApplyToPlannerClick(Sender: TObject);
var var
resID: Integer; resID: Integer;

View File

@ -6,25 +6,27 @@ object Form1: TForm1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 686 ClientHeight = 686
ClientWidth = 910 ClientWidth = 910
LCLVersion = '3.99.0.0'
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
LCLVersion = '2.3.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 33 Height = 34
Top = 0 Top = 0
Width = 910 Width = 910
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 33 ClientHeight = 34
ClientWidth = 910 ClientWidth = 910
TabOrder = 0 TabOrder = 0
object VpResourceCombo1: TVpResourceCombo object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 4 Left = 4
Height = 23 Height = 23
Top = 5 Top = 6
Width = 208 Width = 208
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
Style = csDropDownList Style = csDropDownList
@ -35,6 +37,7 @@ object Form1: TForm1
object BtnNewRes: TButton object BtnNewRes: TButton
AnchorSideLeft.Control = VpResourceCombo1 AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 216 Left = 216
Height = 25 Height = 25
Top = 4 Top = 4
@ -44,12 +47,13 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'New resource' Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1 TabOrder = 1
OnClick = BtnNewResClick
end end
object BtnEditRes: TButton object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 318 Left = 318
Height = 25 Height = 25
Top = 4 Top = 4
@ -59,14 +63,31 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'Edit resource' Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2 TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 416
Height = 25
Top = 5
Width = 107
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 653 Height = 652
Top = 33 Top = 34
Width = 910 Width = 910
ActivePage = TabSheet1 ActivePage = TabSheet1
Align = alClient Align = alClient
@ -74,23 +95,18 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Events and tasks' Caption = 'Events and tasks'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 902 ClientWidth = 902
object VpDayView1: TVpDayView object VpDayView1: TVpDayView
Left = 0 Left = 0
Height = 625 Height = 624
Top = 0 Top = 0
Width = 283 Width = 283
PopupMenu = VpDayView1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alLeft Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0 TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllowDragAndDrop = True AllowDragAndDrop = True
ShowEventTimes = False ShowEventTimes = False
DrawingStyle = dsFlat DrawingStyle = dsFlat
@ -101,81 +117,56 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00 TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00 TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13 HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24 RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12 RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end end
object Panel2: TPanel object Panel2: TPanel
Left = 288 Left = 288
Height = 625 Height = 624
Top = 0 Top = 0
Width = 363 Width = 363
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'Panel2' Caption = 'Panel2'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 363 ClientWidth = 363
TabOrder = 1 TabOrder = 1
object VpWeekView1: TVpWeekView object VpWeekView1: TVpWeekView
Left = 0 Left = 0
Height = 379 Height = 378
Top = 0 Top = 0
Width = 363 Width = 363
PopupMenu = VpWeekView1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
AllDayEventAttributes.BackgroundColor = clWindow AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd' DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
HeadAttributes.Color = clBtnFace
LineColor = clGray LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday WeekStartsOn = dtMonday
Align = alClient Align = alClient
TabStop = True
TabOrder = 0 TabOrder = 0
end end
object VpMonthView1: TVpMonthView object VpMonthView1: TVpMonthView
Left = 0 Left = 0
Height = 241 Height = 241
Top = 384 Top = 383
Width = 363 Width = 363
PopupMenu = VpMonthView1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alBottom Align = alBottom
TabStop = True
TabOrder = 1 TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3 TodayAttributes.BorderPen.Width = 3
@ -185,7 +176,7 @@ object Form1: TForm1
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 379 Top = 378
Width = 363 Width = 363
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
@ -193,52 +184,40 @@ object Form1: TForm1
end end
object VpTaskList1: TVpTaskList object VpTaskList1: TVpTaskList
Left = 656 Left = 656
Height = 625 Height = 624
Top = 0 Top = 0
Width = 246 Width = 246
PopupMenu = VpTaskList1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 2 TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = True DisplayOptions.ShowCompletedTasks = True
DisplayOptions.ShowAll = False
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat DrawingStyle = dsFlat
ShowResourceName = True LineColor = clGray
TaskHeadAttributes.Color = clSilver
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 651 Left = 651
Height = 625 Height = 624
Top = 0 Top = 0
Width = 5 Width = 5
end end
object Splitter3: TSplitter object Splitter3: TSplitter
Left = 283 Left = 283
Height = 625 Height = 624
Top = 0 Top = 0
Width = 5 Width = 5
end end
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'Contacts' Caption = 'Contacts'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 902 ClientWidth = 902
object VpContactButtonBar1: TVpContactButtonBar object VpContactButtonBar1: TVpContactButtonBar
Left = 0 Left = 0
Height = 625 Height = 624
Top = 0 Top = 0
Width = 40 Width = 40
DrawingStyle = dsFlat DrawingStyle = dsFlat
@ -247,21 +226,15 @@ object Form1: TForm1
end end
object VpContactGrid1: TVpContactGrid object VpContactGrid1: TVpContactGrid
Left = 40 Left = 40
Height = 625 Height = 624
Top = 0 Top = 0
Width = 862 Width = 862
PopupMenu = VpContactGrid1.default
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
end end
end end
@ -277,7 +250,7 @@ object Form1: TForm1
Top = 168 Top = 168
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.8.0'
DataStore = VpFlexDataStore1 DataStore = VpFlexDataStore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
@ -289,38 +262,23 @@ object Form1: TForm1
Top = 232 Top = 232
end end
object VpFlexDataStore1: TVpFlexDataStore object VpFlexDataStore1: TVpFlexDataStore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0' CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1' CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2' CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3' CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4' CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5' CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6' CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7' CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8' CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9' CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
AutoConnect = False
AutoCreate = False AutoCreate = False
DayBuffer = 31
DataSources.ResourceDataSource = DsResources DataSources.ResourceDataSource = DsResources
DataSources.EventsDataSource = DsEvents DataSources.EventsDataSource = DsEvents
DataSources.ContactsDataSource = DsContacts DataSources.ContactsDataSource = DsContacts
DataSources.TasksDataSource = DsTasks DataSources.TasksDataSource = DsTasks
ResourceID = 0
Left = 136 Left = 136
Top = 101 Top = 101
ResourceFieldMappings = ( ResourceFieldMappings = (

View File

@ -16,6 +16,7 @@ type
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
BtnDeleteRes: TButton;
BtnNewRes: TButton; BtnNewRes: TButton;
BtnEditRes: TButton; BtnEditRes: TButton;
DsTasks: TDataSource; DsTasks: TDataSource;
@ -46,6 +47,7 @@ type
VpResourceEditDialog1: TVpResourceEditDialog; VpResourceEditDialog1: TVpResourceEditDialog;
VpTaskList1: TVpTaskList; VpTaskList1: TVpTaskList;
VpWeekView1: TVpWeekView; VpWeekView1: TVpWeekView;
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject); procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject);
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
@ -88,6 +90,22 @@ begin
VpResourceEditDialog1.AddNewResource; VpResourceEditDialog1.AddNewResource;
end; end;
// Deletes the selected resource and associated events, contacts and tasks
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
// Edits the currently selected resource // Edits the currently selected resource
procedure TForm1.BtnEditResClick(Sender: TObject); procedure TForm1.BtnEditResClick(Sender: TObject);
begin begin

View File

@ -6,8 +6,8 @@ object Form1: TForm1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 686 ClientHeight = 686
ClientWidth = 980 ClientWidth = 980
LCLVersion = '3.99.0.0'
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '2.1.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 33 Height = 33
@ -21,6 +21,8 @@ object Form1: TForm1
TabOrder = 0 TabOrder = 0
object VpResourceCombo1: TVpResourceCombo object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 4 Left = 4
Height = 23 Height = 23
Top = 5 Top = 5
@ -34,6 +36,7 @@ object Form1: TForm1
object BtnNewRes: TButton object BtnNewRes: TButton
AnchorSideLeft.Control = VpResourceCombo1 AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 216 Left = 216
Height = 25 Height = 25
Top = 4 Top = 4
@ -43,12 +46,13 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'New resource' Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1 TabOrder = 1
OnClick = BtnNewResClick
end end
object BtnEditRes: TButton object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 318 Left = 318
Height = 25 Height = 25
Top = 4 Top = 4
@ -58,8 +62,24 @@ object Form1: TForm1
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Caption = 'Edit resource' Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2 TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 416
Height = 25
Top = 4
Width = 107
AutoSize = True
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
@ -74,23 +94,18 @@ object Form1: TForm1
OnChange = PageControl1Change OnChange = PageControl1Change
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Events and tasks' Caption = 'Events and tasks'
ClientHeight = 624 ClientHeight = 625
ClientWidth = 972 ClientWidth = 972
object VpDayView1: TVpDayView object VpDayView1: TVpDayView
Left = 0 Left = 0
Height = 624 Height = 625
Top = 0 Top = 0
Width = 301 Width = 301
PopupMenu = VpDayView1.default
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alLeft Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0 TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
ShowEventTimes = False ShowEventTimes = False
DrawingStyle = dsFlat DrawingStyle = dsFlat
TimeSlotColors.Active = clWhite TimeSlotColors.Active = clWhite
@ -100,91 +115,65 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00 TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00 TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13 HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24 RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12 RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end end
object Panel2: TPanel object Panel2: TPanel
Left = 306 Left = 306
Height = 624 Height = 625
Top = 0 Top = 0
Width = 386 Width = 386
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'Panel2' Caption = 'Panel2'
ClientHeight = 624 ClientHeight = 625
ClientWidth = 386 ClientWidth = 386
TabOrder = 1 TabOrder = 1
object VpWeekView1: TVpWeekView object VpWeekView1: TVpWeekView
Left = 0 Left = 0
Height = 378 Height = 379
Top = 0 Top = 0
Width = 386 Width = 386
PopupMenu = VpWeekView1.default
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
AllDayEventAttributes.BackgroundColor = clWindow AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd' DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
HeadAttributes.Color = clBtnFace
LineColor = clGray LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday WeekStartsOn = dtMonday
Align = alClient Align = alClient
TabStop = True
TabOrder = 0 TabOrder = 0
end end
object VpMonthView1: TVpMonthView object VpMonthView1: TVpMonthView
Left = 0 Left = 0
Height = 241 Height = 241
Top = 383 Top = 384
Width = 386 Width = 386
PopupMenu = VpMonthView1.default
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alBottom Align = alBottom
TabStop = True
TabOrder = 1 TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3 TodayAttributes.BorderPen.Width = 3
WeekStartsOn = dtSunday
end end
object Splitter2: TSplitter object Splitter2: TSplitter
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 378 Top = 379
Width = 386 Width = 386
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
@ -192,41 +181,28 @@ object Form1: TForm1
end end
object VpTaskList1: TVpTaskList object VpTaskList1: TVpTaskList
Left = 697 Left = 697
Height = 624 Height = 625
Top = 0 Top = 0
Width = 275 Width = 275
PopupMenu = VpTaskList1.default
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 2 TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = False
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat DrawingStyle = dsFlat
ShowResourceName = True LineColor = clGray
TaskHeadAttributes.Color = clSilver
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 692 Left = 692
Height = 624 Height = 625
Top = 0 Top = 0
Width = 5 Width = 5
end end
object Splitter3: TSplitter object Splitter3: TSplitter
Left = 301 Left = 301
Height = 624 Height = 625
Top = 0 Top = 0
Width = 5 Width = 5
end end
@ -243,7 +219,6 @@ object Form1: TForm1
ContactGrid = VpContactGrid1 ContactGrid = VpContactGrid1
DrawingStyle = dsFlat DrawingStyle = dsFlat
OnContactNotFound = VpContactButtonBar1ContactNotFound OnContactNotFound = VpContactButtonBar1ContactNotFound
RadioStyle = True
Align = alLeft Align = alLeft
end end
object VpContactGrid1: TVpContactGrid object VpContactGrid1: TVpContactGrid
@ -251,18 +226,12 @@ object Form1: TForm1
Height = 625 Height = 625
Top = 0 Top = 0
Width = 932 Width = 932
PopupMenu = VpContactGrid1.default
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
end end
end end
@ -303,8 +272,8 @@ object Form1: TForm1
AutoSize = True AutoSize = True
BorderSpacing.Left = 8 BorderSpacing.Left = 8
Caption = 'Apply to planner' Caption = 'Apply to planner'
OnClick = BtnApplyToPlannerClick
TabOrder = 1 TabOrder = 1
OnClick = BtnApplyToPlannerClick
end end
object TabControl1: TTabControl object TabControl1: TTabControl
AnchorSideLeft.Control = TabSheet3 AnchorSideLeft.Control = TabSheet3
@ -345,20 +314,16 @@ object Form1: TForm1
end end
object VpControlLink1: TVpControlLink object VpControlLink1: TVpControlLink
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
Printer.BottomMargin = 0
Printer.DayStart = h_08 Printer.DayStart = h_08
Printer.DayEnd = h_05 Printer.DayEnd = h_05
Printer.Granularity = gr30Min Printer.Granularity = gr30Min
Printer.LeftMargin = 0
Printer.MarginUnits = imAbsolutePixel Printer.MarginUnits = imAbsolutePixel
Printer.PrintFormats = <> Printer.PrintFormats = <>
Printer.RightMargin = 0 Left = 136
Printer.TopMargin = 0 Top = 264
left = 136
top = 264
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.8.0'
DataStore = VpSqlite3Datastore1 DataStore = VpSqlite3Datastore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
@ -366,55 +331,42 @@ object Form1: TForm1
Placement.Left = 10 Placement.Left = 10
Placement.Height = 250 Placement.Height = 250
Placement.Width = 400 Placement.Width = 400
left = 136 Left = 136
top = 335 Top = 335
end end
object VpSqlite3Datastore1: TVpSqlite3Datastore object VpSqlite3Datastore1: TVpSqlite3Datastore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0' CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1' CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2' CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3' CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4' CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5' CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6' CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7' CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8' CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9' CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
Connection = SQLite3Connection1 Connection = SQLite3Connection1
AutoConnect = False
AutoCreate = False AutoCreate = False
DayBuffer = 31 Left = 136
left = 136 Top = 192
top = 192
end end
object SQLite3Connection1: TSQLite3Connection object SQLite3Connection1: TSQLite3Connection
Connected = False Connected = False
LoginPrompt = False LoginPrompt = False
KeepConnection = False KeepConnection = False
Transaction = SQLTransaction1 Transaction = SQLTransaction1
left = 136 AlwaysUseBigint = False
top = 120 Left = 136
Top = 120
end end
object SQLTransaction1: TSQLTransaction object SQLTransaction1: TSQLTransaction
Active = False Active = False
Action = caCommitRetaining Action = caCommitRetaining
Database = SQLite3Connection1 Database = SQLite3Connection1
left = 256 Left = 256
top = 120 Top = 120
end end
object QryAllResources: TSQLQuery object QryAllResources: TSQLQuery
PacketRecords = -1 PacketRecords = -1
@ -517,10 +469,11 @@ object Form1: TForm1
) )
Options = [sqoKeepOpenOnCommit, sqoAutoCommit] Options = [sqoKeepOpenOnCommit, sqoAutoCommit]
Params = <> Params = <>
Macros = <>
UpdateMode = upWhereAll UpdateMode = upWhereAll
UsePrimaryKeyAsKey = False UsePrimaryKeyAsKey = False
left = 560 Left = 560
top = 160 Top = 160
end end
object QryAllContacts: TSQLQuery object QryAllContacts: TSQLQuery
PacketRecords = -1 PacketRecords = -1
@ -712,10 +665,11 @@ object Form1: TForm1
) )
Options = [sqoKeepOpenOnCommit] Options = [sqoKeepOpenOnCommit]
Params = <> Params = <>
Macros = <>
UpdateMode = upWhereAll UpdateMode = upWhereAll
UsePrimaryKeyAsKey = False UsePrimaryKeyAsKey = False
left = 560 Left = 560
top = 214 Top = 214
end end
object QryAllEvents: TSQLQuery object QryAllEvents: TSQLQuery
PacketRecords = -1 PacketRecords = -1
@ -730,10 +684,11 @@ object Form1: TForm1
) )
Options = [sqoKeepOpenOnCommit, sqoAutoApplyUpdates] Options = [sqoKeepOpenOnCommit, sqoAutoApplyUpdates]
Params = <> Params = <>
Macros = <>
UpdateMode = upWhereAll UpdateMode = upWhereAll
UsePrimaryKeyAsKey = False UsePrimaryKeyAsKey = False
left = 560 Left = 560
top = 274 Top = 274
end end
object QryAllTasks: TSQLQuery object QryAllTasks: TSQLQuery
PacketRecords = -1 PacketRecords = -1
@ -748,29 +703,30 @@ object Form1: TForm1
) )
Options = [sqoKeepOpenOnCommit, sqoAutoCommit] Options = [sqoKeepOpenOnCommit, sqoAutoCommit]
Params = <> Params = <>
Macros = <>
UpdateMode = upWhereAll UpdateMode = upWhereAll
UsePrimaryKeyAsKey = False UsePrimaryKeyAsKey = False
left = 560 Left = 560
top = 341 Top = 341
end end
object DsAllResources: TDataSource object DsAllResources: TDataSource
DataSet = QryAllResources DataSet = QryAllResources
left = 656 Left = 656
top = 160 Top = 160
end end
object DsAllContacts: TDataSource object DsAllContacts: TDataSource
DataSet = QryAllContacts DataSet = QryAllContacts
left = 659 Left = 659
top = 214 Top = 214
end end
object DsAllEvents: TDataSource object DsAllEvents: TDataSource
DataSet = QryAllEvents DataSet = QryAllEvents
left = 654 Left = 654
top = 274 Top = 274
end end
object DsAllTasks: TDataSource object DsAllTasks: TDataSource
DataSet = QryAllTasks DataSet = QryAllTasks
left = 656 Left = 656
top = 341 Top = 341
end end
end end

View File

@ -15,6 +15,7 @@ type
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
BtnDeleteRes: TButton;
BtnNewRes: TButton; BtnNewRes: TButton;
BtnEditRes: TButton; BtnEditRes: TButton;
BtnApplyToPlanner: TButton; BtnApplyToPlanner: TButton;
@ -51,6 +52,7 @@ type
VpTaskList1: TVpTaskList; VpTaskList1: TVpTaskList;
VpWeekView1: TVpWeekView; VpWeekView1: TVpWeekView;
procedure BtnApplyToPlannerClick(Sender: TObject); procedure BtnApplyToPlannerClick(Sender: TObject);
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject); procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
@ -105,6 +107,22 @@ begin
QryAllTasks.Open; QryAllTasks.Open;
end; end;
// Deletes the selected resource and associated events, contacts and tasks
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
// Adds a new resource // Adds a new resource
procedure TForm1.BtnNewResClick(Sender: TObject); procedure TForm1.BtnNewResClick(Sender: TObject);
begin begin

View File

@ -66,6 +66,9 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking> <Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<Options> <Options>
<Win32> <Win32>
<GraphicApplication Value="True"/> <GraphicApplication Value="True"/>

View File

@ -6,66 +6,81 @@ object Form1: TForm1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 686 ClientHeight = 686
ClientWidth = 980 ClientWidth = 980
LCLVersion = '3.99.0.0'
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '2.3.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 33 Height = 34
Top = 0 Top = 0
Width = 980 Width = 980
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 33 ClientHeight = 34
ClientWidth = 980 ClientWidth = 980
TabOrder = 0 TabOrder = 0
object VpResourceCombo1: TVpResourceCombo object VpResourceCombo1: TVpResourceCombo
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 4 Left = 4
Height = 23 Height = 23
Top = 5 Top = 6
Width = 208 Width = 208
DataStore = VpZeosDatastore1 DataStore = VpZeosDatastore1
Style = csDropDownList Style = csDropDownList
Borderspacing.Left = 4 Borderspacing.Around = 4
Borderspacing.Top = 4
Borderspacing.Bottom = 4
end end
object BtnNewRes: TButton object BtnNewRes: TButton
AnchorSideLeft.Control = VpResourceCombo1 AnchorSideLeft.Control = VpResourceCombo1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 216 Left = 216
Height = 25 Height = 25
Top = 4 Top = 5
Width = 98 Width = 98
AutoSize = True AutoSize = True
BorderSpacing.Left = 4 BorderSpacing.Around = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'New resource' Caption = 'New resource'
OnClick = BtnNewResClick
TabOrder = 1 TabOrder = 1
OnClick = BtnNewResClick
end end
object BtnEditRes: TButton object BtnEditRes: TButton
AnchorSideLeft.Control = BtnNewRes AnchorSideLeft.Control = BtnNewRes
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 318 Left = 318
Height = 25 Height = 25
Top = 4 Top = 5
Width = 94 Width = 94
AutoSize = True AutoSize = True
BorderSpacing.Left = 4 BorderSpacing.Around = 4
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
Caption = 'Edit resource' Caption = 'Edit resource'
OnClick = BtnEditResClick
TabOrder = 2 TabOrder = 2
OnClick = BtnEditResClick
end
object BtnDeleteRes: TButton
AnchorSideLeft.Control = BtnEditRes
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 416
Height = 25
Top = 5
Width = 107
AutoSize = True
BorderSpacing.Around = 4
Caption = 'Delete resource'
TabOrder = 3
OnClick = BtnDeleteResClick
end end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 653 Height = 652
Top = 33 Top = 34
Width = 980 Width = 980
ActivePage = TabSheet1 ActivePage = TabSheet1
Align = alClient Align = alClient
@ -73,23 +88,18 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Events and tasks' Caption = 'Events and tasks'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 972 ClientWidth = 972
object VpDayView1: TVpDayView object VpDayView1: TVpDayView
Left = 0 Left = 0
Height = 625 Height = 624
Top = 0 Top = 0
Width = 301 Width = 301
PopupMenu = VpDayView1.default
DataStore = VpZeosDatastore1 DataStore = VpZeosDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alLeft Align = alLeft
ReadOnly = False
TabStop = True
TabOrder = 0 TabOrder = 0
AllDayEventAttributes.BackgroundColor = clBtnShadow
AllDayEventAttributes.EventBorderColor = cl3DDkShadow
AllDayEventAttributes.EventBackgroundColor = clBtnFace
AllowDragAndDrop = True AllowDragAndDrop = True
ShowEventTimes = False ShowEventTimes = False
DrawingStyle = dsFlat DrawingStyle = dsFlat
@ -100,91 +110,65 @@ object Form1: TForm1
TimeSlotColors.ActiveRange.RangeBegin = h_00 TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00 TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13 HeadAttributes.Font.Height = -13
HeadAttributes.Color = clBtnFace
RowHeadAttributes.HourFont.Height = -24 RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12 RowHeadAttributes.MinuteFont.Height = -12
RowHeadAttributes.Color = clBtnFace
ShowResourceName = True
LineColor = clGray LineColor = clGray
GutterWidth = 7
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
Granularity = gr30Min
DefaultTopHour = h_07
TimeFormat = tf12Hour
end end
object Panel2: TPanel object Panel2: TPanel
Left = 306 Left = 306
Height = 625 Height = 624
Top = 0 Top = 0
Width = 386 Width = 386
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'Panel2' Caption = 'Panel2'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 386 ClientWidth = 386
TabOrder = 1 TabOrder = 1
object VpWeekView1: TVpWeekView object VpWeekView1: TVpWeekView
Left = 0 Left = 0
Height = 379 Height = 378
Top = 0 Top = 0
Width = 386 Width = 386
PopupMenu = VpWeekView1.default
DataStore = VpZeosDatastore1 DataStore = VpZeosDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
AllDayEventAttributes.BackgroundColor = clWindow AllDayEventAttributes.BackgroundColor = clWindow
AllDayEventAttributes.EventBorderColor = clGray AllDayEventAttributes.EventBorderColor = clGray
AllDayEventAttributes.EventBackgroundColor = clBtnFace
DateLabelFormat = 'dddd, mmmm dd, yyyy' DateLabelFormat = 'dddd, mmmm dd, yyyy'
DayHeadAttributes.Color = clBtnFace
DayHeadAttributes.DateFormat = 'dddd mmmm, dd' DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
HeadAttributes.Color = clBtnFace
LineColor = clGray LineColor = clGray
TimeFormat = tf12Hour
ShowEventTime = True
WeekStartsOn = dtMonday WeekStartsOn = dtMonday
Align = alClient Align = alClient
TabStop = True
TabOrder = 0 TabOrder = 0
end end
object VpMonthView1: TVpMonthView object VpMonthView1: TVpMonthView
Left = 0 Left = 0
Height = 241 Height = 241
Top = 384 Top = 383
Width = 386 Width = 386
PopupMenu = VpMonthView1.default
DataStore = VpZeosDatastore1 DataStore = VpZeosDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alBottom Align = alBottom
TabStop = True
TabOrder = 1 TabOrder = 1
DateLabelFormat = 'mmmm yyyy'
DayHeadAttributes.Font.Height = -13 DayHeadAttributes.Font.Height = -13
DayHeadAttributes.Font.Name = 'Tahoma' DayHeadAttributes.Font.Name = 'Tahoma'
DayHeadAttributes.Color = clBtnFace
DayNameStyle = dsShort
DrawingStyle = dsFlat DrawingStyle = dsFlat
EventDayStyle = []
HeadAttributes.Color = clBtnFace
KBNavigation = True
OffDayColor = clSilver OffDayColor = clSilver
SelectedDayColor = clRed
ShowEvents = True
ShowEventTime = False
TimeFormat = tf12Hour
TodayAttributes.Color = clSilver TodayAttributes.Color = clSilver
TodayAttributes.BorderPen.Color = clRed TodayAttributes.BorderPen.Color = clRed
TodayAttributes.BorderPen.Width = 3 TodayAttributes.BorderPen.Width = 3
WeekStartsOn = dtSunday
end end
object Splitter2: TSplitter object Splitter2: TSplitter
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 379 Top = 378
Width = 386 Width = 386
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
@ -192,52 +176,39 @@ object Form1: TForm1
end end
object VpTaskList1: TVpTaskList object VpTaskList1: TVpTaskList
Left = 697 Left = 697
Height = 625 Height = 624
Top = 0 Top = 0
Width = 275 Width = 275
PopupMenu = VpTaskList1.default
DataStore = VpZeosDatastore1 DataStore = VpZeosDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 2 TabOrder = 2
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = False
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat DrawingStyle = dsFlat
ShowResourceName = True LineColor = clGray
TaskHeadAttributes.Color = clSilver
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 692 Left = 692
Height = 625 Height = 624
Top = 0 Top = 0
Width = 5 Width = 5
end end
object Splitter3: TSplitter object Splitter3: TSplitter
Left = 301 Left = 301
Height = 625 Height = 624
Top = 0 Top = 0
Width = 5 Width = 5
end end
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'Contacts' Caption = 'Contacts'
ClientHeight = 625 ClientHeight = 624
ClientWidth = 972 ClientWidth = 972
object VpContactButtonBar1: TVpContactButtonBar object VpContactButtonBar1: TVpContactButtonBar
Left = 0 Left = 0
Height = 625 Height = 624
Top = 0 Top = 0
Width = 40 Width = 40
DrawingStyle = dsFlat DrawingStyle = dsFlat
@ -246,27 +217,22 @@ object Form1: TForm1
end end
object VpContactGrid1: TVpContactGrid object VpContactGrid1: TVpContactGrid
Left = 40 Left = 40
Height = 625 Height = 624
Top = 0 Top = 0
Width = 932 Width = 932
PopupMenu = VpContactGrid1.default
DataStore = VpZeosDatastore1 DataStore = VpZeosDatastore1
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Color = clWindow
Align = alClient Align = alClient
TabStop = True
TabOrder = 1 TabOrder = 1
AllowInPlaceEditing = True
BarWidth = 3
BarColor = clSilver
ColumnWidth = 200 ColumnWidth = 200
ContactHeadAttributes.Color = clSilver
ContactHeadAttributes.Bordered = True
DrawingStyle = dsFlat DrawingStyle = dsFlat
end end
end end
end end
object ZConnection1: TZConnection object ZConnection1: TZConnection
ControlsCodePage = cCP_UTF8 ControlsCodePage = cCP_UTF8
AutoEncodeStrings = True
Properties.Strings = ( Properties.Strings = (
'AutoEncodeStrings=' 'AutoEncodeStrings='
) )
@ -275,32 +241,19 @@ object Form1: TForm1
Top = 136 Top = 136
end end
object VpZeosDatastore1: TVpZeosDatastore object VpZeosDatastore1: TVpZeosDatastore
CategoryColorMap.Category0.Color = clNavy
CategoryColorMap.Category0.Description = 'Category 0' CategoryColorMap.Category0.Description = 'Category 0'
CategoryColorMap.Category1.Color = clRed
CategoryColorMap.Category1.Description = 'Category 1' CategoryColorMap.Category1.Description = 'Category 1'
CategoryColorMap.Category2.Color = clYellow
CategoryColorMap.Category2.Description = 'Category 2' CategoryColorMap.Category2.Description = 'Category 2'
CategoryColorMap.Category3.Color = clLime
CategoryColorMap.Category3.Description = 'Category 3' CategoryColorMap.Category3.Description = 'Category 3'
CategoryColorMap.Category4.Color = clPurple
CategoryColorMap.Category4.Description = 'Category 4' CategoryColorMap.Category4.Description = 'Category 4'
CategoryColorMap.Category5.Color = clTeal
CategoryColorMap.Category5.Description = 'Category 5' CategoryColorMap.Category5.Description = 'Category 5'
CategoryColorMap.Category6.Color = clFuchsia
CategoryColorMap.Category6.Description = 'Category 6' CategoryColorMap.Category6.Description = 'Category 6'
CategoryColorMap.Category7.Color = clOlive
CategoryColorMap.Category7.Description = 'Category 7' CategoryColorMap.Category7.Description = 'Category 7'
CategoryColorMap.Category8.Color = clAqua
CategoryColorMap.Category8.Description = 'Category 8' CategoryColorMap.Category8.Description = 'Category 8'
CategoryColorMap.Category9.Color = clMaroon
CategoryColorMap.Category9.Description = 'Category 9' CategoryColorMap.Category9.Description = 'Category 9'
HiddenCategories.BackgroundColor = clSilver HiddenCategories.BackgroundColor = clSilver
HiddenCategories.Color = clGray HiddenCategories.Color = clGray
EnableEventTimer = True
PlayEventSounds = True
AutoCreate = True AutoCreate = True
Daybuffer = 31
Left = 136 Left = 136
Top = 200 Top = 200
end end
@ -315,7 +268,7 @@ object Form1: TForm1
Top = 264 Top = 264
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.12' Version = 'v1.8.0'
DataStore = VpZeosDatastore1 DataStore = VpZeosDatastore1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter

View File

@ -5,23 +5,25 @@ unit Unit1;
// Activate ONE of the following defines for the database system to be used: // Activate ONE of the following defines for the database system to be used:
{.$DEFINE sqlite3} {.$DEFINE sqlite3}
{.$DEFINE firebird3} {$DEFINE firebird3}
{$DEFINE postgresql} {.$DEFINE postgresql}
interface interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, ComCtrls, StdCtrls, ComCtrls,
VpBaseDS, VpZeosDs, VpDayView, VpWeekView, VpTaskList, VpContactGrid, ZConnection, ZDbcIntfs,
VpMonthView, VpResEditDlg, VpContactButtons, VpData, VpBaseDS, VpZeosDs,
ZConnection, ZDbcIntfs; VpDayView, VpWeekView, VpMonthView, VpTaskList, VpContactGrid,
VpResEditDlg, VpContactButtons;
type type
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
BtnDeleteRes: TButton;
BtnNewRes: TButton; BtnNewRes: TButton;
BtnEditRes: TButton; BtnEditRes: TButton;
PageControl1: TPageControl; PageControl1: TPageControl;
@ -43,6 +45,7 @@ type
VpWeekView1: TVpWeekView; VpWeekView1: TVpWeekView;
VpZeosDatastore1: TVpZeosDatastore; VpZeosDatastore1: TVpZeosDatastore;
ZConnection1: TZConnection; ZConnection1: TZConnection;
procedure BtnDeleteResClick(Sender: TObject);
procedure BtnNewResClick(Sender: TObject); procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
@ -81,6 +84,21 @@ begin
VpResourceEditDialog1.AddNewResource; VpResourceEditDialog1.AddNewResource;
end; end;
procedure TForm1.BtnDeleteResClick(Sender: TObject);
var
res: TVpResource;
begin
res := VpControlLink1.Datastore.Resource;
if res = nil then
exit;
if MessageDlg(Format('Do you really want to delete resource "%s"? This will also delete its events, tasks and contacts.',
[res.Description]), mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
VpControlLink1.Datastore.DeleteResource(res);
end;
end;
// Edits the currently selected resource // Edits the currently selected resource
procedure TForm1.BtnEditResClick(Sender: TObject); procedure TForm1.BtnEditResClick(Sender: TObject);
begin begin

View File

@ -6,7 +6,7 @@ interface
uses uses
SysUtils, Classes, DB, SysUtils, Classes, DB,
VpBaseDS, VpDBDS, VpData, VpBaseDS, VpDBDS,
ZCompatibility, ZConnection, ZDataset; ZCompatibility, ZConnection, ZDataset;
type type
@ -30,6 +30,9 @@ type
function GetEventsTable: TDataset; override; function GetEventsTable: TDataset; override;
function GetResourceTable: TDataset; override; function GetResourceTable: TDataset; override;
function GetTasksTable: TDataset; override; function GetTasksTable: TDataset; override;
procedure InternalPurgeContacts(Res: TVpResource); override;
procedure InternalPurgeEvents(Res: TVpResource); override;
procedure InternalPurgeTasks(Res: TVpResource); override;
procedure Loaded; override; procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetConnected(const AValue: Boolean); override; procedure SetConnected(const AValue: Boolean); override;
@ -507,6 +510,33 @@ begin
Result := FTasksTable; Result := FTasksTable;
end; end;
{ Removes all contacts of the specified resource from the database. }
procedure TVpZeosDataStore.InternalPurgeContacts(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Contacts WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
{ Removes all events of the specified resource from the database. }
procedure TVpZeosDatastore.InternalPurgeEvents(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Events WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
{ Removes all tasks of the specified resource from the database. }
procedure TVpZeosDatastore.InternalPurgeTasks(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Tasks WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
procedure TVpZeosDatastore.Loaded; procedure TVpZeosDatastore.Loaded;
begin begin
inherited; inherited;

View File

@ -277,6 +277,10 @@ type
procedure LinkToControls(AOwner: TComponent); procedure LinkToControls(AOwner: TComponent);
procedure UnlinkFromControls(AOwner: TComponent); procedure UnlinkFromControls(AOwner: TComponent);
procedure InternalPurgeContacts(Res: TVpResource); virtual;
procedure InternalPurgeEvents(Res: TVpResource); virtual;
procedure InternalPurgeTasks(Res: TVpResource); virtual;
property AutoConnect: Boolean read FAutoConnect write SetAutoConnect default false; property AutoConnect: Boolean read FAutoConnect write SetAutoConnect default false;
property AutoCreate: Boolean read FAutoCreate write FAutoCreate default true; property AutoCreate: Boolean read FAutoCreate write FAutoCreate default true;
@ -948,6 +952,24 @@ begin
NotifyDependents; NotifyDependents;
end; end;
procedure TVpCustomDataStore.InternalPurgeContacts(Res: TVpResource);
begin
// Must be overridden by descendants to remove the contacts of the given
// resource from the external storage
end;
procedure TVpCustomDataStore.InternalPurgeEvents(Res: TVpResource);
begin
// Must be overridden by descendants to remove the events of the given
// resource from the external storage
end;
procedure TVpCustomDataStore.InternalPurgeTasks(Res: TVpResource);
begin
// Must be overridden by descendants to remove the tasks of the given
// resource from the external storage
end;
procedure TVpCustomDataStore.PurgeResource(Res: TVpResource); procedure TVpCustomDataStore.PurgeResource(Res: TVpResource);
begin begin
Unused(Res); Unused(Res);
@ -957,23 +979,35 @@ end;
procedure TVpCustomDataStore.PurgeEvents(Res: TVpResource); procedure TVpCustomDataStore.PurgeEvents(Res: TVpResource);
begin begin
if Res <> nil then
begin
InternalPurgeEvents(Res);
Res.Schedule.ClearEvents; Res.Schedule.ClearEvents;
if not Loading then if not Loading then
NotifyDependents; NotifyDependents;
end;
end; end;
procedure TVpCustomDataStore.PurgeContacts(Res: TVpResource); procedure TVpCustomDataStore.PurgeContacts(Res: TVpResource);
begin begin
if Res <> nil then
begin
InternalPurgeContacts(Res);
Res.Contacts.ClearContacts; Res.Contacts.ClearContacts;
if not Loading then if not Loading then
NotifyDependents; NotifyDependents;
end;
end; end;
procedure TVpCustomDataStore.PurgeTasks(Res: TVpResource); procedure TVpCustomDataStore.PurgeTasks(Res: TVpResource);
begin begin
if Res <> nil then
begin
InternalPurgeTasks(Res);
Res.Tasks.ClearTasks; Res.Tasks.ClearTasks;
if not Loading then if not Loading then
NotifyDependents; NotifyDependents;
end;
end; end;
procedure TVpCustomDatastore.UpdateGroupEvents; procedure TVpCustomDatastore.UpdateGroupEvents;

View File

@ -64,6 +64,10 @@ type
procedure SetReadOnly(const Value: boolean); procedure SetReadOnly(const Value: boolean);
{ internal methods } { internal methods }
procedure InternalPurgeContacts(Res: TVpResource); override;
procedure InternalPurgeEvents(Res: TVpResource); override;
procedure InternalPurgeTasks(Res: TVpResource); override;
procedure LoadContact(AContact: TVpContact); virtual; procedure LoadContact(AContact: TVpContact); virtual;
procedure LoadTask(ATask: TVpTask); virtual; procedure LoadTask(ATask: TVpTask); virtual;
procedure SetFilterCriteria(ATable: TDataset; AUseDateTime: Boolean; procedure SetFilterCriteria(ATable: TDataset; AUseDateTime: Boolean;
@ -96,9 +100,6 @@ type
procedure PostResources; override; procedure PostResources; override;
procedure PurgeResource(Res: TVpResource); override; procedure PurgeResource(Res: TVpResource); override;
procedure PurgeEvents(Res: TVpResource); override;
procedure PurgeContacts(Res: TVpResource); override;
procedure PurgeTasks(Res: TVpResource); override;
procedure SetResourceByName(Value: string); override; procedure SetResourceByName(Value: string); override;
procedure CreateFieldDefs(const TableName: string; FieldDefs: TFieldDefs); virtual; procedure CreateFieldDefs(const TableName: string; FieldDefs: TFieldDefs); virtual;
@ -1879,7 +1880,6 @@ begin
end; end;
end; end;
{ - Added}
procedure TVpCustomDBDataStore.PurgeResource(Res: TVpResource); procedure TVpCustomDBDataStore.PurgeResource(Res: TVpResource);
begin begin
Res.Deleted := true; Res.Deleted := true;
@ -1887,27 +1887,64 @@ begin
Load; Load;
end; end;
procedure TVpCustomDBDataStore.PurgeEvents(Res: TVpResource); { Deletes all events from the database which are assigned to the specified
resource. Does this by iterating over the dataset.
Override if the descendant class provides a more efficient method. }
procedure TVpCustomDBDataStore.InternalPurgeEvents(Res: TVpResource);
var
resIDField: TField;
begin begin
{ Purging the events from the database is done by the descendant !!.01} Assert(Res <> nil);
{ classes !!.01}
inherited; EventsTable.Open;
EventsTable.First;
resIDField := EventsTable.FieldByName('ResourceID');
while not EventsTable.EOF do
begin
if resIDField.AsInteger = Res.ResourceID then
EventsTable.Delete
else
EventsTable.Next;
end;
end; end;
procedure TVpCustomDBDataStore.PurgeContacts(Res: TVpResource); { Deletes all contacts from the database which are assigned to the specified
resource. Does this by iterating over the dataset. Override if the descendant
class provides a more efficient method. }
procedure TVpCustomDBDataStore.InternalPurgeContacts(Res: TVpResource);
var
resIDField: TField;
begin begin
{ Purging the contacts from the database is done by the descendant !!.01} ContactsTable.Open;
{ classes !!.01} ContactsTable.First;
inherited; resIDField := ContactsTable.FieldByName('ResourceID');
while not ContactsTable.EOF do
begin
if resIDField.AsInteger = Res.ResourceID then
ContactsTable.Delete
else
ContactsTable.Next;
end;
end; end;
procedure TVpCustomDBDataStore.PurgeTasks(Res: TVpResource); { Deletes all tasks from the database which are assigned to the specified
resource. Does this by iterating over the dataset. Override if the descendant
class provides a more efficient method. }
procedure TVpCustomDBDataStore.InternalPurgeTasks(Res: TVpResource);
var
resIDField: TField;
begin begin
{ Purging the tasks from the database is done by the descendant !!.01} TasksTable.Open;
{ classes !!.01} TasksTable.First;
inherited; resIDField := TasksTable.FieldByName('ResourceID');
while not TasksTable.EOF do
begin
if resIDField.AsInteger = Res.ResourceID then
TasksTable.Delete
else
TasksTable.Next;
end;
end; end;
{ - End}
procedure TVpCustomDBDataStore.SetResourceByName(Value: string); procedure TVpCustomDBDataStore.SetResourceByName(Value: string);
var var

View File

@ -8,7 +8,7 @@ interface
uses uses
SysUtils, Classes, DB, IBConnection, sqldb, SysUtils, Classes, DB, IBConnection, sqldb,
VpBaseDS, VpDBDS; VpBaseDS, VpData, VpDBDS;
type type
TVpFirebirdDatastore = class(TVpCustomDBDatastore) TVpFirebirdDatastore = class(TVpCustomDBDatastore)
@ -28,6 +28,9 @@ type
function GetEventsTable: TDataset; override; function GetEventsTable: TDataset; override;
function GetResourceTable: TDataset; override; function GetResourceTable: TDataset; override;
function GetTasksTable: TDataset; override; function GetTasksTable: TDataset; override;
procedure InternalPurgeContacts(Res: TVpResource); override;
procedure InternalPurgeEvents(Res: TVpResource); override;
procedure InternalPurgeTasks(Res: TVpResource); override;
procedure Loaded; override; procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure OpenTables; procedure OpenTables;
@ -576,6 +579,33 @@ begin
FTasksTable.Refresh; FTasksTable.Refresh;
end; end;
{ Removes all contacts of the specified resource from the database. }
procedure TVpFirebirdDataStore.InternalPurgeContacts(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Contacts WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
{ Removes all events of the specified resource from the database. }
procedure TVpFirebirdDatastore.InternalPurgeEvents(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Events WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
{ Removes all tasks of the specified resource from the database. }
procedure TVpFirebirdDatastore.InternalPurgeTasks(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Tasks WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
procedure TVpFirebirdDatastore.SetConnected(const AValue: Boolean); procedure TVpFirebirdDatastore.SetConnected(const AValue: Boolean);
begin begin
if (AValue = Connected) or (FConnection = nil) or (FConnectLock > 0) then if (AValue = Connected) or (FConnection = nil) or (FConnectLock > 0) then

View File

@ -157,10 +157,6 @@ type
procedure PostContacts; override; procedure PostContacts; override;
procedure PostTasks; override; procedure PostTasks; override;
procedure PostResources; override; procedure PostResources; override;
procedure PurgeResource(Res: TVpResource); override;
procedure PurgeEvents(Res: TVpResource); override;
procedure PurgeContacts(Res: TVpResource); override;
procedure PurgeTasks(Res: TVpResource); override;
function GetFieldName(Mappings: TCollection; VPField: string): string; function GetFieldName(Mappings: TCollection; VPField: string): string;
function GetNextID(TableName: string): Integer; override; function GetNextID(TableName: string): Integer; override;
@ -208,6 +204,7 @@ uses
{*****************************************************************************} {*****************************************************************************}
{ TVpFieldMapping } { TVpFieldMapping }
(*****************************************************************************)
procedure TVpFieldMapping.Assign(Source: TPersistent); procedure TVpFieldMapping.Assign(Source: TPersistent);
begin begin
@ -220,6 +217,7 @@ end;
(*****************************************************************************) (*****************************************************************************)
{ TVpFlexDataStore } { TVpFlexDataStore }
(*****************************************************************************)
constructor TVpFlexDataStore.Create(AOwner: TComponent); constructor TVpFlexDataStore.Create(AOwner: TComponent);
begin begin
@ -232,7 +230,6 @@ begin
FConnected := false; FConnected := false;
FResourceID := 0; FResourceID := 0;
end; end;
{=====}
destructor TVpFlexDataStore.Destroy; destructor TVpFlexDataStore.Destroy;
begin begin
@ -243,7 +240,6 @@ begin
FDataSources.Free; FDataSources.Free;
inherited; inherited;
end; end;
{=====}
function TVpFlexDataStore.GetConnected: Boolean; function TVpFlexDataStore.GetConnected: Boolean;
var var
@ -263,7 +259,6 @@ begin
Result := AllAssigned and AllActive; Result := AllAssigned and AllActive;
end; end;
{=====}
function TVpFlexDataStore.GetResourceTable : TDataset; function TVpFlexDataStore.GetResourceTable : TDataset;
begin begin
@ -271,7 +266,6 @@ begin
if (FResourceDataSrc <> nil) and (FResourceDataSrc.DataSet <> nil) then if (FResourceDataSrc <> nil) and (FResourceDataSrc.DataSet <> nil) then
Result := FResourceDataSrc.DataSet; Result := FResourceDataSrc.DataSet;
end; end;
{=====}
function TVpFlexDataStore.GetEventsTable : TDataset; function TVpFlexDataStore.GetEventsTable : TDataset;
begin begin
@ -279,7 +273,6 @@ begin
if (FEventsDataSrc <> nil) and (FEventsDataSrc.DataSet <> nil) then if (FEventsDataSrc <> nil) and (FEventsDataSrc.DataSet <> nil) then
Result := FEventsDataSrc.DataSet; Result := FEventsDataSrc.DataSet;
end; end;
{=====}
function TVpFlexDataStore.GetContactsTable : TDataset; function TVpFlexDataStore.GetContactsTable : TDataset;
begin begin
@ -287,7 +280,6 @@ begin
if (FContactsDataSrc <> nil) and (FContactsDataSrc.DataSet <> nil) then if (FContactsDataSrc <> nil) and (FContactsDataSrc.DataSet <> nil) then
Result := FContactsDataSrc.DataSet; Result := FContactsDataSrc.DataSet;
end; end;
{=====}
function TVpFlexDataStore.GetTasksTable : TDataset; function TVpFlexDataStore.GetTasksTable : TDataset;
begin begin
@ -295,7 +287,6 @@ begin
if (FTasksDataSrc <> nil) and (FTasksDataSrc.DataSet <> nil) then if (FTasksDataSrc <> nil) and (FTasksDataSrc.DataSet <> nil) then
Result := FTasksDataSrc.DataSet; Result := FTasksDataSrc.DataSet;
end; end;
{=====}
procedure TVpFlexDataStore.SetConnected(const Value: boolean); procedure TVpFlexDataStore.SetConnected(const Value: boolean);
var var
@ -435,7 +426,6 @@ begin
inherited; inherited;
end; end;
{=====}
procedure TVpFlexDataStore.Load; procedure TVpFlexDataStore.Load;
var var
@ -539,7 +529,6 @@ begin
end; end;
NotifyDependents; NotifyDependents;
end; end;
{=====}
procedure TVpFlexDataStore.LoadEventsOfResource(AResID: Integer); procedure TVpFlexDataStore.LoadEventsOfResource(AResID: Integer);
var var
@ -685,7 +674,8 @@ begin
end; {with FEventsDataSrc.Dataset} end; {with FEventsDataSrc.Dataset}
end; {if resource <> nil} end; {if resource <> nil}
end; end;
(*
(*
procedure TVpFlexDataStore.LoadEvents; procedure TVpFlexDataStore.LoadEvents;
var var
Event: TVpEvent; Event: TVpEvent;
@ -828,7 +818,6 @@ begin
end; {with FEventsDataSrc.Dataset} end; {with FEventsDataSrc.Dataset}
end; {if resource <> nil} end; {if resource <> nil}
end;*) end;*)
{=====}
{ Loads the contact from the current cursor position of the contacts table } { Loads the contact from the current cursor position of the contacts table }
procedure TVpFlexDatastore.LoadContact(AContact: TVpContact); procedure TVpFlexDatastore.LoadContact(AContact: TVpContact);
@ -1306,8 +1295,8 @@ begin
end; {with ContactsTable} end; {with ContactsTable}
end; {if Resource <> nil} end; {if Resource <> nil}
end; end;
{=====}
*) *)
procedure TVpFlexDataStore.LoadTasks; procedure TVpFlexDataStore.LoadTasks;
var var
Task: TVpTask; Task: TVpTask;
@ -1410,7 +1399,6 @@ begin
end; end;
end; end;
end; end;
{=====}
procedure TVpFlexDataStore.RefreshResource; procedure TVpFlexDataStore.RefreshResource;
var var
@ -1502,8 +1490,8 @@ begin
if not Loading then if not Loading then
NotifyDependents; NotifyDependents;
end; end;
{=====}
(* (*
procedure TVpFlexDataStore.RefreshEvents; procedure TVpFlexDataStore.RefreshEvents;
begin begin
if Resource <> nil then begin if Resource <> nil then begin
@ -1535,8 +1523,8 @@ begin
if not Loading then if not Loading then
NotifyDependents; NotifyDependents;
end; end;
{=====}
*) *)
procedure TVpFlexDataStore.PostEvents; procedure TVpFlexDataStore.PostEvents;
var var
J: Integer; J: Integer;
@ -1738,7 +1726,6 @@ begin
if not Loading then if not Loading then
NotifyDependents; NotifyDependents;
end; end;
{=====}
procedure TVpFlexDataStore.PostContacts; procedure TVpFlexDataStore.PostContacts;
var var
@ -2055,7 +2042,6 @@ begin
Resource.Contacts.Sort; Resource.Contacts.Sort;
end; end;
end; end;
{=====}
procedure TVpFlexDataStore.PostTasks; procedure TVpFlexDataStore.PostTasks;
var var
@ -2215,9 +2201,7 @@ begin
Resource.Tasks.Sort; Resource.Tasks.Sort;
end; end;
end; end;
{=====}
{ - New}
procedure TVpFlexDataStore.PostResources; procedure TVpFlexDataStore.PostResources;
var var
I: Integer; I: Integer;
@ -2348,52 +2332,6 @@ begin
Loading := false; Loading := false;
end; end;
end; end;
{=====}
{ - New}
procedure TVpFlexDataStore.PurgeResource(Res: TVpResource);
begin
Res.Deleted := true;
PostResources;
Load;
end;
{=====}
{ - New}
procedure TVpFlexDataStore.PurgeEvents(Res: TVpResource);
var
I: integer;
begin
for I := 0 to pred(Res.Schedule.EventCount) do
TVpEvent(Res.Schedule.GetEvent(I)).Deleted := true;
PostEvents;
Res.Schedule.ClearEvents;
end;
{=====}
{ - New}
procedure TVpFlexDataStore.PurgeContacts(Res: TVpResource);
var
I: integer;
begin
for I := 0 to pred(Res.Contacts.Count) do
TVpContact(Res.Contacts.GetContact(I)).Deleted := true;
PostContacts;
Res.Contacts.ClearContacts;
end;
{=====}
{ - New}
procedure TVpFlexDataStore.PurgeTasks(Res: TVpResource);
var
I: integer;
begin
for I := 0 to pred(Res.Tasks.Count) do
TVpTask(Res.Tasks.GetTask(I)).Deleted := true;
PostTasks;
Res.Tasks.ClearTasks;
end;
{=====}
procedure TVpFlexDataStore.SetResourceDataSrc(Value: TDataSource); procedure TVpFlexDataStore.SetResourceDataSrc(Value: TDataSource);
begin begin
@ -2403,7 +2341,6 @@ begin
Load; Load;
end; end;
end; end;
{=====}
procedure TVpFlexDataStore.SetEventsDataSrc(Value: TDataSource); procedure TVpFlexDataStore.SetEventsDataSrc(Value: TDataSource);
begin begin
@ -2413,7 +2350,6 @@ begin
Load; Load;
end; end;
end; end;
{=====}
procedure TVpFlexDataStore.SetContactsDataSrc(Value: TDataSource); procedure TVpFlexDataStore.SetContactsDataSrc(Value: TDataSource);
begin begin
@ -2423,7 +2359,6 @@ begin
Load; Load;
end; end;
end; end;
{=====}
procedure TVpFlexDataStore.SetTasksDataSrc(Value: TDataSource); procedure TVpFlexDataStore.SetTasksDataSrc(Value: TDataSource);
begin begin
@ -2433,7 +2368,6 @@ begin
Load; Load;
end; end;
end; end;
{=====}
{ - New Field Mapping Streamers} { - New Field Mapping Streamers}
procedure TVpFlexDataStore.DefineProperties(Filer: TFiler); procedure TVpFlexDataStore.DefineProperties(Filer: TFiler);
@ -2448,7 +2382,6 @@ begin
Filer.DefineProperty('TaskFieldMappings', LoadTaskMapping, Filer.DefineProperty('TaskFieldMappings', LoadTaskMapping,
StoreTaskMapping, FTaskMappings.Count > 0); StoreTaskMapping, FTaskMappings.Count > 0);
end; end;
{=====}
procedure TVpFlexDataStore.LoadResMapping(Reader: TReader); procedure TVpFlexDataStore.LoadResMapping(Reader: TReader);
var var
@ -2463,7 +2396,6 @@ begin
end; end;
Reader.ReadListEnd; Reader.ReadListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.StoreResMapping(Writer: TWriter); procedure TVpFlexDataStore.StoreResMapping(Writer: TWriter);
var var
@ -2478,7 +2410,6 @@ begin
end; end;
Writer.WriteListEnd; Writer.WriteListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.LoadEventMapping(Reader: TReader); procedure TVpFlexDataStore.LoadEventMapping(Reader: TReader);
var var
@ -2493,7 +2424,6 @@ begin
end; end;
Reader.ReadListEnd; Reader.ReadListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.StoreEventMapping(Writer: TWriter); procedure TVpFlexDataStore.StoreEventMapping(Writer: TWriter);
var var
@ -2508,7 +2438,6 @@ begin
end; end;
Writer.WriteListEnd; Writer.WriteListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.LoadContactMapping(Reader: TReader); procedure TVpFlexDataStore.LoadContactMapping(Reader: TReader);
var var
@ -2523,7 +2452,6 @@ begin
end; end;
Reader.ReadListEnd; Reader.ReadListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.StoreContactMapping(Writer: TWriter); procedure TVpFlexDataStore.StoreContactMapping(Writer: TWriter);
var var
@ -2538,7 +2466,6 @@ begin
end; end;
Writer.WriteListEnd; Writer.WriteListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.LoadTaskMapping(Reader: TReader); procedure TVpFlexDataStore.LoadTaskMapping(Reader: TReader);
var var
@ -2553,7 +2480,6 @@ begin
end; end;
Reader.ReadListEnd; Reader.ReadListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.StoreTaskMapping(Writer: TWriter); procedure TVpFlexDataStore.StoreTaskMapping(Writer: TWriter);
var var
@ -2568,7 +2494,6 @@ begin
end; end;
Writer.WriteListEnd; Writer.WriteListEnd;
end; end;
{=====}
procedure TVpFlexDataStore.Loaded; procedure TVpFlexDataStore.Loaded;
begin begin
@ -2576,7 +2501,6 @@ begin
if not (csDesigning in ComponentState) then if not (csDesigning in ComponentState) then
Connected := AutoConnect; Connected := AutoConnect;
end; end;
{=====}
function TVpFlexDataStore.GetNextID(TableName: string): Integer; function TVpFlexDataStore.GetNextID(TableName: string): Integer;
begin begin
@ -2654,7 +2578,6 @@ begin
then then
Result := ''; Result := '';
end; end;
{=====}
procedure TVpFlexDataStore.SetFilterCriteria(ATable: TDataset; AUseDateTime: Boolean; procedure TVpFlexDataStore.SetFilterCriteria(ATable: TDataset; AUseDateTime: Boolean;
AResourceID: Integer; AStartDateTime, aEndDateTime: TDateTime); AResourceID: Integer; AStartDateTime, aEndDateTime: TDateTime);
@ -2665,7 +2588,7 @@ begin
else else
inherited; inherited;
end; end;
{=====}
{ TVpDataSources } { TVpDataSources }
@ -2673,55 +2596,46 @@ constructor TVpDataSources.Create(Owner: TVpFlexDataStore);
begin begin
FOwner := Owner; FOwner := Owner;
end; end;
{=====}
function TVpDataSources.GetContactsDataSrc: TDataSource; function TVpDataSources.GetContactsDataSrc: TDataSource;
begin begin
result := FOwner.ContactsDataSource; result := FOwner.ContactsDataSource;
end; end;
{=====}
function TVpDataSources.GetEventsDataSrc: TDataSource; function TVpDataSources.GetEventsDataSrc: TDataSource;
begin begin
result := FOwner.EventsDataSource; result := FOwner.EventsDataSource;
end; end;
{=====}
function TVpDataSources.GetResourceDataSrc: TDataSource; function TVpDataSources.GetResourceDataSrc: TDataSource;
begin begin
result := FOwner.ResourceDataSource; result := FOwner.ResourceDataSource;
end; end;
{=====}
function TVpDataSources.GetTasksDataSrc: TDataSource; function TVpDataSources.GetTasksDataSrc: TDataSource;
begin begin
result := FOwner.TasksDataSource; result := FOwner.TasksDataSource;
end; end;
{=====}
procedure TVpDataSources.SetContactsDataSrc(const Value: TDataSource); procedure TVpDataSources.SetContactsDataSrc(const Value: TDataSource);
begin begin
FOwner.ContactsDataSource := Value; FOwner.ContactsDataSource := Value;
end; end;
{=====}
procedure TVpDataSources.SetEventsDataSrc(const Value: TDataSource); procedure TVpDataSources.SetEventsDataSrc(const Value: TDataSource);
begin begin
FOwner.EventsDataSource := Value; FOwner.EventsDataSource := Value;
end; end;
{=====}
procedure TVpDataSources.SetResourceDataSrc(const Value: TDataSource); procedure TVpDataSources.SetResourceDataSrc(const Value: TDataSource);
begin begin
FOwner.ResourceDataSource := Value; FOwner.ResourceDataSource := Value;
end; end;
{=====}
procedure TVpDataSources.SetTasksDataSrc(const Value: TDataSource); procedure TVpDataSources.SetTasksDataSrc(const Value: TDataSource);
begin begin
FOwner.TasksDataSource := Value; FOwner.TasksDataSource := Value;
end; end;
{=====}
end. end.

View File

@ -6,7 +6,7 @@ interface
uses uses
SysUtils, Classes, DB, sqlite3conn, sqldb, SysUtils, Classes, DB, sqlite3conn, sqldb,
VpBaseDS, VpDBDS; VpData, VpBaseDS, VpDBDS;
type type
@ -27,6 +27,9 @@ type
function GetEventsTable: TDataset; override; function GetEventsTable: TDataset; override;
function GetResourceTable: TDataset; override; function GetResourceTable: TDataset; override;
function GetTasksTable: TDataset; override; function GetTasksTable: TDataset; override;
procedure InternalPurgeContacts(Res: TVpResource); override;
procedure InternalPurgeEvents(Res: TVpResource); override;
procedure InternalPurgeTasks(Res: TVpResource); override;
procedure Loaded; override; procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure OpenTables; procedure OpenTables;
@ -516,6 +519,33 @@ begin
Result := FTasksTable; Result := FTasksTable;
end; end;
{ Removes all contacts of the specified resource from the database. }
procedure TVpSqlite3DataStore.InternalPurgeContacts(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Contacts WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
{ Removes all events of the specified resource from the database. }
procedure TVpSqlite3Datastore.InternalPurgeEvents(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Events WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
{ Removes all tasks of the specified resource from the database. }
procedure TVpSqlite3Datastore.InternalPurgeTasks(Res: TVpResource);
var
sql: String;
begin
sql := Format('DELETE FROM Tasks WHERE ResourceID = %d', [Res.ResourceID]);
FConnection.ExecuteDirect(sql);
end;
procedure TVpSqlite3Datastore.Loaded; procedure TVpSqlite3Datastore.Loaded;
begin begin
inherited; inherited;