/
UnitProtect.pas
67 lines (57 loc) · 1.47 KB
/
UnitProtect.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
unit UnitProtect;
interface
uses
SysUtils, Classes, BoldSubscription, BoldHandles, BoldRootedHandles,
BoldExpressionHandle;
type
TProtectDM = class(TDataModule)
behACount: TBoldExpressionHandle;
behSectCount: TBoldExpressionHandle;
private
{ Private declarations }
public
{ Public declarations }
function GetDisableDEMO: Boolean;
function CheckProtect: Boolean;
end;
var
ProtectDM: TProtectDM;
DEMOCaption: string='Äåìî âåðñèÿ - ÷èñëî îáúÿâëåíèé îãðàíè÷åíî äî 50! ×èñëî ðàçäåëîâ äî 20 - òè! Ëèáî ñðàáîòàëî âðåìåííîå îãðàíè÷åíèå!';
EnableProtect: Boolean=False;
EnableDatesProtect: Boolean=False;
StartProtectDate: string='03.06.2006';
EndProtectDate: string='07.06.2006';
implementation
{$R *.dfm}
uses ModelDM, DateUtils, Dialogs;
function TProtectDM.GetDisableDEMO: Boolean;
var res: Boolean;
begin
res:=False;
if EnableProtect then
begin
if (((Today>StrToDate(EndProtectDate)) or (Today<StrToDate(StartProtectDate))) and EnableDatesProtect)
or (Integer(behACount.Value.GetAsVariant)>50)
or (Integer(behSectCount.Value.GetAsVariant)>20)
then
begin
res:=True;
end;
end;
Result:=
res;
end;
function TProtectDM.CheckProtect: Boolean;
var res: Boolean;
begin
res:=False;
if ModelDM.BoldModelDM.bsh.Active then
if GetDisableDEMO then
begin
res:=True;
ShowMessage('Ñðîê ðàáîòû DEMO-âåðñèè èñò¸ê!'+DEMOCaption);
end;
Result:=
res;
end;
end.