text stringlengths 14 6.51M |
|---|
unit uFrmWMPG;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uMainFormIntf, uFactoryFormIntf, StdCtrls, uDBIntf, DB, DBClient, Menus, uSysMenu,
ComCtrls, ExtCtrls, cxControls, cxPC, uParamObject, SyncObjs, uFrmNav;
type
TFrmWMPG = class(TForm, IMainForm)
statList: TStatusBar;
imgTop: TImage;
tclFrmList: TcxTabControl;
pnlMDIClient: TPanel;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure tclFrmListCanClose(Sender: TObject; var ACanClose: Boolean);
procedure tclFrmListChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure pnlMDIClientResize(Sender: TObject);
private
{ Private declarations }
FMenuObject: TSysMenu;
FFrmNav: TfrmNav;
//IMainForm
function CreateMenu(const Path: string; MenuClick: TNotifyEvent): TObject;
procedure CloseFom(AFormIntf: IFormIntf; var ACanClose: Boolean);
procedure CallFormClass(AFromNo: Integer; AParam: TParamObject); //打开窗体
function GetMDIShowClient: TWinControl;
procedure SetWindowState(AWindowState: TWindowState);
procedure OnShowMDI(Sender: TObject; ACaption: string; AFormIntf: IFormIntf);
public
{ Public declarations }
end;
var
FrmWMPG: TFrmWMPG;
implementation
uses uSysSvc, uFactoryIntf, uOtherIntf, uTestdllInf, uDefCom;
{$R *.dfm}
{ TFrmWMPG }
function TFrmWMPG.CreateMenu(const Path: string;
MenuClick: TNotifyEvent): TObject;
begin
end;
procedure TFrmWMPG.CloseFom(AFormIntf: IFormIntf; var ACanClose: Boolean);
var
aIndex: Integer;
aMsgBox: IMsgBox;
begin
for aIndex := 1 to tclFrmList.Tabs.Count - 1 do
begin
if TFrmObj(tclFrmList.Tabs.Objects[aIndex]).FrmMDI = AFormIntf then
begin
tclFrmList.Tabs.BeginUpdate;
try
TFrmObj(tclFrmList.Tabs.Objects[aIndex]).Free;
tclFrmList.Tabs.Objects[aIndex] := nil;
tclFrmList.Tabs.Delete(aIndex);
ACanClose := True;
finally
tclFrmList.Tabs.EndUpdate;
tclFrmListChange(tclFrmList)
end;
Break;
end;
end;
end;
procedure TFrmWMPG.FormCreate(Sender: TObject);
var
aRegInf: IRegInf;
begin
{加载菜单}
FMenuObject := TSysMenu.Create(Self, Self);
FMenuObject.OnShowMDI := OnShowMDI;
Self.Menu := FMenuObject.GetMainMenu;
aRegInf := SysService as IRegInf;
aRegInf.RegObjFactory(IMainForm, Self);
end;
procedure TFrmWMPG.FormShow(Sender: TObject);
begin
FFrmNav := TfrmNav.Create(nil);
FFrmNav.Parent := Self;
FFrmNav.Show;
pnlMDIClient.Visible := False;
statList.Panels[0].Text := OperatorID;
// OperatorID := '00000';
end;
procedure TFrmWMPG.FormDestroy(Sender: TObject);
begin
FFrmNav.Free;
FMenuObject.Free;
end;
procedure TFrmWMPG.OnShowMDI(Sender: TObject; ACaption: string; AFormIntf: IFormIntf);
var
aFrmObj: TFrmObj;
aIndex: Integer;
begin
aFrmObj := TFrmObj.Create(AFormIntf);
aIndex := tclFrmList.Tabs.AddObject(ACaption, aFrmObj);
tclFrmList.TabIndex := aIndex;
end;
procedure TFrmWMPG.tclFrmListCanClose(Sender: TObject;
var ACanClose: Boolean);
var
aIndex: Integer;
aMsgBox: IMsgBox;
begin
aIndex := tclFrmList.TabIndex;
if aIndex > 0 then
begin
TFrmObj(tclFrmList.Tabs.Objects[aIndex]).FrmMDI.FrmClose;
// TFrmObj(tclFrmList.Tabs.Objects[aIndex]).Free;
ACanClose := False;
end
else
begin
aMsgBox := SysService as IMsgBox;
aMsgBox.MsgBox('导航图页面不能关闭!');
ACanClose := False;
end;
end;
procedure TFrmWMPG.tclFrmListChange(Sender: TObject);
var
aIndex: Integer;
aFrmObj: TFrmObj;
begin
aIndex := tclFrmList.TabIndex;
if aIndex > 0 then
begin
aFrmObj := TFrmObj(tclFrmList.Tabs.Objects[aIndex]);
pnlMDIClient.Visible := True;
FFrmNav.Visible := False;
// Perform(WM_SETREDRAW, 0, 0); //锁屏幕, 防止在切换MDI窗体的时候闪烁
// try
aFrmObj.FrmMDI.FrmShow;
// finally
// Perform(WM_SETREDRAW, 1, 0); //解锁屏幕并重画
// RedrawWindow(Handle, nil, 0, RDW_FRAME + RDW_INVALIDATE + RDW_ALLCHILDREN + RDW_NOINTERNALPAINT);//重绘客户区
// end;
end
else
begin
pnlMDIClient.Visible := False;
FFrmNav.Visible := True;
end;
end;
procedure TFrmWMPG.CallFormClass(AFromNo: Integer; AParam: TParamObject);
begin
FMenuObject.CallFormClass(AFromNo, AParam);
end;
function TFrmWMPG.GetMDIShowClient: TWinControl;
begin
Result := pnlMDIClient;
end;
procedure TFrmWMPG.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
i: Integer;
begin
CanClose := False;
while tclFrmList.Tabs.Count > 1 do
begin
TFrmObj(tclFrmList.Tabs.Objects[1]).FrmMDI.FrmClose();
end;
CanClose := True;
end;
procedure TFrmWMPG.SetWindowState(AWindowState: TWindowState);
begin
WindowState := AWindowState;
end;
procedure TFrmWMPG.pnlMDIClientResize(Sender: TObject);
var
aIndex: Integer;
aMsgBox: IMsgBox;
begin
// aIndex := tclFrmList.TabIndex;
if Assigned(tclFrmList) then
begin
for aIndex := 1 to tclFrmList.Tabs.Count - 1 do
begin
TFrmObj(tclFrmList.Tabs.Objects[aIndex]).FrmMDI.ResizeFrm(pnlMDIClient);
end;
end;
if Assigned(FFrmNav) then
begin
FFrmNav.Width := pnlMDIClient.Width;
FFrmNav.Height := pnlMDIClient.Height;
end;
end;
end.
|
unit UDMargins;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls, UCrpe32;
type
TCrpeMarginsDlg = class(TForm)
pnlMargins: TPanel;
rgMarginScale: TRadioGroup;
pnlMargins2: TPanel;
editTop: TEdit;
editLeft: TEdit;
editRight: TEdit;
editBottom: TEdit;
btnOk: TButton;
btnCancel: TButton;
btnClear: TButton;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnClearClick(Sender: TObject);
procedure rgMarginScaleClick(Sender: TObject);
procedure editTopChange(Sender: TObject);
procedure editRightChange(Sender: TObject);
procedure editLeftChange(Sender: TObject);
procedure editBottomChange(Sender: TObject);
procedure editMarginsKeyPress(Sender: TObject; var Key: Char);
procedure btnOkClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure InitializeControls(OnOff: boolean);
procedure UpdateMargins;
private
{ Private declarations }
crTop,
crLeft,
crBottom,
crRight : smallint;
public
{ Public declarations }
Cr : TCrpe;
end;
var
CrpeMarginsDlg : TCrpeMarginsDlg;
bMargins : boolean;
implementation
{$R *.DFM}
uses UCrpeUtl;
{------------------------------------------------------------------------------}
{ FormCreate procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.FormCreate(Sender: TObject);
begin
bMargins := True;
LoadFormPos(Self);
btnOk.Tag := 1;
btnCancel.Tag := 1;
end;
{------------------------------------------------------------------------------}
{ FormShow procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.FormShow(Sender: TObject);
begin
crTop := Cr.Margins.Top;
crBottom := Cr.Margins.Bottom;
crLeft := Cr.Margins.Left;
crRight := Cr.Margins.Right;
UpdateMargins;
end;
{------------------------------------------------------------------------------}
{ UpdateMargins }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.UpdateMargins;
var
OnOff : boolean;
begin
{Enable/Disable controls}
OnOff := not IsStrEmpty(Cr.ReportName);
InitializeControls(OnOff);
{Update components}
if OnOff then
begin
editTop.Text := IntToStr(Cr.Margins.Top);
editLeft.Text := IntToStr(Cr.Margins.Left);
editRight.Text := IntToStr(Cr.Margins.Right);
editBottom.Text := IntToStr(Cr.Margins.Bottom);
pnlMargins2.BevelOuter := bvRaised;
rgMarginScaleClick(Self);
editTop.SetFocus;
editTop.SelectAll;
end;
end;
{------------------------------------------------------------------------------}
{ InitializeControls }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.InitializeControls(OnOff: boolean);
var
i : integer;
begin
{Enable/Disable the Form Controls}
for i := 0 to ComponentCount - 1 do
begin
if TComponent(Components[i]).Tag = 0 then
begin
if Components[i] is TButton then
TButton(Components[i]).Enabled := OnOff;
if Components[i] is TRadioGroup then
TRadioGroup(Components[i]).Enabled := OnOff;
if Components[i] is TEdit then
begin
TEdit(Components[i]).Text := '';
if TEdit(Components[i]).ReadOnly = False then
TEdit(Components[i]).Color := ColorState(OnOff);
TEdit(Components[i]).Enabled := OnOff;
end;
end;
end;
end;
{------------------------------------------------------------------------------}
{ rgMarginScaleClick procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.rgMarginScaleClick(Sender: TObject);
var
sTmp : string;
begin
editTop.OnChange := nil;
editBottom.OnChange := nil;
editRight.OnChange := nil;
editLeft.OnChange := nil;
{Scale set to Inches}
if rgMarginScale.ItemIndex = 0 then
begin
Str((Cr.Margins.Top / 1440):0:2, sTmp);
editTop.Text := sTmp;
Str((Cr.Margins.Left / 1440):0:2, sTmp);
editLeft.Text := sTmp;
Str((Cr.Margins.Right / 1440):0:2, sTmp);
editRight.Text := sTmp;
Str((Cr.Margins.Bottom / 1440):0:2, sTmp);
editBottom.Text := sTmp;
end
{Scale set to Twips}
else
begin
editTop.Text := IntToStr(Cr.Margins.Top);
editLeft.Text := IntToStr(Cr.Margins.Left);
editRight.Text := IntToStr(Cr.Margins.Right);
editBottom.Text := IntToStr(Cr.Margins.Bottom);
end;
editTop.OnChange := editTopChange;
editBottom.OnChange := editBottomChange;
editRight.OnChange := editRightChange;
editLeft.OnChange := editLeftChange;
end;
{------------------------------------------------------------------------------}
{ editMarginsKeyPress procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.editMarginsKeyPress(Sender: TObject; var Key: Char);
begin
if not (Sender is TEdit) then
Exit;
{Entry in inches}
if rgMarginScale.ItemIndex = 0 then
begin
{Allow numbers or decimals}
if ((Key >= '0') and (Key <= '9')) or (Key = '.') then
begin
if (Key = '.') then
begin
{Allow a dot if all text is selected}
if (Length(TEdit(Sender).Text) = TEdit(Sender).SelLength) then
Exit;
{Do not allow dot if it already exists}
if Pos('.', TEdit(Sender).Text) <> 0 then
begin
Key := Char(0);
Exit;
end;
end;
try
StrToFloat(TEdit(Sender).Text + Key);
except
Application.MessageBox('Value too large!','Entry Error',
MB_APPLMODAL + MB_ICONHAND + MB_OK);
Key := Char(0);
end;
if StrToFloat(TEdit(Sender).Text + Key) > 22.75 then
begin
Application.MessageBox('Value too large!' + Chr(10) +
'Must not be greater than 22.75 inches.','Entry Error',
MB_APPLMODAL + MB_ICONHAND + MB_OK);
Key := Char(0);
end;
end
else if Key <> Char(8) then
Key := Char(0);
end
{Entry in twips}
else
begin
{Allow numbers}
if ((Key >= '0') and (Key <= '9')) then
begin
try
StrToInt(TEdit(Sender).Text + Key);
except
Application.MessageBox('Value too large!','Entry Error',
MB_APPLMODAL + MB_ICONHAND + MB_OK);
Key := Char(0);
end;
if StrToInt(TEdit(Sender).Text + Key) > 32768 then
begin
Application.MessageBox('Value too large!' + Chr(10) +
'Must not be greater than 32768 twips.','Entry Error',
MB_APPLMODAL + MB_ICONHAND + MB_OK);
Key := Char(0);
end;
end
else if Key <> Char(8) then
Key := Char(0);
end;
end;
{------------------------------------------------------------------------------}
{ editTopChange procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.editTopChange(Sender: TObject);
begin
if Length(editTop.Text) <> 0 then
begin
case rgMarginScale.ItemIndex of
{Inches}
0: Cr.Margins.Top := Round(StrToFloat(editTop.Text) * 1440);
{Twips}
1: Cr.Margins.Top := StrToInt(editTop.Text);
end;
end
else
Cr.Margins.Top := 0;
end;
{------------------------------------------------------------------------------}
{ editLeftChange procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.editLeftChange(Sender: TObject);
begin
if Length(editLeft.Text) <> 0 then
begin
case rgMarginScale.ItemIndex of
{Inches}
0: Cr.Margins.Left := Round(StrToFloat(editLeft.Text) * 1440);
{Twips}
1: Cr.Margins.Left := StrToInt(editLeft.Text);
end;
end
else
Cr.Margins.Left := 0;
end;
{------------------------------------------------------------------------------}
{ editRightChange procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.editRightChange(Sender: TObject);
begin
if Length(editLeft.Text) <> 0 then
begin
case rgMarginScale.ItemIndex of
{Inches}
0: Cr.Margins.Right := Round(StrToFloat(editRight.Text) * 1440);
{Twips}
1: Cr.Margins.Right := StrToInt(editRight.Text);
end;
end
else
Cr.Margins.Right := 0;
end;
{------------------------------------------------------------------------------}
{ editBottomChange procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.editBottomChange(Sender: TObject);
begin
if Length(editLeft.Text) <> 0 then
begin
case rgMarginScale.ItemIndex of
{Inches}
0: Cr.Margins.Bottom := Round(StrToFloat(editBottom.Text) * 1440);
{Twips}
1: Cr.Margins.Bottom := StrToInt(editBottom.Text);
end;
end
else
Cr.Margins.Bottom := 0;
end;
{------------------------------------------------------------------------------}
{ btnClearClick procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.btnClearClick(Sender: TObject);
begin
Cr.Margins.Clear;
UpdateMargins;
end;
{------------------------------------------------------------------------------}
{ btnOkClick procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.btnOkClick(Sender: TObject);
begin
SaveFormPos(Self);
Close;
end;
{------------------------------------------------------------------------------}
{ btnCancelClick procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.btnCancelClick(Sender: TObject);
begin
Close;
end;
{------------------------------------------------------------------------------}
{ FormClose procedure }
{------------------------------------------------------------------------------}
procedure TCrpeMarginsDlg.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if ModalResult = mrCancel then
begin
Cr.Margins.Top := crTop;
Cr.Margins.Bottom := crBottom;
Cr.Margins.Left := crLeft;
Cr.Margins.Right := crRight;
end;
bMargins := False;
Release;
end;
end.
|
unit WideStringEdit;
interface
function WStrLComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer;
{* Compare two strings (fast). Terminating 0 is not considered, so if
strings are equal, comparing is continued up to MaxLen bytes.
Since this, pass minimum of lengths as MaxLen. }
function WS2Int( S: PWideChar ): Integer;
{* Converts null-terminated string to Integer. Scanning stopped when any
non-digit character found. Even empty string or string not containing
valid integer number silently converted to 0. }
function UTF8ToUCS2(Dest: PWideChar; MaxDestBytes: Cardinal;
Source: PChar; SourceChars: Cardinal): Cardinal;
(* Decode string from UTF8 to UCS2 *)
function UCS2ToUTF8(Dest: PChar; MaxDestBytes: Cardinal;
Source: PWideChar; SourceChars: Cardinal): Cardinal;
(* Decode string from UCS2 to UTF8 *)
implementation
function WStrLComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; assembler;
asm
OR ECX,ECX
JE @@1
PUSH EDI
PUSH ESI
PUSH EBX
MOV EDI,EDX
MOV ESI,EAX
MOV EBX,ECX
XOR EAX,EAX
REPNE SCASW
SUB EBX,ECX
MOV ECX,EBX
MOV EDI,EDX
XOR EDX,EDX
REPE CMPSW
MOV AX,[ESI-2]
MOV DX,[EDI-2]
SUB EAX,EDX
POP EBX
POP ESI
POP EDI
@@1:
end;
function WS2Int( S: PWideChar ): Integer;
//EAX: S
//Result: Integer -> EAX
asm
XCHG EDX, EAX
XOR EAX, EAX
TEST EDX, EDX
JZ @@exit
XOR ECX, ECX
MOV CX, [EDX]
ADD EDX, 2
CMP CX, '-'
PUSHFD
JE @@0
@@1: CMP CX, '+'
JNE @@2
@@0: MOV CX, [EDX]
ADD EDX, 2
@@2: SUB CX, '0'
CMP CX, '9'-'0'
JA @@fin
LEA EAX, [EAX+EAX*4] //
LEA EAX, [ECX+EAX*2] //
JMP @@0
@@fin: POPFD
JNE @@exit
NEG EAX
@@exit:
end;
function UTF8ToUCS2(Dest: PWideChar; MaxDestBytes: Cardinal;
Source: PChar; SourceChars: Cardinal): Cardinal;
//EAX: @Dest
//EDX: MaxDestBytes
//ECX: @Source
//(ESP): SourceChars;
//Result: DestChars of @Dest -> EAX
asm
//backup
PUSHF
CLD //set (ESI)+
PUSH EBX
PUSH ESI
PUSH EDI
PUSH Dest //backup @Dst
MOV EDI, Dest
TEST Source, Source //test NULL string
JZ @Exit
MOV ESI, Source
MOV ECX, SourceChars
@NextChar:
//test length of Dst
SUB EDX, 2
JLE @Exit
//get next char to EAX
XOR EAX, EAX
LODSB //MOV AL, [ESI]+
//test NULL char (end of string)
TEST AL, AL
JZ @Exit
//decode UTF8 to UCS2
@Utf8ToUcs2:
//test first byte UTF8 = 0xxxxxxx
TEST AL, $80
JNZ @1xxxxxxx
//UTF8: 0xxxxxxx (AH = 0)
@SaveU16:
STOSW //MOVW [EDI]+, EAX
@Loop:
LOOP @NextChar
JMP @Exit
@1xxxxxxx:
//test first byte UTF8 = 10xxxxxx
TEST AL, $40 //01000000
JZ @Exit //Error UTF8: 10xxxxxx
//test first byte UTF8 = 1111xxxx
CMP AL, $F0 //11110000
JAE @Exit //Error UTF8 to UCS2: 1111xxxx ( if AL >= $F0)
//test exist second byte UTF8
JECXZ @Exit // DEC ECX; if ECX = 0
//backup first byte UTF8
MOV AH, AL //11xxxxxx
//load second byte UTF8
LODSB //MOV AL, [ESI]+
//test second byte UTF8 = 10xxxxxx
TEST AL, $40 //01000000
JNE @Exit //Error UTF8: 10xxxxxx
//test second byte UTF8 = 110xxxxx
TEST AH, $20 //00100000
JNZ @1110xxxx //third byte UTF8
//UTF8: 110xxxxx 10xxxxxx
//backup first byte UTF8
MOV BL, AH //110xxxxx
//get high byte UCS2
SHR AH, 2 //00110xxx
AND AX, $073F //AH: 00000xxx; AL: 00xxxxxx
//get low byte USC2
SHL BL, 6 //xx000000
OR AL, BL //xxxxxxxx
//AX: 00000xxx:xxxxxxxx
JMP @SaveU16
@1110xxxx:
//test exist third byte UTF8
JeCXZ @Exit // DEC ECX; if ECX = 0
//backup second byte UTF8
MOV BL, AL //10xxxxxx
//load third byte UTF8
LODSB //MOV AL, [ESI]+
//test third byte UTF8 = 10xxxxxx
CMP AL, $C0 //11000000
JAE @Exit //Error UTF8: 11xxxxxx ( if AL >= $C0)
//UTF8: 1110xxxx 10xxxxxx 10xxxxxx
//get bytes UCS2 на: xx00000:0000xxxx
AND BX, $003F //DX := 00000000:00xxxxxx
ROR BX, 2 //BL := 0000xxxx; BH := xx000000
//get low byte UTF8
AND AL, $3F //00xxxxxx
OR AL, BH //xxxxxxxx
//get high byte UCS2
SHL AH, 4 //xxxx0000
OR AH, BL //xxxxxxxx
JMP @SaveU16
@Exit:
XOR EAX, EAX
MOV [EDI],AX //set end-char of Dst
POP EAX //restore @Dst
XCHG EAX, EDI
//get length of Dst to Result
SUB EAX, EDI
SHR EAX, 1
//restore
POP EDI
POP ESI
POP EBX
POPF
end;
function UCS2ToUTF8(Dest: PChar; MaxDestBytes: Cardinal;
Source: PWideChar; SourceChars: Cardinal): Cardinal;
//EAX: @Dest
//EDX: MaxDestBytes
//ECX: @Source
//(ESP): SourceChars;
//Result: DestChars of @Dest -> EAX
asm
//backup
PUSHF
CLD //set (ESI)+
PUSH EBX
PUSH ESI
PUSH EDI
PUSH Dest //backup @Dst
MOV EDI, Dest
TEST Source, Source //test NULL string
JZ @Exit
MOV ESI, Source
MOV ECX, SourceChars
@NextChar:
//test length of Dst
DEC EDX
JLE @Exit
//get next char to EAX
XOR EAX, EAX
LODSW //MOV AX, [ESI]+
//test NULL char (end of string)
TEST EAX, EAX
JZ @Exit
//decode UCS2 to UTF8
@Ucs2ToUtf8:
//test UCS2-char in $0000..$007F
CMP AX, $007F
JA @11xxxxxx //if AX > $7F
//UTF8-char: 0xxxxxxx
//AH = 00000000; AL = 0xxxxxxx
@0xxxxxxx:
//save UTF8-char
STOSB //MOVB [EDI]+, AL
//end Loop
@Loop:
LOOP @NextChar
JMP @Exit
@11xxxxxx:
//test length of Dst
DEC EDX
JLE @Exit
//test UCS2-char in $0080..$07FF
CMP AX, $07FF
JA @1110xxxx //if AX > $07FF
//UTF8-char: 110xxxxx 10xxxxxx
//AH = 00000xxx; AL = xxxxxxxx
//get first byte UTF8-char to AL
ROR AX, 6 //AH = xxxxxx00; AL = 000xxxxx
//get second byte UTF8-char to AH
SHR AH, 2 //AH = 00xxxxxx
OR AX, $80C0 //AH = 10xxxxxx; AL = 110xxxxx
//save UTF8-char
STOSW //MOVW [EDI]+, AX
JMP @Loop
//UTF8-char: 1110xxxx 10xxxxxx 10xxxxxx
@1110xxxx:
//test length of Dst
DEC EDX
JLE @Exit
//save lobyte of UCS2-char
MOV BL, AL
//AH = xxxxxxxx; AL = xxxxxxxx
//get first byte UTF8-char UTF8 to AL
ROL AX, 4 //AL = ????xxxx; AH = xxxxxx??
AND AL, $0F //AL = 0000xxxx
//get second byte UTF8-char to AH
SHR AH, 2 //AH = 00xxxxxx
OR AX, $80E0 //AH = 10xxxxxx; AL = 1110xxxx
//save first bytes UTF8-char
STOSW //MOVW [EDI]+, AX
//get second byte UTF8-char to AL
XCHG EAX, EBX //??xxxxxx
AND AL, $3F //00xxxxxx
OR AL, $80 //10xxxxxx
//save third byte UTF8-char
JMP @0xxxxxxx
@Exit:
MOV BYTE PTR [EDI], $00 //set end-char of Dst
POP EAX //restore @Dst
XCHG EAX, EDI
//get length of Dst to Result
SUB EAX, EDI
//restore
POP EDI
POP ESI
POP EBX
POPF
end;
END//Decode string from UTF8 to UCS2
function UTF8ToUCS2(Dest: PWideChar; MaxDestBytes: Cardinal;
Source: PChar; SourceChars: Cardinal): Cardinal;
//EAX: @Dest
//EDX: MaxDestBytes
//ECX: @Source
//(ESP): SourceChars;
//Result: DestChars of @Dest -> EAX
asm
//backup
PUSHF
CLD //set (ESI)+
PUSH EBX
PUSH ESI
PUSH EDI
PUSH Dest //backup @Dst
MOV EDI, Dest
TEST Source, Source //test NULL string
JZ @Exit
MOV ESI, Source
MOV ECX, SourceChars
@NextChar:
//test length of Dst
SUB EDX, 2
JLE @Exit
//get next char to EAX
XOR EAX, EAX
LODSB //MOV AL, [ESI]+
//test NULL char (end of string)
TEST AL, AL
JZ @Exit
//decode UTF8 to UCS2
@Utf8ToUcs2:
//test first byte UTF8 = 0xxxxxxx
TEST AL, $80
JNZ @1xxxxxxx
//UTF8: 0xxxxxxx (AH = 0)
@SaveU16:
STOSW //MOVW [EDI]+, EAX
@Loop:
LOOP @NextChar
JMP @Exit
@1xxxxxxx:
//test first byte UTF8 = 10xxxxxx
TEST AL, $40 //01000000
JZ @Exit //Error UTF8: 10xxxxxx
//test first byte UTF8 = 1111xxxx
CMP AL, $F0 //11110000
JAE @Exit //Error UTF8 to UCS2: 1111xxxx ( if AL >= $F0)
//test exist second byte UTF8
JECXZ @Exit // DEC ECX; if ECX = 0
//backup first byte UTF8
MOV AH, AL //11xxxxxx
//load second byte UTF8
LODSB //MOV AL, [ESI]+
//test second byte UTF8 = 10xxxxxx
TEST AL, $40 //01000000
JNE @Exit //Error UTF8: 10xxxxxx
//test second byte UTF8 = 110xxxxx
TEST AH, $20 //00100000
JNZ @1110xxxx //third byte UTF8
//UTF8: 110xxxxx 10xxxxxx
//backup first byte UTF8
MOV BL, AH //110xxxxx
//get high byte UCS2
SHR AH, 2 //00110xxx
AND AX, $073F //AH: 00000xxx; AL: 00xxxxxx
//get low byte USC2
SHL BL, 6 //xx000000
OR AL, BL //xxxxxxxx
//AX: 00000xxx:xxxxxxxx
JMP @SaveU16
@1110xxxx:
//test exist third byte UTF8
JeCXZ @Exit // DEC ECX; if ECX = 0
//backup second byte UTF8
MOV BL, AL //10xxxxxx
//load third byte UTF8
LODSB //MOV AL, [ESI]+
//test third byte UTF8 = 10xxxxxx
CMP AL, $C0 //11000000
JAE @Exit //Error UTF8: 11xxxxxx ( if AL >= $C0)
//UTF8: 1110xxxx 10xxxxxx 10xxxxxx
//get bytes UCS2 на: xx00000:0000xxxx
AND BX, $003F //DX := 00000000:00xxxxxx
ROR BX, 2 //BL := 0000xxxx; BH := xx000000
//get low byte UTF8
AND AL, $3F //00xxxxxx
OR AL, BH //xxxxxxxx
//get high byte UCS2
SHL AH, 4 //xxxx0000
OR AH, BL //xxxxxxxx
JMP @SaveU16
@Exit:
XOR EAX, EAX
MOV [EDI],AX //set end-char of Dst
POP EAX //restore @Dst
XCHG EAX, EDI
//get length of Dst to Result
SUB EAX, EDI
SHR EAX, 1
//restore
POP EDI
POP ESI
POP EBX
POPF
end ; //asm
//Decode string from UCS2 to UTF8
function UCS2ToUTF8(Dest: PChar; MaxDestBytes: Cardinal;
Source: PWideChar; SourceChars: Cardinal): Cardinal;
//EAX: @Dest
//EDX: MaxDestBytes
//ECX: @Source
//(ESP): SourceChars;
//Result: DestChars of @Dest -> EAX
asm
//backup
PUSHF
CLD //set (ESI)+
PUSH EBX
PUSH ESI
PUSH EDI
PUSH Dest //backup @Dst
MOV EDI, Dest
TEST Source, Source //test NULL string
JZ @Exit
MOV ESI, Source
MOV ECX, SourceChars
@NextChar:
//test length of Dst
DEC EDX
JLE @Exit
//get next char to EAX
XOR EAX, EAX
LODSW //MOV AX, [ESI]+
//test NULL char (end of string)
TEST EAX, EAX
JZ @Exit
//decode UCS2 to UTF8
@Ucs2ToUtf8:
//test UCS2-char in $0000..$007F
CMP AX, $007F
JA @11xxxxxx //if AX > $7F
//UTF8-char: 0xxxxxxx
//AH = 00000000; AL = 0xxxxxxx
@0xxxxxxx:
//save UTF8-char
STOSB //MOVB [EDI]+, AL
//end Loop
@Loop:
LOOP @NextChar
JMP @Exit
@11xxxxxx:
//test length of Dst
DEC EDX
JLE @Exit
//test UCS2-char in $0080..$07FF
CMP AX, $07FF
JA @1110xxxx //if AX > $07FF
//UTF8-char: 110xxxxx 10xxxxxx
//AH = 00000xxx; AL = xxxxxxxx
//get first byte UTF8-char to AL
ROR AX, 6 //AH = xxxxxx00; AL = 000xxxxx
//get second byte UTF8-char to AH
SHR AH, 2 //AH = 00xxxxxx
OR AX, $80C0 //AH = 10xxxxxx; AL = 110xxxxx
//save UTF8-char
STOSW //MOVW [EDI]+, AX
JMP @Loop
//UTF8-char: 1110xxxx 10xxxxxx 10xxxxxx
@1110xxxx:
//test length of Dst
DEC EDX
JLE @Exit
//save lobyte of UCS2-char
MOV BL, AL
//AH = xxxxxxxx; AL = xxxxxxxx
//get first byte UTF8-char UTF8 to AL
ROL AX, 4 //AL = ????xxxx; AH = xxxxxx??
AND AL, $0F //AL = 0000xxxx
//get second byte UTF8-char to AH
SHR AH, 2 //AH = 00xxxxxx
OR AX, $80E0 //AH = 10xxxxxx; AL = 1110xxxx
//save first bytes UTF8-char
STOSW //MOVW [EDI]+, AX
//get second byte UTF8-char to AL
XCHG EAX, EBX //??xxxxxx
AND AL, $3F //00xxxxxx
OR AL, $80 //10xxxxxx
//save third byte UTF8-char
JMP @0xxxxxxx
@Exit:
MOV BYTE PTR [EDI], $00 //set end-char of Dst
POP EAX //restore @Dst
XCHG EAX, EDI
//get length of Dst to Result
SUB EAX, EDI
//restore
POP EDI
POP ESI
POP EBX
POPF
end;
end. |
unit brPendaftaranU;
interface
uses Dialogs, Classes, brCommonsU, System.SysUtils, System.StrUtils;
type
brPendaftaran = class(bridgeCommon)
private
procedure masukkanGetPendaftaranUrut;
procedure masukkanPostPendaftaran(idxstr : string);
procedure masukkanDelPendaftaran(idxstr : string);
public
bpjs_urut : string;
aScript : TStringList;
function ambilJsonPostPendaftaran(idxstr : string) : string;
function getPendaftaranUrut(noUrut : string; tanggalDaftar : TDate) : Boolean;
function postPendaftaran(idxstr : string) : Boolean;
function delPendaftaran(idxstr, no_kunjungan, no_kartu, tanggal, no_urut, kd_poli : string) : Boolean;
function delPendaftaranX(idxstr : string) : Boolean;
constructor Create;
destructor destroy;
// property Uri : string;
end;
implementation
uses SynCommons, synautil;
{ brPendaftaran }
function brPendaftaran.ambilJsonPostPendaftaran(idxstr : string) : string;
var sql0, sql1 : string;
tglStr : string;
i : Integer;
V1 : Variant;
begin
Result := '';
parameter_bridging('PENDAFTARAN', 'POST');
// DateTimeToString(tglSqlStr, 'YYYY-MM-DD', tgl);
sql0 := 'select * from jkn.pendaftaran_view where idxstr = %s and bpjs_urut is null;';
sql1 := Format(sql0,[QuotedStr(idxstr)]);
// ShowMessage(idxstr);
fdQuery.Close;
fdQuery.SQL.Clear;
fdQuery.SQL.Add(sql1);
fdQuery.Open();
V1 := _Json(FormatJson);
//ShowMessage(FormatJson);
if not fdQuery.IsEmpty then
begin
// ShowMessage('not empty');
DateTimeToString(tglStr, 'DD-MM-YYYY', fdQuery.FieldByName('tanggal').AsDateTime);
bpjs_urut := fdQuery.FieldByName('bpjs_urut').AsString;
V1.kdProviderPeserta := fdQuery.FieldByName('kd_provider').AsString;
V1.tglDaftar := tglStr;
V1.noKartu := fdQuery.FieldByName('no_kartu').AsString;
V1.kdPoli := fdQuery.FieldByName('poli').AsString;
V1.keluhan := fdQuery.FieldByName('keluhan').AsString;
V1.kunjSakit := fdQuery.FieldByName('kunj_sakit').AsBoolean;
V1.sistole := fdQuery.FieldByName('sistole').AsInteger;
V1.diastole := fdQuery.FieldByName('diastole').AsInteger;
V1.beratBadan := fdQuery.FieldByName('berat_badan').AsInteger;
V1.tinggiBadan := fdQuery.FieldByName('tinggi_badan').AsInteger;
V1.respRate := fdQuery.FieldByName('respiratory').AsInteger;
V1.heartRate := fdQuery.FieldByName('heart').AsInteger;
V1.kdTkp := fdQuery.FieldByName('kd_tkp').AsString;
fdQuery.Close;
Result := VariantSaveJSON(V1);
// FileFromString(Result, 'pendaftaran.json');
end else ShowMessage('data kosong');
//ShowMessage(Result);
end;
constructor brPendaftaran.Create;
begin
inherited Create;
aScript := TStringList.Create;
end;
function brPendaftaran.delPendaftaran(idxstr, no_kunjungan, no_kartu, tanggal, no_urut, kd_poli : string): Boolean;
var sql0, sql1 : string;
ts : TMemoryStream;
begin
Result := False;
parameter_bridging('PENDAFTARAN', 'DELETE');
// mencari parameter pendaftaran
Uri := StringReplace( Uri, '{noKartu}', no_kartu, []);
Uri := StringReplace( Uri, '{tglDaftar}', tanggal, []);
Uri := StringReplace(Uri, '{noUrut}', no_urut, []);
Uri := StringReplace(Uri, '{kdPoli}', kd_poli, []);
if ((Length(no_urut) >= 1) and (Length(no_kunjungan) <= 1)) then
begin
Result := httpDelete(Uri);
jejakIdxstr := idxstr;
if Result then masukkanDelPendaftaran(idxstr);
end;
FDConn.Close;
end;
function brPendaftaran.delPendaftaranX(idxstr: string): Boolean;
var sql0, sql1 : string;
ts : TMemoryStream;
tglDaftar : TDateTime;
noKartu, tglStr, noUrut, kdPoli, bpjsKunjungan : string;
begin
Result := False;
parameter_bridging('PENDAFTARAN', 'DELETE');
// mencari parameter pendaftaran
sql0 := 'select no_kartu, tanggal, bpjs_urut, bpjs_kunjungan, poli from jkn.pendaftaran_view where idxstr = %s';
sql1 := Format(sql0, [QuotedStr(idxstr)]);
fdQuery.Close;
fdQuery.Open(sql1);
if not fdQuery.IsEmpty then
begin
noKartu := fdQuery.FieldByName('no_kartu').AsString;
kdPoli := fdQuery.FieldByName('poli').AsString;
tglDaftar := fdQuery.FieldByName('tanggal').AsDateTime;
DateTimeToString(tglStr, 'DD-MM-YYYY', tglDaftar);
noUrut := '';
if not fdQuery.FieldByName('bpjs_urut').IsNull then noUrut := fdQuery.FieldByName('bpjs_urut').AsString;
bpjsKunjungan := '';
if not fdQuery.FieldByName('bpjs_kunjungan').IsNull then bpjsKunjungan := fdQuery.FieldByName('bpjs_kunjungan').AsString;
Uri := StringReplace( Uri, '{noKartu}', noKartu, []);
Uri := StringReplace( Uri, '{tglDaftar}', tglStr, []);
Uri := StringReplace(Uri, '{noUrut}', noUrut, []);
Uri := StringReplace(Uri, '{kdPoli}', kdPoli, []);
if ((Length(noUrut) > 1) and (Length(bpjsKunjungan) <= 1)) then
begin
Result := httpDelete(Uri);
jejakIdxstr := idxstr;
if Result then masukkanDelPendaftaran(idxstr);
end;
end;
fdQuery.Close;
FDConn.Close;
end;
destructor brPendaftaran.destroy;
begin
aScript.Free;
inherited;
end;
function brPendaftaran.getPendaftaranUrut(noUrut: string;
tanggalDaftar: TDate): Boolean;
var sql0, sql1 : string;
tglStr : string;
begin
DateTimeToString(tglStr, 'dd-mm-yyyy', tanggalDaftar);
Result := False;
parameter_bridging('PENDAFTARAN URUT', 'GET');
//ShowMessage(uri);
Uri := StringReplace( Uri, '{noUrut}', noUrut, []);
Uri := StringReplace( Uri, '{tglDaftar}', tglStr, []);
//ShowMessage(uri);
Result:= httpGet(uri);
if Result then masukkanGetPendaftaranUrut;
FDConn.Close;
end;
procedure brPendaftaran.masukkanDelPendaftaran(idxstr : string);
var dataResp, dataList : Variant;
i : Integer;
tSl : TStringList;
sqlDel0, sqlDel1, sql0, sql1 : string;
kdDiag, nmDiag : string;
tglStr : string;
nonSpesialis : Boolean;
noUrut : string;
begin
// ShowMessage('awal masukkan get');
if logRest('DEL', 'PENDAFTARAN', tsResponse.Text) then
begin
tsL := TStringList.Create;
try
dataResp := _jsonFast(tsResponse.Text);
// ShowMessage(tsResponse.Text);
sqlDel0 := 'update simpus.pasien_kunjungan set bpjs_urut = null where idxstr = %s;';
sqlDel1 := Format(sqlDel0, [quotedStr(idxstr)]);
tSl.Add(sqlDel1);
finally
jalankanScript(tSl);
FreeAndNil(tSl);
end;
end;
end;
procedure brPendaftaran.masukkanGetPendaftaranUrut;
var dataResp, dataList : Variant;
i : Integer;
tSl : TStringList;
sqlDel0, sqlDel1, sql0, sql1 : string;
kdDiag, nmDiag : string;
nonSpesialis : Boolean;
begin
// ShowMessage('awal masukkan get');
if logRest('GET', 'PENDAFTARAN URUT', tsResponse.Text) then
begin
sqlDel0 := 'delete from simpus2.m_diagnosis where kd_diag = %s;';
sql0 := 'insert into simpus2.m_diagnosis(kd_diag, nm_diag, non_spesialis) values(%s, %s, %s);';
tsL := TStringList.Create;
try
dataResp := _jsonFast(tsResponse.Text);
// ShowMessage(IntToStr(dataResp.response.list._Count));
for I := 0 to dataResp.response.list._count - 1 do
begin
kdDiag := dataResp.response.list.Value(i).kdDiag;
nmDiag := dataResp.response.list.Value(i).nmDiag;
// ShowMessage('BooltoStr (nonSpesialis, True)');
nonSpesialis := dataResp.response.list.Value(i).nonSpesialis;
sqlDel1 := Format(sqlDel0,[QuotedStr(kdDiag)]);
tSl.Add(sqlDel1);
sql1 := Format(sql0, [QuotedStr(kdDiag), quotedStr(nmDiag), BoolToStr(nonSpesialis, True)]);
tSl.Add(sql1);
// showMessage(sqlDel1);
// showMessage(sql1);
end;
finally
jalankanScript(tSl);
FreeAndNil(tSl);
end;
end;
end;
procedure brPendaftaran.masukkanPostPendaftaran(idxstr : string);
var dataResp, dataList : Variant;
i : Integer;
tSl : TStringList;
sqlDel0, sqlDel1, sql0, sql1 : string;
kdDiag, nmDiag : string;
tglStr : string;
nonSpesialis : Boolean;
noUrut : string;
begin
//FileFromString(tsResponse.Text, 'resp_daftar.txt');
// ShowMessage('awal masukkan post');
if logRest('POST', 'PENDAFTARAN', tsResponse.Text) then
begin
tsL := TStringList.Create;
try
dataResp := _jsonFast(tsResponse.Text);
//ShowMessage(tsResponse.Text);
noUrut := dataResp.response.message;
sqlDel0 := 'update simpus.pasien_kunjungan set bpjs_urut = %s where idxstr = %s;';
sqlDel1 := Format(sqlDel0, [QuotedStr(noUrut), quotedStr(idxstr)]);
tSl.Add(sqlDel1);
finally
jalankanScript(tSl);
FreeAndNil(tSl);
end;
end;
end;
function brPendaftaran.postPendaftaran(idxstr : string): Boolean;
var
mStream : TMemoryStream;
js : string;
begin
delPendaftaranX(idxstr);
mStream := TMemoryStream.Create;
Result := False;
//ShowMessage('awal pendaftaran');
js := ambilJsonPostPendaftaran(idxstr);
//ShowMessage('akhir ambil json pendaftaran');
if Length(bpjs_urut) < 1 then
begin
WriteStrToStream(mStream, js);
FormatJson := js;
//Uri := ReplaceStr(Uri, '{puskesmas}', puskesmas);
//ShowMessage('awal post pendaftaran');
Result:= httpPost(Uri, mStream);
jejakIdxstr := idxstr;
//ShowMessage('setelah post pendaftaran');
end;
mStream.Free;
if Result then masukkanPostPendaftaran(idxstr);
FDConn.Close;
end;
end.
|
// uses RegularExpressions;
function ValidatePhone(const PhoneNumber: string): Boolean;
var
RegEx: TRegEx;
begin
RegEx := TRegex.Create('^(?:(?:\+|00)?(\d)?)?([0-9]{10,12})$');
Result := RegEx.Match(PhoneNumber).Success;
end; |
unit API_DBases;
interface
uses
System.Classes, FireDAC.Stan.Def, FireDAC.Stan.Async, FireDAC.Stan.Intf,
FireDAC.Phys.MSAcc, FireDAC.Phys.MySQL, FireDAC.Phys.Intf, FireDAC.DApt,
FireDAC.UI.Intf, FireDAC.Comp.UI, FireDAC.Comp.Client, FireDAC.ConsoleUI.Wait,
FireDAC.VCLUI.Async, FireDAC.VCLUI.Wait;
type
// базовый класс работы с БД через технологию FireDAC
TDBEngine = class abstract
private
FDConnection: TFDConnection;
// процедура прописи параметров соединения
procedure SetCustomConnectParams; virtual; abstract;
public
// коннект к БД
procedure OpenConnection;
// дисконект от БД
procedure CloseConnection;
// послать SQL запрос на выборку данных
procedure GetData(DataSet: TFDQuery; sql: string); overload;
function GetData(sql: string): TFDQuery; overload;
// запрос выборка, для работы с параметрами
procedure OpenQuery(aDataSet: TFDQuery);
// послать SQL запрос на модификацию данных
procedure SetData(sql: String); overload;
// запрос на модификацию, для работы с параметрами
procedure ExecQuery(aDataSet: TFDQuery);
// сво-во объект подключение
property Connection: TFDConnection read FDConnection;
public
class function StrToSQL(value: string): string;
end;
// работа с БД Access
TAccessEngine = class(TDBEngine)
private
FFileName: String;
procedure SetCustomConnectParams; override;
public
procedure OpenConnection(FileName: String); overload;
end;
// работа с БД MySQL
TMySQLEngine = class(TDBEngine)
private
FConnectParams: TStringList;
procedure SetCustomConnectParams; override;
public
procedure OpenConnection(FileName: String); overload;
function GetLastInsertedId: integer;
end;
TDBEngineClass = class of TDBEngine;
implementation
uses
System.SysUtils, System.RegularExpressions, API_Files;
function TMySQLEngine.GetLastInsertedId: integer;
var
dsQuery: TFDQuery;
begin
result:=0;
dsQuery:=TFDQuery.Create(nil);
try
GetData(dsQuery,'select LAST_INSERT_ID()');
result:=dsQuery.Fields[0].AsInteger;
finally
dsQuery.Free;
end;
end;
procedure TDBEngine.OpenQuery(aDataSet: TFDQuery);
begin
aDataSet.Close;
aDataSet.Connection := Self.Connection;
aDataSet.Open;
aDataSet.FetchAll;
end;
procedure TDBEngine.ExecQuery(aDataSet: TFDQuery);
begin
aDataSet.Close;
aDataSet.Connection := Self.Connection;
aDataSet.ExecSQL;
end;
class function TDBEngine.StrToSQL(value: string): string;
var
tpFloat: Extended;
begin
if StrToDateDef(value, 0) > 0 then // дата
begin
while Pos('.', value) > 0 do
value[Pos('.', value)] := ' ';
result := quotedstr(copy(value, 7, 4) + copy(value, 4, 2) +
copy(value, 1, 2));
Exit;
end;
if TryStrToFloat(value, tpFloat) then // число
begin
if Pos(',', value) > 0 then
value := StringReplace(value, ',', '.', [rfReplaceAll, rfIgnoreCase]);
result := value;
Exit;
end
else // строка
begin
value := Trim(value);
if Length(value) = 0 then
value := 'NULL'
else
value := quotedstr(value);
result := value;
end;
end;
procedure TDBEngine.SetData(sql: string);
var
dsQuery: TFDQuery;
begin
dsQuery := TFDQuery.Create(nil);
try
dsQuery.Connection := Self.Connection;
dsQuery.sql.Text := sql;
dsQuery.ExecSQL;
finally
dsQuery.Free;
end;
end;
procedure TMySQLEngine.OpenConnection(FileName: string);
begin
FConnectParams := TStringList.Create;
try
FConnectParams.Text := TFilesEngine.GetTextFromFile(FileName);
Self.OpenConnection;
finally
FConnectParams.Free;
end;
end;
procedure TMySQLEngine.SetCustomConnectParams;
begin
FDConnection.Params.Values['DriverID'] := 'MySQL';
FDConnection.Params.Values['Server'] := FConnectParams.Values['Host'];
FDConnection.Params.Values['Database'] := FConnectParams.Values['DataBase'];
FDConnection.Params.Values['User_Name'] := FConnectParams.Values['Login'];
FDConnection.Params.Values['Password'] := FConnectParams.Values['Password'];
FDConnection.Params.Values['CharacterSet'] := FConnectParams.Values['CharacterSet'];
end;
function TDBEngine.GetData(sql: string): TFDQuery;
begin
result := TFDQuery.Create(nil);
Self.GetData(result, sql);
end;
procedure TDBEngine.GetData(DataSet: TFDQuery; sql: string);
begin
DataSet.Connection := Self.FDConnection;
DataSet.sql.Text := sql;
DataSet.Open;
DataSet.FetchAll;
end;
procedure TDBEngine.CloseConnection;
begin
FDConnection.Connected := False;
FDConnection.Free;
end;
procedure TDBEngine.OpenConnection;
begin
FDConnection := TFDConnection.Create(nil);
Self.SetCustomConnectParams;
FDConnection.LoginPrompt := False;
FDConnection.Connected := True;
end;
procedure TAccessEngine.OpenConnection(FileName: string);
begin
FFileName := FileName;
Self.OpenConnection;
end;
procedure TAccessEngine.SetCustomConnectParams;
begin
FDConnection.Params.Values['Database'] := FFileName;
FDConnection.Params.Values['DriverID'] := 'MSAcc';
end;
end.
|
namespace proholz.xsdparser;
interface
type
AttributeValidations = public partial class
private
// assembly
// *
// * Verifies if a given value is present in a given {@link Enum} type.
// * @param instance An instance of the concrete {@link Enum} type that is expected to contain the {@code value} received.
// * @param value The value that is expected to be present in the received {@link Enum} type.
// * @param <T> The concrete type of the {@link Enum} type.
// * @return The instance of the concrete {@link Enum} type that represents {@code value} in the respective {@link Enum}.
// SimpleTypeFinalEnum
public
class method belongsToEnum(instance : SimpleTypeFinalEnum; const value : String) : SimpleTypeFinalEnum;
class method belongsToEnum(instance: WhiteSpaceEnum; const value: String): WhiteSpaceEnum;
class method belongsToEnum(instance: BlockDefaultEnum; const value: String): BlockDefaultEnum;
class method belongsToEnum(instance: BlockEnum; const value: String): BlockEnum;
class method belongsToEnum(instance: ComplexTypeBlockEnum; const value: String): ComplexTypeBlockEnum;
class method belongsToEnum(instance: FinalDefaultEnum; const value: String): FinalDefaultEnum;
class method belongsToEnum(instance: FinalEnum; const value: String): FinalEnum;
class method belongsToEnum(instance: FormEnum; const value: String): FormEnum;
class method belongsToEnum(instance: UsageEnum; const value: String): UsageEnum;
end;
implementation
class method AttributeValidations.belongsToEnum(instance: SimpleTypeFinalEnum; const value: String): SimpleTypeFinalEnum;
begin
if SimpleTypeFinalEnum.TryParse(value, out result) then exit;
if String.Compare(value, '#all') = 0 then exit SimpleTypeFinalEnum.all;
exit instance;
end;
class method AttributeValidations.belongsToEnum(instance: WhiteSpaceEnum; const value: String): WhiteSpaceEnum;
begin
if String.IsNullOrEmpty(value) then exit instance;
if WhiteSpaceEnum.TryParse(value, out result) then exit;
// if String.Compare(value, '#all') = 0 then exit xsdReader.SimpleTypeFinalEnum.all;
exit instance;
end;
class method AttributeValidations.belongsToEnum(instance: BlockDefaultEnum; const value: String): BlockDefaultEnum;
begin
if BlockDefaultEnum.TryParse(value, out result) then exit;
if String.Compare(value, '#all') = 0 then exit BlockDefaultEnum.all;
exit instance;
end;
class method AttributeValidations.belongsToEnum(instance: BlockEnum; const value: String): BlockEnum;
begin
if BlockEnum.TryParse(value, out result) then exit;
if String.Compare(value, '#all') = 0 then exit BlockEnum.all;
exit instance;
end;
class method AttributeValidations.belongsToEnum(instance: ComplexTypeBlockEnum; const value: String): ComplexTypeBlockEnum;
begin
if String.IsNullOrEmpty(value) then exit instance;
if ComplexTypeBlockEnum.TryParse(value, out result) then exit;
if String.Compare(value, '#all') = 0 then exit ComplexTypeBlockEnum.all;
exit instance;
end;
class method AttributeValidations.belongsToEnum(instance: FinalDefaultEnum; const value: String): FinalDefaultEnum;
begin
if String.IsNullOrEmpty(value) then exit instance;
if FinalDefaultEnum.TryParse(value, out result) then exit;
if String.Compare(value, '#all') = 0 then exit FinalDefaultEnum.all;
exit instance;
end;
class method AttributeValidations.belongsToEnum(instance: FinalEnum; const value: String): FinalEnum;
begin
if String.IsNullOrEmpty(value) then exit instance;
if FinalEnum.TryParse(value, out result) then exit;
if String.Compare(value, '#all') = 0 then exit FinalEnum.all;
exit instance;
end;
class method AttributeValidations.belongsToEnum(instance: FormEnum; const value: String): FormEnum;
begin
if String.IsNullOrEmpty(value) then exit instance;
if FormEnum.TryParse(value, out result) then exit;
// exit instance;
raise new ParsingException(
$"The attribute Form doesn't support the value '{value}'
The possible values for the form Attribute are
('qualified', 'unqualified')
");
end;
class method AttributeValidations.belongsToEnum(instance: UsageEnum; const value: String): UsageEnum;
begin
if String.IsNullOrEmpty(value) then exit instance;
if UsageEnum.TryParse(value, out result) then exit;
exit instance;
end;
end. |
////////////////////////////////////////////////////////////////////////////
// PaxCompiler
// Site: http://www.paxcompiler.com
// Author: Alexander Baranovsky (paxscript@gmail.com)
// ========================================================================
// Copyright (c) Alexander Baranovsky, 2006-2014. All rights reserved.
// Code Version: 4.2
// ========================================================================
// Unit: PaxBasicLanguage.pas
// ========================================================================
////////////////////////////////////////////////////////////////////////////
{$I PaxCompiler.def}
unit PaxBasicLanguage;
interface
uses {$I uses.def}
Classes,
PAXCOMP_PARSER,
PAXCOMP_BASIC_PARSER,
PaxRegister,
PaxCompiler;
type
TPaxBasicLanguage = class(TPaxCompilerLanguage)
private
function GetUseFWArrays: Boolean;
procedure SetUseFWArrays(value: Boolean);
protected
function GetParser: TBaseParser; override;
public
constructor Create(AOwner: TComponent); override;
procedure SetCallConv(CallConv: Integer); override;
procedure SetDeclareCallConv(CallConv: Integer);
function GetLanguageName: String; override;
published
property ExplicitOff;
property CompleteBooleanEval;
property UseFWArrays: Boolean read GetUseFWArrays write SetUseFWArrays;
end;
implementation
constructor TPaxBasicLanguage.Create(AOwner: TComponent);
begin
inherited;
P := TBasicParser.Create;
SetCallConv(_ccREGISTER);
end;
procedure TPaxBasicLanguage.SetCallConv(CallConv: Integer);
begin
P.CallConv := CallConv;
end;
procedure TPaxBasicLanguage.SetDeclareCallConv(CallConv: Integer);
begin
P.DeclareCallConv := CallConv;
end;
function TPaxBasicLanguage.GetParser: TBaseParser;
begin
result := P;
end;
function TPaxBasicLanguage.GetLanguageName: String;
begin
result := P.LanguageName;
end;
function TPaxBasicLanguage.GetUseFWArrays: Boolean;
begin
result := P.UseFWArrays;
end;
procedure TPaxBasicLanguage.SetUseFWArrays(value: Boolean);
begin
P.UseFWArrays := value;
end;
end.
|
(********************************************************)
(* *)
(* Json Tools Pascal Unit *)
(* A small json parser with no dependencies *)
(* *)
(* http://www.getlazarus.org/json *)
(* Dual licence GPLv3 LGPLv3 released August 2019 *)
(* *)
(********************************************************)
unit JsonTools;
{$mode delphi}
interface
uses
Classes, SysUtils;
{ EJsonException is the exception type used by TJsonNode. It is thrown
during parse if the string is invalid json or if an attempt is made to
access a non collection by name or index. }
type
EJsonException = class(Exception);
{ TJsonNodeKind is 1 of 6 possible values described below }
TJsonNodeKind = (
{ Object such as { }
nkObject,
{ Array such as [ ] }
nkArray,
{ The literal values true or false }
nkBool,
{ The literal value null }
nkNull,
{ A number value such as 123, 1.23e2, or -1.5 }
nkNumber,
{ A string such as "hello\nworld!" }
nkString);
TJsonNode = class;
{ TJsonNodeEnumerator is used to enumerate 'for ... in' statements }
TJsonNodeEnumerator = record
private
FNode: TJsonNode;
FIndex: Integer;
public
procedure Init(Node: TJsonNode);
function GetCurrent: TJsonNode;
function MoveNext: Boolean;
property Current: TJsonNode read GetCurrent;
end;
{ TJsonNode is the class used to parse, build, and navigate a json document.
You should only create and free the root node of your document. The root
node will manage the lifetime of all children through methods such as Add,
Delete, and Clear.
When you create a TJsonNode node it will have no parent and is considered to
be the root node. The root node must be either an array or an object. Attempts
to convert a root to anything other than array or object will raise an
exception.
Note: The parser supports unicode by converting unicode characters escaped as
values such as \u20AC. If your json string has an escaped unicode character it
will be unescaped when converted to a pascal string.
See also:
JsonStringDecode to convert a JSON string to a normal string
JsonStringEncode to convert a normal string to a JSON string }
TJsonNode = class
private
FStack: Integer;
FParent: TJsonNode;
FName: string;
FKind: TJsonNodeKind;
FValue: string;
FList: TList;
procedure ParseObject(Node: TJsonNode; var C: PChar);
procedure ParseArray(Node: TJsonNode; var C: PChar);
procedure Error(const Msg: string = '');
function Format(const Indent: string): string;
function FormatCompact: string;
function Add(Kind: TJsonNodeKind; const Name, Value: string): TJsonNode; overload;
function GetRoot: TJsonNode;
procedure SetKind(Value: TJsonNodeKind);
function GetName: string;
procedure SetName(const Value: string);
function GetValue: string;
function GetCount: Integer;
function GetAsJson: string;
function GetAsArray: TJsonNode;
function GetAsObject: TJsonNode;
function GetAsNull: TJsonNode;
function GetAsBoolean: Boolean;
procedure SetAsBoolean(Value: Boolean);
function GetAsString: string;
procedure SetAsString(const Value: string);
function GetAsNumber: Double;
procedure SetAsNumber(Value: Double);
public
{ A parent node owns all children. Only destroy a node if it has no parent.
To destroy a child node use Delete or Clear methods instead. }
destructor Destroy; override;
{ GetEnumerator adds 'for ... in' statement support }
function GetEnumerator: TJsonNodeEnumerator;
{ Loading and saving methods }
procedure LoadFromStream(Stream: TStream);
procedure SaveToStream(Stream: TStream);
procedure LoadFromFile(const FileName: string);
procedure SaveToFile(const FileName: string);
{ Convert a json string into a value or a collection of nodes. If the
current node is root then the json must be an array or object. }
procedure Parse(const Json: string);
{ The same as Parse, but returns true if no exception is caught }
function TryParse(const Json: string): Boolean;
{ Add a child node by node kind. If the current node is an array then the
name parameter will be discarded. If the current node is not an array or
object the Add methods will convert the node to an object and discard
its current value.
Note: If the current node is an object then adding an existing name will
overwrite the matching child node instead of adding. }
function Add(const Name: string; K: TJsonNodeKind = nkObject): TJsonNode; overload;
function Add(const Name: string; B: Boolean): TJsonNode; overload;
function Add(const Name: string; const N: Double): TJsonNode; overload;
function Add(const Name: string; const S: string): TJsonNode; overload;
{ Convert to an array and add an item }
function Add: TJsonNode; overload;
{ Delete a child node by index or name }
procedure Delete(Index: Integer); overload;
procedure Delete(const Name: string); overload;
{ Remove all child nodes }
procedure Clear;
{ Get a child node by index. EJsonException is raised if node is not an
array or object or if the index is out of bounds.
See also: Count }
function Child(Index: Integer): TJsonNode; overload;
{ Get a child node by name. If no node is found nil will be returned. }
function Child(const Name: string): TJsonNode; overload;
{ Search for a node using a path string and return true if exists }
function Exists(const Path: string): Boolean;
{ Search for a node using a path string }
function Find(const Path: string): TJsonNode; overload;
{ Search for a node using a path string and return true if exists }
function Find(const Path: string; out Node: TJsonNode): Boolean; overload;
{ Force a series of nodes to exist and return the end node }
function Force(const Path: string): TJsonNode;
{ Format the node and all its children as json }
function ToString: string; override;
{ Root node is read only. A node the root when it has no parent. }
property Root: TJsonNode read GetRoot;
{ Parent node is read only }
property Parent: TJsonNode read FParent;
{ Kind can also be changed using the As methods.
Note: Changes to Kind cause Value to be reset to a default value. }
property Kind: TJsonNodeKind read FKind write SetKind;
{ Name is unique within the scope }
property Name: string read GetName write SetName;
{ Value of the node in json e.g. '[]', '"hello\nworld!"', 'true', or '1.23e2' }
property Value: string read GetValue write Parse;
{ The number of child nodes. If node is not an object or array this
property will return 0. }
property Count: Integer read GetCount;
{ AsJson is the more efficient version of Value. Text returned from AsJson
is the most compact representation of the node in json form.
Note: If you are writing a services to transmit or receive json data then
use AsJson. If you want friendly human readable text use Value. }
property AsJson: string read GetAsJson write Parse;
{ Convert the node to an array }
property AsArray: TJsonNode read GetAsArray;
{ Convert the node to an object }
property AsObject: TJsonNode read GetAsObject;
{ Convert the node to null }
property AsNull: TJsonNode read GetAsNull;
{ Convert the node to a bool }
property AsBoolean: Boolean read GetAsBoolean write SetAsBoolean;
{ Convert the node to a string }
property AsString: string read GetAsString write SetAsString;
{ Convert the node to a number }
property AsNumber: Double read GetAsNumber write SetAsNumber;
end;
{ JsonValidate tests if a string contains a valid json format }
function JsonValidate(const Json: string): Boolean;
{ JsonNumberValidate tests if a string contains a valid json formatted number }
function JsonNumberValidate(const N: string): Boolean;
{ JsonStringValidate tests if a string contains a valid json formatted string }
function JsonStringValidate(const S: string): Boolean;
{ JsonStringEncode converts a pascal string to a json string }
function JsonStringEncode(const S: string): string;
{ JsonStringEncode converts a json string to a pascal string }
function JsonStringDecode(const S: string): string;
{ JsonStringEncode converts a json string to xml }
function JsonToXml(const S: string): string;
implementation
resourcestring
SNodeNotCollection = 'Node is not a container';
SRootNodeKind = 'Root node must be an array or object';
SIndexOutOfBounds = 'Index out of bounds';
SParsingError = 'Error while parsing text';
type
TJsonTokenKind = (tkEnd, tkError, tkObjectOpen, tkObjectClose, tkArrayOpen,
tkArrayClose, tkColon, tkComma, tkNull, tkFalse, tkTrue, tkString, tkNumber);
TJsonToken = record
Head: PChar;
Tail: PChar;
Kind: TJsonTokenKind;
function Value: string;
end;
const
Hex = ['0'..'9', 'A'..'F', 'a'..'f'];
function TJsonToken.Value: string;
begin
case Kind of
tkEnd: Result := #0;
tkError: Result := #0;
tkObjectOpen: Result := '{';
tkObjectClose: Result := '}';
tkArrayOpen: Result := '[';
tkArrayClose: Result := ']';
tkColon: Result := ':';
tkComma: Result := ',';
tkNull: Result := 'null';
tkFalse: Result := 'false';
tkTrue: Result := 'true';
else
SetString(Result, Head, Tail - Head);
end;
end;
function NextToken(var C: PChar; out T: TJsonToken): Boolean;
begin
if C^ > #0 then
if C^ <= ' ' then
repeat
Inc(C);
if C^ = #0 then
Break;
until C^ > ' ';
T.Head := C;
T.Tail := C;
T.Kind := tkEnd;
if C^ = #0 then
Exit(False);
if C^ = '{' then
begin
Inc(C);
T.Tail := C;
T.Kind := tkObjectOpen;
Exit(True);
end;
if C^ = '}' then
begin
Inc(C);
T.Tail := C;
T.Kind := tkObjectClose;
Exit(True);
end;
if C^ = '[' then
begin
Inc(C);
T.Tail := C;
T.Kind := tkArrayOpen;
Exit(True);
end;
if C^ = ']' then
begin
Inc(C);
T.Tail := C;
T.Kind := tkArrayClose;
Exit(True);
end;
if C^ = ':' then
begin
Inc(C);
T.Tail := C;
T.Kind := tkColon;
Exit(True);
end;
if C^ = ',' then
begin
Inc(C);
T.Tail := C;
T.Kind := tkComma;
Exit(True);
end;
if (C[0] = 'n') and (C[1] = 'u') and (C[2] = 'l') and (C[3] = 'l') then
begin
Inc(C, 4);
T.Tail := C;
T.Kind := tkNull;
Exit(True);
end;
if (C[0] = 'f') and (C[1] = 'a') and (C[2] = 'l') and (C[3] = 's') and (C[4] = 'e') then
begin
Inc(C, 5);
T.Tail := C;
T.Kind := tkFalse;
Exit(True);
end;
if (C[0] = 't') and (C[1] = 'r') and (C[2] = 'u') and (C[3] = 'e') then
begin
Inc(C, 4);
T.Tail := C;
T.Kind := tkTrue;
Exit(True);
end;
if C^ = '"' then
begin
repeat
Inc(C);
if C^ = '\' then
begin
Inc(C);
if C^ < ' ' then
begin
T.Tail := C;
T.Kind := tkError;
Exit(False);
end;
if C^ = 'u' then
if not ((C[1] in Hex) and (C[2] in Hex) and (C[3] in Hex) and (C[4] in Hex)) then
begin
T.Tail := C;
T.Kind := tkError;
Exit(False);
end;
end
else if C^ = '"' then
begin
Inc(C);
T.Tail := C;
T.Kind := tkString;
Exit(True);
end;
until C^ in [#0, #10, #13];
T.Tail := C;
T.Kind := tkError;
Exit(False);
end;
if C^ in ['-', '0'..'9'] then
begin
if C^ = '-' then
Inc(C);
if C^ in ['0'..'9'] then
begin
while C^ in ['0'..'9'] do
Inc(C);
if C^ = '.' then
begin
Inc(C);
if C^ in ['0'..'9'] then
begin
while C^ in ['0'..'9'] do
Inc(C);
end
else
begin
T.Tail := C;
T.Kind := tkError;
Exit(False);
end;
end;
if C^ in ['E', 'e'] then
begin
Inc(C);
if C^ = '+' then
Inc(C)
else if C^ = '-' then
Inc(C);
if C^ in ['0'..'9'] then
begin
while C^ in ['0'..'9'] do
Inc(C);
end
else
begin
T.Tail := C;
T.Kind := tkError;
Exit(False);
end;
end;
T.Tail := C;
T.Kind := tkNumber;
Exit(True);
end;
end;
T.Kind := tkError;
Result := False;
end;
{ TJsonNodeEnumerator }
procedure TJsonNodeEnumerator.Init(Node: TJsonNode);
begin
FNode := Node;
FIndex := -1;
end;
function TJsonNodeEnumerator.GetCurrent: TJsonNode;
begin
if FNode.FList = nil then
Result := nil
else if FIndex < 0 then
Result := nil
else if FIndex < FNode.FList.Count then
Result := TJsonNode(FNode.FList[FIndex])
else
Result := nil;
end;
function TJsonNodeEnumerator.MoveNext: Boolean;
begin
Inc(FIndex);
if FNode.FList = nil then
Result := False
else
Result := FIndex < FNode.FList.Count;
end;
{ TJsonNode }
destructor TJsonNode.Destroy;
begin
Clear;
inherited Destroy;
end;
function TJsonNode.GetEnumerator: TJsonNodeEnumerator;
begin
Result.Init(Self);
end;
procedure TJsonNode.LoadFromStream(Stream: TStream);
var
S: string;
I: Int64;
begin
I := Stream.Size - Stream.Position;
S := '';
SetLength(S, I);
Stream.Read(PChar(S)^, I);
Parse(S);
end;
procedure TJsonNode.SaveToStream(Stream: TStream);
var
S: string;
I: Int64;
begin
S := Value;
I := Length(S);
Stream.Write(PChar(S)^, I);
end;
procedure TJsonNode.LoadFromFile(const FileName: string);
var
F: TFileStream;
begin
F := TFileStream.Create(FileName, fmOpenRead);
try
LoadFromStream(F);
finally
F.Free;
end;
end;
procedure TJsonNode.SaveToFile(const FileName: string);
var
F: TFileStream;
begin
F := TFileStream.Create(FileName, fmCreate);
try
SaveToStream(F);
finally
F.Free;
end;
end;
const
MaxStack = 1000;
procedure TJsonNode.ParseObject(Node: TJsonNode; var C: PChar);
var
T: TJsonToken;
N: string;
begin
Inc(FStack);
if FStack > MaxStack then
Error;
while NextToken(C, T) do
begin
case T.Kind of
tkString: N := JsonStringDecode(T.Value);
tkObjectClose:
begin
Dec(FStack);
Exit;
end
else
Error;
end;
NextToken(C, T);
if T.Kind <> tkColon then
Error;
NextToken(C, T);
case T.Kind of
tkObjectOpen: ParseObject(Node.Add(nkObject, N, ''), C);
tkArrayOpen: ParseArray(Node.Add(nkArray, N, ''), C);
tkNull: Node.Add(nkNull, N, 'null');
tkFalse: Node.Add(nkBool, N, 'false');
tkTrue: Node.Add(nkBool, N, 'true');
tkString: Node.Add(nkString, N, T.Value);
tkNumber: Node.Add(nkNumber, N, T.Value);
else
Error;
end;
NextToken(C, T);
if T.Kind = tkComma then
Continue;
if T.Kind = tkObjectClose then
begin
Dec(FStack);
Exit;
end;
Error;
end;
Error;
end;
procedure TJsonNode.ParseArray(Node: TJsonNode; var C: PChar);
var
T: TJsonToken;
begin
Inc(FStack);
if FStack > MaxStack then
Error;
while NextToken(C, T) do
begin
case T.Kind of
tkObjectOpen: ParseObject(Node.Add(nkObject, '', ''), C);
tkArrayOpen: ParseArray(Node.Add(nkArray, '', ''), C);
tkNull: Node.Add(nkNull, '', 'null');
tkFalse: Node.Add(nkBool, '', 'false');
tkTrue: Node.Add(nkBool, '', 'true');
tkString: Node.Add(nkString, '', T.Value);
tkNumber: Node.Add(nkNumber, '', T.Value);
tkArrayClose:
begin
Dec(FStack);
Exit;
end
else
Error;
end;
NextToken(C, T);
if T.Kind = tkComma then
Continue;
if T.Kind = tkArrayClose then
begin
Dec(FStack);
Exit;
end;
Error;
end;
Error;
end;
procedure TJsonNode.Parse(const Json: string);
var
C: PChar;
T: TJsonToken;
begin
Clear;
C := PChar(Json);
if FParent = nil then
begin
if NextToken(C, T) and (T.Kind in [tkObjectOpen, tkArrayOpen]) then
begin
try
if T.Kind = tkObjectOpen then
begin
FKind := nkObject;
ParseObject(Self, C);
end
else
begin
FKind := nkArray;
ParseArray(Self, C);
end;
NextToken(C, T);
if T.Kind <> tkEnd then
Error;
except
Clear;
raise;
end;
end
else
Error(SRootNodeKind);
end
else
begin
NextToken(C, T);
case T.Kind of
tkObjectOpen:
begin
FKind := nkObject;
ParseObject(Self, C);
end;
tkArrayOpen:
begin
FKind := nkArray;
ParseArray(Self, C);
end;
tkNull:
begin
FKind := nkNull;
FValue := 'null';
end;
tkFalse:
begin
FKind := nkBool;
FValue := 'false';
end;
tkTrue:
begin
FKind := nkBool;
FValue := 'true';
end;
tkString:
begin
FKind := nkString;
FValue := T.Value;
end;
tkNumber:
begin
FKind := nkNumber;
FValue := T.Value;
end;
else
Error;
end;
NextToken(C, T);
if T.Kind <> tkEnd then
begin
Clear;
Error;
end;
end;
end;
function TJsonNode.TryParse(const Json: string): Boolean;
begin
try
Parse(Json);
Result := True;
except
Result := False;
end;
end;
procedure TJsonNode.Error(const Msg: string = '');
begin
FStack := 0;
if Msg = '' then
raise EJsonException.Create(SParsingError)
else
raise EJsonException.Create(Msg);
end;
function TJsonNode.GetRoot: TJsonNode;
begin
Result := Self;
while Result.FParent <> nil do
Result := Result.FParent;
end;
procedure TJsonNode.SetKind(Value: TJsonNodeKind);
begin
if Value = FKind then Exit;
case Value of
nkObject: AsObject;
nkArray: AsArray;
nkBool: AsBoolean;
nkNull: AsNull;
nkNumber: AsNumber;
nkString: AsString;
end;
end;
function TJsonNode.GetName: string;
begin
if FParent = nil then
Exit('0');
if FParent.FKind = nkArray then
Result := IntToStr(FParent.FList.IndexOf(Self))
else
Result := FName;
end;
procedure TJsonNode.SetName(const Value: string);
var
N: TJsonNode;
begin
if FParent = nil then
Exit;
if FParent.FKind = nkArray then
Exit;
N := FParent.Child(Value);
if N = Self then
Exit;
FParent.FList.Remove(N);
FName := Value;
end;
function TJsonNode.GetValue: string;
begin
if FKind in [nkObject, nkArray] then
Result := Format('')
else
Result := FValue;
end;
function TJsonNode.GetAsJson: string;
begin
if FKind in [nkObject, nkArray] then
Result := FormatCompact
else
Result := FValue;
end;
function TJsonNode.GetAsArray: TJsonNode;
begin
if FKind <> nkArray then
begin
Clear;
FKind := nkArray;
FValue := '';
end;
Result := Self;
end;
function TJsonNode.GetAsObject: TJsonNode;
begin
if FKind <> nkObject then
begin
Clear;
FKind := nkObject;
FValue := '';
end;
Result := Self;
end;
function TJsonNode.GetAsNull: TJsonNode;
begin
if FParent = nil then
Error(SRootNodeKind);
if FKind <> nkNull then
begin
Clear;
FKind := nkNull;
FValue := 'null';
end;
Result := Self;
end;
function TJsonNode.GetAsBoolean: Boolean;
begin
if FParent = nil then
Error(SRootNodeKind);
if FKind <> nkBool then
begin
Clear;
FKind := nkBool;
FValue := 'false';
Exit(False);
end;
Result := FValue = 'true';
end;
procedure TJsonNode.SetAsBoolean(Value: Boolean);
begin
if FParent = nil then
Error(SRootNodeKind);
if FKind <> nkBool then
begin
Clear;
FKind := nkBool;
end;
if Value then
FValue := 'true'
else
FValue := 'false';
end;
function TJsonNode.GetAsString: string;
begin
if FParent = nil then
Error(SRootNodeKind);
if FKind <> nkString then
begin
Clear;
FKind := nkString;
FValue := '""';
Exit('');
end;
Result := JsonStringDecode(FValue);
end;
procedure TJsonNode.SetAsString(const Value: string);
begin
if FParent = nil then
Error(SRootNodeKind);
if FKind <> nkString then
begin
Clear;
FKind := nkString;
end;
FValue := JsonStringEncode(Value);
end;
function TJsonNode.GetAsNumber: Double;
begin
if FParent = nil then
Error(SRootNodeKind);
if FKind <> nkNumber then
begin
Clear;
FKind := nkNumber;
FValue := '0';
Exit(0);
end;
Result := StrToFloatDef(FValue, 0);
end;
procedure TJsonNode.SetAsNumber(Value: Double);
begin
if FParent = nil then
Error(SRootNodeKind);
if FKind <> nkNumber then
begin
Clear;
FKind := nkNumber;
end;
FValue := FloatToStr(Value);
end;
function TJsonNode.Add: TJsonNode;
begin
Result := AsArray.Add('');
end;
function TJsonNode.Add(Kind: TJsonNodeKind; const Name, Value: string): TJsonNode;
var
S: string;
begin
if not (FKind in [nkArray, nkObject]) then
if Name = '' then
AsArray
else
AsObject;
if FKind in [nkArray, nkObject] then
begin
if FList = nil then
FList := TList.Create;
if FKind = nkArray then
S := IntToStr(FList.Count)
else
S := Name;
Result := Child(S);
if Result = nil then
begin
Result := TJsonNode.Create;
Result.FName := S;
FList.Add(Result);
end;
if Kind = nkNull then
Result.FValue := 'null'
else if Kind in [nkBool, nkString, nkNumber] then
Result.FValue := Value
else
begin
Result.FValue := '';
Result.Clear;
end;
Result.FParent := Self;
Result.FKind := Kind;
end
else
Error(SNodeNotCollection);
end;
function TJsonNode.Add(const Name: string; K: TJsonNodeKind = nkObject): TJsonNode; overload;
begin
case K of
nkObject, nkArray: Result := Add(K, Name, '');
nkNull: Result := Add(K, Name, 'null');
nkBool: Result := Add(K, Name, 'false');
nkNumber: Result := Add(K, Name, '0');
nkString: Result := Add(K, Name, '""');
end;
end;
function TJsonNode.Add(const Name: string; B: Boolean): TJsonNode; overload;
const
Bools: array[Boolean] of string = ('false', 'true');
begin
Result := Add(nkBool, Name, Bools[B]);
end;
function TJsonNode.Add(const Name: string; const N: Double): TJsonNode; overload;
begin
Result := Add(nkNumber, Name, FloatToStr(N));
end;
function TJsonNode.Add(const Name: string; const S: string): TJsonNode; overload;
begin
Result := Add(nkString, Name, JsonStringEncode(S));
end;
procedure TJsonNode.Delete(Index: Integer);
var
N: TJsonNode;
begin
N := Child(Index);
if N <> nil then
begin
FList.Delete(Index);
if FList.Count = 0 then
begin
FList.Free;
FList := nil;
end;
end;
end;
procedure TJsonNode.Delete(const Name: string);
var
N: TJsonNode;
begin
N := Child(Name);
if N <> nil then
begin
FList.Remove(N);
if FList.Count = 0 then
begin
FList.Free;
FList := nil;
end;
end;
end;
procedure TJsonNode.Clear;
var
I: Integer;
begin
if FList <> nil then
begin
for I := 0 to FList.Count - 1 do
TObject(FList[I]).Free;
FList.Free;
FList := nil;
end;
end;
function TJsonNode.Child(Index: Integer): TJsonNode;
begin
if FKind in [nkArray, nkObject] then
begin
if FList = nil then
Error(SIndexOutOfBounds);
if (Index < 0) or (Index > FList.Count - 1) then
Error(SIndexOutOfBounds);
Result := TJsonNode(FList[Index]);
end
else
Error(SNodeNotCollection);
end;
function TJsonNode.Child(const Name: string): TJsonNode;
var
N: TJsonNode;
I: Integer;
begin
Result := nil;
if (FList <> nil) and (FKind in [nkArray, nkObject]) then
if FKind = nkArray then
begin
I := StrToIntDef(Name, -1);
if (I > -1) and (I < FList.Count) then
Exit(TJsonNode(FList[I]));
end
else for I := 0 to FList.Count - 1 do
begin
N := TJsonNode(FList[I]);
if N.FName = Name then
Exit(N);
end;
end;
function TJsonNode.Exists(const Path: string): Boolean;
begin
Result := Find(Path) <> nil;
end;
function TJsonNode.Find(const Path: string): TJsonNode;
var
N: TJsonNode;
A, B: PChar;
S: string;
begin
Result := nil;
if Path = '' then
Exit(Child(''));
if Path[1] = '/' then
begin
N := Self;
while N.Parent <> nil do
N := N.Parent;
end
else
N := Self;
A := PChar(Path);
if A^ = '/' then
begin
Inc(A);
if A^ = #0 then
Exit(N);
end;
if A^ = #0 then
Exit(N.Child(''));
B := A;
while B^ > #0 do
begin
if B^ = '/' then
begin
SetString(S, A, B - A);
N := N.Child(S);
if N = nil then
Exit(nil);
A := B + 1;
B := A;
end
else
begin
Inc(B);
if B^ = #0 then
begin
SetString(S, A, B - A);
N := N.Child(S);
end;
end;
end;
Result := N;
end;
function TJsonNode.Find(const Path: string; out Node: TJsonNode): Boolean;
begin
Node := Find(Path);
Result := Node <> nil;
end;
function TJsonNode.Force(const Path: string): TJsonNode;
var
N: TJsonNode;
A, B: PChar;
S: string;
begin
Result := nil;
// AsObject;
if Path = '' then
begin
N := Child('');
if N = nil then
N := Add('');
Exit(N);
end;
if Path[1] = '/' then
begin
N := Self;
while N.Parent <> nil do
N := N.Parent;
end
else
N := Self;
A := PChar(Path);
if A^ = '/' then
begin
Inc(A);
if A^ = #0 then
Exit(N);
end;
if A^ = #0 then
begin
N := Child('');
if N = nil then
N := Add('');
Exit(N);
end;
B := A;
while B^ > #0 do
begin
if B^ = '/' then
begin
SetString(S, A, B - A);
if N.Child(S) = nil then
N := N.Add(S)
else
N := N.Child(S);
A := B + 1;
B := A;
end
else
begin
Inc(B);
if B^ = #0 then
begin
SetString(S, A, B - A);
if N.Child(S) = nil then
N := N.Add(S)
else
N := N.Child(S);
end;
end;
end;
Result := N;
end;
function TJsonNode.Format(const Indent: string): string;
function EnumNodes: string;
var
I, J: Integer;
S: string;
begin
if (FList = nil) or (FList.Count = 0) then
Exit(' ');
Result := #10;
J := FList.Count - 1;
S := Indent + #9;
for I := 0 to J do
begin
Result := Result + TJsonNode(FList[I]).Format(S);
if I < J then
Result := Result + ','#10
else
Result := Result + #10 + Indent;
end;
end;
var
Prefix: string;
begin
Result := '';
if (FParent <> nil) and (FParent.FKind = nkObject) then
Prefix := JsonStringEncode(FName) + ': '
else
Prefix := '';
case FKind of
nkObject: Result := Indent + Prefix +'{' + EnumNodes + '}';
nkArray: Result := Indent + Prefix + '[' + EnumNodes + ']';
else
Result := Indent + Prefix + FValue;
end;
end;
function TJsonNode.FormatCompact: string;
function EnumNodes: string;
var
I, J: Integer;
begin
Result := '';
if (FList = nil) or (FList.Count = 0) then
Exit;
J := FList.Count - 1;
for I := 0 to J do
begin
Result := Result + TJsonNode(FList[I]).FormatCompact;
if I < J then
Result := Result + ',';
end;
end;
var
Prefix: string;
begin
Result := '';
if (FParent <> nil) and (FParent.FKind = nkObject) then
Prefix := JsonStringEncode(FName) + ':'
else
Prefix := '';
case FKind of
nkObject: Result := Prefix + '{' + EnumNodes + '}';
nkArray: Result := Prefix + '[' + EnumNodes + ']';
else
Result := Prefix + FValue;
end;
end;
function TJsonNode.ToString: string;
begin
Result := Format('');
end;
function TJsonNode.GetCount: Integer;
begin
if FList <> nil then
Result := FList.Count
else
Result := 0;
end;
{ Json helper routines }
function JsonValidate(const Json: string): Boolean;
var
N: TJsonNode;
begin
N := TJsonNode.Create;
try
Result := N.TryParse(Json);
finally
N.Free;
end;
end;
function JsonNumberValidate(const N: string): Boolean;
var
C: PChar;
T: TJsonToken;
begin
C := PChar(N);
Result := NextToken(C, T) and (T.Kind = tkNumber) and (T.Value = N);
end;
function JsonStringValidate(const S: string): Boolean;
var
C: PChar;
T: TJsonToken;
begin
C := PChar(S);
Result := NextToken(C, T) and (T.Kind = tkString) and (T.Value = S);
end;
{ Convert a pascal string to a json string }
function JsonStringEncode(const S: string): string;
function Len(C: PChar): Integer;
var
I: Integer;
begin
I := 0;
while C^ > #0 do
begin
if C^ < ' ' then
if C^ in [#8..#13] then
Inc(I, 2)
else
Inc(I, 6)
else if C^ in ['"', '\'] then
Inc(I, 2)
else
Inc(I);
Inc(C);
end;
Result := I + 2;
end;
const
EscapeChars: PChar = '01234567btnvfr';
HexChars: PChar = '0123456789ABCDEF';
var
C: PChar;
R: string;
I: Integer;
begin
if S = '' then
Exit('""');
C := PChar(S);
R := '';
SetLength(R, Len(C));
R[1] := '"';
I := 2;
while C^ > #0 do
begin
if C^ < ' ' then
begin
R[I] := '\';
Inc(I);
if C^ in [#8..#13] then
R[I] := EscapeChars[Ord(C^)]
else
begin
R[I] := 'u';
R[I + 1] := '0';
R[I + 2] := '0';
R[I + 3] := HexChars[Ord(C^) div $10];
R[I + 4] := HexChars[Ord(C^) mod $10];
Inc(I, 4);
end;
end
else if C^ in ['"', '\'] then
begin
R[I] := '\';
Inc(I);
R[I] := C^;
end
else
R[I] := C^;
Inc(I);
Inc(C);
end;
R[Length(R)] := '"';
Result := R;
end;
{ Convert a json string to a pascal string }
function UnicodeToString(C: LongWord): string; inline;
begin
if C = 0 then
Result := #0
else if C < $80 then
Result := Chr(C)
else if C < $800 then
Result := Chr((C shr $6) + $C0) + Chr((C and $3F) + $80)
else if C < $10000 then
Result := Chr((C shr $C) + $E0) + Chr(((C shr $6) and
$3F) + $80) + Chr((C and $3F) + $80)
else if C < $200000 then
Result := Chr((C shr $12) + $F0) + Chr(((C shr $C) and
$3F) + $80) + Chr(((C shr $6) and $3F) + $80) +
Chr((C and $3F) + $80)
else
Result := '';
end;
function UnicodeToSize(C: LongWord): Integer; inline;
begin
if C = 0 then
Result := 1
else if C < $80 then
Result := 1
else if C < $800 then
Result := 2
else if C < $10000 then
Result := 3
else if C < $200000 then
Result := 4
else
Result := 0;
end;
function HexToByte(C: Char): Byte; inline;
const
Zero = Ord('0');
UpA = Ord('A');
LoA = Ord('a');
begin
if C < 'A' then
Result := Ord(C) - Zero
else if C < 'a' then
Result := Ord(C) - UpA + 10
else
Result := Ord(C) - LoA + 10;
end;
function HexToInt(A, B, C, D: Char): Integer; inline;
begin
Result := HexToByte(A) shl 12 or HexToByte(B) shl 8 or HexToByte(C) shl 4 or
HexToByte(D);
end;
function JsonStringDecode(const S: string): string;
function Len(C: PChar): Integer;
var
I, J: Integer;
begin
if C^ <> '"' then
Exit(0);
Inc(C);
I := 0;
while C^ <> '"' do
begin
if C^ = #0 then
Exit(0);
if C^ = '\' then
begin
Inc(C);
if C^ = 'u' then
begin
if (C[1] in Hex) and (C[2] in Hex) and (C[3] in Hex) and (C[4] in Hex) then
begin
J := UnicodeToSize(HexToInt(C[1], C[2], C[3], C[4]));
if J = 0 then
Exit(0);
Inc(I, J - 1);
Inc(C, 4);
end
else
Exit(0);
end
else if C^ = #0 then
Exit(0)
end;
Inc(C);
Inc(I);
end;
Result := I;
end;
const
Escape = ['b', 't', 'n', 'v', 'f', 'r'];
var
C: PChar;
R: string;
I, J: Integer;
H: string;
begin
C := PChar(S);
I := Len(C);
if I < 1 then
Exit('');
R := '';
SetLength(R, I);
I := 1;
Inc(C);
while C^ <> '"' do
begin
if C^ = '\' then
begin
Inc(C);
if C^ in Escape then
case C^ of
'b': R[I] := #8;
't': R[I] := #9;
'n': R[I] := #10;
'v': R[I] := #11;
'f': R[I] := #12;
'r': R[I] := #13;
end
else if C^ = 'u' then
begin
H := UnicodeToString(HexToInt(C[1], C[2], C[3], C[4]));
for J := 1 to Length(H) - 1 do
begin
R[I] := H[J];
Inc(I);
end;
R[I] := H[Length(H)];
Inc(C, 4);
end
else
R[I] := C^;
end
else
R[I] := C^;
Inc(C);
Inc(I);
end;
Result := R;
end;
function JsonToXml(const S: string): string;
const
Kinds: array[TJsonNodeKind] of string =
(' kind="object"', ' kind="array"', ' kind="bool"', ' kind="null"', ' kind="number"', '');
Space = ' ';
function Escape(N: TJsonNode): string;
begin
Result := N.Value;
if N.Kind = nkString then
begin
Result := JsonStringDecode(Result);
Result := StringReplace(Result, '<', '<', [rfReplaceAll]);
Result := StringReplace(Result, '>', '>', [rfReplaceAll]);
end;
end;
function EnumNodes(P: TJsonNode; const Indent: string): string;
var
N: TJsonNode;
S: string;
begin
Result := '';
if P.Kind = nkArray then
S := 'item'
else
S := '';
for N in P do
begin
Result := Result + Indent + '<' + S + N.Name + Kinds[N.Kind];
case N.Kind of
nkObject, nkArray:
if N.Count > 0 then
Result := Result + '>'#10 + EnumNodes(N, Indent + Space) +
Indent + '</' + S + N.Name + '>'#10
else
Result := Result + '/>'#10;
nkNull: Result := Result + '/>'#10;
else
Result := Result + '>' + Escape(N) + '</' + S + N.Name + '>'#10;
end;
end;
end;
var
N: TJsonNode;
begin
Result := '';
N := TJsonNode.Create;
try
if N.TryParse(S) then
begin
Result :=
'<?xml version="1.0" encoding="UTF-8"?>'#10 +
'<root' + Kinds[N.Kind];
if N.Count > 0 then
Result := Result + '>'#10 + EnumNodes(N, Space) + '</root>'
else
Result := Result + '/>';
end;
finally
N.Free;
end;
end;
end.
|
unit UDExportExcel;
interface
uses
SysUtils, Windows, Controls, Forms, Buttons, StdCtrls,
Classes, ExtCtrls, UCrpe32;
type
TCrpeExcelDlg = class(TForm)
panel1: TPanel;
gbColumnWidth: TGroupBox;
rbByConstant: TRadioButton;
rbByArea: TRadioButton;
editConstant: TEdit;
cbArea: TComboBox;
btnOk: TButton;
btnCancel: TButton;
cbWorksheetFunctions: TCheckBox;
cbXLSType: TComboBox;
lblXLSType: TLabel;
cbCreatePageBreaks: TCheckBox;
cbConvertDatesToStrings: TCheckBox;
cbChopPageHeader: TCheckBox;
cbExportHeaderFooter: TCheckBox;
gbPageRange: TGroupBox;
lblLastPage: TLabel;
rbAllPages: TRadioButton;
rbFirstPage: TRadioButton;
editFirstPage: TEdit;
editLastPage: TEdit;
lblConstantNote: TLabel;
Label1: TLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure rbByConstantClick(Sender: TObject);
procedure rbByAreaClick(Sender: TObject);
procedure editConstantKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure cbXLSTypeChange(Sender: TObject);
procedure rbAllPagesClick(Sender: TObject);
procedure rbFirstPageClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Cr : TCrpe;
end;
var
CrpeExcelDlg: TCrpeExcelDlg;
implementation
{$R *.DFM}
uses Graphics, TypInfo, UCrpeUtl;
{------------------------------------------------------------------------------}
{ FormCreate }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.FormCreate(Sender: TObject);
begin
LoadFormPos(Self);
end;
{------------------------------------------------------------------------------}
{ FormShow }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.FormShow(Sender: TObject);
var
i : integer;
s : string;
begin
{XlsType}
cbXLSType.Clear;
for i := 0 to Ord(High(TCrExportExcelType)) do
cbXLSType.Items.Add(GetEnumName(TypeInfo(TCrExportExcelType), i));
cbXLSType.ItemIndex := Ord(Cr.ExportOptions.Excel.XLSType);
{WorksheetFunctions}
cbWorksheetFunctions.Checked := Cr.ExportOptions.Excel.WorksheetFunctions;
{ColumnWidth}
case Cr.ExportOptions.Excel.ColumnWidth of
ByConstant : rbByConstant.Checked := True;
ByArea : rbByArea.Checked := True;
end;
{Area}
cbArea.Clear;
if cbArea.Items.Count = 0 then
begin
cbArea.Items.Add('Whole Report');
for i := 0 to (Cr.AreaFormat.Count - 1) do
cbArea.Items.Add(Cr.AreaFormat[i].Area);
end;
i := cbArea.Items.IndexOf(Cr.ExportOptions.Excel.Area);
if i = -1 then
cbArea.ItemIndex := 0;
if cbArea.Items.Count = 0 then
cbArea.Text := Cr.ExportOptions.Excel.Area;
{Constant}
Str(Cr.ExportOptions.Excel.Constant:0:8, s);
editConstant.Text := s;
{Booleans}
cbExportHeaderFooter.Checked := Cr.ExportOptions.Excel.ExportHeaderFooter;
cbCreatePageBreaks.Checked := Cr.ExportOptions.Excel.CreatePageBreaks;
cbConvertDatesToStrings.Checked := Cr.ExportOptions.Excel.ConvertDatesToStrings;
cbChopPageHeader.Checked := Cr.ExportOptions.Excel.ChopPageHeader;
{Page Range}
editFirstPage.Text := IntToStr(Cr.ExportOptions.Excel.FirstPage);
editLastPage.Text := IntToStr(Cr.ExportOptions.Excel.LastPage);
if Cr.ExportOptions.Excel.UsePageRange then
begin
rbFirstPage.Checked := True;
rbFirstPageClick(Self);
end
else
begin
rbAllPages.Checked := True;
rbAllPagesClick(Self);
end;
end;
{------------------------------------------------------------------------------}
{ cbXLSTypeChange }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.cbXLSTypeChange(Sender: TObject);
var
OnOff : Boolean;
begin
OnOff := (Pos('Data', cbXLSType.Text) > 0);
cbWorksheetFunctions.Enabled := OnOff;
cbChopPageHeader.Enabled := OnOff;
end;
{------------------------------------------------------------------------------}
{ rbByConstantClick }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.rbByConstantClick(Sender: TObject);
begin
editConstant.Enabled := True;
editConstant.Color := clWindow;
cbArea.Enabled := False;
cbArea.Color := clInactiveCaptionText;
end;
{------------------------------------------------------------------------------}
{ rbByAreaClick }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.rbByAreaClick(Sender: TObject);
begin
editConstant.Enabled := False;
editConstant.Color := clInactiveCaptionText;
cbArea.Enabled := True;
cbArea.Color := clWindow;
end;
{------------------------------------------------------------------------------}
{ editConstantKeyPress }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.editConstantKeyPress(Sender: TObject;
var Key: Char);
begin
{Allow periods or commas}
if Ord(Key) = 44 then Exit;
if Ord(Key) = 46 then Exit;
{Do not allow letters or extended ascii}
if Ord(Key) in [33..47] then Key := Char(0);
if Ord(Key) in [58..255] then Key := Char(0);
end;
{------------------------------------------------------------------------------}
{ rbAllPagesClick }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.rbAllPagesClick(Sender: TObject);
begin
editFirstPage.Enabled := False;
editLastPage.Enabled := False;
editFirstPage.Color := ColorState(False);
editLastPage.Color := ColorState(False);
end;
{------------------------------------------------------------------------------}
{ rbFirstPageClick }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.rbFirstPageClick(Sender: TObject);
begin
editFirstPage.Enabled := True;
editLastPage.Enabled := True;
editFirstPage.Color := ColorState(True);
editLastPage.Color := ColorState(True);
end;
{------------------------------------------------------------------------------}
{ btnOKClick }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.btnOKClick(Sender: TObject);
begin
SaveFormPos(Self);
Cr.ExportOptions.Excel.XLSType := TCrExportExcelType(cbXLSType.ItemIndex);
Cr.ExportOptions.Excel.WorksheetFunctions := cbWorksheetFunctions.Checked;
{ColumnWidth}
if rbByConstant.Checked then
Cr.ExportOptions.Excel.ColumnWidth := ByConstant
else
Cr.ExportOptions.Excel.ColumnWidth := ByArea;
{Constant}
if Length(editConstant.Text) > 0 then
Cr.ExportOptions.Excel.Constant := StrToFloat(editConstant.Text);
{Area}
Cr.ExportOptions.Excel.Area := cbArea.Text;
{Booleans}
Cr.ExportOptions.Excel.ExportHeaderFooter := cbExportHeaderFooter.Checked;
Cr.ExportOptions.Excel.CreatePageBreaks := cbCreatePageBreaks.Checked;
Cr.ExportOptions.Excel.ConvertDatesToStrings := cbConvertDatesToStrings.Checked;
Cr.ExportOptions.Excel.ChopPageHeader := cbChopPageHeader.Checked;
{Page Range}
Cr.ExportOptions.Excel.FirstPage := CrStrToInteger(editFirstPage.Text);
Cr.ExportOptions.Excel.LastPage := CrStrToInteger(editLastPage.Text);
Cr.ExportOptions.Excel.UsePageRange := (rbFirstPage.Checked);
end;
{------------------------------------------------------------------------------}
{ btnCancelClick }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.btnCancelClick(Sender: TObject);
begin
Close;
end;
{------------------------------------------------------------------------------}
{ FormClose }
{------------------------------------------------------------------------------}
procedure TCrpeExcelDlg.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Release;
end;
end.
|
unit ConverterClassFastIndex;
interface
type
TTemperatureScale = (tsCelsius, tsFahrenheit, tsKelvin);
const
cTemperatureString: array[TTemperatureScale] of String = ('Celsius', 'Fahrenheit', 'Kelvin');
type
TTemperature = class
private
FValue : Extended;
FScale : TTemperatureScale;
protected
procedure Assign(ATemperature: TTemperature);
procedure SetScale(AScale: TTemperatureScale);
function GetTemperature(AIndex: TTemperatureScale): Extended;
procedure SetTemperature(AIndex: TTemperatureScale; AValue : Extended);
property Scale : TTemperatureScale read FScale write SetScale;
public
constructor Create;
property Temperature : TTemperature write Assign;
class function StringToScale(AValue: String): TTemperatureScale;
class function ScaleToString(AValue: TTemperatureScale): String;
property Value[Index : TTemperatureScale]: Extended read GetTemperature write SetTemperature; default;
property Celsius : Extended index tsCelsius read GetTemperature write SetTemperature;
property Fahrenheit : Extended index tsFahrenheit read GetTemperature write SetTemperature;
property Kelvin: Extended index tsKelvin read GetTemperature write SetTemperature;
end;
implementation
uses ConvUtils;
// from Celsius to Celsius
// Fahrenheit [F] = [C] x 9/5 + 32 [C] = ([F] - 32) x 5/9
// Kelvin [K] = [C] + 273.15 [C] = [K] - 273.15
// Rankine [R] = ([C] + 273.15) x 9/5 [C] = ([R] - 491.67) x 5/9
constructor TTemperature.Create;
begin
FValue := 0;
FScale := tsCelsius;
end;
function TTemperature.GetTemperature(AIndex: TTemperatureScale): Extended;
begin
if Scale = AIndex then
Result := FValue
else
begin
Scale := AIndex;
Result := FValue;
end;
end;
procedure TTemperature.SetTemperature(AIndex: TTemperatureScale; AValue: Extended);
begin
FValue := AValue;
FScale := AIndex;
end;
procedure TTemperature.SetScale(AScale: TTemperatureScale);
var
lCelsius: Extended;
begin
// convert to celsius
case FScale of
tsCelsius : lCelsius := FValue;
tsFahrenheit : lCelsius := FValue * 9 / 5 + 32;
tsKelvin : lCelsius := FValue + 273.15;
else
raise EConversionError.Create('Unknown scale!');
end;
// convert from celsius
case AScale of
tsCelsius : FValue := lCelsius;
tsFahrenheit : FValue := (lCelsius - 32) * 5 / 9;
tsKelvin : FValue := lCelsius - 273.15;
else
raise EConversionError.Create('Unknown scale!');
end;
// modify scale
FScale := AScale;
end;
procedure TTemperature.Assign(ATemperature: TTemperature);
begin
FValue := ATemperature.FValue;
FScale := ATemperature.FScale;
end;
class function TTemperature.StringToScale(AValue: String): TTemperatureScale;
var
i : TTemperatureScale;
begin
for i := low(TTemperatureScale) to high(TTemperatureScale) do
if AValue = cTemperatureString[i] then
begin
Result := i;
exit;
end;
raise EConversionError.Create('Unknown scale!');
end;
class function TTemperature.ScaleToString(AValue: TTemperatureScale): String;
begin
Result := cTemperatureString[AValue];
end;
end. |
{: Actor movement with two cameras (first-person and third-person)<p>
The movement control is a little "doom-like" and keyboard only.<br>
This demos mainly answers to "doom-like" movement questions and keyboard
handling in GLScene.<p>
The basic principle is to check which key are pressed, and for each movement
key, multiply the movement by the deltaTime and use this value as delta
position or angle.<p>
The frame rate may not be that good on non-T&L accelerated board, mainly due
to the mushrooms that are light on fillrate needs, but heavy on the polygons.<br>
This demonstrates how badly viewport object-level clipping is needed in
GLScene :), a fair share of rendering power is lost in projecting
objects that are out of the viewing frustum.<p>
TODO : 3rd person view with quaternion interpolation (smoother mvt)
More mvt options (duck, jump...)
Smooth animation transition for TGLActor
HUD in 1st person view
Carlos Arteaga Rivero <carteaga@superele.gov.bo>
}
unit unit1;
interface
uses
GLCadencer, GLVectorFileObjects, GLScene, GLObjects,
StdCtrls, Buttons, Controls, ExtCtrls, ComCtrls, Classes, Forms, Graphics,
GLSkydome, GLViewer, GLNavigator, GLFileMD2, GLFile3DS,
GLGeomObjects, GLCrossPlatform, GLCoordinates, BaseClasses;
type
TForm1 = class(TForm)
GLScene1: TGLScene;
GLCamera1: TGLCamera;
DummyCube1: TGLDummyCube;
Disk1: TGLDisk;
GLSceneViewer1: TGLSceneViewer;
Actor1: TGLActor;
Actor2: TGLActor;
GLCadencer1: TGLCadencer;
Panel1: TPanel;
Timer1: TTimer;
GLCamera2: TGLCamera;
Label3: TLabel;
Label4: TLabel;
DummyCube2: TGLDummyCube;
FreeForm1: TGLFreeForm;
GLLightSource2: TGLLightSource;
DummyCube3: TGLDummyCube;
Label1: TLabel;
SkyDome1: TGLSkyDome;
GLNavigator1: TGLNavigator;
GLUserInterface1: TGLUserInterface;
CBMouseLook: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure HandleKeys(const deltaTime: Double);
procedure GLCadencer1Progress(Sender: TObject; const deltaTime,
newTime: Double);
procedure CBMouseLookClick(Sender: TObject);
private
procedure AddMushrooms;
public
{ Déclarations privées }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses VectorGeometry, SysUtils, GLKeyboard, FileUtil, LCLType;
const
cWalkStep = 6; // this is our walking speed, in 3D units / second
cStrafeStep = 6; // this is our strafing speed, in 3D units / second
cRotAngle = 60; // this is our turning speed, in degrees / second
cRunBoost = 2; // speed boost when running
cSpread = 90;
cNbMushrooms = 15;
procedure TForm1.FormCreate(Sender: TObject);
var
path: UTF8String;
p: Integer;
begin
path := ExtractFilePath(ParamStrUTF8(0));
p := Pos('DemosLCL', path);
Delete(path, p+5, Length(path));
path := IncludeTrailingPathDelimiter(path) + IncludeTrailingPathDelimiter('media');
SetCurrentDirUTF8(path);
// Load mushroom mesh
FreeForm1.LoadFromFile('mushroom.3ds');
// Duplicate our reference mushroom (but not its mesh data !)
AddMushrooms;
// Load Actor into GLScene
Actor1.LoadFromFile('waste.md2');
Actor1.Material.Texture.Image.LoadFromFile('waste.jpg');
Actor1.Animations.LoadFromFile('Quake2Animations.aaf');
Actor1.Scale.SetVector(0.04, 0.04, 0.04, 0);
// Load weapon model and texture
Actor2.LoadFromFile('WeaponWaste.md2');
Actor2.Material.Texture.Image.LoadFromFile('WeaponWaste.jpg');
Actor2.Animations.Assign(Actor1.Animations);
// Define animation properties
Actor1.AnimationMode:=aamLoop;
Actor1.SwitchToAnimation('stand');
Actor1.FrameInterpolation:=afpLinear;
Actor2.Synchronize(Actor1);
// Load Texture for ground disk
Disk1.Material.Texture.Image.LoadFromFile('clover.jpg');
end;
procedure TForm1.CBMouseLookClick(Sender: TObject);
begin
GLUserInterface1.MouseLookActive:=CBMouseLook.Checked;
end;
procedure TForm1.HandleKeys(const deltaTime: Double);
var
moving : String;
boost : Single;
begin
// This function uses asynchronous keyboard check (see Keyboard.pas)
if IsKeyDown(VK_ESCAPE) then Close;
if IsKeyDown('A') then begin
CBMouseLook.Checked:=True;
CBMouseLookClick(Self);
end;
if IsKeyDown('D') then begin
CBMouseLook.Checked:=False;
CBMouseLookClick(Self);
end;
//Change Cameras
if IsKeyDown(VK_F7) then begin
GLSceneViewer1.Camera:=GLCamera1;
Actor1.Visible:=True;
Label4.Font.Style:=Label4.Font.Style-[fsBold];
Label3.Font.Style:=Label3.Font.Style+[fsBold];
end;
if IsKeyDown(VK_F8) then begin
GLSceneViewer1.Camera:=GLCamera2;
Actor1.Visible:=False;
Label4.Font.Style:=Label4.Font.Style+[fsBold];
Label3.Font.Style:=Label3.Font.Style-[fsBold];
end;
// Move Actor in the scene
// if nothing specified, we are standing
moving:='stand';
// first, are we running ? if yes give animation & speed a boost
if IsKeyDown(VK_SHIFT) then begin
Actor1.Interval:=100;
boost:=cRunBoost*deltaTime
end else begin
Actor1.Interval:=150;
boost:=deltaTime;
end;
Actor2.Interval:=Actor1.Interval;
// are we advaning/backpedaling ?
if IsKeyDown(VK_UP) then begin
GLNavigator1.MoveForward(cWalkStep*boost);
moving:='run';
end;
if IsKeyDown(VK_DOWN) then begin
GLNavigator1.MoveForward(-cWalkStep*boost);
moving:='run';
end;
// slightly more complex, depending on CTRL key, we either turn or strafe
if IsKeyDown(VK_LEFT) then begin
if IsKeyDown(VK_CONTROL) then
GLNavigator1.StrafeHorizontal(-cStrafeStep*boost)
else GLNavigator1.TurnHorizontal(-cRotAngle*boost);
moving:='run';
end;
if IsKeyDown(VK_RIGHT) then begin
if IsKeyDown(VK_CONTROL) then
GLNavigator1.StrafeHorizontal(cStrafeStep*boost)
else GLNavigator1.TurnHorizontal(cRotAngle*boost);
moving:='run';
end;
// update animation (if required)
// you can use faster methods (such as storing the last value of "moving")
// but this ones shows off the brand new "CurrentAnimation" function :)
if Actor1.CurrentAnimation<>moving then begin
Actor1.SwitchToAnimation(moving);
Actor2.Synchronize(Actor1);
end;
end;
procedure TForm1.GLCadencer1Progress(Sender: TObject; const deltaTime,
newTime: Double);
begin
HandleKeys(deltaTime);
GLUserInterface1.Mouselook;
GLSceneViewer1.Invalidate;
GLUserInterface1.MouseUpdate;
end;
// add a few mushrooms to make the "landscape"
procedure TForm1.AddMushrooms;
var
i : Integer;
proxy : TGLProxyObject;
s : TVector;
f : Single;
begin
// spawn some more mushrooms using proxy objects
for i:=0 to cNbMushrooms-1 do begin
// create a new proxy and set its MasterObject property
proxy:=TGLProxyObject(DummyCube1.AddNewChild(TGLProxyObject));
with proxy do begin
ProxyOptions:=[pooObjects];
MasterObject:=FreeForm1;
// retrieve reference attitude
Direction:=FreeForm1.Direction;
Up:=FreeForm1.Up;
// randomize scale
s:=FreeForm1.Scale.AsVector;
f:=(1*Random+1);
ScaleVector(s, f);
Scale.AsVector:=s;
// randomize position
Position.SetPoint(Random(cSpread)-(cSpread/2),
FreeForm1.Position.z+0.8*f,
Random(cSpread)-(cSpread/2));
// randomize orientation
RollAngle:=Random(360);
TransformationChanged;
end;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Caption:=Format('%.2f FPS', [GLSceneViewer1.FramesPerSecond]);
GLSceneViewer1.ResetPerformanceMonitor;
end;
end.
|
unit pSHAutoComplete;
{$I SynEdit.inc}
interface
uses Classes, SysUtils, Contnrs, Menus, Clipbrd, Types,
SynEdit, SynEditKeyCmds, SynEditTextBuffer, SynEditTypes,
SynCompletionProposal, Windows,
pSHIntf, pSHCommon;
type
TpSHAutoComplete = class(TComponent)
private
FEditors: TList;
// FFieldListRetrievers: TList;
// FFieldListRetrievers: TInterfaceList;
FFieldListRetrievers: TComponentList;
FCaseSQLCode: TpSHCaseCode;
FShortCut: TShortCut;
FNoNextKey : Boolean;
FEndOfTokenChr: string;
FTemplatesList: TStringList;
FCommentsList: TStringList;
FCodeList: TStringList;
function GetEditor(I: Integer): TCustomSynEdit;
procedure SetTemplatesList(Value: TStringList);
procedure SetCodeList(const Value: TStringList);
procedure SetCommentsList(const Value: TStringList);
procedure SetShortCut(const Value: TShortCut);
protected
procedure Notification(AComponent: TComponent; Operation: TOperation);
override;
procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
virtual;
procedure EditorKeyPress(Sender: TObject; var Key: Char); virtual;
procedure Execute(AToken: string; Editor: TCustomSynEdit; AFieldListRetriever: IpSHFieldListRetriever);
function GetPreviousToken(Editor: TCustomSynEdit): string;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Clear;
procedure AddEditor(AEditor: TCustomSynEdit; AFieldListRetriever: IInterface = nil);
function RemoveEditor(AEditor: TCustomSynEdit): Boolean;
procedure LoadFromFile(const AFileName: string);
procedure SaveToFile(const AFileName: string);
procedure AddCompletion(const ATemplate, AComment, ACode: string);
function EditorsCount: Integer;
property Editors[I: Integer]: TCustomSynEdit read GetEditor;
published
property TemplatesList: TStringList read FTemplatesList
write SetTemplatesList;
property CommentsList: TStringList read FCommentsList
write SetCommentsList;
property CodeList: TStringList read FCodeList
write SetCodeList;
property CaseSQLCode: TpSHCaseCode read FCaseSQLCode
write FCaseSQLCode default ccUpper;
property EndOfTokenChr: string read FEndOfTokenChr write FEndOfTokenChr;
property ShortCut: TShortCut read FShortCut write SetShortCut;
end;
implementation
uses TypInfo;
{ TpSHAutoComplete }
function TpSHAutoComplete.GetEditor(I: Integer): TCustomSynEdit;
begin
if (I < 0) or (I >= EditorsCount) then
Result := nil
else
Result := FEditors[I];
end;
procedure TpSHAutoComplete.SetTemplatesList(Value: TStringList);
begin
FTemplatesList.Assign(Value);
end;
procedure TpSHAutoComplete.SetCodeList(const Value: TStringList);
begin
FCodeList.Assign(Value);
end;
procedure TpSHAutoComplete.SetCommentsList(const Value: TStringList);
begin
FCommentsList.Assign(Value);
end;
procedure TpSHAutoComplete.SetShortCut(const Value: TShortCut);
begin
FShortCut := Value;
end;
procedure TpSHAutoComplete.Notification(AComponent: TComponent;
Operation: TOperation);
begin
if (Operation = opRemove) then
begin
if AComponent is TCustomSynEdit then
RemoveEditor(TCustomSynEdit(AComponent));
end;
inherited Notification(AComponent, Operation);
end;
procedure TpSHAutoComplete.EditorKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
ShortCutKey : Word;
ShortCutShift : TShiftState;
I: Integer;
vFieldListRetriever: IpSHFieldListRetriever;
begin
I := FEditors.IndexOf(Sender);
if (I <> -1) and (not (Sender as TCustomSynEdit).ReadOnly) then
begin
ShortCutToKey(FShortCut, ShortCutKey, ShortCutShift);
if (Shift = ShortCutShift) and (Key = ShortCutKey) then
begin
// if Assigned(FFieldListRetrievers) and Assigned(FFieldListRetrievers[I]) then
if Assigned(FFieldListRetrievers) then
begin
Supports(TObject(FFieldListRetrievers[I]), IpSHFieldListRetriever, vFieldListRetriever);
Execute(GetPreviousToken(Sender as TCustomSynEdit),
(Sender as TCustomSynEdit), vFieldListRetriever);
end;
// FNoNextKey := True;
// if FNoNextKey then
// Key := 0;
end;
end;
end;
procedure TpSHAutoComplete.EditorKeyPress(Sender: TObject;
var Key: Char);
begin
if FNoNextKey then
begin
FNoNextKey := False;
Key := #0;
end;
end;
procedure TpSHAutoComplete.Execute(AToken: string;
Editor: TCustomSynEdit; AFieldListRetriever: IpSHFieldListRetriever);
var
I, J: integer;
// StartOfBlock: TPoint;
StartOfBlock: TBufferCoord;
ChangedIndent : Boolean;
ChangedTrailing : Boolean;
TmpOptions : TSynEditorOptions;
OrigOptions: TSynEditorOptions;
BeginningSpaceCount : Integer;
Spacing: string;
InRepeatableGroup: Boolean;
RepeatableGroupI: Integer;
vObjectName: string;
FieldList: TStringList;
function LogonUserName: string;
var
P: PChar;
vSize: Cardinal;
begin
P := StrAlloc(255);
if GetUserName(P, vSize) then
SetString(Result, P, vSize)
else
Result := EmptyStr;
StrDispose(P);
end;
procedure ProcessString(AString: string);
var
J, K: Integer;
GroupStart, GroupEnd: Integer;
Group: string;
CurrentField: string;
vString: string;
SpacesFromLineBegin: Integer;
IsLineBegin: Boolean;
S: string;
begin
J := 1;
vString := AString;
SpacesFromLineBegin := 0;
IsLineBegin := True;
while J <= Length(vString) do
begin
case vString[J] of
#9: Editor.CommandProcessor(ecTab, vString[J], nil);
#13: begin
if (J < Length(vString)) and (vString[J + 1] = #10) then
begin
IsLineBegin := True;
SpacesFromLineBegin := 0;
Inc(J);
Editor.CommandProcessor (ecLineBreak, ' ', nil);
for K := 1 to Length(Spacing) do
if (Spacing[K]=#9) then
Editor.CommandProcessor(ecTab,#9,nil)
else
Editor.CommandProcessor (ecChar, ' ', nil);
end;
end;
'|': StartOfBlock := Editor.CaretXY;
'#':
if ((Length(vString) - J) >= Length('Author')) and
AnsiSameText(Copy(vString, J + 1, Length('Author')), 'Author') then
begin
Inc(J, Length('Author'));
ProcessString(LogonUserName);
end
else
if ((Length(vString) - J) >= Length('Date')) and
AnsiSameText(Copy(vString, J + 1, Length('Date')), 'Date') then
begin
Inc(J, Length('Date'));
ProcessString(DateToStr(Now));
end
else
if ((Length(vString) - J) >= Length('Time')) and
AnsiSameText(Copy(vString, J + 1, Length('Time')), 'Time') then
begin
Inc(J, Length('Time'));
ProcessString(TimeToStr(Time));
end
else
if not InRepeatableGroup then
Editor.PasteFromClipboard
else
begin
CurrentField := FieldList[RepeatableGroupI];
ProcessString(CurrentField);
end;
'^': begin
S := Copy(Editor.LineText, 1, Editor.CaretX - 1);
if S = Spacing then
Editor.CaretX := 1;
if Editor.CaretX = 0 then
begin
Editor.CaretY := Editor.CaretY - 1;
Editor.CaretX := Length(Editor.LineText);
end
else
Editor.CommandProcessor(ecDeleteLastChar, ' ', nil);
end;
' ': begin
if IsLineBegin then
Inc(SpacesFromLineBegin);
Editor.CommandProcessor(ecChar, vString[J], nil);
end;
'~': begin
if (J < Length(vString)) and (vString[J + 1] = '{') then
begin
Inc(J, 2);
GroupStart := J;
while (J <= Length(vString)) and (vString[J] <> '}') do
Inc(J);
GroupEnd := J;
// Inc(J);
if Assigned(AFieldListRetriever) and
(not InRepeatableGroup) then
begin
vObjectName := Clipboard.AsText;
FieldList := TStringList.Create;
try
AFieldListRetriever.GetFieldList(vObjectName, FieldList);
if FieldList.Count > 0 then
begin
Group := Copy(vString, GroupStart, GroupEnd - GroupStart);
InRepeatableGroup := True;
for K := 0 to FieldList.Count - 1 do
begin
RepeatableGroupI := K;
if K = 0 then
ProcessString(Group)
else
ProcessString(StringOfChar(' ',SpacesFromLineBegin) + Group);
end;
InRepeatableGroup := False;
end;
finally
FieldList.Free;
end;
end;
end
else
Editor.CommandProcessor(ecChar, vString[J], nil);
end;
else
begin
Editor.CommandProcessor(ecChar, vString[J], nil);
IsLineBegin := False;
SpacesFromLineBegin := 0;
end;
end;
Inc(J);
end;
end;
begin
I := TemplatesList.IndexOf(AToken);
if (I <> -1) then
begin
TmpOptions := Editor.Options;
OrigOptions:= Editor.Options;
ChangedIndent := eoAutoIndent in TmpOptions;
ChangedTrailing := eoTrimTrailingSpaces in TmpOptions;
if ChangedIndent then Exclude(TmpOptions, eoAutoIndent);
if ChangedTrailing then Exclude(TmpOptions, eoTrimTrailingSpaces);
if ChangedIndent or ChangedTrailing then
Editor.Options := TmpOptions;
Editor.UndoList.AddChange(crAutoCompleteBegin, StartOfBlock, StartOfBlock, '',
smNormal);
FNoNextKey := True;
for J := 1 to Length(AToken) do
Editor.CommandProcessor(ecDeleteLastChar, ' ', nil);
BeginningSpaceCount := Editor.DisplayX - 1;
if (not (eoTabsToSpaces in Editor.Options)) and
(BeginningSpaceCount >= Editor.TabWidth) then
Spacing:=StringOfChar(#9,BeginningSpaceCount div Editor.TabWidth)+StringOfChar(' ',BeginningSpaceCount mod Editor.TabWidth)
else
Spacing:=StringOfChar(' ',BeginningSpaceCount);
StartOfBlock.Char := -1;
StartOfBlock.Line := -1;
InRepeatableGroup := False;
ProcessString(DoCaseCode(TrimRight(CodeList[I]), CaseSQLCode));
if (StartOfBlock.Char <> -1) and (StartOfBlock.Line <> -1) then
Editor.CaretXY := StartOfBlock;
if ChangedIndent or ChangedTrailing then Editor.Options := OrigOptions;
Editor.UndoList.AddChange(crAutoCompleteEnd, StartOfBlock, StartOfBlock, '',
smNormal);
FNoNextKey := False;
end;
end;
function TpSHAutoComplete.GetPreviousToken(
Editor: TCustomSynEdit): string;
var
S: string;
I: integer;
begin
Result := '';
if Editor <> nil then begin
S := Editor.LineText;
I := Editor.CaretX - 1;
if I <= Length (s) then begin
while (I > 0) and (S[I] > ' ') and (pos(S[I], FEndOfTokenChr) = 0) do
Dec(i);
Result := copy(S, I + 1, Editor.CaretX - I - 1);
end;
end
end;
constructor TpSHAutoComplete.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FEditors := TList.Create;
// FFieldListRetrievers := TList.Create;
// FFieldListRetrievers := TInterfaceList.Create;
FFieldListRetrievers := TComponentList.Create;
FFieldListRetrievers.OwnsObjects := True;
FTemplatesList := TStringList.Create;
FTemplatesList.CaseSensitive := False;
// FTemplatesList.Sorted := True;
// FTemplatesList.Duplicates := dupIgnore;
FCommentsList := TStringList.Create;
FCodeList := TStringList.Create;
// FEndOfTokenChr := DefaultEndOfTokenChr;
FEndOfTokenChr := ' ';
FNoNextKey := False;
{$IFDEF SYN_CLX}
FShortCut := QMenus.ShortCut(Ord('J'), [ssCtrl]);
{$ELSE}
// FShortCut := Menus.ShortCut(Ord(' '), [ssShift]);
FShortCut := Menus.ShortCut(Ord('J'), [ssCtrl]);
{$ENDIF}
end;
destructor TpSHAutoComplete.Destroy;
begin
while FEditors.Count <> 0 do
RemoveEditor(TCustomSynEdit(FEditors.Last));
// inherited;
FEditors.Free;
FFieldListRetrievers.Free;
// FFieldListRetrievers := nil;
FTemplatesList.Free;
FCommentsList.Free;
FCodeList.Free;
inherited;
end;
procedure TpSHAutoComplete.Clear;
begin
FTemplatesList.Clear;
FCommentsList.Clear;
FCodeList.Clear;
end;
procedure TpSHAutoComplete.AddEditor(AEditor: TCustomSynEdit; AFieldListRetriever: IInterface = nil);
var
I: Integer;
// vFieldListRetriever: IpSHFieldListRetriever;
vComponentReference: IInterfaceComponentReference;
begin
// Supports(AFieldListRetriever, IpSHFieldListRetriever, vFieldListRetriever);
I := FEditors.IndexOf(AEditor);
if I = -1 then
begin
AEditor.FreeNotification(Self);
FEditors.Add(AEditor);
// FFieldListRetrievers.Add(pointer(vFieldListRetriever));
// FFieldListRetrievers.Add(vFieldListRetriever);
if Supports(AFieldListRetriever, IInterfaceComponentReference, vComponentReference) then
FFieldListRetrievers.Add(vComponentReference.GetComponent)
else
FFieldListRetrievers.Add(nil);
AEditor.AddKeyDownHandler(EditorKeyDown);
AEditor.AddKeyPressHandler(EditorKeyPress);
end
else
begin
// if FFieldListRetrievers[I] <> pointer(vFieldListRetriever) then
if Supports(AFieldListRetriever, IInterfaceComponentReference, vComponentReference) then
begin
if (FFieldListRetrievers[I] <> vComponentReference.GetComponent) then
// FFieldListRetrievers[I] := pointer(vFieldListRetriever);
FFieldListRetrievers[I] := vComponentReference.GetComponent;
end
else
FFieldListRetrievers[I] := nil;
end;
end;
function TpSHAutoComplete.RemoveEditor(AEditor: TCustomSynEdit): Boolean;
var
I: Integer;
begin
I := FEditors.Remove(AEditor);
Result := I <> -1;
if Result then
begin
FFieldListRetrievers.Delete(I);
AEditor.RemoveKeyDownHandler(EditorKeyDown);
AEditor.RemoveKeyPressHandler(EditorKeyPress);
RemoveFreeNotification(AEditor);
end;
end;
procedure TpSHAutoComplete.LoadFromFile(const AFileName: string);
var
vTemplates: TStringList;
I: Integer;
vHeader: string;
vPos: Integer;
vTemplate, vCode, vComment: string;
function SkipEmptyStrings: Boolean;
begin
while (I < vTemplates.Count) and
((Length(Trim(vTemplates[I])) = 0) or (vTemplates[I][1] = ';')) do
Inc(I);
Result := I < vTemplates.Count;
end;
begin
if FileExists(AFileName) then
begin
Clear;
I := 0;
vTemplates := TStringList.Create;
try
vTemplates.LoadFromFile(AFileName);
while (I < vTemplates.Count) do
begin
if not SkipEmptyStrings then Break;
vHeader := Trim(vTemplates[I]);
if (vHeader[1] = '[') and (vHeader[Length(vHeader)] = ']') then
begin
vPos := Pos(' | ', vHeader);
if vPos > 0 then
begin
vTemplate := Trim(Copy(vHeader, 2, vPos - 2));
vComment := Trim(Copy(vHeader, vPos + 3, Length(vHeader) - 3 - vPos));
end
else
begin
vTemplate := Trim(Copy(vHeader, 2, Length(vHeader) - 2));
vComment := '';
end;
Inc(I);
if not SkipEmptyStrings then Break;
vCode := '';
while (I < vTemplates.Count) do
begin
if not ((Length(vTemplates[I]) = 0) or (vTemplates[I][1] = ';')) then
begin
if vTemplates[I][1] = '[' then Break;
vCode := vCode + vTemplates[I] + sLineBreak;
end;
Inc(I)
end;
if Length(vCode) > 0 then
Delete(vCode, Length(vCode) - 1, 2);
AddCompletion(vTemplate, vComment, vCode);
end;
end;
finally
vTemplates.Free;
end;
end;
end;
procedure TpSHAutoComplete.SaveToFile(const AFileName: string);
const
SHeader = '[%s | %s]';
var
I: Integer;
vTemplates: TStringList;
begin
if FTemplatesList.Count > 0 then
begin
vTemplates := TStringList.Create;
try
for I := 0 to FTemplatesList.Count - 1 do
begin
vTemplates.Add(Format(SHeader, [FTemplatesList[I], FCommentsList[I]]));
vTemplates.Add(FCodeList[I]);
vTemplates.Add('');
end;
vTemplates.SaveToFile(AFileName);
finally
vTemplates.Free;
end;
end;
end;
procedure TpSHAutoComplete.AddCompletion(const ATemplate, AComment,
ACode: string);
begin
FTemplatesList.Add(ATemplate);
FCommentsList.Add(AComment);
FCodeList.Add(ACode);
end;
function TpSHAutoComplete.EditorsCount: Integer;
begin
Result := FEditors.Count;
end;
end.
|
PROGRAM Desks(input, output) ;
CONST
Title_length = 16 ; (* Length of paper title *)
TYPE
StackElementType = PACKED ARRAY[1..Title_Length] OF char ;
(* Stack element type is a string *)
NodePtrType = ^StackNodeType; (* a pointer type *)
StackNodeType =
RECORD
Info : StackElementType; (* user's data *)
Next : NodePtrType (* pointer to next node *)
END; (* StackNodeType *)
StackType = NodePtrType; (* pointer to stack top *)
PileNameType = (Urgent, NotUrgent, Files, Trash) ;
PilesType = ARRAY[Urgent..Trash] OF StackType ;
VAR
Desk1 : PilesType ;
pile : PileNameType ;
paper : StackElementType ;
(****************************************************************)
PROCEDURE CreateStack
(VAR Stack : StackType);
(* Initializes Stack to empty state. *)
BEGIN (* CreateStack *)
Stack := NIL
END; (* CreateStack *)
(****************************************************************)
FUNCTION EmptyStack
(Stack : StackType) : Boolean;
(* Returns True if Stack is empty; returns False otherwise. *)
BEGIN (* EmptyStack. *)
EmptyStack := Stack = NIL
END; (* EmptyStack *)
(****************************************************************)
FUNCTION FullStack
(Stack : StackType) : Boolean;
(* Stub for FullStack operation. *)
BEGIN (* FullStack *)
FullStack := False
END; (* FullStack *)
(****************************************************************)
PROCEDURE DestroyStack
(VAR Stack : StackType);
(* Destroys all elements in stack, leaving Stack empty. *)
VAR
TempPtr : NodePtrType;
BEGIN (* DestroyStack *)
(* Pop all the elements in the stack. *)
WHILE Stack <> NIL DO
BEGIN
(* Unlink the top node from the stack. *)
TempPtr := Stack;
Stack := Stack^.Next;
(* Free the space for the old top node. *)
Dispose (TempPtr)
END (* WHILE *)
END; (* DestroyStack *)
(****************************************************************)
PROCEDURE Push
(VAR Stack : StackType;
NewElement : StackElementType);
(* Adds NewElement to the top of Stack. *)
VAR
ElementPtr : NodePtrType;
BEGIN (* Push *)
(* Allocate space for new element. *)
New (ElementPtr);
(* Put new element in the allocated space. *)
ElementPtr^.Info := NewElement;
(* Link the new node to the top of the stack. *)
ElementPtr^.Next := Stack;
Stack := ElementPtr
END; (* Push *)
(****************************************************************)
PROCEDURE Pop
(VAR Stack : StackType;
VAR PoppedElement : StackElementType);
(* Removes the top element from Stack and returns its *)
(* value in PoppedElement. Assumes that the stack is *)
(* not empty. *)
VAR
TempPtr : NodePtrType;
BEGIN (* Pop *)
(* PoppedElement := info in top node. *)
PoppedElement := Stack^.Info;
(* Unlink the top node from the stack. *)
TempPtr := Stack;
Stack := Stack^.Next;
(* Free the space for the old top node. *)
Dispose (TempPtr)
END; (* Pop *)
(****************************************************************)
(* PILES code *)
(****************************************************************)
PROCEDURE CreatePiles (VAR PaperPiles : PilesType) ;
VAR
pile : PileNameType ;
BEGIN
FOR pile := Urgent TO Trash DO
CreateStack (PaperPiles[pile]) ;
writeln ('CREATEPILES : Desk is created.') ;
writeln ;
END ;
PROCEDURE Move (VAR PaperPiles : PilesType; Pile1, Pile2 : PileNameType ) ;
VAR
paper : StackElementType ;
BEGIN
IF NOT(EmptyStack(PaperPiles[Pile1])) THEN
BEGIN
IF NOT(FullStack(PaperPiles[Pile2])) THEN
BEGIN
Pop (PaperPiles[Pile1], paper) ;
Push (PaperPiles[Pile2], paper) ;
writeln ('MOVE : Paper ', paper,' moved from', Pile1,' to', Pile2) ;
END
ELSE
writeln ('MOVE : ', Pile2, ' is full. Cannot move from ', Pile1) ;
END
ELSE
writeln ('MOVE :', Pile1, ' is empty. Cannot move to ', Pile2) ;
writeln ;
END ;
PROCEDURE Transfer(VAR PaperPiles : PilesType; Pile1, Pile2 : PileNameType) ;
VAR
TempStackPtr : NodePtrType ;
BEGIN
IF NOT(EmptyStack(PaperPiles[Pile1])) THEN
BEGIN
TempStackPtr := PaperPiles[Pile1] ;
WHILE (TempStackPtr^.Next <> NIL) DO (* Search for end of Pile1 *)
TempStackPtr := TempStackPtr^.Next ;
TempStackPtr^.Next := PaperPiles[Pile2] ; (* End of Pile1 now points to
beginning of Pile2, thus
Pile1 now includes Pile2*)
PaperPiles[Pile2] := PaperPiles[Pile1] ; (* Pile2 is now the same as
Pile1 *)
PaperPiles[Pile1] := NIL ; (* Pile1 is now empty *)
writeln ('TRANSFER : Moved all papers from', Pile1, ' to', Pile2) ;
END
ELSE
writeln ('TRANSFER :', Pile1, ' is empty. Cannot transfer to ', Pile2) ;
writeln ;
END ;
PROCEDURE Switch(VAR PaperPiles : PilesType; Pile1, Pile2 : PileNameType) ;
VAR
TempStackPtr : NodePtrType ;
BEGIN
TempStackPtr := PaperPiles[Pile2] ; (* Switch pointers for Pile1 *)
PaperPiles[Pile2] := PaperPiles[Pile1] ; (* and Pile2, with the help of*)
PaperPiles[Pile1] := TempStackPtr ; (* a temporary pointer *)
writeln ('SWITCH : Piles', Pile1, ' &', Pile2, ' are switched.') ;
writeln ;
END ;
PROCEDURE Cleanup(VAR PaperPiles : PilesType) ;
BEGIN
DestroyStack (PaperPiles[Trash]) ;
writeln ('CLEANUP : Pile Trash cleaned up.') ;
writeln ;
END ;
PROCEDURE AddPaper(VAR PaperPiles : PilesType; Paper : StackElementType; Pile :
PileNameType) ;
BEGIN
IF NOT(FullStack(PaperPiles[Pile])) THEN
BEGIN
Push (PaperPiles[Pile], Paper) ;
writeln ('ADDPAPER : Paper ', Paper,' is added to Pile', Pile) ;
END
ELSE
writeln ('ADDPAPER : No space on Pile :', Pile) ;
writeln ;
END ;
PROCEDURE RemovePaper(VAR PaperPiles : PilesType; VAR Paper : StackElementType;
Pile : PileNameType) ;
BEGIN
IF NOT(EmptyStack(PaperPiles[Pile])) THEN
BEGIN
Pop (PaperPiles[Pile], Paper) ;
writeln ('REMOVEPAPER : Paper ', Paper,' removed from Pile', Pile) ;
END
ELSE
writeln ('REMOVEPAPER : No papers on Pile', Pile) ;
writeln ;
END ;
PROCEDURE PrintPile(PaperPiles : PilesType; Pile : PileNameType) ;
VAR
TempStackPtr : NodePtrType ;
index : integer ;
BEGIN
index := 1 ;
IF NOT(EmptyStack(PaperPiles[Pile])) THEN
BEGIN
writeln ('PRINTPILE : Pile', Pile) ;
TempStackPtr := PaperPiles[Pile] ;
WHILE (TempStackPtr <> NIL) DO (* While Stack has not been fully read*)
BEGIN
writeln ('Paper', index, ' : ', TempStackPtr^.Info) ;
index := index + 1 ;
TempStackPtr := TempStackPtr^.Next ; (* get next stack value *)
END ;
END
ELSE
writeln ('PRINTPILE : Pile', Pile, ' is empty.') ;
writeln ;
END ;
FUNCTION FindPaper(PaperPiles : PilesType; Paper : StackElementType; VAR Pile
: PileNameType) : boolean ;
VAR
SearchPile : PileNameType ;
SearchPilePtr : NodePtrType ;
found : boolean ;
BEGIN
found := false ;
FindPaper := false ;
FOR SearchPile := Urgent to Trash DO
BEGIN
SearchPilePtr := PaperPiles[SearchPile] ;
WHILE ((SearchPilePtr <> NIL) AND (NOT found)) DO
BEGIN
IF (SearchPilePtr^.Info = Paper) THEN
BEGIN
Pile := SearchPile ;
FindPaper := true ;
found := true ;
writeln ('FINDPAPER : Paper ', Paper,' found in pile',
SearchPile) ;
END
ELSE
SearchPilePtr := SearchPilePtr^.Next ; (* Goto next stack
position *)
END ;
END ;
IF NOT(found) THEN
writeln ('FINDPAPER : Paper ', Paper,' not found.') ;
writeln ;
END ;
(* MAIN PROGRAM *)
BEGIN
CreatePiles (Desk1) ;
AddPaper (Desk1, 'Urgent1', Urgent) ;
AddPaper (Desk1, 'Urgent2', Urgent) ;
AddPaper (Desk1, 'Urgent3', Urgent) ;
AddPaper (Desk1, 'Urgent4', Urgent) ;
AddPaper (Desk1, 'NotUrgent1', NotUrgent) ;
AddPaper (Desk1, 'NotUrgent2', NotUrgent) ;
AddPaper (Desk1, 'NotUrgent3', NotUrgent) ;
AddPaper (Desk1, 'NotUrgent4', NotUrgent) ;
AddPaper (Desk1, 'NotUrgent5', NotUrgent) ;
AddPaper (Desk1, 'Files1', Files) ;
AddPaper (Desk1, 'Files2', Files) ;
AddPaper (Desk1, 'Trash1', Trash) ;
FOR pile := Urgent TO Trash DO
PrintPile (Desk1, pile) ;
RemovePaper (Desk1, paper, Trash) ;
RemovePaper (Desk1, paper, Trash) ;
Move (Desk1, NotUrgent, Files) ;
PrintPile (Desk1, NotUrgent) ;
PrintPile (Desk1, Files ) ;
Move (Desk1, Trash, NotUrgent) ;
Move (Desk1, Files, Trash) ;
Transfer (Desk1, Urgent, NotUrgent) ;
FOR pile := Urgent TO Trash DO
PrintPile (Desk1, pile) ;
Move (Desk1, Trash, Urgent) ;
Transfer (Desk1, Trash, Files) ;
Transfer (Desk1, Files, Trash) ;
Switch (Desk1, Urgent, NotUrgent) ;
Switch (Desk1, Urgent, Files) ;
FOR pile := Urgent TO Trash DO
PrintPile (Desk1, pile) ;
IF (FindPaper (Desk1, 'Secret', pile)) THEN
writeln ('Paper "Secret" found in pile', pile)
ELSE
writeln ('Paper "Secret" not found.' ) ;
writeln ;
IF (FindPaper (Desk1, 'Urgent3 ', pile)) THEN
writeln ('Paper "Urgent3" found in pile', pile)
ELSE
writeln ('Paper "Urgent3" not found.' ) ;
writeln ;
CleanUp (Desk1) ;
PrintPile (Desk1, Trash) ;
END.
|
unit ideSHObjectListFrm;
interface
uses
SHDesignIntf,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ideSHBaseDialogFrm, StdCtrls, ExtCtrls, AppEvnts, VirtualTrees,
ToolWin, ComCtrls, StrUtils;
type
TObjectListForm = class(TBaseDialogForm)
Panel1: TPanel;
Tree: TVirtualStringTree;
ToolBar1: TToolBar;
Edit1: TEdit;
Bevel4: TBevel;
procedure FormCreate(Sender: TObject);
procedure ToolBar1Resize(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
procedure FindObject(const S: string);
{ Tree }
procedure TreeGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure TreeFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
procedure TreeGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
procedure TreeGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
procedure TreePaintText(Sender: TBaseVirtualTree;
const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
TextType: TVSTTextType);
procedure TreeIncrementalSearch(Sender: TBaseVirtualTree;
Node: PVirtualNode; const SearchText: WideString; var Result: Integer);
procedure TreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure TreeDblClick(Sender: TObject);
procedure TreeCompareNodes(Sender: TBaseVirtualTree; Node1, Node2: PVirtualNode;
Column: TColumnIndex; var Result: Integer);
procedure TreeFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
public
{ Public declarations }
procedure Prepare;
procedure DoOnModalResult;
end;
//var
// ObjectListForm: TObjectListForm;
procedure ShowObjectListForm;
implementation
uses
ideSHConsts, ideSHSystem, ideSHSysUtils;
{$R *.dfm}
type
PTreeRec = ^TTreeRec;
TTreeRec = record
NormalText: string;
StaticText: string;
Component: TSHComponent;
ClassIID: TGUID;
ImageIndex: Integer;
end;
{ TObjectListForm }
procedure ShowObjectListForm;
var
ObjectListForm: TObjectListForm;
begin
try
ObjectListForm := TObjectListForm.Create(Application);
ObjectListForm.Prepare;
if IsPositiveResult(ObjectListForm.ShowModal) then
ObjectListForm.DoOnModalResult;
finally
FreeAndNil(ObjectListForm);
end;
end;
procedure TObjectListForm.FormCreate(Sender: TObject);
begin
SetFormSize(540, 340);
Position := poScreenCenter;
inherited;
Caption := Format('%s', [SCaptionDialogObjectList]);
Tree.Images := MainIntf.ImageList;
Tree.OnGetNodeDataSize := TreeGetNodeDataSize;
Tree.OnFreeNode := TreeFreeNode;
Tree.OnGetImageIndex := TreeGetImageIndex;
Tree.OnGetText := TreeGetText;
Tree.OnPaintText := TreePaintText;
Tree.OnIncrementalSearch := TreeIncrementalSearch;
Tree.OnKeyDown := TreeKeyDown;
Tree.OnDblClick := TreeDblClick;
Tree.OnCompareNodes := TreeCompareNodes;
Tree.OnFocusChanged := TreeFocusChanged;
end;
procedure TObjectListForm.Prepare;
var
Node: PVirtualNode;
NodeData: PTreeRec;
DatabaseIntf: ISHDatabase;
I, J, ImageIndex: Integer;
ClassIID: TGUID;
S: string;
begin
if Assigned(NavigatorIntf) and Supports(NavigatorIntf.CurrentDatabase, ISHDatabase, DatabaseIntf) then
begin
Caption := Format('%s\%s', [DatabaseIntf.Caption, Caption]);
Screen.Cursor := crHourGlass;
Tree.BeginUpdate;
try
for I := 0 to Pred(DatabaseIntf.GetSchemeClassIIDList.Count) do
begin
ClassIID := StringToGUID(GetHintLeftPart(DatabaseIntf.GetSchemeClassIIDList[I]));
ImageIndex := DesignerIntf.GetImageIndex(ClassIID);
if not Assigned(RegistryIntf.GetRegComponent(ClassIID)) then Continue;
S := RegistryIntf.GetRegComponent(ClassIID).GetAssociationClassFnc;
for J := 0 to Pred(DatabaseIntf.GetObjectNameList(ClassIID).Count) do
begin
Node := Tree.AddChild(nil);
NodeData := Tree.GetNodeData(Node);
NodeData.NormalText := DatabaseIntf.GetObjectNameList(ClassIID)[J];
NodeData.StaticText := S;
NodeData.Component := nil; // Component
NodeData.ClassIID := ClassIID;
NodeData.ImageIndex := ImageIndex;
end;
end;
Tree.Sort(nil, 0, sdAscending);
Tree.FocusedNode := Tree.GetFirst;
Tree.Selected[Tree.FocusedNode] := True;
finally
Tree.EndUpdate;
Screen.Cursor := crDefault;
end;
end;
end;
procedure TObjectListForm.DoOnModalResult;
var
Data: PTreeRec;
begin
if Assigned(Tree.FocusedNode) then
begin
Data := Tree.GetNodeData(Tree.FocusedNode);
if Assigned(NavigatorIntf) and Assigned(NavigatorIntf.CurrentDatabase) then
ComponentFactoryIntf.CreateComponent(NavigatorIntf.CurrentDatabase.InstanceIID, Data.ClassIID, Data.NormalText);
end;
end;
procedure TObjectListForm.FindObject(const S: string);
var
Node: PVirtualNode;
NodeData: PTreeRec;
begin
Tree.TreeOptions.SelectionOptions := Tree.TreeOptions.SelectionOptions + [toCenterScrollIntoView];
Node := Tree.GetFirst;
if Assigned(Node) then
begin
while Assigned(Node) do
begin
NodeData := Tree.GetNodeData(Node);
if Pos(AnsiUpperCase(S), AnsiUpperCase(NodeData.NormalText)) = 1 then
begin
Tree.FocusedNode := Node;
Tree.Selected[Tree.FocusedNode] := True;
Break;
end else
Node := Tree.GetNext(Node);
end;
if not Assigned(Node) then
begin
Tree.FocusedNode := Tree.GetFirst;
Tree.Selected[Tree.FocusedNode] := True;
end;
end;
end;
procedure TObjectListForm.ToolBar1Resize(Sender: TObject);
begin
Edit1.Width := Edit1.Parent.ClientWidth;
end;
procedure TObjectListForm.Edit1Change(Sender: TObject);
begin
if Screen.ActiveControl = Sender then FindObject(Edit1.Text);
end;
{ Tree }
procedure TObjectListForm.TreeGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TTreeRec);
end;
procedure TObjectListForm.TreeFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
Data: PTreeRec;
begin
Data := Sender.GetNodeData(Node);
if Assigned(Data) then Finalize(Data^);
end;
procedure TObjectListForm.TreeGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
var
Data: PTreeRec;
begin
Data := Sender.GetNodeData(Node);
if (Kind = ikNormal) or (Kind = ikSelected) then
begin
case Column of
0: ImageIndex := Data.ImageIndex;
1: ImageIndex := -1;
end;
end;
end;
procedure TObjectListForm.TreeGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
var
Data: PTreeRec;
begin
Data := Sender.GetNodeData(Node);
case Column of
0: case TextType of
ttNormal: CellText := Data.NormalText;
ttStatic: ;
end;
1: case TextType of
ttNormal: CellText := Data.StaticText;
ttStatic: ;
end;
end;
end;
procedure TObjectListForm.TreePaintText(Sender: TBaseVirtualTree;
const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
TextType: TVSTTextType);
begin
if (Column = 1) and (TextType = ttNormal) then
if Sender.Focused and (vsSelected in Node.States) then
TargetCanvas.Font.Color := clWindow
else
TargetCanvas.Font.Color := clGray;
end;
procedure TObjectListForm.TreeIncrementalSearch(Sender: TBaseVirtualTree;
Node: PVirtualNode; const SearchText: WideString; var Result: Integer);
var
Data: PTreeRec;
begin
Data := Sender.GetNodeData(Node);
(Sender as TVirtualStringTree).TreeOptions.SelectionOptions := (Sender as TVirtualStringTree).TreeOptions.SelectionOptions + [toCenterScrollIntoView];
if Pos(AnsiUpperCase(SearchText), AnsiUpperCase(Data.NormalText)) <> 1 then
Result := 1;
end;
procedure TObjectListForm.TreeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
(Sender as TVirtualStringTree).TreeOptions.SelectionOptions := (Sender as TVirtualStringTree).TreeOptions.SelectionOptions - [toCenterScrollIntoView];
end;
procedure TObjectListForm.TreeDblClick(Sender: TObject);
begin
ModalResult := mrOK;
end;
procedure TObjectListForm.TreeCompareNodes(
Sender: TBaseVirtualTree; Node1, Node2: PVirtualNode;
Column: TColumnIndex; var Result: Integer);
var
Data1, Data2: PTreeRec;
begin
Data1 := Tree.GetNodeData(Node1);
Data2 := Tree.GetNodeData(Node2);
Result := CompareStr(Data1.NormalText, Data2.NormalText);
end;
procedure TObjectListForm.TreeFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
var
Data: PTreeRec;
begin
if Column = 0 then
begin
Data := Tree.GetNodeData(Node);
if Assigned(Data) and (Screen.ActiveControl = Sender) then
Edit1.Text := Data.NormalText;
end;
end;
procedure TObjectListForm.FormShow(Sender: TObject);
begin
inherited;
if Assigned(Tree.FocusedNode) and Supports(DesignerIntf.CurrentComponent, ISHDBComponent) then
begin
Edit1.Text := DesignerIntf.CurrentComponent.Caption;
FindObject(Edit1.Text);
end;
end;
end.
|
unit ThTypes;
interface
uses
System.Classes,
System.UITypes,
System.Generics.Collections,
GR32;
const
TH_SCALE_MIN = 0.2;
TH_SCALE_MAX = 4;
type
TThDrawMode = (dmSelect, dmDraw, dmPen, dmEraser);
TThShapeDragState = (
dsNone,
dsItemAdd,
dsItemMove,
dsItemResize,
dsMultiSelect{Drag for select}
);
TThPercent = 0..100;
TThPath = TArray<TFloatPoint>;
TThPoly = TArrayOfFloatPoint;
TThPolyPoly = TArrayOfArrayOfFloatPoint;
type
IThItemSelectionHandles = interface;
IThItemConnectionHandles = interface;
IThCanvas = interface
end;
IThDrawStyle = interface
end;
IThItem = interface
['{2A361DAA-4178-4D6E-868B-B6ADD9CB21D9}']
procedure Draw(Bitmap: TBitmap32; AScale, AOffset: TFloatPoint);
function PtInItem(APt: TFloatPoint): Boolean;
function GetBounds: TFloatRect;
function GetPolyPoly: TThPolyPoly;
property Bounds: TFloatRect read GetBounds;
property PolyPoly: TThPolyPoly read GetPolyPoly;
end;
IThDrawItem = interface(IThItem)
end;
IThShapeItem = interface(IThItem)
procedure ResizeItem(AFromPoint, AToPoint: TFloatPoint);
procedure DrawPoints(Bitmap: TBitmap32; AScale, AOffset: TFloatPoint;
AFromPoint, AToPoint: TFloatPoint);
end;
IThSelectableItem = interface(IThShapeItem)
['{796D1837-E123-4612-9307-53512AD52FDC}']
procedure MoveItem(APoint: TFloatPoint);
procedure MouseDown(APoint: TFloatPoint);
procedure MouseMove(APoint: TFloatPoint);
procedure MouseUp(APoint: TFloatPoint);
procedure MouseEnter(APoint: TFloatPoint);
procedure MouseLeave(APoint: TFloatPoint);
function GetSelected: Boolean;
procedure SetSelected(const Value: Boolean);
function GetSelection: IThItemSelectionHandles;
// function PtInHandle(APoint: TFloatPoint): Boolean;
property Selected: Boolean read GetSelected write SetSelected;
property Selection: IThItemSelectionHandles read GetSelection;
end;
IThConnectorItem = interface;
// 연결할 수 있는(도형)
IThConnectableItem = interface(IThSelectableItem)
['{6ECF9DA8-3440-42B9-80DE-C33B296CC4D5}']
procedure ShowConnection;
procedure HideConnection;
function GetConnection: IThItemConnectionHandles;
property Connection: IThItemConnectionHandles read GetConnection;
// Visible
function GetLinkedConnectors: TList<IThConnectorItem>;
property LinkedConnectors: TList<IThConnectorItem> read GetLinkedConnectors;
function IsConnectable: Boolean;
procedure ConnectTo(AConnector: IThConnectorItem);
end;
// 연결자(선)
IThConnectorItem = interface
['{B08D51EF-045C-4C7C-B694-DDD4B4C1625A}']
function GetLinkedFromItem: IThShapeItem;
function GetLinkedToItem: IThShapeItem;
property LinkedFromItm: IThShapeItem read GetLinkedFromItem;
property LinkedToItem: IThShapeItem read GetLinkedToItem;
end;
// 그리기 객체
IThDrawObject = interface
procedure MouseDown(const APoint: TFloatPoint; AShift: TShiftState);
procedure MouseMove(const APoint: TFloatPoint; AShift: TShiftState);
procedure MouseUp(const APoint: TFloatPoint; AShift: TShiftState);
procedure Draw(Bitmap: TBitmap32; AScale, AOffset: TFloatPoint);
function GetItemInstance: IThItem;
property ItemInstance: IThItem read GetItemInstance;
end;
IThItemHandle = interface
function GetCursor: TCursor;
property Cursor: TCursor read GetCursor;
end;
IThItemHandles = interface
procedure DrawHandles(Bitmap: TBitmap32; AScale, AOffset: TFloatPoint);
procedure RealignHandles;
procedure MouseDown(const APoint: TFloatPoint);
procedure MouseMove(const APoint: TFloatPoint); // MouseDown & move
procedure MouseUp(const APoint: TFloatPoint);
function PtInHandles(APoint: TFloatPoint): Boolean;
function GetHotHandle: IThItemHandle;
property HotHandle: IThItemHandle read GetHotHandle;
procedure ReleaseHotHandle;
function GetVisible: Boolean;
procedure SetVisible(const Value: Boolean);
property Visible: Boolean read GetVisible write SetVisible;
// Visible: Boolean
end;
// 선택 시 크기변경 핸들 관리
IThItemSelectionHandles = interface(IThItemHandles)
procedure Draw(Bitmap: TBitmap32; AScale, AOffset: TFloatPoint);
procedure ResizeItem(const APoint: TFloatPoint);
end;
IThItemConnectionHandles = interface(IThItemHandles)
['{A4ED614A-0CB3-419A-85B2-0C42176B6C53}']
procedure Draw(Bitmap: TBitmap32; AScale, AOffset: TFloatPoint);
end;
implementation
end.
|
unit uEmprestimoModel;
interface
uses uGenericEntity, uLivroModel, uUsuarioModel;
type
TEmprestimoModel = class(TGenericEntity)
private
FCodigo: Integer;
FDataVencimento: TDate;
FDataDevolucao: TDate;
FDataRetirada: TDate;
FUsuario: TUsuarioModel;
FLivro: TLivroModel;
procedure SetCodigo(const Value: Integer);
procedure SetDataDevolucao(const Value: TDate);
procedure SetDataRetirada(const Value: TDate);
procedure SetDataVencimento(const Value: TDate);
procedure SetLivro(const Value: TLivroModel);
procedure SetUsuario(const Value: TUsuarioModel);
public
property Codigo: Integer read FCodigo write SetCodigo;
property Livro: TLivroModel read FLivro write SetLivro;
property Usuario: TUsuarioModel read FUsuario write SetUsuario;
property DataRetirada: TDate read FDataRetirada write SetDataRetirada;
property DataVencimento: TDate read FDataVencimento write SetDataVencimento;
property DataDevolucao: TDate read FDataDevolucao write SetDataDevolucao;
end;
implementation
uses SysUtils;
{ TEmprestimoModel }
procedure TEmprestimoModel.SetCodigo(const Value: Integer);
begin
FCodigo := Value;
end;
procedure TEmprestimoModel.SetDataDevolucao(const Value: TDate);
begin
FDataDevolucao := Value;
end;
procedure TEmprestimoModel.SetDataRetirada(const Value: TDate);
begin
FDataRetirada := Value;
end;
procedure TEmprestimoModel.SetDataVencimento(const Value: TDate);
begin
FDataVencimento := Value;
end;
procedure TEmprestimoModel.SetLivro(const Value: TLivroModel);
begin
FLivro := Value;
end;
procedure TEmprestimoModel.SetUsuario(const Value: TUsuarioModel);
begin
FUsuario := Value;
end;
end.
|
unit uDMImportCatalogTextFile;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uDMImportTextFile, FMTBcd, DB, ADODB;
type
TDMImportCatalogTextFile = class(TDMImportTextFile)
qryCreateVendorTable: TADOQuery;
qryCreateDatabase: TADOQuery;
qryCreateModelCatalogTable: TADOQuery;
qryInsertModelCatalog: TADOQuery;
private
procedure CreateDataBase;
procedure CreateTables;
function GetIDVendor(Vendor :String): Integer;
function GetNewIDVendor(Vendor :String): Integer;
function GetModelLastCode: Integer;
procedure InsertModelCatalog(Cod, IDVendor: Integer);
procedure SetQueryConnections;
public
function Import: Boolean; override;
procedure CreateCatalogDB;
end;
implementation
uses uNumericFunctions, uDMGlobal;
{$R *.dfm}
{ TDMImportCatalogTextFile }
procedure TDMImportCatalogTextFile.CreateCatalogDB;
begin
CreateDataBase;
CreateTables;
end;
procedure TDMImportCatalogTextFile.CreateDataBase;
begin
try
qryCreateDatabase.Connection := SQLConnection;
qryCreateDatabase.ExecSQL;
except
on E: Exception do
Log.Add(Format('Error: %s', [E.Message]));
end;
end;
procedure TDMImportCatalogTextFile.CreateTables;
begin
try
qryCreateVendorTable.Connection := SQLConnection;
qryCreateVendorTable.ExecSQL;
except
on E: Exception do
Log.Add(Format('Error: %s', [E.Message]));
end;
try
qryCreateModelCatalogTable.Connection := SQLConnection;
qryCreateModelCatalogTable.ExecSQL;
except
on E: Exception do
Log.Add(Format('Error: %s', [E.Message]));
end;
end;
function TDMImportCatalogTextFile.GetIDVendor(Vendor: String): Integer;
begin
with DMGlobal.qryFreeSQL do
begin
if Active then
Close;
SQL.Text := 'SELECT IDVendor from MRCatalogDB..Vendor WHERE Vendor = ' + QuotedStr(Vendor);
Open;
if IsEmpty then
Result := GetNewIDVendor(Vendor)
else
Result := FieldByName('IDVendor').AsInteger;
end;
end;
function TDMImportCatalogTextFile.GetModelLastCode: Integer;
begin
Result := -1;
with DMGlobal.qryFreeSQL do
begin
if Active then
Close;
SQL.Text := 'SELECT Max(IDModelCatalog) Max_IDModelCatalog from MRCatalogDB..Model_Catalog';
try
Open;
Result := Fields.FieldByName('Max_IDModelCatalog').AsInteger;
Close;
except
on E: Exception do
Log.Add(Format('Error: %s', [E.Message]));
end;
end;
end;
function TDMImportCatalogTextFile.GetNewIDVendor(Vendor: String): Integer;
begin
Result := -1;
try
DMGlobal.RunSQL('INSERT INTO MRCatalogDB..Vendor (Vendor) VALUES (' + QuotedStr(Vendor) + ')',SQLConnection);
with DMGlobal.qryFreeSQL do
begin
if Active then
Close;
SQL.Text := 'SELECT Max(IDVendor) Max_IDVendor from MRCatalogDB..Vendor';
Open;
try
Result:= FieldByName('Max_IDVendor').AsInteger;
finally
Close;
end;
end;
except
on E: Exception do
Log.Add(Format('Error: %s', [E.Message]));
end;
end;
function TDMImportCatalogTextFile.Import: Boolean;
var
Cod: Integer;
IDVendor: Integer;
begin
Result := True;
SetQueryConnections;
IDVendor := GetIDVendor(ImpExpConfig.Values['Vendor']);
DMGlobal.RunSQL('DELETE FROM MRCatalogDB..Model_Catalog WHERE IDVendor = ' + InttoStr(IDVendor),SQLConnection);
Cod := GetModelLastCode + 1;
try
with TextFile do
while not Eof do
begin
InsertModelCatalog(Cod,IDVendor);
inc(Cod);
Next;
end;
except
on E: Exception do
begin
Log.Add(Format('Error: %s', [E.Message]));
Result := False;
end;
end;
end;
procedure TDMImportCatalogTextFile.InsertModelCatalog(Cod, IDVendor: Integer);
begin
with qryInsertModelCatalog do
begin
if Active then
Close;
Parameters.ParamByName('IDModelCatalog').Value := InttoStr(Cod);
Parameters.ParamByName('IDVendor').Value := InttoStr(IDVendor);
if not(LinkedColumns.Values['IDBarcode'] = '') then
Parameters.ParamByName('IDBarcode').Value := TextFile.FieldByName(LinkedColumns.Values['IDBarcode']).AsString
else
Parameters.ParamByName('IDBarcode').Value := '';
if not(LinkedColumns.Values['Model'] = '') then
Parameters.ParamByName('Model').Value := TextFile.FieldByName(LinkedColumns.Values['Model']).AsString
else
Parameters.ParamByName('Model').Value := '';
if not(LinkedColumns.Values['InvSize'] = '') then
Parameters.ParamByName('InvSize').Value := TextFile.FieldByName(LinkedColumns.Values['InvSize']).AsString
else
Parameters.ParamByName('InvSize').Value := '';
if not(LinkedColumns.Values['InvColor'] = '') then
Parameters.ParamByName('InvColor').Value := TextFile.FieldByName(LinkedColumns.Values['InvColor']).AsString
else
Parameters.ParamByName('InvColor').Value := '';
if not(LinkedColumns.Values['Description'] = '') then
Parameters.ParamByName('Description').Value := TextFile.FieldByName(LinkedColumns.Values['Description']).AsString
else
Parameters.ParamByName('Description').Value := '';
if not(LinkedColumns.Values['Manufacture'] = '') then
Parameters.ParamByName('Manufacture').Value := TextFile.FieldByName(LinkedColumns.Values['Manufacture']).AsString
else
Parameters.ParamByName('Manufacture').Value := '';
if not(LinkedColumns.Values['TabGroup'] = '') then
Parameters.ParamByName('TabGroup').Value := TextFile.FieldByName(LinkedColumns.Values['TabGroup']).AsString
else
Parameters.ParamByName('TabGroup').Value := '';
if not(LinkedColumns.Values['CustoPrice'] = '') then
Parameters.ParamByName('CustoPrice').Value := MyStrToMoney(TextFile.FieldByName(LinkedColumns.Values['CustoPrice']).AsString)
else
Parameters.ParamByName('CustoPrice').Value := 0;
if not(LinkedColumns.Values['SalePrice'] = '') then
Parameters.ParamByName('SalePrice').Value := MyStrToMoney(TextFile.FieldByName(LinkedColumns.Values['SalePrice']).AsString)
else
Parameters.ParamByName('SalePrice').Value := 0;
if not(LinkedColumns.Values['VendorCode'] = '') then
Parameters.ParamByName('VendorCode').Value := TextFile.FieldByName(LinkedColumns.Values['VendorCode']).AsString
else
Parameters.ParamByName('VendorCode').Value := '';
if not(LinkedColumns.Values['Qty'] = '') then
Parameters.ParamByName('Qty').Value := MyStrToFloat(TextFile.FieldByName(LinkedColumns.Values['Qty']).AsString)
else
Parameters.ParamByName('Qty').Value := 0;
if not(LinkedColumns.Values['QtyMin'] = '') then
Parameters.ParamByName('QtyMin').Value := MyStrToFloat(TextFile.FieldByName(LinkedColumns.Values['QtyMin']).AsString)
else
Parameters.ParamByName('QtyMin').Value := 0;
if not(LinkedColumns.Values['QtyMax'] = '') then
Parameters.ParamByName('QtyMax').Value := MyStrToFloat(TextFile.FieldByName(LinkedColumns.Values['QtyMax']).AsString )
else
Parameters.ParamByName('QtyMax').Value := 0;
try
ExecSQL;
finally
Close;
end;
end;
end;
procedure TDMImportCatalogTextFile.SetQueryConnections;
begin
qryInsertModelCatalog.Connection := SQLConnection;
DMGlobal.qryFreeSQL.Connection := SQLConnection;
end;
end.
|
unit InflatablesList_Manager_Base;
{$INCLUDE '.\InflatablesList_defs.inc'}
interface
uses
Graphics, StdCtrls,
AuxClasses,
InflatablesList_Types,
InflatablesList_Data,
InflatablesList_Backup,
InflatablesList_Item;
type
TILManagerUpdatedFlag = (ilmufMainList,ilmufSmallList,ilmufMiniList,
ilmufOverview,ilmufSettings);
TILManagerUpdatedFlags = set of TILManagerUpdatedFlag;
TILManager_Base = class(TCustomListObject)
protected
fMainManager: Boolean;
fTransient: Boolean;
fStaticSettings: TILStaticManagerSettings; // not changed at runtime
fBackupManager: TILBackupManager;
fDataProvider: TILDataProvider;
fSorting: Boolean; // transient, used only during sorting to disable reindexing
fUpdateCounter: Integer; // transient (not copied in copy constructor)
fUpdated: TILManagerUpdatedFlags; // transient
// list properties
fEncrypted: Boolean;
fListPassword: String;
fCompressed: Boolean;
fHasItemsPassword: Boolean;
fItemsPassword: String;
// internal events forwarded from item shops
fOnShopListItemUpdate: TILIndexedObjectL2Event; // all events are transient
fOnShopValuesUpdate: TILObjectL2Event;
fOnShopAvailHistoryUpd: TILObjectL2Event;
fOnShopPriceHistoryUpd: TILObjectL2Event;
// internal events forwarded from items
fOnItemTitleUpdate: TILObjectL1Event;
fOnItemPicturesUpdate: TILObjectL1Event;
fOnItemFlagsUpdate: TILObjectL1Event;
fOnItemValuesUpdate: TILObjectL1Event; // reserved for item frame
fOnItemOthersUpdate: TILObjectL1Event; // -//-
fOnItemShopListUpdate: TILObjectL1Event;
fOnItemShopListValuesUpdate: TILObjectL1Event; // reserved for shop form
// events
fOnMainListUpdate: TNotifyEvent;
fOnSmallListUpdate: TNotifyEvent;
fOnMiniListUpdate: TNotifyEvent;
fOnOverviewUpdate: TNotifyEvent;
fOnSettingsChange: TNotifyEvent;
fOnItemsPasswordRequest: TNotifyEvent;
// main list
fList: array of TILItem;
fCount: Integer;
// other data
fNotes: String;
fListName: String;
// getters and setters
procedure SetEncrypted(Value: Boolean); virtual;
procedure SetListPassword(const Value: String); virtual;
procedure SetCompressed(Value: Boolean); virtual;
procedure SetItemsPassword(const Value: String); virtual;
// data getters and setters
procedure SetNotes(const Value: String); virtual;
procedure SetListName(const Value: String); virtual;
// list methods
Function GetCapacity: Integer; override;
procedure SetCapacity(Value: Integer); override;
Function GetCount: Integer; override;
procedure SetCount(Value: Integer); override;
Function GetItem(Index: Integer): TILITem; virtual;
// handlers for item shop events
procedure ShopUpdateShopListItemHandler(Sender: TObject; Shop: TObject; Index: Integer); virtual;
procedure ShopUpdateValuesHandler(Sender: TObject; Shop: TObject); virtual;
procedure ShopUpdateAvailHistoryHandler(Sender: TObject; Shop: TObject); virtual;
procedure ShopUpdatePriceHistoryHandler(Sender: TObject; Shop: TObject); virtual;
// handlers for item events
procedure ItemUpdateMainListHandler(Sender: TObject); virtual;
procedure ItemUpdateSmallListHandler(Sender: TObject); virtual;
procedure ItemUpdateMiniListHandler(Sender: TObject); virtual;
procedure ItemUpdateOverviewHandler(Sender: TObject); virtual;
procedure ItemUpdateTitleHandler(Sender: TObject); virtual;
procedure ItemUpdatePicturesHandler(Sender: TObject); virtual;
procedure ItemUpdateFlagsHandler(Sender: TObject); virtual;
procedure ItemUpdateValuesHandler(Sender: TObject); virtual;
procedure ItemUpdateOthersHandler(Sender: TObject); virtual;
procedure ItemUpdateShopListHandler(Sender: TObject); virtual;
Function ItemPasswordRequestHandler(Sender: TObject; out Password: String): Boolean; virtual;
// event callers
procedure UpdateMainList; virtual;
procedure UpdateSmallList; virtual;
procedure UpdateMiniList; virtual;
procedure UpdateOverview; virtual;
procedure UpdateSettings; virtual;
procedure RequestItemsPassword; virtual;
// macro callers
procedure UpdateList; virtual;
// inits/finals
procedure InitializeStaticSettings; virtual;
procedure FinalizeStaticSettings; virtual;
procedure Initialize; virtual;
procedure Finalize; virtual;
// other
procedure ReIndex; virtual;
procedure ThisCopyFrom_Base(Source: TILManager_Base; UniqueCopy: Boolean); virtual;
public
constructor Create;
constructor CreateAsCopy(Source: TILManager_Base; UniqueCopy: Boolean); virtual; // will be overriden
constructor CreateTransient; // nothing is initialized, use with great caution
destructor Destroy; override;
procedure CopyFrom(Source: TILManager_Base; UniqueCopy: Boolean); virtual;
procedure BeginUpdate; virtual;
procedure EndUpdate; virtual;
Function LowIndex: Integer; override;
Function HighIndex: Integer; override;
Function ItemLowIndex: Integer; virtual;
Function ItemHighIndex: Integer; virtual;
// list manipulation
Function ItemIndexOf(ItemUniqueID: TGUID): Integer; virtual;
Function ItemAddEmpty(Index: Integer = -1): Integer; virtual;
Function ItemAddCopy(SrcIndex: Integer; Index: Integer = -1): Integer; virtual;
Function ItemAddSplitOutCopy(SrcIndex: Integer; Index: Integer = -1): Integer; virtual;
procedure ItemExchange(Idx1,Idx2: Integer); virtual;
procedure ItemMove(Src,Dst: Integer); virtual;
procedure ItemDelete(Index: Integer); virtual;
procedure ItemClear; virtual;
// macro methods (broadcast to item objects)
procedure ReinitMainDrawSize(MainWidth,MainHeight: Integer; MainFont: TFont); overload; virtual;
procedure ReinitMainDrawSize(MainList: TListBox); overload; virtual;
procedure ReinitMainDrawSize(MainList: TListBox; OnlyVisible: Boolean); overload; virtual;
procedure ReinitSmallDrawSize(SmallWidth,SmallHeight: Integer; SmallFont: TFont); overload; virtual;
procedure ReinitSmallDrawSize(SmallList: TListBox); overload; virtual;
procedure ReinitMiniDrawSize(MiniWidth,MiniHeight: Integer; MiniFont: TFont); virtual;
// utility methods
Function SortingItemStr(const SortingItem: TILSortingItem): String; virtual;
Function TotalPictureCount: Integer; virtual;
procedure AssignInternalEventHandlers; virtual;
Function EncryptedItemCount(CountDecrypted: Boolean): Integer; virtual;
Function CheckItemPassword(const Password: String): Boolean; virtual;
Function DecryptAllItems: Integer; virtual;
Function GenerateUserID(out NewID: String): Boolean; virtual;
// properties
property MainManager: Boolean read fMainManager write fMainManager;
property Transient: Boolean read fTransient;
property StaticSettings: TILStaticManagerSettings read fStaticSettings;
property DataProvider: TILDataProvider read fDataProvider;
property BackupManager: TILBackupManager read fBackupManager;
// list properties
property Encrypted: Boolean read fEncrypted write SetEncrypted;
property ListPassword: String read fListPassword write SetListPassword;
property Compressed: Boolean read fCompressed write SetCompressed;
property HasItemsPassword: Boolean read fHasItemsPassword;
property ItemsPassword: String read fItemsPassword write SetItemsPassword;
// list and data
property ItemCount: Integer read GetCount;
property Items[Index: Integer]: TILItem read GetItem; default;
property Notes: String read fNotes write SetNotes;
property ListName: String read fListName write SetListName;
// item shop events
property OnShopListItemUpdate: TILIndexedObjectL2Event read fOnShopListItemUpdate write fOnShopListItemUpdate;
property OnShopValuesUpdate: TILObjectL2Event read fOnShopValuesUpdate write fOnShopValuesUpdate;
property OnShopAvailHistoryUpdate: TILObjectL2Event read fOnShopAvailHistoryUpd write fOnShopAvailHistoryUpd;
property OnShopPriceHistoryUpdate: TILObjectL2Event read fOnShopPriceHistoryUpd write fOnShopPriceHistoryUpd;
// item events
property OnItemTitleUpdate: TILObjectL1Event read fOnItemTitleUpdate write fOnItemTitleUpdate;
property OnItemPicturesUpdate: TILObjectL1Event read fOnItemPicturesUpdate write fOnItemPicturesUpdate;
property OnItemFlagsUpdate: TILObjectL1Event read fOnItemFlagsUpdate write fOnItemFlagsUpdate;
property OnItemValuesUpdate: TILObjectL1Event read fOnItemValuesUpdate write fOnItemValuesUpdate;
property OnItemOthersUpdate: TILObjectL1Event read fOnItemOthersUpdate write fOnItemOthersUpdate;
property OnItemShopListUpdate: TILObjectL1Event read fOnItemShopListUpdate write fOnItemShopListUpdate;
property OnItemShopListValuesUpdate: TILObjectL1Event read fOnItemShopListValuesUpdate write fOnItemShopListValuesUpdate;
// global events
property OnMainListUpdate: TNotifyEvent read fOnMainListUpdate write fOnMainListUpdate;
property OnSmallListUpdate: TNotifyEvent read fOnSmallListUpdate write fOnSmallListUpdate;
property OnMiniListUpdate: TNotifyEvent read fOnMiniListUpdate write fOnMiniListUpdate;
property OnOverviewUpdate: TNotifyEvent read fOnOverviewUpdate write fOnOverviewUpdate;
property OnSettingsChange: TNotifyEvent read fOnSettingsChange write fOnSettingsChange;
property OnItemsPasswordRequest: TNotifyEvent read fOnItemsPasswordRequest write fOnItemsPasswordRequest;
end;
implementation
uses
SysUtils,
SimpleCmdLineParser, StrRect, BitVector, CRC32,
InflatablesList_Utils,
InflatablesList_Encryption,
InflatablesList_ItemShop;
const
IL_DEFAULT_LIST_FILENAME = 'list.inl';
procedure TILManager_Base.SetEncrypted(Value: Boolean);
begin
If fEncrypted <> Value then
begin
fEncrypted := Value;
UpdateSettings;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.SetListPassword(const Value: String);
begin
If not IL_SameStr(fListPassword,Value) then
begin
fListPassword := Value;
UniqueString(fListPassword);
UpdateSettings;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.SetCompressed(Value: Boolean);
begin
If fCompressed <> Value then
begin
fCompressed := Value;
UpdateSettings;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.SetItemsPassword(const Value: String);
begin
If CheckItemPassword(Value) then
begin
fItemsPassword := Value;
UniqueString(fItemsPassword);
fHasItemsPassword := True;
end
else raise EILWrongPassword.Create('TILManager_Base.SetItemsPassword: Wrong password.');
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.SetNotes(const Value: String);
begin
If not IL_SameStr(fNotes,Value) then
begin
fNotes := Value;
UniqueString(fNotes);
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.SetListName(const Value: String);
begin
If not IL_SameStr(fListName,Value) then
begin
fListName := Value;
UniqueString(fListName);
end;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.GetCapacity: Integer;
begin
Result := Length(fList);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.SetCapacity(Value: Integer);
var
i: Integer;
begin
If Value < fCount then
begin
For i := Value to Pred(fCount) do
fList[i].Free;
fCount := Value;
end;
SetLength(fList,Value);
end;
//------------------------------------------------------------------------------
Function TILManager_Base.GetCount: Integer;
begin
Result := fCount;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.SetCount(Value: Integer);
begin
// do nothing
end;
//------------------------------------------------------------------------------
Function TILManager_Base.GetItem(Index: Integer): TILITem;
begin
If CheckIndex(Index) then
Result := fList[Index]
else
raise Exception.CreateFmt('TILManager_Base.GetItem: Index (%d) out of bounds.',[Index]);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ShopUpdateShopListItemHandler(Sender: TObject; Shop: TObject; Index: Integer);
begin
If Assigned(fOnShopListItemUpdate) and (Sender is TILItem) and (Shop is TILItemShop) then
fOnShopListItemUpdate(Self,Sender,Shop,Index);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ShopUpdateValuesHandler(Sender: TObject; Shop: TObject);
begin
If Assigned(fOnShopValuesUpdate) and (Sender is TILItem) and (Shop is TILItemShop) then
fOnShopValuesUpdate(Self,Sender,Shop);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ShopUpdateAvailHistoryHandler(Sender: TObject; Shop: TObject);
begin
If Assigned(fOnShopAvailHistoryUpd) and (Sender is TILItem) and (Shop is TILItemShop) then
fOnShopAvailHistoryUpd(Self,Sender,Shop);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ShopUpdatePriceHistoryHandler(Sender: TObject; Shop: TObject);
begin
If Assigned(fOnShopPriceHistoryUpd) and (Sender is TILItem) and (Shop is TILItemShop) then
fOnShopPriceHistoryUpd(Self,Sender,Shop);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateMainListHandler(Sender: TObject);
begin
UpdateMainList;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateSmallListHandler(Sender: TObject);
begin
UpdateSmallList;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateMiniListHandler(Sender: TObject);
begin
UpdateMiniList;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateOverviewHandler(Sender: TObject);
begin
UpdateOverview;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateTitleHandler(Sender: TObject);
begin
If Assigned(fOnItemTitleUpdate) and (Sender is TILItem) then
fOnItemTitleUpdate(Self,Sender);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdatePicturesHandler(Sender: TObject);
begin
If Assigned(fOnItemPicturesUpdate) and (Sender is TILItem) then
fOnItemPicturesUpdate(Self,Sender);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateFlagsHandler(Sender: TObject);
begin
If Assigned(fOnItemFlagsUpdate) and (Sender is TILItem) then
fOnItemFlagsUpdate(Self,Sender);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateValuesHandler(Sender: TObject);
begin
If Sender is TILItem then
begin
If Assigned(fOnItemValuesUpdate) then
fOnItemValuesUpdate(Self,Sender);
If Assigned(fOnItemShopListValuesUpdate) then
fOnItemShopListValuesUpdate(Self,Sender);
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateOthersHandler(Sender: TObject);
begin
If Assigned(fOnItemOthersUpdate) and (Sender is TILItem) then
fOnItemOthersUpdate(Self,Sender);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemUpdateShopListHandler(Sender: TObject);
begin
If Assigned(fOnItemShopListUpdate) and (Sender is TILItem) then
fOnItemShopListUpdate(Self,Sender);
end;
//------------------------------------------------------------------------------
Function TILManager_Base.ItemPasswordRequestHandler(Sender: TObject; out Password: String): Boolean;
begin
Password := '';
If not fHasItemsPassword then
RequestItemsPassword; // prompt for password, changes fItemsPassword
If fHasItemsPassword then
begin
Password := fItemsPassword;
Result := True;
end
else Result := False;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.UpdateMainList;
begin
If Assigned(fOnMainListUpdate) and (fUpdateCounter <= 0) then
fOnMainListUpdate(Self);
Include(fUpdated,ilmufMainList);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.UpdateSmallList;
begin
If Assigned(fOnSmallListUpdate) and (fUpdateCounter <= 0) then
fOnSmallListUpdate(Self);
Include(fUpdated,ilmufSmallList);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.UpdateMiniList;
begin
If Assigned(fOnMiniListUpdate) and (fUpdateCounter <= 0) then
fOnMiniListUpdate(Self);
Include(fUpdated,ilmufMiniList);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.UpdateOverview;
begin
If Assigned(fOnOverviewUpdate) and (fUpdateCounter <= 0) then
fOnOverviewUpdate(Self);
Include(fUpdated,ilmufOverview);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.UpdateSettings;
begin
If Assigned(fOnSettingsChange) and (fUpdateCounter <= 0) then
fOnSettingsChange(Self);
Include(fUpdated,ilmufSettings);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.RequestItemsPassword;
begin
// just a caller...
If Assigned(fOnItemsPasswordRequest) then
fOnItemsPasswordRequest(Self);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.UpdateList;
begin
UpdateMainList;
UpdateSmallList;
UpdateMiniList;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.InitializeStaticSettings;
var
CommandData: TCLPParameter;
CMDLineParser: TCLPParser;
begin
CMDLineParser := TCLPParser.Create;
try
fStaticSettings.NoPictures := CMDLineParser.CommandPresent('no_pics');
fStaticSettings.TestCode := CMDLineParser.CommandPresent('test_code');
fStaticSettings.SavePages := CMDLineParser.CommandPresent('save_pages');
fStaticSettings.LoadPages := CMDLineParser.CommandPresent('load_pages');
fStaticSettings.NoSave := CMDLineParser.CommandPresent('no_save');
fStaticSettings.NoBackup := CMDLineParser.CommandPresent('no_backup');
fStaticSettings.NoUpdateAutoLog := CMDLineParser.CommandPresent('no_updlog');
// note that list_override also disables backups (equivalent to no_backup)
fStaticSettings.ListOverride := False;
fStaticSettings.NoParse := CMDLineParser.CommandPresent('no_parse');
fStaticSettings.DefaultPath := IL_ExtractFilePath(IL_ExpandFileName(RTLToStr(ParamStr(0))));
fStaticSettings.ListPath := fStaticSettings.DefaultPath;
fStaticSettings.ListFile := fStaticSettings.ListPath + IL_DEFAULT_LIST_FILENAME;
If CMDLineParser.CommandPresent('list_override') then
begin
CMDLineParser.GetCommandData('list_override',CommandData);
If Length(CommandData.Arguments) > 0 then
begin
fStaticSettings.ListOverride := True;
fStaticSettings.ListFile := IL_ExpandFileName(CommandData.Arguments[Low(CommandData.Arguments)]);
fStaticSettings.ListPath := IL_ExtractFilePath(fStaticSettings.ListFile);
end;
end;
fStaticSettings.ListName := IL_ExtractFileNameNoExt(fStaticSettings.ListFile);
fStaticSettings.InstanceID := IL_LowerCase(CRC32ToStr(StringCRC32(IL_LowerCase(fStaticSettings.ListPath))));
// paths
fStaticSettings.PicturesPath := IL_IncludeTrailingPathDelimiter(
fStaticSettings.ListPath + fStaticSettings.ListName + '_pics');
fStaticSettings.BackupPath := IL_IncludeTrailingPathDelimiter(
fStaticSettings.ListPath + fStaticSettings.ListName + '_backup');
fStaticSettings.SavedPagesPath := IL_IncludeTrailingPathDelimiter(
fStaticSettings.ListPath + fStaticSettings.ListName + '_saved_pages');
fStaticSettings.TempPath := IL_Format('%sIL_temp_%s\',[IL_GetTempPath,fStaticSettings.InstanceID]);
IL_CreateDirectoryPath(fStaticSettings.TempPath);
finally
CMDLineParser.Free;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.FinalizeStaticSettings;
begin
If fMainManager then
IL_DeleteDir(fStaticSettings.TempPath);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.Initialize;
begin
fMainManager := False;
fTransient := False;
InitializeStaticSettings;
fDataProvider := TILDataProvider.Create;
fBackupManager := TILBackupManager.Create;
fBackupManager.StaticSettings := fStaticSettings;
fBackupManager.LoadBackups;
fSorting := False;
fUpdateCounter := 0;
fUpdated := [];
// encryption
fEncrypted := False;
fListPassword := '';
fHasItemsPassword := False;
fItemsPassword := '';
fCompressed := False;
// list
SetLength(fList,0);
fCount := 0;
fNotes := '';
fListName := '';
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.Finalize;
begin
ItemClear;
SetLength(fList,0);
FreeAndNil(fBackupManager);
FreeAndNil(fDataProvider); // no need to save backups, they are saved in backup itself
FinalizeStaticSettings;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ReIndex;
var
i: Integer;
begin
For i := ItemLowIndex to ItemHighIndex do
fList[i].Index := i;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ThisCopyFrom_Base(Source: TILManager_Base; UniqueCopy: Boolean);
var
i: Integer;
begin
// implements CopyFrom for this one class, no inheritance
// properties
fTransient := Source.Transient;
fStaticSettings := IL_THreadSafeCopy(Source.StaticSettings);
fEncrypted := Source.Encrypted;
fListPassword := Source.ListPassword;
UniqueString(fListPassword);
fCompressed := Source.Compressed;
fHasItemsPassword := Source.HasItemsPassword;
fItemsPassword := Source.ItemsPassword;
UniqueString(fItemsPassword);
// free existing items
For i := ItemLowIndex to ItemHighIndex do
FreeAndNil(fList[i]);
// copy items
SetLength(fList,Source.ItemCount);
fCount := Source.ItemCount;
For i := ItemLowIndex to ItemHighIndex do
begin
fList[i] := TILItem.CreateAsCopy(fDataProvider,Source[i],True,UniqueCopy);
fList[i].Index := i;
fList[i].DeferredLoadProcNum := Source[i].DeferredLoadProcNum;
end;
AssignInternalEventHandlers;
// other data
fNotes := Source.Notes;
UniqueString(fNotes);
fListName := Source.ListName;
UniqueString(fListName);
end;
//==============================================================================
constructor TILManager_Base.Create;
begin
inherited Create;
Initialize;
end;
//------------------------------------------------------------------------------
constructor TILManager_Base.CreateAsCopy(Source: TILManager_Base; UniqueCopy: Boolean);
var
i: Integer;
begin
Create;
fStaticSettings := IL_ThreadSafeCopy(Source.StaticSettings);
{
data provider was already created in a call to Create, no need to recreate it
but recreate backup manager
}
FreeAndNil(fBackupManager);
fBackupManager := TILBackupManager.CreateAsCopy(Source.BackupManager,UniqueCopy);
fEncrypted := Source.Encrypted;
fListPassword := Source.ListPassword;
UniqueString(fListPassword);
fCompressed := Source.Compressed;
fHasItemsPassword := Source.HasItemsPassword;
fItemsPassword := Source.ItemsPassword;
UniqueString(fItemsPassword);
// copy the list
Capacity := Source.Count;
fCount := Source.Count;
For i := Source.LowIndex to Source.HighIndex do
begin
fList[i] := TILItem.CreateAsCopy(fDataProvider,Source[i],True,UniqueCopy);
fList[i].Index := i;
{
assign deffered read handler in case the item copied was
encrypted - there might be a need to decrypt and load it
}
fList[i].DeferredLoadProcNum := Source[i].DeferredLoadProcNum;
end;
AssignInternalEventHandlers;
fCount := Source.Count;
// other data
fNotes := Source.Notes;
UniqueString(fNotes);
fListName := Source.ListName;
UniqueString(fListName);
end;
//------------------------------------------------------------------------------
constructor TILManager_Base.CreateTransient;
begin
inherited Create;
fTransient := True;
{
No field is initialized, no internal object created.
This means instance created by calling this constructor can be used only for
specific purposes.
At this moment, only following methods and properties/fields can be safely
accessed:
- property Transient
- method PreloadStream
- method PreloadFile(String) - only this one overload!
No other method should be called, and no property/field accesses.
}
end;
//------------------------------------------------------------------------------
destructor TILManager_Base.Destroy;
begin
If not fTransient then
Finalize;
inherited;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.CopyFrom(Source: TILManager_Base; UniqueCopy: Boolean);
begin
{
copies all data and non-transient, non-object properties from the source,
replacing existing data and values
}
ThisCopyFrom_Base(Source,UniqueCopy);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.BeginUpdate;
begin
If fUpdateCounter <= 0 then
fUpdated := [];
Inc(fUpdateCounter);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.EndUpdate;
begin
Dec(fUpdateCounter);
If fUpdateCounter <= 0 then
begin
fUpdateCounter := 0;
If ilmufMainList in fUpdated then
UpdateMainList;
If ilmufSmallList in fUpdated then
UpdateSmallList;
If ilmufMiniList in fUpdated then
UpdateMiniList;
If ilmufOverview in fUpdated then
UpdateOverview;
If ilmufSettings in fUpdated then
UpdateSettings;
fUpdated := [];
end;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.LowIndex: Integer;
begin
Result := Low(fList);
end;
//------------------------------------------------------------------------------
Function TILManager_Base.HighIndex: Integer;
begin
Result := Pred(fCount);
end;
//------------------------------------------------------------------------------
Function TILManager_Base.ItemLowIndex: Integer;
begin
Result := LowIndex;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.ItemHighIndex: Integer;
begin
Result := HighIndex;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.ItemIndexOf(ItemUniqueID: TGUID): Integer;
var
i: Integer;
begin
Result := -1;
For i := ItemLowIndex to ItemHighIndex do
If fList[i].DataAccessible then
If IsEqualGUID(ItemUniqueID,fList[i].UniqueID) then
begin
Result := i;
Break{For i};
end;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.ItemAddEmpty(Index: Integer = -1): Integer;
var
i: Integer;
begin
Grow;
If CheckIndex(Index) then
begin
// move existing items
For i := ItemHighIndex downto Index do
fList[i + 1] := fList[i];
Result := Index;
end
else Result := fCount;
fList[Result] := TILItem.Create(fDataProvider);
fList[Result].Index := Result;
fList[Result].StaticSettings := fStaticSettings;
fList[Result].AssignInternalEvents(
ShopUpdateShopListItemHandler,
ShopUpdateValuesHandler,
ShopUpdateAvailHistoryHandler,
ShopUpdatePriceHistoryHandler,
ItemUpdateMainListHandler,
ItemUpdateSmallListHandler,
ItemUpdateMiniListHandler,
ItemUpdateOverviewHandler,
ItemUpdateTitleHandler,
ItemUpdatePicturesHandler,
ItemUpdateFlagsHandler,
ItemUpdateValuesHandler,
ItemUpdateOthersHandler,
ItemUpdateShopListHandler,
ItemPasswordRequestHandler);
Inc(fCount);
ReIndex; // in case of onsertion, otherwise not really needed
UpdateList;
UpdateOverview;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.ItemAddCopy(SrcIndex: Integer; Index: Integer = -1): Integer;
var
i: Integer;
SrcObj: TILItem;
begin
If CheckIndex(SrcIndex) then
begin
SrcObj := fList[SrcIndex];
If SrcObj.DataAccessible then
begin
Grow;
If CheckIndex(Index) then
begin
For i := ItemHighIndex downto Index do
fList[i + 1] := fList[i];
Result := Index;
end
else Result := fCount;
fList[Result] := TILItem.CreateAsCopy(fDataProvider,SrcObj,True,True);
fList[Result].Index := Result;
fList[Result].AssignInternalEvents(
ShopUpdateShopListItemHandler,
ShopUpdateValuesHandler,
ShopUpdateAvailHistoryHandler,
ShopUpdatePriceHistoryHandler,
ItemUpdateMainListHandler,
ItemUpdateSmallListHandler,
ItemUpdateMiniListHandler,
ItemUpdateOverviewHandler,
ItemUpdateTitleHandler,
ItemUpdatePicturesHandler,
ItemUpdateFlagsHandler,
ItemUpdateValuesHandler,
ItemUpdateOthersHandler,
ItemUpdateShopListHandler,
ItemPasswordRequestHandler);
Inc(fCount);
ReIndex;
UpdateList;
UpdateOverview;
end
else raise Exception.Create('TILManager_Base.ItemAddCopy: Cannot create copy of encrypted item.');
end
else raise Exception.CreateFmt('TILManager_Base.ItemAddCopy: Source index (%d) out of bounds.',[SrcIndex]);
end;
//------------------------------------------------------------------------------
Function TILManager_Base.ItemAddSplitOutCopy(SrcIndex: Integer; Index: Integer = -1): Integer;
var
i: Integer;
SrcObj: TILItem;
begin
If CheckIndex(SrcIndex) then
begin
SrcObj := fList[SrcIndex];
If SrcObj.DataAccessible then
begin
If SrcObj.Pieces > 1 then
begin
Grow;
If CheckIndex(Index) then
begin
For i := ItemHighIndex downto Index do
fList[i + 1] := fList[i];
Result := Index;
end
else Result := fCount;
fList[Result] := TILItem.CreateAsCopy(fDataProvider,SrcObj,True,True);
fList[Result].Index := Result;
fList[Result].Pieces := 1; // set before assigning events
fList[Result].AssignInternalEvents(
ShopUpdateShopListItemHandler,
ShopUpdateValuesHandler,
ShopUpdateAvailHistoryHandler,
ShopUpdatePriceHistoryHandler,
ItemUpdateMainListHandler,
ItemUpdateSmallListHandler,
ItemUpdateMiniListHandler,
ItemUpdateOverviewHandler,
ItemUpdateTitleHandler,
ItemUpdatePicturesHandler,
ItemUpdateFlagsHandler,
ItemUpdateValuesHandler,
ItemUpdateOthersHandler,
ItemUpdateShopListHandler,
ItemPasswordRequestHandler);
SrcObj.Pieces := SrcObj.Pieces - 1;
Inc(fCount);
ReIndex;
UpdateList;
UpdateOverview;
end
else raise Exception.Create('TILManager_Base.ItemAddSplitOutCopy: Cannot create split-out copy, too few pieces.');
end
else raise Exception.Create('TILManager_Base.ItemAddSplitOutCopy: Cannot create copy of encrypted item.');
end
else raise Exception.CreateFmt('TILManager_Base.ItemAddSplitOutCopy: Source index (%d) out of bounds.',[SrcIndex]);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemExchange(Idx1,Idx2: Integer);
var
Temp: TILItem;
begin
If Idx1 <> Idx2 then
begin
// sanity checks
If not CheckIndex(Idx1) then
raise Exception.CreateFmt('TILManager_Base.ItemExchange: Index 1 (%d) out of bounds.',[Idx1]);
If not CheckIndex(Idx2) then
raise Exception.CreateFmt('TILManager_Base.ItemExchange: Index 2 (%d) out of bounds.',[Idx1]);
Temp := fList[Idx1];
fList[Idx1] := fList[Idx2];
fList[Idx2] := Temp;
If not fSorting then
begin
// full reindex not needed
fList[Idx1].Index := Idx1;
fList[Idx2].Index := Idx2;
UpdateList;
end;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemMove(Src,Dst: Integer);
var
Temp: TILItem;
i: Integer;
begin
If Src <> Dst then
begin
// sanity checks
If not CheckIndex(Src) then
raise Exception.CreateFmt('TILManager_Base.ItemMove: Source index (%d) out of bounds.',[Src]);
If not CheckIndex(Dst) then
raise Exception.CreateFmt('TILManager_Base.ItemMove: Destination index (%d) out of bounds.',[Dst]);
Temp := fList[Src];
If Src < Dst then
begin
// move items down one place
For i := Src to Pred(Dst) do
fList[i] := fList[i + 1];
end
else
begin
// move items up one place
For i := Src downto Succ(Dst) do
fList[i] := fList[i - 1];
end;
fList[Dst] := Temp;
ReIndex;
UpdateList;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemDelete(Index: Integer);
var
i: Integer;
begin
If CheckIndex(Index) then
begin
FreeAndNil(fList[Index]);
For i := Index to Pred(ItemHighIndex) do
fList[i] := fList[i + 1];
Dec(fCount);
Shrink;
ReIndex;
UpdateList;
UpdateOverview;
end
else raise Exception.CreateFmt('TILManager_Base.ItemDelete: Index (%d) out of bounds.',[Index]);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ItemClear;
var
i: Integer;
begin
For i := ItemLowIndex to ItemHighIndex do
FreeAndNil(fList[i]);
fCount := 0;
Shrink;
UpdateList;
UpdateOverview;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ReinitMainDrawSize(MainWidth,MainHeight: Integer; MainFont: TFont);
var
i: Integer;
begin
BeginUpdate;
try
For i := ItemLowIndex to ItemHighIndex do
fList[i].ReinitMainDrawSize(MainWidth,MainHeight,MainFont);
finally
EndUpdate;
end;
end;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
procedure TILManager_Base.ReinitMainDrawSize(MainList: TListBox);
var
i: Integer;
begin
BeginUpdate;
try
For i := ItemLowIndex to ItemHighIndex do
fList[i].ReinitMainDrawSize(MainList);
finally
EndUpdate;
end;
end;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
procedure TILManager_Base.ReinitMainDrawSize(MainList: TListBox; OnlyVisible: Boolean);
var
i: Integer;
begin
If OnlyVisible and CheckIndex(MainList.TopIndex) and
CheckIndex(Pred(MainList.TopIndex + MainList.ClientHeight div MainList.ItemHeight)) then
begin
BeginUpdate;
try
For i := MainList.TopIndex to Pred(MainList.TopIndex + MainList.ClientHeight div MainList.ItemHeight) do
fList[i].ReinitMainDrawSize(MainList);
finally
EndUpdate;
end;
end
else
begin
BeginUpdate;
try
For i := ItemLowIndex to ItemHighIndex do
fList[i].ReinitMainDrawSize(MainList);
finally
EndUpdate;
end;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ReinitSmallDrawSize(SmallWidth,SmallHeight: Integer; SmallFont: TFont);
var
i: Integer;
begin
BeginUpdate;
try
For i := ItemLowIndex to ItemHighIndex do
fList[i].ReinitSmallDrawSize(SmallWidth,SmallHeight,SmallFont);
finally
EndUpdate;
end;
end;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
procedure TILManager_Base.ReinitSmallDrawSize(SmallList: TListBox);
var
i: Integer;
begin
BeginUpdate;
try
For i := ItemLowIndex to ItemHighIndex do
fList[i].ReinitSmallDrawSize(SmallList);
finally
EndUpdate;
end;
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.ReinitMiniDrawSize(MiniWidth,MiniHeight: Integer; MiniFont: TFont);
var
i: Integer;
begin
BeginUpdate;
try
For i := ItemLowIndex to ItemHighIndex do
fList[i].ReinitMiniDrawSize(MiniWidth,MiniHeight,MiniFont);
finally
EndUpdate;
end;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.SortingItemStr(const SortingItem: TILSortingItem): String;
begin
Result := IL_Format('%s %s',[IL_BoolToStr(SortingItem.Reversed,'+','-'),
fDataProvider.GetItemValueTagString(SortingItem.ItemValueTag)])
end;
//------------------------------------------------------------------------------
Function TILManager_Base.TotalPictureCount: Integer;
var
i: Integer;
begin
Result := 0;
For i := ItemLowIndex to ItemhighIndex do
If fList[i].DataAccessible then
Inc(Result,fList[i].Pictures.Count);
end;
//------------------------------------------------------------------------------
procedure TILManager_Base.AssignInternalEventHandlers;
var
i: Integer;
begin
For i := ItemLowIndex to ItemhighIndex do
begin
fList[i].AssignInternalEventHandlers;
fList[i].AssignInternalEvents(
ShopUpdateShopListItemHandler,
ShopUpdateValuesHandler,
ShopUpdateAvailHistoryHandler,
ShopUpdatePriceHistoryHandler,
ItemUpdateMainListHandler,
ItemUpdateSmallListHandler,
ItemUpdateMiniListHandler,
ItemUpdateOverviewHandler,
ItemUpdateTitleHandler,
ItemUpdatePicturesHandler,
ItemUpdateFlagsHandler,
ItemUpdateValuesHandler,
ItemUpdateOthersHandler,
ItemUpdateShopListHandler,
ItemPasswordRequestHandler);
end;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.EncryptedItemCount(CountDecrypted: Boolean): Integer;
var
i: Integer;
begin
Result := 0;
For i := ItemLowIndex to ItemHighIndex do
If fList[i].Encrypted and (not fList[i].DataAccessible or CountDecrypted) then
Inc(Result);
end;
//------------------------------------------------------------------------------
Function TILManager_Base.CheckItemPassword(const Password: String): Boolean;
var
i: Integer;
begin
Result := True;
For i := ItemLowIndex to ItemHighIndex do
If fList[i].Encrypted and not fList[i].DataAccessible then
begin
// try it only on the first encountered item
Result := fList[i].TryDecrypt(Password);
Break{For i};
end;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.DecryptAllItems: Integer;
var
i: Integer;
Dummy: String;
begin
Result := 0;
If (EncryptedItemCount(False) > 0) and ItemPasswordRequestHandler(Self,Dummy) then
For i := ItemLowIndex to ItemHighIndex do
If fList[i].Encrypted and not fList[i].DataAccessible then
begin
fList[i].Decrypt;
Inc(Result);
end;
end;
//------------------------------------------------------------------------------
Function TILManager_Base.GenerateUserID(out NewID: String): Boolean;
var
i: Integer;
Temp: Integer;
Taken: TBitVector;
begin
NewID := '';
Result := False;
Taken := TBitVector.Create(10000);
try
Taken[0] := True; // ID 0 is not allowed
For i := ItemLowIndex to ItemHighIndex do
If fList[i].DataAccessible then
If TryStrToInt(fList[i].UserID,Temp) then
If (Temp > 0) and (Temp < Taken.Count) then
Taken[Temp] := True;
// find first unassigned id
i := Taken.FirstClean;
If i > 0 then
begin
NewId := IL_Format('%.4d',[i]);
Result := True;
end;
finally
Taken.Free;
end;
end;
end.
|
unit UpShablonText;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, FIBDatabase, pFIBDatabase,
FIBDataSet, pFIBDataSet, cxGridTableView, ImgList, cxGridLevel,
cxGridCustomTableView, cxGridDBTableView, cxClasses, cxControls,
cxGridCustomView, cxGrid, ComCtrls, ToolWin, UpEditText, pFibStoredProc,
BaseTypes, Ibase;
type
TfrmShablonText = class(TForm)
ToolBar1: TToolBar;
btnAdd: TToolButton;
btnDel: TToolButton;
btnEdit: TToolButton;
RefreshButton: TToolButton;
btnSel: TToolButton;
btnClose: TToolButton;
TextGrid: TcxGrid;
TextView: TcxGridDBTableView;
TextViewDBColumn1: TcxGridDBColumn;
TextLevel: TcxGridLevel;
IL_Orders: TImageList;
StyleRepository: TcxStyleRepository;
stBackground: TcxStyle;
stContent: TcxStyle;
stContentEven: TcxStyle;
stContentOdd: TcxStyle;
stFilterBox: TcxStyle;
stFooter: TcxStyle;
stGroup: TcxStyle;
stGroupByBox: TcxStyle;
stHeader: TcxStyle;
stInactive: TcxStyle;
stIncSearch: TcxStyle;
stIndicator: TcxStyle;
stPreview: TcxStyle;
stSelection: TcxStyle;
stHotTrack: TcxStyle;
ContentError: TcxStyle;
qizzStyle: TcxGridTableViewStyleSheet;
TextDS: TpFIBDataSet;
dsTextDSet: TDataSource;
WorkDatabase: TpFIBDatabase;
ReadTransaction: TpFIBTransaction;
WriteTransaction: TpFIBTransaction;
procedure btnAddClick(Sender: TObject);
procedure btnSelClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure btnDelClick(Sender: TObject);
procedure RefreshButtonClick(Sender: TObject);
procedure btnEditClick(Sender: TObject);
procedure TextViewDblClick(Sender: TObject);
procedure TextViewKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
id_type_text: Integer;
public
{ Public declarations }
shablon_text: string;
constructor Create(AOwner: TComponent; id_type_texts: Integer; DbHandle: TISC_DB_HANDLE); reintroduce;
end;
var
frmShablonText: TfrmShablonText;
implementation
{$R *.dfm}
uses UpKernelUnit;
procedure TfrmShablonText.btnAddClick(Sender: TObject);
var T: TfrmShablonEdit;
SP: TpFibStoredProc;
ID_SHABLON: Integer;
begin
T := TfrmShablonEdit.Create(self);
T.Caption := 'Додати назву';
if T.ShowModal = mrYes
then begin
SP := TpFibStoredProc.Create(self);
SP.Database := WorkDatabase;
SP.Transaction := WriteTransaction;
WriteTransaction.StartTransaction;
SP.StoredProcName := 'UP_DT_TEXT_SHABLONS_INS_UPD';
SP.Prepare;
SP.ParamByName('ID_SH').Value := null;
SP.ParamByName('TEXT1').Value := T.cxMemoText.Text;
SP.ParamByName('ID_SHABLON_TYPE').Value := id_type_text;
SP.ExecProc;
ID_SHABLON := SP.ParamByName('ID_SHABLON').Value;
SP.Close;
SP.Free;
WriteTransaction.Commit;
TextDS.CloseOpen(true);
TextDS.Locate('ID_SHABLON', ID_SHABLON, []);
end;
T.Free;
end;
procedure TfrmShablonText.btnSelClick(Sender: TObject);
begin
if (TextDS.RecordCount > 0)
then begin
shablon_text := TextDS.FieldByName('text1').AsString;
ModalResult := mrYes;
end;
end;
procedure TfrmShablonText.btnCloseClick(Sender: TObject);
begin
ModalResult := mrNo;
end;
procedure TfrmShablonText.btnDelClick(Sender: TObject);
var SP: TpFibStoredProc;
begin
if (TextDS.RecordCount > 0)
then begin
if agMessageDlg('Увага!', 'Ви хочете вилучити запис?', mtConfirmation, [mbYes, mbNo]) = mrYes
then begin
SP := TpFibStoredProc.Create(self);
SP.Database := WorkDatabase;
SP.Transaction := WriteTransaction;
WriteTransaction.StartTransaction;
SP.StoredProcName := 'UP_DT_TEXT_SHABLONS_DEL';
SP.Prepare;
SP.ParamByName('ID_SHABLON').Value := TextDS.FieldByName('ID_SHABLON').Value;
SP.ExecProc;
SP.Close;
SP.Free;
WriteTransaction.Commit;
TextDS.CacheDelete;
end;
end;
end;
procedure TfrmShablonText.RefreshButtonClick(Sender: TObject);
begin
TextDS.CloseOpen(true);
end;
constructor TfrmShablonText.Create(AOwner: TComponent;
id_type_texts: Integer; DbHandle: TISC_DB_HANDLE);
begin
inherited Create(AOwner);
id_type_text := id_type_texts;
WorkDatabase.Handle := DbHandle;
ReadTransaction.StartTransaction;
TextDS.SelectSQL.Text := 'select * from up_get_text_shablon(' + IntToStr(id_type_text) + ')';
TextDS.Open;
end;
procedure TfrmShablonText.btnEditClick(Sender: TObject);
var T: TfrmShablonEdit;
SP: TpFibStoredProc;
ID_SHABLON: Integer;
begin
T := TfrmShablonEdit.Create(self);
T.Caption := 'Змінити назву';
T.cxMemoText.EditValue := TextDS.FieldByName('TEXT1').Value;
if T.ShowModal = mrYes
then begin
SP := TpFibStoredProc.Create(self);
SP.Database := WorkDatabase;
SP.Transaction := WriteTransaction;
WriteTransaction.StartTransaction;
SP.StoredProcName := 'UP_DT_TEXT_SHABLONS_INS_UPD';
SP.Prepare;
ID_SHABLON := TextDS.FieldByName('ID_SHABLON').Value;
SP.ParamByName('ID_SH').Value := ID_SHABLON;
SP.ParamByName('TEXT1').Value := T.cxMemoText.Text;
SP.ParamByName('ID_SHABLON_TYPE').Value := id_type_text;
SP.ExecProc;
SP.Close;
SP.Free;
WriteTransaction.Commit;
TextDS.CloseOpen(true);
TextDS.Locate('ID_SHABLON', ID_SHABLON, []);
end;
T.Free;
end;
procedure TfrmShablonText.TextViewDblClick(Sender: TObject);
begin
if (TextDS.RecordCount > 0)
then begin
shablon_text := TextDS.FieldByName('text1').AsString;
ModalResult := mrYes;
end;
end;
procedure TfrmShablonText.TextViewKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if TextDS.RecordCount > 0
then
begin
if ((Key = VK_INSERT) and (btnAdd.Enabled))
then btnAdd.Click;
if ((Key = VK_F2) and (btnEdit.Enabled))
then btnEdit.Click;
if ((Key = VK_DELETE) and (btnDel.Enabled))
then btnDel.Click;
if ((Key = VK_F5) and (RefreshButton.Enabled))
then RefreshButton.Click;
if ((Key = VK_ESCAPE) and (btnClose.Enabled))
then btnClose.Click;
if ((Key = VK_RETURN) and (btnSel.Enabled))
then
begin
if (TextDS.RecordCount > 0)
then begin
shablon_text := TextDS.FieldByName('text1').AsString;
ModalResult := mrYes;
end;
end;
if ((Key = VK_F12) and (ssShift in Shift))
then ShowInfo(TextDS);
end
end;
end.
|
unit InflatablesList_ShopUpdater;
{$INCLUDE '.\InflatablesList_defs.inc'}
interface
uses
Classes,
AuxTypes,
InflatablesList_Types,
InflatablesList_HTML_Document,
InflatablesList_HTML_ElementFinder,
InflatablesList_ItemShop_Update;
type
TILShopUpdaterResult = (
ilurSuccess, // all is well - both price and avail count are valid
ilurDownSuccess, // download was successful, parsing is disabled
ilurNoLink, // no download link defined - avail and price both invalid
ilurNoData, // insufficient search data - avail and price both invalid
ilurFailDown, // failed to download the web page - avail and price both invalid
ilurFailParse, // failed to parse the web page - avail and price both invalid
ilurFailAvailSearch, // avail count cannot be found - avail is 0, price is valid
ilurFailSearch, // price (or both price and avail) cannot be found - avail and price both invalid
ilurFailAvailValGet, // cannot get value for avail count - avail is 0, price is valid
ilurFailValGet, // cannot get value for price (or both price and avail) - avail and price both invalid
ilurFail); // general failure, avail and price both invalid
TILShopUpdater = class(TObject)
private
fShopObject: TILItemShop_Update;
// internals
fDownStream: TMemoryStream;
// results
fDownResCode: Integer;
fDownSize: Int64;
fErrorString: String;
fAvailable: Int32;
fPrice: UInt32;
protected
procedure InitializeResults; virtual;
Function FindElementNode(Document: TILHTMLDocument; Finder: TILElementFinder): TILHTMLElements; virtual;
Function ExtractValue_FirstInteger(const Text: String): UInt32; overload; virtual;
Function ExtractValue_FirstInteger(const Text: TILReconvString): UInt32; overload; virtual;
Function ExtractValue_ContainsTag(const Text,Tag: String): Boolean; overload; virtual;
Function ExtractValue_ContainsTag(const Text: TILReconvString; const Tag: String): Boolean; overload; virtual;
Function ExtractValue_FirstNumber(const Text: String): UInt32; overload; virtual;
Function ExtractValue_FirstNumber(const Text: TILReconvString): UInt32; overload; virtual;
Function ExtractValue_GetText(Node: TILHTMLElementNode; ExtractFrom: TILItemShopParsingExtrFrom; const Data: String): TILReconvString; virtual;
Function ExtractAvailable(Nodes: TILHTMLElements): Int32; virtual;
Function ExtractPrice(Nodes: TILHTMLElements): UInt32; virtual;
public
constructor Create(ShopObject: TILItemShop_Update);
destructor Destroy; override;
Function Run(AlternativeDownload: Boolean): TILShopUpdaterResult; virtual;
property DownloadResultCode: Integer read fDownResCode;
property DownloadSize: Int64 read fDownSize;
property ErrorString: String read fErrorString;
property Available: Int32 read fAvailable;
property Price: UInt32 read fPrice;
end;
implementation
uses
SysUtils, SyncObjs,
CRC32, StrRect,
InflatablesList_Utils,
InflatablesList_HTML_Download,
InflatablesList_HTML_Parser;
var
PageSaveSync: TCriticalSection = nil;
procedure TILShopUpdater.InitializeResults;
begin
fDownResCode := 0;
fDownSize := 0;
fErrorString := '';
fAvailable := 0;
fPrice := 0;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.FindElementNode(Document: TILHTMLDocument; Finder: TILElementFinder): TILHTMLElements;
begin
If not Finder.FindElements(Document,Result) then
Result := nil;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.ExtractValue_FirstInteger(const Text: String): UInt32;
var
i: Integer;
Buff: String;
begin
Buff := '';
For i := 1 to Length(Text) do
begin
If IL_CharInSet(Text[i],['0'..'9']) then
Buff := Buff + Text[i]
else If IL_CharInSet(Text[i],[#0..#32,#160]) then
Continue // ignore character
else If Length(Buff) > 0 then
Break{For i};
end;
Result := StrToIntDef(Buff,0);
end;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Function TILShopUpdater.ExtractValue_FirstInteger(const Text: TILReconvString): UInt32;
begin
Result := ExtractValue_FirstInteger(Text.Str);
If Result = 0 then
begin
Result := ExtractValue_FirstInteger(Text.UTF8Reconv);
If Result = 0 then
Result := ExtractValue_FirstInteger(Text.AnsiReconv);
end;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.ExtractValue_ContainsTag(const Text,Tag: String): Boolean;
begin
If Length(Tag) > 0 then
Result := IL_ContainsText(Text,Tag)
else
Result := True;
end;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Function TILShopUpdater.ExtractValue_ContainsTag(const Text: TILReconvString; const Tag: String): Boolean;
begin
Result := ExtractValue_ContainsTag(Text.Str,Tag);
If not Result then
begin
Result := ExtractValue_ContainsTag(Text.UTF8Reconv,Tag);
If not Result then
Result := ExtractValue_ContainsTag(Text.AnsiReconv,Tag);
end;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.ExtractValue_FirstNumber(const Text: String): UInt32;
var
i: Integer;
Buff: String;
begin
Buff := '';
For i := 1 to Length(Text) do
begin
If IL_CharInSet(Text[i],['0'..'9']) then
Buff := Buff + Text[i]
else If IL_CharInSet(Text[i],[#0..#32,#160,'.',',','-']) then
Continue // ignore character
else If Length(Buff) > 0 then
Break{For i};
end;
Result := StrToIntDef(Buff,0);
end;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Function TILShopUpdater.ExtractValue_FirstNumber(const Text: TILReconvString): UInt32;
begin
Result := ExtractValue_FirstNumber(Text.Str);
If Result = 0 then
begin
Result := ExtractValue_FirstNumber(Text.UTF8Reconv);
If Result = 0 then
Result := ExtractValue_FirstNumber(Text.AnsiReconv);
end;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.ExtractValue_GetText(Node: TILHTMLElementNode; ExtractFrom: TILItemShopParsingExtrFrom; const Data: String): TILReconvString;
var
Index: Integer;
begin
// no need to care for thread safety as result does not leave this object
Result := IL_ReconvString('');
case ExtractFrom of
ilpefNestedText: Result := Node.NestedText;
ilpefAttrValue: begin
Index := Node.AttributeIndexOfName(Data);
If Index >= 0 then
Result := Node.Attributes[Index].Value;
end;
else
{ilpefText}
Result := Node.Text;
end;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.ExtractAvailable(Nodes: TILHTMLElements): Int32;
var
Text: TILReconvString;
i,j: Integer;
begin
Result := 0;
For i := 0 to Pred(fShopObject.ParsingSettings.AvailExtractionSettingsCount) do
with fShopObject.ParsingSettings.AvailExtractionSettings[i] do
begin
For j := Low(Nodes) to High(Nodes) do
begin
// first get the text from which the value will be extracted
Text := ExtractValue_GetText(Nodes[j],ExtractFrom,ExtractionData);
// parse according to selected extr. method
case ExtractionMethod of
ilpemFirstIntegerTag:
begin
Result := Int32(ExtractValue_FirstInteger(Text));
If ExtractValue_ContainsTag(Text,NegativeTag) then
Result := -Result;
end;
ilpemNegTagIsCount:
If ExtractValue_ContainsTag(Text,NegativeTag) then
Result := fShopObject.RequiredCount;
ilpemFirstNumber:
Result := Int32(ExtractValue_FirstNumber(Text));
ilpemFirstNumberTag:
begin
Result := Int32(ExtractValue_FirstNumber(Text));
If ExtractValue_ContainsTag(Text,NegativeTag) then
Result := -Result;
end;
else
{ilpemFirstInteger}
Result := Int32(ExtractValue_FirstInteger(Text));
end;
If Result <> 0 then
Break{For j};
end;
If Result <> 0 then
Break{For i};
end;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.ExtractPrice(Nodes: TILHTMLElements): UInt32;
var
Text: TILReconvString;
i,j: Integer;
begin
Result := 0;
For i := 0 to Pred(fShopObject.ParsingSettings.PriceExtractionSettingsCount) do
with fShopObject.ParsingSettings.PriceExtractionSettings[i] do
begin
For j := Low(Nodes) to High(Nodes) do
begin
// first get the text from which the value will be extracted
Text := ExtractValue_GetText(Nodes[j],ExtractFrom,ExtractionData);
// parse according to selected extr. method
case ExtractionMethod of
ilpemNegTagIsCount:
If ExtractValue_ContainsTag(Text,NegativeTag) then
Result := fShopObject.RequiredCount;
// price cannot be negative, ignore tag
ilpemFirstNumber,
ilpemFirstNumberTag:
Result := Int32(ExtractValue_FirstNumber(Text));
else
{ilpemFirstInteger,
ilpemFirstIntegerTag}
// price cannot be negative, so ignore neg. tag even when requested
Result := ExtractValue_FirstInteger(Text);
end;
If Result <> 0 then
Break{For j};
end;
If Result <> 0 then
Break{For i};
end;
end;
//==============================================================================
constructor TILShopUpdater.Create(ShopObject: TILItemShop_Update);
begin
inherited Create;
fShopObject := TILItemShop_Update.CreateAsCopy(ShopObject,True);
fDownStream := TMemoryStream.Create;
InitializeResults;
end;
//------------------------------------------------------------------------------
destructor TILShopUpdater.Destroy;
begin
fDownStream.Free;
fShopObject.Free;
inherited;
end;
//------------------------------------------------------------------------------
Function TILShopUpdater.Run(AlternativeDownload: Boolean): TILShopUpdaterResult;
var
Parser: TILHTMLParser;
Document: TILHTMLDocument;
AvailNodes: TILHTMLElements;
PriceNodes: TILHTMLElements;
ElementList: TStringList;
OfflineFile: String;
Function CallDownload: Boolean;
begin
If not fShopObject.StaticSettings.LoadPages then
begin
If AlternativeDownload then
Result := IL_WGETDownloadURL(fShopObject.ItemURL,fDownStream,fDownResCode,IL_ThreadSafeCopy(fShopObject.StaticSettings))
else
Result := IL_SYNDownloadURL(fShopObject.ItemURL,fDownStream,fDownResCode,IL_ThreadSafeCopy(fShopObject.StaticSettings));
end
else
begin
If IL_FileExists(OfflineFile) then
begin
fDownStream.LoadFromFile(StrToRTL(OfflineFile));
Result := True;
end
else Result := False;
end;
end;
begin
SetLength(AvailNodes,0);
SetLength(PriceNodes,0);
OfflineFile := fShopObject.StaticSettings.SavedPagesPath +
IL_UpperCase(CRC32ToStr(WideStringCRC32(StrToUnicode(fShopObject.ItemURL))));
If Length(fShopObject.ItemURL) > 0 then
begin
If (fShopObject.ParsingSettings.AvailFinder.StageCount > 0) and
(fShopObject.ParsingSettings.PriceFinder.StageCount > 0) then
try
InitializeResults;
// download
fDownStream.Clear;
If CallDownload then
begin
If fShopObject.StaticSettings.TestCode then
fDownStream.SaveToFile(StrToRTL(fShopObject.StaticSettings.ListPath + 'page.txt'));
If fShopObject.StaticSettings.SavePages then
begin
IL_CreateDirectoryPathForFile(OfflineFile);
PageSaveSync.Enter;
try
fDownStream.SaveToFile(StrToRTL(OfflineFile));
finally
PageSaveSync.Leave;
end;
end;
fDownSize := fDownStream.Size;
fDownStream.Seek(0,soBeginning);
If not fShopObject.StaticSettings.NoParse then
begin
// parsing
Parser := TILHTMLParser.Create(fDownStream);
try
try
Parser.RaiseParseErrors := not fShopObject.ParsingSettings.DisableParsingErrors;
Parser.Run; // whole parsing
Document := Parser.GetDocument;
try
If fShopObject.StaticSettings.TestCode then
begin
ElementList := TStringList.Create;
try
Document.List(ElementList);
ElementList.SaveToFile(StrToRTL(fShopObject.StaticSettings.ListPath + 'elements.txt'));
finally
ElementList.Free;
end;
end;
// prepare finders
fShopObject.ParsingSettings.AvailFinder.Prepare(fShopObject.ParsingSettings.VariablesRec);
fShopObject.ParsingSettings.PriceFinder.Prepare(fShopObject.ParsingSettings.VariablesRec);
// search
AvailNodes := FindElementNode(Document,fShopObject.ParsingSettings.AvailFinder);
PriceNodes := FindElementNode(Document,fShopObject.ParsingSettings.PriceFinder);
// process found nodes
If (Length(AvailNodes) > 0) and (Length(PriceNodes) > 0) then
begin
// both avail and price found
fAvailable := ExtractAvailable(AvailNodes);
fPrice := ExtractPrice(PriceNodes);
If fPrice > 0 then
begin
// price obtained
If fAvailable <> 0 then
Result := ilurSuccess
else
Result := ilurFailAvailValGet
end
else Result := ilurFailValGet;
end
else If Length(PriceNodes) > 0 then
begin
fPrice := ExtractPrice(PriceNodes);
If fPrice > 0 then
Result := ilurFailAvailSearch
else
Result := ilurFailValGet;
end
else Result := ilurFailSearch;
finally
Document.Free;
end;
except
on E: Exception do
begin
fErrorString := IL_Format('%s: %s',[E.ClassName,E.Message]);
Result := ilurFailParse;
end;
end;
finally
Parser.Free;
end;
end
else Result := ilurDownSuccess;
end
else Result := ilurFailDown;
except
on E: Exception do
begin
fErrorString := IL_Format('%s: %s',[E.ClassName,E.Message]);
Result := ilurFail;
end;
end
else Result := ilurNoData;
end
else Result := ilurNoLink;
end;
//==============================================================================
initialization
PageSaveSync := TCriticalSection.Create;
finalization
FreeAndNil(PageSaveSync);
end.
|
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : D:\DonnU\SourcesSVN\FMAS-WIN\Contingent_Student\Sources\WSDL\EDBOPersonToFMASService.wsdl
// Encoding : UTF-8
// Version : 1.0
// (12.03.2014 11:34:08 - 1.33.2.5)
// ************************************************************************ //
unit EDBOPersonToFMASService;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"
// !:int - "http://www.w3.org/2001/XMLSchema"
// !:dateTime - "http://www.w3.org/2001/XMLSchema"
// !:float - "http://www.w3.org/2001/XMLSchema"
// !:decimal - "http://www.w3.org/2001/XMLSchema"
ExtensionDataObject = class; { "http://edboservice.ua/" }
dLastError = class; { "http://edboservice.ua/" }
dQualification = class; { "http://edboservice.ua/" }
dPersonRequestSeasons = class; { "http://edboservice.ua/" }
dPersonEducationFormsGet = class; { "http://edboservice.ua/" }
dPersonAddRet = class; { "http://edboservice.ua/" }
dPersonsIds = class; { "http://edboservice.ua/" }
dPersonContacts = class; { "http://edboservice.ua/" }
dPersonsFind = class; { "http://edboservice.ua/" }
dPersonsFind2 = class; { "http://edboservice.ua/" }
dCountries = class; { "http://edboservice.ua/" }
dLanguages = class; { "http://edboservice.ua/" }
dPersonsStudentsGrups = class; { "http://edboservice.ua/" }
dPersonsStudentsGrups2 = class; { "http://edboservice.ua/" }
dPersonSOAPPhoto = class; { "http://edboservice.ua/" }
dPersonEducationHistoryTypes = class; { "http://edboservice.ua/" }
dPersonEducationHistoryOrdersStatuses = class; { "http://edboservice.ua/" }
dPersonEducationHistoryOrders = class; { "http://edboservice.ua/" }
dPersonEducationHistoryOrders2 = class; { "http://edboservice.ua/" }
dPersonDocumentTypes = class; { "http://edboservice.ua/" }
dPersonDocuments = class; { "http://edboservice.ua/" }
dPersonDocuments2 = class; { "http://edboservice.ua/" }
dPersonEducations = class; { "http://edboservice.ua/" }
dPersonEducations2 = class; { "http://edboservice.ua/" }
dPersonEducationHistoryOrdersData = class; { "http://edboservice.ua/" }
dPersonEducationHistoryOrdersData2 = class; { "http://edboservice.ua/" }
dPersonEducationHistoryOrdersChangeFIOData = class; { "http://edboservice.ua/" }
dPersonEducationHistory = class; { "http://edboservice.ua/" }
dPersonEducationHistory2 = class; { "http://edboservice.ua/" }
dPersonAddresses = class; { "http://edboservice.ua/" }
dPersonAddresses2 = class; { "http://edboservice.ua/" }
dPersonTypeDictGet = class; { "http://edboservice.ua/" }
dPersonRequests = class; { "http://edboservice.ua/" }
dPersonRequests2 = class; { "http://edboservice.ua/" }
dPersonEducationPaymentTypes = class; { "http://edboservice.ua/" }
dPersonsStudentsGrupsPersonsFind = class; { "http://edboservice.ua/" }
dPersonsStudentsGrupsPersonsFind2 = class; { "http://edboservice.ua/" }
dPersonsStudentsGrupsPersons = class; { "http://edboservice.ua/" }
dPersonsStudentsGrupsPersons2 = class; { "http://edboservice.ua/" }
dPersonEducationsFull = class; { "http://edboservice.ua/" }
dPersonCountry = class; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
ExtensionDataObject = class(TRemotable)
private
published
end;
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dLastError = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FLastErrorCode: Integer;
FLastErrorDescription: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property LastErrorCode: Integer read FLastErrorCode write FLastErrorCode;
property LastErrorDescription: WideString read FLastErrorDescription write FLastErrorDescription;
end;
ArrayOfDLastError = array of dLastError; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dQualification = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Qualification: Integer;
FQualificationName: WideString;
FQualificationDateLastChange: TXSDateTime;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property QualificationName: WideString read FQualificationName write FQualificationName;
property QualificationDateLastChange: TXSDateTime read FQualificationDateLastChange write FQualificationDateLastChange;
end;
ArrayOfDQualification = array of dQualification; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonRequestSeasons = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonRequestSeasons: Integer;
FName: WideString;
FRequestPerPerson: Integer;
FClosed: Integer;
FId_PersonRequestSeasonDetails: Integer;
FId_PersonEducationForm: Integer;
FPersonEducationFormName: WideString;
FDateBeginPersonRequestSeason: TXSDateTime;
FDateEndPersonRequestSeason: TXSDateTime;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonRequestSeasons: Integer read FId_PersonRequestSeasons write FId_PersonRequestSeasons;
property Name: WideString read FName write FName;
property RequestPerPerson: Integer read FRequestPerPerson write FRequestPerPerson;
property Closed: Integer read FClosed write FClosed;
property Id_PersonRequestSeasonDetails: Integer read FId_PersonRequestSeasonDetails write FId_PersonRequestSeasonDetails;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property DateBeginPersonRequestSeason: TXSDateTime read FDateBeginPersonRequestSeason write FDateBeginPersonRequestSeason;
property DateEndPersonRequestSeason: TXSDateTime read FDateEndPersonRequestSeason write FDateEndPersonRequestSeason;
end;
ArrayOfDPersonRequestSeasons = array of dPersonRequestSeasons; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationFormsGet = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationForm: Integer;
FId_PersonEducationFormName: Integer;
FPersonEducationFormName: WideString;
FId_Language: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_PersonEducationFormName: Integer read FId_PersonEducationFormName write FId_PersonEducationFormName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property Id_Language: Integer read FId_Language write FId_Language;
end;
ArrayOfDPersonEducationFormsGet = array of dPersonEducationFormsGet; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonAddRet = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Person: Integer;
FPersonCodeU: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Person: Integer read FId_Person write FId_Person;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
end;
ArrayOfDPersonAddRet = array of dPersonAddRet; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsIds = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Person: Integer;
FPersonCodeU: WideString;
FDateLastChange: TXSDateTime;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Person: Integer read FId_Person write FId_Person;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property DateLastChange: TXSDateTime read FDateLastChange write FDateLastChange;
end;
ArrayOfDPersonsIds = array of dPersonsIds; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonContacts = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonContact: Integer;
FId_Person: Integer;
FId_PersonContactType: Integer;
FPersonContactTypeName: WideString;
FValue: WideString;
FDefaull: Integer;
FId_Language: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonContact: Integer read FId_PersonContact write FId_PersonContact;
property Id_Person: Integer read FId_Person write FId_Person;
property Id_PersonContactType: Integer read FId_PersonContactType write FId_PersonContactType;
property PersonContactTypeName: WideString read FPersonContactTypeName write FPersonContactTypeName;
property Value: WideString read FValue write FValue;
property Defaull: Integer read FDefaull write FDefaull;
property Id_Language: Integer read FId_Language write FId_Language;
end;
ArrayOfDPersonContacts = array of dPersonContacts; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsFind = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Person: Integer;
FResident: Integer;
FPersonCodeU: WideString;
FBirthday: TXSDateTime;
FId_PersonName: Integer;
FLastName: WideString;
FFirstName: WideString;
FMiddleName: WideString;
FPersonNameDateBegin: TXSDateTime;
FPersonNameDateEnd: TXSDateTime;
FFIO: WideString;
FPasportSeries: WideString;
FPasportNumber: WideString;
FPasportDate: TXSDateTime;
FPasportIssued: WideString;
FAtestatSeries: WideString;
FAtestatNumber: WideString;
FAtestatDate: TXSDateTime;
FId_PersonSex: Integer;
FPersonSexName: WideString;
FId_Language: Integer;
FId_PersonDocumentPasp: Integer;
FId_PersonDocumentAtestat: Integer;
FId_PersonTypeDict: Integer;
FPersonTypeName: WideString;
FFather: WideString;
FMother: WideString;
FFatherPhones: WideString;
FMotherPhones: WideString;
FBirthplace: WideString;
FLanguagesAreStudied: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Person: Integer read FId_Person write FId_Person;
property Resident: Integer read FResident write FResident;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property Id_PersonName: Integer read FId_PersonName write FId_PersonName;
property LastName: WideString read FLastName write FLastName;
property FirstName: WideString read FFirstName write FFirstName;
property MiddleName: WideString read FMiddleName write FMiddleName;
property PersonNameDateBegin: TXSDateTime read FPersonNameDateBegin write FPersonNameDateBegin;
property PersonNameDateEnd: TXSDateTime read FPersonNameDateEnd write FPersonNameDateEnd;
property FIO: WideString read FFIO write FFIO;
property PasportSeries: WideString read FPasportSeries write FPasportSeries;
property PasportNumber: WideString read FPasportNumber write FPasportNumber;
property PasportDate: TXSDateTime read FPasportDate write FPasportDate;
property PasportIssued: WideString read FPasportIssued write FPasportIssued;
property AtestatSeries: WideString read FAtestatSeries write FAtestatSeries;
property AtestatNumber: WideString read FAtestatNumber write FAtestatNumber;
property AtestatDate: TXSDateTime read FAtestatDate write FAtestatDate;
property Id_PersonSex: Integer read FId_PersonSex write FId_PersonSex;
property PersonSexName: WideString read FPersonSexName write FPersonSexName;
property Id_Language: Integer read FId_Language write FId_Language;
property Id_PersonDocumentPasp: Integer read FId_PersonDocumentPasp write FId_PersonDocumentPasp;
property Id_PersonDocumentAtestat: Integer read FId_PersonDocumentAtestat write FId_PersonDocumentAtestat;
property Id_PersonTypeDict: Integer read FId_PersonTypeDict write FId_PersonTypeDict;
property PersonTypeName: WideString read FPersonTypeName write FPersonTypeName;
property Father: WideString read FFather write FFather;
property Mother: WideString read FMother write FMother;
property FatherPhones: WideString read FFatherPhones write FFatherPhones;
property MotherPhones: WideString read FMotherPhones write FMotherPhones;
property Birthplace: WideString read FBirthplace write FBirthplace;
property LanguagesAreStudied: WideString read FLanguagesAreStudied write FLanguagesAreStudied;
end;
ArrayOfDPersonsFind = array of dPersonsFind; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsFind2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Person: Integer;
FResident: Integer;
FPersonCodeU: WideString;
FBirthday: TXSDateTime;
FId_PersonName: Integer;
FLastName: WideString;
FFirstName: WideString;
FMiddleName: WideString;
FPersonNameDateBegin: TXSDateTime;
FPersonNameDateEnd: TXSDateTime;
FFIO: WideString;
FPasportSeries: WideString;
FPasportNumber: WideString;
FPasportDate: TXSDateTime;
FPasportIssued: WideString;
FAtestatSeries: WideString;
FAtestatNumber: WideString;
FAtestatDate: TXSDateTime;
FId_PersonSex: Integer;
FPersonSexName: WideString;
FId_Language: Integer;
FId_PersonDocumentPasp: Integer;
FId_PersonDocumentAtestat: Integer;
FId_PersonTypeDict: Integer;
FPersonTypeName: WideString;
FFather: WideString;
FMother: WideString;
FFatherPhones: WideString;
FMotherPhones: WideString;
FBirthplace: WideString;
FLanguagesAreStudied: WideString;
FLastNameEn: WideString;
FFirstNameEn: WideString;
FMiddleNameEn: WideString;
FFIOEn: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Person: Integer read FId_Person write FId_Person;
property Resident: Integer read FResident write FResident;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property Id_PersonName: Integer read FId_PersonName write FId_PersonName;
property LastName: WideString read FLastName write FLastName;
property FirstName: WideString read FFirstName write FFirstName;
property MiddleName: WideString read FMiddleName write FMiddleName;
property PersonNameDateBegin: TXSDateTime read FPersonNameDateBegin write FPersonNameDateBegin;
property PersonNameDateEnd: TXSDateTime read FPersonNameDateEnd write FPersonNameDateEnd;
property FIO: WideString read FFIO write FFIO;
property PasportSeries: WideString read FPasportSeries write FPasportSeries;
property PasportNumber: WideString read FPasportNumber write FPasportNumber;
property PasportDate: TXSDateTime read FPasportDate write FPasportDate;
property PasportIssued: WideString read FPasportIssued write FPasportIssued;
property AtestatSeries: WideString read FAtestatSeries write FAtestatSeries;
property AtestatNumber: WideString read FAtestatNumber write FAtestatNumber;
property AtestatDate: TXSDateTime read FAtestatDate write FAtestatDate;
property Id_PersonSex: Integer read FId_PersonSex write FId_PersonSex;
property PersonSexName: WideString read FPersonSexName write FPersonSexName;
property Id_Language: Integer read FId_Language write FId_Language;
property Id_PersonDocumentPasp: Integer read FId_PersonDocumentPasp write FId_PersonDocumentPasp;
property Id_PersonDocumentAtestat: Integer read FId_PersonDocumentAtestat write FId_PersonDocumentAtestat;
property Id_PersonTypeDict: Integer read FId_PersonTypeDict write FId_PersonTypeDict;
property PersonTypeName: WideString read FPersonTypeName write FPersonTypeName;
property Father: WideString read FFather write FFather;
property Mother: WideString read FMother write FMother;
property FatherPhones: WideString read FFatherPhones write FFatherPhones;
property MotherPhones: WideString read FMotherPhones write FMotherPhones;
property Birthplace: WideString read FBirthplace write FBirthplace;
property LanguagesAreStudied: WideString read FLanguagesAreStudied write FLanguagesAreStudied;
property LastNameEn: WideString read FLastNameEn write FLastNameEn;
property FirstNameEn: WideString read FFirstNameEn write FFirstNameEn;
property MiddleNameEn: WideString read FMiddleNameEn write FMiddleNameEn;
property FIOEn: WideString read FFIOEn write FFIOEn;
end;
ArrayOfDPersonsFind2 = array of dPersonsFind2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dCountries = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Country: Integer;
FCountryName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Country: Integer read FId_Country write FId_Country;
property CountryName: WideString read FCountryName write FCountryName;
end;
ArrayOfDCountries = array of dCountries; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dLanguages = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Language: Integer;
FCode: WideString;
FNameLanguage: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Language: Integer read FId_Language write FId_Language;
property Code: WideString read FCode write FCode;
property NameLanguage: WideString read FNameLanguage write FNameLanguage;
end;
ArrayOfDLanguages = array of dLanguages; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsStudentsGrups = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
Fid_pk: Integer;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FStudentsCount: Integer;
FUniversityFacultetFullName: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FAcademicYearName: WideString;
FCourseName: WideString;
FQualificationName: WideString;
FPersonEducationFormName: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationName: WideString;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property id_pk: Integer read Fid_pk write Fid_pk;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property StudentsCount: Integer read FStudentsCount write FStudentsCount;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property CourseName: WideString read FCourseName write FCourseName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
end;
ArrayOfDPersonsStudentsGrups = array of dPersonsStudentsGrups; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsStudentsGrups2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
Fid_pk: Integer;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FStudentsCount: Integer;
FUniversityFacultetFullName: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FAcademicYearName: WideString;
FCourseName: WideString;
FQualificationName: WideString;
FPersonEducationFormName: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationName: WideString;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
FSpecProfessionClassifierCode1: WideString;
FSpecProfessionName1: WideString;
FSpecProfessionClassifierCode2: WideString;
FSpecProfessionName2: WideString;
FSpecProfessionClassifierCode3: WideString;
FSpecProfessionName3: WideString;
FSpecProfessionClassifierCode4: WideString;
FSpecProfessionName4: WideString;
FSpecProfessionClassifierCode5: WideString;
FSpecProfessionName5: WideString;
FSpecProfessionCode1: WideString;
FSpecProfessionCode2: WideString;
FSpecProfessionCode3: WideString;
FSpecProfessionCode4: WideString;
FSpecProfessionCode5: WideString;
FSpecComplexName: WideString;
FSpecProfession1_MaxRang: WideString;
FSpecProfession2_MaxRang: WideString;
FSpecProfession3_MaxRang: WideString;
FSpecProfession4_MaxRang: WideString;
FSpecProfession5_MaxRang: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property id_pk: Integer read Fid_pk write Fid_pk;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property StudentsCount: Integer read FStudentsCount write FStudentsCount;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property CourseName: WideString read FCourseName write FCourseName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
property SpecProfessionClassifierCode1: WideString read FSpecProfessionClassifierCode1 write FSpecProfessionClassifierCode1;
property SpecProfessionName1: WideString read FSpecProfessionName1 write FSpecProfessionName1;
property SpecProfessionClassifierCode2: WideString read FSpecProfessionClassifierCode2 write FSpecProfessionClassifierCode2;
property SpecProfessionName2: WideString read FSpecProfessionName2 write FSpecProfessionName2;
property SpecProfessionClassifierCode3: WideString read FSpecProfessionClassifierCode3 write FSpecProfessionClassifierCode3;
property SpecProfessionName3: WideString read FSpecProfessionName3 write FSpecProfessionName3;
property SpecProfessionClassifierCode4: WideString read FSpecProfessionClassifierCode4 write FSpecProfessionClassifierCode4;
property SpecProfessionName4: WideString read FSpecProfessionName4 write FSpecProfessionName4;
property SpecProfessionClassifierCode5: WideString read FSpecProfessionClassifierCode5 write FSpecProfessionClassifierCode5;
property SpecProfessionName5: WideString read FSpecProfessionName5 write FSpecProfessionName5;
property SpecProfessionCode1: WideString read FSpecProfessionCode1 write FSpecProfessionCode1;
property SpecProfessionCode2: WideString read FSpecProfessionCode2 write FSpecProfessionCode2;
property SpecProfessionCode3: WideString read FSpecProfessionCode3 write FSpecProfessionCode3;
property SpecProfessionCode4: WideString read FSpecProfessionCode4 write FSpecProfessionCode4;
property SpecProfessionCode5: WideString read FSpecProfessionCode5 write FSpecProfessionCode5;
property SpecComplexName: WideString read FSpecComplexName write FSpecComplexName;
property SpecProfession1_MaxRang: WideString read FSpecProfession1_MaxRang write FSpecProfession1_MaxRang;
property SpecProfession2_MaxRang: WideString read FSpecProfession2_MaxRang write FSpecProfession2_MaxRang;
property SpecProfession3_MaxRang: WideString read FSpecProfession3_MaxRang write FSpecProfession3_MaxRang;
property SpecProfession4_MaxRang: WideString read FSpecProfession4_MaxRang write FSpecProfession4_MaxRang;
property SpecProfession5_MaxRang: WideString read FSpecProfession5_MaxRang write FSpecProfession5_MaxRang;
end;
ArrayOfDPersonsStudentsGrups2 = array of dPersonsStudentsGrups2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonSOAPPhoto = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonPhoto: Integer;
FPersonPhotoDateLastChange: TXSDateTime;
FPersonPhotoIsActive: Integer;
FPersonCodeU: WideString;
FPersonPhotoBase64String: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonPhoto: Integer read FId_PersonPhoto write FId_PersonPhoto;
property PersonPhotoDateLastChange: TXSDateTime read FPersonPhotoDateLastChange write FPersonPhotoDateLastChange;
property PersonPhotoIsActive: Integer read FPersonPhotoIsActive write FPersonPhotoIsActive;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property PersonPhotoBase64String: WideString read FPersonPhotoBase64String write FPersonPhotoBase64String;
end;
ArrayOfDPersonSOAPPhoto = array of dPersonSOAPPhoto; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistoryTypes = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationHistoryType: Integer;
FPersonEducationHistoryTypeName: WideString;
FPersonEducationHistoryTypeDescription: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property PersonEducationHistoryTypeDescription: WideString read FPersonEducationHistoryTypeDescription write FPersonEducationHistoryTypeDescription;
end;
ArrayOfDPersonEducationHistoryTypes = array of dPersonEducationHistoryTypes; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistoryOrdersStatuses = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationHistoryOrderStatus: Integer;
FPersonEducationHistoryOrderStatusName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationHistoryOrderStatus: Integer read FId_PersonEducationHistoryOrderStatus write FId_PersonEducationHistoryOrderStatus;
property PersonEducationHistoryOrderStatusName: WideString read FPersonEducationHistoryOrderStatusName write FPersonEducationHistoryOrderStatusName;
end;
ArrayOfDPersonEducationHistoryOrdersStatuses = array of dPersonEducationHistoryOrdersStatuses; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistoryOrders = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FPersonEducationHistoryOrdersDateLastChange: TXSDateTime;
FUniversityKode: WideString;
FId_PersonEducationHistoryType: Integer;
FPersonEducationHistoryTypeName: WideString;
FPersonEducationHistoryTypeDescription: WideString;
FId_PersonEducationHistoryOrderStatus: Integer;
FPersonEducationHistoryOrderStatusName: WideString;
FId_RegulationDocument: Integer;
FIsVerified: Integer;
FId_RegulationDocumentVerificationHistoryType: Integer;
FRegulationDocumentVerificationHistoryTypeName: WideString;
FIsExistFile: Integer;
FStudCount: Integer;
FAcademicYearName: WideString;
FFacultetsNames: WideString;
FOperatorFIO: WideString;
FId_AcademicYear: Integer;
FId_User: Integer;
FRegulationDocumentVerificationHistoryDateLastChange: TXSDateTime;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property PersonEducationHistoryOrdersDateLastChange: TXSDateTime read FPersonEducationHistoryOrdersDateLastChange write FPersonEducationHistoryOrdersDateLastChange;
property UniversityKode: WideString read FUniversityKode write FUniversityKode;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property PersonEducationHistoryTypeDescription: WideString read FPersonEducationHistoryTypeDescription write FPersonEducationHistoryTypeDescription;
property Id_PersonEducationHistoryOrderStatus: Integer read FId_PersonEducationHistoryOrderStatus write FId_PersonEducationHistoryOrderStatus;
property PersonEducationHistoryOrderStatusName: WideString read FPersonEducationHistoryOrderStatusName write FPersonEducationHistoryOrderStatusName;
property Id_RegulationDocument: Integer read FId_RegulationDocument write FId_RegulationDocument;
property IsVerified: Integer read FIsVerified write FIsVerified;
property Id_RegulationDocumentVerificationHistoryType: Integer read FId_RegulationDocumentVerificationHistoryType write FId_RegulationDocumentVerificationHistoryType;
property RegulationDocumentVerificationHistoryTypeName: WideString read FRegulationDocumentVerificationHistoryTypeName write FRegulationDocumentVerificationHistoryTypeName;
property IsExistFile: Integer read FIsExistFile write FIsExistFile;
property StudCount: Integer read FStudCount write FStudCount;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property FacultetsNames: WideString read FFacultetsNames write FFacultetsNames;
property OperatorFIO: WideString read FOperatorFIO write FOperatorFIO;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_User: Integer read FId_User write FId_User;
property RegulationDocumentVerificationHistoryDateLastChange: TXSDateTime read FRegulationDocumentVerificationHistoryDateLastChange write FRegulationDocumentVerificationHistoryDateLastChange;
end;
ArrayOfDPersonEducationHistoryOrders = array of dPersonEducationHistoryOrders; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistoryOrders2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FPersonEducationHistoryOrdersDateLastChange: TXSDateTime;
FUniversityKode: WideString;
FId_PersonEducationHistoryType: Integer;
FPersonEducationHistoryTypeName: WideString;
FPersonEducationHistoryTypeDescription: WideString;
FId_PersonEducationHistoryOrderStatus: Integer;
FPersonEducationHistoryOrderStatusName: WideString;
FId_RegulationDocument: Integer;
FIsVerified: Integer;
FId_RegulationDocumentVerificationHistoryType: Integer;
FRegulationDocumentVerificationHistoryTypeName: WideString;
FIsExistFile: Integer;
FStudCount: Integer;
FAcademicYearName: WideString;
FFacultetsNames: WideString;
FOperatorFIO: WideString;
FId_AcademicYear: Integer;
FId_User: Integer;
FRegulationDocumentVerificationHistoryDateLastChange: TXSDateTime;
FPersonFIOType: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property PersonEducationHistoryOrdersDateLastChange: TXSDateTime read FPersonEducationHistoryOrdersDateLastChange write FPersonEducationHistoryOrdersDateLastChange;
property UniversityKode: WideString read FUniversityKode write FUniversityKode;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property PersonEducationHistoryTypeDescription: WideString read FPersonEducationHistoryTypeDescription write FPersonEducationHistoryTypeDescription;
property Id_PersonEducationHistoryOrderStatus: Integer read FId_PersonEducationHistoryOrderStatus write FId_PersonEducationHistoryOrderStatus;
property PersonEducationHistoryOrderStatusName: WideString read FPersonEducationHistoryOrderStatusName write FPersonEducationHistoryOrderStatusName;
property Id_RegulationDocument: Integer read FId_RegulationDocument write FId_RegulationDocument;
property IsVerified: Integer read FIsVerified write FIsVerified;
property Id_RegulationDocumentVerificationHistoryType: Integer read FId_RegulationDocumentVerificationHistoryType write FId_RegulationDocumentVerificationHistoryType;
property RegulationDocumentVerificationHistoryTypeName: WideString read FRegulationDocumentVerificationHistoryTypeName write FRegulationDocumentVerificationHistoryTypeName;
property IsExistFile: Integer read FIsExistFile write FIsExistFile;
property StudCount: Integer read FStudCount write FStudCount;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property FacultetsNames: WideString read FFacultetsNames write FFacultetsNames;
property OperatorFIO: WideString read FOperatorFIO write FOperatorFIO;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_User: Integer read FId_User write FId_User;
property RegulationDocumentVerificationHistoryDateLastChange: TXSDateTime read FRegulationDocumentVerificationHistoryDateLastChange write FRegulationDocumentVerificationHistoryDateLastChange;
property PersonFIOType: Integer read FPersonFIOType write FPersonFIOType;
end;
ArrayOfDPersonEducationHistoryOrders2 = array of dPersonEducationHistoryOrders2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonDocumentTypes = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonDocumentType: Integer;
FId_PersonDocumentTypeNames: Integer;
FPersonDocumentTypeName: WideString;
FId_Language: Integer;
FIsEntrantDocument: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property Id_PersonDocumentTypeNames: Integer read FId_PersonDocumentTypeNames write FId_PersonDocumentTypeNames;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_Language: Integer read FId_Language write FId_Language;
property IsEntrantDocument: Integer read FIsEntrantDocument write FIsEntrantDocument;
end;
ArrayOfDPersonDocumentTypes = array of dPersonDocumentTypes; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonDocuments = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonDocument: Integer;
FId_Person: Integer;
FId_PersonDocumentType: Integer;
FId_PersonEducation: Integer;
FInstitutionCode: WideString;
FInstitutionName: WideString;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FId_PersonEducationForm: Integer;
FId_PersonEducationFormName: Integer;
FPersonEducationFormName: WideString;
FId_PersonEducationType: Integer;
FId_PersonEducationTypeName: Integer;
FPersonEducationTypeName: WideString;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FDocumentExpiredDate: TXSDateTime;
FDocumentIssued: WideString;
FDescription: WideString;
FPersonDocumentBegin: TXSDateTime;
FPersonDocumentEnd: TXSDateTime;
FZNOBall: Single;
FPersonDocumentTypeName: WideString;
FId_Language: Integer;
FAtestatValue: TXSDecimal;
FZNOPin: Integer;
FPersonCodeU: WideString;
FIsCheckForPaperCopy: Integer;
FIsForeinghEntrantDocumet: Integer;
FIsNotCheckAttestat: Integer;
FIsEntrantDocument: Integer;
FId_PersonDocumentsAwardType: Integer;
FPersonDocumentsAwardTypeName: WideString;
FCancellad: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property Id_Person: Integer read FId_Person write FId_Person;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property InstitutionCode: WideString read FInstitutionCode write FInstitutionCode;
property InstitutionName: WideString read FInstitutionName write FInstitutionName;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_PersonEducationFormName: Integer read FId_PersonEducationFormName write FId_PersonEducationFormName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property Id_PersonEducationType: Integer read FId_PersonEducationType write FId_PersonEducationType;
property Id_PersonEducationTypeName: Integer read FId_PersonEducationTypeName write FId_PersonEducationTypeName;
property PersonEducationTypeName: WideString read FPersonEducationTypeName write FPersonEducationTypeName;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property DocumentExpiredDate: TXSDateTime read FDocumentExpiredDate write FDocumentExpiredDate;
property DocumentIssued: WideString read FDocumentIssued write FDocumentIssued;
property Description: WideString read FDescription write FDescription;
property PersonDocumentBegin: TXSDateTime read FPersonDocumentBegin write FPersonDocumentBegin;
property PersonDocumentEnd: TXSDateTime read FPersonDocumentEnd write FPersonDocumentEnd;
property ZNOBall: Single read FZNOBall write FZNOBall;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_Language: Integer read FId_Language write FId_Language;
property AtestatValue: TXSDecimal read FAtestatValue write FAtestatValue;
property ZNOPin: Integer read FZNOPin write FZNOPin;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property IsCheckForPaperCopy: Integer read FIsCheckForPaperCopy write FIsCheckForPaperCopy;
property IsForeinghEntrantDocumet: Integer read FIsForeinghEntrantDocumet write FIsForeinghEntrantDocumet;
property IsNotCheckAttestat: Integer read FIsNotCheckAttestat write FIsNotCheckAttestat;
property IsEntrantDocument: Integer read FIsEntrantDocument write FIsEntrantDocument;
property Id_PersonDocumentsAwardType: Integer read FId_PersonDocumentsAwardType write FId_PersonDocumentsAwardType;
property PersonDocumentsAwardTypeName: WideString read FPersonDocumentsAwardTypeName write FPersonDocumentsAwardTypeName;
property Cancellad: Integer read FCancellad write FCancellad;
end;
ArrayOfDPersonDocuments = array of dPersonDocuments; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonDocuments2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonDocument: Integer;
FId_Person: Integer;
FId_PersonDocumentType: Integer;
FId_PersonEducation: Integer;
FInstitutionCode: WideString;
FInstitutionName: WideString;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FId_PersonEducationForm: Integer;
FId_PersonEducationFormName: Integer;
FPersonEducationFormName: WideString;
FId_PersonEducationType: Integer;
FId_PersonEducationTypeName: Integer;
FPersonEducationTypeName: WideString;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FDocumentExpiredDate: TXSDateTime;
FDocumentIssued: WideString;
FDescription: WideString;
FPersonDocumentBegin: TXSDateTime;
FPersonDocumentEnd: TXSDateTime;
FZNOBall: Single;
FPersonDocumentTypeName: WideString;
FId_Language: Integer;
FAtestatValue: TXSDecimal;
FZNOPin: Integer;
FPersonCodeU: WideString;
FIsCheckForPaperCopy: Integer;
FIsForeinghEntrantDocumet: Integer;
FIsNotCheckAttestat: Integer;
FIsEntrantDocument: Integer;
FId_PersonDocumentsAwardType: Integer;
FPersonDocumentsAwardTypeName: WideString;
FCancellad: Integer;
FSpecNameFull: WideString;
FSpecDirectionsCode: WideString;
FSpecSpecialityCode: WideString;
FSpecScecializationCode: WideString;
FId_Qualification: Integer;
FId_QualificationGroup: Integer;
FId_University: Integer;
FUniversityFullName: WideString;
FCanselInfo: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property Id_Person: Integer read FId_Person write FId_Person;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property InstitutionCode: WideString read FInstitutionCode write FInstitutionCode;
property InstitutionName: WideString read FInstitutionName write FInstitutionName;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_PersonEducationFormName: Integer read FId_PersonEducationFormName write FId_PersonEducationFormName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property Id_PersonEducationType: Integer read FId_PersonEducationType write FId_PersonEducationType;
property Id_PersonEducationTypeName: Integer read FId_PersonEducationTypeName write FId_PersonEducationTypeName;
property PersonEducationTypeName: WideString read FPersonEducationTypeName write FPersonEducationTypeName;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property DocumentExpiredDate: TXSDateTime read FDocumentExpiredDate write FDocumentExpiredDate;
property DocumentIssued: WideString read FDocumentIssued write FDocumentIssued;
property Description: WideString read FDescription write FDescription;
property PersonDocumentBegin: TXSDateTime read FPersonDocumentBegin write FPersonDocumentBegin;
property PersonDocumentEnd: TXSDateTime read FPersonDocumentEnd write FPersonDocumentEnd;
property ZNOBall: Single read FZNOBall write FZNOBall;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_Language: Integer read FId_Language write FId_Language;
property AtestatValue: TXSDecimal read FAtestatValue write FAtestatValue;
property ZNOPin: Integer read FZNOPin write FZNOPin;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property IsCheckForPaperCopy: Integer read FIsCheckForPaperCopy write FIsCheckForPaperCopy;
property IsForeinghEntrantDocumet: Integer read FIsForeinghEntrantDocumet write FIsForeinghEntrantDocumet;
property IsNotCheckAttestat: Integer read FIsNotCheckAttestat write FIsNotCheckAttestat;
property IsEntrantDocument: Integer read FIsEntrantDocument write FIsEntrantDocument;
property Id_PersonDocumentsAwardType: Integer read FId_PersonDocumentsAwardType write FId_PersonDocumentsAwardType;
property PersonDocumentsAwardTypeName: WideString read FPersonDocumentsAwardTypeName write FPersonDocumentsAwardTypeName;
property Cancellad: Integer read FCancellad write FCancellad;
property SpecNameFull: WideString read FSpecNameFull write FSpecNameFull;
property SpecDirectionsCode: WideString read FSpecDirectionsCode write FSpecDirectionsCode;
property SpecSpecialityCode: WideString read FSpecSpecialityCode write FSpecSpecialityCode;
property SpecScecializationCode: WideString read FSpecScecializationCode write FSpecScecializationCode;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property Id_University: Integer read FId_University write FId_University;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property CanselInfo: WideString read FCanselInfo write FCanselInfo;
end;
ArrayOfDPersonDocuments2 = array of dPersonDocuments2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducations = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducation: Integer;
FId_PersonEducationForm: Integer;
FPersonEducationFormName: WideString;
FId_PersonEducationType: Integer;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FInstitutionCode: WideString;
FId_University: Integer;
FUniversityFullName: WideString;
FUniversityFacultetKode: WideString;
FUniversityFacultetFullName: WideString;
FQualificationName: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationName: WideString;
FSpecClasifierCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FPersonCodeU: WideString;
FCourseName: WideString;
FAcademicYearName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FUniversityGroupFullName: WideString;
FPersonEducationPaymentTypeName: WideString;
FPersonEducationHistoryTypeName: WideString;
FIsRefill: Integer;
FId_PersonRequest: Integer;
FId_PersonDocument: Integer;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FId_PersonEducationPaymentType: Integer;
FId_PersonEducationHistoryType: Integer;
FId_AcademicYear: Integer;
FId_Course: Integer;
FId_Qualification: Integer;
FId_QualificationGroup: Integer;
FId_UniversityGroup: Integer;
FSpecCode: WideString;
FIsSecondHigher: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property Id_PersonEducationType: Integer read FId_PersonEducationType write FId_PersonEducationType;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property InstitutionCode: WideString read FInstitutionCode write FInstitutionCode;
property Id_University: Integer read FId_University write FId_University;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property CourseName: WideString read FCourseName write FCourseName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property SpecCode: WideString read FSpecCode write FSpecCode;
property IsSecondHigher: Integer read FIsSecondHigher write FIsSecondHigher;
end;
ArrayOfDPersonEducations = array of dPersonEducations; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducations2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducation: Integer;
FId_PersonEducationForm: Integer;
FPersonEducationFormName: WideString;
FId_PersonEducationType: Integer;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FInstitutionCode: WideString;
FId_University: Integer;
FUniversityFullName: WideString;
FUniversityFacultetKode: WideString;
FUniversityFacultetFullName: WideString;
FQualificationName: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationName: WideString;
FSpecClasifierCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FPersonCodeU: WideString;
FCourseName: WideString;
FAcademicYearName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FUniversityGroupFullName: WideString;
FPersonEducationPaymentTypeName: WideString;
FPersonEducationHistoryTypeName: WideString;
FIsRefill: Integer;
FId_PersonRequest: Integer;
FId_PersonDocument: Integer;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FId_PersonEducationPaymentType: Integer;
FId_PersonEducationHistoryType: Integer;
FId_AcademicYear: Integer;
FId_Course: Integer;
FId_Qualification: Integer;
FId_QualificationGroup: Integer;
FId_UniversityGroup: Integer;
FSpecCode: WideString;
FIsSecondHigher: Integer;
FSpecProfessionClassifierCode1: WideString;
FSpecProfessionName1: WideString;
FSpecProfessionClassifierCode2: WideString;
FSpecProfessionName2: WideString;
FSpecProfessionClassifierCode3: WideString;
FSpecProfessionName3: WideString;
FSpecProfessionClassifierCode4: WideString;
FSpecProfessionName4: WideString;
FSpecProfessionClassifierCode5: WideString;
FSpecProfessionName5: WideString;
FSpecProfession1_MaxRang: WideString;
FSpecProfession2_MaxRang: WideString;
FSpecProfession3_MaxRang: WideString;
FSpecProfession4_MaxRang: WideString;
FSpecProfession5_MaxRang: WideString;
FSpecProfession1_CurRang: WideString;
FSpecProfession2_CurRang: WideString;
FSpecProfession3_CurRang: WideString;
FSpecProfession4_CurRang: WideString;
FSpecProfession5_CurRang: WideString;
FId_SpecProfessions1RangType: Integer;
FId_SpecProfessions2RangType: Integer;
FId_SpecProfessions3RangType: Integer;
FId_SpecProfessions4RangType: Integer;
FId_SpecProfessions5RangType: Integer;
FSpecProfessionsRangTypeName1: WideString;
FSpecProfessionsRangTypeName2: WideString;
FSpecProfessionsRangTypeName3: WideString;
FSpecProfessionsRangTypeName4: WideString;
FSpecProfessionsRangTypeName5: WideString;
FIsAfterDiplomEducation: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property Id_PersonEducationType: Integer read FId_PersonEducationType write FId_PersonEducationType;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property InstitutionCode: WideString read FInstitutionCode write FInstitutionCode;
property Id_University: Integer read FId_University write FId_University;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property CourseName: WideString read FCourseName write FCourseName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property SpecCode: WideString read FSpecCode write FSpecCode;
property IsSecondHigher: Integer read FIsSecondHigher write FIsSecondHigher;
property SpecProfessionClassifierCode1: WideString read FSpecProfessionClassifierCode1 write FSpecProfessionClassifierCode1;
property SpecProfessionName1: WideString read FSpecProfessionName1 write FSpecProfessionName1;
property SpecProfessionClassifierCode2: WideString read FSpecProfessionClassifierCode2 write FSpecProfessionClassifierCode2;
property SpecProfessionName2: WideString read FSpecProfessionName2 write FSpecProfessionName2;
property SpecProfessionClassifierCode3: WideString read FSpecProfessionClassifierCode3 write FSpecProfessionClassifierCode3;
property SpecProfessionName3: WideString read FSpecProfessionName3 write FSpecProfessionName3;
property SpecProfessionClassifierCode4: WideString read FSpecProfessionClassifierCode4 write FSpecProfessionClassifierCode4;
property SpecProfessionName4: WideString read FSpecProfessionName4 write FSpecProfessionName4;
property SpecProfessionClassifierCode5: WideString read FSpecProfessionClassifierCode5 write FSpecProfessionClassifierCode5;
property SpecProfessionName5: WideString read FSpecProfessionName5 write FSpecProfessionName5;
property SpecProfession1_MaxRang: WideString read FSpecProfession1_MaxRang write FSpecProfession1_MaxRang;
property SpecProfession2_MaxRang: WideString read FSpecProfession2_MaxRang write FSpecProfession2_MaxRang;
property SpecProfession3_MaxRang: WideString read FSpecProfession3_MaxRang write FSpecProfession3_MaxRang;
property SpecProfession4_MaxRang: WideString read FSpecProfession4_MaxRang write FSpecProfession4_MaxRang;
property SpecProfession5_MaxRang: WideString read FSpecProfession5_MaxRang write FSpecProfession5_MaxRang;
property SpecProfession1_CurRang: WideString read FSpecProfession1_CurRang write FSpecProfession1_CurRang;
property SpecProfession2_CurRang: WideString read FSpecProfession2_CurRang write FSpecProfession2_CurRang;
property SpecProfession3_CurRang: WideString read FSpecProfession3_CurRang write FSpecProfession3_CurRang;
property SpecProfession4_CurRang: WideString read FSpecProfession4_CurRang write FSpecProfession4_CurRang;
property SpecProfession5_CurRang: WideString read FSpecProfession5_CurRang write FSpecProfession5_CurRang;
property Id_SpecProfessions1RangType: Integer read FId_SpecProfessions1RangType write FId_SpecProfessions1RangType;
property Id_SpecProfessions2RangType: Integer read FId_SpecProfessions2RangType write FId_SpecProfessions2RangType;
property Id_SpecProfessions3RangType: Integer read FId_SpecProfessions3RangType write FId_SpecProfessions3RangType;
property Id_SpecProfessions4RangType: Integer read FId_SpecProfessions4RangType write FId_SpecProfessions4RangType;
property Id_SpecProfessions5RangType: Integer read FId_SpecProfessions5RangType write FId_SpecProfessions5RangType;
property SpecProfessionsRangTypeName1: WideString read FSpecProfessionsRangTypeName1 write FSpecProfessionsRangTypeName1;
property SpecProfessionsRangTypeName2: WideString read FSpecProfessionsRangTypeName2 write FSpecProfessionsRangTypeName2;
property SpecProfessionsRangTypeName3: WideString read FSpecProfessionsRangTypeName3 write FSpecProfessionsRangTypeName3;
property SpecProfessionsRangTypeName4: WideString read FSpecProfessionsRangTypeName4 write FSpecProfessionsRangTypeName4;
property SpecProfessionsRangTypeName5: WideString read FSpecProfessionsRangTypeName5 write FSpecProfessionsRangTypeName5;
property IsAfterDiplomEducation: Integer read FIsAfterDiplomEducation write FIsAfterDiplomEducation;
end;
ArrayOfDPersonEducations2 = array of dPersonEducations2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistoryOrdersData = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FId_Person: Integer;
FFIO: WideString;
FBirthday: TXSDateTime;
FPersonCodeU: WideString;
FId_PersonEducation: Integer;
FId_PersonEducationHistory: Integer;
FId_PersonEducationPaymentType: Integer;
FPersonEducationPaymentTypeName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryTypeName: WideString;
FResident: Integer;
FIsRefill: Integer;
FId_PersonEducationHistoryType: Integer;
FPersonEducationHistoryDesciption: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FUniversityGroupCode: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FId_PersonRequest: Integer;
FId_PersonDocument: Integer;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FPersonEducationFormName: WideString;
FAcademicYearName: WideString;
FQualificationName: WideString;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
FCourseName: WideString;
FSpecIndastryCode: WideString;
FSpecIndastryClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionsCode: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecSpecializationCode: WideString;
FSpecSpecializationName: WideString;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
FId_AcademicLeaveType: Integer;
FAcademicLeaveTypeName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Person: Integer read FId_Person write FId_Person;
property FIO: WideString read FFIO write FFIO;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property Resident: Integer read FResident write FResident;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property PersonEducationHistoryDesciption: WideString read FPersonEducationHistoryDesciption write FPersonEducationHistoryDesciption;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property UniversityGroupCode: WideString read FUniversityGroupCode write FUniversityGroupCode;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
property CourseName: WideString read FCourseName write FCourseName;
property SpecIndastryCode: WideString read FSpecIndastryCode write FSpecIndastryCode;
property SpecIndastryClasifierCode: WideString read FSpecIndastryClasifierCode write FSpecIndastryClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionsCode: WideString read FSpecDirectionsCode write FSpecDirectionsCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityCode: WideString read FSpecSpecialityCode write FSpecSpecialityCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecSpecializationCode: WideString read FSpecSpecializationCode write FSpecSpecializationCode;
property SpecSpecializationName: WideString read FSpecSpecializationName write FSpecSpecializationName;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
property Id_AcademicLeaveType: Integer read FId_AcademicLeaveType write FId_AcademicLeaveType;
property AcademicLeaveTypeName: WideString read FAcademicLeaveTypeName write FAcademicLeaveTypeName;
end;
ArrayOfDPersonEducationHistoryOrdersData = array of dPersonEducationHistoryOrdersData; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistoryOrdersData2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FId_Person: Integer;
FFIO: WideString;
FBirthday: TXSDateTime;
FPersonCodeU: WideString;
FId_PersonEducation: Integer;
FId_PersonEducationHistory: Integer;
FId_PersonEducationPaymentType: Integer;
FPersonEducationPaymentTypeName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryTypeName: WideString;
FResident: Integer;
FIsRefill: Integer;
FId_PersonEducationHistoryType: Integer;
FPersonEducationHistoryDesciption: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FUniversityGroupCode: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FId_PersonRequest: Integer;
FId_PersonDocument: Integer;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FPersonEducationFormName: WideString;
FAcademicYearName: WideString;
FQualificationName: WideString;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
FCourseName: WideString;
FSpecIndastryCode: WideString;
FSpecIndastryClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionsCode: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecSpecializationCode: WideString;
FSpecSpecializationName: WideString;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
FId_AcademicLeaveType: Integer;
FAcademicLeaveTypeName: WideString;
FPersonEducationDateBegin: TXSDateTime;
FSpecProfessionClassifierCode1: WideString;
FSpecProfessionName1: WideString;
FSpecProfessionClassifierCode2: WideString;
FSpecProfessionName2: WideString;
FSpecProfessionClassifierCode3: WideString;
FSpecProfessionName3: WideString;
FSpecProfessionClassifierCode4: WideString;
FSpecProfessionName4: WideString;
FSpecProfessionClassifierCode5: WideString;
FSpecProfessionName5: WideString;
FSpecProfessionCode1: WideString;
FSpecProfessionCode2: WideString;
FSpecProfessionCode3: WideString;
FSpecProfessionCode4: WideString;
FSpecProfessionCode5: WideString;
FSpecComplexName: WideString;
FSpecProfession1_MaxRang: WideString;
FSpecProfession2_MaxRang: WideString;
FSpecProfession3_MaxRang: WideString;
FSpecProfession4_MaxRang: WideString;
FSpecProfession5_MaxRang: WideString;
FSpecProfession1_CurRang: WideString;
FSpecProfession2_CurRang: WideString;
FSpecProfession3_CurRang: WideString;
FSpecProfession4_CurRang: WideString;
FSpecProfession5_CurRang: WideString;
FId_SpecProfessions1RangType: Integer;
FId_SpecProfessions2RangType: Integer;
FId_SpecProfessions3RangType: Integer;
FId_SpecProfessions4RangType: Integer;
FId_SpecProfessions5RangType: Integer;
FSpecProfessionsRangTypeName1: WideString;
FSpecProfessionsRangTypeName2: WideString;
FSpecProfessionsRangTypeName3: WideString;
FSpecProfessionsRangTypeName4: WideString;
FSpecProfessionsRangTypeName5: WideString;
FId_PersonEducationFrom: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Person: Integer read FId_Person write FId_Person;
property FIO: WideString read FFIO write FFIO;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property Resident: Integer read FResident write FResident;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property PersonEducationHistoryDesciption: WideString read FPersonEducationHistoryDesciption write FPersonEducationHistoryDesciption;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property UniversityGroupCode: WideString read FUniversityGroupCode write FUniversityGroupCode;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
property CourseName: WideString read FCourseName write FCourseName;
property SpecIndastryCode: WideString read FSpecIndastryCode write FSpecIndastryCode;
property SpecIndastryClasifierCode: WideString read FSpecIndastryClasifierCode write FSpecIndastryClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionsCode: WideString read FSpecDirectionsCode write FSpecDirectionsCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityCode: WideString read FSpecSpecialityCode write FSpecSpecialityCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecSpecializationCode: WideString read FSpecSpecializationCode write FSpecSpecializationCode;
property SpecSpecializationName: WideString read FSpecSpecializationName write FSpecSpecializationName;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
property Id_AcademicLeaveType: Integer read FId_AcademicLeaveType write FId_AcademicLeaveType;
property AcademicLeaveTypeName: WideString read FAcademicLeaveTypeName write FAcademicLeaveTypeName;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property SpecProfessionClassifierCode1: WideString read FSpecProfessionClassifierCode1 write FSpecProfessionClassifierCode1;
property SpecProfessionName1: WideString read FSpecProfessionName1 write FSpecProfessionName1;
property SpecProfessionClassifierCode2: WideString read FSpecProfessionClassifierCode2 write FSpecProfessionClassifierCode2;
property SpecProfessionName2: WideString read FSpecProfessionName2 write FSpecProfessionName2;
property SpecProfessionClassifierCode3: WideString read FSpecProfessionClassifierCode3 write FSpecProfessionClassifierCode3;
property SpecProfessionName3: WideString read FSpecProfessionName3 write FSpecProfessionName3;
property SpecProfessionClassifierCode4: WideString read FSpecProfessionClassifierCode4 write FSpecProfessionClassifierCode4;
property SpecProfessionName4: WideString read FSpecProfessionName4 write FSpecProfessionName4;
property SpecProfessionClassifierCode5: WideString read FSpecProfessionClassifierCode5 write FSpecProfessionClassifierCode5;
property SpecProfessionName5: WideString read FSpecProfessionName5 write FSpecProfessionName5;
property SpecProfessionCode1: WideString read FSpecProfessionCode1 write FSpecProfessionCode1;
property SpecProfessionCode2: WideString read FSpecProfessionCode2 write FSpecProfessionCode2;
property SpecProfessionCode3: WideString read FSpecProfessionCode3 write FSpecProfessionCode3;
property SpecProfessionCode4: WideString read FSpecProfessionCode4 write FSpecProfessionCode4;
property SpecProfessionCode5: WideString read FSpecProfessionCode5 write FSpecProfessionCode5;
property SpecComplexName: WideString read FSpecComplexName write FSpecComplexName;
property SpecProfession1_MaxRang: WideString read FSpecProfession1_MaxRang write FSpecProfession1_MaxRang;
property SpecProfession2_MaxRang: WideString read FSpecProfession2_MaxRang write FSpecProfession2_MaxRang;
property SpecProfession3_MaxRang: WideString read FSpecProfession3_MaxRang write FSpecProfession3_MaxRang;
property SpecProfession4_MaxRang: WideString read FSpecProfession4_MaxRang write FSpecProfession4_MaxRang;
property SpecProfession5_MaxRang: WideString read FSpecProfession5_MaxRang write FSpecProfession5_MaxRang;
property SpecProfession1_CurRang: WideString read FSpecProfession1_CurRang write FSpecProfession1_CurRang;
property SpecProfession2_CurRang: WideString read FSpecProfession2_CurRang write FSpecProfession2_CurRang;
property SpecProfession3_CurRang: WideString read FSpecProfession3_CurRang write FSpecProfession3_CurRang;
property SpecProfession4_CurRang: WideString read FSpecProfession4_CurRang write FSpecProfession4_CurRang;
property SpecProfession5_CurRang: WideString read FSpecProfession5_CurRang write FSpecProfession5_CurRang;
property Id_SpecProfessions1RangType: Integer read FId_SpecProfessions1RangType write FId_SpecProfessions1RangType;
property Id_SpecProfessions2RangType: Integer read FId_SpecProfessions2RangType write FId_SpecProfessions2RangType;
property Id_SpecProfessions3RangType: Integer read FId_SpecProfessions3RangType write FId_SpecProfessions3RangType;
property Id_SpecProfessions4RangType: Integer read FId_SpecProfessions4RangType write FId_SpecProfessions4RangType;
property Id_SpecProfessions5RangType: Integer read FId_SpecProfessions5RangType write FId_SpecProfessions5RangType;
property SpecProfessionsRangTypeName1: WideString read FSpecProfessionsRangTypeName1 write FSpecProfessionsRangTypeName1;
property SpecProfessionsRangTypeName2: WideString read FSpecProfessionsRangTypeName2 write FSpecProfessionsRangTypeName2;
property SpecProfessionsRangTypeName3: WideString read FSpecProfessionsRangTypeName3 write FSpecProfessionsRangTypeName3;
property SpecProfessionsRangTypeName4: WideString read FSpecProfessionsRangTypeName4 write FSpecProfessionsRangTypeName4;
property SpecProfessionsRangTypeName5: WideString read FSpecProfessionsRangTypeName5 write FSpecProfessionsRangTypeName5;
property Id_PersonEducationFrom: Integer read FId_PersonEducationFrom write FId_PersonEducationFrom;
end;
ArrayOfDPersonEducationHistoryOrdersData2 = array of dPersonEducationHistoryOrdersData2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistoryOrdersChangeFIOData = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationHistoryOrdersAdditionalData: Integer;
FId_PersonEducationHistoryOrders: Integer;
FFirstName: WideString;
FMiddleName: WideString;
FLastName: WideString;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FDocumentIssued: WideString;
FDocumentDescription: WideString;
FFIODateChange: TXSDateTime;
FPersonCodeU: WideString;
FCurrentFIO: WideString;
FExistInEDBO: Integer;
FId_PersonDocumentType: Integer;
FPersonFIOType: Integer;
FFIOSkeepCreateDocuments: Integer;
FLastNameEn: WideString;
FFirstNameEn: WideString;
FMiddleNameEn: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationHistoryOrdersAdditionalData: Integer read FId_PersonEducationHistoryOrdersAdditionalData write FId_PersonEducationHistoryOrdersAdditionalData;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property FirstName: WideString read FFirstName write FFirstName;
property MiddleName: WideString read FMiddleName write FMiddleName;
property LastName: WideString read FLastName write FLastName;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property DocumentIssued: WideString read FDocumentIssued write FDocumentIssued;
property DocumentDescription: WideString read FDocumentDescription write FDocumentDescription;
property FIODateChange: TXSDateTime read FFIODateChange write FFIODateChange;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property CurrentFIO: WideString read FCurrentFIO write FCurrentFIO;
property ExistInEDBO: Integer read FExistInEDBO write FExistInEDBO;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonFIOType: Integer read FPersonFIOType write FPersonFIOType;
property FIOSkeepCreateDocuments: Integer read FFIOSkeepCreateDocuments write FFIOSkeepCreateDocuments;
property LastNameEn: WideString read FLastNameEn write FLastNameEn;
property FirstNameEn: WideString read FFirstNameEn write FFirstNameEn;
property MiddleNameEn: WideString read FMiddleNameEn write FMiddleNameEn;
end;
ArrayOfDPersonEducationHistoryOrdersChangeFIOData = array of dPersonEducationHistoryOrdersChangeFIOData; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistory = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationHistory: Integer;
FId_PersonEducationHistoryType: Integer;
FId_PersonEducation: Integer;
FId_PersonEducationPaymentType: Integer;
FId_UniversityGroup: Integer;
FDateLastChange: TXSDateTime;
FIsActive: Integer;
FPersonEducationHistoryDesciption: WideString;
FUniversityGroupCode: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FUniversityGroupDescription: WideString;
FId_AcademicYear: Integer;
FId_Course: Integer;
FId_PersonEducationForm: Integer;
FUniversityFacultetKode: WideString;
FSpecCode: WideString;
FUniversityKode: WideString;
FId_Qualification: Integer;
FAcademicYearName: WideString;
FCourseName: WideString;
FPersonEducationFormName: WideString;
FUniversityFullName: WideString;
FUniversityShortName: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FQualificationName: WideString;
FPersonEducationPaymentTypeName: WideString;
FPersonEducationHistoryTypeName: WideString;
FPersonCodeU: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FPersonEducationHistoryDateEnd: TXSDateTime;
FId_OrderOfEnrollment: Integer;
FId_PersonEducationHistoryOrders: Integer;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationName: WideString;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FIsConfirmed: Integer;
FId_AcademicLeaveType: Integer;
FAcademicLeaveTypeName: WideString;
FUniversityKodeFrom: WideString;
FId_UniversityFrom: Integer;
FUniversityFullNameFrom: WideString;
FUserFIO: WideString;
FId_PersonEducationHistoryCorrected: Integer;
FIsCorrected: Integer;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
FId_PersonName: Integer;
FFIO: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property DateLastChange: TXSDateTime read FDateLastChange write FDateLastChange;
property IsActive: Integer read FIsActive write FIsActive;
property PersonEducationHistoryDesciption: WideString read FPersonEducationHistoryDesciption write FPersonEducationHistoryDesciption;
property UniversityGroupCode: WideString read FUniversityGroupCode write FUniversityGroupCode;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property UniversityGroupDescription: WideString read FUniversityGroupDescription write FUniversityGroupDescription;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property SpecCode: WideString read FSpecCode write FSpecCode;
property UniversityKode: WideString read FUniversityKode write FUniversityKode;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property CourseName: WideString read FCourseName write FCourseName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property UniversityShortName: WideString read FUniversityShortName write FUniversityShortName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property PersonEducationHistoryDateEnd: TXSDateTime read FPersonEducationHistoryDateEnd write FPersonEducationHistoryDateEnd;
property Id_OrderOfEnrollment: Integer read FId_OrderOfEnrollment write FId_OrderOfEnrollment;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property IsConfirmed: Integer read FIsConfirmed write FIsConfirmed;
property Id_AcademicLeaveType: Integer read FId_AcademicLeaveType write FId_AcademicLeaveType;
property AcademicLeaveTypeName: WideString read FAcademicLeaveTypeName write FAcademicLeaveTypeName;
property UniversityKodeFrom: WideString read FUniversityKodeFrom write FUniversityKodeFrom;
property Id_UniversityFrom: Integer read FId_UniversityFrom write FId_UniversityFrom;
property UniversityFullNameFrom: WideString read FUniversityFullNameFrom write FUniversityFullNameFrom;
property UserFIO: WideString read FUserFIO write FUserFIO;
property Id_PersonEducationHistoryCorrected: Integer read FId_PersonEducationHistoryCorrected write FId_PersonEducationHistoryCorrected;
property IsCorrected: Integer read FIsCorrected write FIsCorrected;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
property Id_PersonName: Integer read FId_PersonName write FId_PersonName;
property FIO: WideString read FFIO write FFIO;
end;
ArrayOfDPersonEducationHistory = array of dPersonEducationHistory; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationHistory2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationHistory: Integer;
FId_PersonEducationHistoryType: Integer;
FId_PersonEducation: Integer;
FId_PersonEducationPaymentType: Integer;
FId_UniversityGroup: Integer;
FDateLastChange: TXSDateTime;
FIsActive: Integer;
FPersonEducationHistoryDesciption: WideString;
FUniversityGroupCode: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FUniversityGroupDescription: WideString;
FId_AcademicYear: Integer;
FId_Course: Integer;
FId_PersonEducationForm: Integer;
FUniversityFacultetKode: WideString;
FSpecCode: WideString;
FUniversityKode: WideString;
FId_Qualification: Integer;
FAcademicYearName: WideString;
FCourseName: WideString;
FPersonEducationFormName: WideString;
FUniversityFullName: WideString;
FUniversityShortName: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FQualificationName: WideString;
FPersonEducationPaymentTypeName: WideString;
FPersonEducationHistoryTypeName: WideString;
FPersonCodeU: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FPersonEducationHistoryDateEnd: TXSDateTime;
FId_OrderOfEnrollment: Integer;
FId_PersonEducationHistoryOrders: Integer;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationName: WideString;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FIsConfirmed: Integer;
FId_AcademicLeaveType: Integer;
FAcademicLeaveTypeName: WideString;
FUniversityKodeFrom: WideString;
FId_UniversityFrom: Integer;
FUniversityFullNameFrom: WideString;
FUserFIO: WideString;
FId_PersonEducationHistoryCorrected: Integer;
FIsCorrected: Integer;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
FId_PersonName: Integer;
FFIO: WideString;
FSpecProfessionClassifierCode1: WideString;
FSpecProfessionName1: WideString;
FSpecProfessionClassifierCode2: WideString;
FSpecProfessionName2: WideString;
FSpecProfessionClassifierCode3: WideString;
FSpecProfessionName3: WideString;
FSpecProfessionClassifierCode4: WideString;
FSpecProfessionName4: WideString;
FSpecProfessionClassifierCode5: WideString;
FSpecProfessionName5: WideString;
FSpecProfession1_MaxRang: WideString;
FSpecProfession2_MaxRang: WideString;
FSpecProfession3_MaxRang: WideString;
FSpecProfession4_MaxRang: WideString;
FSpecProfession5_MaxRang: WideString;
FSpecProfession1_CurRang: WideString;
FSpecProfession2_CurRang: WideString;
FSpecProfession3_CurRang: WideString;
FSpecProfession4_CurRang: WideString;
FSpecProfession5_CurRang: WideString;
FId_SpecProfessions1RangType: Integer;
FId_SpecProfessions2RangType: Integer;
FId_SpecProfessions3RangType: Integer;
FId_SpecProfessions4RangType: Integer;
FId_SpecProfessions5RangType: Integer;
FSpecProfessionsRangTypeName1: WideString;
FSpecProfessionsRangTypeName2: WideString;
FSpecProfessionsRangTypeName3: WideString;
FSpecProfessionsRangTypeName4: WideString;
FSpecProfessionsRangTypeName5: WideString;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FPersonEducationHistoryTypeNameOrder: WideString;
FId_PersonEducationHistoryTypeOrder: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property DateLastChange: TXSDateTime read FDateLastChange write FDateLastChange;
property IsActive: Integer read FIsActive write FIsActive;
property PersonEducationHistoryDesciption: WideString read FPersonEducationHistoryDesciption write FPersonEducationHistoryDesciption;
property UniversityGroupCode: WideString read FUniversityGroupCode write FUniversityGroupCode;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property UniversityGroupDescription: WideString read FUniversityGroupDescription write FUniversityGroupDescription;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property SpecCode: WideString read FSpecCode write FSpecCode;
property UniversityKode: WideString read FUniversityKode write FUniversityKode;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property CourseName: WideString read FCourseName write FCourseName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property UniversityShortName: WideString read FUniversityShortName write FUniversityShortName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property PersonEducationHistoryDateEnd: TXSDateTime read FPersonEducationHistoryDateEnd write FPersonEducationHistoryDateEnd;
property Id_OrderOfEnrollment: Integer read FId_OrderOfEnrollment write FId_OrderOfEnrollment;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property IsConfirmed: Integer read FIsConfirmed write FIsConfirmed;
property Id_AcademicLeaveType: Integer read FId_AcademicLeaveType write FId_AcademicLeaveType;
property AcademicLeaveTypeName: WideString read FAcademicLeaveTypeName write FAcademicLeaveTypeName;
property UniversityKodeFrom: WideString read FUniversityKodeFrom write FUniversityKodeFrom;
property Id_UniversityFrom: Integer read FId_UniversityFrom write FId_UniversityFrom;
property UniversityFullNameFrom: WideString read FUniversityFullNameFrom write FUniversityFullNameFrom;
property UserFIO: WideString read FUserFIO write FUserFIO;
property Id_PersonEducationHistoryCorrected: Integer read FId_PersonEducationHistoryCorrected write FId_PersonEducationHistoryCorrected;
property IsCorrected: Integer read FIsCorrected write FIsCorrected;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
property Id_PersonName: Integer read FId_PersonName write FId_PersonName;
property FIO: WideString read FFIO write FFIO;
property SpecProfessionClassifierCode1: WideString read FSpecProfessionClassifierCode1 write FSpecProfessionClassifierCode1;
property SpecProfessionName1: WideString read FSpecProfessionName1 write FSpecProfessionName1;
property SpecProfessionClassifierCode2: WideString read FSpecProfessionClassifierCode2 write FSpecProfessionClassifierCode2;
property SpecProfessionName2: WideString read FSpecProfessionName2 write FSpecProfessionName2;
property SpecProfessionClassifierCode3: WideString read FSpecProfessionClassifierCode3 write FSpecProfessionClassifierCode3;
property SpecProfessionName3: WideString read FSpecProfessionName3 write FSpecProfessionName3;
property SpecProfessionClassifierCode4: WideString read FSpecProfessionClassifierCode4 write FSpecProfessionClassifierCode4;
property SpecProfessionName4: WideString read FSpecProfessionName4 write FSpecProfessionName4;
property SpecProfessionClassifierCode5: WideString read FSpecProfessionClassifierCode5 write FSpecProfessionClassifierCode5;
property SpecProfessionName5: WideString read FSpecProfessionName5 write FSpecProfessionName5;
property SpecProfession1_MaxRang: WideString read FSpecProfession1_MaxRang write FSpecProfession1_MaxRang;
property SpecProfession2_MaxRang: WideString read FSpecProfession2_MaxRang write FSpecProfession2_MaxRang;
property SpecProfession3_MaxRang: WideString read FSpecProfession3_MaxRang write FSpecProfession3_MaxRang;
property SpecProfession4_MaxRang: WideString read FSpecProfession4_MaxRang write FSpecProfession4_MaxRang;
property SpecProfession5_MaxRang: WideString read FSpecProfession5_MaxRang write FSpecProfession5_MaxRang;
property SpecProfession1_CurRang: WideString read FSpecProfession1_CurRang write FSpecProfession1_CurRang;
property SpecProfession2_CurRang: WideString read FSpecProfession2_CurRang write FSpecProfession2_CurRang;
property SpecProfession3_CurRang: WideString read FSpecProfession3_CurRang write FSpecProfession3_CurRang;
property SpecProfession4_CurRang: WideString read FSpecProfession4_CurRang write FSpecProfession4_CurRang;
property SpecProfession5_CurRang: WideString read FSpecProfession5_CurRang write FSpecProfession5_CurRang;
property Id_SpecProfessions1RangType: Integer read FId_SpecProfessions1RangType write FId_SpecProfessions1RangType;
property Id_SpecProfessions2RangType: Integer read FId_SpecProfessions2RangType write FId_SpecProfessions2RangType;
property Id_SpecProfessions3RangType: Integer read FId_SpecProfessions3RangType write FId_SpecProfessions3RangType;
property Id_SpecProfessions4RangType: Integer read FId_SpecProfessions4RangType write FId_SpecProfessions4RangType;
property Id_SpecProfessions5RangType: Integer read FId_SpecProfessions5RangType write FId_SpecProfessions5RangType;
property SpecProfessionsRangTypeName1: WideString read FSpecProfessionsRangTypeName1 write FSpecProfessionsRangTypeName1;
property SpecProfessionsRangTypeName2: WideString read FSpecProfessionsRangTypeName2 write FSpecProfessionsRangTypeName2;
property SpecProfessionsRangTypeName3: WideString read FSpecProfessionsRangTypeName3 write FSpecProfessionsRangTypeName3;
property SpecProfessionsRangTypeName4: WideString read FSpecProfessionsRangTypeName4 write FSpecProfessionsRangTypeName4;
property SpecProfessionsRangTypeName5: WideString read FSpecProfessionsRangTypeName5 write FSpecProfessionsRangTypeName5;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property PersonEducationHistoryTypeNameOrder: WideString read FPersonEducationHistoryTypeNameOrder write FPersonEducationHistoryTypeNameOrder;
property Id_PersonEducationHistoryTypeOrder: Integer read FId_PersonEducationHistoryTypeOrder write FId_PersonEducationHistoryTypeOrder;
end;
ArrayOfDPersonEducationHistory2 = array of dPersonEducationHistory2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonAddresses = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonAddress: Integer;
FId_Person: Integer;
FKOATUUCode: WideString;
FKOATUUFullName: WideString;
FId_StreetType: Integer;
FStreetTypeFullName: WideString;
FStreetTypeShortName: WideString;
FAdress: WideString;
FHomeNumber: WideString;
FPersonHomeAddressDetaeBegin: TXSDateTime;
FPersonHomeAddressDetaeEnd: TXSDateTime;
FNoResidentAdress: WideString;
FId_Language: Integer;
FPostIndex: WideString;
FType_: WideString;
FId_Country: Integer;
FCountryName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonAddress: Integer read FId_PersonAddress write FId_PersonAddress;
property Id_Person: Integer read FId_Person write FId_Person;
property KOATUUCode: WideString read FKOATUUCode write FKOATUUCode;
property KOATUUFullName: WideString read FKOATUUFullName write FKOATUUFullName;
property Id_StreetType: Integer read FId_StreetType write FId_StreetType;
property StreetTypeFullName: WideString read FStreetTypeFullName write FStreetTypeFullName;
property StreetTypeShortName: WideString read FStreetTypeShortName write FStreetTypeShortName;
property Adress: WideString read FAdress write FAdress;
property HomeNumber: WideString read FHomeNumber write FHomeNumber;
property PersonHomeAddressDetaeBegin: TXSDateTime read FPersonHomeAddressDetaeBegin write FPersonHomeAddressDetaeBegin;
property PersonHomeAddressDetaeEnd: TXSDateTime read FPersonHomeAddressDetaeEnd write FPersonHomeAddressDetaeEnd;
property NoResidentAdress: WideString read FNoResidentAdress write FNoResidentAdress;
property Id_Language: Integer read FId_Language write FId_Language;
property PostIndex: WideString read FPostIndex write FPostIndex;
property Type_: WideString read FType_ write FType_;
property Id_Country: Integer read FId_Country write FId_Country;
property CountryName: WideString read FCountryName write FCountryName;
end;
ArrayOfDPersonAddresses = array of dPersonAddresses; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonAddresses2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonAddress: Integer;
FId_Person: Integer;
FKOATUUCode: WideString;
FKOATUUFullName: WideString;
FId_StreetType: Integer;
FStreetTypeFullName: WideString;
FStreetTypeShortName: WideString;
FAdress: WideString;
FHomeNumber: WideString;
FPersonHomeAddressDetaeBegin: TXSDateTime;
FPersonHomeAddressDetaeEnd: TXSDateTime;
FNoResidentAdress: WideString;
FId_Language: Integer;
FPostIndex: WideString;
FType_: WideString;
FId_Country: Integer;
FCountryName: WideString;
FApartment: WideString;
FHousing: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonAddress: Integer read FId_PersonAddress write FId_PersonAddress;
property Id_Person: Integer read FId_Person write FId_Person;
property KOATUUCode: WideString read FKOATUUCode write FKOATUUCode;
property KOATUUFullName: WideString read FKOATUUFullName write FKOATUUFullName;
property Id_StreetType: Integer read FId_StreetType write FId_StreetType;
property StreetTypeFullName: WideString read FStreetTypeFullName write FStreetTypeFullName;
property StreetTypeShortName: WideString read FStreetTypeShortName write FStreetTypeShortName;
property Adress: WideString read FAdress write FAdress;
property HomeNumber: WideString read FHomeNumber write FHomeNumber;
property PersonHomeAddressDetaeBegin: TXSDateTime read FPersonHomeAddressDetaeBegin write FPersonHomeAddressDetaeBegin;
property PersonHomeAddressDetaeEnd: TXSDateTime read FPersonHomeAddressDetaeEnd write FPersonHomeAddressDetaeEnd;
property NoResidentAdress: WideString read FNoResidentAdress write FNoResidentAdress;
property Id_Language: Integer read FId_Language write FId_Language;
property PostIndex: WideString read FPostIndex write FPostIndex;
property Type_: WideString read FType_ write FType_;
property Id_Country: Integer read FId_Country write FId_Country;
property CountryName: WideString read FCountryName write FCountryName;
property Apartment: WideString read FApartment write FApartment;
property Housing: WideString read FHousing write FHousing;
end;
ArrayOfDPersonAddresses2 = array of dPersonAddresses2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonTypeDictGet = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonTypeDict: Integer;
FPersonTypeName: WideString;
FDateLastChange: TXSDateTime;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonTypeDict: Integer read FId_PersonTypeDict write FId_PersonTypeDict;
property PersonTypeName: WideString read FPersonTypeName write FPersonTypeName;
property DateLastChange: TXSDateTime read FDateLastChange write FDateLastChange;
end;
ArrayOfDPersonTypeDictGet = array of dPersonTypeDictGet; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonRequests = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonRequest: Integer;
FId_PersonRequestSeasons: Integer;
FPersonCodeU: WideString;
FUniversitySpecialitiesKode: WideString;
FNameRequestSeason: WideString;
FRequestPerPerson: Integer;
FId_UniversitySpecialities: Integer;
FUniversitySpecialitiesDateBegin: TXSDateTime;
FUniversitySpecialitiesDateEnd: TXSDateTime;
FUniversityKode: WideString;
FUniversityFullName: WideString;
FUniversityShortName: WideString;
FUniversityFacultetKode: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FSpecCode: WideString;
FSpecClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityName: WideString;
FId_Language: Integer;
FSpecScecializationCode: WideString;
FSpecScecializationName: WideString;
FOriginalDocumentsAdd: Integer;
FId_PersonRequestStatus: Integer;
FId_PersonRequestStatusType: Integer;
FPersonRequestStatusCode: WideString;
FId_PersonRequestStatusTypeName: Integer;
FPersonRequestStatusTypeName: WideString;
FDescryption: WideString;
FIsNeedHostel: Integer;
FCodeOfBusiness: WideString;
FId_PersonEnteranceTypes: Integer;
FPersonEnteranceTypeName: WideString;
FId_PersonRequestExaminationCause: Integer;
FPersonRequestExaminationCauseName: WideString;
FIsContract: Integer;
FIsBudget: Integer;
FId_PersonEducationForm: Integer;
FPersonEducationFormName: WideString;
FKonkursValue: TXSDecimal;
FKonkursValueSource: WideString;
FPriorityRequest: Integer;
FKonkursValueCorrectValue: TXSDecimal;
FKonkursValueCorrectValueDescription: WideString;
FId_PersonRequestSeasonDetails: Integer;
FId_Qualification: Integer;
FQualificationName: WideString;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FId_PersonDocument: Integer;
FEntrantDocumentSeries: WideString;
FEntrantDocumentNumbers: WideString;
FEntrantDocumentDateGet: TXSDateTime;
FEntrantDocumentIssued: WideString;
FEntrantDocumentValue: TXSDecimal;
FIsCheckForPaperCopy: Integer;
FIsNotCheckAttestat: Integer;
FIsForeinghEntrantDocumet: Integer;
FRequestEnteranseCodes: WideString;
FId_UniversityEntrantWave: Integer;
FRequestStatusIsBudejt: Integer;
FRequestStatusIsContract: Integer;
FUniversityEntrantWaveName: WideString;
FIsHigherEducation: Integer;
FSkipDocumentValue: Integer;
FId_PersonDocumentsAwardType: Integer;
FPersonDocumentsAwardTypeName: WideString;
FId_OrderOfEnrollment: Integer;
FSpecSpecialityClasifierCode: WideString;
FId_PersonName: Integer;
FFIO: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonRequestSeasons: Integer read FId_PersonRequestSeasons write FId_PersonRequestSeasons;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property UniversitySpecialitiesKode: WideString read FUniversitySpecialitiesKode write FUniversitySpecialitiesKode;
property NameRequestSeason: WideString read FNameRequestSeason write FNameRequestSeason;
property RequestPerPerson: Integer read FRequestPerPerson write FRequestPerPerson;
property Id_UniversitySpecialities: Integer read FId_UniversitySpecialities write FId_UniversitySpecialities;
property UniversitySpecialitiesDateBegin: TXSDateTime read FUniversitySpecialitiesDateBegin write FUniversitySpecialitiesDateBegin;
property UniversitySpecialitiesDateEnd: TXSDateTime read FUniversitySpecialitiesDateEnd write FUniversitySpecialitiesDateEnd;
property UniversityKode: WideString read FUniversityKode write FUniversityKode;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property UniversityShortName: WideString read FUniversityShortName write FUniversityShortName;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property SpecCode: WideString read FSpecCode write FSpecCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property Id_Language: Integer read FId_Language write FId_Language;
property SpecScecializationCode: WideString read FSpecScecializationCode write FSpecScecializationCode;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property OriginalDocumentsAdd: Integer read FOriginalDocumentsAdd write FOriginalDocumentsAdd;
property Id_PersonRequestStatus: Integer read FId_PersonRequestStatus write FId_PersonRequestStatus;
property Id_PersonRequestStatusType: Integer read FId_PersonRequestStatusType write FId_PersonRequestStatusType;
property PersonRequestStatusCode: WideString read FPersonRequestStatusCode write FPersonRequestStatusCode;
property Id_PersonRequestStatusTypeName: Integer read FId_PersonRequestStatusTypeName write FId_PersonRequestStatusTypeName;
property PersonRequestStatusTypeName: WideString read FPersonRequestStatusTypeName write FPersonRequestStatusTypeName;
property Descryption: WideString read FDescryption write FDescryption;
property IsNeedHostel: Integer read FIsNeedHostel write FIsNeedHostel;
property CodeOfBusiness: WideString read FCodeOfBusiness write FCodeOfBusiness;
property Id_PersonEnteranceTypes: Integer read FId_PersonEnteranceTypes write FId_PersonEnteranceTypes;
property PersonEnteranceTypeName: WideString read FPersonEnteranceTypeName write FPersonEnteranceTypeName;
property Id_PersonRequestExaminationCause: Integer read FId_PersonRequestExaminationCause write FId_PersonRequestExaminationCause;
property PersonRequestExaminationCauseName: WideString read FPersonRequestExaminationCauseName write FPersonRequestExaminationCauseName;
property IsContract: Integer read FIsContract write FIsContract;
property IsBudget: Integer read FIsBudget write FIsBudget;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property KonkursValue: TXSDecimal read FKonkursValue write FKonkursValue;
property KonkursValueSource: WideString read FKonkursValueSource write FKonkursValueSource;
property PriorityRequest: Integer read FPriorityRequest write FPriorityRequest;
property KonkursValueCorrectValue: TXSDecimal read FKonkursValueCorrectValue write FKonkursValueCorrectValue;
property KonkursValueCorrectValueDescription: WideString read FKonkursValueCorrectValueDescription write FKonkursValueCorrectValueDescription;
property Id_PersonRequestSeasonDetails: Integer read FId_PersonRequestSeasonDetails write FId_PersonRequestSeasonDetails;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property QualificationName: WideString read FQualificationName write FQualificationName;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property EntrantDocumentSeries: WideString read FEntrantDocumentSeries write FEntrantDocumentSeries;
property EntrantDocumentNumbers: WideString read FEntrantDocumentNumbers write FEntrantDocumentNumbers;
property EntrantDocumentDateGet: TXSDateTime read FEntrantDocumentDateGet write FEntrantDocumentDateGet;
property EntrantDocumentIssued: WideString read FEntrantDocumentIssued write FEntrantDocumentIssued;
property EntrantDocumentValue: TXSDecimal read FEntrantDocumentValue write FEntrantDocumentValue;
property IsCheckForPaperCopy: Integer read FIsCheckForPaperCopy write FIsCheckForPaperCopy;
property IsNotCheckAttestat: Integer read FIsNotCheckAttestat write FIsNotCheckAttestat;
property IsForeinghEntrantDocumet: Integer read FIsForeinghEntrantDocumet write FIsForeinghEntrantDocumet;
property RequestEnteranseCodes: WideString read FRequestEnteranseCodes write FRequestEnteranseCodes;
property Id_UniversityEntrantWave: Integer read FId_UniversityEntrantWave write FId_UniversityEntrantWave;
property RequestStatusIsBudejt: Integer read FRequestStatusIsBudejt write FRequestStatusIsBudejt;
property RequestStatusIsContract: Integer read FRequestStatusIsContract write FRequestStatusIsContract;
property UniversityEntrantWaveName: WideString read FUniversityEntrantWaveName write FUniversityEntrantWaveName;
property IsHigherEducation: Integer read FIsHigherEducation write FIsHigherEducation;
property SkipDocumentValue: Integer read FSkipDocumentValue write FSkipDocumentValue;
property Id_PersonDocumentsAwardType: Integer read FId_PersonDocumentsAwardType write FId_PersonDocumentsAwardType;
property PersonDocumentsAwardTypeName: WideString read FPersonDocumentsAwardTypeName write FPersonDocumentsAwardTypeName;
property Id_OrderOfEnrollment: Integer read FId_OrderOfEnrollment write FId_OrderOfEnrollment;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property Id_PersonName: Integer read FId_PersonName write FId_PersonName;
property FIO: WideString read FFIO write FFIO;
end;
ArrayOfDPersonRequests = array of dPersonRequests; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonRequests2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonRequest: Integer;
FId_PersonRequestSeasons: Integer;
FPersonCodeU: WideString;
FUniversitySpecialitiesKode: WideString;
FNameRequestSeason: WideString;
FRequestPerPerson: Integer;
FId_UniversitySpecialities: Integer;
FUniversitySpecialitiesDateBegin: TXSDateTime;
FUniversitySpecialitiesDateEnd: TXSDateTime;
FUniversityKode: WideString;
FUniversityFullName: WideString;
FUniversityShortName: WideString;
FUniversityFacultetKode: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FSpecCode: WideString;
FSpecClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityName: WideString;
FId_Language: Integer;
FSpecScecializationCode: WideString;
FSpecScecializationName: WideString;
FOriginalDocumentsAdd: Integer;
FId_PersonRequestStatus: Integer;
FId_PersonRequestStatusType: Integer;
FPersonRequestStatusCode: WideString;
FId_PersonRequestStatusTypeName: Integer;
FPersonRequestStatusTypeName: WideString;
FDescryption: WideString;
FIsNeedHostel: Integer;
FCodeOfBusiness: WideString;
FId_PersonEnteranceTypes: Integer;
FPersonEnteranceTypeName: WideString;
FId_PersonRequestExaminationCause: Integer;
FPersonRequestExaminationCauseName: WideString;
FIsContract: Integer;
FIsBudget: Integer;
FId_PersonEducationForm: Integer;
FPersonEducationFormName: WideString;
FKonkursValue: TXSDecimal;
FKonkursValueSource: WideString;
FPriorityRequest: Integer;
FKonkursValueCorrectValue: TXSDecimal;
FKonkursValueCorrectValueDescription: WideString;
FId_PersonRequestSeasonDetails: Integer;
FId_Qualification: Integer;
FQualificationName: WideString;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FId_PersonDocument: Integer;
FEntrantDocumentSeries: WideString;
FEntrantDocumentNumbers: WideString;
FEntrantDocumentDateGet: TXSDateTime;
FEntrantDocumentIssued: WideString;
FEntrantDocumentValue: TXSDecimal;
FIsCheckForPaperCopy: Integer;
FIsNotCheckAttestat: Integer;
FIsForeinghEntrantDocumet: Integer;
FRequestEnteranseCodes: WideString;
FId_UniversityEntrantWave: Integer;
FRequestStatusIsBudejt: Integer;
FRequestStatusIsContract: Integer;
FUniversityEntrantWaveName: WideString;
FIsHigherEducation: Integer;
FSkipDocumentValue: Integer;
FId_PersonDocumentsAwardType: Integer;
FPersonDocumentsAwardTypeName: WideString;
FId_OrderOfEnrollment: Integer;
FSpecSpecialityClasifierCode: WideString;
FId_PersonName: Integer;
FFIO: WideString;
FUniversityPhone: WideString;
FDateCreate: TXSDateTime;
FStatusDateSet: TXSDateTime;
FBossName: WideString;
FAdress: WideString;
FEmail: WideString;
FPhone: WideString;
FWebSite: WideString;
FBossNameW: WideString;
FAdressW: WideString;
FEmailW: WideString;
FPhoneW: WideString;
FWebSiteW: WideString;
FIsEz: Integer;
FDateRegistration: TXSDateTime;
FAdressDocumentGetW: WideString;
FPersonRequestStatusTypeNameEz: WideString;
FId_LanguageEx: Integer;
FLanguageExName: WideString;
FIsForeignWay: Integer;
FId_ForeignType: Integer;
FForeignTypeName: WideString;
FEntranceCodes: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonRequestSeasons: Integer read FId_PersonRequestSeasons write FId_PersonRequestSeasons;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property UniversitySpecialitiesKode: WideString read FUniversitySpecialitiesKode write FUniversitySpecialitiesKode;
property NameRequestSeason: WideString read FNameRequestSeason write FNameRequestSeason;
property RequestPerPerson: Integer read FRequestPerPerson write FRequestPerPerson;
property Id_UniversitySpecialities: Integer read FId_UniversitySpecialities write FId_UniversitySpecialities;
property UniversitySpecialitiesDateBegin: TXSDateTime read FUniversitySpecialitiesDateBegin write FUniversitySpecialitiesDateBegin;
property UniversitySpecialitiesDateEnd: TXSDateTime read FUniversitySpecialitiesDateEnd write FUniversitySpecialitiesDateEnd;
property UniversityKode: WideString read FUniversityKode write FUniversityKode;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property UniversityShortName: WideString read FUniversityShortName write FUniversityShortName;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property SpecCode: WideString read FSpecCode write FSpecCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property Id_Language: Integer read FId_Language write FId_Language;
property SpecScecializationCode: WideString read FSpecScecializationCode write FSpecScecializationCode;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property OriginalDocumentsAdd: Integer read FOriginalDocumentsAdd write FOriginalDocumentsAdd;
property Id_PersonRequestStatus: Integer read FId_PersonRequestStatus write FId_PersonRequestStatus;
property Id_PersonRequestStatusType: Integer read FId_PersonRequestStatusType write FId_PersonRequestStatusType;
property PersonRequestStatusCode: WideString read FPersonRequestStatusCode write FPersonRequestStatusCode;
property Id_PersonRequestStatusTypeName: Integer read FId_PersonRequestStatusTypeName write FId_PersonRequestStatusTypeName;
property PersonRequestStatusTypeName: WideString read FPersonRequestStatusTypeName write FPersonRequestStatusTypeName;
property Descryption: WideString read FDescryption write FDescryption;
property IsNeedHostel: Integer read FIsNeedHostel write FIsNeedHostel;
property CodeOfBusiness: WideString read FCodeOfBusiness write FCodeOfBusiness;
property Id_PersonEnteranceTypes: Integer read FId_PersonEnteranceTypes write FId_PersonEnteranceTypes;
property PersonEnteranceTypeName: WideString read FPersonEnteranceTypeName write FPersonEnteranceTypeName;
property Id_PersonRequestExaminationCause: Integer read FId_PersonRequestExaminationCause write FId_PersonRequestExaminationCause;
property PersonRequestExaminationCauseName: WideString read FPersonRequestExaminationCauseName write FPersonRequestExaminationCauseName;
property IsContract: Integer read FIsContract write FIsContract;
property IsBudget: Integer read FIsBudget write FIsBudget;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property KonkursValue: TXSDecimal read FKonkursValue write FKonkursValue;
property KonkursValueSource: WideString read FKonkursValueSource write FKonkursValueSource;
property PriorityRequest: Integer read FPriorityRequest write FPriorityRequest;
property KonkursValueCorrectValue: TXSDecimal read FKonkursValueCorrectValue write FKonkursValueCorrectValue;
property KonkursValueCorrectValueDescription: WideString read FKonkursValueCorrectValueDescription write FKonkursValueCorrectValueDescription;
property Id_PersonRequestSeasonDetails: Integer read FId_PersonRequestSeasonDetails write FId_PersonRequestSeasonDetails;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property QualificationName: WideString read FQualificationName write FQualificationName;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property EntrantDocumentSeries: WideString read FEntrantDocumentSeries write FEntrantDocumentSeries;
property EntrantDocumentNumbers: WideString read FEntrantDocumentNumbers write FEntrantDocumentNumbers;
property EntrantDocumentDateGet: TXSDateTime read FEntrantDocumentDateGet write FEntrantDocumentDateGet;
property EntrantDocumentIssued: WideString read FEntrantDocumentIssued write FEntrantDocumentIssued;
property EntrantDocumentValue: TXSDecimal read FEntrantDocumentValue write FEntrantDocumentValue;
property IsCheckForPaperCopy: Integer read FIsCheckForPaperCopy write FIsCheckForPaperCopy;
property IsNotCheckAttestat: Integer read FIsNotCheckAttestat write FIsNotCheckAttestat;
property IsForeinghEntrantDocumet: Integer read FIsForeinghEntrantDocumet write FIsForeinghEntrantDocumet;
property RequestEnteranseCodes: WideString read FRequestEnteranseCodes write FRequestEnteranseCodes;
property Id_UniversityEntrantWave: Integer read FId_UniversityEntrantWave write FId_UniversityEntrantWave;
property RequestStatusIsBudejt: Integer read FRequestStatusIsBudejt write FRequestStatusIsBudejt;
property RequestStatusIsContract: Integer read FRequestStatusIsContract write FRequestStatusIsContract;
property UniversityEntrantWaveName: WideString read FUniversityEntrantWaveName write FUniversityEntrantWaveName;
property IsHigherEducation: Integer read FIsHigherEducation write FIsHigherEducation;
property SkipDocumentValue: Integer read FSkipDocumentValue write FSkipDocumentValue;
property Id_PersonDocumentsAwardType: Integer read FId_PersonDocumentsAwardType write FId_PersonDocumentsAwardType;
property PersonDocumentsAwardTypeName: WideString read FPersonDocumentsAwardTypeName write FPersonDocumentsAwardTypeName;
property Id_OrderOfEnrollment: Integer read FId_OrderOfEnrollment write FId_OrderOfEnrollment;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property Id_PersonName: Integer read FId_PersonName write FId_PersonName;
property FIO: WideString read FFIO write FFIO;
property UniversityPhone: WideString read FUniversityPhone write FUniversityPhone;
property DateCreate: TXSDateTime read FDateCreate write FDateCreate;
property StatusDateSet: TXSDateTime read FStatusDateSet write FStatusDateSet;
property BossName: WideString read FBossName write FBossName;
property Adress: WideString read FAdress write FAdress;
property Email: WideString read FEmail write FEmail;
property Phone: WideString read FPhone write FPhone;
property WebSite: WideString read FWebSite write FWebSite;
property BossNameW: WideString read FBossNameW write FBossNameW;
property AdressW: WideString read FAdressW write FAdressW;
property EmailW: WideString read FEmailW write FEmailW;
property PhoneW: WideString read FPhoneW write FPhoneW;
property WebSiteW: WideString read FWebSiteW write FWebSiteW;
property IsEz: Integer read FIsEz write FIsEz;
property DateRegistration: TXSDateTime read FDateRegistration write FDateRegistration;
property AdressDocumentGetW: WideString read FAdressDocumentGetW write FAdressDocumentGetW;
property PersonRequestStatusTypeNameEz: WideString read FPersonRequestStatusTypeNameEz write FPersonRequestStatusTypeNameEz;
property Id_LanguageEx: Integer read FId_LanguageEx write FId_LanguageEx;
property LanguageExName: WideString read FLanguageExName write FLanguageExName;
property IsForeignWay: Integer read FIsForeignWay write FIsForeignWay;
property Id_ForeignType: Integer read FId_ForeignType write FId_ForeignType;
property ForeignTypeName: WideString read FForeignTypeName write FForeignTypeName;
property EntranceCodes: WideString read FEntranceCodes write FEntranceCodes;
end;
ArrayOfDPersonRequests2 = array of dPersonRequests2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationPaymentTypes = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducationPaymentType: Integer;
FPersonEducationPaymentTypeName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
end;
ArrayOfDPersonEducationPaymentTypes = array of dPersonEducationPaymentTypes; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsStudentsGrupsPersonsFind = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FId_Person: Integer;
FFIO: WideString;
FBirthday: TXSDateTime;
FPersonCodeU: WideString;
FId_PersonEducation: Integer;
FId_PersonEducationHistory: Integer;
FId_PersonEducationPaymentType: Integer;
FPersonEducationPaymentTypeName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryTypeName: WideString;
FAcademicYearName: WideString;
FCourseName: WideString;
FPersonEducationFormName: WideString;
FUniversityFacultetFullName: WideString;
FQualificationName: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FUniversityGroupFullName: WideString;
FIsRefill: Integer;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
FSpecIndastryCode: WideString;
FSpecIndastryClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionsCode: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationCode: WideString;
FSpecScecializationName: WideString;
FResident: Integer;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Person: Integer read FId_Person write FId_Person;
property FIO: WideString read FFIO write FFIO;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property CourseName: WideString read FCourseName write FCourseName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
property SpecIndastryCode: WideString read FSpecIndastryCode write FSpecIndastryCode;
property SpecIndastryClasifierCode: WideString read FSpecIndastryClasifierCode write FSpecIndastryClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionsCode: WideString read FSpecDirectionsCode write FSpecDirectionsCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityCode: WideString read FSpecSpecialityCode write FSpecSpecialityCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationCode: WideString read FSpecScecializationCode write FSpecScecializationCode;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property Resident: Integer read FResident write FResident;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
end;
ArrayOfDPersonsStudentsGrupsPersonsFind = array of dPersonsStudentsGrupsPersonsFind; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsStudentsGrupsPersonsFind2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FId_Person: Integer;
FFIO: WideString;
FBirthday: TXSDateTime;
FPersonCodeU: WideString;
FId_PersonEducation: Integer;
FId_PersonEducationHistory: Integer;
FId_PersonEducationPaymentType: Integer;
FPersonEducationPaymentTypeName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryTypeName: WideString;
FAcademicYearName: WideString;
FCourseName: WideString;
FPersonEducationFormName: WideString;
FUniversityFacultetFullName: WideString;
FQualificationName: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FUniversityGroupFullName: WideString;
FIsRefill: Integer;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
FSpecIndastryCode: WideString;
FSpecIndastryClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionsCode: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationCode: WideString;
FSpecScecializationName: WideString;
FResident: Integer;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
FCountryName: WideString;
FSpecProfessionClassifierCode1: WideString;
FSpecProfessionName1: WideString;
FSpecProfessionClassifierCode2: WideString;
FSpecProfessionName2: WideString;
FSpecProfessionClassifierCode3: WideString;
FSpecProfessionName3: WideString;
FSpecProfessionClassifierCode4: WideString;
FSpecProfessionName4: WideString;
FSpecProfessionClassifierCode5: WideString;
FSpecProfessionName5: WideString;
FSpecProfessionCode1: WideString;
FSpecProfessionCode2: WideString;
FSpecProfessionCode3: WideString;
FSpecProfessionCode4: WideString;
FSpecProfessionCode5: WideString;
FSpecComplexName: WideString;
FSpecProfession1_MaxRang: WideString;
FSpecProfession2_MaxRang: WideString;
FSpecProfession3_MaxRang: WideString;
FSpecProfession4_MaxRang: WideString;
FSpecProfession5_MaxRang: WideString;
FSpecProfession1_CurRang: WideString;
FSpecProfession2_CurRang: WideString;
FSpecProfession3_CurRang: WideString;
FSpecProfession4_CurRang: WideString;
FSpecProfession5_CurRang: WideString;
FId_SpecProfessions1RangType: Integer;
FId_SpecProfessions2RangType: Integer;
FId_SpecProfessions3RangType: Integer;
FId_SpecProfessions4RangType: Integer;
FId_SpecProfessions5RangType: Integer;
FSpecProfessionsRangTypeName1: WideString;
FSpecProfessionsRangTypeName2: WideString;
FSpecProfessionsRangTypeName3: WideString;
FSpecProfessionsRangTypeName4: WideString;
FSpecProfessionsRangTypeName5: WideString;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FIsAfterDiplomEducation: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Person: Integer read FId_Person write FId_Person;
property FIO: WideString read FFIO write FFIO;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property CourseName: WideString read FCourseName write FCourseName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
property SpecIndastryCode: WideString read FSpecIndastryCode write FSpecIndastryCode;
property SpecIndastryClasifierCode: WideString read FSpecIndastryClasifierCode write FSpecIndastryClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionsCode: WideString read FSpecDirectionsCode write FSpecDirectionsCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityCode: WideString read FSpecSpecialityCode write FSpecSpecialityCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationCode: WideString read FSpecScecializationCode write FSpecScecializationCode;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property Resident: Integer read FResident write FResident;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
property CountryName: WideString read FCountryName write FCountryName;
property SpecProfessionClassifierCode1: WideString read FSpecProfessionClassifierCode1 write FSpecProfessionClassifierCode1;
property SpecProfessionName1: WideString read FSpecProfessionName1 write FSpecProfessionName1;
property SpecProfessionClassifierCode2: WideString read FSpecProfessionClassifierCode2 write FSpecProfessionClassifierCode2;
property SpecProfessionName2: WideString read FSpecProfessionName2 write FSpecProfessionName2;
property SpecProfessionClassifierCode3: WideString read FSpecProfessionClassifierCode3 write FSpecProfessionClassifierCode3;
property SpecProfessionName3: WideString read FSpecProfessionName3 write FSpecProfessionName3;
property SpecProfessionClassifierCode4: WideString read FSpecProfessionClassifierCode4 write FSpecProfessionClassifierCode4;
property SpecProfessionName4: WideString read FSpecProfessionName4 write FSpecProfessionName4;
property SpecProfessionClassifierCode5: WideString read FSpecProfessionClassifierCode5 write FSpecProfessionClassifierCode5;
property SpecProfessionName5: WideString read FSpecProfessionName5 write FSpecProfessionName5;
property SpecProfessionCode1: WideString read FSpecProfessionCode1 write FSpecProfessionCode1;
property SpecProfessionCode2: WideString read FSpecProfessionCode2 write FSpecProfessionCode2;
property SpecProfessionCode3: WideString read FSpecProfessionCode3 write FSpecProfessionCode3;
property SpecProfessionCode4: WideString read FSpecProfessionCode4 write FSpecProfessionCode4;
property SpecProfessionCode5: WideString read FSpecProfessionCode5 write FSpecProfessionCode5;
property SpecComplexName: WideString read FSpecComplexName write FSpecComplexName;
property SpecProfession1_MaxRang: WideString read FSpecProfession1_MaxRang write FSpecProfession1_MaxRang;
property SpecProfession2_MaxRang: WideString read FSpecProfession2_MaxRang write FSpecProfession2_MaxRang;
property SpecProfession3_MaxRang: WideString read FSpecProfession3_MaxRang write FSpecProfession3_MaxRang;
property SpecProfession4_MaxRang: WideString read FSpecProfession4_MaxRang write FSpecProfession4_MaxRang;
property SpecProfession5_MaxRang: WideString read FSpecProfession5_MaxRang write FSpecProfession5_MaxRang;
property SpecProfession1_CurRang: WideString read FSpecProfession1_CurRang write FSpecProfession1_CurRang;
property SpecProfession2_CurRang: WideString read FSpecProfession2_CurRang write FSpecProfession2_CurRang;
property SpecProfession3_CurRang: WideString read FSpecProfession3_CurRang write FSpecProfession3_CurRang;
property SpecProfession4_CurRang: WideString read FSpecProfession4_CurRang write FSpecProfession4_CurRang;
property SpecProfession5_CurRang: WideString read FSpecProfession5_CurRang write FSpecProfession5_CurRang;
property Id_SpecProfessions1RangType: Integer read FId_SpecProfessions1RangType write FId_SpecProfessions1RangType;
property Id_SpecProfessions2RangType: Integer read FId_SpecProfessions2RangType write FId_SpecProfessions2RangType;
property Id_SpecProfessions3RangType: Integer read FId_SpecProfessions3RangType write FId_SpecProfessions3RangType;
property Id_SpecProfessions4RangType: Integer read FId_SpecProfessions4RangType write FId_SpecProfessions4RangType;
property Id_SpecProfessions5RangType: Integer read FId_SpecProfessions5RangType write FId_SpecProfessions5RangType;
property SpecProfessionsRangTypeName1: WideString read FSpecProfessionsRangTypeName1 write FSpecProfessionsRangTypeName1;
property SpecProfessionsRangTypeName2: WideString read FSpecProfessionsRangTypeName2 write FSpecProfessionsRangTypeName2;
property SpecProfessionsRangTypeName3: WideString read FSpecProfessionsRangTypeName3 write FSpecProfessionsRangTypeName3;
property SpecProfessionsRangTypeName4: WideString read FSpecProfessionsRangTypeName4 write FSpecProfessionsRangTypeName4;
property SpecProfessionsRangTypeName5: WideString read FSpecProfessionsRangTypeName5 write FSpecProfessionsRangTypeName5;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property IsAfterDiplomEducation: Integer read FIsAfterDiplomEducation write FIsAfterDiplomEducation;
end;
ArrayOfDPersonsStudentsGrupsPersonsFind2 = array of dPersonsStudentsGrupsPersonsFind2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsStudentsGrupsPersons = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FId_Person: Integer;
FFIO: WideString;
FBirthday: TXSDateTime;
FPersonCodeU: WideString;
FId_PersonEducation: Integer;
FId_PersonEducationHistory: Integer;
FId_PersonEducationPaymentType: Integer;
FPersonEducationPaymentTypeName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryTypeName: WideString;
FResident: Integer;
FIsRefill: Integer;
FId_PersonEducationHistoryType: Integer;
FPersonEducationHistoryDesciption: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FUniversityGroupCode: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FId_PersonRequest: Integer;
FId_PersonDocument: Integer;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FPersonEducationFormName: WideString;
FAcademicYearName: WideString;
FQualificationName: WideString;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
FCourseName: WideString;
FSpecIndastryCode: WideString;
FSpecIndastryClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionsCode: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecSpecializationCode: WideString;
FSpecSpecializationName: WideString;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Person: Integer read FId_Person write FId_Person;
property FIO: WideString read FFIO write FFIO;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property Resident: Integer read FResident write FResident;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property PersonEducationHistoryDesciption: WideString read FPersonEducationHistoryDesciption write FPersonEducationHistoryDesciption;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property UniversityGroupCode: WideString read FUniversityGroupCode write FUniversityGroupCode;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
property CourseName: WideString read FCourseName write FCourseName;
property SpecIndastryCode: WideString read FSpecIndastryCode write FSpecIndastryCode;
property SpecIndastryClasifierCode: WideString read FSpecIndastryClasifierCode write FSpecIndastryClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionsCode: WideString read FSpecDirectionsCode write FSpecDirectionsCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityCode: WideString read FSpecSpecialityCode write FSpecSpecialityCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecSpecializationCode: WideString read FSpecSpecializationCode write FSpecSpecializationCode;
property SpecSpecializationName: WideString read FSpecSpecializationName write FSpecSpecializationName;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
end;
ArrayOfDPersonsStudentsGrupsPersons = array of dPersonsStudentsGrupsPersons; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonsStudentsGrupsPersons2 = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_UniversityGroup: Integer;
FUniversityFacultetKode: WideString;
FId_PersonEducationForm: Integer;
FId_Qualification: Integer;
FSpecCode: WideString;
FId_Course: Integer;
FId_AcademicYear: Integer;
FId_Person: Integer;
FFIO: WideString;
FBirthday: TXSDateTime;
FPersonCodeU: WideString;
FId_PersonEducation: Integer;
FId_PersonEducationHistory: Integer;
FId_PersonEducationPaymentType: Integer;
FPersonEducationPaymentTypeName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryTypeName: WideString;
FResident: Integer;
FIsRefill: Integer;
FId_PersonEducationHistoryType: Integer;
FPersonEducationHistoryDesciption: WideString;
FPersonEducationHistoryDateBegin: TXSDateTime;
FUniversityGroupCode: WideString;
FUniversityGroupFullName: WideString;
FUniversityGroupShortName: WideString;
FUniversityFacultetFullName: WideString;
FUniversityFacultetShortName: WideString;
FId_PersonRequest: Integer;
FId_PersonDocument: Integer;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FPersonEducationFormName: WideString;
FAcademicYearName: WideString;
FQualificationName: WideString;
FId_QualificationGroup: Integer;
FQualificationGroupName: WideString;
FCourseName: WideString;
FSpecIndastryCode: WideString;
FSpecIndastryClasifierCode: WideString;
FSpecIndastryName: WideString;
FSpecDirectionsCode: WideString;
FSpecClasifierCode: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FSpecSpecialityName: WideString;
FSpecSpecializationCode: WideString;
FSpecSpecializationName: WideString;
FId_PersonEducationsCancelEducationType: Integer;
FPersonEducationsCancelEducationTypeName: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FSpecProfessionClassifierCode1: WideString;
FSpecProfessionName1: WideString;
FSpecProfessionClassifierCode2: WideString;
FSpecProfessionName2: WideString;
FSpecProfessionClassifierCode3: WideString;
FSpecProfessionName3: WideString;
FSpecProfessionClassifierCode4: WideString;
FSpecProfessionName4: WideString;
FSpecProfessionClassifierCode5: WideString;
FSpecProfessionName5: WideString;
FSpecProfession1_MaxRang: WideString;
FSpecProfession2_MaxRang: WideString;
FSpecProfession3_MaxRang: WideString;
FSpecProfession4_MaxRang: WideString;
FSpecProfession5_MaxRang: WideString;
FSpecProfession1_CurRang: WideString;
FSpecProfession2_CurRang: WideString;
FSpecProfession3_CurRang: WideString;
FSpecProfession4_CurRang: WideString;
FSpecProfession5_CurRang: WideString;
FId_SpecProfessions1RangType: Integer;
FId_SpecProfessions2RangType: Integer;
FId_SpecProfessions3RangType: Integer;
FId_SpecProfessions4RangType: Integer;
FId_SpecProfessions5RangType: Integer;
FSpecProfessionsRangTypeName1: WideString;
FSpecProfessionsRangTypeName2: WideString;
FSpecProfessionsRangTypeName3: WideString;
FSpecProfessionsRangTypeName4: WideString;
FSpecProfessionsRangTypeName5: WideString;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FIsAfterDiplomEducation: Integer;
FSpecProfessionCode1: WideString;
FSpecProfessionCode2: WideString;
FSpecProfessionCode3: WideString;
FSpecProfessionCode4: WideString;
FSpecProfessionCode5: WideString;
FSpecComplexName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property SpecCode: WideString read FSpecCode write FSpecCode;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Person: Integer read FId_Person write FId_Person;
property FIO: WideString read FFIO write FFIO;
property Birthday: TXSDateTime read FBirthday write FBirthday;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationHistory: Integer read FId_PersonEducationHistory write FId_PersonEducationHistory;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property Resident: Integer read FResident write FResident;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property PersonEducationHistoryDesciption: WideString read FPersonEducationHistoryDesciption write FPersonEducationHistoryDesciption;
property PersonEducationHistoryDateBegin: TXSDateTime read FPersonEducationHistoryDateBegin write FPersonEducationHistoryDateBegin;
property UniversityGroupCode: WideString read FUniversityGroupCode write FUniversityGroupCode;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property UniversityGroupShortName: WideString read FUniversityGroupShortName write FUniversityGroupShortName;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property UniversityFacultetShortName: WideString read FUniversityFacultetShortName write FUniversityFacultetShortName;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property QualificationGroupName: WideString read FQualificationGroupName write FQualificationGroupName;
property CourseName: WideString read FCourseName write FCourseName;
property SpecIndastryCode: WideString read FSpecIndastryCode write FSpecIndastryCode;
property SpecIndastryClasifierCode: WideString read FSpecIndastryClasifierCode write FSpecIndastryClasifierCode;
property SpecIndastryName: WideString read FSpecIndastryName write FSpecIndastryName;
property SpecDirectionsCode: WideString read FSpecDirectionsCode write FSpecDirectionsCode;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityCode: WideString read FSpecSpecialityCode write FSpecSpecialityCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecSpecializationCode: WideString read FSpecSpecializationCode write FSpecSpecializationCode;
property SpecSpecializationName: WideString read FSpecSpecializationName write FSpecSpecializationName;
property Id_PersonEducationsCancelEducationType: Integer read FId_PersonEducationsCancelEducationType write FId_PersonEducationsCancelEducationType;
property PersonEducationsCancelEducationTypeName: WideString read FPersonEducationsCancelEducationTypeName write FPersonEducationsCancelEducationTypeName;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property SpecProfessionClassifierCode1: WideString read FSpecProfessionClassifierCode1 write FSpecProfessionClassifierCode1;
property SpecProfessionName1: WideString read FSpecProfessionName1 write FSpecProfessionName1;
property SpecProfessionClassifierCode2: WideString read FSpecProfessionClassifierCode2 write FSpecProfessionClassifierCode2;
property SpecProfessionName2: WideString read FSpecProfessionName2 write FSpecProfessionName2;
property SpecProfessionClassifierCode3: WideString read FSpecProfessionClassifierCode3 write FSpecProfessionClassifierCode3;
property SpecProfessionName3: WideString read FSpecProfessionName3 write FSpecProfessionName3;
property SpecProfessionClassifierCode4: WideString read FSpecProfessionClassifierCode4 write FSpecProfessionClassifierCode4;
property SpecProfessionName4: WideString read FSpecProfessionName4 write FSpecProfessionName4;
property SpecProfessionClassifierCode5: WideString read FSpecProfessionClassifierCode5 write FSpecProfessionClassifierCode5;
property SpecProfessionName5: WideString read FSpecProfessionName5 write FSpecProfessionName5;
property SpecProfession1_MaxRang: WideString read FSpecProfession1_MaxRang write FSpecProfession1_MaxRang;
property SpecProfession2_MaxRang: WideString read FSpecProfession2_MaxRang write FSpecProfession2_MaxRang;
property SpecProfession3_MaxRang: WideString read FSpecProfession3_MaxRang write FSpecProfession3_MaxRang;
property SpecProfession4_MaxRang: WideString read FSpecProfession4_MaxRang write FSpecProfession4_MaxRang;
property SpecProfession5_MaxRang: WideString read FSpecProfession5_MaxRang write FSpecProfession5_MaxRang;
property SpecProfession1_CurRang: WideString read FSpecProfession1_CurRang write FSpecProfession1_CurRang;
property SpecProfession2_CurRang: WideString read FSpecProfession2_CurRang write FSpecProfession2_CurRang;
property SpecProfession3_CurRang: WideString read FSpecProfession3_CurRang write FSpecProfession3_CurRang;
property SpecProfession4_CurRang: WideString read FSpecProfession4_CurRang write FSpecProfession4_CurRang;
property SpecProfession5_CurRang: WideString read FSpecProfession5_CurRang write FSpecProfession5_CurRang;
property Id_SpecProfessions1RangType: Integer read FId_SpecProfessions1RangType write FId_SpecProfessions1RangType;
property Id_SpecProfessions2RangType: Integer read FId_SpecProfessions2RangType write FId_SpecProfessions2RangType;
property Id_SpecProfessions3RangType: Integer read FId_SpecProfessions3RangType write FId_SpecProfessions3RangType;
property Id_SpecProfessions4RangType: Integer read FId_SpecProfessions4RangType write FId_SpecProfessions4RangType;
property Id_SpecProfessions5RangType: Integer read FId_SpecProfessions5RangType write FId_SpecProfessions5RangType;
property SpecProfessionsRangTypeName1: WideString read FSpecProfessionsRangTypeName1 write FSpecProfessionsRangTypeName1;
property SpecProfessionsRangTypeName2: WideString read FSpecProfessionsRangTypeName2 write FSpecProfessionsRangTypeName2;
property SpecProfessionsRangTypeName3: WideString read FSpecProfessionsRangTypeName3 write FSpecProfessionsRangTypeName3;
property SpecProfessionsRangTypeName4: WideString read FSpecProfessionsRangTypeName4 write FSpecProfessionsRangTypeName4;
property SpecProfessionsRangTypeName5: WideString read FSpecProfessionsRangTypeName5 write FSpecProfessionsRangTypeName5;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property IsAfterDiplomEducation: Integer read FIsAfterDiplomEducation write FIsAfterDiplomEducation;
property SpecProfessionCode1: WideString read FSpecProfessionCode1 write FSpecProfessionCode1;
property SpecProfessionCode2: WideString read FSpecProfessionCode2 write FSpecProfessionCode2;
property SpecProfessionCode3: WideString read FSpecProfessionCode3 write FSpecProfessionCode3;
property SpecProfessionCode4: WideString read FSpecProfessionCode4 write FSpecProfessionCode4;
property SpecProfessionCode5: WideString read FSpecProfessionCode5 write FSpecProfessionCode5;
property SpecComplexName: WideString read FSpecComplexName write FSpecComplexName;
end;
ArrayOfDPersonsStudentsGrupsPersons2 = array of dPersonsStudentsGrupsPersons2; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonEducationsFull = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_PersonEducation: Integer;
FId_PersonEducationForm: Integer;
FPersonEducationFormName: WideString;
FId_PersonEducationType: Integer;
FPersonEducationDateBegin: TXSDateTime;
FPersonEducationDateEnd: TXSDateTime;
FInstitutionCode: WideString;
FId_University: Integer;
FUniversityFullName: WideString;
FUniversityFacultetKode: WideString;
FUniversityFacultetFullName: WideString;
FQualificationName: WideString;
FSpecDirectionName: WideString;
FSpecSpecialityName: WideString;
FSpecScecializationName: WideString;
FSpecClasifierCode: WideString;
FSpecSpecialityClasifierCode: WideString;
FPersonCodeU: WideString;
FCourseName: WideString;
FAcademicYearName: WideString;
FId_PersonEducationHistoryOrders: Integer;
FPersonEducationHistoryOrdersNumber: WideString;
FPersonEducationHistoryOrdersDate: TXSDateTime;
FUniversityGroupFullName: WideString;
FPersonEducationPaymentTypeName: WideString;
FPersonEducationHistoryTypeName: WideString;
FIsRefill: Integer;
FId_PersonRequest: Integer;
FId_PersonDocument: Integer;
FDocumentSeries: WideString;
FDocumentNumbers: WideString;
FDocumentDateGet: TXSDateTime;
FId_PersonDocumentType: Integer;
FPersonDocumentTypeName: WideString;
FId_PersonEducationPaymentType: Integer;
FId_PersonEducationHistoryType: Integer;
FId_AcademicYear: Integer;
FId_Course: Integer;
FId_Qualification: Integer;
FId_QualificationGroup: Integer;
FId_UniversityGroup: Integer;
FSpecCode: WideString;
FIsSecondHigher: Integer;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_PersonEducation: Integer read FId_PersonEducation write FId_PersonEducation;
property Id_PersonEducationForm: Integer read FId_PersonEducationForm write FId_PersonEducationForm;
property PersonEducationFormName: WideString read FPersonEducationFormName write FPersonEducationFormName;
property Id_PersonEducationType: Integer read FId_PersonEducationType write FId_PersonEducationType;
property PersonEducationDateBegin: TXSDateTime read FPersonEducationDateBegin write FPersonEducationDateBegin;
property PersonEducationDateEnd: TXSDateTime read FPersonEducationDateEnd write FPersonEducationDateEnd;
property InstitutionCode: WideString read FInstitutionCode write FInstitutionCode;
property Id_University: Integer read FId_University write FId_University;
property UniversityFullName: WideString read FUniversityFullName write FUniversityFullName;
property UniversityFacultetKode: WideString read FUniversityFacultetKode write FUniversityFacultetKode;
property UniversityFacultetFullName: WideString read FUniversityFacultetFullName write FUniversityFacultetFullName;
property QualificationName: WideString read FQualificationName write FQualificationName;
property SpecDirectionName: WideString read FSpecDirectionName write FSpecDirectionName;
property SpecSpecialityName: WideString read FSpecSpecialityName write FSpecSpecialityName;
property SpecScecializationName: WideString read FSpecScecializationName write FSpecScecializationName;
property SpecClasifierCode: WideString read FSpecClasifierCode write FSpecClasifierCode;
property SpecSpecialityClasifierCode: WideString read FSpecSpecialityClasifierCode write FSpecSpecialityClasifierCode;
property PersonCodeU: WideString read FPersonCodeU write FPersonCodeU;
property CourseName: WideString read FCourseName write FCourseName;
property AcademicYearName: WideString read FAcademicYearName write FAcademicYearName;
property Id_PersonEducationHistoryOrders: Integer read FId_PersonEducationHistoryOrders write FId_PersonEducationHistoryOrders;
property PersonEducationHistoryOrdersNumber: WideString read FPersonEducationHistoryOrdersNumber write FPersonEducationHistoryOrdersNumber;
property PersonEducationHistoryOrdersDate: TXSDateTime read FPersonEducationHistoryOrdersDate write FPersonEducationHistoryOrdersDate;
property UniversityGroupFullName: WideString read FUniversityGroupFullName write FUniversityGroupFullName;
property PersonEducationPaymentTypeName: WideString read FPersonEducationPaymentTypeName write FPersonEducationPaymentTypeName;
property PersonEducationHistoryTypeName: WideString read FPersonEducationHistoryTypeName write FPersonEducationHistoryTypeName;
property IsRefill: Integer read FIsRefill write FIsRefill;
property Id_PersonRequest: Integer read FId_PersonRequest write FId_PersonRequest;
property Id_PersonDocument: Integer read FId_PersonDocument write FId_PersonDocument;
property DocumentSeries: WideString read FDocumentSeries write FDocumentSeries;
property DocumentNumbers: WideString read FDocumentNumbers write FDocumentNumbers;
property DocumentDateGet: TXSDateTime read FDocumentDateGet write FDocumentDateGet;
property Id_PersonDocumentType: Integer read FId_PersonDocumentType write FId_PersonDocumentType;
property PersonDocumentTypeName: WideString read FPersonDocumentTypeName write FPersonDocumentTypeName;
property Id_PersonEducationPaymentType: Integer read FId_PersonEducationPaymentType write FId_PersonEducationPaymentType;
property Id_PersonEducationHistoryType: Integer read FId_PersonEducationHistoryType write FId_PersonEducationHistoryType;
property Id_AcademicYear: Integer read FId_AcademicYear write FId_AcademicYear;
property Id_Course: Integer read FId_Course write FId_Course;
property Id_Qualification: Integer read FId_Qualification write FId_Qualification;
property Id_QualificationGroup: Integer read FId_QualificationGroup write FId_QualificationGroup;
property Id_UniversityGroup: Integer read FId_UniversityGroup write FId_UniversityGroup;
property SpecCode: WideString read FSpecCode write FSpecCode;
property IsSecondHigher: Integer read FIsSecondHigher write FIsSecondHigher;
end;
ArrayOfDPersonEducationsFull = array of dPersonEducationsFull; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// ************************************************************************ //
dPersonCountry = class(TRemotable)
private
FExtensionData: ExtensionDataObject;
FId_Country: Integer;
FCountryName: WideString;
public
destructor Destroy; override;
published
property ExtensionData: ExtensionDataObject read FExtensionData write FExtensionData;
property Id_Country: Integer read FId_Country write FId_Country;
property CountryName: WideString read FCountryName write FCountryName;
end;
ArrayOfDPersonCountry = array of dPersonCountry; { "http://edboservice.ua/" }
// ************************************************************************ //
// Namespace : http://edboservice.ua/
// soapAction: http://edboservice.ua/%operationName%
// transport : http://schemas.xmlsoap.org/soap/http
// binding : EDBOPersonSoap
// service : EDBOPerson
// port : EDBOPersonSoap
// URL : http://ias.donnu.edu.ua/EDBOdata/EDBOPersonToFMASService.asmx
// ************************************************************************ //
EDBOPersonSoap = interface(IInvokable)
['{D85BDD64-A6B6-26EE-9FC8-7EC3E291D844}']
function Login(const User: WideString; const Password: WideString; const ClearPreviewSession: Integer; const ApplicationKey: WideString): WideString; stdcall;
function GetLastError(const GUIDSession: WideString): ArrayOfDLastError; stdcall;
function QualificationsGet(const SessionGUID: WideString; const Id_Language: Integer; const ActualDate: WideString): ArrayOfDQualification; stdcall;
function PersonRequestSeasonsGet(const SessionGUID: WideString; const Id_Language: Integer; const ActualDate: WideString; const Id_PersonRequestSeasons: Integer; const Id_PersonEducationForm: Integer; const OnlyActive: Integer): ArrayOfDPersonRequestSeasons; stdcall;
function PersonEducationFormsGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer): ArrayOfDPersonEducationFormsGet; stdcall;
function PersonGetId(const SessionGUID: WideString; const Id_Person: Integer; const PersonCodeU: WideString): ArrayOfDPersonAddRet; stdcall;
function PersonsIdsGet(const SessionGUID: WideString; const Id_Language: Integer; const Id_PersonRequestSeasons: Integer; const UniversityKode: WideString): ArrayOfDPersonsIds; stdcall;
function PersonContactsGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonContact: Integer): ArrayOfDPersonContacts; stdcall;
function PersonsFind(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const FIOMask: WideString; const DocumentSeries: WideString; const DocumentNumber: WideString; const Ids_DocumentTypes: WideString; const Hundred: Integer; const PersonCodeU: WideString; const Filters: WideString
): ArrayOfDPersonsFind; stdcall;
function PersonsFind2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const FIOMask: WideString; const DocumentSeries: WideString; const DocumentNumber: WideString; const Ids_DocumentTypes: WideString; const Hundred: Integer; const PersonCodeU: WideString; const Filters: WideString
): ArrayOfDPersonsFind2; stdcall;
function CountriesGet(const SessionGUID: WideString; const Id_Language: Integer; const ActualDate: WideString): ArrayOfDCountries; stdcall;
function LanguagesGet(const SessionGUID: WideString): ArrayOfDLanguages; stdcall;
function PersonsStudentsGrupsGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const Type_: Integer; const UniversityKode: WideString; const Id_AcademicYear: Integer; const Filters: WideString): ArrayOfDPersonsStudentsGrups; stdcall;
function PersonsStudentsGrupsGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const Type_: Integer; const UniversityKode: WideString; const Id_AcademicYear: Integer; const Filters: WideString): ArrayOfDPersonsStudentsGrups2; stdcall;
function PersonSOAPPhotoGet(const SessionGUID: WideString; const UniversityKode: WideString; const PersonCodeU: WideString): ArrayOfDPersonSOAPPhoto; stdcall;
function PersonEducationHistoryTypesGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer): ArrayOfDPersonEducationHistoryTypes; stdcall;
function PersonEducationHistoryOrdersStatusesGet(const SessionGUID: WideString): ArrayOfDPersonEducationHistoryOrdersStatuses; stdcall;
function PersonEducationHistoryOrdersGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const UniversityKode: WideString; const Id_PersonEducationHistoryType: Integer; const Id_PersonEducationHistoryOrderStatus: Integer; const Filters: WideString): ArrayOfDPersonEducationHistoryOrders; stdcall;
function PersonEducationHistoryOrdersGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const UniversityKode: WideString; const Id_PersonEducationHistoryType: Integer; const Id_PersonEducationHistoryOrderStatus: Integer; const Filters: WideString): ArrayOfDPersonEducationHistoryOrders2; stdcall;
function PersonDocumentTypesGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer): ArrayOfDPersonDocumentTypes; stdcall;
function PersonDocumentsGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonDocumentType: Integer; const Id_PersonDocument: Integer; const UniversityKode: WideString; const IsEntrantDocument: Integer): ArrayOfDPersonDocuments; stdcall;
function PersonDocumentsGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonDocumentType: Integer; const Id_PersonDocument: Integer; const UniversityKode: WideString; const IsEntrantDocument: Integer): ArrayOfDPersonDocuments2; stdcall;
function PersonEducationsGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonEducation: Integer; const Id_PersonEducationType: Integer; const Filters: WideString): ArrayOfDPersonEducations; stdcall;
function PersonEducationsGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonEducation: Integer; const Id_PersonEducationType: Integer; const Filters: WideString): ArrayOfDPersonEducations2; stdcall;
function PersonEducationHistoryOrdersDataGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const Id_PersonEducationHistoryOrders: Integer; const Filters: WideString): ArrayOfDPersonEducationHistoryOrdersData; stdcall;
function PersonEducationHistoryOrdersDataGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const Id_PersonEducationHistoryOrders: Integer; const Filters: WideString): ArrayOfDPersonEducationHistoryOrdersData2; stdcall;
function PersonEducationHistoryOrdersChangeFIODataGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const Id_PersonEducationHistoryOrders: Integer; const Filters: WideString): ArrayOfDPersonEducationHistoryOrdersChangeFIOData; stdcall;
function PersonEducationHistoryGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonEducation: Integer; const IsActiveOnly: Integer): ArrayOfDPersonEducationHistory; stdcall;
function PersonEducationHistoryGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonEducation: Integer; const IsActiveOnly: Integer): ArrayOfDPersonEducationHistory2; stdcall;
function PersonAddressesGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonAddress: Integer): ArrayOfDPersonAddresses; stdcall;
function PersonAddressesGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonAddress: Integer): ArrayOfDPersonAddresses2; stdcall;
function PersonTypeDictGet(const SessionGUID: WideString; const Id_Language: Integer): ArrayOfDPersonTypeDictGet; stdcall;
function PersonRequestsGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonRequestSeasons: Integer; const Id_PersonRequest: Integer; const UniversityFacultetKode: WideString; const Id_PersonEducationForm: Integer; const Id_Qualification: Integer; const Filters: WideString
): ArrayOfDPersonRequests; stdcall;
function PersonRequestsGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const PersonCodeU: WideString; const Id_PersonRequestSeasons: Integer; const Id_PersonRequest: Integer; const UniversityFacultetKode: WideString; const Id_PersonEducationForm: Integer; const Id_Qualification: Integer; const Filters: WideString
): ArrayOfDPersonRequests2; stdcall;
function PersonEducationPaymentTypesGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer): ArrayOfDPersonEducationPaymentTypes; stdcall;
function PersonsStudentsGrupsPersonsFind(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const UniversityKode: WideString; const Filters: WideString): ArrayOfDPersonsStudentsGrupsPersonsFind; stdcall;
function PersonsStudentsGrupsPersonsFind2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const UniversityKode: WideString; const Filters: WideString): ArrayOfDPersonsStudentsGrupsPersonsFind2; stdcall;
function PersonsStudentsGrupsPersonsGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const UniversityKode: WideString; const Id_AcademicYear: Integer; const Id_UniversityGroup: Integer; const UniversityFacultetKode: WideString; const Id_PersonEducationForm: Integer; const Id_Qualification: Integer; const SpecCode: WideString;
const Id_Course: Integer; const Filters: WideString; const IgnoreSpec: Integer): ArrayOfDPersonsStudentsGrupsPersons; stdcall;
function PersonsStudentsGrupsPersonsGet2(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const UniversityKode: WideString; const Id_AcademicYear: Integer; const Id_UniversityGroup: Integer; const UniversityFacultetKode: WideString; const Id_PersonEducationForm: Integer; const Id_Qualification: Integer; const SpecCode: WideString;
const Id_Course: Integer; const Filters: WideString; const IgnoreSpec: Integer; const SpecProfessionCode1: WideString; const SpecProfessionCode2: WideString; const SpecProfessionCode3: WideString; const SpecProfessionCode4: WideString; const SpecProfessionCode5: WideString; const SpecProfession1_MaxRang: WideString;
const SpecProfession2_MaxRang: WideString; const SpecProfession3_MaxRang: WideString; const SpecProfession4_MaxRang: WideString; const SpecProfession5_MaxRang: WideString): ArrayOfDPersonsStudentsGrupsPersons2; stdcall;
function PersonEducationsFullGet(const SessionGUID: WideString; const ActualDate: WideString; const Id_Language: Integer; const UniversityKode: WideString; const Id_PersonRequestSeasons: Integer): ArrayOfDPersonEducationsFull; stdcall;
function PersonCountryGet(const SessionGUID: WideString; const PersonCodeU: WideString): ArrayOfDPersonCountry; stdcall;
end;
function GetEDBOPersonSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): EDBOPersonSoap;
implementation
function GetEDBOPersonSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): EDBOPersonSoap;
const
defWSDL = 'D:\DonnU\SourcesSVN\FMAS-WIN\Contingent_Student\Sources\WSDL\EDBOPersonToFMASService.wsdl';
defURL = 'http://ias.donnu.edu.ua/EDBOdata/EDBOPersonToFMASService.asmx';
defSvc = 'EDBOPerson';
defPrt = 'EDBOPersonSoap';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as EDBOPersonSoap);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
destructor dLastError.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dQualification.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FQualificationDateLastChange) then
FQualificationDateLastChange.Free;
inherited Destroy;
end;
destructor dPersonRequestSeasons.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FDateBeginPersonRequestSeason) then
FDateBeginPersonRequestSeason.Free;
if Assigned(FDateEndPersonRequestSeason) then
FDateEndPersonRequestSeason.Free;
inherited Destroy;
end;
destructor dPersonEducationFormsGet.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonAddRet.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonsIds.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FDateLastChange) then
FDateLastChange.Free;
inherited Destroy;
end;
destructor dPersonContacts.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonsFind.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonNameDateBegin) then
FPersonNameDateBegin.Free;
if Assigned(FPersonNameDateEnd) then
FPersonNameDateEnd.Free;
if Assigned(FPasportDate) then
FPasportDate.Free;
if Assigned(FAtestatDate) then
FAtestatDate.Free;
inherited Destroy;
end;
destructor dPersonsFind2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonNameDateBegin) then
FPersonNameDateBegin.Free;
if Assigned(FPersonNameDateEnd) then
FPersonNameDateEnd.Free;
if Assigned(FPasportDate) then
FPasportDate.Free;
if Assigned(FAtestatDate) then
FAtestatDate.Free;
inherited Destroy;
end;
destructor dCountries.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dLanguages.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonsStudentsGrups.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonsStudentsGrups2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonSOAPPhoto.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonPhotoDateLastChange) then
FPersonPhotoDateLastChange.Free;
inherited Destroy;
end;
destructor dPersonEducationHistoryTypes.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonEducationHistoryOrdersStatuses.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonEducationHistoryOrders.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
if Assigned(FPersonEducationHistoryOrdersDateLastChange) then
FPersonEducationHistoryOrdersDateLastChange.Free;
if Assigned(FRegulationDocumentVerificationHistoryDateLastChange) then
FRegulationDocumentVerificationHistoryDateLastChange.Free;
inherited Destroy;
end;
destructor dPersonEducationHistoryOrders2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
if Assigned(FPersonEducationHistoryOrdersDateLastChange) then
FPersonEducationHistoryOrdersDateLastChange.Free;
if Assigned(FRegulationDocumentVerificationHistoryDateLastChange) then
FRegulationDocumentVerificationHistoryDateLastChange.Free;
inherited Destroy;
end;
destructor dPersonDocumentTypes.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonDocuments.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
if Assigned(FDocumentExpiredDate) then
FDocumentExpiredDate.Free;
if Assigned(FPersonDocumentBegin) then
FPersonDocumentBegin.Free;
if Assigned(FPersonDocumentEnd) then
FPersonDocumentEnd.Free;
if Assigned(FAtestatValue) then
FAtestatValue.Free;
inherited Destroy;
end;
destructor dPersonDocuments2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
if Assigned(FDocumentExpiredDate) then
FDocumentExpiredDate.Free;
if Assigned(FPersonDocumentBegin) then
FPersonDocumentBegin.Free;
if Assigned(FPersonDocumentEnd) then
FPersonDocumentEnd.Free;
if Assigned(FAtestatValue) then
FAtestatValue.Free;
inherited Destroy;
end;
destructor dPersonEducations.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
inherited Destroy;
end;
destructor dPersonEducations2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
inherited Destroy;
end;
destructor dPersonEducationHistoryOrdersData.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
inherited Destroy;
end;
destructor dPersonEducationHistoryOrdersData2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
inherited Destroy;
end;
destructor dPersonEducationHistoryOrdersChangeFIOData.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
if Assigned(FFIODateChange) then
FFIODateChange.Free;
inherited Destroy;
end;
destructor dPersonEducationHistory.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FDateLastChange) then
FDateLastChange.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
if Assigned(FPersonEducationHistoryDateEnd) then
FPersonEducationHistoryDateEnd.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
inherited Destroy;
end;
destructor dPersonEducationHistory2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FDateLastChange) then
FDateLastChange.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
if Assigned(FPersonEducationHistoryDateEnd) then
FPersonEducationHistoryDateEnd.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
inherited Destroy;
end;
destructor dPersonAddresses.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonHomeAddressDetaeBegin) then
FPersonHomeAddressDetaeBegin.Free;
if Assigned(FPersonHomeAddressDetaeEnd) then
FPersonHomeAddressDetaeEnd.Free;
inherited Destroy;
end;
destructor dPersonAddresses2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonHomeAddressDetaeBegin) then
FPersonHomeAddressDetaeBegin.Free;
if Assigned(FPersonHomeAddressDetaeEnd) then
FPersonHomeAddressDetaeEnd.Free;
inherited Destroy;
end;
destructor dPersonTypeDictGet.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FDateLastChange) then
FDateLastChange.Free;
inherited Destroy;
end;
destructor dPersonRequests.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FUniversitySpecialitiesDateBegin) then
FUniversitySpecialitiesDateBegin.Free;
if Assigned(FUniversitySpecialitiesDateEnd) then
FUniversitySpecialitiesDateEnd.Free;
if Assigned(FKonkursValue) then
FKonkursValue.Free;
if Assigned(FKonkursValueCorrectValue) then
FKonkursValueCorrectValue.Free;
if Assigned(FEntrantDocumentDateGet) then
FEntrantDocumentDateGet.Free;
if Assigned(FEntrantDocumentValue) then
FEntrantDocumentValue.Free;
inherited Destroy;
end;
destructor dPersonRequests2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FUniversitySpecialitiesDateBegin) then
FUniversitySpecialitiesDateBegin.Free;
if Assigned(FUniversitySpecialitiesDateEnd) then
FUniversitySpecialitiesDateEnd.Free;
if Assigned(FKonkursValue) then
FKonkursValue.Free;
if Assigned(FKonkursValueCorrectValue) then
FKonkursValueCorrectValue.Free;
if Assigned(FEntrantDocumentDateGet) then
FEntrantDocumentDateGet.Free;
if Assigned(FEntrantDocumentValue) then
FEntrantDocumentValue.Free;
if Assigned(FDateCreate) then
FDateCreate.Free;
if Assigned(FStatusDateSet) then
FStatusDateSet.Free;
if Assigned(FDateRegistration) then
FDateRegistration.Free;
inherited Destroy;
end;
destructor dPersonEducationPaymentTypes.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
destructor dPersonsStudentsGrupsPersonsFind.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
inherited Destroy;
end;
destructor dPersonsStudentsGrupsPersonsFind2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
inherited Destroy;
end;
destructor dPersonsStudentsGrupsPersons.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
inherited Destroy;
end;
destructor dPersonsStudentsGrupsPersons2.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FBirthday) then
FBirthday.Free;
if Assigned(FPersonEducationHistoryDateBegin) then
FPersonEducationHistoryDateBegin.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
inherited Destroy;
end;
destructor dPersonEducationsFull.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
if Assigned(FPersonEducationDateBegin) then
FPersonEducationDateBegin.Free;
if Assigned(FPersonEducationDateEnd) then
FPersonEducationDateEnd.Free;
if Assigned(FPersonEducationHistoryOrdersDate) then
FPersonEducationHistoryOrdersDate.Free;
if Assigned(FDocumentDateGet) then
FDocumentDateGet.Free;
inherited Destroy;
end;
destructor dPersonCountry.Destroy;
begin
if Assigned(FExtensionData) then
FExtensionData.Free;
inherited Destroy;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(EDBOPersonSoap), 'http://edboservice.ua/', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(EDBOPersonSoap), 'http://edboservice.ua/%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(EDBOPersonSoap), ioDocument);
InvRegistry.RegisterExternalParamName(TypeInfo(EDBOPersonSoap), 'PersonsStudentsGrupsGet', 'Type_', 'Type');
InvRegistry.RegisterExternalParamName(TypeInfo(EDBOPersonSoap), 'PersonsStudentsGrupsGet2', 'Type_', 'Type');
RemClassRegistry.RegisterXSClass(ExtensionDataObject, 'http://edboservice.ua/', 'ExtensionDataObject');
RemClassRegistry.RegisterXSClass(dLastError, 'http://edboservice.ua/', 'dLastError');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDLastError), 'http://edboservice.ua/', 'ArrayOfDLastError');
RemClassRegistry.RegisterXSClass(dQualification, 'http://edboservice.ua/', 'dQualification');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDQualification), 'http://edboservice.ua/', 'ArrayOfDQualification');
RemClassRegistry.RegisterXSClass(dPersonRequestSeasons, 'http://edboservice.ua/', 'dPersonRequestSeasons');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonRequestSeasons), 'http://edboservice.ua/', 'ArrayOfDPersonRequestSeasons');
RemClassRegistry.RegisterXSClass(dPersonEducationFormsGet, 'http://edboservice.ua/', 'dPersonEducationFormsGet');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationFormsGet), 'http://edboservice.ua/', 'ArrayOfDPersonEducationFormsGet');
RemClassRegistry.RegisterXSClass(dPersonAddRet, 'http://edboservice.ua/', 'dPersonAddRet');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonAddRet), 'http://edboservice.ua/', 'ArrayOfDPersonAddRet');
RemClassRegistry.RegisterXSClass(dPersonsIds, 'http://edboservice.ua/', 'dPersonsIds');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsIds), 'http://edboservice.ua/', 'ArrayOfDPersonsIds');
RemClassRegistry.RegisterXSClass(dPersonContacts, 'http://edboservice.ua/', 'dPersonContacts');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonContacts), 'http://edboservice.ua/', 'ArrayOfDPersonContacts');
RemClassRegistry.RegisterXSClass(dPersonsFind, 'http://edboservice.ua/', 'dPersonsFind');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsFind), 'http://edboservice.ua/', 'ArrayOfDPersonsFind');
RemClassRegistry.RegisterXSClass(dPersonsFind2, 'http://edboservice.ua/', 'dPersonsFind2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsFind2), 'http://edboservice.ua/', 'ArrayOfDPersonsFind2');
RemClassRegistry.RegisterXSClass(dCountries, 'http://edboservice.ua/', 'dCountries');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDCountries), 'http://edboservice.ua/', 'ArrayOfDCountries');
RemClassRegistry.RegisterXSClass(dLanguages, 'http://edboservice.ua/', 'dLanguages');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDLanguages), 'http://edboservice.ua/', 'ArrayOfDLanguages');
RemClassRegistry.RegisterXSClass(dPersonsStudentsGrups, 'http://edboservice.ua/', 'dPersonsStudentsGrups');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsStudentsGrups), 'http://edboservice.ua/', 'ArrayOfDPersonsStudentsGrups');
RemClassRegistry.RegisterXSClass(dPersonsStudentsGrups2, 'http://edboservice.ua/', 'dPersonsStudentsGrups2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsStudentsGrups2), 'http://edboservice.ua/', 'ArrayOfDPersonsStudentsGrups2');
RemClassRegistry.RegisterXSClass(dPersonSOAPPhoto, 'http://edboservice.ua/', 'dPersonSOAPPhoto');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonSOAPPhoto), 'http://edboservice.ua/', 'ArrayOfDPersonSOAPPhoto');
RemClassRegistry.RegisterXSClass(dPersonEducationHistoryTypes, 'http://edboservice.ua/', 'dPersonEducationHistoryTypes');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistoryTypes), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistoryTypes');
RemClassRegistry.RegisterXSClass(dPersonEducationHistoryOrdersStatuses, 'http://edboservice.ua/', 'dPersonEducationHistoryOrdersStatuses');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistoryOrdersStatuses), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistoryOrdersStatuses');
RemClassRegistry.RegisterXSClass(dPersonEducationHistoryOrders, 'http://edboservice.ua/', 'dPersonEducationHistoryOrders');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistoryOrders), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistoryOrders');
RemClassRegistry.RegisterXSClass(dPersonEducationHistoryOrders2, 'http://edboservice.ua/', 'dPersonEducationHistoryOrders2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistoryOrders2), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistoryOrders2');
RemClassRegistry.RegisterXSClass(dPersonDocumentTypes, 'http://edboservice.ua/', 'dPersonDocumentTypes');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonDocumentTypes), 'http://edboservice.ua/', 'ArrayOfDPersonDocumentTypes');
RemClassRegistry.RegisterXSClass(dPersonDocuments, 'http://edboservice.ua/', 'dPersonDocuments');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonDocuments), 'http://edboservice.ua/', 'ArrayOfDPersonDocuments');
RemClassRegistry.RegisterXSClass(dPersonDocuments2, 'http://edboservice.ua/', 'dPersonDocuments2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonDocuments2), 'http://edboservice.ua/', 'ArrayOfDPersonDocuments2');
RemClassRegistry.RegisterXSClass(dPersonEducations, 'http://edboservice.ua/', 'dPersonEducations');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducations), 'http://edboservice.ua/', 'ArrayOfDPersonEducations');
RemClassRegistry.RegisterXSClass(dPersonEducations2, 'http://edboservice.ua/', 'dPersonEducations2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducations2), 'http://edboservice.ua/', 'ArrayOfDPersonEducations2');
RemClassRegistry.RegisterXSClass(dPersonEducationHistoryOrdersData, 'http://edboservice.ua/', 'dPersonEducationHistoryOrdersData');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistoryOrdersData), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistoryOrdersData');
RemClassRegistry.RegisterXSClass(dPersonEducationHistoryOrdersData2, 'http://edboservice.ua/', 'dPersonEducationHistoryOrdersData2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistoryOrdersData2), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistoryOrdersData2');
RemClassRegistry.RegisterXSClass(dPersonEducationHistoryOrdersChangeFIOData, 'http://edboservice.ua/', 'dPersonEducationHistoryOrdersChangeFIOData');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistoryOrdersChangeFIOData), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistoryOrdersChangeFIOData');
RemClassRegistry.RegisterXSClass(dPersonEducationHistory, 'http://edboservice.ua/', 'dPersonEducationHistory');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistory), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistory');
RemClassRegistry.RegisterXSClass(dPersonEducationHistory2, 'http://edboservice.ua/', 'dPersonEducationHistory2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationHistory2), 'http://edboservice.ua/', 'ArrayOfDPersonEducationHistory2');
RemClassRegistry.RegisterXSClass(dPersonAddresses, 'http://edboservice.ua/', 'dPersonAddresses');
RemClassRegistry.RegisterExternalPropName(TypeInfo(dPersonAddresses), 'Type_', 'Type');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonAddresses), 'http://edboservice.ua/', 'ArrayOfDPersonAddresses');
RemClassRegistry.RegisterXSClass(dPersonAddresses2, 'http://edboservice.ua/', 'dPersonAddresses2');
RemClassRegistry.RegisterExternalPropName(TypeInfo(dPersonAddresses2), 'Type_', 'Type');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonAddresses2), 'http://edboservice.ua/', 'ArrayOfDPersonAddresses2');
RemClassRegistry.RegisterXSClass(dPersonTypeDictGet, 'http://edboservice.ua/', 'dPersonTypeDictGet');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonTypeDictGet), 'http://edboservice.ua/', 'ArrayOfDPersonTypeDictGet');
RemClassRegistry.RegisterXSClass(dPersonRequests, 'http://edboservice.ua/', 'dPersonRequests');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonRequests), 'http://edboservice.ua/', 'ArrayOfDPersonRequests');
RemClassRegistry.RegisterXSClass(dPersonRequests2, 'http://edboservice.ua/', 'dPersonRequests2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonRequests2), 'http://edboservice.ua/', 'ArrayOfDPersonRequests2');
RemClassRegistry.RegisterXSClass(dPersonEducationPaymentTypes, 'http://edboservice.ua/', 'dPersonEducationPaymentTypes');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationPaymentTypes), 'http://edboservice.ua/', 'ArrayOfDPersonEducationPaymentTypes');
RemClassRegistry.RegisterXSClass(dPersonsStudentsGrupsPersonsFind, 'http://edboservice.ua/', 'dPersonsStudentsGrupsPersonsFind');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsStudentsGrupsPersonsFind), 'http://edboservice.ua/', 'ArrayOfDPersonsStudentsGrupsPersonsFind');
RemClassRegistry.RegisterXSClass(dPersonsStudentsGrupsPersonsFind2, 'http://edboservice.ua/', 'dPersonsStudentsGrupsPersonsFind2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsStudentsGrupsPersonsFind2), 'http://edboservice.ua/', 'ArrayOfDPersonsStudentsGrupsPersonsFind2');
RemClassRegistry.RegisterXSClass(dPersonsStudentsGrupsPersons, 'http://edboservice.ua/', 'dPersonsStudentsGrupsPersons');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsStudentsGrupsPersons), 'http://edboservice.ua/', 'ArrayOfDPersonsStudentsGrupsPersons');
RemClassRegistry.RegisterXSClass(dPersonsStudentsGrupsPersons2, 'http://edboservice.ua/', 'dPersonsStudentsGrupsPersons2');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonsStudentsGrupsPersons2), 'http://edboservice.ua/', 'ArrayOfDPersonsStudentsGrupsPersons2');
RemClassRegistry.RegisterXSClass(dPersonEducationsFull, 'http://edboservice.ua/', 'dPersonEducationsFull');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonEducationsFull), 'http://edboservice.ua/', 'ArrayOfDPersonEducationsFull');
RemClassRegistry.RegisterXSClass(dPersonCountry, 'http://edboservice.ua/', 'dPersonCountry');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfDPersonCountry), 'http://edboservice.ua/', 'ArrayOfDPersonCountry');
end. |
{***************************************************************************}
{ }
{ Delphi Package Manager - DPM }
{ }
{ Copyright © 2019 Vincent Parrett and contributors }
{ }
{ vincent@finalbuilder.com }
{ https://www.finalbuilder.com }
{ }
{ }
{***************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{***************************************************************************}
unit DPM.Console.Command.List;
interface
uses
VSoft.CancellationToken,
DPM.Console.ExitCodes,
DPM.Console.Command.Base,
DPM.Core.Logging,
DPM.Core.Configuration.Interfaces,
DPM.Core.Repository.Interfaces;
type
TListCommand = class(TBaseCommand)
private
FRepositoryManager : IPackageRepositoryManager;
protected
function Execute(const cancellationToken : ICancellationToken) : TExitCode; override;
public
constructor Create(const logger : ILogger; const configurationManager : IConfigurationManager; const repositoryManager : IPackageRepositoryManager);reintroduce;
end;
implementation
uses
Spring.Collections,
DPM.Core.Types,
DPM.Core.Utils.Strings,
DPM.Core.Options.Common,
DPM.Core.Options.List,
DPM.Core.Package.Interfaces;
{ TListCommand }
constructor TListCommand.Create(const logger: ILogger; const configurationManager: IConfigurationManager; const repositoryManager : IPackageRepositoryManager);
begin
inherited Create(logger, configurationManager);
FRepositoryManager := repositoryManager;
end;
function TListCommand.Execute(const cancellationToken : ICancellationToken) : TExitCode;
var
searchResults : IList<IPackageListItem>;
item : IPackageListItem;
resultString : string;
config : IConfiguration;
begin
result := TExitCode.Error;
TListOptions.Default.ApplyCommon(TCommonOptions.Default);
if not TListOptions.Default.Validate(Logger) then
begin
result := TExitCode.InvalidArguments;
exit;
end;
if TListOptions.Default.ConfigFile = '' then
begin
result := TExitCode.InvalidArguments;
exit;
end;
TListOptions.Default.Take := MaxInt;
config := FConfigurationManager.LoadConfig(TListOptions.Default.ConfigFile);
if config = nil then
exit(TExitCode.InitException);
FRepositoryManager.Initialize(config);
searchResults := FRepositoryManager.List(cancellationToken, TListOptions.Default);
//TODO : re-implement this
if searchResults.Any then
begin
//group by id+version+compiler, collect platforms
for item in searchResults do
begin
if cancellationToken.IsCancelled then
exit;
resultString := TStringUtils.PadRight(item.Id, 24) + #9+'v' + TStringUtils.PadRight(item.Version.ToString, 15) + ' [Delphi ' + CompilerToString(item.CompilerVersion) + ' - ' + item.Platforms + ']';
Logger.Information(resultString);
end;
result := TExitCode.OK;
end
else
Logger.Information('No packages were found');
end;
end.
|
program swap;
var a_i, b_i : Integer;
var a_r, b_r : Real;
(*procedure mit call by reference mit Integer als Datentyp*)
procedure swapInt(var i1, i2 : Integer);
var temp_i : Integer;
begin
temp_i := i1;
i1 := i2;
i2 := temp_i;
end;
(*procedure mit call by reference mit Real als Datentyp*)
procedure swapReal(var r1, r2 : Real);
var temp_r : Real;
begin
temp_r := r1;
r1 := r2;
r2 := temp_r;
end;
begin
a_i := 1;
b_i := 2;
a_r := 1;
b_r := 2;
WriteLn('-- Vertauschungsprozedur --',#13#10,'Variable a_i (Integer): ',a_i,' Variable b_i (Integer): ',b_i);
swapint(a_i,b_i);
WriteLn('Getauscht:',#13#10,'Variable a_i (Integer): ',a_i,' Variable b_i (Integer): ',b_i,#13#10);
(*:2:2 zur limitierung der angezeigten Stellen auf zwei vor und -nachkomma Stellen*)
WriteLn('Variable a_r (Real): ',a_r:2:2,' Variable b_r (Real): ',b_r:2:2);
swapreal(a_r,b_r);
WriteLn('Getauscht:',#13#10,'Variable a_r (Real): ',a_r:2:2,' Variable b_r (Real): ',b_r:2:2);
end. |
(*
Category: SWAG Title: DIRECTORY HANDLING ROUTINES
Original name: 0012.PAS
Description: Make/Change DIR
Author: SWAG SUPPORT TEAM
Date: 05-28-93 13:37
*)
Program MakeChangeDir;
{ Purpose: - Make directories where they don't exist }
{ }
{ Useful for: - Installation Type Programs }
{ }
{ Useful notes: - seems to handles even directories With extentions }
{ (i.e. DIRDIR.YYY) }
{ - there are some defaults that have been set up :- }
{ change if needed }
{ - doesn't check to see how legal the required directory }
{ is (i.e. spaces, colon in the wrong place, etc.) }
{ }
{ Legal junk: - this has been released to the public as public domain }
{ - if you use it, give me some credit! }
{ }
Var
Slash : Array[1..20] of Integer;
Procedure MkDirCDir(Target : String);
Var
i,
count : Integer;
dir,
home,
tempdir : String;
begin
{ sample directory below to make }
Dir := Target;
{ add slash at end if not given }
if Dir[Length(Dir)] <> '\' then
Dir := Dir + '\';
{ if colon where normally is change to that drive }
if Dir[2] = ':' then
ChDir(Copy(Dir, 1, 2))
else
{ assume current drive (and directory) }
begin
GetDir(0, Home);
if Dir[1] <> '\' then
Dir := Home + '\' + Dir
else
Dir := Home + Dir;
end;
Count := 0;
{ search directory For slashed and Record them }
For i := 1 to Length(Dir) do
begin
if Dir[i] = '\' then
begin
Inc(Count);
Slash[Count] := i;
end;
end;
{ For each step of the way, change to the directory }
{ if get error, assume it doesn't exist - make it }
{ then change to it }
For i := 2 to Count do
begin
TempDir := Copy(Dir, 1, Slash[i] - 1);
{$I-}
ChDir(TempDir);
if IOResult <> 0 then
begin
MkDir(TempDir);
ChDir(TempDir);
end;
end;
end;
begin
MkDirCDir('D:\HI.ZZZ\GEEKS\2JKD98');
end.
|
unit NFSMonthCalendar;
interface
{$WARN SYMBOL_PLATFORM OFF}
uses
SysUtils, Classes, vcl.Controls, Vcl.ComCtrls, Windows, CommCtrl, Messages, vcl.Dialogs,
vcl.Graphics, system.Types;
type
TCalClickEvent = procedure(Sender: TObject; aDate: TDate) of object;
type
TNFSMonthCalendar = class(TMonthCalendar)
private
_TitleBk: Integer;
_OnDayClick: TCalClickEvent;
_OnTodayClick: TCalClickEvent;
_OnNextClick: TCalClickEvent;
_OnPrevClick: TCalClickEvent;
_Date: TDateTime;
_OnDateChanged: TNotifyEvent;
procedure DoClick;
protected
procedure WndProc(var Message: TMessage); override;
procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED;
procedure CMExit(var Message: TCMExit); message CM_EXIT;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property OnDayClick: TCalClickEvent read _OnDayClick write _OnDayClick;
property OnTodayClick: TCalClickEvent read _OnTodayClick write _OnTodayClick;
property OnNextClick: TCalClickEvent read _OnNextClick write _OnNextClick;
property OnPrevClick: TCalClickEvent read _OnPrevClick write _OnPrevClick;
property OnDateChanged: TNotifyEvent read _OnDateChanged write _OnDateChanged;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('new frontiers', [TNFSMonthCalendar]);
end;
{ TNFSMonthCalendar }
constructor TNFSMonthCalendar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
WeekNumbers := true;
_TitleBk := 0;
_Date := now;
end;
destructor TNFSMonthCalendar.Destroy;
begin
inherited;
end;
procedure TNFSMonthCalendar.DoClick;
var
dt: TDate;
mcht: TMCHitTestInfo;
pt: TPoint;
begin
pt := ScreenToClient(Mouse.CursorPos);
mcht.cbSize := sizeof(mcht);
mcht.Pt := Point(pt.x, pt.y);
MonthCal_HitTest(Handle, mcht);
case mcht.uHit of
MCHT_TITLEBK:
begin
inc(_TitleBk);
end;
MCHT_TITLEMONTH:
begin
dt := EncodeDate(mcht.st.wYear, mcht.st.wMonth, mcht.st.wDay);
if Assigned(_OnDayClick) then
_OnDayClick(Self, dt);
end;
mcht_CalendarDate,
mcht_CalendarDateNext,
mcht_CalendarDatePrev:
begin
if _TitleBk < 0 then
_TitleBk := 0;
if _TitleBk = 0 then
begin
dt := EncodeDate(mcht.st.wYear, mcht.st.wMonth, mcht.st.wDay);
if Assigned(_OnDayClick) then
_OnDayClick(Self, dt);
end;
Dec(_TitleBk);
if _TitleBk < 0 then
_TitleBk := 0;
end;
mcht_TodayLink:
begin
dt := Date;
if Assigned(_OnTodayClick) then
_OnTodayClick(Self, dt);
end;
mcht_TitleBtnNext:
begin
dt := Date;
if Assigned(_OnNextClick) then
_OnNextClick(Self, dt);
end;
mcht_TitleBtnPrev:
begin
dt := Date;
if Assigned(_OnPrevClick) then
_OnPrevClick(Self, dt);
end;
else
//Result := False;
end;
end;
procedure TNFSMonthCalendar.WndProc(var Message: TMessage);
begin
inherited;
if Message.Msg = WM_LBUTTONDOWN then
DoClick;
if _Date <> Date then
begin
_Date := Date;
if Assigned(_OnDateChanged) then
_OnDateChanged(Self);
end;
end;
procedure TNFSMonthCalendar.CMExit(var Message: TCMExit);
begin //
end;
procedure TNFSMonthCalendar.CMFocusChanged(var Message: TCMFocusChanged);
begin //
end;
end.
|
unit UListaProduto;
interface
uses classes,Uproduto;
type TlistaProduto = Class (TList)
private
protected
FListaProduto:TList;
public
procedure AdicionarProduto(Objeto:TProduto);
procedure RemoverProduto(Index:integer);
function ContarItens:Integer;
function getProdutos(Index:integer):TProduto;
procedure setUmaListaProduto(vListaProduto:TList);
function getUmaListaProduto:TList;
property UmaListaProduto:TList read getUmaListaProduto write setUmaListaProduto;
constructor criar;
destructor destruir;
End;
implementation
{ TlistaProduto }
procedure TlistaProduto.AdicionarProduto(Objeto: TProduto);
begin
FListaProduto.Add(Objeto);
end;
function TlistaProduto.ContarItens: Integer;
begin
Result:=UmaListaProduto.Count;
end;
constructor TlistaProduto.criar;
begin
FListaProduto:=TList.Create;
end;
destructor TlistaProduto.destruir;
begin
FListaProduto.Free;
end;
function TlistaProduto.getProdutos(Index: integer): TProduto;
begin
Result:= TProduto(FListaProduto.Items[Index]);
end;
function TlistaProduto.getUmaListaProduto: TList;
begin
Result:= FListaProduto;
end;
procedure TlistaProduto.RemoverProduto(Index: integer);
begin
FListaProduto.Delete(Index);
end;
procedure TlistaProduto.setUmaListaProduto(vListaProduto: TList);
begin
FListaProduto:= vListaProduto;
end;
end.
|
{* ***** BEGIN LICENSE BLOCK *****
Copyright 2010 Sean B. Durkin
This file is part of TurboPower LockBox 3. TurboPower LockBox 3 is free
software being offered under a dual licensing scheme: LGPL3 or MPL1.1.
The contents of this file are subject to the Mozilla Public License (MPL)
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Alternatively, you may redistribute it and/or modify it under the terms of
the GNU Lesser General Public License (LGPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
You should have received a copy of the Lesser GNU General Public License
along with TurboPower LockBox 3. If not, see <http://www.gnu.org/licenses/>.
TurboPower LockBox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. In relation to LGPL,
see the GNU Lesser General Public License for more details. In relation to MPL,
see the MPL License for the specific language governing rights and limitations
under the License.
The Initial Developer of the Original Code for TurboPower LockBox version 2
and earlier was TurboPower Software.
* ***** END LICENSE BLOCK ***** *}
unit uTPLb_RSA_Engine;
interface
uses Classes, uTPLb_StreamCipher, uTPLb_Asymetric, uTPLb_Codec, uTPLb_CodecIntf,
uTPLb_HugeCardinal, uTPLb_MemoryStreamPool;
type
TRSA_Engine = class( TAsymetric_Engine)
protected
// ICryptoGraphicAlgorithm
function DisplayName: string; override;
function ProgId: string; override;
function Features: TAlgorithmicFeatureSet; override;
function DefinitionURL: string; override;
function WikipediaReference: string; override;
// IStreamCipher = interface( )
function LoadKeyFromStream( Store: TStream): TSymetricKey; override;
function AsymetricKeyPairClass: TAsymetricKeyPairClass; override;
function EncClass: TAsymetricEncryptorClass; override;
function DecClass: TAsymetricDecryptorClass; override;
public
procedure GenerateAsymetricKeyPair(
KeySizeInBits: cardinal;
ProgressSender: TObject;
ProgressEvent: TGenerateAsymetricKeyPairProgress;
var KeyPair: TAsymetricKeyPair; var wasAborted: boolean);
override;
function CreateFromStream( Store: TStream; Parts: TKeyStoragePartSet):
TAsymetricKeyPair; override;
end;
const
RSAKeySig = #78#10'LockBox3';
RSAKeyStoreVersion = 1;
type
RSAKeyStorePart = (PartN, PartE, PartD, PartCRT);
RSAKeyStorePartSet = set of RSAKeyStorePart;
IHugeCardinalWrap = interface
['{27B8620A-903B-4695-80DD-20DA9D24BCC4}']
function Value: THugeCardinal;
procedure Burn;
function IsZero: boolean;
end;
TRSAKeyPair = class;
TRSAKeyPart = class( TAsymtricKeyPart)
protected
F_RSA_n: IHugeCardinalWrap;
FOwner: TRSAKeyPair;
function NominalKeyBitLength: cardinal; override;
procedure MarkPartsToStoreLoad( var Parts: RSAKeyStorePartSet); virtual; abstract;
procedure StoreE( Store: TStream); virtual; abstract;
procedure StoreD( Store: TStream); virtual; abstract;
procedure StoreCRT( Store: TStream); virtual; abstract;
procedure StoreSmallPartsToStream( const Parts: RSAKeyStorePartSet; Store: TStream);
procedure LoadE( Store: TStream); virtual; abstract;
procedure LoadD( Store: TStream); virtual; abstract;
procedure LoadCRT( Store: TStream); virtual; abstract;
procedure LoadSmallPartsFromStream( const Parts: RSAKeyStorePartSet; Store: TStream);
procedure SenseVersion( doReadPastHeader: boolean; Store: TStream;
var Version: integer; var AvailableParts: RSAKeyStorePartSet);
public
procedure SaveToStream ( Store: TStream); override;
procedure LoadFromStream( Store: TStream); override;
procedure Burn; override;
end;
TRSA_PublicKeyPart = class( TRSAKeyPart)
protected
procedure MarkPartsToStoreLoad( var Parts: RSAKeyStorePartSet); override;
procedure StoreE( Store: TStream); override;
procedure StoreD( Store: TStream); override;
procedure StoreCRT( Store: TStream); override;
procedure LoadE( Store: TStream); override;
procedure LoadD( Store: TStream); override;
procedure LoadCRT( Store: TStream); override;
public
F_RSA_e: IHugeCardinalWrap;
procedure Burn; override;
function isEmpty: boolean; override;
end;
TRSA_PrivateKeyPart = class( TRSAKeyPart)
protected
procedure MarkPartsToStoreLoad( var Parts: RSAKeyStorePartSet); override;
procedure StoreE( Store: TStream); override;
procedure StoreD( Store: TStream); override;
procedure StoreCRT( Store: TStream); override;
procedure LoadE( Store: TStream); override;
procedure LoadD( Store: TStream); override;
procedure LoadCRT( Store: TStream); override;
public
F_RSA_d: IHugeCardinalWrap;
F_RSA_p, F_RSA_q, F_RSA_dp, F_RSA_dq, F_RSA_qinv: IHugeCardinalWrap;
procedure Burn; override;
function isEmpty: boolean; override;
end;
TRSAKeyPair = class( TAsymetricKeyPair)
private
procedure LinkParts;
procedure CheckLinkages;
protected
FPool: IMemoryStreamPool;
function StoreHugeCardinal(
Number: THugeCardinal; StoreStream: TStream): boolean; virtual;
function LoadHugeCardinal_IfNotAlready(
StoreStream: TStream; var Number: IHugeCardinalWrap): boolean; virtual;
public
F_RSA_n, F_RSA_d, F_RSA_e: IHugeCardinalWrap;
F_RSA_p, F_RSA_q, F_RSA_dp, F_RSA_dq, F_RSA_qinv: IHugeCardinalWrap;
constructor CreateEmpty; override;
destructor Destroy; override;
procedure LoadFromStream( Store: TStream; Parts: TKeyStoragePartSet); override;
procedure StoreToStream( Store: TStream; Parts: TKeyStoragePartSet); override;
procedure Burn; override;
end;
TRSA_Encryptor = class( TAsymetricEncryptor)
public
function GenerateSymetricKey: TSymetricKey; override;
function VerifySignature(
Document: TStream; // FCipherText is the signature to be verified.
ProgressSender: TObject;
ProgressEvent: TOnEncDecProgress;
var wasAborted: boolean): boolean; override;
end;
TRSA_Decryptor = class( TAsymetricDecryptor)
public
function LoadSymetricKey( Ciphertext: TStream): TSymetricKey; override;
procedure Sign( // FPlaintext is the document to be signed.
Signature: TStream;
ProgressSender: TObject;
ProgressEvent: TOnEncDecProgress;
var wasAborted: boolean); override;
end;
implementation
uses uTPLb_RSA_Primitives, SysUtils, Math, uTPLb_HugeCardinalUtils,
uTPLB_Constants, uTPLb_I18n;
{ TRSA_Engine }
function TRSA_Engine.AsymetricKeyPairClass: TAsymetricKeyPairClass;
begin
result := TRSAKeyPair
end;
function TRSA_Engine.DecClass: TAsymetricDecryptorClass;
begin
result := TRSA_Decryptor
end;
function TRSA_Engine.DefinitionURL: string;
begin
result := 'http://www.ietf.org/rfc/rfc3447.txt'
end;
function TRSA_Engine.DisplayName: string;
begin
result := RSA_DisplayName
end;
function TRSA_Engine.EncClass: TAsymetricEncryptorClass;
begin
result := TRSA_Encryptor
end;
function TRSA_Engine.Features: TAlgorithmicFeatureSet;
begin
result := (inherited Features);
Include( result, afStar)
end;
type TRSA_Gen_Key_Helper = class
private
FPool: IMemoryStreamPool;
FdoOwn: boolean;
FNumbersTested: integer;
FClient_ProgressEvent: TGenerateAsymetricKeyPairProgress;
procedure Progress_Event( Sender: TObject; BitsProcessed,
TotalBits: int64; var doAbort: boolean);
procedure PrimalityTest_Event( CountPrimalityTests: integer);
public
constructor Create(
Client_ProgressEvent1: TGenerateAsymetricKeyPairProgress;
const Pool1: IMemoryStreamPool);
destructor Destroy; override;
end;
THugeCardinalWrap = class( TInterfacedObject, IHugeCardinalWrap)
private
FValue: THugeCardinal;
function Value: THugeCardinal;
procedure Burn;
function IsZero: boolean;
public
constructor Create( Value1: THugeCardinal);
destructor Destroy; override;
end;
function NewWrap( Value1: THugeCardinal): IHugeCardinalWrap;
begin
result := THugeCardinalWrap.Create( Value1)
end;
procedure TRSA_Engine.GenerateAsymetricKeyPair(
KeySizeInBits: cardinal; ProgressSender: TObject;
ProgressEvent: TGenerateAsymetricKeyPairProgress;
var KeyPair: TAsymetricKeyPair; var wasAborted: boolean);
var
RSAKeyPair: TRSAKeyPair;
N, e, d, Totient: THugeCardinal;
p, q, dp, dq, qinv: THugeCardinal; // For use with CRT.
GeneratePrimePassCount: integer; // 1 .. 20;
Helper: TRSA_Gen_Key_Helper;
begin
RSAKeyPair := AsymetricKeyPairClass.CreateEmpty as TRSAKeyPair;
GeneratePrimePassCount := 5;
Helper := TRSA_Gen_Key_Helper.Create( ProgressEvent, RSAKeyPair.FPool);
Totient := nil;
try
uTPLb_HugeCardinalUtils.Compute_RSA_Fundamentals_2Factors(
KeySizeInBits, StandardExponent, N, e, d, Totient,
p, q, dp, dq, qinv,
Helper.Progress_Event, Helper.PrimalityTest_Event,
GeneratePrimePassCount, RSAKeyPair.FPool, Helper.FNumbersTested, wasAborted);
if not wasAborted then
begin
RSAKeyPair.F_RSA_n := NewWrap( N);
RSAKeyPair.F_RSA_d := NewWrap( d);
RSAKeyPair.F_RSA_e := NewWrap( e);
RSAKeyPair.F_RSA_p := NewWrap( p);
RSAKeyPair.F_RSA_q := NewWrap( q);
RSAKeyPair.F_RSA_dp := NewWrap( dp);
RSAKeyPair.F_RSA_dq := NewWrap( dq);
RSAKeyPair.F_RSA_qinv := NewWrap( qinv);
RSAKeyPair.LinkParts
end
else
begin
N.Free; d.Free; e.Free;
p.Free; q.Free; dp.Free; dq.Free; qinv.Free;
end
finally
Totient.Free;
Helper.Free
end;
KeyPair := RSAKeyPair
end;
function TRSA_Engine.CreateFromStream(
Store: TStream; Parts: TKeyStoragePartSet): TAsymetricKeyPair;
begin
result := TRSAKeyPair.CreateEmpty;
result.LoadFromStream( Store, Parts)
end;
function TRSA_Engine.LoadKeyFromStream( Store: TStream): TSymetricKey;
begin
result := CreateFromStream( Store, [partPublic, partPrivate])
end;
function TRSA_Engine.ProgId: string;
begin
result := RSA_ProgId
end;
function TRSA_Engine.WikipediaReference: string;
begin
result := 'RSA'
end;
{ TRSAKeyPart }
procedure TRSAKeyPart.Burn;
begin
F_RSA_n.Burn
end;
function TRSAKeyPart.NominalKeyBitLength: cardinal;
var
Xtra: cardinal;
begin
result := F_RSA_n.Value.BitLength;
Xtra := result mod 8;
if Xtra > 0 then
Inc( result, 8 - Xtra)
end;
procedure TRSAKeyPart.StoreSmallPartsToStream( const Parts: RSAKeyStorePartSet; Store: TStream);
var
iVersion: integer;
pBuffer: TBytes;
begin
pBuffer := TEncoding.UTF8.GetBytes(RSAKeySig);
Store.WriteBuffer(pBuffer, Length(pBuffer));
iVersion := RSAKeyStoreVersion;
Store.WriteBuffer( iVersion, SizeOf( iVersion));
Store.WriteBuffer( Parts, SizeOf( Parts));
if (PartN in Parts) and assigned( FOwner) then
FOwner.StoreHugeCardinal( F_RSA_n.Value, Store);
if (PartE in Parts) and assigned( FOwner) then
StoreE( Store);
if (PartD in Parts) and assigned( FOwner) then
StoreD( Store);
if (PartCRT in Parts) and assigned( FOwner) then
StoreCRT( Store);
end;
procedure TRSAKeyPart.SaveToStream( Store: TStream);
var
PartsToStore: RSAKeyStorePartSet;
begin
PartsToStore := [PartN];
MarkPartsToStoreLoad( PartsToStore);
StoreSmallPartsToStream( PartsToSTore, Store)
//FOwner.StoreHugeCardinal( F_RSA_n, Store)
end;
procedure TRSAKeyPart.SenseVersion(
doReadPastHeader: boolean; Store: TStream;
var Version: integer;
var AvailableParts: RSAKeyStorePartSet);
var
pKey: TBytes;
pSig: TBytes;
ReadCount, Count: integer;
Ok: boolean;
begin
pKey := TEncoding.UTF8.GetBytes(RSAKeySig);
SetLength(pSig, Length(pKey));
ReadCount := Store.Read(pSig, Length(pSig));
Ok := (ReadCount = Length(pSig)) and (Length(pKey) = Length(pSig)) and CompareMem(@pKey[0], @pSig[0], Length(pKey));
if Ok then
begin
Count := Store.Read( Version, SizeOf( Version));
Inc( ReadCount, Count);
Ok := (Count = SizeOf( Version)) and (Version >= 1)
end;
if Ok then
begin
Count := Store.Read( AvailableParts, SizeOf( AvailableParts));
Inc( ReadCount, Count);
Ok := Count = SizeOf( AvailableParts)
end;
if (not Ok) or (not doReadPastHeader) then
Store.Seek( -ReadCount, soCurrent);
if not Ok then
begin
Version := 0;
AvailableParts := []
end
end;
procedure TRSAKeyPart.LoadSmallPartsFromStream( const Parts: RSAKeyStorePartSet; Store: TStream);
var
Version: integer;
// Sig: utf8string;
AvailableParts, PartsToLoad: RSAKeyStorePartSet;
begin
SenseVersion( True, Store, Version, AvailableParts);
if Version > RSAKeyStoreVersion then
raise Exception.Create('Invalid or unrecognised format for RSA key');
if Version >= 1 then
begin
if (Parts - AvailableParts - [PartCRT]) <> [] then
raise Exception.Create('Error Message');
PartsToLoad := Parts - [PartCRT];
if ((Parts * [PartD, PartCRT]) <> []) and
(PartCRT in AvailableParts) then
Include( PartsToLoad, PartCRT);
end
else
PartsToLoad := [];
if assigned( FOwner) then
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_n);
if PartE in PartsToLoad then
LoadE( Store);
if PartD in PartsToLoad then
LoadD( Store);
if PartCRT in PartsToLoad then
LoadCRT( Store)
end;
procedure TRSAKeyPart.LoadFromStream( Store: TStream);
var
PartsToLoad: RSAKeyStorePartSet;
begin
PartsToLoad := [PartN];
MarkPartsToStoreLoad( PartsToLoad);
LoadSmallPartsFromStream( PartsToLoad, Store)
// FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_n)
end;
{ TRSA_Encryptor }
function TRSA_Encryptor.GenerateSymetricKey: TSymetricKey;
var
Key: TRSA_PublicKeyPart;
begin
Key := FPublicKey as TRSA_PublicKeyPart;
result := Generate_RSA_SymetricKey(
Key.F_RSA_n.Value, Key.F_RSA_e.Value, FCipherText, FSymetricCodec.BlockCipher)
end;
type
TMonitor = class
private
FSender: TObject;
FEvent: TOnEncDecProgress;
function OnProgress( Sender: TObject; CountBytesProcessed: int64): boolean;
public
constructor Create( Event: TOnEncDecProgress; Sender: TObject);
end;
function TRSA_Encryptor.VerifySignature(
Document: TStream; ProgressSender: TObject;
ProgressEvent: TOnEncDecProgress; var wasAborted: boolean): boolean;
var
Key: TRSA_PublicKeyPart;
Monitor: TMonitor;
OpRes: TLongOpResult;
begin
Key := FPublicKey as TRSA_PublicKeyPart;
wasAborted := False;
result := assigned( Key) and
assigned( Key.F_RSA_n) and (not Key.F_RSA_n.isZero) and
assigned( Key.F_RSA_e) and (not Key.F_RSA_e.isZero);
if result then
begin
Monitor := TMonitor.Create( ProgressEvent, ProgressSender);
try
OpRes := RSASSA_PSS_VERIFY( Key.F_RSA_n.Value, Key.F_RSA_e.Value, Document, FCipherText,
Monitor.OnProgress)
finally
Monitor.Free;
end;
result := OpRes = opPass;
wasAborted := OpRes = opAbort
end
end;
function UnWrap( const Wrap: IHugeCardinalWrap): THugeCardinal;
begin
if assigned( Wrap) then
result := Wrap.Value
else
result := nil
end;
{ TRSA_Decryptor }
function TRSA_Decryptor.LoadSymetricKey( Ciphertext: TStream): TSymetricKey;
var
Key: TRSA_PrivateKeyPart;
begin
Key := FPrivateKey as TRSA_PrivateKeyPart;
result := Extract_RSA_SymetricKey(
UnWrap( Key.F_RSA_d), UnWrap( Key.F_RSA_n),
UnWrap( Key.F_RSA_p), UnWrap( Key.F_RSA_q), UnWrap( Key.F_RSA_dp), UnWrap( Key.F_RSA_dq), UnWrap( Key.F_RSA_qinv),
Ciphertext, FSymetricCodec.BlockCipher)
end;
procedure TRSA_Decryptor.Sign(
Signature: TStream; ProgressSender: TObject;
ProgressEvent: TOnEncDecProgress; var wasAborted: boolean);
var
Succeeded: boolean;
Key: TRSA_PrivateKeyPart;
OpRes: TLongOpResult;
Monitor: TMonitor;
begin
wasAborted := False;
Key := FPrivateKey as TRSA_PrivateKeyPart;
Succeeded := assigned( Key) and
assigned( Key.F_RSA_d) and (not Key.F_RSA_d.isZero) and
assigned( Key.F_RSA_n) and (not Key.F_RSA_n.isZero);
if Succeeded then
begin
Monitor := TMonitor.Create( ProgressEvent, ProgressSender);
try
OpRes := uTPLb_RSA_Primitives.RSASSA_PSS_SIGN(
UnWrap( Key.F_RSA_d), UnWrap( Key.F_RSA_n), FPlainText, Signature, Monitor.OnProgress,
UnWrap( Key.F_RSA_p), UnWrap( Key.F_RSA_q), UnWrap( Key.F_RSA_dp), UnWrap( Key.F_RSA_dq), UnWrap( Key.F_RSA_qinv))
finally
Monitor.Free
end;
// Succeeded := OpRes = opPass;
wasAborted := opRes = opAbort
// Discard Succeeded. It should be impossible to fail.
end
end;
function StoreHugeCardinal_Primitive(
Number: THugeCardinal; StoreStream: TStream): boolean;
// Stores the number in the stream using the cannonical format.
// Returns True if the Number was assigned.
var
L: cardinal;
begin
result := assigned( Number);
if result then
L := (Number.BitLength + 7) div 8
else
L := 0;
if not assigned( StoreStream) then exit;
StoreStream.WriteBuffer( L, SizeOf( L));
if L > 0 then
Number.StreamOut( LittleEndien, StoreStream, L)
end;
function LoadHugeCardinal_Primitive(
StoreStream: TStream; const Pool1: IMemoryStreamPool): THugeCardinal;
// Loads the number from the stream using the cannonical format.
var
L: cardinal;
ValueStream: TMemoryStream;
begin
StoreStream.Read( L, SizeOf( L));
ValueStream := TMemoryStream.Create;
try
StoreStream.ReadBuffer( ValueStream.Memory^, L);
ValueStream.Position := 0;
result := THugeCardinal.CreateFromStreamIn(
L*8, LittleEndien, ValueStream, Pool1)
finally
ValueStream.Free
end end;
function TRSAKeyPair.StoreHugeCardinal(
Number: THugeCardinal; StoreStream: TStream): boolean;
// virtual method.
begin
result := StoreHugeCardinal_Primitive( Number, StoreStream)
end;
procedure TRSAKeyPair.StoreToStream( Store: TStream; Parts: TKeyStoragePartSet);
var
SmallParts: RSAKeyStorePartSet;
begin
if Parts = [] then
SmallParts := []
else
SmallParts := [PartN];
if partPublic in Parts then
(FPublicPart as TRSAKeyPart).MarkPartsToStoreLoad( SmallParts);
if partPrivate in Parts then
(FPrivatePart as TRSAKeyPart).MarkPartsToStoreLoad( SmallParts);
if FPublicPart is TRSAKeyPart then
TRSAKeyPart( FPublicPart).StoreSmallPartsToStream( SmallParts, Store)
else
(FPrivatePart as TRSAKeyPart).StoreSmallPartsToStream( SmallParts, Store)
//if Parts <> [] then
// StoreHugeCardinal( F_RSA_n, Store);
//if partPublic in Parts then
// StoreHugeCardinal( F_RSA_e, Store);
//if partPrivate in Parts then
// StoreHugeCardinal( F_RSA_d, Store)
end;
function TRSAKeyPair.LoadHugeCardinal_IfNotAlready(
StoreStream: TStream; var Number: IHugeCardinalWrap): boolean;
// virtual method.
var
L: cardinal;
ValueStream: TMemoryStream;
begin
result := not assigned( Number);
if not result then exit; // Only load if we are not already loaded.
StoreStream.ReadBuffer( L, SizeOf( L));
ValueStream := TMemoryStream.Create;
try
ValueStream.Size := L;
if L > 0 then
StoreStream.ReadBuffer( ValueStream.Memory^, L);
ValueStream.Position := 0;
Number := NewWrap( THugeCardinal.CreateFromStreamIn(
L*8, LittleEndien, ValueStream, FPool))
finally
ValueStream.Free
end;
if Number.isZero then
Number := nil
end;
{ TRSA_PublicKeyPart }
procedure TRSA_PublicKeyPart.Burn;
begin
inherited;
F_RSA_e.Burn
end;
function TRSA_PublicKeyPart.isEmpty: boolean;
begin
result := (not assigned( F_RSA_e)) or F_RSA_e.isZero
end;
procedure TRSA_PublicKeyPart.LoadCRT( Store: TStream);
begin
if assigned( FOwner) and (FOwner.FPrivatePart is TRSAKeyPart) then
TRSAKeyPart( FOwner.FPrivatePart).LoadCRT( Store)
end;
procedure TRSA_PublicKeyPart.LoadD( Store: TStream);
begin
if assigned( FOwner) and (FOwner.FPrivatePart is TRSAKeyPart) then
TRSAKeyPart( FOwner.FPrivatePart).LoadD( Store)
end;
procedure TRSA_PublicKeyPart.LoadE( Store: TStream);
begin
if assigned( FOwner) then
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_e)
end;
procedure TRSA_PublicKeyPart.MarkPartsToStoreLoad(
var Parts: RSAKeyStorePartSet);
begin
Include( Parts, PartE)
end;
procedure TRSA_PublicKeyPart.StoreCRT( Store: TStream);
begin
if assigned( FOwner) and (FOwner.FPrivatePart is TRSAKeyPart) then
TRSAKeyPart( FOwner.FPrivatePart).StoreCRT( Store)
end;
procedure TRSA_PublicKeyPart.StoreD( Store: TStream);
begin
if assigned( FOwner) and (FOwner.FPrivatePart is TRSAKeyPart) then
TRSAKeyPart( FOwner.FPrivatePart).StoreD( Store)
end;
procedure TRSA_PublicKeyPart.StoreE( Store: TStream);
begin
if assigned( FOwner) then
FOwner.StoreHugeCardinal( F_RSA_e.Value, Store)
end;
{ TRSA_PrivateKeyPart }
procedure TRSA_PrivateKeyPart.Burn;
begin
inherited;
F_RSA_d.Burn
end;
function TRSA_PrivateKeyPart.isEmpty: boolean;
begin
result := (not assigned( F_RSA_d)) or F_RSA_d.isZero
end;
procedure TRSA_PrivateKeyPart.LoadCRT( Store: TStream);
begin
if not assigned( FOwner) then exit;
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_p);
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_q);
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_dp);
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_dq);
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_qinv)
end;
procedure TRSA_PrivateKeyPart.LoadD( Store: TStream);
begin
if assigned( FOwner) then
FOwner.LoadHugeCardinal_IfNotAlready( Store, F_RSA_d)
end;
procedure TRSA_PrivateKeyPart.LoadE( Store: TStream);
begin
if assigned( FOwner) and (FOwner.FPublicPart is TRSAKeyPart) then
TRSAKeyPart( FOwner.FPublicPart).LoadE( Store)
end;
procedure TRSA_PrivateKeyPart.MarkPartsToStoreLoad(
var Parts: RSAKeyStorePartSet);
begin
Include( Parts, PartD);
if assigned( F_RSA_qinv) then
Include( Parts, PartCRT)
end;
procedure TRSA_PrivateKeyPart.StoreCRT( Store: TStream);
begin
if not assigned( FOwner) then exit;
FOwner.StoreHugeCardinal( F_RSA_p.Value, Store);
FOwner.StoreHugeCardinal( F_RSA_q.Value, Store);
FOwner.StoreHugeCardinal( F_RSA_dp.Value, Store);
FOwner.StoreHugeCardinal( F_RSA_dq.Value, Store);
FOwner.StoreHugeCardinal( F_RSA_qinv.Value, Store)
end;
procedure TRSA_PrivateKeyPart.StoreD( Store: TStream);
begin
if assigned( FOwner) then
FOwner.StoreHugeCardinal( F_RSA_d.Value, Store)
end;
procedure TRSA_PrivateKeyPart.StoreE( Store: TStream);
begin
if assigned( FOwner) and (FOwner.FPublicPart is TRSAKeyPart) then
TRSAKeyPart( FOwner.FPublicPart).StoreE( Store)
end;
{ TRSAKeyPair }
procedure TRSAKeyPair.Burn;
begin
if assigned( F_RSA_n) then
F_RSA_n.Burn;
if assigned( F_RSA_e) then
F_RSA_e.Burn;
if assigned( F_RSA_d) then
F_RSA_d.Burn;
if assigned( F_RSA_p) then
F_RSA_p.Burn;
if assigned( F_RSA_q) then
F_RSA_q.Burn;
if assigned( F_RSA_dp) then
F_RSA_dp.Burn;
if assigned( F_RSA_dq) then
F_RSA_dq.Burn;
if assigned( F_RSA_qinv) then
F_RSA_qinv.Burn;
F_RSA_n := nil;
F_RSA_d := nil;
F_RSA_e := nil;
F_RSA_p := nil;
F_RSA_q := nil;
F_RSA_dp := nil;
F_RSA_dq := nil;
F_RSA_qinv := nil;
LinkParts
end;
constructor TRSAKeyPair.CreateEmpty;
begin
FPool := NewPool;
F_RSA_n := nil;
F_RSA_d := nil;
F_RSA_e := nil;
F_RSA_p := nil;
F_RSA_q := nil;
F_RSA_dp := nil;
F_RSA_dq := nil;
F_RSA_qinv := nil;
FPublicPart := TRSA_PublicKeyPart.Create;
FPrivatePart := TRSA_PrivateKeyPart.Create;
LinkParts;
end;
procedure TRSAKeyPair.LinkParts;
begin
(FPublicPart as TRSA_PublicKeyPart).FOwner := self;
(FPublicPart as TRSA_PublicKeyPart).F_RSA_n := F_RSA_n;
(FPublicPart as TRSA_PublicKeyPart).F_RSA_e := F_RSA_e;
(FPrivatePart as TRSA_PrivateKeyPart).FOwner := self;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_n := F_RSA_n;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_d := F_RSA_d;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_p := F_RSA_p;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_q := F_RSA_q;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_dp := F_RSA_dp;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_dq := F_RSA_dq;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_qinv := F_RSA_qinv;
end;
procedure TRSAKeyPair.CheckLinkages;
begin
if not (
(FPublicPart is TRSA_PublicKeyPart ) and
(FPrivatePart is TRSA_PrivateKeyPart) and
(TRSA_PublicKeyPart( FPublicPart).FOwner = self) and
(TRSA_PublicKeyPart( FPublicPart).F_RSA_n = F_RSA_n) and
(TRSA_PublicKeyPart( FPublicPart).F_RSA_e = F_RSA_e) and
(TRSA_PrivateKeyPart( FPrivatePart).FOwner = self) and
(TRSA_PrivateKeyPart( FPrivatePart).F_RSA_n = F_RSA_n) and
(TRSA_PrivateKeyPart( FPrivatePart).F_RSA_d = F_RSA_d) and
(TRSA_PrivateKeyPart( FPrivatePart).F_RSA_p = F_RSA_p) and
(TRSA_PrivateKeyPart( FPrivatePart).F_RSA_q = F_RSA_q) and
(TRSA_PrivateKeyPart( FPrivatePart).F_RSA_dp = F_RSA_dp) and
(TRSA_PrivateKeyPart( FPrivatePart).F_RSA_dq = F_RSA_dq) and
(TRSA_PrivateKeyPart( FPrivatePart).F_RSA_qinv = F_RSA_qinv)) then
raise Exception.Create('TRSAKeyPair linkage error.');
end;
destructor TRSAKeyPair.Destroy;
begin
F_RSA_n := nil;
F_RSA_d := nil;
F_RSA_e := nil;
F_RSA_p := nil;
F_RSA_q := nil;
F_RSA_dp := nil;
F_RSA_dq := nil;
F_RSA_qinv := nil;
FPool := nil;
inherited
end;
procedure TRSAKeyPair.LoadFromStream( Store: TStream; Parts: TKeyStoragePartSet);
var
Version: integer;
AvailableParts, PartsToLoad: RSAKeyStorePartSet;
begin
(FPublicPart as TRSA_PublicKeyPart).SenseVersion( False, Store, Version, AvailableParts);
if Parts <> [] then
begin
F_RSA_n := nil;
(FPublicPart as TRSA_PublicKeyPart).F_RSA_n := nil;
TRSA_PublicKeyPart( FPublicPart).F_RSA_n := nil;
end;
if partPublic in Parts then
begin
F_RSA_e := nil;
TRSA_PublicKeyPart ( FPublicPart).F_RSA_e := nil;
end;
if partPrivate in Parts then
begin
F_RSA_d := nil;
F_RSA_p := nil;
F_RSA_q := nil;
F_RSA_dp := nil;
F_RSA_dq := nil;
F_RSA_qinv := nil;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_d := nil;
TRSA_PrivateKeyPart( FPrivatePart).F_RSA_p := nil;
TRSA_PrivateKeyPart( FPrivatePart).F_RSA_q := nil;
TRSA_PrivateKeyPart( FPrivatePart).F_RSA_dp := nil;
TRSA_PrivateKeyPart( FPrivatePart).F_RSA_dq := nil;
TRSA_PrivateKeyPart( FPrivatePart).F_RSA_qinv := nil;
end;
if Version = 0 then
begin
if Parts <> [] then
LoadHugeCardinal_IfNotAlready( Store, F_RSA_n);
if partPublic in Parts then
LoadHugeCardinal_IfNotAlready( Store, F_RSA_e);
if partPrivate in Parts then
LoadHugeCardinal_IfNotAlready( Store, F_RSA_d);
LinkParts
end
else
begin
PartsToLoad := [];
if Parts <> [] then
Include( PartsToLoad, PartN);
if partPublic in Parts then
Include( PartsToLoad, PartE);
if partPrivate in Parts then
begin
Include( PartsToLoad, PartD);
Include( PartsToLoad, PartCRT);
end;
(FPublicPart as TRSA_PublicKeyPart).LoadSmallPartsFromStream( PartsToLoad, Store);
// n and e are loaded into the public key.
// d, dp, dq, p, q & qinv are loaded into the private key.
F_RSA_n := (FPublicPart as TRSA_PublicKeyPart).F_RSA_n;
F_RSA_e := (FPublicPart as TRSA_PublicKeyPart).F_RSA_e;
(FPrivatePart as TRSA_PrivateKeyPart).F_RSA_n := F_RSA_n;
F_RSA_d := (FPrivatePart as TRSA_PrivateKeyPart).F_RSA_d;
F_RSA_p := TRSA_PrivateKeyPart( FPrivatePart).F_RSA_p;
F_RSA_q := TRSA_PrivateKeyPart( FPrivatePart).F_RSA_q;
F_RSA_dp := TRSA_PrivateKeyPart( FPrivatePart).F_RSA_dp;
F_RSA_dq := TRSA_PrivateKeyPart( FPrivatePart).F_RSA_dq;
F_RSA_qinv := TRSA_PrivateKeyPart( FPrivatePart).F_RSA_qinv
end;
CheckLinkages
end;
{ TRSA_Gen_Key_Helper }
constructor TRSA_Gen_Key_Helper.Create(
Client_ProgressEvent1: TGenerateAsymetricKeyPairProgress;
const Pool1: IMemoryStreamPool);
begin
FPool := Pool1;
FdoOwn := not assigned( FPool);
if FdoOwn then
FPool := NewPool;
FNumbersTested := 0;
FClient_ProgressEvent := Client_ProgressEvent1
end;
destructor TRSA_Gen_Key_Helper.Destroy;
begin
FPool := nil;
inherited
end;
procedure TRSA_Gen_Key_Helper.PrimalityTest_Event( CountPrimalityTests: integer);
begin
end;
procedure TRSA_Gen_Key_Helper.Progress_Event(
Sender: TObject; BitsProcessed, TotalBits: int64; var doAbort: boolean);
begin
if assigned( FClient_ProgressEvent) then
FClient_ProgressEvent( Sender, FNumbersTested, doAbort)
end;
{ TMonitor }
constructor TMonitor.Create(Event: TOnEncDecProgress; Sender: TObject);
begin
FEvent := Event;
FSender := Sender
end;
function TMonitor.OnProgress(
Sender: TObject; CountBytesProcessed: int64): boolean;
begin
// Discard the low-level 'Sender'
if assigned( FEvent) then
result := FEvent( FSender, CountBytesProcessed)
else
result := True
end;
{ THugeCardinalWrap }
procedure THugeCardinalWrap.Burn;
begin
if assigned( FValue) then
FValue.Burn
end;
constructor THugeCardinalWrap.Create( Value1: THugeCardinal);
begin
FValue := Value1
end;
destructor THugeCardinalWrap.Destroy;
begin
FValue.Free;
inherited
end;
function THugeCardinalWrap.IsZero: boolean;
begin
result := (not assigned( FValue)) or FValue.isZero
end;
function THugeCardinalWrap.Value: THugeCardinal;
begin
result := FValue
end;
end.
|
//
// Generated by JavaToPas v1.5 20171018 - 171009
////////////////////////////////////////////////////////////////////////////////
unit android.speech.tts.Voice;
interface
uses
AndroidAPI.JNIBridge,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.os;
type
JVoice = interface;
JVoiceClass = interface(JObjectClass)
['{533A14BC-BBED-47D1-BF16-39C83B1FC67F}']
function _GetCREATOR : JParcelable_Creator; cdecl; // A: $19
function _GetLATENCY_HIGH : Integer; cdecl; // A: $19
function _GetLATENCY_LOW : Integer; cdecl; // A: $19
function _GetLATENCY_NORMAL : Integer; cdecl; // A: $19
function _GetLATENCY_VERY_HIGH : Integer; cdecl; // A: $19
function _GetLATENCY_VERY_LOW : Integer; cdecl; // A: $19
function _GetQUALITY_HIGH : Integer; cdecl; // A: $19
function _GetQUALITY_LOW : Integer; cdecl; // A: $19
function _GetQUALITY_NORMAL : Integer; cdecl; // A: $19
function _GetQUALITY_VERY_HIGH : Integer; cdecl; // A: $19
function _GetQUALITY_VERY_LOW : Integer; cdecl; // A: $19
function describeContents : Integer; cdecl; // ()I A: $1
function equals(obj : JObject) : boolean; cdecl; // (Ljava/lang/Object;)Z A: $1
function getFeatures : JSet; cdecl; // ()Ljava/util/Set; A: $1
function getLatency : Integer; cdecl; // ()I A: $1
function getLocale : JLocale; cdecl; // ()Ljava/util/Locale; A: $1
function getName : JString; cdecl; // ()Ljava/lang/String; A: $1
function getQuality : Integer; cdecl; // ()I A: $1
function hashCode : Integer; cdecl; // ()I A: $1
function init(&name : JString; locale : JLocale; quality : Integer; latency : Integer; requiresNetworkConnection : boolean; features : JSet) : JVoice; cdecl;// (Ljava/lang/String;Ljava/util/Locale;IIZLjava/util/Set;)V A: $1
function isNetworkConnectionRequired : boolean; cdecl; // ()Z A: $1
function toString : JString; cdecl; // ()Ljava/lang/String; A: $1
procedure writeToParcel(dest : JParcel; flags : Integer) ; cdecl; // (Landroid/os/Parcel;I)V A: $1
property CREATOR : JParcelable_Creator read _GetCREATOR; // Landroid/os/Parcelable$Creator; A: $19
property LATENCY_HIGH : Integer read _GetLATENCY_HIGH; // I A: $19
property LATENCY_LOW : Integer read _GetLATENCY_LOW; // I A: $19
property LATENCY_NORMAL : Integer read _GetLATENCY_NORMAL; // I A: $19
property LATENCY_VERY_HIGH : Integer read _GetLATENCY_VERY_HIGH; // I A: $19
property LATENCY_VERY_LOW : Integer read _GetLATENCY_VERY_LOW; // I A: $19
property QUALITY_HIGH : Integer read _GetQUALITY_HIGH; // I A: $19
property QUALITY_LOW : Integer read _GetQUALITY_LOW; // I A: $19
property QUALITY_NORMAL : Integer read _GetQUALITY_NORMAL; // I A: $19
property QUALITY_VERY_HIGH : Integer read _GetQUALITY_VERY_HIGH; // I A: $19
property QUALITY_VERY_LOW : Integer read _GetQUALITY_VERY_LOW; // I A: $19
end;
[JavaSignature('android/speech/tts/Voice')]
JVoice = interface(JObject)
['{109B4015-6FB6-42B9-BB78-EBC915833A63}']
function describeContents : Integer; cdecl; // ()I A: $1
function equals(obj : JObject) : boolean; cdecl; // (Ljava/lang/Object;)Z A: $1
function getFeatures : JSet; cdecl; // ()Ljava/util/Set; A: $1
function getLatency : Integer; cdecl; // ()I A: $1
function getLocale : JLocale; cdecl; // ()Ljava/util/Locale; A: $1
function getName : JString; cdecl; // ()Ljava/lang/String; A: $1
function getQuality : Integer; cdecl; // ()I A: $1
function hashCode : Integer; cdecl; // ()I A: $1
function isNetworkConnectionRequired : boolean; cdecl; // ()Z A: $1
function toString : JString; cdecl; // ()Ljava/lang/String; A: $1
procedure writeToParcel(dest : JParcel; flags : Integer) ; cdecl; // (Landroid/os/Parcel;I)V A: $1
end;
TJVoice = class(TJavaGenericImport<JVoiceClass, JVoice>)
end;
const
TJVoiceLATENCY_HIGH = 400;
TJVoiceLATENCY_LOW = 200;
TJVoiceLATENCY_NORMAL = 300;
TJVoiceLATENCY_VERY_HIGH = 500;
TJVoiceLATENCY_VERY_LOW = 100;
TJVoiceQUALITY_HIGH = 400;
TJVoiceQUALITY_LOW = 200;
TJVoiceQUALITY_NORMAL = 300;
TJVoiceQUALITY_VERY_HIGH = 500;
TJVoiceQUALITY_VERY_LOW = 100;
implementation
end.
|
unit unt_FileAnalyzer;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, JvExMask, JvToolEdit, JvExControls,
JvEditorCommon, JvEditor, StrUtils, IniFiles, ExtCtrls, ComCtrls;
const
BuffSize = 8192;
type
TOnProgressEvent = procedure(Processed, Current, Total: Int64) of object;
TOnFindPhraseEvent = procedure(Position, LineNr, SelFrom, SelTo: Integer) of object;
TOnFindPhrase2Event = procedure(Position, LineNr, SelFrom, SelTo: Integer; txt: string) of object;
TMaskPart = record
Part: string[30];
PartFrom: Integer;
PartTo: Integer;
Length: Integer;
Mode: Char;
end;
TFileAnalyzer = class
private
str: string;
//res: string;
LineNr: Integer;
Buffer: array[1..BuffSize] of Char; // bufor odczytu pliku
Buff: array[1..BuffSize*2] of Char; // bufor lini - upper case
BuffC: array[1..BuffSize*2] of Char; // bufor zawierajacy jedna linie
BuffSize: Integer;
Masks: array of array of TMaskPart;
procedure ProcessLine;
public
Abort: Boolean;
FileName: string;
UseMask: Boolean;
TotalSize: Int64;
Progress: Int64;
TextCharCount: Int64;
CaseSensitive: Boolean;
OnProgress: TOnProgressEvent;
OnFindPhrase: TOnFindPhraseEvent;
OnFindPhrase2: TOnFindPhrase2Event;
procedure AnalyzeFile(mask: string);
constructor Create;
destructor Destroy; override;
end;
implementation
{ TFileAnalyzer }
procedure TFileAnalyzer.AnalyzeFile(mask: string);
var
F: file;
NumRead: Integer;
m, n: Integer;
CharPos: Integer;
bb: Boolean;
stl: TStringList;
stc: TStringList;
begin
Abort := False;
stl := TStringList.Create;
stc := TStringList.Create;
try
if CaseSensitive then str := mask else str := UpperCase(mask);
if UseMask then
begin
stl.Text := AnsiReplaceStr(str, '|', #13#10);
SetLength(Masks, stl.Count);
for m := 0 to stl.Count-1 do
begin
stc.Text := AnsiReplaceStr(stl[m], '*', #13#10 + '*');
stc.Text := AnsiReplaceStr(stc.Text, '^', #13#10 + '^');
stc.Text := AnsiReplaceStr(stc.Text, '_', #13#10 + '_');
for n := stc.Count-1 downto 0 do
if stc[n] = '' then stc.Delete(n);
SetLength(Masks[m], stc.Count);
for n := 0 to stc.Count-1 do
begin
if n = 0 then
begin
Masks[m][n].Part := stc[n];
Masks[m][n].Mode := #0;
end
else
begin
Masks[m][n].Mode := stc[n][1];
Masks[m][n].Part := Copy(stc[n], 2, Length(stc[n])-1);
end;
Masks[m][n].Length := Length(Masks[m][n].Part);
end;
end;
end
else
begin
SetLength(Masks, 1);
SetLength(Masks[0], 1);
Masks[0][0].Part := str;
Masks[0][0].Length := Length(str);
end;
{ if Pos('umasks.dcu', LowerCase(FileName)) > 0 then
Sleep(0); }
AssignFile(F, FileName);
FileMode := 0;
Reset(F, 1);
CharPos := 1;
LineNr := 0;
Progress := 0;
TextCharCount := 0;
// TotalSize := FileSize(edtFileName.Text);
TotalSize := FileSize(F);
repeat
if Abort then Break;
BlockRead(F, Buffer, SizeOf(Buffer), NumRead);
for m := 1 to NumRead do
begin
Inc(Progress);
bb := False;
if CharPos >= 1024 then
Buffer[m] := #10;
if Buffer[m] in [#9, #10, #13, #32..#127] then inc(TextCharCount);
if (m < NumRead) then
if (Buffer[m] = #13) and (Buffer[m+1] <> #10) then bb := True;
if Buffer[m] = #10 then bb := True;
if bb then
begin
BuffSize := CharPos-1;
ProcessLine;
CharPos := 1;
end
else
begin
if CharPos > Length(Buff) then CharPos := 1;
buff[CharPos] := Buffer[m];
inc(CharPos);
end;
end;
if Assigned(OnProgress) then
OnProgress(NumRead, Progress, TotalSize);
until NumRead = 0;
CloseFile(F) ;
finally
for n := Low(Masks) to High(Masks) do
SetLength(Masks[n], 0);
SetLength(Masks, 0);
stc.Free;
stl.Free;
end;
// Caption := 'predkosc: ' + FileSize( Round(TotalSize / (tc/1000))) + '/s';
// memo1.Lines.Text := Trim(ResultBuff);
{ mmo.Lines.Text := 'Fraza: "' + str + '"' + #13#10
+ 'Znaleziono ' + IntToStr(ResCnt) + ' fraz' + #13#10
+ 'Czas: ' + IntToStr(tc) + #13#10
+ 'Linie: ' + IntToStr(LineCnt) + #13#10
//+ 'Ansi: ' + IntToStr(AnsiCharCnt) + ', nie Ansi: ' + IntToStr(NonAnsiCharCnt) + #13#10
+ res;
pbar.Position := 1000; }
end;
constructor TFileAnalyzer.Create;
begin
end;
destructor TFileAnalyzer.Destroy;
begin
inherited;
end;
procedure TFileAnalyzer.ProcessLine;
var
PartFrom, PartTo: Integer;
pm: ^TMaskPart;
function FindPart: Boolean;
var
m: integer; //nr znaku maski
n: Integer; // nr znaku tekstu
LFound: Boolean;
begin
Result := False;
m := 1;
PartFrom := PartTo;
n := PartFrom;
while n < BuffSize do
begin
inc(n);
if UseMask then
begin
LFound := (Buff[n] = pm.Part[m]) or (pm.Part[m] in ['?', '#', '$', '@']);
if LFound and (pm.Part[m] in ['#', '$', '@']) then
if Buff[n] in [#32..#126] then
begin
if (pm.Part[m] = '#') and (Buff[n] = #32) then LFound := False
else
if (pm.Part[m] = '$') and (not (Buff[n] in [#48..#57])) then LFound := False
else
if (pm.Part[m] = '%') and (not (Buff[n] in [#65..#90, #97..#122])) then LFound := False
else
if (pm.Part[m] = '@') and(not (Buff[n] in
[#33..#47, #58..#64, #91..#96, #123..#126]))
then LFound := False
end
else
LFound := False;
end
else
LFound := Buff[n] = pm.Part[m];
if LFound then inc(m)
else
begin
if (m > 1) then Dec(n);
m := 1;
end;
if m = 2 then PartFrom := n;
if m > pm.Length then
begin
Result := True;
PartTo := n;
Break;
end
end;
end;
var
m, n, i: Integer;
StrFrom, StrTo: Integer;
bb, LFound: Boolean;
begin
Inc(LineNr);
if BuffSize= 0 then Exit;
for n := 1 to BuffSize do
if Buff[n] <> #0 then BuffC[n] := Buff[n] else BuffC[n] := #32;
if not CaseSensitive then
CharUpperBuff(@Buff[1], BuffSize);
for m := Low(Masks) to High(Masks) do
begin
LFound := True;
StrTo := 0;
PartFrom := 0;
PartTo := 0;
while LFound do
begin
StrFrom := 0;
if UseMask then
for n := Low(Masks[m]) to High(Masks[m]) do
begin
pm := @masks[m][n];
if pm.Part <> '' then
begin
bb := FindPart;
if bb and (n > 0) then
if pm.Mode <> '*' then // jesli lacznikiem nie jest *
begin
if pm.Mode = '^' then
for i := StrTo+1 to PartFrom-1 do
if not (Buff[i] in [#48..#57, #65..#90, #97..#122]) then
begin
bb := False;
Break;
end;
if pm.Mode = '_' then
for i := StrTo+1 to PartFrom-1 do
if not (Buff[i] in [#9, #32, '_']) then //SPACJA lub TAB
begin
bb := False;
Break;
end;
end;
if not bb then
begin
LFound := False;
Break;
end
else
begin
if StrFrom = 0 then StrFrom := PartFrom;
if PartTo > StrTo then StrTo := PartTo;
end;
end;
end
else
begin
pm := @masks[m][0];
if not FindPart then
begin
LFound := False;
Break;
end
else
begin
if StrFrom = 0 then StrFrom := PartFrom;
if PartTo > StrTo then StrTo := PartTo;
end;
end;
if LFound then
begin
if Assigned(OnFindPhrase) then
OnFindPhrase(Progress, LineNr, StrFrom, StrTo);
if Assigned(OnFindPhrase2) then
OnFindPhrase2(Progress, LineNr, StrFrom, StrTo,
AnsiReplaceStr(Copy(BuffC, 1, BuffSize), #0, #32));
end;
{ begin
res := res + IntToStr(ResCnt) + '. ' + #9 + IntToStr(LineCnt) + ':' + #9 + '"'
+ Copy(BuffC, StrFrom, StrTo - StrFrom + 1) +'"' + #9 + ' -> '
+ Copy(BuffC, 1, BuffSize) + #13#10;
end; }
end;
end;
end;
end.
|
unit Demo.GaugeChart.Sample;
interface
uses
System.Classes, Demo.BaseFrame, cfs.GCharts, uniTimer;
type
TDemo_GaugeChart_Sample = class(TDemoBaseFrame)
private
FuniTimer: TUniTimer;
FMemory: Integer;
FCPU: Integer;
FNetwork: Integer;
procedure OnTimer(Sender: TObject);
public
procedure CreateDynamicComponents; override;
procedure GenerateChart; override;
end;
implementation
procedure TDemo_GaugeChart_Sample.CreateDynamicComponents;
begin
inherited;
FuniTimer := TUniTimer.Create(Self);
FuniTimer.ChainMode := True;
FuniTimer.OnTimer := OnTimer;
FuniTimer.Interval := 6000;
end;
procedure TDemo_GaugeChart_Sample.GenerateChart;
var
Chart: IcfsGChartProducer; //Defined as TInterfacedObject. No need try..finally
begin
Chart := TcfsGChartProducer.Create;
Chart.ClassChartType := TcfsGChartProducer.CLASS_GAUGE_CHART;
// Data
Chart.Data.DefineColumns([
TcfsGChartDataCol.Create(TcfsGChartDataType.gcdtString, 'Label'),
TcfsGChartDataCol.Create(TcfsGChartDataType.gcdtNumber, 'Value')
]);
FMemory := 40 + Random(60);
FCPU := 40 + Random(60);
FNetwork := 60 + Random(20);
Chart.Data.AddRow(['Memory', FMemory]);
Chart.Data.AddRow(['CPU', FCPU]);
Chart.Data.AddRow(['Network', FNetwork]);
// Options
Chart.Options.Title('Computational resources');
Chart.Options.RedFrom(90);
Chart.Options.RedTo(100);
Chart.Options.YellowFrom(75);
Chart.Options.YellowTo(90);
Chart.Options.MinorTicks(5);
// Generate
GChartsFrame.DocumentInit;
GChartsFrame.DocumentSetBody('<div id="Chart" style="width:600px; height:200px; margin:auto;position: absolute;top:0;bottom: 0;left: 0;right: 0;"></div>');
GChartsFrame.DocumentGenerate('Chart', Chart);
GChartsFrame.DocumentPost;
end;
procedure TDemo_GaugeChart_Sample.OnTimer(Sender: TObject);
begin
GenerateChart;
end;
initialization
RegisterClass(TDemo_GaugeChart_Sample);
end.
|
unit Dmitry.Utils.Dialogs;
interface
uses
Windows;
function SelectDirPlus(hWnd: HWND; const Caption: string; const SelRot: String = ''; const Root: WideString = ''): String;
// Диалог выбора директории с кнопкой "Создать папку"
function SelectDir(hWnd: HWND; const Caption: String; const SelRot: String = ''): String;
// Диалог выбора директории
function ChangeIconDialog(hOwner :tHandle; var FileName: string; var IconIndex: Integer): Boolean;
// Диалог выбора иконки
implementation
uses
SysUtils , ShlObj, ActiveX, Forms, SysConst;
// -----------------------------------------------------------------
threadvar
MyDir: string;
function BrowseCallbackProc(Hwnd: HWND; UMsg: UINT; LParam: LPARAM; LpData: LPARAM): Integer; stdcall;
begin
Result := 0;
if UMsg = BFFM_INITIALIZED then
SendMessage(Hwnd, BFFM_SETSELECTION, 1, LongInt(PChar(MyDir)));
end;
function SelectDirPlus(HWnd: HWND; const Caption: string; const SelRot: string = ''; const Root: WideString = ''): String;
// Диалог выбора директории с кнопкой "Создать папку"
var
WindowList: Pointer;
BrowseInfo : TBrowseInfo;
Buffer: PChar;
RootItemIDList, ItemIDList: PItemIDList;
ShellMalloc: IMalloc;
IDesktopFolder: IShellFolder;
Eaten, Flags: LongWord;
Cmd: Boolean;
begin
Result:= SelRot;
FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
if DirectoryExists(SelRot) then myDir:= SelRot;
if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then begin
Buffer := ShellMalloc.Alloc(MAX_PATH);
try
RootItemIDList := nil;
if Root <> '' then begin
SHGetDesktopFolder(IDesktopFolder);
IDesktopFolder.ParseDisplayName(hWnd, nil, POleStr(Root),
Eaten, RootItemIDList, Flags);
end;
with BrowseInfo do begin
hwndOwner:= hWnd;
pidlRoot:= RootItemIDList;
pszDisplayName:= Buffer;
lpfn:= @BrowseCallbackProc;
lpszTitle:= PChar(Caption);
ulFlags:= BIF_RETURNONLYFSDIRS or BIF_NEWDIALOGSTYLE or
BIF_EDITBOX or BIF_STATUSTEXT;
end;
WindowList:= DisableTaskWindows(0);
try
ItemIDList:= ShBrowseForFolder(BrowseInfo);
finally
EnableTaskWindows(WindowList);
end;
Cmd:= ItemIDList <> nil;
if Cmd then begin
ShGetPathFromIDList(ItemIDList, Buffer);
ShellMalloc.Free(ItemIDList);
if Length(Buffer) <> 0 then
Result:= IncludeTrailingPathDelimiter(Buffer)
else
Result:= '';
end;
finally
ShellMalloc.Free(Buffer);
end;
end;
end;
// -----------------------------------------------------------------
function SelectDir(hWnd: HWND; const Caption: String; const SelRot: String = ''): String;
// Диалог выбора директории
var
lpItemID: PItemIDList;
BrowseInfo: TBrowseInfo;
TempPath: array[0..MAX_PATH] of char;
begin
Result:= SelRot;
FillChar(BrowseInfo, sizeof(TBrowseInfo), 0);
if DirectoryExists(SelRot) then myDir:= SelRot;
with BrowseInfo do begin
hwndOwner:= hWnd;
lpszTitle:= PChar(Caption);
lpfn:= @BrowseCallbackProc;
ulFlags:= BIF_RETURNONLYFSDIRS;
end;
lpItemID:= SHBrowseForFolder(BrowseInfo);
if lpItemId <> nil then begin
SHGetPathFromIDList(lpItemID, TempPath);
Result:= IncludeTrailingPathDelimiter(TempPath);
end;
GlobalFreePtr(lpItemID);
end;
// -----------------------------------------------------------------
function ChangeIconDialog(hOwner :tHandle; var FileName: string; var IconIndex: Integer): Boolean;
// Диалог выбора иконки
type
SHChangeIconProc = function(Wnd: HWND; szFileName: PChar; Reserved: Integer;
var lpIconIndex: Integer): DWORD; stdcall;
SHChangeIconProcW = function(Wnd: HWND; szFileName: PWideChar;
Reserved: Integer; var lpIconIndex: Integer): DWORD; stdcall;
const
Shell32 = 'shell32.dll';
var
ShellHandle: THandle;
SHChangeIcon: SHChangeIconProc;
SHChangeIconW: SHChangeIconProcW;
Buf: array [0..MAX_PATH] of Char;
BufW: array [0..MAX_PATH] of WideChar;
begin
Result:= False;
SHChangeIcon:= nil;
SHChangeIconW:= nil;
ShellHandle:= Windows.LoadLibrary(PChar(Shell32));
try
if ShellHandle <> 0 then begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
SHChangeIconW:= GetProcAddress(ShellHandle, PChar(62))
else
SHChangeIcon:= GetProcAddress(ShellHandle, PChar(62));
end;
if Assigned(SHChangeIconW) then begin
StringToWideChar(FileName, BufW, SizeOf(BufW));
Result:= SHChangeIconW(hOwner, BufW, SizeOf(BufW), IconIndex) = 1;
if Result then
FileName:= BufW;
end
else if Assigned(SHChangeIcon) then begin
StrPCopy(Buf, FileName);
Result:= SHChangeIcon(hOwner, Buf, SizeOf(Buf), IconIndex) = 1;
if Result then FileName:= Buf;
end
else
raise Exception.Create(SUnkOSError);
finally
if ShellHandle <> 0 then FreeLibrary(ShellHandle);
end;
end;
// -----------------------------------------------------------------
end.
|
unit TestUPrecoGasVO;
{
Delphi DUnit Test Case
----------------------
This unit contains a skeleton test case class generated by the Test Case Wizard.
Modify the generated code to correctly setup and call the methods from the unit
being tested.
}
interface
uses
TestFramework, UPrecoGasVO, Atributos, UPaisVO, UCnaeVO, Generics.Collections,
UGenericVO, Classes, SysUtils, Constantes, UEstadoVO, UPessoasVO, UCidadeVO;
type
// Test methods for class TPrecoGasVO
TestTPrecoGasVO = class(TTestCase)
strict private
FPrecoGasVO: TPrecoGasVO;
public
procedure SetUp; override;
procedure TearDown; override;
published
procedure TestValidarCamposObrigatorios;
procedure TestValidarCamposObrigatoriosNaoEncontrado;
end;
implementation
procedure TestTPrecoGasVO.SetUp;
begin
FPrecoGasVO := TPrecoGasVO.Create;
end;
procedure TestTPrecoGasVO.TearDown;
begin
FPrecoGasVO.Free;
FPrecoGasVO := nil;
end;
procedure TestTPrecoGasVO.TestValidarCamposObrigatorios;
var
Preco : TPrecoGasVO;
begin
Preco := TPrecoGasVO.Create;
Preco.dtMesAno := StrToDate('01/01/2016');
Preco.idPessoa := 36;
Preco.vlGas := 10.00;
try
Preco.ValidarCamposObrigatorios;
Check(True,'Sucesso!')
except on E: Exception do
Check(False,'Erro!');
end;
end;
procedure TestTPrecoGasVO.TestValidarCamposObrigatoriosNaoEncontrado;
var
Preco : TPrecoGasVO;
begin
Preco := TPrecoGasVO.Create;
try
Preco.ValidarCamposObrigatorios;
Check(False,'Erro!')
except on E: Exception do
Check(True,'Sucesso!');
end;
end;
initialization
// Register any test cases with the test runner
RegisterTest(TestTPrecoGasVO.Suite);
end.
|
(*
This component was downloaded from the
About Delphi Programming site
http://delphi.about.com
TNetDrive is a non-visual component that connects a network path to a drive name.
Find more: http://delphi.about.com/library/weekly/aa061506a.htm
*)
unit NetDrive;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TNetDrive = class(TComponent)
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
private
FErrorString: string;
FDrive: string;
FOnDisconnect: TNotifyEvent;
FOnConnect: TNotifyEvent;
procedure SetOnConnect(const Value: TNotifyEvent);
procedure SetOnDisconnect(const Value: TNotifyEvent);
function FreeDriveName:string;
function DriveExists(ADrive:string):boolean;
procedure Delay(Ams:integer);
protected
public
//Yanniel: I refactored this method to avoid code duplication
function Connect(AResource,AUser,APassword:string):string; overload;
//Yanniel: I added this overloaded method
function Connect(AResource, AUser, APassword: string; out AError: string): string; overload;
//Yanniel: I refactored this method to avoid code duplication
function Disconnect:boolean; overload;
//Yanniel: I added this overloaded method
function Disconnect(out AError: string):boolean; overload;
property Drive:string read FDrive write FDrive;
property ErrorString:string read FErrorString;
published
property OnConnect:TNotifyEvent read FOnConnect write SetOnConnect;
property OnDisconnect:TNotifyEvent read FOnDisconnect write SetOnDisconnect;
end;
procedure Register;
implementation
uses
FileCtrl;
procedure Register;
begin
RegisterComponents('delphi.about.com', [TNetDrive]);
end;
{ TNetDrive }
//Yanniel: I refactored this method to avoid code duplication
function TNetDrive.Connect(AResource, AUser, APassword: string): string;
var
ErrorMsg: string;
begin
Result:= Connect(AResource, AUser, APassword, ErrorMsg);
if ErrorMsg <> '' then
ShowMessage(ErrorMsg);
end;
//Yanniel: I added this overloaded method
function TNetDrive.Connect(AResource, AUser, APassword: string; out AError: string): string;
var
n : NETRESOURCE;
i : integer;
begin
FDrive:='';
n.dwScope:=RESOURCE_GLOBALNET;
n.dwType:=RESOURCETYPE_DISK;
n.dwDisplayType:=RESOURCEDISPLAYTYPE_GENERIC;
n.dwUsage:=RESOURCEUSAGE_CONNECTABLE;
n.lpLocalName:=PChar(FreeDriveName);
n.lpRemoteName:=PChar(AResource);
n.lpComment:='';
n.lpProvider:='';
i:=WNetAddConnection2(n,PChar(APassword),PChar(AUser),0);
case i of
NO_ERROR : begin
delay(500);
FDrive:=n.lpLocalName;
repeat until DriveExists(FDrive);
end;
ERROR_ACCESS_DENIED : AError:= 'Access to the network resource was denied.';
ERROR_ALREADY_ASSIGNED : AError:= 'The local device specified by lpLocalName is already connected to a network resource.';
ERROR_BAD_DEV_TYPE : AError:= 'The type of local device and the type of network resource do not match.';
ERROR_BAD_DEVICE : AError:= 'The value specified by lpLocalName is invalid.';
ERROR_BAD_NET_NAME : AError:= 'The value specified by lpRemoteName is not acceptable to any network resource provider. The resource name is invalid, or the named resource cannot be located.';
ERROR_BAD_PROFILE : AError:= 'The user profile is in an incorrect format.';
ERROR_BAD_PROVIDER : AError:= 'The value specified by lpProvider does not match any provider.';
ERROR_BUSY : AError:= 'The router or provider is busy, possibly initializing. The caller should retry.';
ERROR_CANCELLED : AError:= 'The attempt to make the connection was cancelled by the user through a dialog box from one of the network resource providers, or by a called resource.';
ERROR_CANNOT_OPEN_PROFILE : AError:= 'The system is unable to open the user profile to process persistent connections.';
ERROR_DEVICE_ALREADY_REMEMBERED : AError:= 'An entry for the device specified in lpLocalName is already in the user profile.';
ERROR_EXTENDED_ERROR : AError:= 'A network-specific error occured. Call the WNetGetLastError function to get a description of the error.';
ERROR_INVALID_PASSWORD : AError:= 'The specified password is invalid.';
ERROR_NO_NET_OR_BAD_PATH : AError:= 'A network component has not started, or the specified name could not be handled.';
ERROR_NO_NETWORK : AError:= 'There is no network present.';
else AError:= 'An unknown error has occured attempting to connect to '+AResource+'.';
end;
if Assigned(FOnConnect) then
FOnConnect(self);
Result:=FDrive;
end;
constructor TNetDrive.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FErrorString:='';
FDrive:='';
FOnDisconnect:=nil;
FOnConnect:=nil;
end;
procedure TNetDrive.Delay(Ams: integer);
var
h,m,s,ms : word;
dt : TDateTime;
begin
DecodeTime(Time,h,m,s,ms);
ms:=ms+Ams;
while ms>999 do
begin
inc(s,1);
dec(ms,1000);
end;
while s>59 do
begin
inc(m,1);
dec(s,60);
end;
while m>59 do
begin
inc(h,1);
dec(m,60);
end;
dt:=EncodeTime(h,m,s,ms);
repeat until Time>dt;
end;
destructor TNetDrive.Destroy;
begin
inherited Destroy;
end;
//Yanniel: I refactored this method to avoid code duplication
function TNetDrive.Disconnect: boolean;
var
ErrorMsg: string;
begin
Result:= Disconnect(ErrorMsg);
if ErrorMsg <> '' then
ShowMessage(ErrorMsg);
end;
//Yanniel: I added this overloaded method
function TNetDrive.Disconnect(out AError: string):boolean;
begin
result:=false;
if FDrive<>'' then
begin
case WNetCancelConnection2(PChar(FDrive),0,true) of
NO_ERROR : begin
FDrive:='';
Result:=true;
end;
ERROR_BAD_PROFILE : AError:= 'The user profile is in an incorrect format.';
ERROR_CANNOT_OPEN_PROFILE : AError:= 'The system is unable to open the user profile to process persistent connections.';
ERROR_DEVICE_IN_USE : AError:= 'The device is in use by an active process and cannot be disconnected.';
ERROR_EXTENDED_ERROR : AError:= 'A network-specific error occurred. To get a description of the error, use the WNetGetLastError function.';
ERROR_NOT_CONNECTED : AError:= 'The name specified by the lpName parameter is not a redirected device, or the system is not currently connected to the device specified by the parameter.';
ERROR_OPEN_FILES : AError:= 'There are open files, and the fForce parameter is FALSE.';
end;
if Assigned(FOnDisconnect) then
FOnDisconnect(self);
end;
end;
function TNetDrive.DriveExists(ADrive: string): boolean;
var
buf : string;
begin
GetDir(0,buf);
{$I-}
ChDir(ADrive);
{$I+}
Result:=(IOResult=0);
ChDir(buf);
end;
function TNetDrive.FreeDriveName: string;
var
l : TStringList;
d : TDriveComboBox;
t : char;
i : integer;
begin
l:=TStringList.Create;
d:=TDriveComboBox.Create(self);
d.Parent:=Application.MainForm;
d.Visible:=false;
l.Assign(d.Items);
d.Free;
for i:=0 to l.Count-1 do
l[i]:=copy(l[i],1,1);
t:='d';
result:='';
while (t<='z') and (result='') do
if l.IndexOf(t)=-1
then result:=t
else inc(t);
l.Free;
if result<>'' then
result:=result+':';
end;
procedure TNetDrive.SetOnConnect(const Value: TNotifyEvent);
begin
FOnConnect := Value;
end;
procedure TNetDrive.SetOnDisconnect(const Value: TNotifyEvent);
begin
FOnDisconnect := Value;
end;
end.
|
unit ObjPlayRobot;
interface
uses
Windows, Classes, SysUtils, DateUtils, SDK;
type
TPlayRobotObject = class
m_sCharName: string;
m_sScriptFileName: string;
m_AutoRunList: TList;
private
m_boRunOnWeek: Boolean; //是否已执行操作;
procedure LoadScript();
procedure ClearScript();
//procedure ProcessAutoRun();//20080818 注释
procedure AutoRun(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);
procedure AutoRunOfOnWeek(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);//星期几运行
procedure AutoRunOfOnDay(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);//每天运行
{procedure AutoRunOfOnHour(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);//隔小时运行 //20080818 注释
procedure AutoRunOfOnMin(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);//隔分钟运行
procedure AutoRunOfOnSec(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);//隔秒钟运行 }
public
constructor Create();
destructor Destroy; override;
procedure ReloadScript();
procedure Run(PlayObject: TObject);
end;
TPlayRobotManage = class
RobotHumanList: TStringList;
PlayObject: TObject;
private
procedure LoadRobot();
procedure UnLoadRobot();
public
constructor Create();
destructor Destroy; override;
procedure RELOADROBOT();
procedure Run;
end;
implementation
uses M2Share, HUtil32, ObjBase;
//===========================人物个人机器人=====================================
{ TPlayRobotObject }
procedure TPlayRobotObject.AutoRun(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);
begin
if GetTickCount - AutoRunInfo.dwRunTick > AutoRunInfo.dwRunTimeLen then begin
case AutoRunInfo.nRunCmd of
nRONPCLABLEJMP: begin
case AutoRunInfo.nMoethod of
nRODAY: begin
if GetTickCount - AutoRunInfo.dwRunTick > 86400000{24 * 60 * 60 * 1000} * LongWord(AutoRunInfo.nParam1) then begin
AutoRunInfo.dwRunTick := GetTickCount();
g_RobotNPC.GotoLable(TPlayObject(PlayObject), AutoRunInfo.sParam2, False);
end;
end;
nROHOUR: begin
if GetTickCount - AutoRunInfo.dwRunTick > 3600000{60 * 60 * 1000} * LongWord(AutoRunInfo.nParam1) then begin
AutoRunInfo.dwRunTick := GetTickCount();
g_RobotNPC.GotoLable(TPlayObject(PlayObject), AutoRunInfo.sParam2, False);
end;
end;
nROMIN: begin
if GetTickCount - AutoRunInfo.dwRunTick > 60000{60 * 1000} * LongWord(AutoRunInfo.nParam1) then begin
AutoRunInfo.dwRunTick := GetTickCount();
g_RobotNPC.GotoLable(TPlayObject(PlayObject), AutoRunInfo.sParam2, False);
end;
end;
nROSEC: begin
if GetTickCount - AutoRunInfo.dwRunTick > 1000 * LongWord(AutoRunInfo.nParam1) then begin
AutoRunInfo.dwRunTick := GetTickCount();
g_RobotNPC.GotoLable(TPlayObject(PlayObject), AutoRunInfo.sParam2, False);
end;
end;
nRUNONWEEK: AutoRunOfOnWeek(AutoRunInfo, PlayObject);
nRUNONDAY: AutoRunOfOnDay(AutoRunInfo, PlayObject);
{nRUNONHOUR: AutoRunOfOnHour(AutoRunInfo, PlayObject);//20080818 注释
nRUNONMIN: AutoRunOfOnMin(AutoRunInfo, PlayObject);
nRUNONSEC: AutoRunOfOnSec(AutoRunInfo, PlayObject);}
end; // case
end;
{ 1: ; //20080818 注释
2: ;
3: ; }
end; // case
end;
end;
procedure TPlayRobotObject.AutoRunOfOnDay(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);
var
nMIN, nHOUR: Integer;
wHour, wMin, wSec, wMSec: Word;
sMIN, sHOUR: string;
sLineText, sLabel: string;
begin
sLineText := AutoRunInfo.sParam1;
sLineText := GetValidStr3(sLineText, sHOUR, [':']);
sLineText := GetValidStr3(sLineText, sMIN, [':']);
nHOUR := Str_ToInt(sHOUR, -1);
nMIN := Str_ToInt(sMIN, -1);
sLabel := AutoRunInfo.sParam2;
DecodeTime(Time, wHour, wMin, wSec, wMSec);
if (nHOUR in [0..24]) and (nMIN in [0..60]) then begin
if (wHour = nHOUR) then begin
if (wMin = nMIN) then begin
if not AutoRunInfo.boStatus then begin
g_RobotNPC.GotoLable(TPlayObject(PlayObject), AutoRunInfo.sParam2, False);
AutoRunInfo.boStatus := True;
end;
end else begin
AutoRunInfo.boStatus := False;
end;
end;
end;
end;
{//20080818 注释
procedure TPlayRobotObject.AutoRunOfOnHour(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);
begin
end;
procedure TPlayRobotObject.AutoRunOfOnMin(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);
begin
end;
procedure TPlayRobotObject.AutoRunOfOnSec(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);
begin
end; }
procedure TPlayRobotObject.AutoRunOfOnWeek(AutoRunInfo: pTAutoRunInfo; PlayObject: TObject);
var
nMIN, nHOUR, nWeek: Integer;
wWeek, wHour, wMin, wSec, wMSec: Word;
sMIN, sHOUR, sWeek: string;
sLineText, sLabel: string;
begin
sLineText := AutoRunInfo.sParam1;
sLineText := GetValidStr3(sLineText, sWeek, [':']);
sLineText := GetValidStr3(sLineText, sHOUR, [':']);
sLineText := GetValidStr3(sLineText, sMIN, [':']);
nWeek := Str_ToInt(sWeek, -1);
nHOUR := Str_ToInt(sHOUR, -1);
nMIN := Str_ToInt(sMIN, -1);
sLabel := AutoRunInfo.sParam2;
DecodeTime(Time, wHour, wMin, wSec, wMSec);
wWeek := DayOfTheWeek(Now);
if (nWeek in [1..7]) and (nHOUR in [0..24]) and (nMIN in [0..60]) then begin
if (wWeek = nWeek) and (wHour = nHOUR) then begin
if (wMin = nMIN) then begin
if not AutoRunInfo.boStatus then begin
g_RobotNPC.GotoLable(TPlayObject(PlayObject), AutoRunInfo.sParam2, False);
AutoRunInfo.boStatus := True;
end;
end else begin
AutoRunInfo.boStatus := False;
end;
end;
end;
end;
procedure TPlayRobotObject.ClearScript;
var
I: Integer;
begin
if m_AutoRunList.Count > 0 then begin//20080630
for I := 0 to m_AutoRunList.Count - 1 do begin
if pTAutoRunInfo(m_AutoRunList.Items[I]) <> nil then
Dispose(pTAutoRunInfo(m_AutoRunList.Items[I]));
end;
end;
m_AutoRunList.Clear;
end;
constructor TPlayRobotObject.Create;
begin
m_AutoRunList := TList.Create;
m_boRunOnWeek := False;
end;
destructor TPlayRobotObject.Destroy;
begin
ClearScript();
m_AutoRunList.Free;
end;
procedure TPlayRobotObject.LoadScript;
var
I: Integer;
LoadList: TStringList;
sFileName: string;
sLineText: string;
sActionType: string;
sRunCmd: string;
sMoethod: string;
sParam1: string;
sParam2: string;
sParam3: string;
sParam4: string;
AutoRunInfo: pTAutoRunInfo;
begin
sFileName := g_Config.sEnvirDir + 'Robot_def\' + m_sScriptFileName + '.txt';
if FileExists(sFileName) then begin
LoadList := TStringList.Create;
LoadList.LoadFromFile(sFileName);
if LoadList.Count > 0 then begin//20080630
for I := 0 to LoadList.Count - 1 do begin
sLineText := LoadList.Strings[I];
if (sLineText <> '') and (sLineText[1] <> ';') then begin
sLineText := GetValidStr3(sLineText, sActionType, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sRunCmd, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sMoethod, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sParam1, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sParam2, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sParam3, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sParam4, [' ', '/', #9]);
if CompareText(sActionType, sROAUTORUN) = 0 then begin
if CompareText(sRunCmd, sRONPCLABLEJMP) = 0 then begin
New(AutoRunInfo);
AutoRunInfo.dwRunTick := GetTickCount;
AutoRunInfo.dwRunTimeLen := 0;
AutoRunInfo.boStatus := False;
AutoRunInfo.nRunCmd := nRONPCLABLEJMP;
if CompareText(sMoethod, sRODAY) = 0 then
AutoRunInfo.nMoethod := nRODAY;
if CompareText(sMoethod, sROHOUR) = 0 then
AutoRunInfo.nMoethod := nROHOUR;
if CompareText(sMoethod, sROMIN) = 0 then
AutoRunInfo.nMoethod := nROMIN;
if CompareText(sMoethod, sROSEC) = 0 then
AutoRunInfo.nMoethod := nROSEC;
if CompareText(sMoethod, sRUNONWEEK) = 0 then
AutoRunInfo.nMoethod := nRUNONWEEK;
if CompareText(sMoethod, sRUNONDAY) = 0 then
AutoRunInfo.nMoethod := nRUNONDAY;
{ if CompareText(sMoethod, sRUNONHOUR) = 0 then //20080818 注释
AutoRunInfo.nMoethod := nRUNONHOUR;
if CompareText(sMoethod, sRUNONMIN) = 0 then
AutoRunInfo.nMoethod := nRUNONMIN;
if CompareText(sMoethod, sRUNONSEC) = 0 then
AutoRunInfo.nMoethod := nRUNONSEC; }
AutoRunInfo.sParam1 := sParam1;
AutoRunInfo.sParam2 := sParam2;
AutoRunInfo.sParam3 := sParam3;
AutoRunInfo.sParam4 := sParam4;
AutoRunInfo.nParam1 := Str_ToInt(sParam1, 1);
m_AutoRunList.Add(AutoRunInfo);
end;
end;
end;
end;
end;
LoadList.Free;
end;
end;
{//20080818 注释
procedure TPlayRobotObject.ProcessAutoRun;
begin
end; }
procedure TPlayRobotObject.ReloadScript;
begin
ClearScript();
LoadScript();
end;
procedure TPlayRobotObject.Run(PlayObject: TObject);
var
I: Integer;
AutoRunInfo: pTAutoRunInfo;
begin
if m_AutoRunList.Count > 0 then begin//20080630
for I := 0 to m_AutoRunList.Count - 1 do begin
AutoRunInfo := pTAutoRunInfo(m_AutoRunList.Items[I]);
if AutoRunInfo <> nil then AutoRun(AutoRunInfo, PlayObject);
end;
end;
end;
{ TPlayRobotManage }
constructor TPlayRobotManage.Create;
begin
PlayObject := nil;
RobotHumanList := TStringList.Create;
LoadRobot();
end;
destructor TPlayRobotManage.Destroy;
begin
UnLoadRobot();
RobotHumanList.Free;
end;
procedure TPlayRobotManage.LoadRobot;
var
I: Integer;
LoadList: TStringList;
sFileName: string;
sLineText: string;
sRobotName: string;
sScriptFileName: string;
sRobotType: string;
RobotHuman: TPlayRobotObject;
begin
sFileName := g_Config.sEnvirDir + 'Robot.txt';
if FileExists(sFileName) then begin
LoadList := TStringList.Create;
LoadList.LoadFromFile(sFileName);
if LoadList.Count > 0 then begin//20080630
for I := 0 to LoadList.Count - 1 do begin
sLineText := LoadList.Strings[I];
if (sLineText <> '') and (sLineText[1] <> ';') then begin
sLineText := GetValidStr3(sLineText, sRobotName, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sScriptFileName, [' ', '/', #9]);
sLineText := GetValidStr3(sLineText, sRobotType, [' ', '/', #9]);
if (sRobotName <> '') and (sScriptFileName <> '') and (sRobotType = '1') then begin
RobotHuman := TPlayRobotObject.Create;
RobotHuman.m_sCharName := sRobotName;
RobotHuman.m_sScriptFileName := sScriptFileName;
RobotHuman.LoadScript;
RobotHumanList.AddObject(RobotHuman.m_sCharName, RobotHuman);
end;
end;
end;
end;
LoadList.Free;
end;
end;
procedure TPlayRobotManage.RELOADROBOT;
begin
UnLoadRobot();
LoadRobot();
end;
procedure TPlayRobotManage.Run;
var
I: Integer;
begin
try
if PlayObject <> nil then begin
if RobotHumanList.Count > 0 then begin//20080630
for I := 0 to RobotHumanList.Count - 1 do begin
TPlayRobotObject(RobotHumanList.Objects[I]).Run(PlayObject);
end;
end;
end;
except
on E: Exception do begin
MainOutMessage('{异常} TPlayRobotManage::Run');
end;
end;
end;
procedure TPlayRobotManage.UnLoadRobot;
var
I: Integer;
begin
if RobotHumanList.Count > 0 then begin//20080630
for I := 0 to RobotHumanList.Count - 1 do begin
TPlayRobotObject(RobotHumanList.Objects[I]).Free;
end;
end;
RobotHumanList.Clear;
end;
end.
|
unit AcctCard_FieldNames;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxControls, cxContainer, cxEdit, cxLabel, cxLookAndFeelPainters,
ExtCtrls, StdCtrls, cxButtons, cxTextEdit, cxMaskEdit, ActnList,
Unit_ZGlobal_Consts, ZProc, ZMessages, Registry;
type
TFZAcctCard_FieldNames = class(TForm)
LabelNameFieldTin: TcxLabel;
LabelNameFieldAcctCard: TcxLabel;
MaskEditNameFieldTin: TcxMaskEdit;
MaskEditNameFieldCard: TcxMaskEdit;
YesBtn: TcxButton;
CancelBtn: TcxButton;
Bevel: TBevel;
ActionList: TActionList;
ActionYes: TAction;
ActionCancel: TAction;
LabelNameFieldFIO: TcxLabel;
MaskEditNameFieldFIO: TcxMaskEdit;
procedure ActionCancelExecute(Sender: TObject);
procedure ActionYesExecute(Sender: TObject);
private
PLanguageIndex:byte;
public
constructor Create(AOwner:TComponent);reintroduce;
end;
function TinFieldName:String;
function CardFieldName:String;
function FIOFieldName:string;
implementation
{$R *.dfm}
const Path_IniFile_Reports = '\Software\Zarplata\AcctCard\FieldNames';
function TinFieldName:String;
var reg:TRegistry;
Key:string;
begin
Key := Path_IniFile_Reports;
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
if not reg.OpenKey(Key,False) then
begin
reg.free;
Result:='KOD_NAL';
Exit;
end;
if(reg.ReadString('TIN')<>null)then
Result:=reg.ReadString('TIN')
else
Result:='KOD_NAL';
reg.Free;
end;
function CardFieldName:String;
var reg:TRegistry;
Key:string;
begin
Key := Path_IniFile_Reports;
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
if not reg.OpenKey(Key,False) then
begin
reg.free;
Result:='CARD_NO';
Exit;
end;
if(reg.ReadString('CARD')<>null)then
Result:=reg.ReadString('CARD')
else
Result:='CARD_NO';
reg.Free;
end;
function FIOFieldName:String;
var reg:TRegistry;
Key:string;
begin
Key := Path_IniFile_Reports;
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
if not reg.OpenKey(Key,False) then
begin
reg.free;
Result:='FIO';
Exit;
end;
if(reg.ReadString('FIO')<>null)then
Result:=reg.ReadString('FIO')
else
Result:='FIO';
reg.Free;
end;
constructor TFZAcctCard_FieldNames.Create(Aowner:TComponent);
begin
inherited Create(AOwner);
PLanguageIndex:=LanguageIndex;
//******************************************************************************
CancelBtn.Caption := CancelBtn_Caption[PLanguageIndex];
CancelBtn.Hint := CancelBtn.Caption;
YesBtn.Caption := YesBtn_Caption[PLanguageIndex];
YesBtn.Hint := YesBtn.Caption;
Caption := FUV_RefreshSkr_FieldNames_Caption[PLanguageIndex];
LabelNameFieldTin.Caption := FUV_RefreshSkr_FieldNamesTin_Caption[PLanguageIndex];
LabelNameFieldAcctCard.Caption := FUV_RefreshSkr_FieldNamesAcctCard_Caption[PLanguageIndex];
//******************************************************************************
MaskEditNameFieldTin.Text := TinFieldName;
MaskEditNameFieldCard.Text:= CardFieldName;
MaskEditNameFieldFIO.Text := FIOFieldName;
end;
procedure TFZAcctCard_FieldNames.ActionCancelExecute(Sender: TObject);
begin
ModalResult := mrCancel;
end;
procedure TFZAcctCard_FieldNames.ActionYesExecute(Sender: TObject);
var reg:TRegistry;
Key:string;
begin
if Trim(MaskEditNameFieldTin.Text)='' then
begin
ZShowMessage(Error_Caption[PLanguageIndex],FUV_RefreshSkr_FieldNamesTin_NotInput_Text[PLanguageIndex],mtInformation,[mbOK]);
MaskEditNameFieldTin.SetFocus;
Exit;
end;
if Trim(MaskEditNameFieldCard.Text)='' then
begin
ZShowMessage(Error_Caption[PLanguageIndex],FUV_RefreshSkr_FieldNamesAcctCard_NotInput_Text[PLanguageIndex],mtInformation,[mbOK]);
MaskEditNameFieldTin.SetFocus;
Exit;
end;
Key := Path_IniFile_Reports;
try
reg := TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey(Key,True);
reg.WriteString('TIN',MaskEditNameFieldTin.Text);
reg.WriteString('CARD',MaskEditNameFieldCard.Text);
reg.WriteString('FIO',MaskEditNameFieldFIO.Text);
finally
reg.Free;
end;
ModalResult:=mrYes;
end;
end.
|
{-------------------------------------------------------------------------
Copyright by Haeger + Busch, Germany / >>>>>>>>> /-----
Ingenieurbuero fuer Kommunikationslösungen / <<<<<<<<< /
----------------------------------------------------/ >>>>>>>>> /
Homepage : http://www.hbTapi.com
EMail : info@hbTapi.com
Package : hbTapi Components
-------------------------------------------------------------------------}
unit uSettings;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, hbComm, hbCommUtils;
type
TComPortSettingsDlg = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
ButtonCancel: TButton;
ButtonOk: TButton;
Label6: TLabel;
Bevel1: TBevel;
Label_Port: TLabel;
cbPort: TComboBox;
cbBaud: TComboBox;
cbDataBits: TComboBox;
cbParity: TComboBox;
cbStopBits: TComboBox;
cbHandshake: TComboBox;
procedure FormCreate(Sender: TObject);
procedure DoChangePort(Sender: TObject);
private
FPortName : String;
function GetBaud: Integer;
procedure Set_Baud(const Value: Integer);
function GetParity: Byte;
procedure Set_Parity(Value: Byte);
function GetDatabits: Integer;
procedure Set_DataBits(const Value: Integer);
procedure Set_Port(const Value: String);
function GetPort: String;
function GetStopbits: Integer;
procedure Set_StopBits(Value: Integer);
function GetHandshake: DWORD;
procedure Set_Handshake(const Value: DWORD);
public
function Execute: Boolean;
procedure AssignFromComPort(const Value: ThbComPort);
procedure AssignToComPort(const Value: ThbComPort);
property PortName : String read GetPort write Set_Port;
property Baud : Integer read GetBaud write Set_Baud;
property Parity : Byte read GetParity write Set_Parity;
property DataBits : Integer read GetDatabits write Set_DataBits;
property StopBits : Integer read GetStopbits write Set_StopBits;
property Handshake: DWORD read GetHandshake write Set_Handshake;
end;
implementation
{$R *.DFM}
function TComPortSettingsDlg.Execute: Boolean;
begin
result := ShowModal = mrOK;
end;
procedure TComPortSettingsDlg.AssignFromComPort(const Value: ThbComPort);
begin
PortName := Value.PortName;
Baud := Value.Baudrate;
Parity := Value.Parity;
Databits := Value.Databits;
Stopbits := Value.Stopbits;
Handshake := Value.FlowCtrl.Handshake;
end;
procedure TComPortSettingsDlg.AssignToComPort(const Value: ThbComPort);
begin
Value.PortName := PortName;
Value.Baudrate := Baud;
Value.Parity := Parity;
Value.Databits := Databits;
Value.Stopbits := Stopbits;
Value.FlowCtrl.Handshake := Handshake;
end;
function TComPortSettingsDlg.GetBaud: Integer;
begin
result := StrToIntDef(cbBaud.Text, 19200);
end;
function TComPortSettingsDlg.GetParity: Byte;
begin
case cbParity.ItemIndex of
1 : result := ODDPARITY;
2 : result := EVENPARITY;
3 : result := MARKPARITY;
4 : result := SPACEPARITY;
else
result := NOPARITY;
end;
end;
procedure TComPortSettingsDlg.Set_Baud(const Value: Integer);
var i : integer;
begin
i := cbBaud.Items.IndexOf(IntToStr(Value));
if i >= 0 then
cbBaud.ItemIndex := i;
end;
procedure TComPortSettingsDlg.Set_Parity(Value: Byte);
begin
case Value of
ODDPARITY : cbParity.ItemIndex := 1;
EVENPARITY : cbParity.ItemIndex := 2;
MARKPARITY : cbParity.ItemIndex := 3;
SPACEPARITY : cbParity.ItemIndex := 4;
else
cbParity.ItemIndex := 0; // NOPARITY
end;
end;
procedure TComPortSettingsDlg.FormCreate(Sender: TObject);
begin
EnumSerialPorts(cbPort.Items);
Set_Baud (19200);
Set_Databits(8);
set_StopBits(ONESTOPBIT);
Set_Parity (NOPARITY);
end;
function TComPortSettingsDlg.GetDatabits: Integer;
begin
result := StrToIntDef( cbDatabits.Text, 8);
end;
procedure TComPortSettingsDlg.Set_DataBits(const Value: Integer);
var i : integer;
begin
i := cbDatabits.Items.IndexOf(IntToStr(Value));
if i >= 0 then
cbDatabits.ItemIndex := i;
end;
procedure TComPortSettingsDlg.Set_Port(const Value: String);
begin
Label_Port.Caption := Value;
FPortName := Value;
cbPort.OnChange := nil;
cbPort.ItemIndex := cbPort.Items.IndexOf(FPortName);
cbPort.OnChange := DoChangePort;
end;
function TComPortSettingsDlg.GetPort: String;
begin
result := FPortName;
end;
function TComPortSettingsDlg.GetStopbits: Integer;
begin
case cbStopbits.ItemIndex of
1 : result := ONE5STOPBITS;
2 : result := TWOSTOPBITS;
else
result := ONESTOPBIT;
end;
end;
procedure TComPortSettingsDlg.Set_StopBits(Value: Integer);
begin
case Value of
ONE5STOPBITS : cbStopbits.ItemIndex := 1;
TWOSTOPBITS : cbStopbits.ItemIndex := 2;
else
cbStopbits.ItemIndex := 0
end;
end;
procedure TComPortSettingsDlg.DoChangePort(Sender: TObject);
begin
Set_Port(cbPort.Text);
end;
function TComPortSettingsDlg.GetHandshake: DWORD;
begin
case cbHandshake.ItemIndex of
1: result := COMPORTHANDSHAKE_XONXOFF;
2: result := COMPORTHANDSHAKE_RTSCTS;
3: result := COMPORTHANDSHAKE_DTRDSR;
else
result := COMPORTHANDSHAKE_NONE;
end;
end;
procedure TComPortSettingsDlg.Set_Handshake(const Value: DWORD);
begin
case Value of
COMPORTHANDSHAKE_XONXOFF : cbHandshake.ItemIndex := 1;
COMPORTHANDSHAKE_RTSCTS : cbHandshake.ItemIndex := 2;
COMPORTHANDSHAKE_DTRDSR : cbHandshake.ItemIndex := 3;
else
cbHandshake.ItemIndex := 0;
end;
end;
end.
|
unit TpPictureProperty;
interface
uses
TypInfo, SysUtils, Classes, Controls, Graphics, Dialogs, ExtDlgs,
dcedit, dcfdes, dcsystem, dcdsgnstuff,
ThPicture;
type
{
TTpPictureProperty = class(TPropertyEditor)
protected
function GetDialog: TOpenPictureDialog;
function GetPicture: TThPicture;
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
property Picture: TThPicture read GetPicture;
end;
}
//
TTpPicturePathProperty = class(TStringProperty)
public
class procedure SetPaths(const inRoot, inFolder: string);
protected
function GetDialog: TOpenPictureDialog;
function GetPicture: TThPicture;
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
property Picture: TThPicture read GetPicture;
end;
//
TTpPictureUrlProperty = class(TStringProperty)
public
function GetValue: string; override;
end;
procedure RegisterPicturePropertyEditor;
implementation
uses
StrUtils, LrUtils, ThPathUtils, TpStrings;
var
OpenPictureDialog: TOpenPictureDialog;
RootFolder: string;
PictureFolder: string;
LastPictureFolder: string;
procedure RegisterPicturePropertyEditor;
begin
//RegisterEditClass(TypeInfo(TPicture), nil, '', TDCSimpleEdit);
//RegisterPropertyEditor(TypeInfo(TThPicture), nil, '', TTpPictureProperty);
RegisterPropertyEditor(TypeInfo(string), nil, 'PicturePath',
TTpPicturePathProperty);
RegisterPropertyEditor(TypeInfo(string), nil, 'PictureUrl',
TTpPictureUrlProperty);
end;
{ TTpPictureProperty }
{
function TTpPictureProperty.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [ paDialog ];
end;
function TTpPictureProperty.GetDialog: TOpenPictureDialog;
begin
if OpenPictureDialog = nil then
begin
OpenPictureDialog := TOpenPictureDialog.Create(nil);
LastPictureFolder := '';
end;
if LastPictureFolder <> PictureFolder then
begin
OpenPictureDialog.InitialDir := PictureFolder;
LastPictureFolder := PictureFolder;
end;
Result := OpenPictureDialog;
end;
function TTpPictureProperty.GetPicture: TThPicture;
begin
//Result := TThPicture(GetComponent(0));
Result := TThPicture(GetOrdValue);
end;
procedure TTpPictureProperty.Edit;
var
p: string;
begin
with GetDialog do
if Execute then
begin
p := ExtractRelativePath(DocumentManagerForm.CurrentItem.Path, FileName);
Picture.SetPaths(FileName, ThPathToUrl(p));
end
else if MessageDlg('Clear picture?', mtConfirmation, mbYesNoCancel, 0)
= mrYes then
Picture.SetPaths('', '');
end;
function TTpPictureProperty.GetValue: string;
begin
Result := '(picture)';
end;
}
{ TTpPicturePathProperty }
class procedure TTpPicturePathProperty.SetPaths(const inRoot, inFolder: string);
begin
RootFolder := inRoot;
PictureFolder := inFolder;
//NeedFolder(PictureFolder);
end;
function TTpPicturePathProperty.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [ paDialog ];
end;
function TTpPicturePathProperty.GetPicture: TThPicture;
begin
Result := TThPicture(GetComponent(0));
end;
procedure TTpPicturePathProperty.Edit;
var
d: string;
begin
with GetDialog do
if Execute then
begin
if not IsSubfolder(FileName, RootFolder) then
if MessageDlg(SCopyPictureMsg, mtConfirmation, mbYesNoCancel, 0)
= mrYes then
begin
NeedFolder(PictureFolder);
d := PictureFolder + ExtractFileName(FileName);
CopyFile(FileName, d);
FileName := d;
end;
if not IsSubfolder(FileName, RootFolder) then
SetStrValue(FileName)
else begin
d := ExtractRelativePath(RootFolder, FileName);
SetStrValue(d);
Picture.PictureUrl := ThPathToUrl(d);
end;
end
// else if MessageDlg('Clear picture?', mtConfirmation, mbYesNoCancel, 0)
// = mrYes then
// SetStrValue('');
end;
function TTpPicturePathProperty.GetDialog: TOpenPictureDialog;
begin
if OpenPictureDialog = nil then
begin
OpenPictureDialog := TOpenPictureDialog.Create(nil);
LastPictureFolder := '';
end;
if LastPictureFolder <> PictureFolder then
begin
OpenPictureDialog.InitialDir := PictureFolder;
LastPictureFolder := PictureFolder;
end;
Result := OpenPictureDialog;
end;
{ TTpPictureUrlProperty }
function TTpPictureUrlProperty.GetValue: string;
begin
Result := GetStrValue;
if Result = '' then
Result := '(auto)';
end;
end.
|
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
IdServerWebsocketContext;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
btnWebsocketsTest: TButton;
cbxUseSSL: TCheckBox;
edtCertFilename: TLabeledEdit;
edtKeyFilename: TLabeledEdit;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure btnWebsocketsTestClick(Sender: TObject);
procedure cbxUseSSLClick(Sender: TObject);
private
procedure ServerMessageTextReceived(const AContext: TIdServerWSContext; const aText: string);
procedure ClientBinDataReceived(const aData: TStream);
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
IdWebsocketServer, IdHTTPWebsocketClient, superobject, IdSocketIOHandling,
IdIOHandlerWebsocket,
IdSSLOpenSSL,
IdServerIOHandlerWebsocket;
var
server: TIdWebsocketServer;
client: TIdHTTPWebsocketClient;
const
C_CLIENT_EVENT = 'CLIENT_TO_SERVER_EVENT_TEST';
C_SERVER_EVENT = 'SERVER_TO_CLIENT_EVENT_TEST';
procedure ShowMessageInMainthread(const aMsg: string) ;
begin
TThread.Synchronize(nil,
procedure
begin
ShowMessage(aMsg);
end);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
server := TIdWebsocketServer.Create(Self);
server.DefaultPort := 12345;
server.SocketIO.OnEvent(C_CLIENT_EVENT,
procedure(const ASocket: ISocketIOContext; const aArgument: TSuperArray; const aCallback: ISocketIOCallback)
begin
//show request (threadsafe)
ShowMessageInMainthread('REQUEST: ' + aArgument[0].AsJSon);
//send callback (only if specified!)
if aCallback <> nil then
aCallback.SendResponse( SO(['succes', True]).AsJSon );
end);
server.Active := True;
client := TIdHTTPWebsocketClient.Create(Self);
client.Port := 12345;
client.Host := 'localhost';
client.SocketIOCompatible := True;
client.SocketIO.OnEvent(C_SERVER_EVENT,
procedure(const ASocket: ISocketIOContext; const aArgument: TSuperArray; const aCallback: ISocketIOCallback)
begin
ShowMessageInMainthread('Data PUSHED from server: ' + aArgument[0].AsJSon);
//server wants a response?
if aCallback <> nil then
aCallback.SendResponse('thank for the push!');
end);
client.Connect;
client.SocketIO.Emit(C_CLIENT_EVENT, SO([ 'request', 'some data']),
//provide callback
procedure(const ASocket: ISocketIOContext; const aJSON: ISuperObject; const aCallback: ISocketIOCallback)
begin
//show response (threadsafe)
ShowMessageInMainthread('RESPONSE: ' + aJSON.AsJSon);
end);
//start timer so server pushes (!) data to all clients
Timer1.Interval := 5 * 1000; //5s
// Timer1.Enabled := True;
end;
procedure TForm1.cbxUseSSLClick(Sender: TObject);
begin
edtCertFilename.Enabled := cbxUseSSL.Checked;
edtKeyFilename.Enabled := cbxUseSSL.Checked;
end;
procedure TForm1.btnWebsocketsTestClick(Sender: TObject);
begin
server := TIdWebsocketServer.Create(Self);
server.DefaultPort := 12346;
if cbxUseSSL.Checked then
begin
server.UseSSL := true;
with server.IOHandler as TIdServerIOHandlerWebsocketSSL do
begin
SSLOptions.Method := sslvTLSv1_2;
SSLOptions.KeyFile := edtKeyFilename.Text;
SSLOptions.CertFile := edtCertFilename.Text;
SSLOptions.RootCertFile := '';
end;
end
else
server.IOHandler;
server.Active := True;
client := TIdHTTPWebsocketClient.Create(Self);
client.Port := 12346;
client.Host := 'localhost';
client.UseSSL := cbxUseSSL.Checked;
if cbxUseSSL.Checked then
(client.IOHandler as TIdIOHandlerWebsocketSSL).SSLOptions.Method := sslvTLSv1_2;
client.Connect;
client.UpgradeToWebsocket;
client.OnBinData := ClientBinDataReceived;
server.OnMessageText := ServerMessageTextReceived;
client.IOHandler.Write('test');
end;
procedure TForm1.ClientBinDataReceived(const aData: TStream);
begin
//
end;
procedure TForm1.ServerMessageTextReceived(const AContext: TIdServerWSContext; const aText: string);
var
strm: TStringStream;
begin
ShowMessageInMainthread('WS REQUEST: ' + aText);
strm := TStringStream.Create('SERVER: ' + aText);
AContext.IOHandler.Write(strm);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := false;
server.SocketIO.EmitEventToAll(C_SERVER_EVENT, SO(['data', 'pushed from server']),
procedure(const ASocket: ISocketIOContext; const aJSON: ISuperObject; const aCallback: ISocketIOCallback)
begin
//show response (threadsafe)
TThread.Synchronize(nil,
procedure
begin
ShowMessage('RESPONSE from a client: ' + aJSON.AsJSon);
end);
end);
end;
end.
|
unit PestObsGroupUnit;
interface
uses
GoPhastTypes, System.Classes, System.SysUtils;
type
TPestObservationGroup = class(TPhastCollectionItem)
private
FObsGroupName: string;
FUseGroupTarget: Boolean;
FAbsoluteCorrelationFileName: string;
FStoredGroupTarget: TRealStorage;
function GetRelativCorrelationFileName: string;
procedure SetAbsoluteCorrelationFileName(const Value: string);
procedure SetObsGroupName(Value: string);
procedure SetRelativCorrelationFileName(const Value: string);
procedure SetStoredGroupTarget(const Value: TRealStorage);
procedure SetUseGroupTarget(const Value: Boolean);
function GetGroupTarget: Double;
procedure SetGroupTarget(const Value: Double);
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
// COVFLE]
property AbsoluteCorrelationFileName: string
read FAbsoluteCorrelationFileName write SetAbsoluteCorrelationFileName;
// GTARG
property GroupTarget: Double read GetGroupTarget write SetGroupTarget;
published
// OBGNME
property ObsGroupName: string read FObsGroupName write SetObsGroupName;
// GTARG
property UseGroupTarget: Boolean read FUseGroupTarget
write SetUseGroupTarget;
// GTARG
property StoredGroupTarget: TRealStorage read FStoredGroupTarget
write SetStoredGroupTarget;
// COVFLE]
property RelativCorrelationFileName: string
read GetRelativCorrelationFileName write SetRelativCorrelationFileName;
end;
TPestObservationGroups = class(TPhastCollection)
private
function GetParamGroup(Index: Integer): TPestObservationGroup;
procedure SetParamGroup(Index: Integer; const Value: TPestObservationGroup);
public
constructor Create(InvalidateModelEvent: TNotifyEvent);
function Add: TPestObservationGroup;
property Items[Index: Integer]: TPestObservationGroup read GetParamGroup
write SetParamGroup; default;
end;
function ValidObsGroupName(Value: string): string;
implementation
uses
frmGoPhastUnit;
function ValidObsGroupName(Value: string): string;
const
MaxLength = 12;
ValidCharacters = ['A'..'Z', 'a'..'z', '0'..'9',
'_', '.', ':', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '+',
'=', '?', '/', '<', '>'];
var
AChar: Char;
CharIndex: Integer;
begin
result := Copy(Value, 1, MaxLength);
for CharIndex := 1 to Length(result) do
begin
AChar := result[CharIndex];
if not CharInSet(AChar, ValidCharacters) then
begin
AChar := '_';
result[CharIndex] := AChar;
end;
end;
end;
{ TPestObservationGroup }
procedure TPestObservationGroup.Assign(Source: TPersistent);
var
SourceGroup: TPestObservationGroup;
begin
if Source is TPestObservationGroup then
begin
SourceGroup := TPestObservationGroup(Source);
ObsGroupName := SourceGroup.ObsGroupName;
UseGroupTarget := SourceGroup.UseGroupTarget;
GroupTarget := SourceGroup.GroupTarget;
AbsoluteCorrelationFileName := SourceGroup.AbsoluteCorrelationFileName;
end
else
begin
inherited;
end;
end;
constructor TPestObservationGroup.Create(Collection: TCollection);
begin
inherited;
FStoredGroupTarget := TRealStorage.Create;
FStoredGroupTarget.OnChange := OnInvalidateModel;
end;
destructor TPestObservationGroup.Destroy;
begin
FStoredGroupTarget.Free;
inherited;
end;
function TPestObservationGroup.GetGroupTarget: Double;
begin
result := FStoredGroupTarget.Value;
end;
function TPestObservationGroup.GetRelativCorrelationFileName: string;
begin
if AbsoluteCorrelationFileName <> '' then
begin
result := ExtractRelativePath(frmGoPhast.PhastModel.ModelFileName,
AbsoluteCorrelationFileName);
end
else
begin
result := ''
end;
end;
procedure TPestObservationGroup.SetAbsoluteCorrelationFileName(
const Value: string);
begin
SetStringProperty(FAbsoluteCorrelationFileName, Value);
end;
procedure TPestObservationGroup.SetGroupTarget(const Value: Double);
begin
FStoredGroupTarget.Value := Value;
end;
procedure TPestObservationGroup.SetObsGroupName(Value: string);
begin
SetStringProperty(FObsGroupName, ValidObsGroupName(Value));
end;
procedure TPestObservationGroup.SetRelativCorrelationFileName(
const Value: string);
begin
if Value <> '' then
begin
AbsoluteCorrelationFileName := ExpandFileName(Value)
end
else
begin
AbsoluteCorrelationFileName := '';
end;
end;
procedure TPestObservationGroup.SetStoredGroupTarget(const Value: TRealStorage);
begin
FStoredGroupTarget.Assign(Value);
end;
procedure TPestObservationGroup.SetUseGroupTarget(const Value: Boolean);
begin
SetBooleanProperty(FUseGroupTarget, Value);
end;
{ TPestObservationGroups }
function TPestObservationGroups.Add: TPestObservationGroup;
begin
result := inherited Add as TPestObservationGroup
end;
constructor TPestObservationGroups.Create(InvalidateModelEvent: TNotifyEvent);
begin
inherited Create(TPestObservationGroup, InvalidateModelEvent);
end;
function TPestObservationGroups.GetParamGroup(
Index: Integer): TPestObservationGroup;
begin
result := inherited Items[Index] as TPestObservationGroup;
end;
procedure TPestObservationGroups.SetParamGroup(Index: Integer;
const Value: TPestObservationGroup);
begin
inherited Items[Index] := Value;
end;
end.
|
(********************************************************************************
* *
* mmeapi.h -- ApiSet Contract for api-ms-win-mm-mme-l1-1-0 *
* *
* Copyright (c) Microsoft Corporation. All rights reserved. *
* *
********************************************************************************)
unit CMC.MMEAPI;
interface
{$IFDEF FPC}
{$MODE delphi}
{$ENDIF}
uses
Windows, Classes,
Win32.MMSysCom;
const
winmm_dll = 'WinMM.dll';
const
{ ***************************************************************************
Waveform audio support
*************************************************************************** }
{ waveform audio error return values }
WAVERR_BADFORMAT = (WAVERR_BASE + 0); { unsupported wave format }
WAVERR_STILLPLAYING = (WAVERR_BASE + 1); { still something playing }
WAVERR_UNPREPARED = (WAVERR_BASE + 2); { header not prepared }
WAVERR_SYNC = (WAVERR_BASE + 3); { device is synchronous }
WAVERR_LASTERROR = (WAVERR_BASE + 3); { last error in range }
(* device ID for wave device mapper *)
WAVE_MAPPER = UINT(-1);
(* flags for dwFlags parameter in waveOutOpen() and waveInOpen() *)
WAVE_FORMAT_QUERY = $0001;
WAVE_ALLOWSYNC = $0002;
WAVE_MAPPED = $0004;
WAVE_FORMAT_DIRECT = $0008;
WAVE_FORMAT_DIRECT_QUERY = (WAVE_FORMAT_QUERY or WAVE_FORMAT_DIRECT);
WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE = $0010;
(* flags for dwFlags field of WAVEHDR *)
WHDR_DONE = $00000001; (* done bit *)
WHDR_PREPARED = $00000002; (* set if this header has been prepared *)
WHDR_BEGINLOOP = $00000004; (* loop start block *)
WHDR_ENDLOOP = $00000008; (* loop end block *)
WHDR_INQUEUE = $00000010; (* reserved for driver *)
(* flags for dwSupport field of WAVEOUTCAPS *)
WAVECAPS_PITCH = $0001; (* supports pitch control *)
WAVECAPS_PLAYBACKRATE = $0002; (* supports playback rate control *)
WAVECAPS_VOLUME = $0004; (* supports volume control *)
WAVECAPS_LRVOLUME = $0008; (* separate left-right volume control *)
WAVECAPS_SYNC = $0010;
WAVECAPS_SAMPLEACCURATE = $0020;
(* defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS *)
WAVE_INVALIDFORMAT = $00000000; (* invalid format *)
WAVE_FORMAT_1M08 = $00000001; (* 11.025 kHz, Mono, 8-bit *)
WAVE_FORMAT_1S08 = $00000002; (* 11.025 kHz, Stereo, 8-bit *)
WAVE_FORMAT_1M16 = $00000004; (* 11.025 kHz, Mono, 16-bit *)
WAVE_FORMAT_1S16 = $00000008; (* 11.025 kHz, Stereo, 16-bit *)
WAVE_FORMAT_2M08 = $00000010; (* 22.05 kHz, Mono, 8-bit *)
WAVE_FORMAT_2S08 = $00000020; (* 22.05 kHz, Stereo, 8-bit *)
WAVE_FORMAT_2M16 = $00000040; (* 22.05 kHz, Mono, 16-bit *)
WAVE_FORMAT_2S16 = $00000080; (* 22.05 kHz, Stereo, 16-bit *)
WAVE_FORMAT_4M08 = $00000100; (* 44.1 kHz, Mono, 8-bit *)
WAVE_FORMAT_4S08 = $00000200; (* 44.1 kHz, Stereo, 8-bit *)
WAVE_FORMAT_4M16 = $00000400; (* 44.1 kHz, Mono, 16-bit *)
WAVE_FORMAT_4S16 = $00000800; (* 44.1 kHz, Stereo, 16-bit *)
WAVE_FORMAT_44M08 = $00000100; (* 44.1 kHz, Mono, 8-bit *)
WAVE_FORMAT_44S08 = $00000200; (* 44.1 kHz, Stereo, 8-bit *)
WAVE_FORMAT_44M16 = $00000400; (* 44.1 kHz, Mono, 16-bit *)
WAVE_FORMAT_44S16 = $00000800; (* 44.1 kHz, Stereo, 16-bit *)
WAVE_FORMAT_48M08 = $00001000; (* 48 kHz, Mono, 8-bit *)
WAVE_FORMAT_48S08 = $00002000; (* 48 kHz, Stereo, 8-bit *)
WAVE_FORMAT_48M16 = $00004000; (* 48 kHz, Mono, 16-bit *)
WAVE_FORMAT_48S16 = $00008000; (* 48 kHz, Stereo, 16-bit *)
WAVE_FORMAT_96M08 = $00010000; (* 96 kHz, Mono, 8-bit *)
WAVE_FORMAT_96S08 = $00020000; (* 96 kHz, Stereo, 8-bit *)
WAVE_FORMAT_96M16 = $00040000; (* 96 kHz, Mono, 16-bit *)
WAVE_FORMAT_96S16 = $00080000; (* 96 kHz, Stereo, 16-bit *)
// xxx
{ MIXERCONTROL.fdwControl }
MIXERCONTROL_CONTROLF_UNIFORM = $00000001;
MIXERCONTROL_CONTROLF_MULTIPLE = $00000002;
MIXERCONTROL_CONTROLF_DISABLED = $80000000;
{ MIXERCONTROL_CONTROLTYPE_xxx building block defines }
MIXERCONTROL_CT_CLASS_MASK = $F0000000;
MIXERCONTROL_CT_CLASS_CUSTOM = $00000000;
MIXERCONTROL_CT_CLASS_METER = $10000000;
MIXERCONTROL_CT_CLASS_SWITCH = $20000000;
MIXERCONTROL_CT_CLASS_NUMBER = $30000000;
MIXERCONTROL_CT_CLASS_SLIDER = $40000000;
MIXERCONTROL_CT_CLASS_FADER = $50000000;
MIXERCONTROL_CT_CLASS_TIME = $60000000;
MIXERCONTROL_CT_CLASS_LIST = $70000000;
MIXERCONTROL_CT_SUBCLASS_MASK = $0F000000;
MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = $00000000;
MIXERCONTROL_CT_SC_SWITCH_BUTTON = $01000000;
MIXERCONTROL_CT_SC_METER_POLLED = $00000000;
MIXERCONTROL_CT_SC_TIME_MICROSECS = $00000000;
MIXERCONTROL_CT_SC_TIME_MILLISECS = $01000000;
MIXERCONTROL_CT_SC_LIST_SINGLE = $00000000;
MIXERCONTROL_CT_SC_LIST_MULTIPLE = $01000000;
MIXERCONTROL_CT_UNITS_MASK = $00FF0000;
MIXERCONTROL_CT_UNITS_CUSTOM = $00000000;
MIXERCONTROL_CT_UNITS_BOOLEAN = $00010000;
MIXERCONTROL_CT_UNITS_SIGNED = $00020000;
MIXERCONTROL_CT_UNITS_UNSIGNED = $00030000;
MIXERCONTROL_CT_UNITS_DECIBELS = $00040000; { in 10ths }
MIXERCONTROL_CT_UNITS_PERCENT = $00050000; { in 10ths }
{ Commonly used control types for specifying MIXERCONTROL.dwControlType }
MIXERCONTROL_CONTROLTYPE_CUSTOM = (MIXERCONTROL_CT_CLASS_CUSTOM or MIXERCONTROL_CT_UNITS_CUSTOM);
MIXERCONTROL_CONTROLTYPE_BOOLEANMETER =
(MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_BOOLEAN);
MIXERCONTROL_CONTROLTYPE_SIGNEDMETER =
(MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_SIGNED);
MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1);
MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER =
(MIXERCONTROL_CT_CLASS_METER or MIXERCONTROL_CT_SC_METER_POLLED or MIXERCONTROL_CT_UNITS_UNSIGNED);
MIXERCONTROL_CONTROLTYPE_BOOLEAN =
(MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BOOLEAN or MIXERCONTROL_CT_UNITS_BOOLEAN);
MIXERCONTROL_CONTROLTYPE_ONOFF = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1);
MIXERCONTROL_CONTROLTYPE_MUTE = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2);
MIXERCONTROL_CONTROLTYPE_MONO = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3);
MIXERCONTROL_CONTROLTYPE_LOUDNESS = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4);
MIXERCONTROL_CONTROLTYPE_STEREOENH = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5);
MIXERCONTROL_CONTROLTYPE_BASS_BOOST = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + $00002277);
MIXERCONTROL_CONTROLTYPE_BUTTON = (MIXERCONTROL_CT_CLASS_SWITCH or MIXERCONTROL_CT_SC_SWITCH_BUTTON or
MIXERCONTROL_CT_UNITS_BOOLEAN);
MIXERCONTROL_CONTROLTYPE_DECIBELS = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_DECIBELS);
MIXERCONTROL_CONTROLTYPE_SIGNED = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_SIGNED);
MIXERCONTROL_CONTROLTYPE_UNSIGNED = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_UNSIGNED);
MIXERCONTROL_CONTROLTYPE_PERCENT = (MIXERCONTROL_CT_CLASS_NUMBER or MIXERCONTROL_CT_UNITS_PERCENT);
MIXERCONTROL_CONTROLTYPE_SLIDER = (MIXERCONTROL_CT_CLASS_SLIDER or MIXERCONTROL_CT_UNITS_SIGNED);
MIXERCONTROL_CONTROLTYPE_PAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1);
MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2);
MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER or MIXERCONTROL_CT_UNITS_UNSIGNED);
MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1);
MIXERCONTROL_CONTROLTYPE_BASS = (MIXERCONTROL_CONTROLTYPE_FADER + 2);
MIXERCONTROL_CONTROLTYPE_TREBLE = (MIXERCONTROL_CONTROLTYPE_FADER + 3);
MIXERCONTROL_CONTROLTYPE_EQUALIZER = (MIXERCONTROL_CONTROLTYPE_FADER + 4);
MIXERCONTROL_CONTROLTYPE_SINGLESELECT =
(MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_SINGLE or MIXERCONTROL_CT_UNITS_BOOLEAN);
MIXERCONTROL_CONTROLTYPE_MUX = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1);
MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT =
(MIXERCONTROL_CT_CLASS_LIST or MIXERCONTROL_CT_SC_LIST_MULTIPLE or MIXERCONTROL_CT_UNITS_BOOLEAN);
MIXERCONTROL_CONTROLTYPE_MIXER = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1);
MIXERCONTROL_CONTROLTYPE_MICROTIME =
(MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MICROSECS or MIXERCONTROL_CT_UNITS_UNSIGNED);
MIXERCONTROL_CONTROLTYPE_MILLITIME =
(MIXERCONTROL_CT_CLASS_TIME or MIXERCONTROL_CT_SC_TIME_MILLISECS or MIXERCONTROL_CT_UNITS_UNSIGNED);
MIXER_GETLINECONTROLSF_ALL = $00000000;
MIXER_GETLINECONTROLSF_ONEBYID = $00000001;
MIXER_GETLINECONTROLSF_ONEBYTYPE = $00000002;
MIXER_GETLINECONTROLSF_QUERYMASK = $0000000F;
MIXER_GETCONTROLDETAILSF_VALUE = $00000000;
MIXER_GETCONTROLDETAILSF_LISTTEXT = $00000001;
MIXER_GETCONTROLDETAILSF_QUERYMASK = $0000000F;
MIXER_SETCONTROLDETAILSF_VALUE = $00000000;
MIXER_SETCONTROLDETAILSF_CUSTOM = $00000001;
MIXER_SETCONTROLDETAILSF_QUERYMASK = $0000000F;
(****************************************************************************
MIDI audio support
****************************************************************************)
(* MIDI error return values *)
MIDIERR_UNPREPARED = (MIDIERR_BASE + 0); (* header not prepared *)
MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1); (* still something playing *)
MIDIERR_NOMAP = (MIDIERR_BASE + 2); (* no configured instruments *)
MIDIERR_NOTREADY = (MIDIERR_BASE + 3); (* hardware is still busy *)
MIDIERR_NODEVICE = (MIDIERR_BASE + 4); (* port no longer connected *)
MIDIERR_INVALIDSETUP = (MIDIERR_BASE + 5); (* invalid MIF *)
MIDIERR_BADOPENMODE = (MIDIERR_BASE + 6); (* operation unsupported w/ open mode *)
MIDIERR_DONT_CONTINUE = (MIDIERR_BASE + 7); (* thru device 'eating' a message *)
MIDIERR_LASTERROR = (MIDIERR_BASE + 7); (* last error in range *)
MIDIPATCHSIZE = 128;
(* device ID for MIDI mapper *)
MIDIMAPPER = UINT(-1);
MIDI_MAPPER = UINT(-1);
//{$IF (WINVER >= $0400)}
(* flags for dwFlags parm of midiInOpen() *)
MIDI_IO_STATUS = $00000020;
//{$ENDIF} (* WINVER >= $0400 *)
(* flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches() *)
MIDI_CACHE_ALL = 1;
MIDI_CACHE_BESTFIT = 2;
MIDI_CACHE_QUERY = 3;
MIDI_UNCACHE = 4;
(* flags for wTechnology field of MIDIOUTCAPS structure *)
MOD_MIDIPORT = 1; (* output port *)
MOD_SYNTH = 2; (* generic internal synth *)
MOD_SQSYNTH = 3; (* square wave internal synth *)
MOD_FMSYNTH = 4; (* FM internal synth *)
MOD_MAPPER = 5; (* MIDI mapper *)
MOD_WAVETABLE = 6; (* hardware wavetable synth *)
MOD_SWSYNTH = 7; (* software synth *)
(* flags for dwSupport field of MIDIOUTCAPS structure *)
MIDICAPS_VOLUME = $0001; (* supports volume control *)
MIDICAPS_LRVOLUME = $0002; (* separate left-right volume control *)
MIDICAPS_CACHE = $0004;
//{$IF (WINVER >= $0400)}
MIDICAPS_STREAM = $0008; (* driver supports midiStreamOut directly *)
// {$ENDIF} (* WINVER >= $0400 *)
(* flags for dwFlags field of MIDIHDR structure *)
MHDR_DONE = $00000001; (* done bit *)
MHDR_PREPARED = $00000002; (* set if header prepared *)
MHDR_INQUEUE = $00000004; (* reserved for driver *)
MHDR_ISSTRM = $00000008; (* Buffer is stream buffer *)
//{$IF (WINVER >= $0400)}
(* *)
(* Type codes which go in the high byte of the event DWORD of a stream buffer *)
(* *)
(* Type codes 00-7F contain parameters within the low 24 bits *)
(* Type codes 80-FF contain a length of their parameter in the low 24 *)
(* bits, followed by their parameter data in the buffer. The event *)
(* DWORD contains the exact byte length; the parm data itself must be *)
(* padded to be an even multiple of 4 bytes long. *)
(* *)
MEVT_F_SHORT = $00000000;
MEVT_F_LONG = $80000000;
MEVT_F_CALLBACK = $40000000;
MEVT_SHORTMSG = byte($00); (* parm = shortmsg for midiOutShortMsg *)
MEVT_TEMPO = byte($01); (* parm = new tempo in microsec/qn *)
MEVT_NOP = byte($02); (* parm = unused; does nothing *)
(* $04-$7F reserved *)
MEVT_LONGMSG = byte($80); (* parm = bytes to send verbatim *)
MEVT_COMMENT = byte($82); (* parm = comment data *)
MEVT_VERSION = byte($84); (* parm = MIDISTRMBUFFVER struct *)
(* $81-$FF reserved *)
MIDISTRM_ERROR = (-2);
(* *)
(* Structures and defines for midiStreamProperty *)
(* *)
MIDIPROP_SET = $80000000;
MIDIPROP_GET = $40000000;
(* These are intentionally both non-zero so the app cannot accidentally *)
(* leave the operation off and happen to appear to work due to default *)
(* action. *)
MIDIPROP_TIMEDIV = $00000001;
MIDIPROP_TEMPO = $00000002;
// {$ENDIF} (* WINVER >= $0400 *)
(****************************************************************************
Auxiliary audio support
****************************************************************************)
(* device ID for aux device mapper *)
AUX_MAPPER = UINT(-1);
(* flags for wTechnology field in AUXCAPS structure *)
AUXCAPS_CDAUDIO = 1; (* audio from internal CD-ROM drive *)
AUXCAPS_AUXIN = 2; (* audio from auxiliary input jacks *)
(* flags for dwSupport field in AUXCAPS structure *)
AUXCAPS_VOLUME = $0001; (* supports volume control *)
AUXCAPS_LRVOLUME = $0002; (* separate left-right volume control *)
(****************************************************************************
Mixer Support
****************************************************************************)
MIXER_SHORT_NAME_CHARS = 16;
MIXER_LONG_NAME_CHARS = 64;
(* *)
(* MMRESULT error return values specific to the mixer API *)
(* *)
(* *)
MIXERR_INVALLINE = (MIXERR_BASE + 0);
MIXERR_INVALCONTROL = (MIXERR_BASE + 1);
MIXERR_INVALVALUE = (MIXERR_BASE + 2);
MIXERR_LASTERROR = (MIXERR_BASE + 2);
MIXER_OBJECTF_HANDLE = $80000000;
MIXER_OBJECTF_MIXER = $00000000;
MIXER_OBJECTF_HMIXER = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIXER);
MIXER_OBJECTF_WAVEOUT = $10000000;
MIXER_OBJECTF_HWAVEOUT = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEOUT);
MIXER_OBJECTF_WAVEIN = $20000000;
MIXER_OBJECTF_HWAVEIN = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_WAVEIN);
MIXER_OBJECTF_MIDIOUT = $30000000;
MIXER_OBJECTF_HMIDIOUT = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIOUT);
MIXER_OBJECTF_MIDIIN = $40000000;
MIXER_OBJECTF_HMIDIIN = (MIXER_OBJECTF_HANDLE or MIXER_OBJECTF_MIDIIN);
MIXER_OBJECTF_AUX = $50000000;
(* *)
(* MIXERLINE.fdwLine *)
(* *)
(* *)
MIXERLINE_LINEF_ACTIVE = $00000001;
MIXERLINE_LINEF_DISCONNECTED = $00008000;
MIXERLINE_LINEF_SOURCE = $80000000;
(* *)
(* MIXERLINE.dwComponentType *)
(* *)
(* component types for destinations and sources *)
(* *)
(* *)
MIXERLINE_COMPONENTTYPE_DST_FIRST = $00000000;
MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0);
MIXERLINE_COMPONENTTYPE_DST_DIGITAL = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1);
MIXERLINE_COMPONENTTYPE_DST_LINE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2);
MIXERLINE_COMPONENTTYPE_DST_MONITOR = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3);
MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4);
MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5);
MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6);
MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7);
MIXERLINE_COMPONENTTYPE_DST_VOICEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
MIXERLINE_COMPONENTTYPE_DST_LAST = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
MIXERLINE_COMPONENTTYPE_SRC_FIRST = $00001000;
MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0);
MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1);
MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2);
MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3);
MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4);
MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5);
MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6);
MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7);
MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8);
MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9);
MIXERLINE_COMPONENTTYPE_SRC_ANALOG = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
MIXERLINE_COMPONENTTYPE_SRC_LAST = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
(* *)
(* MIXERLINE.Target.dwType *)
(* *)
(* *)
MIXERLINE_TARGETTYPE_UNDEFINED = 0;
MIXERLINE_TARGETTYPE_WAVEOUT = 1;
MIXERLINE_TARGETTYPE_WAVEIN = 2;
MIXERLINE_TARGETTYPE_MIDIOUT = 3;
MIXERLINE_TARGETTYPE_MIDIIN = 4;
MIXERLINE_TARGETTYPE_AUX = 5;
MIXER_GETLINEINFOF_DESTINATION = $00000000;
MIXER_GETLINEINFOF_SOURCE = $00000001;
MIXER_GETLINEINFOF_LINEID = $00000002;
MIXER_GETLINEINFOF_COMPONENTTYPE = $00000003;
MIXER_GETLINEINFOF_TARGETTYPE = $00000004;
MIXER_GETLINEINFOF_QUERYMASK = $0000000F;
type
(* wave data block header *)
PWAVEHDR = ^TWAVEHDR;
TWAVEHDR = record
lpData: LPSTR; (* pointer to locked data buffer *)
dwBufferLength: DWORD; (* length of data buffer *)
dwBytesRecorded: DWORD; (* used for input only *)
dwUser: DWORD_PTR; (* for client's use *)
dwFlags: DWORD; (* assorted flags (see defines) *)
dwLoops: DWORD; (* loop control counter *)
lpNext: PWAVEHDR; (* reserved for driver *)
reserved: DWORD_PTR; (* reserved for driver *)
end;
(* waveform output device capabilities structure *)
TWAVEOUTCAPSA = record
wMid: word; (* manufacturer ID *)
wPid: word; (* product ID *)
vDriverVersion: TMMVERSION; (* version of the driver *)
szPname: array[0..MAXPNAMELEN - 1] of ANSICHAR; (* product name (NULL terminated string) *)
dwFormats: DWORD; (* formats supported *)
wChannels: word; (* number of sources supported *)
wReserved1: word; (* packing *)
dwSupport: DWORD; (* functionality supported by driver *)
end;
PWAVEOUTCAPSA = ^TWAVEOUTCAPSA;
TWAVEOUTCAPSW = record
wMid: word; (* manufacturer ID *)
wPid: word; (* product ID *)
vDriverVersion: TMMVERSION; (* version of the driver *)
szPname: array[0..MAXPNAMELEN - 1] of WCHAR; (* product name (NULL terminated string) *)
dwFormats: DWORD; (* formats supported *)
wChannels: word; (* number of sources supported *)
wReserved1: word; (* packing *)
dwSupport: DWORD; (* functionality supported by driver *)
end;
PWAVEOUTCAPSW = ^TWAVEOUTCAPSW;
(* waveform audio function prototypes *)
function waveOutGetNumDevs(): UINT; stdcall; external winmm_dll;
implementation
end.
|
{==============================================================================
Copyright (C) combit GmbH
-------------------------------------------------------------------------------
File : simplefm.pas, simplefm.dfm, simple2.dpr
Module : simple list sample
Descr. : D: Dieses Beispiel demonstriert das Designen und Drucken von Listen.
US: This example demonstrates how to design and print lists.
===============================================================================}
unit simplefm;
interface
uses
Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DB, DBTables, cmbtll28, L28, StdCtrls, L28db, Registry, Windows,
Data.Win.ADODB
{$If CompilerVersion >=28} // >=XE7
, System.UITypes
{$ENDIF}
;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
DesignButton: TButton;
PreviewButton: TButton;
PrintButton: TButton;
DebugCheckBox: TCheckBox;
LL: TDBL28_;
ADOConnection1: TADOConnection;
ADOTableArticle: TADOTable;
dsProducts: TDataSource;
procedure FormCreate(Sender: TObject);
procedure DesignButtonClick(Sender: TObject);
procedure PreviewButtonClick(Sender: TObject);
procedure PrintButtonClick(Sender: TObject);
procedure DebugCheckBoxClick(Sender: TObject);
private
{ Private declarations }
public
CurPath, DataFilePath, DataFileName: string;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var errorText: String;
var regKeyPath: String;
var errorOccurred: Boolean;
var registry: TRegistry;
begin
{D: Bestimme den Dateinamen der Beispiel-Datenbank}
{US: Set the filename for the test database }
errorOccurred := true;
registry := TRegistry.Create();
registry.RootKey := HKEY_CURRENT_USER;
regKeyPath := 'Software\combit\cmbtll\';
if registry.KeyExists(regKeyPath) then
begin
if registry.OpenKeyReadOnly(regKeyPath) then
begin
DataFilePath := registry.ReadString('LL' + IntToStr(LL.LlGetVersion(LL_VERSION_MAJOR)) + 'SampleDir');
if (DataFilePath[Length(DataFilePath)] = '\') then
begin
DataFileName:='samples.mdb';
end
else
DataFileName:='\samples.mdb';
registry.CloseKey();
if FileExists(DataFilePath + DataFileName) then
begin
{D: Lade die Datenbank, fange Fehler ab }
{US: Load the database, checks for errors }
Try
begin
ADOConnection1.ConnectionString :='Provider=Microsoft.Jet.OLEDB.4.0;Data Source= ' + DataFilePath + DataFileName +';' ;
ADOConnection1.Connected :=true;
ADOConnection1.LoginPrompt :=false;
ADOTableArticle.active := false;
ADOTableArticle.TableName :='article';
ADOTableArticle.active := true;
{D: Setze Dateipfad für LL Projektdateien }
{US: Set path fo LL project files}
CurPath := GetCurrentDir()+ '\';
errorOccurred := false;
end
Except On EDBEngineError Do
//
End;
end;
end;
end;
registry.Free();
if errorOccurred then
begin
errorText := 'D: Beispiel-Datenbank nicht gefunden' + #13 + 'US: Test database not found';
MessageDlg(errorText, mtError, [mbOK], 0);
end;
end;
procedure TForm1.DesignButtonClick(Sender: TObject);
begin
{D: Zum ersten Datensatz wechseln }
{US: Move to first record }
ADOTableArticle.First;
LL.Datasource :=dsProducts;
{D: Designer mit dem Titel 'Design List' starten }
{US: Opens the designer, sets designer title to 'Design List'}
LL.AutoDesignerFile := CurPath + 'simple.lst';
LL.AutoShowSelectFile := No;
LL.AutoDesign('Design List');
end;
procedure TForm1.PreviewButtonClick(Sender: TObject);
begin
{D: Zum ersten Datensatz wechseln }
{US: Move to first record }
ADOTableArticle.First;
LL.Datasource :=dsProducts;
{D: Projekt als Vorschau ausdrucken}
{US: Print project to preview}
LL.AutoDesignerFile := CurPath + 'simple.lst';
LL.AutoShowSelectFile := No;
LL.AutoDestination := adPreview;
LL.AutoPrint('Print list to preview','');
end;
procedure TForm1.PrintButtonClick(Sender: TObject);
begin
begin
{D: Zum ersten Datensatz wechseln }
{US: Move to first record }
ADOTableArticle.First;
LL.Datasource :=dsProducts;
{D: Projekt auf Drucker ausdrucken }
{US: Print project to printer}
LL.AutoDesignerFile := CurPath + 'simple.lst';
LL.AutoShowSelectFile := No;
LL.AutoDestination := adPrinter;
LL.AutoPrint('Print list to printer','');
end;
end;
procedure TForm1.DebugCheckBoxClick(Sender: TObject);
{D: (De)aktiviert Debug-Ausgaben }
{US: enables or disables debug output }
begin
If DebugCheckBox.checked=true
then
begin
LL.DebugMode:=1;
MessageDlg('D: Debwin muss zur Anzeige von Debugausgaben gestartet werden'+#13
+'US: Start Debwin to receive debug messages', mtInformation,
[mbOK],0);
end
else LL.DebugMode:=0;
end;
end.
|
unit UP_uManOrdersFrame;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxGridTableView, cxGridLevel,
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
cxGridDBTableView, cxGrid, Buttons, ExtCtrls,
ActnList, ComCtrls, uCommonSp, Mask,
CheckEditUnit, cxContainer, cxLabel, cxDBLabel, cxCheckBox, cxTL,
cxInplaceContainer, cxTLData, cxDBTL, cxMaskEdit, cxCalendar,
FIBDatabase, pFIBDatabase, FIBDataSet, pFIBDataSet, Ibase, uFControl,
uLabeledFControl, uDateControl, cxTextEdit, cxSplitter, cxDBEdit,
cxDropDownEdit, cxButtonEdit;
type
TfmManOrdersPage = class(TFrame)
WriteTransaction: TpFIBTransaction;
DSetManOrders: TpFIBDataSet;
ManOrdersSource: TDataSource;
WorkDatabase: TpFIBDatabase;
ReadTransaction: TpFIBTransaction;
Panel2: TPanel;
ManOrdersGrid: TcxGrid;
ManOrdersGridLevel: TcxGridLevel;
cbLevels: TcxCheckBox;
LevelEdit: TcxButtonEdit;
cbAllOrders: TcxCheckBox;
ManOrdersGridDBView: TcxGridDBTableView;
ManOrdersGridDBViewDBColumn1: TcxGridDBColumn;
ManOrdersGridDBViewDBColumn2: TcxGridDBColumn;
ManOrdersGridDBViewDBColumn3: TcxGridDBColumn;
ManOrdersGridDBViewDBColumn4: TcxGridDBColumn;
ManOrdersGridDBViewDBColumn5: TcxGridDBColumn;
ManOrdersGridDBViewDBColumn6: TcxGridDBColumn;
ManOrdersGridDBViewDBColumn7: TcxGridDBColumn;
StyleRepository: TcxStyleRepository;
stBackground: TcxStyle;
stContent: TcxStyle;
stContentEven: TcxStyle;
stContentOdd: TcxStyle;
stFilterBox: TcxStyle;
stFooter: TcxStyle;
stGroup: TcxStyle;
stGroupByBox: TcxStyle;
stHeader: TcxStyle;
stInactive: TcxStyle;
stIncSearch: TcxStyle;
stIndicator: TcxStyle;
stPreview: TcxStyle;
stSelection: TcxStyle;
stHotTrack: TcxStyle;
qizzStyle: TcxGridTableViewStyleSheet;
procedure BonusGridDBTableView1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ReportDataViewKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure LevelEditPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure ReportDataViewDblClick(Sender: TObject);
procedure cbLevelsPropertiesChange(Sender: TObject);
procedure cbAllOrdersPropertiesChange(Sender: TObject);
procedure ManOrdersGridDBViewKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
id_level:Integer;
public
id_pcard:integer;
constructor Create(AOwner: TComponent; DbHandle:TISC_DB_HANDLE ;Id_PC: Integer; modify :integer; ActualDate: TDate); reintroduce;
end;
implementation
uses Registry, UpKernelUnit, uUnivSprav, RxmemDs;
{$R *.dfm}
constructor TfmManOrdersPage.Create(AOwner: TComponent;DbHandle:TISC_DB_HANDLE; Id_PC: Integer; modify :integer; ActualDate: TDate);
var D,M,Y,Hour, Min, Sec, MSec :Word;
DefLevelInfoDS:TpFIBDataSet;
begin
inherited Create(AOwner);
DecodeDate(Date,Y,M,D);
DecodeTime(Time,Hour, Min, Sec, MSec);
self.Name:=self.Name+IntToStr(Y)+IntToStr(M)+IntToStr(D)+IntToStr(Hour)+IntToStr(Min)+IntToStr(Sec);
self.WorkDatabase.Handle:=DbHandle;
ReadTransaction.StartTransaction;
DefLevelInfoDS:=TpFIBDataSet.Create(self);
DefLevelInfoDS.Database:=WorkDatabase;
DefLevelInfoDS.Transaction:=ReadTransaction;
DefLevelInfoDS.SelectSQL.Text:='SELECT * FROM UP_KER_UTIL_GET_DEF_LEVEL';
DefLevelInfoDS.Open;
if (DefLevelInfoDS.RecordCount>0)
then begin
LevelEdit.Text:=DefLevelInfoDS.FieldByName('LEVEL_NAME').AsString;
id_level:=DefLevelInfoDS.FieldByName('ID_LEVEL').Value;
end;
DefLevelInfoDS.Close;
DefLevelInfoDS.Free;
id_pcard:=Id_PC;
DSetManOrders.ParamByName('Id_PCard').AsInteger := Id_PCard;
if cbLevels.Checked
then DSetManOrders.ParamByName('Id_level').Value := id_level
else DSetManOrders.ParamByName('Id_level').Value := null;
if cbAllOrders.Checked
then DSetManOrders.ParamByName('show_all').Value := 1
else DSetManOrders.ParamByName('show_all').Value := 0;
DSetManOrders.Open;
ManOrdersGridDBView.ViewData.Expand(True);
end;
procedure TfmManOrdersPage.BonusGridDBTableView1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if (( Key = VK_F12) and (ssShift in Shift))
then ShowInfo(DSetManOrders);
end;
procedure TfmManOrdersPage.ReportDataViewKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if (( Key = VK_F12) and (ssShift in Shift))
then begin
ShowInfo(DSetManOrders);
end;
end;
procedure TfmManOrdersPage.LevelEditPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
var
Params:TUnivParams;
OutPut : TRxMemoryData;
begin
Params.FormCaption:='Довідник рівнів актуальності';
Params.ShowMode:=fsmSelect;
Params.ShowButtons:=[fbExit];
Params.TableName:='UP_SYS_LEVEL';
Params.Fields:='LEVEL_ORDER,LEVEL_NAME,ID_LEVEL';
Params.FieldsName:='Порядок,Назва';
Params.KeyField:='ID_LEVEL';
Params.ReturnFields:='LEVEL_ORDER,LEVEL_NAME,ID_LEVEL';
Params.DBHandle:=Integer(WorkDatabase.Handle);
OutPut:=TRxMemoryData.Create(self);
if GetUnivSprav(Params,OutPut)
then begin
id_level:=output['ID_LEVEL'];
LevelEdit.Text:=VarToStr(output['LEVEL_NAME']);
Screen.Cursor:=crHourGlass;
if DSetManOrders.Active then DSetManOrders.Close;
if cbLevels.Checked
then DSetManOrders.ParamByName('Id_level').Value := id_level
else DSetManOrders.ParamByName('Id_level').Value := null;
if cbAllOrders.Checked
then DSetManOrders.ParamByName('show_all').Value := 1
else DSetManOrders.ParamByName('show_all').Value := 0;
DSetManOrders.Open;
ManOrdersGridDBView.ViewData.Expand(True);
Screen.Cursor:=crDefault;
end;
end;
procedure TfmManOrdersPage.ReportDataViewDblClick(Sender: TObject);
begin
if (DSetManOrders.RecordCount>0)
then begin
end;
end;
procedure TfmManOrdersPage.cbLevelsPropertiesChange(Sender: TObject);
begin
LevelEdit.Enabled:=cbLevels.Checked;
Screen.Cursor:=crHourGlass;
if DSetManOrders.Active then DSetManOrders.Close;
if cbLevels.Checked
then DSetManOrders.ParamByName('Id_level').Value := id_level
else DSetManOrders.ParamByName('Id_level').Value := null;
if cbAllOrders.Checked
then DSetManOrders.ParamByName('show_all').Value := 1
else DSetManOrders.ParamByName('show_all').Value := 0;
DSetManOrders.Open;
ManOrdersGridDBView.ViewData.Expand(True);
Screen.Cursor:=crDefault;
end;
procedure TfmManOrdersPage.cbAllOrdersPropertiesChange(Sender: TObject);
begin
Screen.Cursor:=crHourGlass;
if DSetManOrders.Active then DSetManOrders.Close;
if cbLevels.Checked
then DSetManOrders.ParamByName('Id_level').Value := id_level
else DSetManOrders.ParamByName('Id_level').Value := null;
if cbAllOrders.Checked
then DSetManOrders.ParamByName('show_all').Value := 1
else DSetManOrders.ParamByName('show_all').Value := 0;
DSetManOrders.Open;
ManOrdersGridDBView.ViewData.Expand(True);
Screen.Cursor:=crDefault;
end;
procedure TfmManOrdersPage.ManOrdersGridDBViewKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if ((Chr(Key)='+') and (ssCtrl in Shift)) then ManOrdersGridDBView.ViewData.Expand(True);
if ((Chr(Key)='-') and (ssCtrl in Shift)) then ManOrdersGridDBView.ViewData.Expand(False);
end;
end.
|
Unit IRPRequest;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
Interface
Uses
Windows,
IRPMonRequest, IRPMonDll;
Type
TIRPRequest = Class (TDriverRequest)
Private
FArgs : TIRPArguments;
FIRPAddress : Pointer;
FMajorFunction : Byte;
FMinorFunction : Byte;
FPreviousMode : Byte;
FRequestorMode : Byte;
FIRPFlags : Cardinal;
FProcessId : THandle;
FThreadId : THandle;
FRequestorProcessId : NativeUInt;
Public
Constructor Create(Var ARequest:REQUEST_IRP); Overload;
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValueRaw(AColumnType:ERequestListModelColumnType; Var AValue:Pointer; Var AValueSize:Cardinal):Boolean; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
Class Function PowerStateTypeToString(AType:Cardinal):WideString;
Class Function PowerStateToString(AType:Cardinal; AState:Cardinal):WideString;
Class Function ShutdownTypeToString(AType:Cardinal):WideString;
Class Function BusQueryIdTypeToString(AType:BUS_QUERY_ID_TYPE):WideString;
Class Function DeviceTextTypeToString(AType:DEVICE_TEXT_TYPE):WideString;
Class Function DeviceRelationTypeToString(AType:DEVICE_RELATION_TYPE):WideString;
Class Function SecurityInformationToString(AInfo:Cardinal):WideString;
Class Function CreateOptionsToString(AOptions:Cardinal):WideString;
Class Function ShareAccessToString(AAccess:Cardinal):WideString;
Class Function Build(Var ARequest:REQUEST_IRP):TIRPRequest;
Property Args : TIRPArguments Read FArgs;
Property Address : Pointer Read FIRPAddress;
Property MajorFunction : Byte Read FMajorFunction;
Property MinorFunction : Byte Read FMinorFunction;
Property RequestorMode : Byte Read FRequestorMode;
Property PreviousMode : Byte Read FPreviousMode;
Property IRPFlags : Cardinal Read FIRPFlags;
Property ProcessId : THandle Read FProcessId;
Property ThreadId : THandle Read FThreadId;
Property RequestorProcessId : NativeUInt Read FRequestorProcessId;
end;
TZeroArgIRPRequest = Class (TIRPRequest)
Public
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TCreateRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TCreatePipeRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TCreateMailslotRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TDeviceControlRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TFileSystemControlRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TReadWriteRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQuerySetRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
Class Function InformationClassToString(AClass:Cardinal):WideString;
end;
TQuerySetVolumeRequest = Class (TIRPRequest)
Public
Class Function InformationClassToString(AInfoClass:Cardinal):WideString;
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQuerySecurityRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TSetSecurityRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TCloseCleanupRequest = Class (TIRPRequest)
Public
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
(** IRP_MJ_POWER **)
TWaitWakeRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TPowerSequenceRequest = Class (TIRPRequest)
Public
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQuerySetPowerRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
(** IRP_MJ_PNP **)
TQueryIdRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQueryDeviceTextRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQueryDeviceRelationsRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQueryDeviceCapabilitiesRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQueryInterfaceRequest = Class (TIRPRequest)
Public
Function GetColumnName(AColumnType:ERequestListModelColumnType):WideString; Override;
Function GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean; Override;
end;
TQueryDeviceStateRequest = Class (TZeroArgIRPRequest);
TStartDeviceRequest = Class (TZeroArgIRPRequest);
TEnumeratedDeviceRequest = Class (TZeroArgIRPRequest);
TRemoveDeviceRequest = Class (TZeroArgIRPRequest);
TQueryRemoveDeviceRequest = Class (TZeroArgIRPRequest);
TCancelRemoveDeviceRequest = Class (TZeroArgIRPRequest);
TSurpriseDeviceRequest = Class (TZeroArgIRPRequest);
TstopDeviceRequest = Class (TZeroArgIRPRequest);
TQueryStopDeviceRequest = Class (TZeroArgIRPRequest);
TCancelStopDeviceRequest = Class (TZeroArgIRPRequest);
TEjectDeviceRequest = Class (TZeroArgIRPRequest);
Implementation
Uses
SysUtils,
NameTables;
(** TIRPRequest **)
Constructor TIRPRequest.Create(Var ARequest:REQUEST_IRP);
Var
d : Pointer;
begin
Inherited Create(ARequest.Header);
d := PByte(@ARequest) + SizeOf(ARequest);
AssignData(d, ARequest.DataSize);
FMajorFunction := ARequest.MajorFunction;
FMinorFunction := ARequest.MinorFunction;
FPreviousMode := ARequest.PreviousMode;
FRequestorMode := ARequest.RequestorMode;
FIRPAddress := ARequest.IRPAddress;
FIRPFlags := ARequest.IrpFlags;
SetFileObject(ARequest.FileObject);
FArgs := ARequest.Args;
FRequestorProcessId := ARequest.RequestorProcessId;
end;
Function TIRPRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
case AColumnType of
rlmctSubType: Result := 'Major function';
rlmctMinorFunction: Result := 'Minor function';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
Function TIRPRequest.GetColumnValueRaw(AColumnType:ERequestListModelColumnType; Var AValue:Pointer; Var AValueSize:Cardinal):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctSubType: begin
AValue := @FMajorFunction;
AValueSize := SizeOf(FMajorFunction);
end;
rlmctMinorFunction: begin
AValue := @FMinorFunction;
AValueSize := SizeOf(FMinorFunction);
end;
rlmctIRPAddress: begin
AValue := @FIRPAddress;
AValueSize := SizeOf(FIRPAddress);
end;
rlmctIRPFlags: begin
AValue := @FIRPFlags;
AValueSize := SizeOf(FIRPFlags);
end;
rlmctArg1: begin
AValue := @FArgs.Other.Arg1;
AValueSize := SizeOf(FArgs.Other.Arg1);
end;
rlmctArg2: begin
AValue := @FArgs.Other.Arg2;
AValueSize := SizeOf(FArgs.Other.Arg2);
end;
rlmctArg3: begin
AValue := @FArgs.Other.Arg3;
AValueSize := SizeOf(FArgs.Other.Arg3);
end;
rlmctArg4: begin
AValue := @FArgs.Other.Arg4;
AValueSize := SizeOf(FArgs.Other.Arg4);
end;
rlmctPreviousMode: begin
AValue := @FPreviousMode;
AValueSize := SizeOf(FPreviousMode);
end;
rlmctRequestorMode: begin
AValue := @FRequestorMode;
AValueSize := SizeOf(FRequestorMode);
end;
rlmctRequestorPID: begin
AValue := @FRequestorProcessId;
AValueSize := SizeOf(FRequestorProcessId);
end;
Else Result := Inherited GetColumnValueRaw(AColumnType, AValue, AValueSize);
end;
end;
Function TIRPRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctRequestorPID : AResult := Format('%d', [FRequestorProcessId]);
rlmctSubType: AResult := Format('%s', [MajorFunctionToString(FMajorFunction)]);
rlmctMinorFunction: AResult := Format('%s', [MinorFunctionToString(FMajorFunction, FMinorFunction)]);
rlmctIRPAddress: AResult := Format('0x%p', [FIRPAddress]);
rlmctIRPFlags: AResult := Format('0x%x', [FIRPFlags]);
rlmctArg1: AResult := Format('0x%p', [FArgs.Other.Arg1]);
rlmctArg2: AResult := Format('0x%p', [FArgs.Other.Arg2]);
rlmctArg3: AResult := Format('0x%p', [FArgs.Other.Arg3]);
rlmctArg4: AResult := Format('0x%p', [FArgs.Other.Arg4]);
rlmctPreviousMode: AResult := AccessModeToString(FPreviousMode);
rlmctRequestorMode: AResult := AccessModeToString(FRequestorMode);
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Class Function TIRPRequest.PowerStateTypeToString(AType:Cardinal):WideString;
begin
Case AType Of
0 : Result := 'System';
1 : Result := 'Device';
Else Result := Format('%u', [AType]);
end;
end;
Class Function TIRPRequest.PowerStateToString(AType:Cardinal; AState:Cardinal):WideString;
begin
Result := Format('%u', [AState]);
If AType = 0 Then
begin
Case AState Of
0 : Result := 'PowerSystemUnspecified';
1 : Result := 'PowerSystemWorking';
2 : Result := 'PowerSystemSleeping1';
3 : Result := 'PowerSystemSleeping2';
4 : Result := 'PowerSystemSleeping3';
5 : Result := 'PowerSystemHibernate';
6 : Result := 'PowerSystemShutdown';
7 : Result := 'PowerSystemMaximum';
end;
end
Else If AType = 1 Then
begin
Case AState Of
0 : Result := 'PowerDeviceUnspecified';
1 : Result := 'PowerDeviceD0';
2 : Result := 'PowerDeviceD1';
3 : Result := 'PowerDeviceD2';
4 : Result := 'PowerDeviceD3';
end;
end;
end;
Class Function TIRPRequest.ShutdownTypeToString(AType:Cardinal):WideString;
begin
Case AType Of
0 : Result := 'PowerActionNone';
1 : Result := ' PowerActionReserved';
2 : Result := ' PowerActionSleep';
3 : Result := ' PowerActionHibernate';
4 : Result := ' PowerActionShutdown';
5 : Result := ' PowerActionShutdownReset';
6 : Result := ' PowerActionShutdownOff';
7 : Result := ' PowerActionWarmEject';
end;
end;
Class Function TIRPRequest.BusQueryIdTypeToString(AType:BUS_QUERY_ID_TYPE):WideString;
begin
Case AType Of
BusQueryDeviceID: Result := 'DeviceID';
BusQueryHardwareIDs: Result := 'HardwareIDs';
BusQueryCompatibleIDs: Result := 'CompatibleIDs';
BusQueryInstanceID: Result := 'InstanceID';
BusQueryDeviceSerialNumber: Result := 'SerialNumber';
BusQueryContainerID: Result := 'ContainerID';
Else Result := Format('<unknown (%u)>', [Ord(AType)]);
End;
end;
Class Function TIRPRequest.DeviceTextTypeToString(AType:DEVICE_TEXT_TYPE):WideString;
begin
Case AType Of
DeviceTextDescription: Result := 'Description';
DeviceTextLocationInformation: Result := 'Location';
Else Result := Format('<unknown (%u)>', [Ord(AType)]);
end;
end;
Class Function TIRPRequest.DeviceRelationTypeToString(AType:DEVICE_RELATION_TYPE):WideString;
begin
Case AType Of
BusRelations: Result := 'Bus';
EjectionRelations: Result := 'Ejection';
PowerRelations: Result := 'Power';
RemovalRelations: Result := 'Removal';
TargetDeviceRelation: Result := 'Target';
SingleBusRelations: Result := 'SingleBus';
TransportRelations: Result := 'Transport';
Else Result := Format('<unknown (%u)>', [Ord(AType)]);
end;
end;
Class Function TIRPRequest.SecurityInformationToString(AInfo:Cardinal):WideString;
begin
Result := '';
If ((AInfo And OWNER_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' Owner';
If ((AInfo And GROUP_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' Group';
If ((AInfo And DACL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' Dacl';
If ((AInfo And SACL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' Sacl';
If ((AInfo And LABEL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' Label';
If ((AInfo And ATTRIBUTE_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' Attribute';
If ((AInfo And SCOPE_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' Scope';
If ((AInfo And PROCESS_TRUST_LABEL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' ProcessTrust';
If ((AInfo And ACCESS_FILTER_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' AccessFilter';
If ((AInfo And PROTECTED_DACL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' ProtectedDaclt';
If ((AInfo And PROTECTED_SACL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' ProtectedSacl';
If ((AInfo And UNPROTECTED_DACL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' UnprotectedDaclt';
If ((AInfo And UNPROTECTED_SACL_SECURITY_INFORMATION) <> 0) Then
Result := Result + ' UnprotectedSacl';
If Result <> '' Then
Delete(Result, 1, 1);
end;
Class Function TIRPRequest.CreateOptionsToString(AOptions:Cardinal):WideString;
Var
disp : Cardinal;
opt : Cardinal;
begin
Result := '';
opt := (AOptions And $FFFFFF);
disp := (AOptions Shr 24);
Case disp Of
FILE_SUPERSEDE : Result := 'Supersede';
FILE_CREATE : Result := 'Create';
FILE_OPEN : Result := 'Open';
FILE_OPEN_IF : Result := 'OpenIf';
FILE_OVERWRITE : Result := 'Overwrite';
FILE_OVERWRITE_IF : Result := 'OverwriteIf';
end;
If ((opt And FILE_DIRECTORY_FILE) <> 0) THen
Result := Result + ' Directory';
If ((opt And FILE_WRITE_THROUGH) <> 0) THen
Result := Result + ' WriteThrough';
If ((opt And FILE_SEQUENTIAL_ONLY) <> 0) THen
Result := Result + ' Sequential';
If ((opt And FILE_NO_INTERMEDIATE_BUFFERING) <> 0) THen
Result := Result + ' NoBuffering';
If ((opt And FILE_SYNCHRONOUS_IO_ALERT) <> 0) THen
Result := Result + ' SynchronousAlert';
If ((opt And FILE_SYNCHRONOUS_IO_NONALERT) <> 0) THen
Result := Result + ' SynchronousNoAlert';
If ((opt And FILE_NON_DIRECTORY_FILE) <> 0) THen
Result := Result + ' NonDirectory';
If ((opt And FILE_CREATE_TREE_CONNECTION) <> 0) THen
Result := Result + ' TreeConnection';
If ((opt And FILE_COMPLETE_IF_OPLOCKED) <> 0) THen
Result := Result + ' CompleteOplocked';
If ((opt And FILE_NO_EA_KNOWLEDGE) <> 0) THen
Result := Result + ' NoEAKnowledge';
If ((opt And FILE_OPEN_REMOTE_INSTANCE) <> 0) THen
Result := Result + ' RemoteInstance';
If ((opt And FILE_RANDOM_ACCESS) <> 0) THen
Result := Result + ' RandomAccess';
If ((opt And FILE_DELETE_ON_CLOSE) <> 0) THen
Result := Result + ' DeleteOnClose';
If ((opt And FILE_OPEN_BY_FILE_ID) <> 0) THen
Result := Result + ' FileId';
If ((opt And FILE_OPEN_FOR_BACKUP_INTENT) <> 0) THen
Result := Result + ' Backup';
If ((opt And FILE_NO_COMPRESSION) <> 0) THen
Result := Result + ' NoCompression';
If ((opt And FILE_OPEN_REQUIRING_OPLOCK) <> 0) THen
Result := Result + ' RequireOplock';
If ((opt And FILE_DISALLOW_EXCLUSIVE) <> 0) THen
Result := Result + ' DisallowExclusive';
If ((opt And FILE_SESSION_AWARE) <> 0) THen
Result := Result + ' SessionAware';
If ((opt And FILE_RESERVE_OPFILTER) <> 0) THen
Result := Result + ' ReserveOpFilter';
If ((opt And FILE_OPEN_REPARSE_POINT) <> 0) THen
Result := Result + ' ReparsePoint';
If ((opt And FILE_OPEN_NO_RECALL) <> 0) THen
Result := Result + ' NoRecall';
If ((opt And FILE_OPEN_FOR_FREE_SPACE_QUERY) <> 0) THen
Result := Result + ' FreeSpaceQuery';
end;
Class Function TIRPRequest.ShareAccessToString(AAccess:Cardinal):WideString;
begin
Result := '';
If ((AAccess And FILE_SHARE_READ) <> 0) Then
Result := Result + ' Read';
If ((AAccess And FILE_SHARE_WRITE) <> 0) Then
Result := Result + ' Write';
If ((AAccess And FILE_SHARE_DELETE) <> 0) Then
Result := Result + ' Delete';
If Result <> '' Then
Delete(Result, 1, 1);
end;
Class Function TIRPRequest.Build(Var ARequest:REQUEST_IRP):TIRPRequest;
begin
Result := Nil;
Case ARequest.MajorFunction Of
0 : Result := TCreateRequest.Create(ARequest);
1 : Result := TCreatePipeRequest.Create(ARequest);
2, 18 : Result := TCloseCleanupRequest.Create(ARequest);
3, 4 : Result := TReadWriteRequest.Create(ARequest);
5, 6 : Result := TQuerySetRequest.Create(ARequest);
10, 11 : Result := TQuerySetVolumeRequest.Create(ARequest);
12 : ; // DirectoryControl
13 : Result := TFileSystemControlRequest.Create(ARequest);
14, 15 : Result := TDeviceControlRequest.Create(ARequest);
19 : Result := TCreateMailslotRequest.Create(ARequest);
20 : Result := TQuerySecurityRequest.Create(ARequest);
21 : Result := TSetSecurityRequest.Create(ARequest);
22 : begin
Case ARequest.MinorFunction Of
0 : Result := TWaitWakeRequest.Create(ARequest);
1 : Result := TPowerSequenceRequest.Create(ARequest);
2, 3 : Result := TQuerySetPowerRequest.Create(ARequest);
end;
end;
27 : begin // PnP
Case ARequest.MinorFunction Of
$0 : Result := TStartDeviceRequest.Create(ARequest);
$1 : Result := TQueryRemoveDeviceRequest.Create(ARequest);
$2 : Result := TRemoveDeviceRequest.Create(ARequest);
$3 : Result := TCancelRemoveDeviceRequest.Create(ARequest);
$4 : Result := TStopDeviceRequest.Create(ARequest);
$5 : Result := TQueryStopDeviceRequest.Create(ARequest);
$6 : Result := TCancelStopDeviceRequest.Create(ARequest);
$7 : Result := TQueryDeviceRelationsRequest.Create(ARequest);
$8 : Result := TQueryInterfaceRequest.Create(ARequest);
$9 : Result := TQueryDeviceCapabilitiesRequest.Create(ARequest);
$C : Result := TQueryDeviceTextRequest.Create(ARequest);
$11 : Result := TEjectDeviceRequest.Create(ARequest);
$13 : Result := TQueryIdRequest.Create(ARequest);
$14 : Result := TQueryDeviceStateRequest.Create(ARequest);
$17 : Result := TSurpriseDeviceRequest.Create(ARequest);
$19 : Result := TEnumeratedDeviceRequest.Create(ARequest);
end;
end;
end;
If Not Assigned(Result) Then
Result := TIRPRequest.Create(ARequest);
end;
(** TZeroArgIRPRequest **)
Function TZeroArgIRPRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Case AColumnType Of
rlmctArg1,
rlmctArg2,
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
(** TCreateRequest **)
Function TCreateRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('0x%p', [FArgs.Create.SecurityContext]);
rlmctArg2: AResult := CreateOptionsToString(FArgs.Create.Options);
rlmctArg3: AResult := ShareAccessToString(FArgs.Create.ShareAccess);
rlmctArg4: AResult := Format('%u', [FArgs.Create.EaLength]);
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TCreateRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Security context';
rlmctArg2 : Result := 'Options';
rlmctArg3 : Result := 'Access and attributes';
rlmctArg4 : Result := 'EA length';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TCreatePipeRequest **)
Function TCreatePipeRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('0x%p', [FArgs.Create.SecurityContext]);
rlmctArg2: AResult := CreateOptionsToString(FArgs.Create.Options);
rlmctArg3: AResult := ShareAccessToString(FArgs.Create.ShareAccess);
rlmctArg4: Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TCreatePipeRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Security context';
rlmctArg2 : Result := 'Options';
rlmctArg3 : Result := 'Access and attributes';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TCreateMailslotRequest **)
Function TCreateMailslotRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('0x%p', [FArgs.Create.SecurityContext]);
rlmctArg2: AResult := CreateOptionsToString(FArgs.Create.Options);
rlmctArg3: AResult := ShareAccessToString(FArgs.Create.ShareAccess);
rlmctArg4: Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TCreateMailslotRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Security context';
rlmctArg2 : Result := 'Options';
rlmctArg3 : Result := 'Access and attributes';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TDeviceControlRequest **)
Function TDeviceControlRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('%u', [FArgs.DeviceControl.OutputBufferLength]);
rlmctArg2: AResult := Format('%u', [FArgs.DeviceControl.InputBufferLength]);
rlmctArg3: AResult := IOCTLToString(FArgs.DeviceControl.IoControlCode);
rlmctArg4: AResult := Format('0x%p', [FArgs.DeviceControl.Type3InputBuffer]);
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TDeviceControlRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Output length';
rlmctArg2 : Result := 'Input length';
rlmctArg3 : Result := 'IOCTL';
rlmctArg4 : Result := 'Type3 input';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TFileSystemControlRequest **)
Function TFileSystemControlRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('%u', [FArgs.DeviceControl.OutputBufferLength]);
rlmctArg2: AResult := Format('%u', [FArgs.DeviceControl.InputBufferLength]);
rlmctArg3: AResult := IOCTLToString(FArgs.DeviceControl.IoControlCode);
rlmctArg4: AResult := Format('0x%p', [FArgs.DeviceControl.Type3InputBuffer]);
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TFileSystemControlRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Output length';
rlmctArg2 : Result := 'Input length';
rlmctArg3 : Result := 'FSCTL';
rlmctArg4 : Result := 'Type3 input';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TReadWriteRequest **)
Function TReadWriteRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('%u', [FArgs.ReadWrite.Length]);
rlmctArg2: AResult := Format('0x%x', [FArgs.ReadWrite.Key]);
rlmctArg3: AResult := Format('0x%x', [FArgs.ReadWrite.ByteOffset]);
rlmctArg4: Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TReadWriteRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Length';
rlmctArg2 : Result := 'Key';
rlmctArg3 : Result := 'Offset';
rlmctArg4 : Result := '';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TQuerySetRequest **)
Class Function TQuerySetRequest.InformationClassToString(AClass:Cardinal):WideString;
begin
Result := '';
If AClass < 76 Then
Result := FIleInformationClassArray[AClass]
Else Format('%u', [AClass]);
end;
Function TQuerySetRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('%u', [FArgs.QuerySetInformation.Lenth]);
rlmctArg2: AResult := InformationClassToString(FArgs.QuerySetInformation.FileInformationClass);
rlmctArg3,
rlmctArg4: Result := False
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TQuerySetRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Length';
rlmctArg2 : Result := 'Information class';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TQuerySetVolumeRequest **)
Class Function TQuerySetVolumeRequest.InformationClassToString(AInfoClass:Cardinal):WideString;
begin
Case AInfoClass Of
1 : Result := 'FileFsVolumeInformation';
2 : Result := 'FileFsLabelInformation';
3 : Result := 'FileFsSizeInformation';
4 : Result := 'FileFsDeviceInformation';
5 : Result := 'FileFsAttributeInformation';
6 : Result := 'FileFsControlInformation';
7 : Result := 'FileFsFullSizeInformation';
8 : Result := 'FileFsObjectIdInformation';
9 : Result := 'FileFsDriverPathInformation';
10 : Result := 'FileFsVolumeFlagsInformation';
11 : Result := 'FileFsSectorSizeInformation';
12 : Result := 'FileFsDataCopyInformation';
13 : Result := 'FileFsMetadataSizeInformation';
Else Result := Format('%u', [AInfoClass]);
end;
end;
Function TQuerySetVolumeRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := Format('%u', [FArgs.QuerySetInformation.Lenth]);
rlmctArg2: AResult := InformationClassToString(Args.QuerySetVolume.FileInformationClass);
rlmctArg3,
rlmctArg4: Result := False
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TQuerySetVolumeRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Length';
rlmctArg2 : Result := 'Information class';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TQuerySecurityRequest **)
Function TQuerySecurityRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := SecurityInformationToString(FArgs.QuerySecurity.SecurityInformation);
rlmctArg2: AResult := Format('%u', [FArgs.QuerySecurity.Length]);
rlmctArg3,
rlmctArg4: Result := False
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TQuerySecurityRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Security information';
rlmctArg2 : Result := 'Length';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TSetSecurityRequest **)
Function TSetSecurityRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1: AResult := SecurityInformationToString(FArgs.SetSecurity.SecurityInformation);
rlmctArg2: AResult := Format('0x%p', [FArgs.SetSecurity.SecurityDescriptor]);
rlmctArg3,
rlmctArg4: Result := False
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TSetSecurityRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Security information';
rlmctArg2 : Result := 'Descriptor';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TWaitWakeRequest **)
Function TWaitWakeRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1 : AResult := PowerStateToString(1, FArgs.WaitWake.PowerState);
rlmctArg2,
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TWaitWakeRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Power state';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TPowerSequenceRequest **)
Function TPowerSequenceRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Case AColumnType Of
rlmctArg1,
rlmctArg2,
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
(** TQuerySetPowerRequest **)
Function TQuerySetPowerRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1 : AResult := Format('%u', [FArgs.QuerySetPower.SystemContext]);
rlmctArg2 : AResult := PowerStateTypeToString(FArgs.QuerySetPower.PowerStateType);
rlmctArg3 : AResult := PowerStateToString(FArgs.QuerySetPower.PowerStateType, FArgs.QuerySetPower.PowerState);
rlmctArg4 : AResult := ShutdownTypeToString(FArgs.QuerySetPower.ShutdownType);
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TQuerySetPowerRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'System context';
rlmctArg2 : Result := 'Power state type';
rlmctArg3 : Result := 'Power state';
rlmctArg4 : Result := 'Shutdown type';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TCloseCleanupRequest **)
Function TCloseCleanupRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Case AColumnType Of
rlmctArg1,
rlmctArg2,
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
(** TQueryIdRequest **)
Function TQueryIdRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1 : AResult := BusQueryIdTypeToString(FArgs.QueryId.IdType);
rlmctArg2,
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TQueryIdRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'ID type';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TQueryDeviceRelationsRequest **)
Function TQueryDeviceRelationsRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1 : AResult := DeviceRelationTypeToString(FArgs.QueryDeviceRelations.DeviceRelationType);
rlmctArg2,
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TQueryDeviceRelationsRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Relation type';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TQueryDeviceTextRequest **)
Function TQueryDeviceTextRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1 : AResult := DeviceTextTypeToString(FArgs.QueryText.TextType);
rlmctArg2 : AResult := Format('%u', [FArgs.QueryText.LocaleId]);
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
Function TQueryDeviceTextRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Text type';
rlmctArg2 : Result := 'Locale';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
(** TQueryDeviceCapabilitiesRequest **)
Function TQueryDeviceCapabilitiesRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Capabilities';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
Function TQueryDeviceCapabilitiesRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1 : AResult := Format('0x%p', [FArgs.QueryCapabilities.Capabilities]);
rlmctArg2,
rlmctArg3,
rlmctArg4 : Result := False;
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
(** TQueryInterfaceRequest **)
Function TQueryInterfaceRequest.GetColumnName(AColumnType:ERequestListModelColumnType):WideString;
begin
Case AColumnType Of
rlmctArg1 : Result := 'Interface type';
rlmctArg2 : Result := 'Size | Version';
rlmctArg3 : Result := 'Routines';
rlmctArg4 : Result := 'Specific';
Else Result := Inherited GetColumnName(AColumnType);
end;
end;
Function TQueryInterfaceRequest.GetColumnValue(AColumnType:ERequestListModelColumnType; Var AResult:WideString):Boolean;
begin
Result := True;
Case AColumnType Of
rlmctArg1 : AResult := Format('0x%p', [FArgs.QueryInterface.InterfaceType]);
rlmctArg2 : AResult := Format('%u | %u', [FArgs.QueryInterface.Size, FArgs.QueryInterface.Version]);
rlmctArg3 : AResult := Format('0x%p', [FArgs.QueryInterface.InterfaceRoutines]);
rlmctArg4 : AResult := Format('0x%p', [FArgs.QueryInterface.InterfaceSpecificData]);
Else Result := Inherited GetColumnValue(AColumnType, AResult);
end;
end;
End.
|
namespace WinFormsApplication;
interface
{$HIDE H8}
uses
System.Drawing,
System.Collections,
System.Windows.Forms,
System.ComponentModel;
type
MainForm = partial class
{$REGION Windows Form Designer generated fields}
private
components: System.ComponentModel.IContainer;
notifyIcon: System.Windows.Forms.NotifyIcon;
aboutToolStripMenuItem: System.Windows.Forms.ToolStripMenuItem;
helpToolStripMenuItem: System.Windows.Forms.ToolStripMenuItem;
quitToolStripMenuItem1: System.Windows.Forms.ToolStripMenuItem;
fileToolStripMenuItem: System.Windows.Forms.ToolStripMenuItem;
menuStrip1: System.Windows.Forms.MenuStrip;
quitToolStripMenuItem: System.Windows.Forms.ToolStripMenuItem;
contextMenuStrip1: System.Windows.Forms.ContextMenuStrip;
treeView: System.Windows.Forms.TreeView;
openToolStripMenuItem: System.Windows.Forms.ToolStripMenuItem;
openFileDialog: System.Windows.Forms.OpenFileDialog;
method InitializeComponent;
{$ENDREGION}
end;
implementation
{$REGION Windows Form Designer generated code}
method MainForm.InitializeComponent;
begin
self.components := new System.ComponentModel.Container();
var resources: System.ComponentModel.ComponentResourceManager := new System.ComponentModel.ComponentResourceManager(typeOf(MainForm));
self.notifyIcon := new System.Windows.Forms.NotifyIcon(self.components);
self.contextMenuStrip1 := new System.Windows.Forms.ContextMenuStrip(self.components);
self.quitToolStripMenuItem := new System.Windows.Forms.ToolStripMenuItem();
self.menuStrip1 := new System.Windows.Forms.MenuStrip();
self.fileToolStripMenuItem := new System.Windows.Forms.ToolStripMenuItem();
self.openToolStripMenuItem := new System.Windows.Forms.ToolStripMenuItem();
self.quitToolStripMenuItem1 := new System.Windows.Forms.ToolStripMenuItem();
self.helpToolStripMenuItem := new System.Windows.Forms.ToolStripMenuItem();
self.aboutToolStripMenuItem := new System.Windows.Forms.ToolStripMenuItem();
self.treeView := new System.Windows.Forms.TreeView();
self.openFileDialog := new System.Windows.Forms.OpenFileDialog();
self.contextMenuStrip1.SuspendLayout();
self.menuStrip1.SuspendLayout();
self.SuspendLayout();
//
// notifyIcon
//
self.notifyIcon.ContextMenuStrip := self.contextMenuStrip1;
self.notifyIcon.Text := 'TreeView Demo';
self.notifyIcon.Visible := true;
self.notifyIcon.Click += new System.EventHandler(@self.notifyIcon_Click);
//
// contextMenuStrip1
//
self.contextMenuStrip1.Items.AddRange(array of System.Windows.Forms.ToolStripItem([self.quitToolStripMenuItem]));
self.contextMenuStrip1.Name := 'contextMenuStrip1';
self.contextMenuStrip1.Size := new System.Drawing.Size(106, 26);
//
// quitToolStripMenuItem
//
self.quitToolStripMenuItem.Name := 'quitToolStripMenuItem';
self.quitToolStripMenuItem.Size := new System.Drawing.Size(105, 22);
self.quitToolStripMenuItem.Text := '&Quit';
self.quitToolStripMenuItem.Click += new System.EventHandler(@self.quitToolStripMenuItem1_Click);
//
// menuStrip1
//
self.menuStrip1.Items.AddRange(array of System.Windows.Forms.ToolStripItem([self.fileToolStripMenuItem,
self.helpToolStripMenuItem]));
self.menuStrip1.Location := new System.Drawing.Point(0, 0);
self.menuStrip1.Name := 'menuStrip1';
self.menuStrip1.Size := new System.Drawing.Size(371, 24);
self.menuStrip1.TabIndex := 1;
self.menuStrip1.Text := 'menuStrip1';
//
// fileToolStripMenuItem
//
self.fileToolStripMenuItem.DropDownItems.AddRange(array of System.Windows.Forms.ToolStripItem([self.openToolStripMenuItem,
self.quitToolStripMenuItem1]));
self.fileToolStripMenuItem.Name := 'fileToolStripMenuItem';
self.fileToolStripMenuItem.Size := new System.Drawing.Size(35, 20);
self.fileToolStripMenuItem.Text := '&File';
//
// openToolStripMenuItem
//
self.openToolStripMenuItem.Name := 'openToolStripMenuItem';
self.openToolStripMenuItem.Size := new System.Drawing.Size(123, 22);
self.openToolStripMenuItem.Text := '&Open...';
self.openToolStripMenuItem.Click += new System.EventHandler(@self.openToolStripMenuItem_Click);
//
// quitToolStripMenuItem1
//
self.quitToolStripMenuItem1.Name := 'quitToolStripMenuItem1';
self.quitToolStripMenuItem1.Size := new System.Drawing.Size(123, 22);
self.quitToolStripMenuItem1.Text := '&Quit';
self.quitToolStripMenuItem1.Click += new System.EventHandler(@self.quitToolStripMenuItem1_Click);
//
// helpToolStripMenuItem
//
self.helpToolStripMenuItem.DropDownItems.AddRange(array of System.Windows.Forms.ToolStripItem([self.aboutToolStripMenuItem]));
self.helpToolStripMenuItem.Name := 'helpToolStripMenuItem';
self.helpToolStripMenuItem.Size := new System.Drawing.Size(40, 20);
self.helpToolStripMenuItem.Text := '&Help';
//
// aboutToolStripMenuItem
//
self.aboutToolStripMenuItem.Name := 'aboutToolStripMenuItem';
self.aboutToolStripMenuItem.Size := new System.Drawing.Size(126, 22);
self.aboutToolStripMenuItem.Text := '&About...';
self.aboutToolStripMenuItem.Click += new System.EventHandler(@self.aboutToolStripMenuItem_Click);
//
// treeView
//
self.treeView.Dock := System.Windows.Forms.DockStyle.Fill;
self.treeView.Location := new System.Drawing.Point(0, 24);
self.treeView.Name := 'treeView';
self.treeView.Size := new System.Drawing.Size(371, 202);
self.treeView.TabIndex := 2;
//
// openFileDialog
//
self.openFileDialog.Filter := 'Managed assemblies (*.exe;*.dll)|*.exe;*.dll)';
//
// MainForm
//
self.ClientSize := new System.Drawing.Size(371, 226);
self.Controls.Add(self.treeView);
self.Controls.Add(self.menuStrip1);
self.Icon := (resources.GetObject('$this.Icon') as System.Drawing.Icon);
self.MainMenuStrip := self.menuStrip1;
self.Name := 'MainForm';
self.Text := 'Assembly enumerator';
self.Load += new System.EventHandler(@self.MainForm_Load);
self.contextMenuStrip1.ResumeLayout(false);
self.menuStrip1.ResumeLayout(false);
self.menuStrip1.PerformLayout();
self.ResumeLayout(false);
self.PerformLayout();
end;
{$ENDREGION}
end. |
{algo triangle_car
//BUT avoir un triangle en caractere
//ENTREE une hauteur de triangle
//SORTIE le triangle de 2 caractete
CONST
carcarmax=100 // la constante de la taille du triangle carmax
Type
tabchar = tableau[1..carcarmax,1..carcarmax] de caractere //mon tableau de caractere
Procedure iChar(Var tab1:tabchar)// nom de ma procedure plus paramètre
Var
taille,i,j:Entier //variable local
debut
ECRIRE('veuillez entré un taille de triangle')
LIRE (taille)
pour i de 1 a taille faire
pour j de 1 a taille faire
si i>=j alors
tab1[i,j]<-'O' // le tableau est remplie de O
fin si
si i=j ou i=taille ou j=1 alors
tab1[i,j]<-'X' // les extremites du triangle sont rempli de X
fin si
fin pour
fin pour
fin
Var
Tab2: tableau[1..carcarmax,1..carcarmax] de caractère
i,j,cpt:Entier
debut
iChar(Tab2) // appel de la procedure
fin.
}
Program Triangle_char;
uses crt;
CONST
carmax=100; // valeur max de mon triangle
Type
tabchar = Array [1..carmax,1..carmax] of Char; // tab de caractere
// PROCEDURE D'INITIALISATION DU TABLEAU DE CARACTERE
Procedure iChar(VAR tab1:tabchar);
VAR
taille,i,j:integer;
BEGIN
writeln('veuille saisir la taille du tab');
readln(taille);
For i:=1 to taille do
Begin
For j:=1 to taille do
Begin
If i>=j then
Begin
tab1[i,j]:='O'; //remplissage du tableau par des O
End;
If (i=j) OR (i=taille) OR (j=1) then
Begin
tab1[i,j]:='X'; // contour du tab par des X
End;
Write(tab1[i,j]);
End;
Writeln;
End;
END;
Var
tab2:Array[1..carmax,1..carmax] of Char;
i,j,compteur:integer;
BEGIN
clrscr;
iChar(tab2); // Appel de la première procedure
writeln;
readln;
END.
|
unit DatabasesSetup;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ImgList,
LMDCustomComponent, LMDBrowseDlg,
htDatabases;
type
TDatabasesSetupForm = class(TForm)
Panel3: TPanel;
Button1: TButton;
NewButton: TButton;
DeleteButton: TButton;
ImageList1: TImageList;
DatabaseList: TListView;
PropertiesButton: TButton;
procedure NewButtonClick(Sender: TObject);
procedure DatabaseListSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
procedure FormCreate(Sender: TObject);
procedure DatabaseListEdited(Sender: TObject; Item: TListItem;
var S: String);
procedure DeleteButtonClick(Sender: TObject);
procedure PropertiesButtonClick(Sender: TObject);
private
{ Private declarations }
Database: ThtDatabaseItem;
FDatabases: ThtDatabasesItem;
Item: TListItem;
protected
procedure SelectDatabase(inIndex: Integer);
procedure SetDatabases(const Value: ThtDatabasesItem);
procedure UpdateDatabaseList;
public
{ Public declarations }
property Databases: ThtDatabasesItem read FDatabases write SetDatabases;
end;
var
DatabasesSetupForm: TDatabasesSetupForm;
implementation
uses
DatabaseSetup;
{$R *.dfm}
procedure TDatabasesSetupForm.FormCreate(Sender: TObject);
begin
//
end;
procedure TDatabasesSetupForm.DatabaseListSelectItem(Sender: TObject;
Item: TListItem; Selected: Boolean);
begin
if Selected then
SelectDatabase(Item.Index);
end;
procedure TDatabasesSetupForm.UpdateDatabaseList;
var
i, s: Integer;
begin
with DatabaseList do
begin
Items.BeginUpdate;
try
if Selected <> nil then
s := Selected.Index
else
s := 0;
Clear;
for i := 0 to Pred(Databases.Count) do
with Items.Add, Databases[i] do
Caption := DisplayName;
if Items.Count > s then
Selected := Items[s]
else if Items.Count > 0 then
Selected := Items[0];
finally
Items.EndUpdate;
end;
PropertiesButton.Enabled := (Items.Count > 0);
end;
end;
procedure TDatabasesSetupForm.NewButtonClick(Sender: TObject);
begin
Database := ThtDatabaseItem.Create;
Database.DisplayName := 'New Database';
Databases.Add(Database);
UpdateDatabaseList;
with DatabaseList do
Selected := Items[Pred(Items.Count)];
end;
procedure TDatabasesSetupForm.DeleteButtonClick(Sender: TObject);
begin
if MessageDlg('Delete database "' + Database.DisplayName + '"?',
mtConfirmation, mbYesNoCancel, 0) = mrYes then
begin
FreeAndNil(Database);
UpdateDatabaseList;
end;
end;
procedure TDatabasesSetupForm.SelectDatabase(inIndex: Integer);
begin
Database := Databases[inIndex];
Item := DatabaseList.Items[inIndex];
end;
procedure TDatabasesSetupForm.DatabaseListEdited(Sender: TObject;
Item: TListItem; var S: String);
begin
Database.DisplayName := S;
end;
procedure TDatabasesSetupForm.PropertiesButtonClick(Sender: TObject);
begin
with TDatabaseSetupForm.Create(nil) do
try
Database := Self.Database;
ShowModal;
finally
Free;
end;
UpdateDatabaseList;
end;
procedure TDatabasesSetupForm.SetDatabases(const Value: ThtDatabasesItem);
begin
FDatabases := Value;
UpdateDatabaseList;
end;
end.
|
UNIT Scanner;
INTERFACE
TYPE
TTipoToken = (TOKEN_ID, TOKEN_FIGURAS, TOKEN_CORCHETE_A, TOKEN_CORCHETE_C,
TOKEN_MARCADORES, TOKEN_CUBO, TOKEN_ESFERA, TOKEN_EOF,
TOKEN_ENTERO, TOKEN_ERROR ,TOKEN_TETERA, TOKEN_CONO);
pToken = ^TToken;
TToken = RECORD
Cadena : String;
Tipo : TTipoToken;
Valor : Integer;
end;
CONST
LstP = 5;
ListaPalabras:array [1..LstP] of TToken = (
(Cadena: 'FIGURAS' ; Tipo : TOKEN_FIGURAS),
(Cadena: 'CUBO' ; Tipo : TOKEN_CUBO ),
(Cadena: 'ESFERA' ; Tipo : TOKEN_ESFERA ),
(Cadena: 'TETERA' ; Tipo : TOKEN_TETERA ),
(Cadena: 'MARCADORES' ; Tipo : TOKEN_MARCADORES));
VAR
Avance : Boolean;
Archivo : File of Char;
C : Char;
Cad : String;
T : TToken;
FUNCTION Scannea : TToken;
IMPLEMENTATION
USES
CRT, SYSUTILS;
FUNCTION EsPalabraReservada(S:String) : TTipoToken;
VAR
r : TTipoToken;
i : Integer;
BEGIN
r := TOKEN_ID;
T.Cadena := S;
T.Valor :=0;
FOR i:=1 TO LstP DO BEGIN
IF UPCASE(S) = ListaPalabras[i].Cadena THEN BEGIN
r := ListaPalabras[i].Tipo;
END;
END;
EsPalabraReservada := r;
END;
PROCEDURE Leer; BEGIN
IF Avance = True THEN BEGIN
IF eof(Archivo) THEN BEGIN
C := #26;
T.Tipo := TOKEN_EOF;
END
ELSE BEGIN
read(Archivo,C);
END;
END;
END;
PROCEDURE Estado1; BEGIN
WHILE c IN ['a'..'z','A'..'Z','¥','_','0'..'9'] DO BEGIN
Cad := Cad+c;
Leer;
END;
T.Tipo := EsPalabraReservada(cad);
Avance := false;
END;
PROCEDURE Estado2; BEGIN
WHILE c IN ['0'..'9'] DO BEGIN
Cad := Cad+c;
Leer;
END;
T.Tipo := TOKEN_ENTERO;
T.Cadena :=Cad;
val(cad,T.Valor);
Avance := true;
END;
PROCEDURE Estado3; BEGIN
T.Tipo := TOKEN_CORCHETE_A;
T.Cadena:= '';
T.Valor := 0;
Avance := true;
END;
PROCEDURE Estado4; BEGIN
T.Tipo := TOKEN_CORCHETE_C;
T.Cadena:= '';
T.Valor := 0;
Avance := true;
END;
PROCEDURE Estado5; BEGIN
T.Tipo := TOKEN_EOF;
END;
FUNCTION Scannea : TToken;
VAR
Regreso : boolean;
BEGIN
Cad := '';
leer;
Regreso :=False;
WHILE c IN ['#',#13,#10,#9,#32] DO BEGIN
IF Regreso = True THEN BEGIN
avance := true;
Leer;
END;
IF c = '#' THEN BEGIN
WHILE c <> #10 DO BEGIN
Leer;
END;
END;
Regreso := True;
END;
CASE C OF
'A'..'Z',
'a'..'z' : BEGIN Estado1; END;
'0'..'9' : BEGIN Estado2; END;
'{' : BEGIN Estado3; END;
'}' : BEGIN Estado4; END;
#26 : BEGIN Estado5; END;
ELSE BEGIN
writeln('ERROR caracter invalido : ',c);
T.Tipo := TOKEN_ERROR;
END;
END;
Scannea:=T;
END;
END.
|
{Una agencia organiza promociones en el verano y las ofrece a distintas empresas.
De cada pedido que hace una Empresa se conoce:
- Código de Empresa ( XXX = fin de datos)
- Si desea Plotear el vehículo (S/N)
- Cantidad de días que dura la promoción
Además se sabe que el costo del pedido se calcula según la siguiente Tabla:
*Precio base $8000 (incluye vehículo con chofer )
* Ploteo del vehículo $5000
* Días ($300 por día) < a 7 días +15% 7 <= d <=15 igual precio Más de 15 días -10%
Se pide desarrollar un programa Pascal que ingrese la lista de pedidos a satisfacer y luego calcule e
informe:
a) Para cada Empresa el costo del pedido.
b) El máximo importe cotizado de las promociones que solicitaron ploteado del vehículo. Puede no
haber promociones con ploteo.}
Program Ploteo;
Function Costo(Plot:char; Dias:byte):real;
Var
Pr:real;
begin
Pr:= 8000 + (Dias * 300);
If (Plot = 'S') then
Pr:= Pr + 5000;
Case Dias of
1..6:Pr:= Pr * 1.15;
7..15:Pr:= Pr;
16..100:Pr:= Pr * 0.9;
end;
Costo:= Pr;
end;
Var
Cod:string[4];
Plot,Espacio:char;
Dias:byte;
Precio,Max:real;
arch:text;
Begin
Max:= 0;
assign(arch,'Ploteo.txt');reset(arch);
readln(arch,Cod,Espacio,Plot,Espacio,Dias);
while (Cod <> 'XXX') do
begin
Precio:= Costo(Plot,Dias);
If (Precio > Max) and (Plot = 'S') then
Max:= Precio;
writeln('El costo para la empresa con codigo: ',Cod,' es: $',Precio:2:0);
writeln;
readln(arch,Cod,Espacio,Plot,Espacio,Dias); //El readln debe ir al final para que calcule bien los demás valores.
end;
close(arch);
writeln('El maximo importe cotizado con ploteo es: $',Max:2:0);
end.
|
unit frmconfig;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
EditBtn, StdCtrls, Spin;
type
{ TTimeTrackerConfigForm }
TTimeTrackerConfigForm = class(TForm)
BPConfig: TButtonPanel;
CBLimitTracking: TCheckBox;
EEndOfWorkingDay: TEdit;
EPassWord: TEdit;
EUserName: TEdit;
FEDB: TFileNameEdit;
LEEndOfWorkingDay: TLabel;
LEPassword: TLabel;
LEUserName: TLabel;
LFEDB: TLabel;
LSEInterruptTimeout: TLabel;
LSEInterruptTimeout1: TLabel;
SEInterruptTimeOut: TSpinEdit;
SEWeeksOfInterrupts: TSpinEdit;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormShow(Sender: TObject);
private
procedure CheckLimit;
procedure SaveConfig;
procedure ShowConfig;
{ private declarations }
public
{ public declarations }
end;
var
TimeTrackerConfigForm: TTimeTrackerConfigForm;
implementation
uses apptracker;
{$R *.lfm}
{ TTimeTrackerConfigForm }
procedure TTimeTrackerConfigForm.FormShow(Sender: TObject);
begin
ShowConfig;
end;
procedure TTimeTrackerConfigForm.FormClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
if ModalResult=mrOK then
SaveConfig;
end;
procedure TTimeTrackerConfigForm.CheckLimit;
begin
EEndOfWorkingDay.Enabled:=CBLimitTracking.Checked;
end;
procedure TTimeTrackerConfigForm.ShowConfig;
Var
s : TTrackerSettings;
begin
S:=TrackerApp.Settings;
FEDB.FileName:=S.DatabaseName;
EUserName.Text:=S.DatabaseUser;
EPassword.Text:=S.DatabasePwd;
SEInterruptTimeOut.Value:=S.InterruptTimeOut;
CBLimitTracking.Checked:=S.LimitTracking;
SEWeeksOfInterrupts.Value:=S.WeeksOfInterrupts;
CheckLimit;
If (S.EndOfWorkingDay<>0) then
EEndOfWorkingDay.Text:=FormatDateTime('hh:nn',S.EndOfWorkingDay)
end;
procedure TTimeTrackerConfigForm.SaveConfig;
Var
s : TTrackerSettings;
begin
S:=TrackerApp.Settings;
S.DatabaseName := FEDB.FileName;
S.DatabaseUser := EUserName.Text;
S.DatabasePwd := EPassword.Text;
S.InterruptTimeOut := SEInterruptTimeOut.Value;
S.WeeksOfInterrupts:=SEWeeksOfInterrupts.Value;
S.LimitTracking := CBLimitTracking.Checked;
If (EEndOfWorkingDay.Text<>'') then
S.EndOfWorkingDay:=StrToTime(EEndOfWorkingDay.Text)
else
S.EndOfWorkingDay:=0;
TrackerApp.SaveSettings;
end;
end.
|
{ Copyright (c) 1985, 87 by Borland International, Inc. }
program ProcPtr;
{ This example program shows how to use a pointer and an inline
directive to call 2 different procedures with the same parameters.
CallProc is an inline directive (or macro) with the same parameters
as both One and TheOther. A global pointer variable, ProcAddr,
contains the address of the procedure to call. Then a call is made
to CallProc, which in turn does a far call to the address stored
in ProcAddr.
Warning: This technique is recommended only for those programmers with
assembly language programming experience.
For more information about inline directives, refer to P-367 in the
Owner's Handbook.
}
var
ProcAddr : pointer;
procedure CallProc(var i : integer; w : word; s : string);
Inline($FF/$1E/ProcAddr);
{$F+}
procedure One(var i : integer; w : word; s : string);
begin
Writeln('First One,');
end;
{$F-}
{$F+}
procedure TheOther(var i : integer; w : word; s : string);
begin
Writeln('then TheOther');
end;
{$F-}
var
i : integer;
begin
ProcAddr := @One;
CallProc(i, 7, 'data'); { first call one }
ProcAddr := @TheOther;
CallProc(i, 5, 'more data'); { then call the other }
end.
|
unit DelphiGzip;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DsgnIntf, gzio, zlib;
type
TZeroHundred = 0..100;
THeader = set of (filename, comment);
TAboutProperty = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TCompressionLevel = 1..9;
TCompressionType = (Standard,Filtered,HuffmanOnly);
TGzip = class(TComponent)
private
{ Private declarations }
FGzipHeader : THeader;
FAbout : TAboutProperty;
FFileSource : string;
FFileDestination : string;
FDeleteSource : boolean;
FComments : string;
FCompressionLevel : TCompressionLevel;
FCompressionType : TCompressionType;
FWindowOnError : boolean;
FOnProgress : TNotifyEvent;
FProgress : integer;
FProgressStep : TZeroHundred;
FGzipFilename : string;
FGzipComments : string;
protected
{ Protected declarations }
procedure DoOnProgress; virtual;
function gz_compress (var infile:file; outfile:gzFile): integer;
function gz_uncompress (infile:gzFile; var outfile:file;
fsize:longword) : integer;
public
{ Public declarations }
constructor Create( AOwner: TComponent); override;
procedure FileSwitch;
function Gzip : integer;
function Gunzip : integer;
function getGzipInfo : integer;
property GzipFilename : string
read FGzipFilename write FGzipFilename;
property GzipComments : string
read FGzipComments write FGzipComments;
property Progress : integer
read FProgress write FProgress;
published
{ Published declarations }
property GzipHeader : THeader
read FGzipHeader write FGzipHeader;
property About: TAboutProperty
read FAbout write FAbout;
Property DeleteSource : boolean
read FDeleteSource write FDeleteSource;
Property FileSource : string
read FFileSource write FFileSource;
Property FileDestination : string
read FFileDestination write FFileDestination;
Property Comments : string
read FComments write FComments;
Property CompressionLevel : TCompressionLevel
read FCompressionLevel write FCompressionLevel;
Property CompressionType : TCompressionType
read FCompressionType write FCompressionType;
Property WindowOnError : boolean
read FWindowOnError write FWindowOnError;
property ProgressStep : TZeroHundred
read FProgressStep write FProgressStep;
property OnProgress : TNotifyEvent
read FOnProgress write FOnProgress;
end;
procedure Register;
implementation
uses utils;
const
ASCII_FLAG = $01; { bit 0 set: file probably ascii text }
HEAD_CRC = $02; { bit 1 set: header CRC present }
EXTRA_FIELD = $04; { bit 2 set: extra field present }
ORIG_NAME = $08; { bit 3 set: original file name present }
COMMENT_ = $10; { bit 4 set: file comment present }
RESERVED = $E0; { bits 5..7: reserved }
procedure TAboutProperty.Edit;
var utils : TUtils;
begin
ShowMessage(utils.CreateAboutMsg('DelphiGZip'))
end;
function TAboutProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect, paDialog, paReadOnly];
end;
function TAboutProperty.GetValue: string;
begin
Result := 'DelphiGzip';
end;
constructor TGzip.Create( AOwner: TComponent);
begin
inherited Create( AOwner);
CompressionLevel := 6;
CompressionType := Standard;
FileSource := 'data.dat';
FileDestination := 'data.dat.gz';
DeleteSource := False;
WindowOnError := True;
FProgressStep := 0;
FComments := 'generated by DelphiZlib';
FGzipHeader := [filename]
end;
procedure TGzip.DoOnProgress;
begin
if Assigned (FOnProgress) then
FOnProgress (self)
end;
{ gz_compress ----------------------------------------------
# This code comes from minigzip.pas with some changes
# Original:
# minigzip.c -- usage example of the zlib compression library
# Copyright (C) 1995-1998 Jean-loup Gailly.
#
# Pascal tranlastion
# Copyright (C) 1998 by Jacques Nomssi Nzali
#
# 0 - No Error
# 1 - Read Error
# 2 - Write Error
# 3 - gzclose error
-----------------------------------------------------------}
function TGzip.gz_compress (var infile:file; outfile:gzFile): integer;
var
len : uInt;
ioerr : integer;
buf : packed array [0..BUFLEN-1] of byte; { Global uses BSS instead of stack }
errorcode : byte;
fsize, lensize : longword;
begin
errorcode := 0;
Progress := 0;
fsize := FileSize(infile);
lensize := 0;
if FProgressStep > 0 then DoOnProgress;
while true do begin
{$I-}
blockread (infile, buf, BUFLEN, len);
{$I+}
ioerr := IOResult;
if (ioerr <> 0) then begin
errorcode := 1;
break
end;
if (len = 0) then break;
{$WARNINGS OFF}{Comparing signed and unsigned types}
if (gzwrite (outfile, @buf, len) <> len) then begin
{$WARNINGS OFF}
errorcode := 2;
break
end;
if FProgressStep > 0 then begin
{$WARNINGS OFF}{Calculate progress and raise event}
lensize := lensize + len;
if ((lensize / fsize) * 100 >= FProgress + FProgressStep)
or (lensize = fsize) then begin
FProgress := Trunc((lensize / fsize) * 100);
DoOnProgress
end
{$WARNINGS ON}
end
end; {WHILE}
closeFile (infile);
if (gzclose (outfile) <> 0{Z_OK}) then errorcode := 3;
gz_compress := errorcode;
end;
{ gz_uncompress ----------------------------------------------
# This code comes from minigzip.pas with some changes
# Original:
# minigzip.c -- usage example of the zlib compression library
# Copyright (C) 1995-1998 Jean-loup Gailly.
#
# Pascal tranlastion
# Copyright (C) 1998 by Jacques Nomssi Nzali
#
# 0 - No error
# 1 - Read Error
# 2 - Write Error
# 3 - gzclose Error
-----------------------------------------------------------}
function TGzip.gz_uncompress (infile:gzFile; var outfile:file;
fsize:longword) : integer;
var
len : integer;
written : uInt;
buf : packed array [0..BUFLEN-1] of byte; { Global uses BSS instead of stack }
errorcode : byte;
lensize : longword;
begin
errorcode := 0;
FProgress := 0;
lensize := 0;
if FProgressStep > 0 then DoOnProgress;
while true do begin
len := gzread (infile, @buf, BUFLEN);
if (len < 0) then begin
errorcode := 1;
break
end;
if (len = 0)
then break;
{$I-}
blockwrite (outfile, buf, len, written);
{$I+}
{$WARNINGS OFF}{Comparing signed and unsigned types}
if (written <> len) then begin
{$WARNINGS ON}
errorcode := 2;
break
end;
if FProgressStep > 0 then begin
{$WARNINGS OFF}
lensize := lensize + len;
if ((lensize / fsize) * 100 >= FProgress + FProgressStep)
or (lensize = fsize) then begin
FProgress := Trunc((lensize / fsize) * 100);
DoOnProgress
end
{$WARNINGS ON}
end
end; {WHILE}
if (gzclose (infile) <> 0{Z_OK}) then begin
if FWindowOnError then
MessageDlg('gzclose Error.', mtError, [mbAbort], 0);
errorcode := 3
end;
gz_uncompress := errorcode
end;
{***************************************************************
* The public part
***************************************************************}
procedure TGzip.FileSwitch;
var s : string;
begin
s := FFileSource;
FFileSource := FFileDestination;
FFileDestination := s;
end;
{ Gzip ---------------------------------------------------------
# Returns 0 - File compressed
# 1 - Could not open FFileIn
# 2 - Could not create FFileOut
# >100 - Error-100 in gz_compress
---------------------------------------------------------------}
function TGzip.Gzip : integer;
var outmode : string;
s : string;
infile : file;
outfile : gzFile;
errorcode : integer;
flags : uInt;
stream : gz_streamp;
p : PChar;
ioerr : integer;
begin
AssignFile (infile, FFileSource);
{$I-}
Reset (infile,1);
{$I+}
ioerr := IOResult;
if (ioerr <> 0) then begin
if FWindowOnError then
MessageDlg('Can''t open: '+FFileSource, mtError, [mbAbort], 0);
errorcode := 1
end
else begin
outmode := 'w ';
s := IntToStr(FCompressionLevel);
outmode[2] := s[1];
case FCompressionType of
Standard : outmode[3] := ' ';
HuffmanOnly : outmode[3] := 'h';
Filtered : outmode[3] := 'f';
end;
flags := 0;
if (filename in FGzipHeader) then flags := ORIG_NAME;
if (comment in FGzipHeader) then flags := flags + COMMENT_;
outfile := gzopen (FFileDestination, outmode, flags);
if (outfile = NIL) then begin
if FWindowOnError then
MessageDlg('Can''t open: '+FFileDestination, mtError, [mbAbort], 0);
close( infile);
errorcode := 2
end
else begin
{ if flags are set then write them }
stream := gz_streamp(outfile);
if (filename in FGzipHeader) then
begin
s := ExtractFilename(FFileSource);
p := PChar(s);
blockWrite( stream^.gzfile, p[0], length(s)+1);
stream^.startpos := stream^.startpos + length(s) + 1
end;
if (comment in FGzipHeader) then
begin
p := PChar(FComments);
blockWrite( stream^.gzfile, p[0], length(FComments)+1);
stream^.startpos := stream^.startpos + length(FComments) + 1
end;
{ start compressing }
errorcode := gz_compress(infile, outfile);
if errorcode <> 0 then errorcode := errorcode+100
else
if FDeleteSource then erase (infile);
end
end;
Gzip := errorcode
end;
{ Gzip ---------------------------------------------------------
# Returns 0 - File decompressed
# 1 - Could not open FFileIn
# 2 - Could not create FFileOut
# 3 - FFileIn not a valid gzip-file
---------------------------------------------------------------}
function TGzip.Gunzip : integer;
var //len : integer;
infile : gzFile;
outfile : file;
ioerr : integer;
errorcode : integer;
fsize : longword;
s : gz_streamp;
begin
errorcode := 0;
infile := gzopen (FFileSource, 'r', 0);
if (infile = NIL) then begin
if FWindowOnError then
MessageDlg('Can''t open: '+FFileSource, mtError, [mbAbort], 0);
errorcode := 1
end
else begin
s := gz_streamp(infile);
fsize := FileSize( s^.gzfile);
AssignFile (outfile, FFileDestination);
{$I-}
Rewrite (outfile,1);
{$I+}
ioerr := IOResult;
if (ioerr <> 0) then begin
if FWindowOnError then
MessageDlg('Can''t create: '+FFileDestination, mtError, [mbAbort], 0);
errorcode := 2
end
else begin
{ We could open all files, so time for uncompressing }
gz_uncompress (infile, outfile, fsize);
if FDeleteSource then DeleteFile(FFileSource);
{$I-}
close (outfile);
{$I+}
ioerr := IOResult;
if (ioerr <> 0) then begin
if FWindowOnError then
MessageDlg('Can''t close file '+FFileDestination, mtError, [mbAbort], 0);
halt(1)
end
end
end;
Gunzip := errorcode
end;
{ getGzipInfo ==================================================================
# todo: check for more errorcodes
#
# Errorcodes:
# 0 - No error. Info can be found in GzipFilename
# GzipComments
# 1 - Can't open FFileSource
# 2 - Not a Gzip file or invalid header
# 3 - Can't handle this field
# 4 -
===============================================================================}
function TGzip.getGzipInfo : integer;
// todo: check for eof, corrupt files etc etc
var len, dummy: uInt;
infile : file;
head : array[0..9] of byte;
ch : char;
str : string;
errorcode, ioerr : integer;
begin
errorcode := 0;
// Clean up old values
FGzipFilename := '';
FGzipComments := '';
AssignFile( infile, FFileSource);
{$I-}
Reset (infile,1);
{$I+}
ioerr := IOResult;
if (ioerr <> 0) then begin
if FWindowOnError then
MessageDlg('Can''t open: '+FFileSource, mtError, [mbAbort], 0);
errorcode := 1
end else begin
TRY
blockRead( infile, head, 10, len);
if (head[0] <> $1F) or (head[1] <> $8B) or (len<10) then begin
// Not a Gzip-file or header not valid
errorcode := 2;
abort
end;
if (head[2] <> Z_DEFLATED) or ((head[3] and RESERVED) <> 0) then begin
// Can not handle this
errorcode := 3;
abort
end;
if ((head[3] and EXTRA_FIELD) <> 0) then begin
// the extra field
blockRead(infile, len, 1);
blockread(infile, dummy, 1);
len := len + (dummy shl 8);
if FileSize( infile) < int(len+12) then begin
errorcode := 2;
abort
end;
seek( infile, len + 12) // just throw it away
end;
if ((head[3] and ORIG_NAME) <> 0) then begin
// the original file name
str := '';
blockread( infile, ch, 1);
while (ch <> char(0)) and not eof( infile) do begin
str := str + ch;
blockread( infile, ch, 1)
end;
if eof( infile) then begin
errorcode := 2;
abort
end;
FGzipFilename := str
end;
if ((head[3] and COMMENT_) <> 0) then begin
// the comments
str := '';
blockread( infile, ch, 1);
while (ch <> char(0)) and not eof( infile) do begin
str := str + ch;
blockread( infile, ch, 1)
end;
if eof( infile) then begin
errorcode := 2;
abort
end;
FGzipComments := str
end
FINALLY
CloseFile ( infile)
end
end;
getGzipInfo := errorcode
end;
procedure Register;
begin
RegisterComponents('Samples', [TGzip]);
RegisterPropertyEditor(TypeInfo(TAboutProperty), TGzip, 'ABOUT', TAboutProperty);
end;
end.
|
unit Dmitry.Graphics.Types;
interface
uses
System.Classes,
System.SyncObjs,
Vcl.Graphics;
type
TRGB = record
B, G, R : Byte;
end;
ARGB = array [0..32677] of TRGB;
PARGB = ^ARGB;
PRGB = ^TRGB;
PARGBArray = array of PARGB;
TRGB32 = record
B, G, R, L : byte;
end;
ARGB32 = array [0..32677] of TRGB32;
PARGB32 = ^ARGB32;
PRGB32 = ^TRGB32;
PARGB32Array = array of PARGB32;
type
TProgressCallBackProc = procedure(Progress: Integer; var Break: Boolean) of object;
var
SumLMatrix : array[0..255, 0..255] of Byte;
SumLMatrixDone : Boolean = False;
function SumL(LD, LS : Byte) : Byte; inline;
procedure InitSumLMatrix;
implementation
procedure InitSumLMatrix;
var
I, J : Integer;
begin
if not SumLMatrixDone then
begin
for I := 0 to 255 do
for J := 0 to 255 do
SumLMatrix[I, J] := SumL(I, J);
SumLMatrixDone := True;
end;
end;
function SumL(LD, LS : Byte) : Byte; inline;
var
N : Byte;
begin
N := 255 - LD;
Result := LD + (N * LS + $7F) div 255;
end;
end.
|
{..............................................................................}
{ Summary ShowNetList - generate a Protel format net list from a Sch Project }
{ Version 2 }
{ Copyright (c) 2004 by Altium Limited }
{..............................................................................}
{..............................................................................}
Procedure RunNetList;
Var
ErrorCode : Integer;
CommandLine : String;
Value : Integer;
FileName : String;
AnIndex : Integer;
Begin
ResetParameters;
AddStringParameter('ObjectKind','Netlist');
// AnIndex value for GenerateReport process
// Based on netlisters in
// Design » Netlist For Project
// 1 = EDIF for PCB
// 2 = Multiwire
// 3 = Pcad for PCB
// 4 = Protel
// 5 = Verilog file
// 6 = VHDL File
// 7 = XSPICE
AnIndex := 4;
AddIntegerParameter('Index',AnIndex);
AddStringParameter('ReturnGeneratedDocuments', 'True');
RunProcess('WorkspaceManager:GenerateReport');
GetIntegerParameter('Result', Value);
If Value = 0 Then Exit;
// Invoke the notepad and display the netlist file.
GetStringParameter('File1', FileName);
CommandLine := 'notepad.exe ' + FileName;
ErrorCode := RunApplication(CommandLine);
If ErrorCode <> 0 Then
ShowError('System cannot start : ' + CommandLine + #13#10 + GetErrorMessage(ErrorCode));
End;
{..............................................................................}
{..............................................................................}
|
program mergefields;
(*gibt ein array auf der konsole aus*)
procedure printArray(a : ARRAY OF INTEGER);
var i : INTEGER;
begin
for i := 0 to length(a)-1 do
Write(a[i], ' ');
WriteLn();
end;
(*setzt alle elemente in einem array auf 0*)
procedure clearArray(var a : ARRAY OF INTEGER);
var i : INTEGER;
begin
for i := 0 to length(a)-1 do
a[i] := 0;
end;
PROCEDURE Merge(a1, a2: ARRAY OF INTEGER; VAR a3: ARRAY OF INTEGER; VAR n3: INTEGER);
var i,i2,i3,i4,count : INTEGER;
var found : Boolean;
BEGIN
count := 0;
found := False;
n3 := 0;
(*schreibt alle unterschiedlichen elemente von a1 und a2 aus a1 in a3*)
FOR i := 0 TO length(a1)-1 DO BEGIN
FOR i2 := 0 TO length(a2)-1 DO BEGIN
IF a2[i2] = a1[i] THEN
found := True;
END;
IF found = False then
BEGIN
a3[count] := a1[i];
count := count + 1;
n3 := n3 + 1;
END;
found := False;
END;
(*schreibt alle unterschiedlichen elemente aus a1 und a2 aus a2 geordnet in a3*)
FOR i := 0 TO length(a2)-1 DO BEGIN
FOR i2 := 0 TO length(a1)-1 DO BEGIN
IF a1[i2] = a2[i] THEN
found := True;
END;
IF found = False THEN
FOR i3 := 0 TO length(a3)-1 DO
IF (a2[i] <= a3[i3]) OR ((a2[i] >= a3[i3]) AND (a3[i3] = 0))THEN
BEGIN
FOR i4 := length(a3)-1 DOWNTO i3+1 DO
a3[i4] := a3[i4-1];
a3[i3] := a2[i];
n3 := n3 + 1;
break;
END;
found := false;
END;
END;
var a1 : ARRAY [1 .. 6] OF INTEGER;
var a2 : ARRAY [1 .. 4] OF INTEGER;
var a3 : ARRAY [1 .. (length(a1) + length(a2))] OF INTEGER;
var n3 : INTEGER;
BEGIN
WriteLn('-- mergefields --');
a1[1] := 1;
a1[2] := 2;
a1[3] := 3;
a1[4] := 4;
a1[5] := 5;
a1[6] := 6;
a2[1] := 7;
a2[2] := 8;
a2[3] := 9;
a2[4] := 10;
Merge(a1,a2,a3,n3);
printArray(a1);
printArray(a2);
printArray(a3);
WriteLn('n3: ',n3,#13#10);
clearArray(a3);
a1[1] := 2;
a1[2] := 4;
a1[3] := 4;
a1[4] := 10;
a1[5] := 15;
a1[6] := 15;
a2[1] := 2;
a2[2] := 4;
a2[3] := 5;
a2[4] := 10;
Merge(a1,a2,a3,n3);
printArray(a1);
printArray(a2);
printArray(a3);
WriteLn('n3: ',n3,#13#10);
END. |
namespace org.me.sqlitesample;
//Sample app by Brian Long (http://blong.com)
{
This source file contains helper classes to
keep the SQLite access all in one place
If you deploy this app to the emulator then you can see the database after running the app:
adb -e shell
cd data/data/org.me.sqlitesample/databases
ls -l
This will list out the database file's directory entry.
You can also look at the content of the database from inside the adb shell:
sqlite3 SQLiteSample
.tables
.schema Customers
.dump Customers
select distinct FirstName from Customers;
.quit
exit
}
interface
uses
java.util,
android.content,
android.util,
android.database.sqlite;
type
//Database helper class for customer records
CustomerDatabaseAdapter = public class
private
ctx: Context;
dbHelper: CustomerDatabaseHelper;
db: SQLiteDatabase;
public
const
Tag = "sqlitesample.CustomerDatabaseAdapter";
FLD_ID = "_id";
FLD_FIRST = "FirstName";
FLD_LAST = "LastName";
FLD_TOWN = "Town";
ALIAS_FULLNAME = 'FullName';
DB_TABLE = "Customers";
protected
public
constructor (aContext: Context);
method Open: CustomerDatabaseAdapter;
method Close;
method FetchCustomer(rowId: Int64): SQLiteCursor;
method FetchAllCustomers: SQLiteCursor;
end;
//Nested SQLite helper class that can create, populate, upgrade and destroy the database
CustomerDatabaseHelper nested in CustomerDatabaseAdapter = class(SQLiteOpenHelper)
private
const
DB_NAME = "SQLiteSample";
DB_VER = 2;
DB_CREATE =
"create table " + CustomerDatabaseAdapter.DB_TABLE + " (" +
CustomerDatabaseAdapter.FLD_ID + " integer primary key autoincrement, " +
CustomerDatabaseAdapter.FLD_FIRST + " text not null, " +
CustomerDatabaseAdapter.FLD_LAST + " text not null, " +
CustomerDatabaseAdapter.FLD_TOWN + " text)";
DB_DESTROY = "drop table if exists " + CustomerDatabaseAdapter.DB_TABLE;
public
constructor (aContext: Context);
method onCreate(db: SQLiteDatabase); override;
method onUpgrade(db: SQLiteDatabase; oldVersion, newVersion: Integer); override;
method PrepopulateTable(db: SQLiteDatabase);
method DropTable(db: SQLiteDatabase);
end;
implementation
constructor CustomerDatabaseAdapter(aContext: Context);
begin
ctx := aContext;
end;
method CustomerDatabaseAdapter.Open: CustomerDatabaseAdapter;
begin
dbHelper := new CustomerDatabaseHelper(ctx);
db := dbHelper.WritableDatabase;
exit self
end;
method CustomerDatabaseAdapter.Close;
begin
dbHelper.close
end;
method CustomerDatabaseAdapter.FetchCustomer(rowId: Int64): SQLiteCursor;
begin
var cursor := SQLiteCursor(db.query(true, DB_TABLE,
[FLD_ID, FLD_FIRST, FLD_LAST, FLD_TOWN],
FLD_ID + '=' + rowId, nil, nil, nil, nil, nil));
if cursor <> nil then
cursor.moveToFirst();
exit cursor
end;
method CustomerDatabaseAdapter.FetchAllCustomers: SQLiteCursor;
begin
exit SQLiteCursor(db.query(DB_TABLE,
[FLD_ID, FLD_FIRST + ' || " " || ' + FLD_LAST + ' AS ' + ALIAS_FULLNAME, FLD_TOWN],
nil, nil, nil, nil, FLD_LAST))
end;
constructor CustomerDatabaseAdapter.CustomerDatabaseHelper(aContext: Context);
begin
inherited constructor(aContext, DB_NAME, nil, DB_VER)
end;
method CustomerDatabaseAdapter.CustomerDatabaseHelper.onCreate(db: SQLiteDatabase);
begin
db.execSQL(DB_CREATE);
PrepopulateTable(db)
end;
method CustomerDatabaseAdapter.CustomerDatabaseHelper.onUpgrade(db: SQLiteDatabase; oldVersion, newVersion: Integer);
begin
Log.w(Tag, 'Upgrading database from version ' + oldVersion + ' to ' + newVersion + ', which will destroy all old data');
DropTable(db);
onCreate(db)
end;
method CustomerDatabaseAdapter.CustomerDatabaseHelper.PrepopulateTable(db: SQLiteDatabase);
begin
var initialValues := new ContentValues();
var values: array of array of String :=
[['John', 'Smith', 'Manchester'],
['John', 'Doe', 'Dorchester'],
['Fred', 'Bloggs', 'Winchester'],
['Walt', 'Jabsco', 'Ilchester'],
['Jane', 'Smith', 'Silchester'],
['Raymond', 'Luxury-Yacht', 'Colchester']];
for i: Integer := 0 to length(values)-1 do
begin
initialValues.put(FLD_FIRST, values[i, 0]);
initialValues.put(FLD_LAST, values[i, 1]);
initialValues.put(FLD_TOWN, values[i, 2]);
db.insert(DB_TABLE, nil, initialValues);
initialValues.clear;
end;
end;
method CustomerDatabaseAdapter.CustomerDatabaseHelper.DropTable(db: SQLiteDatabase);
begin
db.execSQL(DB_DESTROY)
end;
end. |
unit PascalCodeUnificationFrm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls,
System.Math,
CoreClasses, ListEngine, PascalStrings, TextParsing, UnicodeMixedLib, DoStatusIO, TextDataEngine;
type
TPascalCodeUnificationForm = class(TForm)
FileListMemo: TMemo;
AddFileButton: TButton;
FixedButton: TButton;
StatusMemo: TMemo;
StateLabel: TLabel;
ProgressBar: TProgressBar;
WordDefineMemo: TMemo;
dictInputInfoLabel: TLabel;
WordOutputMemo: TMemo;
dictOutputInfoLabel: TLabel;
FixedWordCheckBox: TCheckBox;
OpenDialog: TFileOpenDialog;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure AddFileButtonClick(Sender: TObject);
procedure FixedButtonClick(Sender: TObject);
procedure FixedWordCheckBoxClick(Sender: TObject);
private
procedure DoStatusMethod(AText: SystemString; const ID: Integer);
public
end;
var
PascalCodeUnificationForm: TPascalCodeUnificationForm;
implementation
{$R *.dfm}
procedure TPascalCodeUnificationForm.FormCreate(Sender: TObject);
var
he: THashTextEngine;
begin
AddDoStatusHook(Self, DoStatusMethod);
if umlFileExists(umlCombineFileName(umlGetFilePath(Application.Exename), 'PascalCodeUnification.ini')) then
begin
he := THashTextEngine.Create;
he.LoadFromFile(umlCombineFileName(umlGetFilePath(Application.Exename), 'PascalCodeUnification.ini'));
FixedWordCheckBox.Checked := he.GetDefaultValue('options', 'fixedWord', FixedWordCheckBox.Checked);
FileListMemo.Lines.BeginUpdate;
FileListMemo.Lines.Assign(he.Names['Files']);
FileListMemo.Lines.EndUpdate;
WordDefineMemo.Lines.BeginUpdate;
WordDefineMemo.Lines.Assign(he.Names['Words']);
WordDefineMemo.Lines.EndUpdate;
DisposeObject(he);
FixedWordCheckBoxClick(FixedWordCheckBox);
end;
end;
procedure TPascalCodeUnificationForm.FormDestroy(Sender: TObject);
var
he: THashTextEngine;
begin
DeleteDoStatusHook(Self);
he := THashTextEngine.Create;
he.SetDefaultValue('options', 'fixedWord', FixedWordCheckBox.Checked);
he.Names['Files'].Assign(FileListMemo.Lines);
he.Names['Words'].Assign(WordDefineMemo.Lines);
he.SaveToFile(umlCombineFileName(umlGetFilePath(Application.Exename), 'PascalCodeUnification.ini'));
DisposeObject(he);
end;
procedure TPascalCodeUnificationForm.AddFileButtonClick(Sender: TObject);
begin
if not OpenDialog.Execute() then
Exit;
FileListMemo.Lines.AddStrings(OpenDialog.Files);
StateLabel.Caption := Format('code files: %d, fixed Unit define: %d, fixed word : %d', [FileListMemo.Lines.Count, 0, 0]);
end;
procedure TPascalCodeUnificationForm.FixedButtonClick(Sender: TObject);
var
fixedUName_Counter, fixedWord_Counter: Integer;
uHash: THashList;
nHash: THashVariantList;
function FixedUnit(const fn, un: SystemString): Boolean;
type
TParsingState = (psUnit, psUses, psUnknow);
var
Code: TCoreClassStringList;
u_TP, w_TP: TTextParsing;
i: Integer;
p: PTokenData;
State: TParsingState;
n, N2, I_Name, prefix: TPascalString;
nComp: Boolean;
begin
Result := False;
if not umlFileExists(fn) then
Exit;
DoStatus('prepare parsing %s...', [umlGetFileName(fn).Text]);
Code := TCoreClassStringList.Create;
try
Code.LoadFromFile(fn);
except
DoStatus('%s encoding error!', [umlGetFileName(fn).Text]);
DisposeObject(Code);
Exit;
end;
w_TP := nil;
if FixedWordCheckBox.Checked then
begin
w_TP := TTextParsing.Create(Code.Text, tsPascal);
i := 0;
while i < w_TP.TokenCount do
begin
p := w_TP.Tokens[i];
if (p^.tokenType = ttAscii) then
begin
nHash.IncValue(p^.Text, 1);
n := nHash.HashList.KeyData[p^.Text]^.OriginName;
nComp := p^.Text <> n;
Result := Result or nComp;
if nComp then
begin
Inc(fixedWord_Counter);
p^.Text := n;
end;
end;
Inc(i);
end;
w_TP.RebuildToken;
u_TP := TTextParsing.Create(w_TP.ParsingData.Text, tsPascal, nil, TPascalString(SpacerSymbol.V).DeleteChar('.'));
end
else
begin
u_TP := TTextParsing.Create(Code.Text, tsPascal, nil, TPascalString(SpacerSymbol.V).DeleteChar('.'));
end;
i := 0;
State := psUnknow;
while i < u_TP.TokenCount do
begin
p := u_TP.Tokens[i];
if p^.tokenType = ttComment then
begin
I_Name := p^.Text;
if umlMultipleMatch('{*}', I_Name) then
begin
I_Name.DeleteFirst;
I_Name.DeleteLast;
N2 := I_Name.TrimChar(#32#9);
if umlMultipleMatch(['$I *', '$INCLUDE *'], N2) then
begin
I_Name := umlDeleteFirstStr(I_Name, ' ');
prefix := umlDeleteLastStr(I_Name, '/\');
I_Name := umlGetLastStr(I_Name, '/\');
if uHash.Exists(I_Name) then
begin
n := uHash.KeyData[I_Name]^.OriginName;
nComp := (I_Name <> n) or (umlMultipleMatch('$I *', N2));
if nComp then
begin
if prefix.Len > 0 then
prefix := prefix.ReplaceChar('/', '\') + '\';
I_Name := PFormat('{$INCLUDE %s}', [prefix.Text + n.Text]);
DoStatus('fixed Include : "%s" -> "%s"', [p^.Text.Text, I_Name.Text]);
p^.Text := I_Name;
Inc(fixedUName_Counter);
end;
Result := Result or nComp;
end
else
begin
uHash.Add(I_Name, nil, False);
if umlMultipleMatch('$I *', N2) then
begin
Result := True;
n := I_Name;
if prefix.Len > 0 then
prefix := prefix.ReplaceChar('/', '\') + '\';
I_Name := PFormat('{$INCLUDE %s}', [prefix.Text + n.Text]);
DoStatus('fixed Include : "%s" -> "%s"', [p^.Text.Text, I_Name.Text]);
p^.Text := I_Name;
Inc(fixedUName_Counter);
end;
end;
end;
end;
end
else
case State of
psUnit: if (p^.tokenType = ttAscii) then
begin
nComp := p^.Text <> un;
Result := Result or nComp;
if nComp then
begin
DoStatus('fixed unit (%s) define:%s -> %s', [umlGetFileName(fn).Text, p^.Text.Text, un]);
Inc(fixedUName_Counter);
p^.Text := un;
end;
end
else if (p^.tokenType = ttSymbol) and (p^.Text = ';') then
State := psUnknow;
psUses: if (p^.tokenType = ttAscii) then
begin
if (not p^.Text.Same('in')) then
begin
if uHash.Exists(p^.Text) then
begin
n := uHash.KeyData[p^.Text]^.OriginName;
nComp := p^.Text <> n;
Result := Result or nComp;
if nComp then
begin
DoStatus('fixed unit (%s) define: %s -> %s', [umlGetFileName(fn).Text, p^.Text.Text, n.Text]);
Inc(fixedUName_Counter);
p^.Text := n;
end;
end
else
uHash.Add(p^.Text, nil, False);
end;
end
else if (p^.tokenType = ttSymbol) and (p^.Text = ';') then
State := psUnknow;
psUnknow: if (p^.tokenType = ttAscii) then
begin
if (p^.Text.Same('unit')) then
State := psUnit
else if (p^.Text.Same('program')) then
State := psUnit
else if (p^.Text.Same('library')) then
State := psUnit
else if (p^.Text.Same('uses')) then
State := psUses;
end;
end;
Inc(i);
end;
if Result then
begin
DoStatus('rebuild code %s...', [umlGetFileName(fn).Text]);
u_TP.RebuildToken;
Code.Text := u_TP.ParsingData.Text.Text;
Code.SaveToFile(fn);
end;
DisposeObject([Code, u_TP, w_TP]);
end;
function ListSortCompare(const p1, p2: PListPascalStringData): Integer;
begin
Result := CompareValue(Integer(nHash[p2^.Data.Text]), Integer(nHash[p1^.Data.Text]));
end;
procedure QuickSortList(var SortList: TCoreClassPointerList; L, R: Integer); inline;
var
i, J: Integer;
p, T: Pointer;
begin
repeat
i := L;
J := R;
p := SortList[(L + R) shr 1];
repeat
while ListSortCompare(SortList[i], p) < 0 do
Inc(i);
while ListSortCompare(SortList[J], p) > 0 do
Dec(J);
if i <= J then
begin
if i <> J then
begin
T := SortList[i];
SortList[i] := SortList[J];
SortList[J] := T;
end;
Inc(i);
Dec(J);
end;
until i > J;
if L < J then
QuickSortList(SortList, L, J);
L := i;
until i >= R;
end;
var
i: Integer;
nList: TListPascalString;
begin
FixedButton.Enabled := False;
AddFileButton.Enabled := False;
FileListMemo.Enabled := False;
uHash := THashList.CustomCreate(8192);
nHash := THashVariantList.CustomCreate($FFFF);
ProgressBar.Max := FileListMemo.Lines.Count - 1;
ProgressBar.Position := 0;
if FixedWordCheckBox.Checked then
begin
nHash.IncValue('begin', 1);
nHash.IncValue('end', 1);
nHash.IncValue('index', 1);
for i := 0 to WordDefineMemo.Lines.Count - 1 do
nHash.IncValue(WordDefineMemo.Lines[i], 1);
end;
for i := 0 to FileListMemo.Lines.Count - 1 do
if umlFileExists(FileListMemo.Lines[i]) then
begin
if umlMultipleMatch(['*.pas', '*.pp', '*.dpr'], FileListMemo.Lines[i]) then
uHash.Add(umlChangeFileExt(umlGetFileName(FileListMemo.Lines[i]), ''), nil)
else if umlMultipleMatch('*.inc', FileListMemo.Lines[i]) then
uHash.Add(umlGetFileName(FileListMemo.Lines[i]), nil)
else
DoStatus('no support file: %s', [umlGetFileName(FileListMemo.Lines[i]).Text]);
end;
fixedUName_Counter := 0;
fixedWord_Counter := 0;
for i := 0 to FileListMemo.Lines.Count - 1 do
if umlFileExists(FileListMemo.Lines[i]) then
if umlMultipleMatch(['*.pas', '*.pp', '*.dpr', '*.inc'], FileListMemo.Lines[i]) then
begin
FixedUnit(FileListMemo.Lines[i], umlChangeFileExt(umlGetFileName(FileListMemo.Lines[i]), ''));
ProgressBar.Position := i;
StateLabel.Caption := Format('code files: %d, fixed Unit define: %d, fixed word : %d',
[FileListMemo.Lines.Count, fixedUName_Counter, fixedWord_Counter]);
end;
if FixedWordCheckBox.Checked then
begin
DoStatus('build dict...');
nList := TListPascalString.Create;
nHash.GetNameList(nList);
if nList.Count > 1 then
QuickSortList(nList.List.ListData^, 0, nList.List.Count - 1);
WordOutputMemo.Lines.BeginUpdate;
nList.AssignTo(WordOutputMemo.Lines);
WordOutputMemo.Lines.EndUpdate;
DisposeObject(nList);
end;
ProgressBar.Position := 0;
DoStatus('all done.');
DisposeObject([uHash, nHash]);
FixedButton.Enabled := True;
AddFileButton.Enabled := True;
FileListMemo.Enabled := True;
end;
procedure TPascalCodeUnificationForm.FixedWordCheckBoxClick(Sender: TObject);
var
flag: Boolean;
begin
flag := FixedWordCheckBox.Checked;
dictInputInfoLabel.Visible := flag;
WordDefineMemo.Visible := flag;
dictOutputInfoLabel.Visible := flag;
WordOutputMemo.Visible := flag;
end;
procedure TPascalCodeUnificationForm.DoStatusMethod(AText: SystemString; const ID: Integer);
begin
StatusMemo.Lines.Add(AText);
Application.ProcessMessages;
end;
end.
|
unit EcranAccueil;
interface
uses Variables;
{Affiche l'écran d'accueil du jeu}
procedure afficher;
{ Affiche un écran de vérification Quitter ? Oui/Non }
procedure verifQuitter(Joueur : TJoueur);
implementation
uses GestionEcran, OptnAffichage, EcranGrimoire, EcranTribu;
{ Déclaration 'forward' nécessaire pour indiquer qu'on appelle la procédure
suivante avant sa déclaration dans le programme. }
procedure choisirDifficulte(Joueur : TJoueur); forward;
{ Affiche le numéro du joueur dans le coin haut gauche de l'écran }
procedure afficherJoueur(Joueur : TJoueur);
begin
dessinerCadreXY(2,1, 27,3, double, 15,0);
deplacerCurseurXY(5,2);
write('Sélection : ');
if Joueur = Joueur1 then
begin
couleurTexte(13);
write('Joueur 1');
end
else if Joueur = Joueur2 then
begin
couleurTexte(14);
write('Joueur 2');
end;
couleurTexte(15);
end;
{ Propose au joueur de nommer sa Tribu et son Elevage principal }
procedure creerTribu(Joueur : TJoueur);
var
nomTribu, nomElevage : String; // Noms saisis par le joueur
begin
{ Création de la Tribu }
effacerEcran();
if getMultijoueur() = True then afficherJoueur(Joueur);
afficherTitre('QUEL EST LE NOM DE VOTRE TRIBU ?', 10);
deplacerCurseurXY(48,14);
write('Nom :');
deplacerCurseurXY(55,14);
readln(nomTribu);
{ Création de l'Elevage }
effacerEcran();
if getMultijoueur() = True then afficherJoueur(Joueur);
afficherTitre('NOM DE SON ELEVAGE PRINCIPAL', 10);
deplacerCurseurXY(48,14);
write('Nom :');
deplacerCurseurXY(55,14);
readln(nomElevage);
{ Affectation des noms saisis }
setTribu_nom(Joueur, nomTribu);
setElevage_nom(Joueur, nomElevage);
if getMultijoueur = True then
begin
if Joueur = Joueur1 then choisirDifficulte(Joueur2)
else if Joueur = Joueur2 then EcranTribu.afficher(Joueur1);
end;
{ Début de la partie }
EcranTribu.afficher(Joueur);
end;
{ Propose au joueur de choisir l'archétype de sa Tribu }
procedure choisirArchetype(Joueur : TJoueur);
var
choix : String; // Valeur entrée par la joueur
begin
effacerEcran();
{ Corps de l'écran }
if getMultijoueur() = True then afficherJoueur(Joueur);
afficherTitre('CHOIX DE L''ARCHÉTYPE DE VOTRE TRIBU', 4);
// Tribu Algébriste
afficherAction(40,8, '1', 'TRIBU ALGÉBRISTE', 'vert');
deplacerCurseurXY(44,9);
couleurTexte(8);
write('Aucun modificateur');
couleurTexte(15);
// Tribu Analyste
afficherAction(40,12, '2', 'TRIBU GÉOMÈTRE', 'vert');
deplacerCurseurXY(44,13);
couleurTexte(8);
write('Le bonheur de votre population reste constant');
couleurTexte(15);
// Tribu Borélienne
afficherAction(40,16, '3', 'TRIBU BORÉLIENNE', 'vert');
deplacerCurseurXY(44,17);
couleurTexte(8);
write('L''armée de départ est renforcée');
couleurTexte(15);
// Tribu Géomètre
afficherAction(40,20, '4', 'TRIBU ARCHIVISTE', 'vert');
deplacerCurseurXY(44,21);
couleurTexte(8);
write('Votre Tribu peut encaisser davantage de défaites');
couleurTexte(15);
// Tribu Probabiliste
afficherAction(40,24, '5', 'TRIBU PROBABILISTE', 'vert');
deplacerCurseurXY(44,25);
couleurTexte(8);
write('Probabilité de se faire attaquer réduite');
couleurTexte(15);
{ Partie inférieure de l'écran }
afficherAction(8,26, '0', 'Retour', 'jaune');
afficherMessage();
afficherCadreAction();
{ Déplace le curseur dans le cadre "Action" }
deplacerCurseurXy(114,26);
readln(choix);
{ Liste des choix disponibles }
if (choix = '0') then choisirDifficulte(Joueur);
if (choix = '1') then setTribu_archetype(Joueur, 'Algébriste');
if (choix = '2') then setTribu_archetype(Joueur, 'Géomètre');
if (choix = '3') then setTribu_archetype(Joueur, 'Borélienne');
if (choix = '4') then setTribu_archetype(Joueur, 'Archiviste');
if (choix = '5') then setTribu_archetype(Joueur, 'Probabiliste');
if (choix = '1') OR (choix = '2') OR (choix = '3') OR (choix = '4') OR (choix = '5') then
begin
appliquerArchetype(Joueur);
creerTribu(Joueur);
end
{ Valeur saisie invalide }
else
begin
setMessage('Vous devez choisir un archétype');
choisirArchetype(Joueur);
end;
end;
{ Propose au joueur de choisir la difficulté du jeu }
procedure choisirDifficulte(Joueur : TJoueur);
var
choix : String; // Valeur entrée par la joueur
begin
effacerEcran();
{ Corps de l'écran }
if getMultijoueur() = True then afficherJoueur(Joueur);
afficherTitre('CHOIX DE LA DIFFICULTÉ DU JEU', 4);
// Difficulté Linéaire
afficherAction(44,10, '1', 'LINÉAIRE', 'vert');
deplacerCurseurXY(48,11);
couleurTexte(8);
write('Perdre devient le challenge');
couleurTexte(15);
// Difficulté Appliqué
afficherAction(44,15, '2', 'APPLIQUÉ', 'vert');
deplacerCurseurXY(48,16);
couleurTexte(8);
write('Une expérience de jeu classique');
couleurTexte(15);
// Difficulté Quantique
afficherAction(44,20, '3', 'QUANTIQUE', 'vert');
deplacerCurseurXY(48,21);
couleurTexte(8);
write('Ça vous intrique ?');
couleurTexte(15);
{ Partie inférieure de l'écran }
afficherAction(8,26, '0', 'Retour', 'jaune');
afficherMessage();
afficherCadreAction();
{ Déplace le curseur dans le cadre "Action" }
deplacerCurseurXy(114,26);
readln(choix);
{ Liste des choix disponibles }
if (choix = '0') then afficher();
if (choix = '1') then setTribu_difficulte(Joueur, 'Linéaire');
if (choix = '2') then setTribu_difficulte(Joueur, 'Appliqué');
if (choix = '3') then setTribu_difficulte(Joueur, 'Quantique');
if (choix = '1') OR (choix = '2') OR (choix = '3') then
begin
appliquerDifficulte(Joueur);
choisirArchetype(Joueur)
end
{ Valeur saisie invalide }
else
begin
setMessage('Vous devez choisir une difficulté');
choisirDifficulte(Joueur);
end;
end;
{ Récupère le choix du joueur et détermine l'action à effectuer }
procedure choisir;
var
choix : String; // Valeur entrée par la joueur
begin
{ Déplace le curseur dans le cadre "Action" }
deplacerCurseurXY(114,26);
readln(choix);
{ Liste des choix disponibles }
if (choix = '1') then
begin
choisirDifficulte(Joueur1);
end;
if (choix = '2') then
begin
setMultijoueur(True);
choisirDifficulte(Joueur1);
end;
if (choix = '3') then
begin
EcranGrimoire.afficherGrimoire();
end;
if (choix = '0') then halt
{ Valeur saisie invalide }
else
begin
setMessage('Action non reconnue');
afficher();
end;
end;
{ Affichage de l'écran et appel des fonctions & procédures associées }
procedure afficher;
begin
effacerEcran();
// (ré)Initialisation des deux Joueurs
initJoueur(Joueur1);
initJoueur(Joueur2);
// Réinitialisation du booléen Multijoueur
setMultijoueur(False);
{ TITRE }
couleurTexte(15);
deplacerCurseurXY(13,1);
write('─────────────────────────────────────────────────────────────────────────────────────────────');
deplacerCurseurXY(13,3);
write(' ██████╗██╗██╗ ██╗██╗██╗ ██╗███████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗ ██████╗');
deplacerCurseurXY(13,4);
write('██╔════╝██║██║ ██║██║██║ ██║╚══███╔╝██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║ ██╔═████╗');
deplacerCurseurXY(13,5);
write('██║ ██║██║ ██║██║██║ ██║ ███╔╝ ███████║ ██║ ██║██║ ██║██╔██╗ ██║ ██║██╔██║');
deplacerCurseurXY(13,6);
write('██║ ██║╚██╗ ██╔╝██║██║ ██║ ███╔╝ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║ ████╔╝██║');
deplacerCurseurXY(13,7);
write('╚██████╗██║ ╚████╔╝ ██║███████╗██║███████╗██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║ ╚██████╔╝');
deplacerCurseurXY(13,8);
write(' ╚═════╝╚═╝ ╚═══╝ ╚═╝╚══════╝╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ');
deplacerCurseurXY(13,9);
write(' ╦ ╔═╗╔╦╗╔═╗╔╦╗╦ ╦╔═╗ ╔═╗╔╦╗╦╔╦╗╦╔═╗╔╗╔');
deplacerCurseurXY(13,10);
write('────────────────────────── ║ ╠═╣║║║╠═╣ ║ ╠═╣╚═╗ ║╣ ║║║ ║ ║║ ║║║║ ──────────────────────────');
deplacerCurseurXY(13,11);
write(' ╩═╝╩ ╩╩ ╩╩ ╩ ╩ ╩ ╩╚═╝ ╚═╝═╩╝╩ ╩ ╩╚═╝╝╚╝');
deplacerCurseurXY(13,12);
{ INTRODUCTION }
deplacerCurseurXY(4,14);
write('Bienvenue dans Civilization 0 — Lamaths Edition');
couleurTexte(8);
deplacerCurseurXY(4,16);
write('À la tête d''une Tribu de Lamas mathématiciens, vous menez une guerre sans merci contre les hordes littéraires');
deplacerCurseurXY(4,17);
write('qui menacent vos recherches. Affirmez votre supériorité ; résolvez des équations pour améliorer votre élevage');
deplacerCurseurXY(4,18);
write('et étalez votre savoir afin de conquérir les pâturages tombés entre les sabots de l''ennemi.');
deplacerCurseurXY(4,20);
write('Que les axiomes vous guident !');
couleurTexte(15);
{ CHOIX }
afficherAction(4,23, '1', 'Débuter une nouvelle partie (Solo)', 'vert');
afficherAction(4,24, '2', 'Mode 2 Joueurs', 'vert');
afficherAction(4,26, '3', 'Consulter le Grimoire', 'vert');
afficherAction(4,27, '0', 'Quitter le jeu', 'jaune');
afficherMessage();
afficherCadreAction();
choisir();
end;
{ Affiche un écran de vérification Quitter ? Oui/Non }
procedure verifQuitter(Joueur : TJoueur);
var
choix : String; // Valeur entrée par la joueur
begin
effacerEcran();
{ Corps de l'écran }
afficherTitre('VOULEZ-VOUS VRAIMENT QUITTER LA PARTIE ?', 10);
afficherAction(53,14, '1', 'Non', 'vert');
afficherAction(53,16, '2', 'Oui', 'vert');
{ Partie inférieure de l'écran }
afficherMessage();
afficherCadreAction();
{ Déplace le curseur dans le cadre "Action" }
deplacerCurseurXy(114,26);
readln(choix);
{ Liste des choix disponibles }
if (choix = '1') then EcranTribu.afficher(Joueur);
if (choix = '2') then EcranAccueil.afficher()
{ Valeur saisie invalide }
else
begin
setMessage('Action non reconnue');
verifQuitter(Joueur);
end;
end;
end.
|
unit BsDiscountObjEdit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxLookAndFeelPainters, cxLabel, StdCtrls, cxButtons, cxTextEdit,
cxControls, cxContainer, cxEdit, cxCheckBox;
type
TfrmGroupObjEdit = class(TForm)
chRootObject: TcxCheckBox;
NameObjEdit: TcxTextEdit;
NameComment: TcxTextEdit;
btnOk: TcxButton;
btnCancel: TcxButton;
lblNameObj: TcxLabel;
lblComment: TcxLabel;
lblKodObj: TcxLabel;
KodEdit: TcxTextEdit;
procedure btnOkClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure KodEditKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmGroupObjEdit: TfrmGroupObjEdit;
implementation
{$R *.dfm}
procedure TfrmGroupObjEdit.btnOkClick(Sender: TObject);
begin
if KodEdit.Text='' then
begin
KodEdit.Style.Color:=clRed;
ShowMessage('Ви не заповнили поле "Код об''єкту"');
Exit;
end;
if NameObjEdit.Text='' then
begin
NameObjEdit.Style.Color:=clRed;
ShowMessage('Ви не заповнили поле "Назва об''єкту"');
Exit;
end;
ModalResult:=mrOk;
end;
procedure TfrmGroupObjEdit.btnCancelClick(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
procedure TfrmGroupObjEdit.KodEditKeyPress(Sender: TObject; var Key: Char);
begin
if ((key in ['0'..'9']) or (Key=#8)) then KodEdit.Properties.ReadOnly:=False
else KodEdit.Properties.ReadOnly:=True;
end;
end.
|
unit uPayment;
interface
uses
SysUtils, ADODB, uMRTraceControl, uDocumentInfo, Dialogs;
type
TPayment = class
private
FIDStore: Integer;
FIDCashRegMov: Integer;
FIDCustomer: Integer;
FPaymentDate: TDateTime;
FIDCentroCusto: Integer;
FIDLancamentoTipo: Integer;
FIDContaCorrente: Integer;
FIDEmpresa: Integer;
FSucessMsg: String;
FPaymentIndex: Integer;
FDocumentType: TDocumentType;
FIDServiceOrder: Integer;
FPaymentMemo: String;
FSaveIdPaymentDebitCard: integer;
procedure setSaveIdPaymentDebitCard(const Value: integer);
procedure UpdateCashRegMov;
procedure SetDefaultValues;
function GetNewIDPayment: Integer;
function GetInsertParameters: String;
protected
// Alex 09/27/2015
FPaymentType : String;
FADOConnection: TADOConnection;
FTraceControl: TMRTraceControl;
FIDUser: Integer;
FIDPreSale: Integer;
FIDPaymentType: Integer;
FPaymentValue: Currency;
// Antonio M F Souza, Jan 18 2013
FInvoiceValueFromCashRegister: Currency;
FIDMeioPrevisto: Integer;
FIDPayment: Integer;
FErrorMsg: String;
FRemovePaymentWhenDeleting : Boolean; // Alex 10/05/2015
procedure InsertPayment;
procedure FillParameters(ACmdPayment : TADOCommand); virtual;
procedure BeforeProcessPayment; virtual;
procedure OnProcessPayment; virtual;
procedure AfterProcessPayment; virtual;
procedure BeforeDeletePayment; virtual;
procedure SetProperties(ADSPayment: TADODataSet); virtual;
procedure setIdMeioPrevisto(arg_cardType: String);
function getIdMeioPrevisto(): Integer;
function GetAutoProcess: Boolean; virtual;
function GetSQLFields: String; virtual;
function CanUpdateCashregMov : Boolean; virtual;
public
constructor Create(AADOConnection: TADOConnection; ATraceControl: TMrTraceControl); virtual;
procedure LoadPayment;
function ValidatePayment: Boolean; virtual;
function ProcessPayment: Boolean;
function GetPaymentType: Integer; virtual;
function CanDelete: Boolean; virtual;
function DeletePayment: Boolean;
property ADOConnection: TADOConnection read FADOConnection write FADOConnection;
property TraceControl: TMRTraceControl read FTraceControl write FTraceControl;
property AutoProcess: Boolean read GetAutoProcess;
property PaymentIndex: Integer read FPaymentIndex write FPaymentIndex;
property IDPayment: Integer read FIDPayment write FIDPayment;
property IDPreSale: Integer read FIDPreSale write FIDPreSale;
property IDServiceOrder: Integer read FIDServiceOrder write FIDServiceOrder;
property IDStore: Integer read FIDStore write FIDStore;
property IDCashRegMov: Integer read FIDCashRegMov write FIDCashRegMov;
property IDUser: Integer read FIDUser write FIDUser;
property IDCustomer: Integer read FIDCustomer write FIDCustomer;
property IDPaymentType: Integer read FIDPaymentType write FIDPaymentType;
property PaymentDate: TDateTime read FPaymentDate write FPaymentDate;
property PaymentValue: Currency read FPaymentValue write FPaymentValue;
property IDCentroCusto: Integer read FIDCentroCusto write FIDCentroCusto;
property IDLancamentoTipo: Integer read FIDLancamentoTipo write FIDLancamentoTipo;
property IDContaCorrente: Integer read FIDContaCorrente write FIDContaCorrente;
property IDEmpresa: Integer read FIDEmpresa write FIDEmpresa;
property ErrorMsg: String read FErrorMsg write FErrorMsg;
property SucessMsg: String read FSucessMsg write FSucessMsg;
property PaymentMemo: String read FPaymentMemo write FPaymentMemo;
//amfsouza 04.15.2011 - to force identification when debit card.
property SaveIdPaymentDebitCard: integer write setSaveIdPaymentDebitCard;
property DocumentType: TDocumentType read FDocumentType write FDocumentType;
property InvoiceValueFromCashRegister: Currency read FInvoiceValueFromCashRegister write FInvoiceValueFromCashRegister;
end;
implementation
uses Classes, DB, uSystemConst, Math, Variants, uDebugFunctions, uDM;
{ TPayment }
constructor TPayment.Create(AADOConnection: TADOConnection; ATraceControl: TMrTraceControl);
begin
FADOConnection := AADOConnection;
FTraceControl := ATraceControl;
FRemovePaymentWhenDeleting := True; // Alex 10/05/2015
end;
procedure TPayment.InsertPayment;
var
CmdPayment : TADOCommand;
begin
FTraceControl.TraceIn(Self.ClassName + '.InsertPayment');
SetDefaultValues;
FIDPayment := GetNewIDPayment;
CmdPayment := TADOCommand.Create(nil);
with CmdPayment do
try
Connection := FADOConnection;
CommandText := 'INSERT INTO Fin_Lancamento (' + GetSQLFields + ')' +
'VALUES (' + GetInsertParameters + ')';
FillParameters(CmdPayment);
// showmessage(CommandText);
Execute;
//after insert in database I need reset to avoid mistakes.
FSaveIdPaymentDebitCard := 0
finally
FreeAndNil(CmdPayment);
end;
FTraceControl.TraceOut;
end;
function TPayment.CanDelete: Boolean;
begin
FTraceControl.TraceIn(Self.ClassName + '.CanDelete');
// showmessage('can delete');
with TADODataSet.Create(nil) do
try
try
Connection := FADOConnection;
CommandText := 'SELECT * FROM Fin_LancQuit (NOLOCK) WHERE IDLancamento = :IDLancamento';
Parameters.ParamByName('IDLancamento').Value := FIDPayment;
Open;
Result := IsEmpty;
finally
Free;
end;
except
on E: Exception do
begin
Result := False;
ErrorMsg := E.Message;
FTraceControl.SaveTrace(FIDUser, E.Message, Self.ClassName);
end;
end;
FTraceControl.TraceOut;
end;
function TPayment.ProcessPayment: Boolean;
begin
(* I think we have be a hook in that method to configure correct config *)
FTraceControl.TraceIn(Self.ClassName + '.ProcessPayment');
Result := True;
try
if ValidatePayment then
begin
//Antonio: BeforeProcessPayment will be called by a child class of TPayment (
BeforeProcessPayment;
try
FADOConnection.BeginTrans;
InsertPayment;
UpdateCashRegMov;
OnProcessPayment;
FADOConnection.CommitTrans;
except
on E: Exception do
begin
Result := False;
FADOConnection.RollbackTrans;
ErrorMsg := E.Message;
//FTraceControl.SaveTrace(FIDUser, E.Message, Self.ClassName);
end;
end;
AfterProcessPayment;
end;
except
on E: Exception do
begin
Result := False;
ErrorMsg := E.Message;
//FTraceControl.SaveTrace(FIDUser, E.Message, Self.ClassName);
end;
end;
FTraceControl.TraceOut;
end;
function TPayment.DeletePayment: Boolean;
begin
FTraceControl.TraceIn(Self.ClassName + '.DeletePayment');
Result := True;
// Alex 10/05/2015
//if ( FRemovePaymentWhenDeleting = False ) Then begin
BeforeDeletePayment();
// end;
if ( FRemovePaymentWhenDeleting = False ) Then begin
exit;
end;
try
with TADOCommand.Create(nil) do
try
Connection := FADOConnection;
CommandText := 'DELETE Fin_Lancamento WHERE IDLancamento = :IDLancamento';
Parameters.ParamByName('IDLancamento').Value := FIDPayment;
Execute;
finally
Free;
end;
except
on E: Exception do
begin
Result := False;
ErrorMsg := E.Message;
FTraceControl.SaveTrace(FIDUser, E.Message, Self.ClassName);
end;
end;
FTraceControl.TraceOut;
end;
function TPayment.ValidatePayment: Boolean;
begin
FTraceControl.TraceIn(Self.ClassName + '.ValidatePayment');
Result := FIDPayment = 0;
FTraceControl.TraceOut;
end;
function TPayment.GetNewIDPayment: Integer;
begin
FTraceControl.TraceIn(Self.ClassName + '.GetNewIDLancamento');
Result := 0;
with TADOStoredProc.Create(nil) do
try
Connection := FADOConnection;
ProcedureName := 'sp_Sis_GetNextCode;1';
Parameters.Refresh;
Parameters.ParamByName('@Tabela').Value := 'Fin_Lancamento.IDLancamento';
ExecProc;
Result := Parameters.ParamByName('@NovoCodigo').Value;
finally
Free;
end;
FTraceControl.TraceOut;
end;
procedure TPayment.UpdateCashRegMov;
begin
FTraceControl.TraceIn(Self.ClassName + '.ValidatePayment');
if (FIDCashRegMov <> 0) and CanUpdateCashregMov then
begin
with TADOCommand.Create(nil) do
try
Connection := FADOConnection;
CommandText := 'UPDATE CashRegMov ' +
'SET TotalSales = IsNull(TotalSales, 0) + ROUND(IsNull(:Value,0),2) ' +
'WHERE IDCashRegMov = :IDCashRegMov';
Parameters.ParamByName('IDCashRegMov').Value := FIDCashRegMov;
Parameters.ParamByName('Value').Value := FPaymentValue;
Execute;
finally
Free;
end;
end;
FTraceControl.TraceOut;
end;
function TPayment.GetPaymentType: Integer;
begin
Result := PAYMENT_TYPE_CASH;
end;
function TPayment.GetSQLFields: String;
var
IDField: String;
begin
case FDocumentType of
dtInvoice: IDField := 'IDPreSale';
dtServiceOrder: IDField := 'IDServiceOrder';
end;
Result := 'IDLancamento,' +
IDField + ',' +
'IDCashRegMov,' +
'IDEmpresa,' +
'IDPessoa,' +
'IDUsuarioLancamento,' +
'IDLancamentoTipo,' +
'IDCentroCusto,' +
'IDContaCorrentePrevista,' +
'Pagando,' +
'IDQuitacaoMeioPrevisto,' +
'DataLancamento,' +
'DataVencimento,' +
'ValorNominal,' +
'Situacao';
end;
function TPayment.GetInsertParameters: String;
begin
Result := ':' + StringReplace(GetSQLFields, ',', ',:', [rfReplaceAll]);
end;
procedure TPayment.SetDefaultValues;
begin
FTraceControl.TraceIn(Self.ClassName + '.SetDefaultValues');
with TADODataSet.Create(nil) do
try
Connection := FADOConnection;
CommandText := 'SELECT ' +
' S.IDCentroCusto, ' +
' MPS.IDContaCorrente, ' +
' S.IDEmpresa, ' +
' MP.IDLancamentoTipo ' +
'FROM ' +
' Store S (NOLOCK) ' +
' JOIN MeioPagToStore MPS (NOLOCK) ON (S.IDStore = MPS.IDStore) ' +
' JOIN MeioPag MP (NOLOCK) ON (MPS.IDMeioPag = MP.IDMeioPag) ' +
'WHERE ' +
' S.IDStore = :IDStore ' +
' AND MPS.IDMeioPag = :IDMeioPag';
Parameters.ParamByName('IDStore').Value := FIDStore;
Parameters.ParamByName('IDMeioPag').Value := FIDPaymentType;
Open;
FIDCentroCusto := FieldByName('IDCentroCusto').AsInteger;
FIDContaCorrente := FieldByName('IDContaCorrente').AsInteger;
FIDLancamentoTipo := FieldByName('IDLancamentoTipo').AsInteger;
FIDEmpresa := FieldByName('IDEmpresa').AsInteger;
finally
Free;
end;
FTraceControl.TraceOut;
end;
procedure TPayment.OnProcessPayment;
begin
// para ser herdado
end;
procedure TPayment.FillParameters(ACmdPayment: TADOCommand);
begin
with ACmdPayment do
begin
Parameters.ParamByName('IDLancamento').Value := FIDPayment;
case FDocumentType of
dtInvoice:
begin
Parameters.ParamByName('IDPreSale').Value := FIDPreSale;
end;
dtServiceOrder:
begin
Parameters.ParamByName('IDServiceOrder').Value := FIDServiceOrder;
end;
end;
Parameters.ParamByName('IDCashRegMov').Value := FIDCashRegMov;
Parameters.ParamByName('IDEmpresa').Value := FIDEmpresa;
Parameters.ParamByName('IDPessoa').Value := FIDCustomer;
Parameters.ParamByName('IDUsuarioLancamento').Value := FIDUser;
Parameters.ParamByName('IDLancamentoTipo').Value := FIDLancamentoTipo;
Parameters.ParamByName('IDCentroCusto').Value := FIDCentroCusto;
Parameters.ParamByName('IDContaCorrentePrevista').Value := FIDContaCorrente;
Parameters.ParamByName('Pagando').Value := 0;
// # changing this point to get IDquitacaoMeioPrevisto based on mapping in client parameter
parameters.ParamByName('IDQuitacaoMeioPrevisto').Value := getIdMeioPrevisto();
(*
//amfsouza 04.15.2011
if ( FSaveIdPaymentDebitCard > 0 ) then
Parameters.ParamByName('IDQuitacaoMeioPrevisto').Value := FSaveIdPaymentDebitCard
else
Parameters.ParamByName('IDQuitacaoMeioPrevisto').Value := FIDPaymentType;
*)
Parameters.ParamByName('DataLancamento').Value := FPaymentDate;
Parameters.ParamByName('DataVencimento').Value := FPaymentDate;
Parameters.ParamByName('ValorNominal').Value := FPaymentValue;
Parameters.ParamByName('Situacao').Value := 1;
end;
end;
procedure TPayment.AfterProcessPayment;
begin
// para ser herdado
end;
procedure TPayment.BeforeProcessPayment;
begin
// para ser herdado
end;
procedure TPayment.LoadPayment;
var
DSPayment: TADODataSet;
begin
FTraceControl.TraceIn(Self.ClassName + '.LoadPayment');
DSPayment := TADODataSet.Create(nil);
with DSPayment do
try
Connection := FADOConnection;
case FDocumentType of
dtInvoice: CommandText := 'SELECT ' + StringReplace(GetSQLFields, 'IDPreSale', 'L.IDPreSale', [rfReplaceAll]) + ',IDStore' +
' FROM Fin_Lancamento L (NOLOCK) ' +
' JOIN Invoice I (NOLOCK) ON (L.IDPresale = I.IDPreSale)' +
' WHERE L.IDLancamento = :IDLancamento';
dtServiceOrder: CommandText := 'SELECT ' + StringReplace(GetSQLFields, 'IDServiceOrder', 'L.IDServiceOrder', [rfReplaceAll]) + ',IDStore' +
' FROM Fin_Lancamento L (NOLOCK) ' +
' JOIN Ser_ServiceOrder S (NOLOCK) ON (L.IDServiceOrder = S.IDServiceOrder)' +
' WHERE L.IDLancamento = :IDLancamento';
end;
Parameters.ParamByName('IDLancamento').Value := FIDPayment;
Open;
if not IsEmpty then
SetProperties(DSPayment);
finally
Free;
end;
FTraceControl.TraceOut;
end;
procedure TPayment.SetProperties(ADSPayment: TADODataSet);
begin
FTraceControl.TraceIn(Self.ClassName + '.SetProperties');
with ADSPayment do
begin
FIDStore := FieldByName('IDStore').AsInteger;
FIDCashRegMov := FieldByName('IDCashRegMov').AsInteger;
FIDCustomer := FieldByName('IDPessoa').AsInteger;
FPaymentDate := FieldByName('DataLancamento').AsDateTime;
FIDCentroCusto := FieldByName('IDCentroCusto').AsInteger;
FIDContaCorrente := FieldByName('IDContaCorrentePrevista').AsInteger;
FIDEmpresa := FieldByName('IDEmpresa').AsInteger;
FIDUser := FieldByName('IDUsuarioLancamento').AsInteger;
case FDocumentType of
dtInvoice: FIDPreSale := FieldByName('IDPreSale').AsInteger;
dtServiceOrder: FIDServiceOrder := FieldByName('IDServiceOrder').AsInteger;
end;
FIDPaymentType := FieldByName('IDQuitacaoMeioPrevisto').AsInteger;
FPaymentValue := FieldByName('ValorNominal').AsCurrency;
end;
FTraceControl.TraceOut;
end;
function TPayment.GetAutoProcess: Boolean;
begin
Result := False;
end;
procedure TPayment.BeforeDeletePayment;
begin
// para ser herdado
end;
function TPayment.CanUpdateCashregMov: Boolean;
begin
Result := True;
end;
procedure TPayment.setSaveIdPaymentDebitCard(const Value: integer);
begin
FSaveIdPaymentDebitCard := value;
end;
procedure TPayment.setIdMeioPrevisto(arg_cardType: String);
var
processor, cardID: String;
idMeioPag: Integer;
select: TADOQuery;
saveIdPaymentType: Integer;
begin
try
try
saveIdPaymentType := FIDPaymentType;
select := TADOQuery.Create(nil);
select.Connection := FADOConnection;
select.sql.add('select IdMeioPag from MeioPag where meiopag = :param_meiopag');
select.Parameters.ParamByName('param_meiopag').Value := arg_cardType;
select.Open;
if ( not select.IsEmpty ) then begin
idMeioPag := select.fieldByName('IDMeioPag').Value;
// Alex 09/27/2015
//FIDPayment := idMeioPag;
FIDPaymentType := idMeioPag;
end;
except
on e: Exception do begin
FIDPaymentType := saveIdPaymentType;
end;
end;
finally
freeAndNil(select);
end;
end;
function TPayment.getIdMeioPrevisto: Integer;
begin
result := FIDPaymentType;
end;
end.
|
unit UnitPrintPreview;
// ------------------------------------------------------------------------------
//
// SVG Control Package 2.0
// Copyright (c) 2015 Bruno Verhue
//
// ------------------------------------------------------------------------------
// The SVG Editor need at least version v2.40 update 9 of the SVG library
interface
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
System.Variants,
System.Classes,
System.Actions,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ActnList,
Vcl.PlatformDefaultStyleActnCtrls,
Vcl.ActnMan,
Vcl.StdCtrls,
Vcl.ExtCtrls,
BVE.SVGPrintPreviewFormVCL;
type
TfrmPrintPreview = class(TSVGPrintPreviewForm)
Panel1: TPanel;
Splitter1: TSplitter;
PageSetupDialog1: TPageSetupDialog;
eOutputDevice: TEdit;
Label1: TLabel;
Button1: TButton;
ActionManager1: TActionManager;
aOrientationLandscape: TAction;
aOrientationPortait: TAction;
aPrint: TAction;
aCancel: TAction;
aPrinterSelect: TAction;
Panel2: TPanel;
Button2: TButton;
Button3: TButton;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label2: TLabel;
Label3: TLabel;
ePagesHorizontal: TEdit;
ePagesVertical: TEdit;
eMarginTop: TEdit;
eMarginRight: TEdit;
eMarginBottom: TEdit;
eGlueEdge: TEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
cbUnits: TComboBox;
GroupBox3: TGroupBox;
cbAutoViewbox: TCheckBox;
cbAlign: TComboBox;
cbMeetOrSlice: TComboBox;
Label10: TLabel;
Label11: TLabel;
eMarginLeft: TEdit;
GroupBox4: TGroupBox;
cbIdenticalMargins: TCheckBox;
aIdenticalMargins: TAction;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmPrintPreview: TfrmPrintPreview;
implementation
uses
UnitEditor;
{$R *.dfm}
procedure TfrmPrintPreview.FormCreate(Sender: TObject);
begin
ActionOrientationLandscape := aOrientationLandscape;
ActionOrientationPortait := aOrientationPortait;
ActionPrint := aPrint;
ActionCancel := aCancel;
ActionPrinterSelect := aPrinterSelect;
ActionIdenticalMargins := aIdenticalMargins;
ComboBoxUnits := cbUnits;
CheckBoxAutoViewbox := cbAutoViewBox;
ComboBoxAlign := cbAlign;
ComboBoxMeetOrSlice := cbMeetOrSlice;
EditOutputDevice := eOutputDevice;
EditPagesHorizontal := ePagesHorizontal;
EditPagesVertical := ePagesVertical;
EditMarginLeft := eMarginLeft;
EditMarginTop := eMarginTop;
EditMarginRight := eMarginRight;
EditMarginBottom := eMarginBottom;
EditGlueEdge := eGlueEdge;
frmEditor.FormPrintPreview := Self;
end;
end.
|
unit RegistrationFrm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels,
cxLookAndFeelPainters, cxContainer, cxEdit, Vcl.Menus, Vcl.StdCtrls,
cxButtons, cxTextEdit, dxGDIPlusClasses, Vcl.ExtCtrls, cxLabel;
type
TfrmRegistration = class(TForm)
eName: TcxTextEdit;
bRegister: TcxButton;
Image1: TImage;
lVersion: TcxLabel;
procedure bRegisterClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmRegistration: TfrmRegistration;
implementation
uses
TarockDM, WiRL.http.Client.Interfaces;
{$R *.dfm}
procedure TfrmRegistration.bRegisterClick(Sender: TObject);
begin
if Trim(eName.Text)='' then Exit;
Screen.Cursor:=crHourGlass;
try
while true do begin
try
if dm.RegisterPlayer(eName.Text) then
Break
else
Exit;
except
on E:EWiRLSocketException do
dm.ReactiveServerConnection;
else Raise;
end;
end;
dm.MyName:=eName.Text;
ModalResult:=mrOk;
finally
Screen.Cursor:=crDefault;
end;
end;
end.
|
unit GenuisUnit;
interface
uses
Forms,mainForm,Classes,Windows,activex;
type
TBxGenuis = class(TObject)
constructor Create;
private
fDisplayForm : TfrmGenius;
fTick:Integer; //执行两次step所花费的时间
fStepItExecuted:Boolean; //保证一次循环只调用一次stepit
fPredictCount:Integer; //预测时间
protected
public
procedure Start; //以Form的方式创建显示精灵窗体
procedure StartPredict(loopCount:Integer);//调用时用必须要在后面加上Application.ProcessMessages;
procedure Stop;
procedure SetMessage(aMsg:string='加载中...'); //设置窗体显示的等待信息标签,该字符串不能太长
procedure SetTitle(aTitle:string='管家婆'); //设置窗体表头
procedure SetDefaultGIFPath(GIFPath:string); //设置显示GIF的默认路径
end;
var
Genuis : TBxGenuis;
implementation
uses
SysUtils;
{ TBxGenuis }
constructor TBxGenuis.Create;
begin
CoInitialize(nil); //加载COM对象时必须添加的这句话,作用是初始化OLE对象
fDisplayForm := TfrmGenius.Create(nil);
fPredictCount:=0;
fTick:=0;
fStepItExecuted:=False;
SetMessage;
end;
procedure TBxGenuis.SetDefaultGIFPath(GIFPath: string);
begin
fDisplayForm.DefaultGifPath:=GIFPath;
end;
procedure TBxGenuis.SetMessage(aMsg: string);
begin
fDisplayForm.lblMsg.Caption := aMsg;
end;
procedure TBxGenuis.SetTitle(aTitle: string);
begin
fDisplayForm.lblTitle.Caption := aTitle;
end;
procedure TBxGenuis.Start;
begin
fDisplayForm.StartCount;
fPredictCount:=0;
fTick:=0;
fStepItExecuted:=False;
end;
//根据循环次数估计整个循环用时,并判断是否显示等待窗体
procedure TBxGenuis.StartPredict(loopCount:Integer); //该函数只执行两次,第一次记录开始时刻,第二次算出一次循环所花费的时间总数
begin
if not fStepItExecuted then
begin
if fTick=0 then
fTick:=GetTickCount
else
begin
fTick:= GetTickCount-fTick;
fStepItExecuted:=True;
fPredictCount:= fTick * loopCount;
fDisplayForm.StartPredict(fPredictCount);
end;
end
else if fTick<>0 then
fTick:=0;
end;
procedure TBxGenuis.Stop;
begin
fDisplayForm.TaskFinished := True;
fTick:=0;
fStepItExecuted:=False;
end;
initialization
Genuis := TBxGenuis.Create;
end.
|
unit processsharedstring;
interface
uses
SysUtils,
Classes,
Windows;
type
TProcessSharedAnsiString = class
private
FIdentifier: AnsiString;
MappedFileSentry: THandle;
MappingHandle: THandle;
function MapView(Count: Int64): Pointer;
function UnmapView(Ptr: Pointer): Boolean;
function GetValue: AnsiString;
procedure SetValue(const Value: AnsiString);
procedure AcquireMutex;
procedure ReleaseMutex;
public
constructor Create(GlobalName: AnsiString);
destructor Destroy; override;
property Value: AnsiString read GetValue write SetValue;
procedure Lock;
procedure Unlock;
end;
implementation
const
MappedFileSize = 16384;
{ TProcessSharedAnsiString }
procedure TProcessSharedAnsiString.AcquireMutex;
begin
WaitForSingleObject(MappedFileSentry, INFINITE);
end;
constructor TProcessSharedAnsiString.Create(GlobalName: AnsiString);
begin
inherited Create;
MappedFileSentry := CreateMutex(nil, False, '7B31BF45-60D3-4F07-8308-DD7FEC8D065B');
AcquireMutex;
try
MappingHandle := OpenFileMapping(FILE_MAP_ALL_ACCESS, False, PAnsiChar(GlobalName));
if MappingHandle = 0 then
begin
MappingHandle := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0,
MappedFileSize, PAnsiChar(GlobalName));
SetValue('');
end;
finally
ReleaseMutex;
end;
FIdentifier := GlobalName;
end;
destructor TProcessSharedAnsiString.Destroy;
begin
CloseHandle(MappedFileSentry);
inherited;
end;
function TProcessSharedAnsiString.GetValue: AnsiString;
var
P: Pointer;
J: Integer;
begin
Result := '';
AcquireMutex;
try
P := MapView(MappedFileSize);
if P <> nil then
try
SetLength(Result, Integer(P^));
Cardinal(P) := Cardinal(P) + 4;
for J := 1 to Length(Result) do
begin
Result[J] := AnsiChar(P^);
Cardinal(P) := Cardinal(P) + 1;
end;
finally
UnmapView(P);
end;
finally
ReleaseMutex;
end;
end;
procedure TProcessSharedAnsiString.Lock;
begin
AcquireMutex;
end;
function TProcessSharedAnsiString.MapView(Count: Int64): Pointer;
begin
Result := MapViewOfFile(MappingHandle, FILE_MAP_ALL_ACCESS, 0, 0, Count);
if Result = nil then
raise Exception.Create('Could not map view of file: ' + FIdentifier);
end;
procedure TProcessSharedAnsiString.ReleaseMutex;
begin
Windows.ReleaseMutex(MappedFileSentry);
end;
procedure TProcessSharedAnsiString.SetValue(const Value: AnsiString);
var
P: Pointer;
I, J: Integer;
begin
AcquireMutex;
try
P := MapView(MappedFileSize);
if P <> nil then
try
I := Length(Value);
if I > MappedFileSize - 4 then
I := MappedFileSize - 4;
Integer(P^) := I;
Cardinal(P) := Cardinal(P) + 4;
for J := 1 to I do
begin
AnsiChar(P^) := Value[J];
Cardinal(P) := Cardinal(P) + 1;
end;
finally
UnmapView(P);
end;
finally
ReleaseMutex;
end;
end;
procedure TProcessSharedAnsiString.Unlock;
begin
ReleaseMutex;
end;
function TProcessSharedAnsiString.UnmapView(Ptr: Pointer): Boolean;
begin
Result := UnmapViewOfFile(Ptr);
end;
end.
|
namespace com.example.android.snake;
{*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*}
interface
uses
android.content,
android.content.res,
android.graphics,
android.graphics.drawable,
android.os,
android.util,
android.view,
org.w3c.dom;
type
/// <summary>
/// TileView: a View-variant designed for handling arrays of "icons" or other
/// drawables.
/// </summary>
TileView = public class(View)
protected
// Parameters controlling the size of the tiles and their range within view.
// Width/Height are in pixels, and Drawables will be scaled to fit to these
// dimensions. X/Y Tile Counts are the number of tiles that will be drawn.
class var mTileSize: Integer;
class var mXTileCount: Integer;
class var mYTileCount: Integer;
private
class var mXOffset: Integer;
class var mYOffset: Integer;
// A hash that maps integer handles specified by the subclasser to the
// drawable that will be used for that reference
var mTileArray: array of Bitmap;
// A two-dimensional array of integers in which the number represents the
// index of the tile that should be drawn at that locations
var mTileGrid: array of array of Integer;
var mPaint: Paint := new Paint(); readonly;
public
constructor(context: Context; attrs: AttributeSet; defStyle: Integer);
constructor(context: Context; attrs: AttributeSet);
method resetTiles(tilecount: Integer);
protected
method onSizeChanged(w: Integer; h: Integer; oldw: Integer; oldh: Integer); override;
public
method loadTile(key: Integer; tile: Drawable);
method clearTiles();
method setTile(tileindex: Integer; x: Integer; y: Integer);
method onDraw(canvas: Canvas); override;
end;
implementation
constructor TileView(context: Context; attrs: AttributeSet; defStyle: Integer);
begin
inherited constructor (context, attrs, defStyle);
var a: TypedArray := context.obtainStyledAttributes(attrs, R.styleable.TileView);
mTileSize := a.Int[R.styleable.TileView_tileSize, 12];
a.recycle
end;
constructor TileView(context: Context; attrs: AttributeSet);
begin
inherited constructor (context, attrs);
var a: TypedArray := context.obtainStyledAttributes(attrs, R.styleable.TileView);
mTileSize := a.Int[R.styleable.TileView_tileSize, 12];
a.recycle
end;
/// <summary>
/// Rests the internal array of Bitmaps used for drawing tiles, and
/// sets the maximum index of tiles to be inserted
/// </summary>
/// <param name="tilecount"></param>
method TileView.resetTiles(tilecount: Integer);
begin
mTileArray := new Bitmap[tilecount]
end;
method TileView.onSizeChanged(w: Integer; h: Integer; oldw: Integer; oldh: Integer);
begin
mXTileCount := Integer(Math.floor(w div mTileSize));
mYTileCount := Integer(Math.floor(h div mTileSize));
mXOffset := (w - mTileSize * mXTileCount) div 2;
mYOffset := (h - mTileSize * mYTileCount) div 2;
mTileGrid := new array of Integer[mXTileCount];
for i: Integer := 0 to pred(mTileGrid.length) do
mTileGrid[i] := new Integer[mYTileCount];
clearTiles
end;
/// <summary>
/// Function to set the specified Drawable as the tile for a particular
/// integer key.
/// </summary>
/// <param name="key"></param>
/// <param name="tile"></param>
method TileView.loadTile(key: Integer; tile: Drawable);
begin
var lBitmap: Bitmap := Bitmap.createBitmap(mTileSize, mTileSize, Bitmap.Config.ARGB_8888);
var canvas: Canvas := new Canvas(lBitmap);
tile.setBounds(0, 0, mTileSize, mTileSize);
tile.draw(canvas);
mTileArray[key] := lBitmap
end;
/// <summary>
/// Resets all tiles to 0 (empty)
/// </summary>
method TileView.clearTiles();
begin
for x: Integer := 0 to pred(mXTileCount) do
for y: Integer := 0 to pred(mYTileCount) do
setTile(0, x, y);
end;
/// <summary>
/// Used to indicate that a particular tile (set with loadTile and referenced
/// by an integer) should be drawn at the given x/y coordinates during the
/// next invalidate/draw cycle.
/// </summary>
/// <param name="tileindex"></param>
/// <param name="x"></param>
/// <param name="y"></param>
method TileView.setTile(tileindex: Integer; x: Integer; y: Integer);
begin
mTileGrid[x][y] := tileindex
end;
method TileView.onDraw(canvas: Canvas);
begin
inherited onDraw(canvas);
for x: Integer := 0 to pred(mXTileCount) do
for y: Integer := 0 to pred(mYTileCount) do
if mTileGrid[x][y] > 0 then
canvas.drawBitmap(mTileArray[mTileGrid[x][y]],
mXOffset + x * mTileSize,
mYOffset + y * mTileSize,
mPaint)
end;
end. |
{
SuperMaximo GameLibrary : Music class unit
by Max Foster
License : http://creativecommons.org/licenses/by/3.0/
}
unit MusicClass;
{$mode objfpc}{$H+}
interface
uses SDL_mixer;
type
PMusic = ^TMusic;
TMusic = object
strict private
mixMusic : PMix_Music;
name_ : string;
public
//Load music with the specified name from the file provided
constructor create(newName, fileName : string);
destructor destroy;
function name : string;
procedure play;
end;
function music(searchName : string) : PMusic;
function addMusic(newName, fileName : string) : PMusic;
procedure destroyMusic(searchName : string);
procedure destroyAllMusic;
implementation
uses SysUtils, Classes;
var
allMusic : array['a'..'z'] of TList;
constructor TMusic.create(newName, fileName : string);
begin
name_ := newName;
mixMusic := Mix_LoadMUS(pchar(setDirSeparators(fileName)));
end;
destructor TMusic.destroy;
begin
Mix_FreeMusic(mixMusic);
end;
function TMusic.name : string;
begin
result := name_;
end;
procedure TMusic.play;
begin
Mix_PlayMusic(mixMusic, -1);
end;
function music(searchName : string) : PMusic;
var
letter : char;
i : word;
tempMusic : PMusic;
begin
letter := searchName[1];
result := nil;
if (allMusic[letter].count > 0) then
begin
for i := 0 to allMusic[letter].count-1 do
begin
tempMusic := PMusic(allMusic[letter][i]);
if (tempMusic^.name = searchName) then result := tempMusic;
end;
end;
end;
function addMusic(newName, fileName : string) : PMusic;
var
letter : char;
begin
letter := newName[1];
allMusic[letter].add(new(PMusic, create(newName, fileName)));
result := allMusic[letter].last;
end;
procedure destroyMusic(searchName : string);
var
letter : char;
i : word;
tempMusic : PMusic;
begin
letter := searchName[1];
if (allMusic[letter].count > 0) then
begin
for i := 0 to allMusic[letter].count-1 do
begin
tempMusic := PMusic(allMusic[letter][i]);
if (tempMusic^.name = searchName) then
begin
dispose(tempMusic, destroy);
allMusic[letter].delete(i);
break;
end;
end;
end;
end;
procedure destroyAllMusic;
var
i : char;
j : integer;
tempMusic : PMusic;
begin
for i := 'a' to 'z' do
begin
if (allMusic[i].count > 0) then
begin
for j := 0 to allMusic[i].count-1 do
begin
tempMusic := PMusic(allMusic[i][j]);
dispose(tempMusic, destroy);
end;
allMusic[i].clear;
end;
end;
end;
procedure initializeAllMusic;
var
i : char;
begin
for i := 'a' to 'z' do
begin
allMusic[i] := TList.create;
end;
end;
procedure finalizeAllMusic;
var
i : char;
begin
for i := 'a' to 'z' do
begin
allMusic[i].destroy;
end;
end;
initialization
initializeAllMusic;
finalization
finalizeAllMusic;
end.
|
unit UnitSizeResizerForm;
interface
uses
Windows,
Messages,
System.SysUtils,
System.Classes,
System.Math,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.AppEvnts,
Vcl.Themes,
Vcl.StdCtrls,
Vcl.ExtCtrls,
Vcl.ComCtrls,
Vcl.ImgList,
Vcl.Imaging.JPEG,
UnitDBDeclare,
UnitDBFileDialogs,
UnitPropeccedFilesSupport,
Dmitry.Utils.Files,
Dmitry.Controls.Base,
Dmitry.Controls.LoadingSign,
Dmitry.Controls.DmProgress,
Dmitry.Controls.WebLink,
Dmitry.Controls.SaveWindowPos,
Dmitry.Controls.PathEditor,
Dmitry.Controls.ImButton,
uBitmapUtils,
uDBForm,
uW7TaskBar,
uWatermarkOptions,
uAssociations,
uThreadForm,
uMemory,
uSettings,
uConstants,
uShellIntegration,
uRuntime,
uResources,
uLogger,
uDBThread,
uDBContext,
uDBEntities,
uDBManager,
uPortableDeviceUtils,
uThemesUtils,
uProgramStatInfo,
uFormInterfaces,
uCollectionEvents;
const
Settings_ConvertForm = 'Convert settings';
type
TFormSizeResizer = class(TThreadForm, IBatchProcessingForm)
BtOk: TButton;
BtCancel: TButton;
BtSaveAsDefault: TButton;
LbInfo: TLabel;
EdImageName: TEdit;
ImlWatermarkPatterns: TImageList;
LsMain: TLoadingSign;
PrbMain: TDmProgress;
PnOptions: TPanel;
CbWatermark: TCheckBox;
CbConvert: TCheckBox;
DdConvert: TComboBox;
BtJPEGOptions: TButton;
DdRotate: TComboBox;
CbRotate: TCheckBox;
CbResize: TCheckBox;
DdResizeAction: TComboBox;
EdWidth: TEdit;
LbSizeSeparator: TLabel;
EdHeight: TEdit;
CbAspectRatio: TCheckBox;
CbAddSuffix: TCheckBox;
BtChangeDirectory: TButton;
BtWatermarkOptions: TButton;
TmrPreview: TTimer;
WlBack: TWebLink;
WlNext: TWebLink;
PbImage: TPaintBox;
SwpMain: TSaveWindowPos;
AeMain: TApplicationEvents;
PeSavePath: TPathEditor;
procedure BtCancelClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtJPEGOptionsClick(Sender: TObject);
procedure BtOkClick(Sender: TObject);
procedure BtSaveAsDefaultClick(Sender: TObject);
procedure EdWidthExit(Sender: TObject);
procedure EdHeightKeyPress(Sender: TObject; var Key: Char);
procedure BtChangeDirectoryClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure CbConvertClick(Sender: TObject);
procedure CbRotateClick(Sender: TObject);
procedure CbResizeClick(Sender: TObject);
procedure DdResizeActionChange(Sender: TObject);
procedure DdConvertChange(Sender: TObject);
procedure CbWatermarkClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BtWatermarkOptionsClick(Sender: TObject);
procedure DdRotateClick(Sender: TObject);
procedure DdRotateChange(Sender: TObject);
procedure CbAspectRatioClick(Sender: TObject);
procedure TmrPreviewTimer(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure EdImageNameEnter(Sender: TObject);
procedure WlBackClick(Sender: TObject);
procedure WlNextClick(Sender: TObject);
procedure PbImagePaint(Sender: TObject);
procedure PbImageContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure AeMainMessage(var Msg: tagMSG; var Handled: Boolean);
private
{ Private declarations }
FContext: IDBContext;
FData: TMediaItemCollection;
FW7TaskBar: ITaskbarList3;
FDataCount: Integer;
FProcessingParams: TProcessingParams;
FPreviewImage: TBitmap;
FOwner: TDBForm;
FIgnoreInput: Boolean;
FCreatingResize: Boolean;
FCurrentPreviewPosition: Integer;
FRealWidth: Integer;
FRealHeight: Integer;
FProcessingList: TStrings;
FPreviewAvalable: Boolean;
FThreadCount: Integer;
procedure LoadLanguage;
procedure CheckValidForm;
procedure GeneratePreview;
procedure DefaultResize;
procedure DefaultConvert;
procedure DefaultExport;
procedure DoDefaultRotate(RotateValue: Integer; StartImmediately: Boolean);
procedure SetInfo(Owner: TDBForm; List: TMediaItemCollection);
protected
function GetFormID: string; override;
procedure FillProcessingParams;
procedure CreateParams(var Params: TCreateParams); override;
procedure ReadSettings;
procedure UpdateNavigation;
procedure WndProc(var Message: TMessage); override;
procedure CustomFormAfterDisplay; override;
public
{ Public declarations }
destructor Destroy; override;
procedure ThreadEnd(Data: TMediaItem; EndProcessing: Boolean);
procedure UpdatePreview(PreviewImage: TBitmap; FileName: string; RealWidth, RealHeight: Integer);
//IBatchProcessingForm
procedure ExportImages(Owner: TDBForm; List: TMediaItemCollection);
procedure ResizeImages(Owner: TDBForm; List: TMediaItemCollection);
procedure ConvertImages(Owner: TDBForm; List: TMediaItemCollection);
procedure RotateImages(Owner: TDBForm; List: TMediaItemCollection; DefaultRotate: Integer; StartImmediately: Boolean);
end;
const
ConvertImageID = 'ConvertImage';
implementation
uses
uImageConvertThread,
FormManegerUnit,
DBCMenu;
{$R *.dfm}
procedure TFormSizeResizer.ConvertImages(Owner: TDBForm; List: TMediaItemCollection);
begin
SetInfo(Owner, List);
DefaultConvert;
Show;
end;
procedure TFormSizeResizer.ExportImages(Owner: TDBForm; List: TMediaItemCollection);
begin
SetInfo(Owner, List);
DefaultExport;
Show;
end;
procedure TFormSizeResizer.ResizeImages(Owner: TDBForm; List: TMediaItemCollection);
begin
SetInfo(Owner, List);
DefaultResize;
Show;
end;
procedure TFormSizeResizer.RotateImages(Owner: TDBForm; List: TMediaItemCollection;
DefaultRotate: Integer; StartImmediately: Boolean);
begin
SetInfo(Owner, List);
DoDefaultRotate(DefaultRotate, StartImmediately);
if not StartImmediately then
Show;
end;
procedure TFormSizeResizer.AeMainMessage(var Msg: tagMSG; var Handled: Boolean);
var
P: TPoint;
begin
if not Active then
Exit;
if Msg.message = WM_MOUSEWHEEL then
begin
if PrbMain.Visible then
Exit;
GetCursorPos(P);
if PtInRect(PbImage.BoundsRect, Self.ScreenToClient(P)) then
begin
if NativeInt(Msg.WParam) < 0 then
WlNextClick(Self)
else
WlBackClick(Self);
Msg.message := 0;
Handled := True;
end;
end;
end;
procedure TFormSizeResizer.BtCancelClick(Sender: TObject);
begin
Close;
end;
procedure TFormSizeResizer.FillProcessingParams;
const
Rotations: array [-1 .. 3] of Integer = (DB_IMAGE_ROTATE_UNKNOWN, DB_IMAGE_ROTATE_EXIF, DB_IMAGE_ROTATE_270,
DB_IMAGE_ROTATE_90, DB_IMAGE_ROTATE_180);
function GeneratePreffix: string;
begin
Result := '_' + L('processed');
if CbResize.Checked then
Result := '_' + AnsiLowerCase(StringReplace(DdResizeAction.Text, ' ', '_', [rfReplaceAll]));
end;
begin
FProcessingParams.Rotate := CbRotate.Checked;
FProcessingParams.Rotation := Rotations[DdRotate.ItemIndex];
FProcessingParams.Convert := CbConvert.Checked;
if DdConvert.ItemIndex = -1 then
FProcessingParams.GraphicClass := nil
else
FProcessingParams.GraphicClass := TGraphicClass(DdConvert.Items.Objects[DdConvert.ItemIndex]);
FProcessingParams.Resize := CbResize.Checked;
FProcessingParams.ResizeToSize := (DdResizeAction.ItemIndex in [0 .. 6]) or
(DdResizeAction.ItemIndex = DdResizeAction.Items.Count - 1);
if (FProcessingParams.ResizeToSize) then
begin
case DdResizeAction.ItemIndex of
0:
begin
FProcessingParams.Width := 1920;
FProcessingParams.Height := 1080;
end;
1:
begin
FProcessingParams.Width := 1280;
FProcessingParams.Height := 720;
end;
2:
begin
FProcessingParams.Width := 1024;
FProcessingParams.Height := 768;
end;
3:
begin
FProcessingParams.Width := 800;
FProcessingParams.Height := 600;
end;
4:
begin
FProcessingParams.Width := 640;
FProcessingParams.Height := 480;
end;
5:
begin
FProcessingParams.Width := 320;
FProcessingParams.Height := 240;
end;
6:
begin
FProcessingParams.Width := 128;
FProcessingParams.Height := 124;
end;
else
FProcessingParams.Width := Min(Max(StrToIntDef(EdWidth.Text, 100), 5), 5000);
FProcessingParams.Height := Min(Max(StrToIntDef(EdHeight.Text, 100), 5), 5000);
end;
end else
begin
FProcessingParams.PercentResize := 100;
case DdResizeAction.ItemIndex - 7 of
0:
FProcessingParams.PercentResize := 25;
1:
FProcessingParams.PercentResize := 50;
2:
FProcessingParams.PercentResize := 75;
3:
FProcessingParams.PercentResize := 150;
4:
FProcessingParams.PercentResize := 200;
5:
FProcessingParams.PercentResize := 400;
end;
end;
FProcessingParams.AddWatermark := CbWatermark.Checked;
if CbWatermark.Checked then
begin
FProcessingParams.WatermarkOptions.Text := AppSettings.ReadString(Settings_Watermark, 'Text', L('Sample text'));
FProcessingParams.WatermarkOptions.Color := AppSettings.ReadInteger(Settings_Watermark, 'Color', clWhite);
FProcessingParams.WatermarkOptions.Transparenty := AppSettings.ReadInteger(Settings_Watermark, 'Transparency', 25);
FProcessingParams.WatermarkOptions.BlockCountX := AppSettings.ReadInteger(Settings_Watermark, 'BlocksX', 3);
FProcessingParams.WatermarkOptions.BlockCountY := AppSettings.ReadInteger(Settings_Watermark, 'BlocksY', 3);
FProcessingParams.WatermarkOptions.FontName := AppSettings.ReadString(Settings_Watermark, 'Font', 'Arial');
if AppSettings.ReadInteger(Settings_Watermark, 'Mode', 0) = 0 then
FProcessingParams.WatermarkOptions.DrawMode := WModeImage
else
FProcessingParams.WatermarkOptions.DrawMode := WModeText;
FProcessingParams.WatermarkOptions.KeepProportions := AppSettings.ReadBool(Settings_Watermark, 'KeepProportions', True);
FProcessingParams.WatermarkOptions.StartPoint.X := AppSettings.ReadInteger(Settings_Watermark, 'ImageStartX', 25);
FProcessingParams.WatermarkOptions.StartPoint.Y := AppSettings.ReadInteger(Settings_Watermark, 'ImageStartY', 25);
FProcessingParams.WatermarkOptions.EndPoint.X := AppSettings.ReadInteger(Settings_Watermark, 'ImageEndX', 75);
FProcessingParams.WatermarkOptions.EndPoint.Y := AppSettings.ReadInteger(Settings_Watermark, 'ImageEndY', 75);
FProcessingParams.WatermarkOptions.ImageFile := AppSettings.ReadString(Settings_Watermark, 'WatermarkImage');
FProcessingParams.WatermarkOptions.ImageTransparency := Round(AppSettings.ReadInteger(Settings_Watermark, 'ImageTransparency', 50) * 255 / 100);
end;
FProcessingParams.SaveAspectRation := CbAspectRatio.Checked;
if CbAddSuffix.Checked then
FProcessingParams.Preffix := GeneratePreffix
else
FProcessingParams.Preffix := '';
FProcessingParams.WorkDirectory := PeSavePath.Path;
end;
procedure TFormSizeResizer.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Release;
end;
procedure TFormSizeResizer.FormCreate(Sender: TObject);
var
I: Integer;
Description, Mask: string;
Ext: TFileAssociation;
PathImage: TBitmap;
begin
FContext := DBManager.DBContext;
FCreatingResize := True;
FIgnoreInput := False;
FPreviewImage := nil;
DoubleBuffered := True;
RegisterMainForm(Self);
LoadLanguage;
FData := TMediaItemCollection.Create;
FProcessingList := TStringList.Create;
FCurrentPreviewPosition := 0;
for I := 0 to TFileAssociations.Instance.Count - 1 do
begin
Ext := TFileAssociations.Instance[I];
if Ext.CanSave then
begin
Description := Ext.Description;
Mask := '*' + Ext.Extension;
DdConvert.Items.AddObject(Description + ' (' + Mask + ')', TObject(Ext.GraphicClass));
end;
end;
DdConvert.ItemIndex := 0;
DdRotate.ItemIndex := 0;
DdResizeAction.ItemIndex := 0;
ReadSettings;
SetStretchBltMode(PbImage.Canvas.Handle, STRETCH_HALFTONE);
FRealWidth := 0;
FRealHeight := 0;
FW7TaskBar := CreateTaskBarInstance;
SwpMain.Key := RegRoot + 'ConvertForm';
SwpMain.SetPosition;
LsMain.Color := Theme.WindowColor;
PathImage := GetPathSeparatorImage;
try
PeSavePath.SeparatorImage := PathImage;
finally
F(PathImage);
end;
end;
destructor TFormSizeResizer.Destroy;
begin
F(FData);
F(FProcessingList);
inherited;
end;
procedure TFormSizeResizer.FormDestroy(Sender: TObject);
var
I: Integer;
EventInfo: TEventValues;
begin
TmrPreview.Enabled := False;
if FProcessingList.Count > 0 then
begin
for I := 0 to FProcessingList.Count - 1 do
ProcessedFilesCollection.RemoveFile(FProcessingList[I]);
CollectionEvents.DoIDEvent(Self, 0, [EventID_Repaint_ImageList], EventInfo);
end;
F(FPreviewImage);
UnRegisterMainForm(Self);
SwpMain.SavePosition;
FContext := nil;
end;
procedure TFormSizeResizer.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Screen.ActiveControl <> nil then
if Screen.ActiveControl.Parent <> nil then
if Screen.ActiveControl.Parent.Parent = PeSavePath then
Exit;
if Key = VK_ESCAPE then
Close;
if Key = VK_RETURN then
BtOkClick(Sender);
end;
procedure TFormSizeResizer.FormResize(Sender: TObject);
begin
if FCreatingResize then
begin
FCreatingResize := False;
Exit;
end;
GeneratePreview;
end;
procedure TFormSizeResizer.GeneratePreview;
begin
if not FIgnoreInput then
begin
TmrPreview.Enabled := False;
TmrPreview.Interval := 200;
TmrPreview.Enabled := True;
end;
end;
function TFormSizeResizer.GetFormID: string;
begin
Result := ConvertImageID;
end;
procedure TFormSizeResizer.BtJPEGOptionsClick(Sender: TObject);
begin
JpegOptionsForm.Execute(ConvertImageID);
CheckValidForm;
end;
procedure TFormSizeResizer.BtOkClick(Sender: TObject);
var
I: Integer;
EventInfo: TEventValues;
function CheckFileTypes: Boolean;
var
I: Integer;
begin
Result := True;
for I := 0 to FData.Count - 1 do
Result := Result and TFileAssociations.Instance.IsConvertableExt(ExtractFileExt(FData[I].FileName));
end;
begin
if not CheckFileTypes and (DdConvert.ItemIndex < 0) then
begin
MessageBoxDB(Handle, L('Please, choose format!'), L('Warning'), TD_BUTTON_OK, TD_ICON_WARNING);
Exit;
end;
if IsDevicePath(PeSavePath.Path) then
begin
MessageBoxDB(Handle, L('Please, choose a valid directory!'), L('Warning'), TD_BUTTON_OK, TD_ICON_WARNING);
BtChangeDirectoryClick(Self);
Exit;
end;
CreateDirA(PeSavePath.Path);
if not DirectoryExistsSafe(PeSavePath.Path) then
begin
MessageBoxDB(Handle, L('Please, choose a valid directory!'), L('Warning'), TD_BUTTON_OK, TD_ICON_WARNING);
BtChangeDirectoryClick(Self);
Exit;
end;
FThreadCount := 0;
for I := 0 to FData.Count - 1 do
begin
ProcessedFilesCollection.AddFile(FData[I].FileName);
FProcessingList.Add(AnsiLOwerCase(FData[I].FileName));
end;
CollectionEvents.DoIDEvent(Self, 0, [EventID_Repaint_ImageList], EventInfo);
//statistics
ProgramStatistics.ConverterUsed;
// change form state
PnOptions.Hide;
BtSaveAsDefault.Hide;
BtOk.Hide;
PrbMain.Top := BtCancel.Top - BtCancel.Height - 5;
PrbMain.Show;
EdImageName.Top := PrbMain.Top - EdImageName.Height - 5;
WlNext.Enabled := False;
WlBack.Enabled := False;
WlNext.Top := EdImageName.Top - 2;
WlBack.Top := EdImageName.Top - 2;
PbImage.Height := EdImageName.Top - 5 - PbImage.Top;
BtCancel.Left := PrbMain.Left + PrbMain.Width - BtCancel.Width;
ClientHeight := ClientHeight - PnOptions.Height - 5;
// init progress
LsMain.Show;
FDataCount := FData.Count;
if FW7TaskBar <> nil then
begin
FW7TaskBar.SetProgressState(Handle, TBPF_NORMAL);
FW7TaskBar.SetProgressValue(Handle, FDataCount - FData.Count, FDataCount);
end;
PrbMain.MaxValue := FDataCount;
// fill params of processing
FillProcessingParams;
if CbWatermark.Checked then
begin
if FProcessingParams.WatermarkOptions.DrawMode = WModeImage then
ProgramStatistics.WatermarkImageUsed
else
ProgramStatistics.WatermarkTextUsed;
end;
NewFormState;
FProcessingParams.PreviewOptions.GeneratePreview := False;
for I := 1 to Min(FData.Count, ProcessorCount) do
begin
Inc(FThreadCount);
TImageConvertThread.Create(Self, StateID, FContext, FData.Extract(0), FProcessingParams);
end;
end;
procedure TFormSizeResizer.SetInfo(Owner: TDBForm; List: TMediaItemCollection);
var
I: Integer;
FWidth, FHeight: Integer;
begin
FOwner := Owner;
for I := 0 to List.Count - 1 do
if List[I].Selected then
begin
FData.Add(List[I].Copy);
if List[I].IsCurrent then
FData.Position := FData.Count - 1;
end;
FCurrentPreviewPosition := FData.Position;
if FData.Count > 0 then
begin
PeSavePath.Path := ExtractFileDir(FData[FCurrentPreviewPosition].FileName);
EdImageName.Text := ExtractFileName(FData[FCurrentPreviewPosition].FileName);
end;
UpdateNavigation;
if (FPreviewImage = nil) then
begin
FPreviewImage := TBitmap.Create;
if TFormCollection.Instance.GetImage(FOwner, FData[FCurrentPreviewPosition].FileName, FPreviewImage, FWidth, FHeight) then
begin
FRealWidth := FWidth;
FRealHeight := FHeight;
PbImage.Repaint;
end else
F(FPreviewImage);
end;
GeneratePreview;
end;
procedure TFormSizeResizer.ThreadEnd(Data: TMediaItem; EndProcessing: Boolean);
var
I: Integer;
begin
Dec(FThreadCount);
PrbMain.Position := FDataCount - FData.Count;
if FW7TaskBar <> nil then
FW7TaskBar.SetProgressValue(Handle, FDataCount - FData.Count, FDataCount);
I := FProcessingList.IndexOf(AnsiLowerCase(Data.FileName));
if I > -1 then
FProcessingList.Delete(I);
FillProcessingParams;
if (FData.Count > 0) and not EndProcessing then
begin
TImageConvertThread.Create(Self, StateID, FContext, FData.Extract(0), FProcessingParams);
Inc(FThreadCount);
end else if (FThreadCount = 0) or EndProcessing then
Close;
end;
procedure TFormSizeResizer.TmrPreviewTimer(Sender: TObject);
var
R: TRect;
FWidth, FHeight: Integer;
begin
TmrPreview.Enabled := False;
if PrbMain.Visible then
Exit;
FillProcessingParams;
NewFormState;
R := PbImage.ClientRect;
FProcessingParams.PreviewOptions.GeneratePreview := True;
FProcessingParams.PreviewOptions.PreviewWidth := R.Right - R.Left + 1;
FProcessingParams.PreviewOptions.PreviewHeight := R.Bottom - R.Top + 1;
TImageConvertThread.Create(Self, StateID, FContext, FData[FCurrentPreviewPosition].Copy, FProcessingParams);
LsMain.Show;
if (FPreviewImage = nil) then
begin
FPreviewImage := TBitmap.Create;
if TFormCollection.Instance.GetImage(FOwner, FData[FCurrentPreviewPosition].FileName, FPreviewImage, FWidth, FHeight) then
begin
FRealWidth := FWidth;
FRealHeight := FHeight;
PbImage.Repaint;
end else
F(FPreviewImage);
end;
end;
procedure TFormSizeResizer.UpdateNavigation;
begin
WlBack.Enabled := FCurrentPreviewPosition > 0;
WlNext.Enabled := FCurrentPreviewPosition < FData.Count - 1;
end;
procedure TFormSizeResizer.UpdatePreview(PreviewImage: TBitmap; FileName: string; RealWidth, RealHeight: Integer);
begin
LsMain.Hide;
FRealWidth := RealWidth;
FRealHeight := RealHeight;
EdImageName.Text := ExtractFileName(FileName);
F(FPreviewImage);
FPreviewImage := PreviewImage;
FPreviewAvalable := PreviewImage <> nil;
PbImage.Refresh;
end;
procedure TFormSizeResizer.WlBackClick(Sender: TObject);
begin
if not WlBack.Enabled then
Exit;
Dec(FCurrentPreviewPosition);
UpdateNavigation;
if Sender = WlBack then
TmrPreviewTimer(Sender)
else
begin
TmrPreview.Enabled := False;
TmrPreview.Interval := 100;
TmrPreview.Enabled := True;
LsMain.Show;
end;
end;
procedure TFormSizeResizer.WlNextClick(Sender: TObject);
begin
if not WlNext.Enabled then
Exit;
Inc(FCurrentPreviewPosition);
UpdateNavigation;
if Sender = WlNext then
TmrPreviewTimer(Sender)
else
begin
TmrPreview.Enabled := False;
TmrPreview.Interval := 100;
TmrPreview.Enabled := True;
LsMain.Show;
end;
end;
procedure TFormSizeResizer.WndProc(var Message: TMessage);
var
C: TColor;
DC: HDC;
BrushInfo: TagLOGBRUSH;
Brush: HBrush;
begin
if (Message.Msg = WM_ERASEBKGND) and StyleServices.Enabled then
begin
Message.Result := 1;
DC := TWMEraseBkgnd(Message).DC;
if DC = 0 then
Exit;
C := Theme.WindowColor;
brushInfo.lbStyle := BS_SOLID;
brushInfo.lbColor := ColorToRGB(C);
Brush := CreateBrushIndirect(brushInfo);
FillRect(DC, Rect(0, 0, Width, PbImage.Top), Brush);
FillRect(DC, Rect(0, PbImage.Top + PbImage.Height, Width, Height), Brush);
FillRect(DC, Rect(0, PbImage.Top, PbImage.Left, PbImage.Top + PbImage.Height), Brush);
FillRect(DC, Rect(PbImage.Left + PbImage.Width, PbImage.Top, Width, PbImage.Top + PbImage.Height), Brush);
if(Brush > 0) then
DeleteObject(Brush);
Exit;
end;
inherited;
end;
procedure TFormSizeResizer.BtSaveAsDefaultClick(Sender: TObject);
begin
AppSettings.WriteInteger(Settings_ConvertForm, 'Convert', DdConvert.ItemIndex);
AppSettings.WriteInteger(Settings_ConvertForm, 'Rotate', DdRotate.ItemIndex);
AppSettings.WriteInteger(Settings_ConvertForm, 'Resize', DdResizeAction.ItemIndex);
AppSettings.WriteString(Settings_ConvertForm, 'ResizeW', EdWidth.Text);
AppSettings.WriteString(Settings_ConvertForm, 'ResizeH', Edheight.Text);
AppSettings.WriteBool(Settings_ConvertForm, 'SaveAspectRatio', CbAspectRatio.Checked);
AppSettings.WriteBool(Settings_ConvertForm, 'AddSuffix', CbAddSuffix.Checked);
end;
procedure TFormSizeResizer.BtWatermarkOptionsClick(Sender: TObject);
begin
ShowWatermarkOptions;
CheckValidForm;
end;
procedure TFormSizeResizer.CbAspectRatioClick(Sender: TObject);
begin
CheckValidForm;
end;
procedure TFormSizeResizer.CbConvertClick(Sender: TObject);
begin
DdConvert.Enabled := CbConvert.Checked;
DdConvertChange(Sender);
CheckValidForm;
end;
procedure TFormSizeResizer.CbResizeClick(Sender: TObject);
begin
DdResizeAction.Enabled := CbResize.Checked;
CheckValidForm;
end;
procedure TFormSizeResizer.CbRotateClick(Sender: TObject);
begin
DdRotate.Enabled := CbRotate.Checked;
CheckValidForm;
end;
procedure TFormSizeResizer.CbWatermarkClick(Sender: TObject);
begin
BtWatermarkOptions.Enabled := CbWatermark.Checked;
CheckValidForm;
end;
procedure TFormSizeResizer.CheckValidForm;
var
Valid: Boolean;
begin
Valid := CbConvert.Checked or CbResize.Checked or CbRotate.Checked or CbWatermark.Checked;
GeneratePreview;
BtOk.Enabled := Valid;
BtSaveAsDefault.Enabled := Valid;
end;
procedure TFormSizeResizer.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.WndParent := GetDesktopWindow;
with Params do
ExStyle := ExStyle or WS_EX_APPWINDOW;
end;
procedure TFormSizeResizer.CustomFormAfterDisplay;
begin
inherited;
if EdImageName = nil then
Exit;
if DdConvert = nil then
Exit;
if DdRotate = nil then
Exit;
if DdResizeAction = nil then
Exit;
EdImageName.Refresh;
DdConvert.Refresh;
DdRotate.Refresh;
DdResizeAction.Refresh;
end;
procedure TFormSizeResizer.DdConvertChange(Sender: TObject);
begin
CheckValidForm;
end;
procedure TFormSizeResizer.DdResizeActionChange(Sender: TObject);
begin
EdWidth.Enabled := DdResizeAction.Enabled and (DdResizeAction.ItemIndex = DdResizeAction.Items.Count - 1);
EdHeight.Enabled := EdWidth.Enabled;
LbSizeSeparator.Enabled := EdWidth.Enabled;
CheckValidForm;
end;
procedure TFormSizeResizer.DdRotateChange(Sender: TObject);
begin
CheckValidForm;
end;
procedure TFormSizeResizer.DdRotateClick(Sender: TObject);
begin
CheckValidForm;
end;
procedure TFormSizeResizer.DefaultConvert;
begin
FIgnoreInput := True;
CbConvert.Checked := True;
FIgnoreInput := False;
TmrPreviewTimer(Self);
end;
procedure TFormSizeResizer.DefaultExport;
begin
FIgnoreInput := True;
CbWatermark.Checked := True;
CbResize.Checked := True;
DdResizeAction.ItemIndex := 1;
CbRotate.Checked := True;
DdRotate.ItemIndex := 0;
FIgnoreInput := False;
TmrPreviewTimer(Self);
end;
procedure TFormSizeResizer.DefaultResize;
begin
FIgnoreInput := True;
CbResize.Checked := True;
CbRotate.Checked := True;
DdRotate.ItemIndex := 0; //rotate by EXIF by default
FIgnoreInput := False;
TmrPreviewTimer(Self);
end;
procedure TFormSizeResizer.DoDefaultRotate(RotateValue: Integer; StartImmediately : Boolean);
var
I : Integer;
begin
FIgnoreInput := True;
CbRotate.Checked := True;
CbAddSuffix.Checked := not StartImmediately;
for I := 0 to DdRotate.Items.Count - 1 do
if DdRotate.Items.Objects[I] = Pointer(RotateValue) then
begin
DdRotate.ItemIndex := I;
Break;
end;
FIgnoreInput := False;
if StartImmediately then
BtOkClick(Self)
else
TmrPreviewTimer(Self);
end;
procedure TFormSizeResizer.EdWidthExit(Sender: TObject);
begin
(Sender as TEdit).Text := IntToStr(Min(Max(StrToIntDef((Sender as TEdit).Text, 100), 5), 5000));
CheckValidForm;
end;
/// <summary>
/// LoadLanguage
/// </summary>
procedure TFormSizeResizer.LoadLanguage;
begin
BeginTranslate;
try
Caption := L('Change Image');
LbInfo.Caption := L(
'You can change image size, convert image to another format, rotate image and add custom watermark.');
CbWatermark.Caption := L('Add Watermark');
BtWatermarkOptions.Caption := L('Watermark Options');
CbConvert.Caption := L('Convert');
CbResize.Caption := L('Resize');
DdResizeAction.Items.Add(L('Full HD (1920x1080)'));
DdResizeAction.Items.Add(L('HD (1280x720)'));
DdResizeAction.Items.Add(L('Big (1024x768)'));
DdResizeAction.Items.Add(L('Medium (800x600)'));
DdResizeAction.Items.Add(L('Small (640x480)'));
DdResizeAction.Items.Add(L('Pocket PC (240õ320)'));
DdResizeAction.Items.Add(L('Thumbnails (128x124)'));
DdResizeAction.Items.Add(Format(L('Size: %d%%'), [25]));
DdResizeAction.Items.Add(Format(L('Size: %d%%'), [50]));
DdResizeAction.Items.Add(Format(L('Size: %d%%'), [75]));
DdResizeAction.Items.Add(Format(L('Size: %d%%'), [150]));
DdResizeAction.Items.Add(Format(L('Size: %d%%'), [200]));
DdResizeAction.Items.Add(Format(L('Size: %d%%'), [400]));
DdResizeAction.Items.Add(L('Custom size:'));
CbRotate.Caption := L('Rotate');
DdRotate.Items.AddObject(L('By EXIF'), Pointer(DB_IMAGE_ROTATE_EXIF));
DdRotate.Items.AddObject(L('Left'), Pointer(DB_IMAGE_ROTATE_270));
DdRotate.Items.AddObject(L('Right'), Pointer(DB_IMAGE_ROTATE_90));
DdRotate.Items.AddObject(L('180 grad'), Pointer(DB_IMAGE_ROTATE_180));
CbAspectRatio.Caption := L('Save aspect ratio');
CbAddSuffix.Caption := L('Add filename suffix');
BtJPEGOptions.Caption := L('JPEG Options');
BtSaveAsDefault.Caption := L('Save settings by default');
PrbMain.Text := L('Processing... (&%%)');
PeSavePath.LoadingText := L('Loading...');
BtCancel.Caption := L('Cancel');
BtOk.Caption := L('Ok');
finally
EndTranslate;
end;
end;
procedure TFormSizeResizer.PbImageContextPopup(Sender: TObject;
MousePos: TPoint; var Handled: Boolean);
var
Info: TMediaItemCollection;
I: Integer;
begin
if PrbMain.Visible then
Exit;
Info := TMediaItemCollection.Create;
try
Info.Assign(FData);
Info.Position := FCurrentPreviewPosition;
for I := 0 to Info.Count - 1 do
Info[I].Selected := I = FCurrentPreviewPosition;
TDBPopupMenu.Instance.Execute(Self, PbImage.ClientToScreen(MousePos).X, PbImage.ClientToScreen(MousePos).Y, Info);
finally
F(Info);
end;
end;
procedure TFormSizeResizer.PbImagePaint(Sender: TObject);
var
R: TRect;
DisplayImage, ShadowImage: TBitmap;
W, H, X, Y, Width, Height : Integer;
Text: string;
begin
if (FPreviewImage <> nil) and (FRealWidth + FRealHeight > 0) then
begin
R := Rect(0, 0, PbImage.Width, PbImage.Height);
W := R.Right - R.Left + 1 - 4; //4px for shadow
H := R.Bottom - R.Top + 1 - 4; //4px for shadow
Width := FPreviewImage.Width;
Height := FPreviewImage.Height;
ProportionalSizeA(W, H, Width, Height);
ProportionalSize(FRealWidth, FRealHeight, Width, Height);
X := R.Left + W div 2 - Width div 2;
Y := R.Top + H div 2 - Height div 2;
R := Rect(X, Y, X + Width + 4, Y + Height + 4);
DisplayImage := TBitmap.Create;
ShadowImage := TBitmap.Create;
try
ShadowImage.PixelFormat := pf32Bit;
DisplayImage.PixelFormat := pf24Bit;
DrawShadowToImage(ShadowImage, FPreviewImage);
DisplayImage.SetSize(ShadowImage.Width, ShadowImage.Height);
LoadBMPImage32bit(ShadowImage, DisplayImage, Theme.WindowColor);
PbImage.Canvas.Pen.Color := Theme.WindowColor;
PbImage.Canvas.Brush.Color := Theme.WindowColor;
PbImage.Canvas.Rectangle(PbImage.ClientRect);
PbImage.Canvas.StretchDraw(R, DisplayImage);
finally
F(DisplayImage);
F(ShadowImage);
end;
end else
begin
PbImage.Canvas.Pen.Color := Theme.WindowColor;
PbImage.Canvas.Brush.Color := Theme.WindowColor;
PbImage.Canvas.Rectangle(PbImage.ClientRect);
Text := L('Preview isn''t available. Image can be corrupted or encrypted.');
H := PbImage.Canvas.TextHeight(Text);
R := Rect(0, PbImage.Height div 2 - H div 2, PbImage.Width, PbImage.Height);
PbImage.Canvas.Font.Color := Theme.WindowTextColor;
PbImage.Canvas.TextRect(R, Text, [tfCenter, tfWordBreak]);
end;
end;
procedure TFormSizeResizer.ReadSettings;
begin
try
DdConvert.ItemIndex := AppSettings.ReadInteger(Settings_ConvertForm, 'Convert', 0);
DdRotate.ItemIndex := AppSettings.ReadInteger(Settings_ConvertForm, 'Rotate', 0);
EdWidth.Text := IntToStr(AppSettings.ReadInteger(Settings_ConvertForm, 'ResizeW', 1024));
EdHeight.Text := IntToStr(AppSettings.ReadInteger(Settings_ConvertForm, 'ResizeH', 768));
DdResizeAction.ItemIndex := AppSettings.ReadInteger(Settings_ConvertForm, 'Resize', 0);
CbAspectRatio.Checked := AppSettings.ReadBool(Settings_ConvertForm, 'SaveAspectRatio', True);
CbAddSuffix.Checked := AppSettings.ReadBool(Settings_ConvertForm, 'AddSuffix', True);
except
on e: Exception do
EventLog(e);
end;
end;
procedure TFormSizeResizer.EdHeightKeyPress(Sender: TObject; var Key: Char);
begin
if not CharInSet(Key, ['0' .. '9']) then
Key := #0;
end;
procedure TFormSizeResizer.EdImageNameEnter(Sender: TObject);
begin
DefocusControl(TWinControl(Sender), True);
end;
procedure TFormSizeResizer.BtChangeDirectoryClick(Sender: TObject);
var
Directory: string;
begin
Directory := UnitDBFileDialogs.DBSelectDir(Handle, L('Select folder for processed images'), PeSavePath.Path);
if DirectoryExists(Directory) then
PeSavePath.Path := Directory;
end;
initialization
FormInterfaces.RegisterFormInterface(IBatchProcessingForm, TFormSizeResizer);
end.
|
unit ViewOnlineHuman;
interface
uses
Windows, SysUtils, StrUtils, Classes, Controls, Forms,
Grids, ExtCtrls, StdCtrls;
type
TfrmViewOnlineHuman = class(TForm)
PanelStatus: TPanel;
GridHuman: TStringGrid;
Timer: TTimer;
Panel1: TPanel;
ButtonRefGrid: TButton;
Label1: TLabel;
ComboBoxSort: TComboBox;
EditSearchName: TEdit;
ButtonSearch: TButton;
ButtonView: TButton;
Button1: TButton;
ButtonKick: TButton;
procedure FormCreate(Sender: TObject);
procedure ButtonRefGridClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ComboBoxSortClick(Sender: TObject);
procedure GridHumanDblClick(Sender: TObject);
procedure TimerTimer(Sender: TObject);
procedure ButtonSearchClick(Sender: TObject);
procedure ButtonViewClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
ViewList: TStringList;
dwTimeOutTick: LongWord;
procedure RefGridSession();
procedure GetOnlineList();
procedure SortOnlineList(nSort: Integer);//排序在线列表
procedure ShowHumanInfo();
{ Private declarations }
public
procedure Open();
{ Public declarations }
end;
var
frmViewOnlineHuman: TfrmViewOnlineHuman;
implementation
uses UsrEngn, M2Share, ObjBase, HUtil32, HumanInfo;
{$R *.dfm}
{ TfrmViewOnlineHuman }
procedure TfrmViewOnlineHuman.Open;
begin
frmHumanInfo := TfrmHumanInfo.Create(Owner);
dwTimeOutTick := GetTickCount();
GetOnlineList();
RefGridSession();
Timer.Enabled := True;
ShowModal;
Timer.Enabled := False;
frmHumanInfo.Free;
end;
//取在线人物列表
procedure TfrmViewOnlineHuman.GetOnlineList;
var
I: Integer;
begin
ViewList.Clear;
try
EnterCriticalSection(ProcessHumanCriticalSection);
if UserEngine <> nil then begin
for I := 0 to UserEngine.m_PlayObjectList.Count - 1 do begin
ViewList.AddObject(UserEngine.m_PlayObjectList.Strings[I], UserEngine.m_PlayObjectList.Objects[I]);
end;
end;
finally
LeaveCriticalSection(ProcessHumanCriticalSection);
end;
end;
procedure TfrmViewOnlineHuman.RefGridSession;
var
I: Integer;
PlayObject: TPlayObject;
begin
PanelStatus.Caption := '正在取得数据...';
GridHuman.Visible := False;
GridHuman.Cells[0, 1] := '';
GridHuman.Cells[1, 1] := '';
GridHuman.Cells[2, 1] := '';
GridHuman.Cells[3, 1] := '';
GridHuman.Cells[4, 1] := '';
GridHuman.Cells[5, 1] := '';
GridHuman.Cells[6, 1] := '';
GridHuman.Cells[7, 1] := '';
GridHuman.Cells[8, 1] := '';
GridHuman.Cells[9, 1] := '';
GridHuman.Cells[10, 1] := '';
GridHuman.Cells[11, 1] := '';
GridHuman.Cells[12, 1] := '';
GridHuman.Cells[13, 1] := '';
GridHuman.Cells[14, 1] := '';
GridHuman.Cells[15, 1] := '';
GridHuman.Cells[16, 1] := '';
GridHuman.Cells[17, 1] := '';
GridHuman.Cells[18, 1] := '';
GridHuman.Cells[19, 1] := '';//20081204
if ViewList.Count <= 0 then begin
GridHuman.RowCount := 2;
GridHuman.FixedRows := 1;
end else begin
GridHuman.RowCount := ViewList.Count + 1;
end;
for I := 0 to ViewList.Count - 1 do begin
PlayObject := TPlayObject(ViewList.Objects[I]);
if PlayObject <> nil then begin
GridHuman.Cells[0, I + 1] := IntToStr(I);
GridHuman.Cells[1, I + 1] := PlayObject.m_sCharName;
GridHuman.Cells[2, I + 1] := IntToSex(PlayObject.m_btGender);
GridHuman.Cells[3, I + 1] := IntToJob(PlayObject.m_btJob);
GridHuman.Cells[4, I + 1] := IntToStr(PlayObject.m_Abil.Level);
GridHuman.Cells[5, I + 1] := IntToStr(PlayObject.m_NGLevel);//内功等级
GridHuman.Cells[6, I + 1] := PlayObject.m_sMapName;
GridHuman.Cells[7, I + 1] := IntToStr(PlayObject.m_nCurrX) + ':' + IntToStr(PlayObject.m_nCurrY);
GridHuman.Cells[8, I + 1] := PlayObject.m_sUserID;
GridHuman.Cells[9, I + 1] := PlayObject.m_sIPaddr;
GridHuman.Cells[10, I + 1] := IntToStr(PlayObject.m_btPermission);
GridHuman.Cells[11, I + 1] := PlayObject.m_sIPLocal; // GetIPLocal(PlayObject.m_sIPaddr);
GridHuman.Cells[12, I + 1] := IntToStr(PlayObject.m_nGameGold);
GridHuman.Cells[13, I + 1] := IntToStr(PlayObject.m_nGamePoint);
GridHuman.Cells[14, I + 1] := IntToStr(PlayObject.m_nPayMentPoint);
GridHuman.Cells[15, I + 1] := BooleanToStr(PlayObject.m_boNotOnlineAddExp);
GridHuman.Cells[16, I + 1] := PlayObject.m_sAutoSendMsg;
GridHuman.Cells[17, I + 1] := IntToStr(PlayObject.MessageCount);
GridHuman.Cells[18, I + 1] := IntToStr(PlayObject.m_nGameDiaMond);
GridHuman.Cells[19, I + 1] := IntToStr(PlayObject.m_nGameGird);
end;
end;
GridHuman.Visible := True;
end;
procedure TfrmViewOnlineHuman.FormCreate(Sender: TObject);
begin
ViewList := TStringList.Create;
GridHuman.Cells[0, 0] := '序号';
GridHuman.Cells[1, 0] := '人物名称';
GridHuman.Cells[2, 0] := '性别';
GridHuman.Cells[3, 0] := '职业';
GridHuman.Cells[4, 0] := '等级';
GridHuman.Cells[5, 0] := '内功等级';//20081204
GridHuman.Cells[6, 0] := '地图';
GridHuman.Cells[7, 0] := '座标';
GridHuman.Cells[8, 0] := '登录帐号';
GridHuman.Cells[9, 0] := '登录IP';
GridHuman.Cells[10, 0] := '权限';
GridHuman.Cells[11, 0] := '所在地区';
GridHuman.Cells[12, 0] := g_Config.sGameGoldName;
GridHuman.Cells[13, 0] := g_Config.sGamePointName;
GridHuman.Cells[14, 0] := g_Config.sPayMentPointName;
GridHuman.Cells[15, 0] := '离线挂机';
GridHuman.Cells[16, 0] := '自动回复';
GridHuman.Cells[17, 0] := '未处理消息';
GridHuman.Cells[18, 0] := g_Config.sGameDiaMond; //20071226 金刚石
GridHuman.Cells[19, 0] := g_Config.sGameGird;//20071226 灵符
if UserEngine <> nil then Caption := Format(' [在线人数:%d]', [UserEngine.PlayObjectCount]);
end;
procedure TfrmViewOnlineHuman.ButtonRefGridClick(Sender: TObject);
begin
dwTimeOutTick := GetTickCount();
GetOnlineList();
RefGridSession();
end;
procedure TfrmViewOnlineHuman.FormDestroy(Sender: TObject);
begin
ViewList.Free;
frmViewOnlineHuman:= nil;
end;
procedure TfrmViewOnlineHuman.ComboBoxSortClick(Sender: TObject);
begin
if ComboBoxSort.ItemIndex < 0 then Exit;
dwTimeOutTick := GetTickCount();
GetOnlineList();
SortOnlineList(ComboBoxSort.ItemIndex);
RefGridSession();
end;
//按数字大小倒排序的函数 20090131
function DescCompareInt(List: TStringList; I1, I2: Integer): Integer;
begin
I1 := StrToIntDef(List[I1], 0);
I2 := StrToIntDef(List[I2], 0);
if I1 > I2 then Result:=-1
else if I1 < I2 then Result:=1
else Result:=0;
end;
//字符串排序 20081024
function StrSort_2(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := 0;
try
Result := CompareStr(List[Index1], List[Index2]);
except
end;
end;
procedure TfrmViewOnlineHuman.SortOnlineList(nSort: Integer);
var
I: Integer;
SortList: TStringList;
begin
if (ViewList = nil) or (ViewList.Count = 0) then Exit;//20080503
SortList := TStringList.Create;
try
case nSort of
0: begin
ViewList.Sort;
Exit;
end;
1: begin
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(IntToStr(TPlayObject(ViewList.Objects[I]).m_btGender), ViewList.Objects[I]);
end;
SortList.CustomSort(DescCompareInt);//排序时调用那个函数 20081023 OK
end;
2: begin
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(IntToStr(TPlayObject(ViewList.Objects[I]).m_btJob), ViewList.Objects[I]);
end;
SortList.CustomSort(DescCompareInt);//排序时调用那个函数 20081023 OK
end;
3: begin
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(IntToStr(TPlayObject(ViewList.Objects[I]).m_Abil.Level), ViewList.Objects[I]);
end;
SortList.CustomSort(DescCompareInt);//排序时调用那个函数 20081005 OK
end;
4: begin
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(TPlayObject(ViewList.Objects[I]).m_sMapName, ViewList.Objects[I]);
end;
SortList.CustomSort(StrSort_2);//文字排序 20081024
end;
5: begin
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(TPlayObject(ViewList.Objects[I]).m_sIPaddr, ViewList.Objects[I]);
end;
SortList.CustomSort(StrSort_2);//文字排序 20081024
end;
6: begin
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(IntToStr(TPlayObject(ViewList.Objects[I]).m_btPermission), ViewList.Objects[I]);
end;
SortList.CustomSort(DescCompareInt);//排序时调用那个函数 20081005
end;
7: begin
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(TPlayObject(ViewList.Objects[I]).m_sIPLocal, ViewList.Objects[I]);
end;
SortList.CustomSort(StrSort_2);//文字排序 20081024
end;
8: begin//非挂机 20080811
for I := 0 to ViewList.Count - 1 do begin
if not TPlayObject(ViewList.Objects[I]).m_boNotOnlineAddExp then begin
SortList.AddObject(IntToStr(I), ViewList.Objects[I]);
end;
end;
end;//8
9: begin//元宝
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(IntToStr(TPlayObject(ViewList.Objects[I]).m_nGameGold), ViewList.Objects[I]);
end;
SortList.CustomSort(DescCompareInt);//排序时调用那个函数 20080928
end;//9
10:begin//内功等级
for I := 0 to ViewList.Count - 1 do begin
SortList.AddObject(IntToStr(TPlayObject(ViewList.Objects[I]).m_NGLevel), ViewList.Objects[I]);
end;
SortList.CustomSort(DescCompareInt);//排序时调用那个函数
end;//10
end;
//ViewList.Free;
//ViewList := SortList; //20080503 修改成下面两段
ViewList.Clear;
for I := 0 to SortList.Count - 1 do begin
ViewList.AddObject(IntToStr(I), SortList.Objects[I]);
end;
ViewList.Sort;
finally
SortList.Free;//20080117
end;
end;
procedure TfrmViewOnlineHuman.GridHumanDblClick(Sender: TObject);
begin
ShowHumanInfo();
end;
procedure TfrmViewOnlineHuman.TimerTimer(Sender: TObject);
begin
if (GetTickCount - dwTimeOutTick > 30000) and (ViewList.Count > 0) then begin
ViewList.Clear;
RefGridSession();
end;
end;
procedure TfrmViewOnlineHuman.ButtonSearchClick(Sender: TObject);
var
I: Integer;
sHumanName: string;
PlayObject: TPlayObject;
begin
sHumanName := Trim(EditSearchName.Text);
if sHumanName = '' then begin
Application.MessageBox('请输入一个人物名称!!!', '错误信息', MB_OK + MB_ICONEXCLAMATION);
Exit;
end;
if Sender = ButtonSearch then begin
for I := 0 to ViewList.Count - 1 do begin
PlayObject := TPlayObject(ViewList.Objects[I]);
if CompareText(PlayObject.m_sCharName, sHumanName) = 0 then begin
GridHuman.Row := I + 1;
Exit;
end;
end;
Application.MessageBox('人物没有在线!!!', '提示信息', MB_OK + MB_ICONINFORMATION);
Exit;
end;
if Sender = ButtonKick then begin
for I := 0 to ViewList.Count - 1 do begin
PlayObject := TPlayObject(ViewList.Objects[I]);
if AnsiContainsText(PlayObject.m_sCharName, sHumanName) then begin
PlayObject.m_boEmergencyClose := True;
PlayObject.m_boNotOnlineAddExp := False;
PlayObject.m_boPlayOffLine := False;
end;
end;
dwTimeOutTick := GetTickCount();
GetOnlineList();
RefGridSession();
end;
end;
procedure TfrmViewOnlineHuman.ButtonViewClick(Sender: TObject);
begin
ShowHumanInfo();
end;
procedure TfrmViewOnlineHuman.ShowHumanInfo;
var
nSelIndex: Integer;
sPlayObjectName: string;
PlayObject: TPlayObject;
begin
nSelIndex := GridHuman.Row;
Dec(nSelIndex);
if (nSelIndex < 0) or (ViewList.Count <= nSelIndex) then begin
Application.MessageBox('请先选择一个要查看的人物!!!', '提示信息', MB_OK + MB_ICONINFORMATION);
Exit;
end;
sPlayObjectName := GridHuman.Cells[1, nSelIndex + 1];
PlayObject := UserEngine.GetPlayObject(sPlayObjectName);
if PlayObject = nil then begin
Application.MessageBox('此人物已经不在线!!!', '提示信息', MB_OK + MB_ICONINFORMATION);
Exit;
end;
frmHumanInfo.PlayObject := TPlayObject(ViewList.Objects[nSelIndex]);
frmHumanInfo.Top := Self.Top + 20;
frmHumanInfo.Left := Self.Left;
frmHumanInfo.Open();
end;
procedure TfrmViewOnlineHuman.Button1Click(Sender: TObject);
var
I: Integer;
begin
try
EnterCriticalSection(ProcessHumanCriticalSection);
for I := 0 to UserEngine.m_PlayObjectList.Count - 1 do begin
if TPlayObject(UserEngine.m_PlayObjectList.Objects[I]).m_boNotOnlineAddExp then begin
TPlayObject(UserEngine.m_PlayObjectList.Objects[I]).m_boNotOnlineAddExp := False;
TPlayObject(UserEngine.m_PlayObjectList.Objects[I]).m_boPlayOffLine := False;
TPlayObject(UserEngine.m_PlayObjectList.Objects[I]).m_boKickFlag := True;//20080815 增加
end;
end;
finally
LeaveCriticalSection(ProcessHumanCriticalSection);
end;
dwTimeOutTick := GetTickCount();
GetOnlineList();
RefGridSession();
end;
procedure TfrmViewOnlineHuman.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;
end.
|
unit uFrmPurchaseItemQuickEntry;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, PAIDETODOS, siComp, siLangRT, StdCtrls, LblEffct, ExtCtrls,
ADODB, DB, Buttons, DBCtrls, uFrmModelQuickEntry, uFrmBarcodeSearch,
mrBarCodeEdit;
type
TFrmPurchaseItemQuickEntry = class(TFrmParent)
Panel4: TPanel;
lblVendor: TLabel;
lblSearchType: TLabel;
lblQty: TLabel;
gbxModelProperties: TGroupBox;
lblModel: TLabel;
lblDescription: TLabel;
lblCost: TLabel;
lblManufacturer: TLabel;
lblOurPrice: TLabel;
DBText: TDBText;
DBText1: TDBText;
DBText2: TDBText;
DBText3: TDBText;
DBText4: TDBText;
cbxSearchType: TComboBox;
edtSearchNumber: TEdit;
pnlButtons: TPanel;
btNewItem: TSpeedButton;
btSearch: TSpeedButton;
edtVendor: TEdit;
edtQty: TEdit;
qryModel: TADODataSet;
qryModelIDModel: TIntegerField;
qryModelModel: TStringField;
qryModelDescription: TStringField;
qryModelSellingPrice: TBCDField;
qryModelFinalCost: TBCDField;
qryModelSuggRetail: TBCDField;
qryModelManufacturer: TStringField;
dtsModel: TDataSource;
cmdInsPurchaseItem: TADOCommand;
btAdd: TButton;
qryModelGroupID: TIntegerField;
lblQtyType: TLabel;
cbxQtyType: TComboBox;
lblCaseQty: TLabel;
DBText5: TDBText;
qryModelCaseQty: TFloatField;
edtBarcode: TmrBarCodeEdit;
procedure btNewItemClick(Sender: TObject);
procedure btSearchClick(Sender: TObject);
procedure edtSearchNumberKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edtQtyKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btAddClick(Sender: TObject);
procedure edtQtyKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure cbxQtyTypeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edtSearchNumberExit(Sender: TObject);
procedure cbxSearchTypeChange(Sender: TObject);
procedure edtBarcodeAfterSearchBarcode(Sender: TObject);
private
FModelSQL: String;
FIDPurchase: Integer;
FIDVendor: Integer;
FFrmModelQuickEntry: TFrmModelQuickEntry;
FFrmBarcodeSearch: TFrmBarcodeSearch;
procedure LoadImages;
procedure SearchModel(AIDModel: Integer);
procedure InsertPurchaseItem;
procedure RefreshControls;
public
procedure Start(AIDPurchase, AIDVendor: Integer; AVendorName: String);
end;
implementation
uses uDM, uSystemConst, uCharFunctions, uMsgBox, uMsgConstant, uContentClasses;
{$R *.dfm}
procedure TFrmPurchaseItemQuickEntry.btNewItemClick(Sender: TObject);
var
ABarcode: TBarcode;
begin
inherited;
ABarcode := FFrmModelQuickEntry.Start(False, True, False, '');
if ABarcode.Model.IDModel <> -1 then
SearchModel(ABarcode.Model.IDModel);
end;
procedure TFrmPurchaseItemQuickEntry.btSearchClick(Sender: TObject);
var
iIDModel: Integer;
begin
inherited;
iIDModel := FFrmBarcodeSearch.Start;
if iIDModel <> -1 then
SearchModel(iIDModel);
end;
procedure TFrmPurchaseItemQuickEntry.edtSearchNumberKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if (key = 13) then
SearchModel(0);
end;
procedure TFrmPurchaseItemQuickEntry.edtQtyKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
Key := ValidateNumbers(Key);
end;
procedure TFrmPurchaseItemQuickEntry.InsertPurchaseItem;
begin
with cmdInsPurchaseItem do
begin
Parameters.ParamByName('IDPurchase').Value := FIDPurchase;
Parameters.ParamByName('IDPurchaseItem').Value := DM.GetNextID('Pur_PurchaseItem.IDPurchaseItem');
Parameters.ParamByName('IDModel').Value := qryModel.FieldByName('IDModel').AsInteger;
Parameters.ParamByName('IDGroup').Value := qryModel.FieldByName('GroupID').AsInteger;
Parameters.ParamByName('IDFornecedor').Value := FIDVendor;
if cbxQtyType.ItemIndex = 0 then
begin
Parameters.ParamByName('CaseQty').Value := StrToInt(edtQty.Text);
Parameters.ParamByName('CaseCost').Value := qryModel.FieldByName('CaseQty').AsFloat * qryModel.FieldByName('FinalCost').AsFloat;
Parameters.ParamByName('Qty').Value := StrToInt(edtQty.Text) * qryModel.FieldByName('CaseQty').AsFloat;
end
else
begin
Parameters.ParamByName('CaseQty').Value := NULL;
Parameters.ParamByName('CaseCost').Value := NULL;
Parameters.ParamByName('Qty').Value := StrToInt(edtQty.Text);
end;
Parameters.ParamByName('NewCostPrice').Value := qryModel.FieldByName('FinalCost').AsFloat;
Parameters.ParamByName('NewSalePrice').Value := qryModel.FieldByName('SellingPrice').AsFloat;
Parameters.ParamByName('NewSuggRetail').Value := qryModel.FieldByName('SuggRetail').AsFloat;
Parameters.ParamByName('CostPrice').Value := qryModel.FieldByName('FinalCost').AsFloat * StrToInt(edtQty.Text);
Execute;
end;
end;
procedure TFrmPurchaseItemQuickEntry.LoadImages;
begin
DM.imgSmall.GetBitmap(BTN18_NEW, btNewItem.Glyph);
DM.imgSmall.GetBitmap(BTN18_SEARCH, btSearch.Glyph);
end;
procedure TFrmPurchaseItemQuickEntry.SearchModel(AIDModel: Integer);
begin
with qryModel do
begin
Close;
CommandText := FModelSQL;
if AIDModel <> 0 then
CommandText := CommandText + ' WHERE M.IDModel = ' + IntToStr(AIDModel)
else
begin
case cbxSearchType.ItemIndex of
0: CommandText := CommandText + ' WHERE B.IDBarcode = ' + QuotedStr(edtBarcode.Text);
1: CommandText := CommandText + ' WHERE M.Model = ' + QuotedStr(edtSearchNumber.Text);
2: CommandText := CommandText + ' WHERE VMC.VendorCode = ' + QuotedStr(edtSearchNumber.Text);
end;
end;
Parameters.ParamByName('IDVendor').Value := FIDVendor;
Open;
if RecordCount = 0 then
begin
edtSearchNumber.Clear;
edtBarcode.Clear;
case cbxSearchType.ItemIndex of
0: MsgBox(MSG_INF_BARCODE_NOT_FOUND, vbInformation + vbOKOnly);
1: MsgBox(MSG_INF_MODEL_NOT_FOUND, vbInformation + vbOKOnly);
2: MsgBox(MSG_INF_VENDOR_NUMBER_NOT_FOUND, vbInformation + vbOKOnly);
end;
end
else
begin
RefreshControls;
edtSearchNumber.Clear;
edtBarcode.Clear;
end;
end;
end;
procedure TFrmPurchaseItemQuickEntry.Start(AIDPurchase, AIDVendor: Integer;
AVendorName: String);
begin
FIDPurchase := AIDPurchase;
FIDVendor := AIDVendor;
edtVendor.Text := AVendorName;
ShowModal;
end;
procedure TFrmPurchaseItemQuickEntry.FormCreate(Sender: TObject);
begin
inherited;
LoadImages;
FModelSQL := qryModel.CommandText;
FFrmModelQuickEntry := TFrmModelQuickEntry.Create(Self);
FFrmBarcodeSearch := TFrmBarcodeSearch.Create(Self);
edtBarcode.CheckBarcodeDigit := DM.fSystem.SrvParam[PARAM_REMOVE_BARCODE_DIGIT];
edtBarcode.RunSecondSQL := DM.fSystem.SrvParam[PARAM_SEARCH_MODEL_AFTER_BARCODE];
end;
procedure TFrmPurchaseItemQuickEntry.FormDestroy(Sender: TObject);
begin
inherited;
FreeAndNil(FFrmModelQuickEntry);
FreeAndNil(FFrmBarcodeSearch);
end;
procedure TFrmPurchaseItemQuickEntry.FormShow(Sender: TObject);
begin
inherited;
edtBarcode.SetFocus;
end;
procedure TFrmPurchaseItemQuickEntry.btAddClick(Sender: TObject);
begin
inherited;
if (not qryModel.Active) or (qryModel.RecordCount = 0) then
begin
MsgBox(MSG_EXC_SELECT_A_MODEL, vbInformation + vbOKOnly);
Exit;
end;
if (edtQty.Text = '') or (StrToInt(edtQty.Text) = 0) then
begin
MsgBox(MSG_CRT_QTY_NO_ZERO, vbInformation + vbOKOnly);
end
else
begin
InsertPurchaseItem;
edtQty.Clear;
edtSearchNumber.Clear;
edtBarcode.Clear;
if edtSearchNumber.CanFocus then
edtSearchNumber.SetFocus;
if edtBarcode.CanFocus then
edtBarcode.SetFocus;
cbxQtyType.Visible := False;
lblQtyType.Visible := False;
qryModel.Close;
end;
end;
procedure TFrmPurchaseItemQuickEntry.edtQtyKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if (key = 13) then
btAddClick(Sender);
end;
procedure TFrmPurchaseItemQuickEntry.cbxQtyTypeKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
inherited;
if (key = 13) then
edtQty.SetFocus;
end;
procedure TFrmPurchaseItemQuickEntry.RefreshControls;
begin
with qryModel do
begin
if FieldByName('CaseQty').AsFloat > 0 then
begin
cbxQtyType.Enabled := True;
cbxQtyType.TabStop := False;
cbxQtyType.ItemIndex := 0;
cbxQtyType.Visible := True;
lblQtyType.Visible := True;
edtQty.SetFocus;
end
else
begin
cbxQtyType.Enabled := False;
cbxQtyType.TabStop := True;
cbxQtyType.ItemIndex := 1;
cbxQtyType.Visible := False;
lblQtyType.Visible := False;
edtQty.SetFocus;
end;
end;
end;
procedure TFrmPurchaseItemQuickEntry.edtSearchNumberExit(Sender: TObject);
begin
inherited;
if TEdit(Sender).Text <> '' then
SearchModel(0);
end;
procedure TFrmPurchaseItemQuickEntry.cbxSearchTypeChange(Sender: TObject);
begin
inherited;
if cbxSearchType.ItemIndex = 0 then
edtBarcode.BringToFront
else
edtSearchNumber.BringToFront;
end;
procedure TFrmPurchaseItemQuickEntry.edtBarcodeAfterSearchBarcode(
Sender: TObject);
begin
inherited;
with edtBarcode do
if SearchResult then
SearchModel(GetFieldValue('IDModel'))
else
begin
MsgBox(MSG_CRT_NO_BARCODE, vbCritical + vbOkOnly);
Clear;
end;
end;
end.
|
unit uImpressaoEtiquetas;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, JvExStdCtrls, JvEdit, JvValidateEdit,
Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Mask, JvExMask, JvToolEdit, Vcl.Buttons,
Vcl.ImgList, Vcl.Grids, Vcl.DBGrids, FireDAC.Comp.Client, Data.DB,
Datasnap.DBClient, uFWConnection, System.StrUtils;
type
TLOTE = record
ORDEMPRODUCAO : Integer;
SEQUENCIA : Integer;
ESTAGIO : Integer;
IDLOTE : Integer;
CODIGOMC : string;
LOCALIZACAO_ID : Integer;
FIM: Boolean;
QUANTIDADE: Integer;
ID_PRODUTO: Integer;
end;
type
TfrmImpressaoEtiquetas = class(TForm)
Panel1: TPanel;
pnSuperior: TPanel;
edNumeroLoteEstagio: TLabeledEdit;
edCodigoOrdemProducao: TLabeledEdit;
edProduto: TLabeledEdit;
pnBotoesEdicao: TPanel;
GridPanel2: TGridPanel;
Panel4: TPanel;
Panel5: TPanel;
btEtiquetas: TBitBtn;
cds_Itens: TClientDataSet;
ds_Itens: TDataSource;
btFechar: TSpeedButton;
cds_ItensORDEMPRODUCAO: TIntegerField;
cds_ItensPRODUTO: TStringField;
edt_Quantidade: TLabeledEdit;
cds_ItensCODIGOBARRAS: TStringField;
cds_ItensDATALOTE: TDateField;
btnAdicionar: TBitBtn;
cds_ItensCODIGOMC: TStringField;
edCodigoUsuario: TLabeledEdit;
edNomeUsuario: TLabeledEdit;
cds_ItensNUMEROLOTE: TStringField;
edNomeLocalizacao: TEdit;
edCodigoLocalizacao: TButtonedEdit;
Label2: TLabel;
Label1: TLabel;
btnRemover: TBitBtn;
cds_ItensIDOPMC: TIntegerField;
procedure btFecharClick(Sender: TObject);
procedure btEtiquetasClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure cds_ItensAfterPost(DataSet: TDataSet);
procedure btnAdicionarClick(Sender: TObject);
procedure edCodigoLocalizacaoRightButtonClick(Sender: TObject);
procedure edCodigoLocalizacaoChange(Sender: TObject);
procedure edCodigoLocalizacaoKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure btnRemoverClick(Sender: TObject);
private
function AtualizaLocalizacao : Boolean;
{ Private declarations }
public
{ Public declarations }
LOTE : TLOTE;
procedure ExecutarEvento;
procedure ImprimirEtiquetas;
procedure LimparEdits;
procedure CarregaEtiquetas;
end;
var
frmImpressaoEtiquetas: TfrmImpressaoEtiquetas;
implementation
uses
uFuncoes,
uMensagem,
uBeanOPFinal_Estagio,
uBeanOPFinal_Estagio_Lote,
uBeanOPFinal_Estagio_Lote_S,
uBeanOPFinal_Estagio_Lote_S_Qualidade,
uBeanControleEstoque,
uBeanControleEstoqueProduto,
uConstantes,
uDMUtil,
uBeanUsuario,
uBeanMotivoDescarte,
uBeanLocalizacao;
{$R *.dfm}
function TfrmImpressaoEtiquetas.AtualizaLocalizacao : Boolean;
var
FWC : TFWConnection;
L : TOPFINAL_ESTAGIO_LOTE;
begin
Result := True;
if edCodigoLocalizacao.Enabled then begin
Result := False;
if LOTE.IDLOTE > 0 then begin
FWC := TFWConnection.Create;
L := TOPFINAL_ESTAGIO_LOTE.Create(FWC);
try
try
L.ID.Value := LOTE.IDLOTE;
L.LOCALIZACAO_ID.Value := StrToIntDef(edCodigoLocalizacao.Text,0);
L.Update;
Result := True;
except
on E : Exception do Begin
FWC.Rollback;
DisplayMsg(MSG_ERR, 'Erro ao Atualizar a Localização para o Lote, Verifique!');
Exit;
End;
end;
finally
FreeAndNil(L);
FreeAndNil(FWC);
end;
end;
end;
end;
procedure TfrmImpressaoEtiquetas.btEtiquetasClick(Sender: TObject);
begin
if btEtiquetas.Tag = 0 then begin
btEtiquetas.Tag := 1;
try
if edCodigoLocalizacao.Enabled then begin
if Length(Trim(edNomeLocalizacao.Text)) = 0 then begin
DisplayMsg(MSG_WAR, 'Obrigatório informar a Localização do Lote, Verifique!');
if edCodigoLocalizacao.CanFocus then
edCodigoLocalizacao.SetFocus;
Exit;
end;
end;
if LOTE.FIM then
begin
DisplayMsg(MSG_INF, 'Não existem etiquetas para imprimir!');
Exit;
end;
ImprimirEtiquetas;
finally
btEtiquetas.Tag := 0;
end;
end;
end;
procedure TfrmImpressaoEtiquetas.btFecharClick(Sender: TObject);
begin
Close;
end;
procedure TfrmImpressaoEtiquetas.btnAdicionarClick(Sender: TObject);
var
FWC : TFWConnection;
LS : TOPFINAL_ESTAGIO_LOTE_S;
L : TOPFINAL_ESTAGIO_LOTE;
USU : TUSUARIO;
C: TCONTROLEESTOQUE;
CP: TCONTROLEESTOQUEPRODUTO;
begin
if not (USUARIO.PERMITEINCLUIRETIQUETAS) then begin
DisplayMsg(MSG_PASSWORD, 'Digite o usuário e senha de alguem que tenha permissão por favor!');
if not (ResultMsgModal in [mrOk, mrYes]) then Exit;
FWC := TFWConnection.Create;
USU := TUSUARIO.Create(FWC);
try
USU.SelectList('ID = ' + IntToStr(ResultMsgPassword));
if USU.Count > 0 then begin
if not (TUSUARIO(USU.Itens[0]).PERMITEITENSETIQUETA.Value) then begin
DisplayMsg(MSG_WAR, 'Usuário informado não tem permissão para a operação atual!');
Exit;
end;
end
else begin
DisplayMsg(MSG_WAR, 'Usuário não encontrado!');
Exit;
end;
finally
FreeAndNil(USU);
FreeAndNil(FWC);
end;
end;
FWC := TFWConnection.Create;
if LOTE.FIM then
begin
L := TOPFINAL_ESTAGIO_LOTE.Create(FWC);
C := TCONTROLEESTOQUE.Create(FWC);
CP := TCONTROLEESTOQUEPRODUTO.Create(FWC);
try
L.SelectList('ID = ' + IntToStr(LOTE.IDLOTE));
if L.Count > 0 then
begin
L.ID.Value := LOTE.IDLOTE;
L.QUANTIDADE.Value := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).QUANTIDADE.Value + 1;
L.Update;
C.ID.isNull := True;
C.DATAHORA.Value := Now;
C.USUARIO_ID.Value := USUARIO.CODIGO;
C.TIPOMOVIMENTACAO.Value := 0;
C.CANCELADO.Value := False;
C.OBSERVACAO.Value := 'Adicionando entrega de item manualmente';
C.Insert;
CP.ID.isNull := True;
CP.CONTROLEESTOQUE_ID.Value := C.ID.Value;
CP.PRODUTO_ID.Value := LOTE.ID_PRODUTO;
CP.QUANTIDADE.Value := 1;
CP.Insert;
LOTE.QUANTIDADE := LOTE.QUANTIDADE + 1;
edt_Quantidade.Text := IntToStr(LOTE.QUANTIDADE);
end;
finally
FreeAndNil(L);
FreeAndNil(C);
FreeAndNil(CP);
FreeAndNil(FWC);
end;
end
else
begin
LS := TOPFINAL_ESTAGIO_LOTE_S.Create(FWC);
try
FWC.StartTransaction;
try
LS.ID.isNull := True;
LS.OPFINAL_ESTAGIO_LOTE_ID.Value := LOTE.IDLOTE;
LS.DATAHORA.Value := Now;
LS.BAIXADO.Value := False;
LS.Insert;
FWC.Commit;
except
on E : Exception do begin
FWC.Rollback;
DisplayMsg(MSG_WAR, 'Erro ao Inserir Item!', '', E.Message);
Exit;
end;
end;
CarregaEtiquetas;
finally
FreeAndNil(LS);
FreeAndNil(FWC);
end;
end;
end;
procedure TfrmImpressaoEtiquetas.btnRemoverClick(Sender: TObject);
var
FWC : TFWConnection;
C: TCONTROLEESTOQUE;
CP: TCONTROLEESTOQUEPRODUTO;
L: TOPFINAL_ESTAGIO_LOTE;
begin
FWC := TFWConnection.Create;
L := TOPFINAL_ESTAGIO_LOTE.Create(FWC);
C := TCONTROLEESTOQUE.Create(FWC);
CP := TCONTROLEESTOQUEPRODUTO.Create(FWC);
try
L.SelectList('ID = ' + IntToStr(LOTE.IDLOTE));
if L.Count > 0 then
begin
L.ID.Value := LOTE.IDLOTE;
L.QUANTIDADE.Value := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).QUANTIDADE.Value - 1;
L.Update;
C.ID.isNull := True;
C.DATAHORA.Value := Now;
C.USUARIO_ID.Value := USUARIO.CODIGO;
C.TIPOMOVIMENTACAO.Value := 1;
C.CANCELADO.Value := False;
C.OBSERVACAO.Value := 'Removendo entrega de item manualmente';
C.Insert;
CP.ID.isNull := True;
CP.CONTROLEESTOQUE_ID.Value := C.ID.Value;
CP.PRODUTO_ID.Value := LOTE.ID_PRODUTO;
CP.QUANTIDADE.Value := -1;
CP.Insert;
LOTE.QUANTIDADE := LOTE.QUANTIDADE - 1;
edt_Quantidade.Text := IntToStr(LOTE.QUANTIDADE);
end;
finally
FreeAndNil(L);
FreeAndNil(C);
FreeAndNil(CP);
FreeAndNil(FWC);
end;
end;
procedure TfrmImpressaoEtiquetas.CarregaEtiquetas;
var
FWC : TFWConnection;
LS : TOPFINAL_ESTAGIO_LOTE_S;
L : TOPFINAL_ESTAGIO_LOTE;
I : Integer;
begin
FWC := TFWConnection.Create;
L := TOPFINAL_ESTAGIO_LOTE.Create(FWC);
LS := TOPFINAL_ESTAGIO_LOTE_S.Create(FWC);
try
L.SelectList('ID = ' + IntToStr(LOTE.IDLOTE));
if L.Count > 0 then begin
LS.SelectList('OPFINAL_ESTAGIO_LOTE_ID = ' + IntToStr(LOTE.IDLOTE) + 'AND (NOT BAIXADO)');
if LS.Count > 0 then begin
cds_Itens.EmptyDataSet;
for I := 0 to Pred(LS.Count) do begin
cds_Itens.Append;
cds_ItensCODIGOBARRAS.Value := StrZero(TOPFINAL_ESTAGIO_LOTE_S(LS.Itens[I]).ID.asString, MinimoCodigoBarras);
cds_ItensORDEMPRODUCAO.Value := LOTE.ORDEMPRODUCAO;
cds_ItensPRODUTO.Value := edProduto.Text;
cds_ItensDATALOTE.Value := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).DATAHORAINICIO.Value;
cds_ItensCODIGOMC.Value := LOTE.CODIGOMC;
cds_ItensIDOPMC.Value := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).ORDEMPRODUCAOMC_ID.Value;
cds_Itens.Post;
end;
end;
end;
finally
FreeAndNil(LS);
FreeAndNil(L);
FreeAndNil(FWC);
end;
end;
procedure TfrmImpressaoEtiquetas.cds_ItensAfterPost(DataSet: TDataSet);
begin
edt_Quantidade.Text := IntToStr(cds_Itens.RecordCount);
end;
procedure TfrmImpressaoEtiquetas.edCodigoLocalizacaoChange(Sender: TObject);
begin
edNomeLocalizacao.Clear;
end;
procedure TfrmImpressaoEtiquetas.edCodigoLocalizacaoKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
edCodigoLocalizacaoRightButtonClick(nil);
end;
procedure TfrmImpressaoEtiquetas.edCodigoLocalizacaoRightButtonClick(
Sender: TObject);
var
FWC : TFWConnection;
L : TLOCALIZACAO;
begin
FWC := TFWConnection.Create;
L := TLOCALIZACAO.Create(FWC);
try
edCodigoLocalizacao.Text := IntToStr(DMUtil.Selecionar(L, edCodigoLocalizacao.Text, ''));
L.SelectList('id = ' + edCodigoLocalizacao.Text);
if L.Count = 1 then
edNomeLocalizacao.Text := TLOCALIZACAO(L.Itens[0]).NOME.asString;
finally
FreeAndNil(L);
FreeAndNil(FWC);
end;
end;
procedure TfrmImpressaoEtiquetas.ExecutarEvento;
var
FWC : TFWConnection;
Consulta : TFDQuery;
BuscaOP : TFDQuery;
Codigo,
CodigoOPF,
SeqEstagio: Integer;
U : TUSUARIO;
L : TOPFINAL_ESTAGIO_LOTE;
LS : TOPFINAL_ESTAGIO_LOTE_S;
LOCAL : TLOCALIZACAO;
I: Integer;
begin
if edCodigoOrdemProducao.Focused then begin
if Pos('*', edCodigoOrdemProducao.Text) > 0 then begin
CodigoOPF := StrToIntDef(LeftStr(edCodigoOrdemProducao.Text, Pos('*', edCodigoOrdemProducao.Text)-1),0);
SeqEstagio:= StrToIntDef(RightStr(edCodigoOrdemProducao.Text, (Length(edCodigoOrdemProducao.Text) - Pos('*', edCodigoOrdemProducao.Text))), 0);
if CodigoOPF > 0 then begin
FWC := TFWConnection.Create;
Consulta := TFDQuery.Create(nil);
try
try
Consulta.Close;
Consulta.SQL.Clear;
Consulta.SQL.Add('SELECT');
Consulta.SQL.Add(' OPF.ID,');
Consulta.SQL.Add(' OPFE.ID AS IDESTAGIO,');
Consulta.SQL.Add(' OPFE.SEQUENCIA,');
Consulta.SQL.Add(' (P.DESCRICAO || '' - '' || OPF.ID) AS PRODUTO,');
Consulta.SQL.Add(' P.ID AS IDPRODUTO,');
Consulta.SQL.Add(' E.TIPO,');
Consulta.SQL.Add(' MC.CODIGO AS CODIGOMC,');
Consulta.SQL.Add(' (COALESCE((SELECT SUM(COALESCE(CEP.QUANTIDADE, 0.00))');
Consulta.SQL.Add(' FROM CONTROLEESTOQUE CE INNER JOIN CONTROLEESTOQUEPRODUTO CEP ON (CEP.CONTROLEESTOQUE_ID = CE.ID)');
Consulta.SQL.Add(' WHERE (NOT CE.CANCELADO) AND CEP.PRODUTO_ID = P.ID),0.00)) AS SALDO');
Consulta.SQL.Add('FROM OPFINAL OPF');
Consulta.SQL.Add('INNER JOIN PRODUTO P ON (P.ID = OPF.PRODUTO_ID)');
Consulta.SQL.Add('INNER JOIN OPFINAL_ESTAGIO OPFE ON (OPFE.OPFINAL_ID = OPF.ID)');
Consulta.SQL.Add('INNER JOIN ESTAGIO E ON (OPFE.ESTAGIO_ID = E.ID)');
Consulta.SQL.Add('INNER JOIN MEIOCULTURA MC ON (MC.ID_PRODUTO = OPFE.MEIOCULTURA_ID)');
Consulta.SQL.Add('WHERE 1 = 1');
Consulta.SQL.Add('AND OPF.CANCELADO = FALSE');
Consulta.SQL.Add('AND OPF.ID = :CODIGOOP');
Consulta.SQL.Add('AND OPFE.SEQUENCIA = :SEQUENCIA');
Consulta.Connection := FWC.FDConnection;
Consulta.ParamByName('CODIGOOP').DataType := ftInteger;
Consulta.ParamByName('SEQUENCIA').DataType := ftInteger;
Consulta.ParamByName('CODIGOOP').Value := CodigoOPF;
Consulta.ParamByName('SEQUENCIA').Value := SeqEstagio;
Consulta.Open;
if not Consulta.IsEmpty then begin
Consulta.First;
if Consulta.FieldByName('ID').AsInteger = CodigoOPF then begin
if Consulta.FieldByName('SEQUENCIA').AsInteger = SeqEstagio then begin
edProduto.Text := Consulta.FieldByName('PRODUTO').AsString;
edCodigoOrdemProducao.Enabled := False;
LOTE.ORDEMPRODUCAO := Consulta.FieldByName('ID').AsInteger;
LOTE.SEQUENCIA := Consulta.FieldByName('SEQUENCIA').AsInteger;
LOTE.ESTAGIO := Consulta.FieldByName('IDESTAGIO').AsInteger;
LOTE.CODIGOMC := Consulta.FieldByName('CODIGOMC').AsString;
LOTE.ID_PRODUTO := Consulta.FieldByName('IDPRODUTO').AsInteger;
edNumeroLoteEstagio.Enabled := True;
if edNumeroLoteEstagio.CanFocus then
edNumeroLoteEstagio.SetFocus;
end;
end;
end;
except
on E : Exception do begin
DisplayMsg(MSG_ERR, 'Erro ao Buscar Ordem de Produção!', '', E.Message);
Exit;
end;
end;
finally
FreeAndNil(Consulta);
FreeAndNil(FWC);
end;
end;
end;
end else if edNumeroLoteEstagio.Focused then begin
if StrToIntDef(edNumeroLoteEstagio.Text, 0) > 0 then begin
FWC := TFWConnection.Create;
U := TUSUARIO.Create(FWC);
L := TOPFINAL_ESTAGIO_LOTE.Create(FWC);
LOCAL := TLOCALIZACAO.Create(FWC);
LS := TOPFINAL_ESTAGIO_LOTE_S.Create(FWC);
try
L.SelectList('OPFINAL_ESTAGIO_ID = ' + IntToStr(LOTE.ESTAGIO) + ' AND NUMEROLOTE = ' + edNumeroLoteEstagio.Text);
if L.Count > 0 then begin
U.SelectList('ID = ' + TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).USUARIO_ID.asString);
if U.Count > 0 then begin
edCodigoUsuario.Text := TUSUARIO(U.Itens[0]).ID.asString;
edNomeUsuario.Text := TUSUARIO(U.Itens[0]).NOME.asString;
edCodigoLocalizacao.Text := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).LOCALIZACAO_ID.asString;
LOCAL.SelectList('ID = ' + TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).LOCALIZACAO_ID.asString);
if LOCAL.Count > 0 then
edNomeLocalizacao.Text := TLOCALIZACAO(LOCAL.Itens[0]).NOME.asString;
LOTE.IDLOTE := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).ID.Value;
LOTE.LOCALIZACAO_ID := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).LOCALIZACAO_ID.Value;
LOTE.QUANTIDADE := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).QUANTIDADE.Value;
if LOTE.QUANTIDADE > 0 then
LOTE.FIM := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).QUANTIDADE.Value > 0;
edCodigoLocalizacao.Enabled := USUARIO.PERMITEINCLUIRETIQUETAS and (not LOTE.FIM);
if LOTE.FIM then
begin
edt_Quantidade.Text := IntToStr(LOTE.QUANTIDADE);
end
else
begin
LS.SelectList('OPFINAL_ESTAGIO_LOTE_ID = ' + IntToStr(LOTE.IDLOTE) + ' AND (NOT BAIXADO)');
if LS.Count > 0 then begin
cds_Itens.EmptyDataSet;
for I := 0 to Pred(LS.Count) do begin
cds_Itens.Append;
cds_ItensCODIGOBARRAS.Value := StrZero(TOPFINAL_ESTAGIO_LOTE_S(LS.Itens[I]).ID.asString, MinimoCodigoBarras);
cds_ItensORDEMPRODUCAO.Value := LOTE.ORDEMPRODUCAO;
cds_ItensPRODUTO.Value := edProduto.Text;
cds_ItensDATALOTE.Value := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).DATAHORAINICIO.Value;
cds_ItensNUMEROLOTE.Value := StrZero(TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).NUMEROLOTE.asString, MinimoCodigoBarras);
cds_ItensCODIGOMC.Value := LOTE.CODIGOMC;
cds_ItensIDOPMC.Value := TOPFINAL_ESTAGIO_LOTE(L.Itens[0]).ORDEMPRODUCAOMC_ID.Value;
cds_Itens.Post;
end;
end;
end;
end;
end;
finally
FreeAndNil(U);
FreeAndNil(L);
FreeAndNil(LOCAL);
FreeAndNil(LS);
FreeAndNil(FWC);
end;
edNumeroLoteEstagio.Enabled := LOTE.FIM or (cds_Itens.RecordCount = 0);
btnAdicionar.Visible := LOTE.FIM or (not edNumeroLoteEstagio.Enabled);
btnRemover.Visible := LOTE.FIM;
end;
end;
end;
procedure TfrmImpressaoEtiquetas.FormCreate(Sender: TObject);
begin
cds_Itens.CreateDataSet;
AjustaForm(Self);
end;
procedure TfrmImpressaoEtiquetas.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case Key of
VK_RETURN : ExecutarEvento;
VK_ESCAPE : begin
if LOTE.ORDEMPRODUCAO > 0 then
LimparEdits
else
Close;
end;
end;
end;
procedure TfrmImpressaoEtiquetas.ImprimirEtiquetas;
begin
if not cds_Itens.IsEmpty then begin
if AtualizaLocalizacao then begin
DMUtil.frxDBDataset1.DataSet := cds_Itens;
RelParams.Clear;
DMUtil.ImprimirRelatorio('frEtiquetaLote.fr3');
LimparEdits;
end;
end;
end;
procedure TfrmImpressaoEtiquetas.LimparEdits;
begin
edCodigoOrdemProducao.Clear;
edCodigoOrdemProducao.Enabled := True;
edNumeroLoteEstagio.Clear;
edNumeroLoteEstagio.Enabled := False;
edProduto.Clear;
cds_Itens.EmptyDataSet;
edt_Quantidade.Clear;
btnAdicionar.Visible := False;
btnRemover.Visible := False;
edCodigoLocalizacao.Enabled := False;
edt_Quantidade.Enabled := True;
edCodigoUsuario.Clear;
edNomeUsuario.Clear;
edCodigoLocalizacao.Clear;
edNomeLocalizacao.Clear;
edt_Quantidade.Clear;
LOTE.ORDEMPRODUCAO := 0;
LOTE.SEQUENCIA := 0;
LOTE.ESTAGIO := 0;
LOTE.IDLOTE := 0;
LOTE.CODIGOMC := EmptyStr;
LOTE.LOCALIZACAO_ID := 0;
LOTE.QUANTIDADE := 0;
LOTE.ID_PRODUTO := 0;
if edCodigoOrdemProducao.CanFocus then
edCodigoOrdemProducao.SetFocus;
end;
end.
|
unit HlpCRC32Fast;
{$I ..\Include\HashLib.inc}
interface
uses
HlpHashLibTypes,
HlpHash,
HlpIHash,
HlpIHashInfo,
HlpHashResult,
HlpIHashResult;
type
TCRC32Fast = class(THash, IChecksum, IHash32, ITransformBlock)
strict protected
var
FCurrentCRC: UInt32;
procedure LocalCRCCompute(const ACRCTable: THashLibUInt32Array;
const AData: THashLibByteArray; AIndex, ALength: Int32);
class function Init_CRC_Table(APolynomial: UInt32)
: THashLibUInt32Array; static;
public
constructor Create();
procedure Initialize(); override;
function TransformFinal(): IHashResult; override;
end;
TCRC32_PKZIP = class sealed(TCRC32Fast)
strict private
const
// Polynomial Reversed
CRC32_PKZIP_Polynomial = UInt32($EDB88320);
class var
FCRC32_PKZIP_Table: THashLibUInt32Array;
class constructor CRC32_PKZIP();
public
constructor Create();
procedure TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32); override;
function Clone(): IHash; override;
end;
TCRC32_CASTAGNOLI = class sealed(TCRC32Fast)
strict private
const
CRC32_CASTAGNOLI_Polynomial = UInt32($82F63B78); // Polynomial Reversed
class var
FCRC32_CASTAGNOLI_Table: THashLibUInt32Array;
class constructor CRC32_CASTAGNOLI();
public
constructor Create();
procedure TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32); override;
function Clone(): IHash; override;
end;
implementation
{ TCRC32Fast }
class function TCRC32Fast.Init_CRC_Table(APolynomial: UInt32)
: THashLibUInt32Array;
var
LIdx, LJIdx, LKIdx: Int32;
LRes: UInt32;
begin
System.SetLength(Result, 16 * 256);
for LIdx := 0 to System.Pred(256) do
begin
LRes := LIdx;
for LJIdx := 0 to System.Pred(16) do
begin
LKIdx := 0;
while LKIdx < System.Pred(9) do
begin
{ *
// branched variant
if (LRes and 1) = 1 then
begin
LRes := APolynomial xor (LRes shr 1)
end
else
begin
LRes := LRes shr 1;
end;
* }
{ *
// branchless variant
LRes := (LRes shr 1) xor (LRes and 1) * APolynomial;
* }
// faster branchless variant
LRes := (LRes shr 1) xor (-Int32(LRes and 1) and APolynomial);
Result[(LJIdx * 256) + LIdx] := LRes;
System.Inc(LKIdx);
end;
end;
end;
end;
procedure TCRC32Fast.LocalCRCCompute(const ACRCTable: THashLibUInt32Array;
const AData: THashLibByteArray; AIndex, ALength: Int32);
var
LCRC, LA, LB, LC, LD: UInt32;
LCRCTable: THashLibUInt32Array;
begin
LCRC := not FCurrentCRC; // LCRC := System.High(UInt32) xor FCurrentCRC;
LCRCTable := ACRCTable;
while ALength >= 16 do
begin
LA := LCRCTable[(3 * 256) + AData[AIndex + 12]] xor LCRCTable
[(2 * 256) + AData[AIndex + 13]] xor LCRCTable
[(1 * 256) + AData[AIndex + 14]] xor LCRCTable
[(0 * 256) + AData[AIndex + 15]];
LB := LCRCTable[(7 * 256) + AData[AIndex + 8]] xor LCRCTable
[(6 * 256) + AData[AIndex + 9]] xor LCRCTable
[(5 * 256) + AData[AIndex + 10]] xor LCRCTable
[(4 * 256) + AData[AIndex + 11]];
LC := LCRCTable[(11 * 256) + AData[AIndex + 4]] xor LCRCTable
[(10 * 256) + AData[AIndex + 5]] xor LCRCTable
[(9 * 256) + AData[AIndex + 6]] xor LCRCTable
[(8 * 256) + AData[AIndex + 7]];
LD := LCRCTable[(15 * 256) + ((LCRC and $FF) xor AData[AIndex])
] xor LCRCTable[(14 * 256) + (((LCRC shr 8) and $FF) xor AData[AIndex + 1]
)] xor LCRCTable[(13 * 256) + (((LCRC shr 16) and $FF) xor AData
[AIndex + 2])] xor LCRCTable
[(12 * 256) + ((LCRC shr 24) xor AData[AIndex + 3])];
LCRC := LD xor LC xor LB xor LA;
System.Inc(AIndex, 16);
System.Dec(ALength, 16);
end;
System.Dec(ALength);
while (ALength >= 0) do
begin
LCRC := LCRCTable[Byte(LCRC xor AData[AIndex])] xor (LCRC shr 8);
System.Inc(AIndex);
System.Dec(ALength);
end;
FCurrentCRC := not LCRC; // FCurrentCRC := LCRC xor System.High(UInt32);
end;
constructor TCRC32Fast.Create();
begin
Inherited Create(4, 1);
end;
procedure TCRC32Fast.Initialize;
begin
FCurrentCRC := 0;
end;
function TCRC32Fast.TransformFinal: IHashResult;
begin
Result := THashResult.Create(FCurrentCRC);
Initialize();
end;
{ TCRC32_PKZIP }
function TCRC32_PKZIP.Clone(): IHash;
var
HashInstance: TCRC32_PKZIP;
begin
HashInstance := TCRC32_PKZIP.Create();
HashInstance.FCurrentCRC := FCurrentCRC;
Result := HashInstance as IHash;
Result.BufferSize := BufferSize;
end;
constructor TCRC32_PKZIP.Create;
begin
Inherited Create();
end;
procedure TCRC32_PKZIP.TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32);
begin
LocalCRCCompute(FCRC32_PKZIP_Table, a_data, a_index, a_length);
end;
class constructor TCRC32_PKZIP.CRC32_PKZIP();
begin
FCRC32_PKZIP_Table := Init_CRC_Table(CRC32_PKZIP_Polynomial);
end;
{ TCRC32_CASTAGNOLI }
function TCRC32_CASTAGNOLI.Clone(): IHash;
var
HashInstance: TCRC32_CASTAGNOLI;
begin
HashInstance := TCRC32_CASTAGNOLI.Create();
HashInstance.FCurrentCRC := FCurrentCRC;
Result := HashInstance as IHash;
Result.BufferSize := BufferSize;
end;
constructor TCRC32_CASTAGNOLI.Create;
begin
Inherited Create();
end;
procedure TCRC32_CASTAGNOLI.TransformBytes(const a_data: THashLibByteArray;
a_index, a_length: Int32);
begin
LocalCRCCompute(FCRC32_CASTAGNOLI_Table, a_data, a_index, a_length);
end;
class constructor TCRC32_CASTAGNOLI.CRC32_CASTAGNOLI();
begin
FCRC32_CASTAGNOLI_Table := Init_CRC_Table(CRC32_CASTAGNOLI_Polynomial);
end;
end.
|
// RemObjects CS to Pascal 0.1
namespace UT3Bots.Communications;
interface
uses
System,
System.Collections.Generic,
System.Linq,
System.Text;
type
BotMesh = public enum(
IronGuard = -1,
Lauren = 0,
Barktooth,
Reaper,
Sharptooth,
Harbinger,
Matrix);
BotColor = public enum(
Random = -2,
None = -1,
Red = 0,
Blue = 1);
Emote = public enum(
[StringValue('TauntA')]
/// <summary>
/// Oh Yeah, Bring it on baby!
/// </summary>
BringItOn,
[StringValue('TauntB')]
/// <summary>
/// Got time to waste? Show off with some hoolahooping.
/// </summary>
HoolaHoop,
[StringValue('TauntC')]
/// <summary>
/// I got your frags, right here!
/// </summary>
PelvicThrust,
[StringValue('TauntD')]
/// <summary>
/// Boom! Headshot!
/// </summary>
BulletToTheHead,
[StringValue('TauntE')]
/// <summary>
/// Come get some!
/// </summary>
ComeHere,
[StringValue('TauntF')]
/// <summary>
/// Death is coming...
/// </summary>
SlitThroat);
FireType = public enum(
None = 0,
Firing = 1,
AltFiring = 2);
ItemType = public enum(
None = 0,
Weapon,
Ammo,
Health,
Armor);
WeaponType = public enum(
[StringValue('')]
None = 0,
[StringValue('UTWeap_ImpactHammer')]
ImpactHammer,
[StringValue('UTWeap_Enforcer')]
Enforcer,
[StringValue('UTWeap_Translocator')]
Translocator,
[StringValue('UTWeap_BioRifle_Content')]
BioRifle,
[StringValue('UTWeap_ShockRifle')]
ShockRifle,
[StringValue('UTWeap_LinkGun')]
LinkGun,
[StringValue('UTWeap_Stinger')]
Stinger,
[StringValue('UTWeap_Avril')]
Avril,
[StringValue('UTWeap_FlakCannon')]
FlakCannon,
[StringValue('UTWeap_SniperRifle')]
SniperRifle,
[StringValue('UTWeap_RocketLauncher')]
RocketLauncher,
[StringValue('UTWeap_Redeemer')]
Redeemer,
[StringValue('UTWeap_InstagibRifle')]
InstaGibRifle);
AmmoType = public enum(
[StringValue('')]
None = 0,
[StringValue('UTAmmo_ImpactHammer')]
ImpactHammer,
[StringValue('UTAmmo_Enforcer')]
Enforcer,
[StringValue('UTAmmo_Translocator')]
Translocator,
[StringValue('UTAmmo_BioRifle')]
BioRifle,
[StringValue('UTAmmo_ShockRifle')]
ShockRifle,
[StringValue('UTAmmo_LinkGun')]
LinkGun,
[StringValue('UTAmmo_Stinger')]
Stinger,
[StringValue('UTAmmo_Avril')]
Avril,
[StringValue('UTAmmo_FlakCannon')]
FlakCannon,
[StringValue('UTAmmo_SniperRifle')]
SniperRifle,
[StringValue('UTAmmo_RocketLauncher')]
RocketLauncher,
[StringValue('UTAmmo_Redeemer')]
Redeemer,
[StringValue('UTAmmo_InstagibRifle')]
InstaGibRifle);
HealthType = public enum(
[StringValue('')]
None = 0,
[StringValue('UTPickupFactory_MediumHealth')]
MediBox,
[StringValue('UTPickupFactory_HealthVial')]
HealthVial,
[StringValue('UTPickupFactory_LargeHealth')]
BigKegOHealth,
[StringValue('UTPickupFactory_SuperHealth')]
SuperHealth);
ArmorType = public enum(
[StringValue('')]
None = 0,
[StringValue('UTArmorPickup_Thighpads')]
ThighPads,
[StringValue('UTArmorPickup_Vest')]
ChestArmour,
[StringValue('UTArmorPickup_ShieldBelt')]
ShieldBelt,
[StringValue('UTArmorPickup_Helmet')]
Helmet,
[StringValue('UTPickupFactory_Berserk')]
Berserk,
[StringValue('UTPickupFactory_UDamage')]
MultiplyDamage,
[StringValue('UTPickupFactory_Invisiblity')]
Invisibility,
[StringValue('UTPickupFactory_Invulnerability')]
Invulnerability,
[StringValue('UTPickupFactory_JumpBoots')]
JumpBoots);
implementation
end.
|
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.mozilla.org/NPL/NPL-1_1Final.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: mwStringHashList.pas, released December 18, 2000.
The Initial Developer of the Original Code is Martin Waldenburg
(Martin.Waldenburg@T-Online.de).
Portions created by Martin Waldenburg are Copyright (C) 2000 Martin Waldenburg.
All Rights Reserved.
Contributor(s): ___________________.
Last Modified: 1/2/2001
Current Version: 2.0
Notes: This is a very fast Hash list for strings.
Known Issues:
-----------------------------------------------------------------------------}
{$R-}
unit mwStringHashList;
interface
uses Classes, SysUtils, Windows;
var
mwHashTable: array[#0..#255] of byte;
mwInsensitiveHashTable: array[#0..#255] of Byte;
type
TmwStringHash = function(const aString: string): Integer;
TmwStringHashCompare = function(const Str1: string; const Str2: string): Boolean;
TmwHashWord = class
S: string;
Id: Integer;
ExID: Integer;
constructor Create(aString: string; anId, anExId: Integer);
end;
PHashPointerList = ^THashPointerList;
THashPointerList = array[1..1] of TObject;
TmwBaseStringHashList = class(TObject)
FList: PHashPointerList;
fCapacity: Integer;
protected
fHash: TmwStringHash;
function Get(Index: Integer): Pointer;
procedure Put(Index: Integer; Item: Pointer);
procedure SetCapacity(NewCapacity: Integer);
public
destructor Destroy; override;
procedure Clear;
property Capacity: Integer read fCapacity;
property Items[Index: Integer]: Pointer read Get write Put; default;
end;
TmwHashStrings = class(TmwBaseStringHashList)
public
procedure AddString(aString: string; anId, anExId: Integer);
end;
TmwHashItems = class(TmwBaseStringHashList)
public
constructor Create(aHash: TmwStringHash);
procedure AddString(aString: string; anId, anExId: Integer);
end;
TmwStringHashList = class(TmwBaseStringHashList)
private
fSecondaryHash: TmwStringHash;
fCompare: TmwStringHashCompare;
public
constructor Create(Primary, Secondary: TmwStringHash; aCompare: TmwStringHashCompare);
procedure AddString(aString: string; anId, anExId: Integer);
function Hash(const S: string; var anId: Integer; var anExId: Integer): Boolean;
function HashEX(const S: string; var anId: Integer; var anExId: Integer; HashValue: Integer): Boolean;
end;
function CrcHash(const aString: string): integer;
function ICrcHash(const aString: string): integer;
function SmallCrcHash(const aString: string): integer;
function ISmallCrcHash(const aString: string): integer;
function TinyHash(const aString: string): Integer;
function ITinyHash(const aString: string): Integer;
function HashCompare(const Str1: string; const Str2: string): Boolean;
function IHashCompare(const Str1: string; const Str2: string): Boolean;
function HashSecondaryOne(const aString: string): Integer;
function HashSecondaryTwo(const aString: string): Integer;
procedure InitTables;
implementation
procedure InitTables;
var
I, K: Char;
Temp: Byte;
begin
for I := #0 to #255 do
begin
mwHashTable[I] := Ord(I);
end;
RandSeed := 255;
for I := #1 to #255 do
begin
repeat
K := Char(Random(255));
until K <> #0;
Temp := mwHashTable[I];
mwHashTable[I] := mwHashTable[K];
mwHashTable[K] := Temp;
end;
for I := #0 to #255 do
mwInsensitiveHashTable[I] := mwHashTable[AnsiLowerCase(string(I))[1]];
end;
{ based on a Hasch function by Cyrille de Brebisson }
function CrcHash(const aString: string): integer;
var
I: Integer;
begin
Result := 0;
for i := 1 to length(aString) do
begin
Result := (Result shr 4) xor (((Result xor mwHashTable[aString[I]]) and $F) * $1000);
Result := (Result shr 4) xor (((Result xor (ord(mwHashTable[aString[I]]) shr 4)) and $F) * $1000);
end;
if Result = 0 then Result := Length(aString) mod 8 + 1;
end;
function ICrcHash(const aString: string): integer;
var
I: Integer;
begin
Result := 0;
for i := 1 to length(aString) do
begin
Result := (Result shr 4) xor (((Result xor mwInsensitiveHashTable[aString[I]]) and $F) * $1000);
Result := (Result shr 4) xor (((Result xor (ord(mwInsensitiveHashTable[aString[I]]) shr 4)) and $F) * $1000);
end;
if Result = 0 then Result := Length(aString) mod 8 + 1;
end;
function SmallCrcHash(const aString: string): integer;
var
I: Integer;
begin
Result := 0;
for i := 1 to length(aString) do
begin
Result := (Result shr 4) xor (((Result xor mwHashTable[aString[I]]) and $F) * $80);
Result := (Result shr 4) xor (((Result xor (ord(mwHashTable[aString[I]]) shr 4)) and $F) * $80);
if I = 3 then break;
end;
if Result = 0 then Result := Length(aString) mod 8 + 1;
end;
function ISmallCrcHash(const aString: string): integer;
var
I: Integer;
begin
Result := 0;
for i := 1 to length(aString) do
begin
Result := (Result shr 4) xor (((Result xor mwInsensitiveHashTable[aString[I]]) and $F) * $80);
Result := (Result shr 4) xor (((Result xor (ord(mwInsensitiveHashTable[aString[I]]) shr 4)) and $F) * $80);
if I = 3 then break;
end;
if Result = 0 then Result := Length(aString) mod 8 + 1;
end;
function TinyHash(const aString: string): Integer;
var
I: Integer;
begin
Result := Length(aString);
for i := 1 to length(aString) do
begin
inc(Result, mwHashTable[aString[I]]);
Result := Result mod 128 + 1;
if I = 2 then break;
end;
end;
function ITinyHash(const aString: string): Integer;
var
I: Integer;
begin
Result := Length(aString);
for i := 1 to length(aString) do
begin
inc(Result, mwInsensitiveHashTable[aString[I]]);
Result := Result mod 128 + 1;
if I = 2 then break;
end;
end;
function HashCompare(const Str1: string; const Str2: string): Boolean;
var
I: Integer;
begin
if Length(Str1) <> Length(Str2) then
begin
Result := False;
Exit;
end;
Result := True;
for I := 1 to Length(Str1) do
if Str1[I] <> Str2[I] then
begin
Result := False;
Exit;
end;
end;
function IHashCompare(const Str1: string; const Str2: string): Boolean;
var
I: Integer;
begin
if Length(Str1) <> Length(Str2) then
begin
Result := False;
Exit;
end;
Result := True;
for I := 1 to Length(Str1) do
if mwInsensitiveHashTable[Str1[I]] <> mwInsensitiveHashTable[Str2[I]] then
begin
Result := False;
Exit;
end;
end;
function HashSecondaryOne(const aString: string): Integer;
begin
Result := Length(aString);
inc(Result, mwInsensitiveHashTable[aString[Length(aString)]]);
Result := Result mod 16 + 1;
inc(Result, mwInsensitiveHashTable[aString[1]]);
Result := Result mod 16 + 1;
end;
function HashSecondaryTwo(const aString: string): Integer;
var
I: Integer;
begin
Result := Length(aString);
for I := Length(aString) downto 1 do
begin
inc(Result, mwInsensitiveHashTable[aString[I]]);
Result := Result mod 32 + 1;
end;
end;
{ TmwHashString }
constructor TmwHashWord.Create(aString: string; anId, anExId: Integer);
begin
inherited Create;
S := aString;
Id := anId;
ExID := anExId;
end;
{ TmwBaseStringHashList }
procedure TmwBaseStringHashList.Clear;
var
I: Integer;
begin
for I := 1 to fCapacity do
if fList[I] <> nil then
fList[I].Free;
ReallocMem(FList, 0);
fCapacity := 0;
end;
destructor TmwBaseStringHashList.Destroy;
begin
Clear;
inherited Destroy;
end;
function TmwBaseStringHashList.Get(Index: Integer): Pointer;
begin
Result := nil;
if (Index > 0) and (Index <= fCapacity) then
Result := fList[Index];
end;
procedure TmwBaseStringHashList.Put(Index: Integer; Item: Pointer);
begin
if (Index > 0) and (Index <= fCapacity) then
fList[Index] := Item;
end;
procedure TmwBaseStringHashList.SetCapacity(NewCapacity: Integer);
var
I, OldCapacity: Integer;
begin
if NewCapacity > fCapacity then
begin
ReallocMem(FList, (NewCapacity) * SizeOf(Pointer));
OldCapacity := fCapacity;
FCapacity := NewCapacity;
for I := OldCapacity + 1 to NewCapacity do Items[I] := nil;
end;
end;
{ TmwHashStrings }
procedure TmwHashStrings.AddString(aString: string; anId, anExId: Integer);
begin
SetCapacity(Capacity + 1);
fList[Capacity] := TmwHashWord.Create(aString, anId, anExId);
end;
{ TmwHashItems }
procedure TmwHashItems.AddString(aString: string; anId, anExId: Integer);
var
HashWord: TmwHashWord;
HashStrings: TmwHashStrings;
HashVal: Integer;
begin
HashVal := fHash(aString);
SetCapacity(HashVal);
if Items[HashVal] = nil then
begin
Items[HashVal] := TmwHashWord.Create(aString, anId, anExId);
end else
if fList[HashVal] is TmwHashStrings then
begin
TmwHashStrings(Items[HashVal]).AddString(aString, anId, anExId);
end else
begin
HashWord := Items[HashVal];
HashStrings := TmwHashStrings.Create;
Items[HashVal] := HashStrings;
HashStrings.AddString(HashWord.S, HashWord.Id, HashWord.ExId);
HashWord.Free;
HashStrings.AddString(aString, anId, anExId)
end;
end;
constructor TmwHashItems.Create(aHash: TmwStringHash);
begin
inherited Create;
fHash := aHash;
end;
{ TmwStringHashList }
constructor TmwStringHashList.Create(Primary, Secondary: TmwStringHash; aCompare: TmwStringHashCompare);
begin
inherited Create;
fHash := Primary;
fSecondaryHash := Secondary;
fCompare := aCompare;
end;
procedure TmwStringHashList.AddString(aString: string; anId, anExId: Integer);
var
HashWord: TmwHashWord;
HashValue: Integer;
HashItems: TmwHashItems;
begin
HashValue := fHash(aString);
if HashValue >= fCapacity then SetCapacity(HashValue);
if Items[HashValue] = nil then
begin
Items[HashValue] := TmwHashWord.Create(aString, anId, anExId);
end else
if fList[HashValue] is TmwHashItems then
begin
TmwHashItems(Items[HashValue]).AddString(aString, anId, anExId);
end else
begin
HashWord := Items[HashValue];
HashItems := TmwHashItems.Create(fSecondaryHash);
Items[HashValue] := HashItems;
HashItems.AddString(HashWord.S, HashWord.Id, HashWord.ExId);
HashWord.Free;
HashItems.AddString(aString, anId, anExId);
end;
end;
function TmwStringHashList.Hash(const S: string; var anId: Integer; var anExId: Integer): Boolean;
begin
Result := HashEX(S, anId, anExId, fHash(S));
end;
function TmwStringHashList.HashEX(const S: string; var anId: Integer; var anExId: Integer; HashValue: Integer): Boolean;
var
Temp: TObject;
Hashword: TmwHashWord;
HashItems: TmwHashItems;
I, ItemHash: Integer;
begin
Result := False;
anID := -1;
anExId := -1;
if HashValue < 1 then Exit;
if HashValue > Capacity then Exit;
if Items[HashValue] <> nil then
begin
if fList[HashValue] is TmwHashWord then
begin
Hashword := Items[HashValue];
Result := fCompare(HashWord.S, S);
if Result then
begin
anID := HashWord.Id;
anExId := HashWord.ExID;
end;
end else
begin
HashItems := Items[HashValue];
ItemHash := HashItems.fHash(S);
if ItemHash > HashItems.Capacity then Exit;
Temp := HashItems[ItemHash];
if Temp <> nil then
if Temp is TmwHashWord then
begin
Result := fCompare(TmwHashWord(Temp).S, S);
if Result then
begin
anID := TmwHashWord(Temp).Id;
anExId := TmwHashWord(Temp).ExID;
end;
end else
for I := 1 to TmwHashStrings(Temp).Capacity do
begin
HashWord := TmwHashStrings(Temp)[I];
Result := fCompare(HashWord.S, S);
if Result then
begin
anID := HashWord.Id;
anExId := HashWord.ExID;
exit;
end;
end;
end;
end;
end;
initialization
InitTables;
{$R+}
end.
|
//
// This unit is part of the GLScene Project, http://glscene.org
//
{: GLProjectedTextures<p>
Implements projected textures through a GLScene object.
<b>History : </b><font size=-1><ul>
<li>05/03/10 - DanB - More state added to TGLStateCache
<li>30/03/07 - DaStr - Added $I GLScene.inc
<li>28/03/07 - DaStr - Renamed parameters in some methods
(thanks Burkhard Carstens) (Bugtracker ID = 1678658)
<li>15/06/05 - Mathx - Added the Style property and inverse rendering
<li>07/05/05 - Mathx - Support for tmBlend textures (by Ruben Javier)
<li>01/10/04 - SG - Initial (by Matheus Degiovani)
</ul></font>
}
unit GLProjectedTextures;
interface
{$I GLScene.inc}
uses
Classes, GLScene, GLTexture, OpenGL1x, OpenGLTokens, GLVectorGeometry, xopengl,
GLRenderContextInfo, GLState;
type
{: Possible styles of texture projection. Possible values:<ul>
<li>ptsOriginal: Original projection method (first pass,
is default scene render, second pass is texture
projection).
<li>ptsInverse: Inverse projection method (first pass
is texture projection, sencond pass is regular scene
render). This method is useful if you want to simulate
lighting only through projected textures (the textures
of the scene are "masked" into the white areas of
the projection textures).
</ul> }
TGLProjectedTexturesStyle = (ptsOriginal, ptsInverse);
TGLProjectedTextures = class;
// TGLTextureEmmiter
//
{: A projected texture emmiter.<p>
It's material property will be used as the projected texture.
Can be places anywhere in the scene. }
TGLTextureEmitter = class(TGLSceneObject)
private
{ Private Declarations }
FFOVy: single;
FAspect: single;
protected
{ Protected Declarations }
{: Sets up the base texture matrix for this emitter<p>
Should be called whenever a change on its properties is made.}
procedure SetupTexMatrix;
public
{ Public Declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published Declarations }
{: Indicates the field-of-view of the projection frustum.}
property FOVy: single read FFOVy write FFOVy;
{: x/y ratio. For no distortion, this should be set to
texture.width/texture.height.}
property Aspect: single read FAspect write FAspect;
end;
// TGLTextureEmitterItem
//
{: Specifies an item on the TGLTextureEmitters collection. }
TGLTextureEmitterItem = class(TCollectionItem)
private
{ Private Declarations }
FEmitter : TGLTextureEmitter;
protected
{ Protected Declarations }
procedure SetEmitter(const val : TGLTextureEmitter);
procedure RemoveNotification(aComponent : TComponent);
function GetDisplayName : String; override;
public
{ Public Declarations }
constructor Create(ACollection: TCollection); override;
procedure Assign(Source: TPersistent); override;
published
{ Published Declarations }
property Emitter: TGLTextureEmitter read FEmitter write SetEmitter;
end;
// TGLTextureEmitters
//
{: Collection of TGLTextureEmitter. }
TGLTextureEmitters = class (TCollection)
private
{ Private Declarations }
FOwner : TGLProjectedTextures;
protected
{ Protected Declarations }
function GetOwner : TPersistent; override;
function GetItems(index : Integer) : TGLTextureEmitterItem;
procedure RemoveNotification(aComponent : TComponent);
public
{ Public Declarations }
procedure AddEmitter(texEmitter: TGLTextureEmitter);
property Items[index : Integer] : TGLTextureEmitterItem read GetItems; default;
end;
// TGLProjectedTexture
//
{: Projected Textures Manager.<p>
Specifies active texture Emitters (whose texture will be projected)
and receivers (children of this object). }
TGLProjectedTextures = class(TGLImmaterialSceneObject)
private
{ Private Declarations }
FEmitters: TGLTextureEmitters;
FStyle: TGLProjectedTexturesStyle;
procedure LoseTexMatrix;
public
{ Public Declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DoRender(var ARci : TRenderContextInfo;
ARenderSelf, ARenderChildren : Boolean); override;
published
{ Published Declarations }
{: List of texture emitters. }
property Emitters: TGLTextureEmitters read FEmitters write FEmitters;
{: Indicates the style of the projected textures. }
property Style: TGLProjectedTexturesStyle read FStyle write FStyle;
end;
//-------------------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------
implementation
//-------------------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------
// ------------------
// ------------------ TGLTextureEmitter ------------------
// ------------------
// Create
//
constructor TGLTextureEmitter.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
setupTexMatrix;
FFOVy:= 90;
FAspect:= 1;
end;
// SetupTexMatrix
//
procedure TGLTextureEmitter.SetupTexMatrix;
begin
glMatrixMode(GL_TEXTURE);
glLoadIdentity;
// First scale and bias into [0..1] range.
glTranslatef(0.5, 0.5, 0);
glScalef(0.5, 0.5, 1);
// Then set the projector's "perspective" (i.e. the "spotlight cone"):.
gluPerspective(FFOVy, FAspect, 0.1, 1);
glMultMatrixf(PGLFloat(invAbsoluteMatrixAsAddress));
glMatrixMode(GL_MODELVIEW);
end;
// ------------------
// ------------------ TGLTextureEmitterItem ------------------
// ------------------
// Create
//
constructor TGLTextureEmitterItem.Create(ACollection: TCollection);
begin
inherited Create(ACollection);
end;
// Assign
//
procedure TGLTextureEmitterItem.Assign(Source: TPersistent);
begin
if Source is TGLTextureEmitterItem then begin
FEmitter:=TGLTextureEmitterItem(Source).FEmitter;
TGLProjectedTextures(TGLTextureEmitters(Collection).GetOwner).StructureChanged;
end;
inherited;
end;
// SetCaster
//
procedure TGLTextureEmitterItem.SetEmitter(const val : TGLTextureEmitter);
begin
if FEmitter<>val then begin
FEmitter:=val;
TGLProjectedTextures(TGLTextureEmitters(Collection).GetOwner).StructureChanged;
end;
end;
// RemoveNotification
//
procedure TGLTextureEmitterItem.RemoveNotification(aComponent : TComponent);
begin
if aComponent=FEmitter then
FEmitter:=nil;
end;
// GetDisplayName
//
function TGLTextureEmitterItem.GetDisplayName : String;
begin
if Assigned(FEmitter) then begin
Result:= '[TexEmitter] ' + FEmitter.Name;
end else Result:='nil';
end;
// ------------------
// ------------------ TGLTextureEmitters ------------------
// ------------------
// GetOwner
//
function TGLTextureEmitters.GetOwner : TPersistent;
begin
Result:=FOwner;
end;
// GetItems
//
function TGLTextureEmitters.GetItems(index : Integer) : TGLTextureEmitterItem;
begin
Result:=TGLTextureEmitterItem(inherited Items[index]);
end;
// RemoveNotification
//
procedure TGLTextureEmitters.RemoveNotification(aComponent : TComponent);
var
i : Integer;
begin
for i:=0 to Count-1 do
Items[i].RemoveNotification(aComponent);
end;
// AddEmitter
//
procedure TGLTextureEmitters.AddEmitter(texEmitter: TGLTextureEmitter);
var
item: TGLTextureEmitterItem;
begin
item:= TGLTextureEmitterItem(self.Add);
item.Emitter:= texEmitter;
end;
// ------------------
// ------------------ TGLProjectedTextures ------------------
// ------------------
// Create
//
constructor TGLProjectedTextures.Create(AOwner: TComponent);
begin
inherited Create(aOWner);
FEmitters:= TGLTextureEmitters.Create(TGLTextureEmitterItem);
FEmitters.FOwner:= self;
end;
// Destroy
//
destructor TGLProjectedTextures.Destroy;
begin
FEmitters.Free;
inherited destroy;
end;
// LoseTexMatrix
//
procedure TGLProjectedTextures.LoseTexMatrix;
begin
glBlendFunc(GL_ONE, GL_ZERO);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
glDisable(GL_TEXTURE_GEN_Q);
glMatrixMode(GL_TEXTURE);
glLoadIdentity;
glMatrixMode(GL_MODELVIEW);
end;
// DoRender
//
procedure TGLProjectedTextures.DoRender(var ARci: TRenderContextInfo;
ARenderSelf, ARenderChildren: boolean);
const
PS: array [0..3] of GLfloat = (1, 0, 0, 0);
PT: array [0..3] of GLfloat = (0, 1, 0, 0);
PR: array [0..3] of GLfloat = (0, 0, 1, 0);
PQ: array [0..3] of GLfloat = (0, 0, 0, 1);
var
i: integer;
emitter: TGLTextureEmitter;
begin
if not (ARenderSelf or ARenderChildren) then Exit;
if (csDesigning in ComponentState) then begin
inherited;
Exit;
end;
//First pass of original style: render regular scene
if Style = ptsOriginal then
self.RenderChildren(0, Count-1, ARci);
Arci.GLStates.PushAttrib(cAllAttribBits);
//generate planes
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, @PS);
glTexGenfv(GL_T, GL_EYE_PLANE, @PT);
glTexGenfv(GL_R, GL_EYE_PLANE, @PR);
glTexGenfv(GL_Q, GL_EYE_PLANE, @PQ);
//options
Arci.GLStates.Disable(stLighting);
Arci.GLStates.DepthFunc := cfLEqual;
Arci.GLStates.Enable(stBlend);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glEnable(GL_TEXTURE_GEN_Q);
//second pass (original) first pass (inverse): for each emiter,
//render projecting the texture summing all emitters
for i:= 0 to Emitters.Count -1 do begin
emitter:= Emitters[i].Emitter;
if not assigned(emitter) then continue;
if not emitter.Visible then continue;
emitter.Material.Apply(ARci);
ARci.GLStates.Enable(stBlend);
if Style = ptsOriginal then begin
//on the original style, render blending the textures
If emitter.Material.Texture.TextureMode <> tmBlend then
ARci.GLStates.SetBlendFunc(bfDstColor, bfOne)
Else
ARci.GLStates.SetBlendFunc(bfDstColor, bfZero);
end else begin
//on inverse style: the first texture projector should
//be a regular rendering (i.e. no blending). All others
//are "added" together creating an "illumination mask"
if i = 0 then
Arci.GLStates.SetBlendFunc(bfOne, bfZero)
else
ARci.GLStates.SetBlendFunc(bfOne, bfOne);
end;
//get this emitter's tex matrix
emitter.SetupTexMatrix;
repeat
ARci.ignoreMaterials:= true;
Self.RenderChildren(0, Count-1, ARci);
ARci.ignoreMaterials:= false;
until not emitter.Material.UnApply(ARci);
end;
LoseTexMatrix;
ARci.GLStates.PopAttrib;
//second pass (inverse): render regular scene, blending it
//with the "mask"
if Style = ptsInverse then begin
ARci.GLStates.PushAttrib(cAllAttribBits);
Arci.GLStates.Enable(stBlend);
ARci.GLStates.DepthFunc := cfLEqual;
ARci.GLStates.SetBlendFunc(bfDstColor, bfSrcColor);
//second pass: render everything, blending with what is
//already there
ARci.ignoreBlendingRequests:= true;
self.RenderChildren(0, Count-1, ARci);
ARci.ignoreBlendingRequests:= false;
ARci.GLStates.PopAttrib;
end;
end;
initialization
RegisterClasses([TGLTextureEmitter, TGLProjectedTextures]);
end.
|
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtCtrls, StdCtrls,
mmsystem,
uMultiCore;
// multicore user record
type
TMultiCoreData = record
// scanline area
StartIndex,EndIndex : integer;
// rgb-color prefix sum
AccumLength : integer;
AccumR,AccumG,AccumB : array of integer;
end;
PMultiCoreData = ^TMultiCoreData;
type
TForm1 = class(TForm)
MainPaintBox: TPaintBox;
MainMenu1: TMainMenu;
EditMenuItem: TMenuItem;
ClearMenuItem: TMenuItem;
LogMemo: TMemo;
MultiCoreMenuItem: TMenuItem;
EnableMenuItem: TMenuItem;
DisableMenuItem: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure MainPaintBoxPaint(Sender: TObject);
procedure ClearMenuItemClick(Sender: TObject);
procedure MainPaintBoxMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MainPaintBoxMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MainPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormResize(Sender: TObject);
procedure MultiCoreMenuItemClick(Sender: TObject);
procedure EnableMenuItemClick(Sender: TObject);
procedure DisableMenuItemClick(Sender: TObject);
private
{ Private 宣言 }
// enbale
MultiCoreEnable : boolean;
// core threads
corecount : integer;
// bitmap buffer
Buffer : TBitmap;
// cache bitmap scanline[]
// warning : if call TBitmap.Scaline[] function in multicore process, the speed drops markedly.
// 注意:マルチコア処理下でTBitmap.Scanline[]を使用すると、速度が著しく低下します。
// get Scanline pointer in advance to avoid it(speed drops).
// 速度低下を回避するには、あらかじめスキャラインを取得しておきましょう。
BufferScanline : array of pointer;
// user record
UserRecord : array of TMultiCoreData;
// mouse down event flag
MouseDownFlag : boolean;
// multicore blur function
procedure MultiCore_HorizonBlur(ptr:pointer);
// buffer & multicore userrecord update
procedure SizeUpdate;
public
{ Public 宣言 }
procedure DrawBuffer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ClearMenuItemClick(Sender: TObject);
begin
// clear
Buffer.Canvas.Brush.Style := bsSolid; // solid fill
Buffer.Canvas.Brush.Color := $00ffffff; // black
Buffer.Canvas.FillRect(rect(0,0,Buffer.Width,Buffer.Height));
end;
procedure TForm1.DisableMenuItemClick(Sender: TObject);
begin
MultiCoreEnable := false;
end;
procedure TForm1.DrawBuffer;
begin
BitBlt(
MainPaintBox.Canvas.Handle,
0,0,Buffer.Width,Buffer.Height,
Buffer.Canvas.Handle,
0,0,
SRCCOPY
);
end;
procedure TForm1.EnableMenuItemClick(Sender: TObject);
begin
MultiCoreEnable := true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
MultiCoreEnable := true;
// create & initialize multicore
_MultiCoreInitialize(4);
corecount := _MultiCoreManager.Count;
// buffer
Buffer := TBitmap.Create;
Buffer.HandleType := bmDIB;
Buffer.PixelFormat := pf32bit;
// multicore user record
SetLength(UserRecord,CoreCount);
// size update
// buffer & userdata & scanline
SizeUpdate;
TimeBeginPeriod(1);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
// free multicore
_MultiCoreFinalize;
// buffer
Buffer.Free;
TimeEndPeriod(1);
end;
procedure TForm1.FormResize(Sender: TObject);
begin
// To be called after FormDestroy :-Q
if not(self.Showing) then exit;
SizeUpdate;
end;
procedure TForm1.MainPaintBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MouseDownFlag := true;
// draw circle
MainPaintBoxMouseMove(sender,Shift,X,Y);
end;
procedure TForm1.MainPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
col : integer;
l : integer;
i : integer;
t : int64;
begin
if not(MouseDownFlag) then exit;
// left button
if not(Shift = [ssLeft]) then exit;
// random color
col := random($ffffff);
// draw circle
Buffer.Canvas.Pen.Style := psSolid;
Buffer.Canvas.Pen.Color := col;
Buffer.Canvas.Brush.Style := bsSolid;
Buffer.Canvas.Brush.Color := col;
l := random(20) + 60;
Buffer.Canvas.Ellipse(X-l,Y-l,X+l,Y+l);
// *** multicore processing ***
// blur buffer
// task add
for i:=0 to CoreCount-1 do
_MultiCoreManager.Add(MultiCore_HorizonBlur,@UserRecord[i]);
// start
t := TimeGetTime;
if MultiCoreEnable then _MultiCoreManager.Start // multicore mode
else _MultiCoreManager.Start(true); // single mode
// sync
_MultiCoreManager.Sync;
t := TimeGetTime - t;
// log
LogMemo.Lines.Add(IntToStr(t)+'ms');
// buffer
DrawBuffer;
// wait
sleep(10);
end;
procedure TForm1.MainPaintBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MouseDownFlag := false;
end;
procedure TForm1.MainPaintBoxPaint(Sender: TObject);
begin
DrawBuffer;
end;
procedure TForm1.MultiCoreMenuItemClick(Sender: TObject);
begin
// menu check update
EnableMenuItem.Checked := MultiCoreEnable = true;
DisableMenuItem.Checked := MultiCoreEnable= false;
end;
procedure TForm1.MultiCore_HorizonBlur(ptr: pointer);
const
blurpixel : integer = 24;
var
data : PMultiCoreData;
i,j,len : integer;
sline,eline : integer;
sptr : ^cardinal;
r,g,b : integer;
leftpos,rightpos,divcount : integer;
begin
// user record pointer
data := PMultiCoreData(ptr);
// area
sline := data.startindex;
eline := data.endindex;
for i:=sline to eline do
begin
// make prefix sum buffer(add)
// https://en.wikipedia.org/wiki/Prefix_sum
//
len := data.AccumLength;
r := 0;
g := 0;
b := 0;
sptr := BufferScanline[i];
for j:=0 to len-1 do
begin
r := r + (sptr^ and $ff0000) shr 16;
g := g + (sptr^ and $00ff00) shr 8;
b := b + (sptr^ and $0000ff);
data.AccumR[j] := r;
data.AccumG[j] := g;
data.AccumB[j] := b;
inc(sptr);
end;
// blur
// AccumRGB[pos+8] - AccumRGB[pos-8] = RGB[pos-8] + RGB[pos-7] + ... + RGB[pos+7] + RGB[pos+8]
sptr := BufferScanline[i];
for j:=0 to len-1 do
begin
leftpos := j - blurpixel;
rightpos := j + blurpixel;
if leftpos < 0 then leftpos := 0;
if rightpos > len-1 then rightpos := len-1;
divcount := rightpos - leftpos;
r := data.AccumR[rightpos] - data.AccumR[leftpos];
g := data.AccumG[rightpos] - data.AccumG[leftpos];
b := data.AccumB[rightpos] - data.AccumB[leftpos];
r := (r div divcount) and $ff;
g := (g div divcount) and $ff;
b := (b div divcount) and $ff;
r := (r shl 16) or (g shl 8) or b;
sptr^ := r;
inc(sptr);
end;
end;
end;
procedure TForm1.SizeUpdate;
var
i : integer;
begin
// buffer
Buffer.SetSize(MainPaintBox.Width,MainPaintBox.Height);
// clear
Buffer.Canvas.Brush.Style := bsSolid; // solid fill
Buffer.Canvas.Brush.Color := $00ffffff; // black
Buffer.Canvas.FillRect(rect(0,0,Buffer.Width,Buffer.Height));
// get scanline
SetLength(BufferScanline,Buffer.Height);
for i:=0 to Buffer.Height-1 do
BufferScanline[i] := Buffer.ScanLine[i];
// setup multicore user record
for i:=0 to CoreCount-1 do
begin
// process index area (do not duplicate area)
UserRecord[i].startindex := (i * Buffer.Height) div CoreCount;
UserRecord[i].endindex := ((i+1) * Buffer.Height) div CoreCount -1;
// Accumlation buffer (horizon only)
UserRecord[i].AccumLength := Buffer.Width;
SetLength(UserRecord[i].AccumR , Buffer.Width);
SetLength(UserRecord[i].AccumG , Buffer.Width);
SetLength(UserRecord[i].AccumB , Buffer.Width);
end;
end;
end.
|
unit frmContingentSafety;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.StdCtrls, dbfunc, uKernel, Vcl.Mask,
DateUtils;
type
TfContingentSafety = class(TForm)
Panel1: TPanel;
Label3: TLabel;
Label1: TLabel;
cmbPedagogue: TComboBox;
cmbAcademicYear: TComboBox;
Label2: TLabel;
cmbEducationProgram: TComboBox;
cmbLearningLevel: TComboBox;
Label6: TLabel;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Panel2: TPanel;
lvInlist: TListView;
Panel3: TPanel;
cmbOrderOut: TComboBox;
bOutGroup: TButton;
Panel4: TPanel;
Panel5: TPanel;
lvOut: TListView;
Panel6: TPanel;
lvContingentSafety: TListView;
TabSheet2: TTabSheet;
Panel8: TPanel;
lvListActualContingent: TListView;
Panel10: TPanel;
Panel11: TPanel;
lvListActualContingentOut: TListView;
Panel7: TPanel;
lvActualContingent: TListView;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure cmbPedagogueChange(Sender: TObject);
procedure cmbEducationProgramChange(Sender: TObject);
procedure cmbLearningLevelChange(Sender: TObject);
procedure lvActualContingentColumnClick(Sender: TObject;
Column: TListColumn);
private
PedagogueSurnameNP: TResultTable;
AcademicYear: TResultTable;
EducationProgram: TResultTable;
LearningLevel: TResultTable;
OutOrderList: TResultTable;
ChildInList: TResultTable; // сохранность контингента
ChildOut: TResultTable; // сохранность контингента
ReportSafety: TResultTable; // отчет о сохраности
ActualContingent: TResultTable; // фактический список детей
ActualContingentOut: TResultTable; // список отчисленных из всех групп
ReportActual: TResultTable; // отчет о фактическом списке
in_id_education_program, in_id_learning_level, in_status,
number_report: integer;
FIDPedagogue: integer;
FIDCurAcademicYear: integer;
procedure SetIDPedagogue(const Value: integer);
procedure SetIDCurAcademicYear(const Value: integer);
procedure ShowContingentSafety;
procedure ShowActualContingent;
public
property IDPedagogue: integer read FIDPedagogue write SetIDPedagogue;
property IDCurAcademicYear: integer read FIDCurAcademicYear
write SetIDCurAcademicYear;
end;
var
fContingentSafety: TfContingentSafety;
implementation
{$R *.dfm}
{ TForm1 }
procedure TfContingentSafety.cmbEducationProgramChange(Sender: TObject);
begin
if cmbEducationProgram.ItemIndex = 0 then
in_id_education_program := 0
else
in_id_education_program := EducationProgram
[cmbEducationProgram.ItemIndex - 1].ValueByName('ID');
ShowContingentSafety;
ShowActualContingent;
end;
procedure TfContingentSafety.cmbLearningLevelChange(Sender: TObject);
begin
if cmbLearningLevel.ItemIndex = 0 then
in_id_learning_level := 0
else
in_id_learning_level := LearningLevel[cmbLearningLevel.ItemIndex - 1]
.ValueByName('ID');
ShowContingentSafety;
ShowActualContingent;
end;
procedure TfContingentSafety.cmbPedagogueChange(Sender: TObject);
begin
if cmbPedagogue.ItemIndex = 0 then
IDPedagogue := 0
else
IDPedagogue := PedagogueSurnameNP[cmbPedagogue.ItemIndex - 1]
.ValueByName('ID_OUT');
ShowContingentSafety;
ShowActualContingent;
end;
procedure TfContingentSafety.FormCreate(Sender: TObject);
begin
AcademicYear := nil;
PedagogueSurnameNP := nil;
EducationProgram := nil;
LearningLevel := nil;
OutOrderList := nil;
ChildInList := nil;
ChildOut := nil;
ReportSafety := nil;
ActualContingent := nil;
ActualContingentOut := nil;
ReportActual := nil;
end;
procedure TfContingentSafety.FormDestroy(Sender: TObject);
begin
if Assigned(AcademicYear) then
FreeAndNil(AcademicYear);
if Assigned(PedagogueSurnameNP) then
FreeAndNil(PedagogueSurnameNP);
if Assigned(EducationProgram) then
FreeAndNil(EducationProgram);
if Assigned(LearningLevel) then
FreeAndNil(LearningLevel);
if Assigned(OutOrderList) then
FreeAndNil(OutOrderList);
if Assigned(ChildInList) then
FreeAndNil(ChildInList);
if Assigned(ChildOut) then
FreeAndNil(ChildOut);
if Assigned(ReportSafety) then
FreeAndNil(ReportSafety);
if Assigned(ActualContingent) then
FreeAndNil(ActualContingent);
if Assigned(ActualContingentOut) then
FreeAndNil(ActualContingentOut);
if Assigned(ReportActual) then
FreeAndNil(ReportActual);
end;
procedure TfContingentSafety.FormShow(Sender: TObject);
begin
if MonthOf(Now) < 9 then
number_report := 3;
if not Assigned(AcademicYear) then
AcademicYear := Kernel.GetAcademicYear;
Kernel.FillingComboBox(cmbAcademicYear, AcademicYear, 'NAME', false);
Kernel.ChooseComboBoxItemIndex(cmbAcademicYear, AcademicYear, true, 'ID',
IDCurAcademicYear);
if not Assigned(PedagogueSurnameNP) then
PedagogueSurnameNP := Kernel.GetPedagogueSurnameNP;
Kernel.FillingComboBox(cmbPedagogue, PedagogueSurnameNP, 'SurnameNP', true);
Kernel.ChooseComboBoxItemIndex(cmbPedagogue, PedagogueSurnameNP, true,
'ID_OUT', IDPedagogue);
if not Assigned(EducationProgram) then
EducationProgram := Kernel.GetEducationProgram;
Kernel.FillingComboBox(cmbEducationProgram, EducationProgram, 'NAME', true);
cmbEducationProgram.ItemIndex := 0;
if not Assigned(LearningLevel) then
LearningLevel := Kernel.GetLearningLevel;
Kernel.FillingComboBox(cmbLearningLevel, LearningLevel, 'NAME', true);
cmbLearningLevel.ItemIndex := 0;
if not Assigned(OutOrderList) then
OutOrderList := Kernel.GetInOutOrderList(0, 2);
Kernel.FillingComboBox(cmbOrderOut, OutOrderList, 'NUMBER_DATES_NAME', false);
cmbOrderOut.ItemIndex := 0;
ShowContingentSafety;
ShowActualContingent;
end;
procedure TfContingentSafety.lvActualContingentColumnClick(Sender: TObject;
Column: TListColumn);
begin
// number_report := Column.Index;
// ShowActualContingent(number_report);
end;
procedure TfContingentSafety.SetIDCurAcademicYear(const Value: integer);
begin
if FIDCurAcademicYear <> Value then
FIDCurAcademicYear := Value;
end;
procedure TfContingentSafety.SetIDPedagogue(const Value: integer);
begin
if FIDPedagogue <> Value then
FIDPedagogue := Value;
end;
procedure TfContingentSafety.ShowActualContingent;
begin
if cmbEducationProgram.ItemIndex = 0 then
in_id_education_program := 0
else
in_id_education_program := EducationProgram
[cmbEducationProgram.ItemIndex - 1].ValueByName('ID');
IDCurAcademicYear := AcademicYear[cmbAcademicYear.ItemIndex]
.ValueByName('ID');
if Assigned(ActualContingent) then
FreeAndNil(ActualContingent);
// в Kernel в запросе сделать сортировку по дате по убывания, а фамилии - как есть
ActualContingent := Kernel.GetActualContingent(IDPedagogue, IDCurAcademicYear,
in_id_education_program);
Kernel.GetLVActualContingent(lvListActualContingent, ActualContingent);
if Assigned(ActualContingentOut) then
FreeAndNil(ActualContingentOut);
ActualContingentOut := Kernel.GetActualContingentOut(IDPedagogue, IDCurAcademicYear,
in_id_education_program);
Kernel.GetLVActualContingentOut(lvListActualContingentOut, ActualContingentOut)
end;
procedure TfContingentSafety.ShowContingentSafety;
begin
if Assigned(ChildInList) then
FreeAndNil(ChildInList);
// входные параметры для хранимки
// in_id_pedagogue, in_id_academic_year, in_id_education_program, in_id_learning_level, in_status: integer;
ChildInList := Kernel.GetChildListForContingent(IDPedagogue,
IDCurAcademicYear, in_id_education_program, in_id_learning_level, 1);
Kernel.GetLVContingentInList(lvInlist, ChildInList);
if Assigned(ChildOut) then
FreeAndNil(ChildOut);
ChildOut := Kernel.GetChildListForContingent(IDPedagogue, IDCurAcademicYear,
in_id_education_program, in_id_learning_level, 2);
Kernel.GetLVContingentOut(lvOut, ChildOut);
end;
end.
|
unit Chapter06._02_Solution1;
{$mode objfpc}{$H+}
interface
uses
Classes,
SysUtils,
DeepStar.Utils,
AI.TreeNode;
// 144. Binary Tree Preorder Traversal
// https://leetcode.com/problems/binary-tree-preorder-traversal/description/
// 二叉树的前序遍历
// 时间复杂度: O(n), n为树的节点个数
// 空间复杂度: O(h), h为树的高度
type
TSolution = class(TObject)
public
function preorderTraversal(root: TTreeNode): TList_int;
end;
procedure Main;
implementation
procedure Main;
var
a: TArr_int;
l: TList_int;
t: TTreeNode;
begin
a := [1, 3, 2];
TArrayUtils_int.Print(a);
t := TTreeNode.Create(a);
with TSolution.Create do
begin
l := preorderTraversal(t);
TArrayUtils_int.Print(l.ToArray);
Free;
end;
l.Free;
t.ClearAndFree;
end;
{ TSolution }
function TSolution.preorderTraversal(root: TTreeNode): TList_int;
var
list: TList_int;
procedure __pre__(node: TTreeNode);
begin
if node = nil then Exit;
list.AddLast(node.Val);
__pre__(node.Left);
__pre__(node.Right);
end;
begin
list := TList_int.Create;
__pre__(root);
Result := list;
end;
end.
|
{..............................................................................}
{ Summary Demo the use of Client's RunCommonDialog process }
{ Copyright (c) 2003 by Altium Limited }
{..............................................................................}
{..............................................................................}
{..............................................................................}
Procedure RunADialogProcess;
Var
S : String;
Value : Integer;
Begin
// available parameters for Dialog: Color or FileOpenSave Names
ResetParameters;
AddStringParameter('Dialog','Color'); // color dialog
AddStringParameter('Color', '0'); // black color
RunProcess('Client:RunCommonDialog');
//Result value obtained from the RunCommonDialog's Ok or Cancel buttons.
GetStringParameter('Result',S);
If (S = 'True') Then
Begin
GetStringParameter('Color',S);
ShowInfo('New color is ' + S);
End;
End;
{..............................................................................}
{..............................................................................} |
unit UArqRetornoItau;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, ALed, ExtCtrls, FMTBcd, DB, SqlExpr, DBClient, Grids, DBGrids, SMDBGrid, StdCtrls,
Mask, JvToolEdit, dbxpress, UDM1, rsDBUtils;
type
TfArqRetornoItau = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Label1: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
ALed1: TALed;
Label8: TLabel;
ALed2: TALed;
Label2: TLabel;
ALed3: TALed;
Label3: TLabel;
dsmArquivo: TDataSource;
Label4: TLabel;
ALed4: TALed;
ALed5: TALed;
Label6: TLabel;
SMDBGrid1: TSMDBGrid;
qCReceberParc: TSQLQuery;
qCReceberParcNUMCRECEBER: TIntegerField;
qCReceberParcPARCELA: TStringField;
qCReceberParcVLRVENCIMENTO: TFloatField;
qCReceberParcDTVENCIMENTO: TDateField;
qCReceberParcQUITADO: TStringField;
qCReceberParcJUROSCALC: TFloatField;
qCReceberParcDTPAGTO: TDateField;
qCReceberParcCODCLIENTE: TIntegerField;
qCReceberParcNUMNOTA: TIntegerField;
qCReceberParcVLRDESCONTO: TFloatField;
qCReceberParcVLRPAGTO: TFloatField;
qCReceberParcVLRRESTANTE: TFloatField;
qCReceberParcCODVENDEDOR: TIntegerField;
qCReceberParcPERCCOMISSAO: TFloatField;
qCReceberParcAGENCIA: TStringField;
qCReceberParcTITPORTADOR: TStringField;
qCReceberParcCODTIPOCOBRANCA: TIntegerField;
qCReceberParcVLRDESPESA: TFloatField;
qCReceberParcCODBANCO: TIntegerField;
qCReceberParcPGCARTORIO: TStringField;
qCReceberParcTITPROTESTADO: TStringField;
qCReceberParcQTDDIASPROT: TIntegerField;
qCReceberParcDTMOVIMENTO: TDateField;
qCReceberParcDIASATRASO: TIntegerField;
qCReceberParcJUROSPAGOS: TFloatField;
qCReceberParcCANCELADO: TStringField;
qCReceberParcTIPODOC: TStringField;
qCReceberParcVLRDEVOLUCAO: TFloatField;
qCReceberParcCODCONDPGTO: TIntegerField;
qCReceberParcDTDEVOLUCAO: TDateField;
qCReceberParcCOBRANCAEMITIDA: TStringField;
JvFilenameEdit1: TJvFilenameEdit;
mArquivo: TClientDataSet;
mArquivoNumTitEmpresa: TStringField;
mArquivoNumTitBanco: TStringField;
mArquivoCodCarteira: TStringField;
mArquivoCodOcorrenciaRet: TStringField;
mArquivoNomeOcorrenciaRet: TStringField;
mArquivoDtOcorrencia: TStringField;
mArquivoNumNota: TStringField;
mArquivoDtVenc: TStringField;
mArquivoVlrTitulo: TFloatField;
mArquivoEspecieDoc: TStringField;
mArquivoVlrDespesaCobranca: TFloatField;
mArquivoVlrIOF: TFloatField;
mArquivoVlrAbatimento: TFloatField;
mArquivoVlrDesconto: TFloatField;
mArquivoVlrPago: TFloatField;
mArquivoVlrJurosPagos: TFloatField;
mArquivoDtLiquidacao: TStringField;
mArquivoInstrCancelada: TStringField;
mArquivoNomeCliente: TStringField;
mArquivoErros: TStringField;
mArquivoCodLiquidacao: TStringField;
mArquivoDescLiquidacao: TStringField;
mArquivoAtualizado: TStringField;
mArquivoTipo: TStringField;
mArquivoCodCliente: TIntegerField;
mArquivoParcela: TStringField;
mArquivoDescErro2: TStringField;
mArquivoDescErro1: TStringField;
mArquivoDescErro3: TStringField;
mArquivoDescErro4: TStringField;
mArquivoNumCReceber: TIntegerField;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure SMDBGrid1GetCellParams(Sender: TObject; Field: TField;
AFont: TFont; var Background: TColor; Highlight: Boolean);
private
{ Private declarations }
Fdm1: Tdm1;
vNumMov, vNumMovJuros : Integer;
vHistorico : String;
vFilial : Integer;
vMotivo : String;
procedure Grava_NumBanco;
procedure Grava_Historico;
procedure Grava_MovFinanceiro(Tipo : String);
//procedure Grava_Liquidacao;
//procedure Grava_Historico(Tipo, Historico : String); //E- Entrada L- Liquidação P-Protestado
// procedure Pagamento;
// procedure Grava_Protesto;
procedure Grava_Vencimento;
procedure Motivo_Rejeicao(Codigo : String);
procedure Motivo_Ocorrencia28(Codigo : String);
public
{ Public declarations }
end;
var
fArqRetornoItau: TfArqRetornoItau;
implementation
uses UDMCons;
{$R *.DFM}
procedure TfArqRetornoItau.Grava_MovFinanceiro(Tipo : String);
begin
Fdm1.tMovFinanceiro.Close;
Fdm1.MovFinanceiro.Params[0].AsInteger := 0;
Fdm1.tMovFinanceiro.Open;
Fdm1.tMovFinanceiro.Insert;
Fdm1.tMovFinanceiroNUMMOVTO.AsInteger := Fdm1.Incrementa('NUMMOVTO','MOVFINANCEIRO');
Fdm1.tMovFinanceiroCODBANCO.AsInteger := Fdm1.tCReceberParcCODBANCO.AsInteger;
Fdm1.tMovFinanceiroTIPOMOV.AsString := 'REC';
Fdm1.tMovFinanceiroDTMOVIMENTO.AsDateTime := Fdm1.tCReceberParcDTPAGTO.AsDateTime;
if Tipo = 'D' then
begin
Fdm1.tMovFinanceiroVLRENTRADA.AsFloat := Fdm1.tCReceberParcVLRPAGTO.AsFloat;
Fdm1.tMovFinanceiroHISTORICO.AsString := 'Recto. Dupl. ' + Fdm1.tCReceberHistNUMCRECEBER.AsString + ' parcela ' + Fdm1.tCReceberHistPARCELA.AsString + ' de ' + Fdm1.tCReceberParcNOMECLIENTE.AsString;
end
else
if Tipo = 'J' then
begin
Fdm1.tMovFinanceiroVLRENTRADA.AsFloat := Fdm1.tCReceberParcVLRPAGTO.AsFloat;
Fdm1.tMovFinanceiroHISTORICO.AsString := 'Recto. Juros da Dupl. ' + Fdm1.tCReceberHistNUMCRECEBER.AsString + ' parcela ' + Fdm1.tCReceberHistPARCELA.AsString + ' de ' + Fdm1.tCReceberParcNOMECLIENTE.AsString;
end;
if DmCons.qCliente.Locate('ID',Fdm1.tCReceberParcCODCLIENTE.AsInteger,([LocaseInsensitive])) then
Fdm1.tMovFinanceiroTIPOPESSOA.AsString := DmCons.qClientePESSOA.AsString;
Fdm1.tMovFinanceiro.Post;
Fdm1.tMovFinanceiro.ApplyUpdates(0);
end;
procedure TfArqRetornoItau.Grava_Historico;
var
vAux : Integer;
begin
Fdm1.tCReceberHist.Close;
Fdm1.CReceberHist.Params[0].AsInteger := mArquivoNumCReceber.AsInteger;
Fdm1.CReceberHist.Params[1].AsString := mArquivoParcela.AsString;
Fdm1.tCReceberHist.Open;
Fdm1.tCReceberHist.Last;
vAux := Fdm1.tCReceberHistITEM.AsInteger + 1;
Fdm1.tCReceberHist.Insert;
Fdm1.tCReceberHistNUMCRECEBER.AsInteger := mArquivoNumCReceber.AsInteger;
Fdm1.tCReceberHistPARCELA.AsString := mArquivoParcela.AsString;
Fdm1.tCReceberHistITEM.AsInteger := vAux;
Fdm1.tCReceberHistDTHISTORICO.AsDateTime := Date;
Fdm1.tCReceberHistCODBANCO.AsInteger := Fdm1.tCReceberParcCODBANCO.AsInteger;
if (mArquivoCodOcorrenciaRet.AsString = '06') or (mArquivoCodOcorrenciaRet.AsString = '08')
or (mArquivoCodOcorrenciaRet.AsString = '09') or (mArquivoCodOcorrenciaRet.AsString = '10') then
begin
Fdm1.tCReceberHistDTULTPGTO.AsDateTime := Fdm1.tCReceberParcDTPAGTO.AsDateTime;
if mArquivoVlrPago.AsFloat > 0 then
Fdm1.tCReceberHistVLRULTPGTO.AsFloat := mArquivoVlrPago.AsFloat
else
Fdm1.tCReceberHistVLRULTPGTO.AsFloat := mArquivoVlrTitulo.AsFloat;
Fdm1.tCReceberHistVLRULTJUROSPAGO.AsFloat := mArquivoVlrJurosPagos.AsFloat;
Fdm1.tCReceberHistVLRULTDESCONTO.AsFloat := mArquivoVlrDesconto.AsFloat;
Fdm1.tCReceberHistVLRULTDESPESA.AsFloat := mArquivoVlrDesconto.AsFloat;
Fdm1.tCReceberHistTIPOHIST.AsString := 'P';
if StrToFloat(FormatFloat('0.00',Fdm1.tCReceberParcVLRRESTANTE.AsFloat)) > 0 then
Fdm1.tCReceberHistHISTORICO.AsString := 'PAGAMENTO PARCIAL - Sistema Itaú'
else
Fdm1.tCReceberHistHISTORICO.AsString := 'PAGAMENTO TOTAL - Sistema Itaú';
Grava_MovFinanceiro('D');
Fdm1.tCReceberHistNUMMOVFINANC.AsInteger := Fdm1.tMovFinanceiroNUMMOVTO.AsInteger;
if mArquivoVlrJurosPagos.AsFloat > 0 then
begin
Grava_MovFinanceiro('J');
Fdm1.tCReceberHistNUMMOVJUROS.AsInteger := Fdm1.tMovFinanceiroNUMMOVTO.AsInteger;
end;
end
else
if mArquivoCodOcorrenciaRet.AsString = '23' then
Fdm1.tCReceberHistHISTORICO.AsString := 'PROTESTO ENVIADO A CARTÓRIO/TARIFA';
Fdm1.tCReceberHist.Post;
Fdm1.tCReceberHist.ApplyUpdates(0);
end;
procedure TfArqRetornoItau.Motivo_Ocorrencia28(Codigo : String);
begin
if Codigo = '03' then
vMotivo := 'Tarifa de sustação'
else
if Codigo = '04' then
vMotivo := 'Tarifa de protesto'
else
if Codigo = '08' then
vMotivo := 'Tarifa de custas de protesto'
else
if Codigo = 'A9' then
vMotivo := 'Tarifa de manutenção de título vencido'
else
if Codigo = 'B1' then
vMotivo := 'Tarifa de baixa da carteira'
else
if Codigo = 'B2' then
vMotivo := 'Tarifa de rateio dos custos de impressão completa de bloquetos'
else
if Codigo = 'B3' then
vMotivo := 'Tarifa de registro de entrada do título'
else
if Codigo = 'F5' then
vMotivo := 'Tarifa de entrada na rede SICREDI'
else
if Codigo = 'E1' then
vMotivo := 'Tarifa de rateio impressão completa posta não';
end;
procedure TfArqRetornoItau.Motivo_Rejeicao(Codigo : String);
var
i, i2 : Integer;
vDescricao : String;
begin
i := 1;
i2 := 0;
while i <= Length(Codigo) do
begin
if mArquivoCodOcorrenciaRet.AsString = '03' then
begin
inc(i2);
case StrToInt(Copy(Codigo,i,2)) of
03 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NÃO FOI POSSÍVEL ATRIBUIR A AGÊNCIA PELO CEP OU CEP INVÁLIDO';
04 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'SIGLA DO ESTADO INVÁLIDA';
05 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'PRAZO DA OPERAÇÃO MENOR QUE PRAZO MÍNIMO OU MAIOR QUE O MÁXIMO';
07 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'VALOR DO TÍTULO MAIOR QUE 10.000.000,00';
08 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NÃO INFORMADO OU DESLOCADO';
09 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'AGÊNCIA ENCERRADA';
10 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NÃO INFORMADO OU DESLOCADO';
11 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'CEP NÃO NUMÉRICO';
12 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NOME NÃO INFORMADO OU DESLOCADO (BANCOS CORRESPONDENTES)';
13 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'CEP INCOMPATÍVEL COM A SIGLA DO ESTADO';
14 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NOSSO NÚMERO JÁ REGISTRADO NO CADASTRO DO BANCO OU FORA DA FAIXA';
15 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NOSSO NÚMERO EM DUPLICIDADE NO MESMO MOVIMENTO';
18 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'DATA DE ENTRADA INVÁLIDA PARA OPERAR COM ESTA CARTEIRA';
19 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'OCORRÊNCIA INVÁLIDA';
21 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'CARTEIRA NÃO ACEITA DEPOSITÁRIA CORRESPONDENTE';
22 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'CARTEIRA NÃO PERMITIDA (NECESSÁRIO CADASTRAR FAIXA LIVRE)';
27 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'CGC DO CEDENTE INAPTO';
29 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'CATEGORIA DA CONTA INVÁLIDA ';
35 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'IOF MAIOR QUE 5%';
36 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'QUANTIDADE DE MOEDA INCOMPATÍVEL COM VALOR DO TÍTULO';
37 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NÃO NUMÉRICO OU IGUAL A ZEROS';
42 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'NOSSO NÚMERO FORA DE FAIXA';
52 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'EMPRESA NÃO ACEITA BANCO CORRESPONDENTE';
53 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'EMPRESA NÃO ACEITA BANCO CORRESPONDENTE - COBRANÇA MENSAGEM';
54 : mArquivo.FieldByName('DescErro'+IntToStr(i2)).AsString := 'BANCO CORRESPONDENTE - TÍTULO COM VENCIMENTO INFERIOR A 15 DIAS';
end;
i := i + 2;
end
else
if mArquivoCodOcorrenciaRet.AsString = '17' then //Nota 20 tabela 2
begin
end
else
if mArquivoCodOcorrenciaRet.AsString = '16' then //Nota 20 tabela 3
begin
end
else
if mArquivoCodOcorrenciaRet.AsString = '15' then //Nota 20 tabela 4
begin
end
else
if mArquivoCodOcorrenciaRet.AsString = '18' then //Nota 20 tabela 5
begin
end
else
if mArquivoCodOcorrenciaRet.AsString = '25' then //Nota 20 tabela 6
begin
inc(i2);
case StrToInt(Copy(Codigo,i,4)) of
0 :;
end;
i := i + 4;
end
else
if mArquivoCodOcorrenciaRet.AsString = '24' then //Nota 20 tabela 7
begin
inc(i2);
case StrToInt(Copy(Codigo,i,4)) of
0 :;
end;
i := i + 4;
end
else
if mArquivoCodOcorrenciaRet.AsString = '57' then //Nota 20 tabela 8
begin
inc(i2);
case StrToInt(Copy(Codigo,i,4)) of
0 :;
end;
i := i + 4;
end;
end;
end;
{procedure TfArqRetornoItau.Grava_Protesto;
begin
Fdm1.tCReceberParc.Edit;
Fdm1.tCReceberParcTitProtestado.AsBoolean := True;
Fdm1.tCReceberParc.Post;
Grava_Historico('P','TITULO PROTESTADO');
Fdm1.tCReceberParcHist.Post;
mArquivo.Edit;
mArquivoAtualizado.AsBoolean := True;
mArquivo.Post;
end;}
procedure TfArqRetornoItau.Grava_Vencimento;
begin
{ Fdm1.tCReceberParc.Edit;
vHistorico := 'DT.VECTO. ALTERADA DE ' + Fdm1.tCReceberParcDtVencCReceber.AsString + ' PARA ' + mArquivoDtVecto.AsString;
Fdm1.tCReceberParcDtVencCReceber.AsDateTime := mArquivoDtVecto.AsDateTime;
Fdm1.tCReceberParc.Post;
Grava_Historico('V',vHistorico);
Fdm1.tCReceberParcHist.Post;
mArquivo.Edit;
mArquivoAtualizado.AsBoolean := True;
mArquivo.Post;}
end;
{procedure TfArqRetornoItau.Grava_Historico(Tipo, Historico : String);
begin
DM2.tCReceberParcHist2.Refresh;
DM2.tCReceberParcHist2.Last;
Fdm1.tCReceberParcHist.Insert;
Fdm1.tCReceberParcHistNumCReceber.AsInteger := Fdm1.tCReceberParcNumCReceber.AsInteger;
Fdm1.tCReceberParcHistParcCReceber.AsInteger := Fdm1.tCReceberParcParcCReceber.AsInteger;
Fdm1.tCReceberParcHistItem.AsInteger := DM2.tCReceberParcHist2Item.AsInteger + 1;
Fdm1.tCReceberParcHistDtHistorico.AsDateTime := Date;
Fdm1.tCReceberParcHistCodHistorico.AsCurrency := 0;
Fdm1.tCReceberParcHistHistorico.AsString := Historico;
if Tipo = 'L' then
begin
Fdm1.tCReceberParcHistDtUltPgto.AsDateTime := mArquivoDtOcorrencia.AsDateTime;
Fdm1.tCReceberParcHistVlrUltPgto.AsCurrency := mArquivoVlrPago.AsFloat;
Fdm1.tCReceberParcHistVlrUltJuros.AsFloat := mArquivoVlrJurosPago.AsFloat;
Fdm1.tCReceberParcHistVlrUltDescontos.AsFloat := mArquivoVlrDesconto.AsFloat;
Fdm1.tCReceberParcHistVlrUltDespesas.AsFloat := 0;
Fdm1.tCReceberParcHistVlrUltAbatimentos.AsFloat := mArquivoVlrAbatimento.AsFloat;
Fdm1.tCReceberParcHistJurosPagos.AsFloat := mArquivoVlrJurosPago.AsFloat;
Fdm1.tCReceberParcHistPgto.AsBoolean := True;
Fdm1.tCReceberParcHistNumMov.AsInteger := vNumMov;
Fdm1.tCReceberParcHistNumMovJuros.AsInteger := vNumMovJuros;
Fdm1.tCReceberParcHistJurosCalc.AsFloat := mArquivoVlrJurosPago.AsFloat;
end
else
Fdm1.tCReceberParcHistPgto.AsBoolean := False;
end;}
procedure TfArqRetornoItau.Grava_NumBanco;
begin
{Fdm1.tCReceberParc.Edit;
Fdm1.tCReceberParcNumTitBanco.AsString := mArquivoNumTitBanco.AsString;
Fdm1.tCReceberParc.Post;
Grava_Historico('E','ENTRADA CONFIRMADA');
Fdm1.tCReceberParcHist.Post;
mArquivo.Edit;
mArquivoAtualizado.AsBoolean := True;
mArquivo.Post;}
end;
procedure TfArqRetornoItau.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := Cafree;
end;
procedure TfArqRetornoItau.BitBtn2Click(Sender: TObject);
begin
mArquivo.EmptyDataSet;
end;
procedure TfArqRetornoItau.BitBtn1Click(Sender: TObject);
var
Txt : TextFile;
Entrada, Arquivo, Texto1 : String;
i : Integer;
vFlag : Boolean;
vContinuar : Boolean;
begin
if jvFileNameEdit1.Text <> '' then
begin
try
vContinuar := True;
mArquivo.EmptyDataSet;
Arquivo := JvFilenameEdit1.FileName;
AssignFile(Txt,Arquivo);
Reset(Txt);
while not Eof(Txt) do
begin
ReadLn(Txt,Entrada);
if (Copy(Entrada,2,1) = '2') and (Copy(Entrada,3,7) = 'RETORNO') then
begin
if Fdm1.tBcoItauNUMCONTA.AsString <> Copy(Entrada,33,5) then
begin
vContinuar := False;
ShowMessage('Nº da conta diferente ' + Copy(Entrada,33,5));
end;
end;
if vContinuar then
begin
if Copy(Entrada,1,1) = '1' then
begin
mArquivo.Insert;
mArquivoAtualizado.AsString := 'N';
mArquivoNumTitBanco.AsString := Copy(Entrada,86,8) + Copy(Entrada,94,1);
mArquivoCodOcorrenciaRet.AsString := Copy(Entrada,109,2);
Case mArquivoCodOcorrenciaRet.AsInteger of
2 : mArquivoNomeOcorrenciaRet.AsString := 'ENTRADA CONFIRMADA';
3 : mArquivoNomeOcorrenciaRet.AsString := 'ENTRADA REJEITADA';
4 : mArquivoNomeOcorrenciaRet.AsString := 'ALTERAÇÃO DE DADOS - NOVA ENTRADA';
5 : mArquivoNomeOcorrenciaRet.AsString := 'ALTERAÇÃO DE DADOS - BAIXA';
6 : mArquivoNomeOcorrenciaRet.AsString := 'LIQUIDAÇÃO NORMAL';
8 : mArquivoNomeOcorrenciaRet.AsString := 'LIQUIDAÇÃO CARTÓRIO';
9 : mArquivoNomeOcorrenciaRet.AsString := 'BAIXA SIMPLES';
10 : mArquivoNomeOcorrenciaRet.AsString := 'BAIXA POR TER SIDO LIQUIDADO';
11 : mArquivoNomeOcorrenciaRet.AsString := 'EM SER (SÓ NO RETORNO MENSAL)';
12 : mArquivoNomeOcorrenciaRet.AsString := 'ABATIMENTO CONCEDIDO';
13 : mArquivoNomeOcorrenciaRet.AsString := 'ABATIMENTO CANCELADO';
14 : mArquivoNomeOcorrenciaRet.AsString := 'VENCIMENTO ALTERADO';
15 : mArquivoNomeOcorrenciaRet.AsString := 'BAIXAS REJEITADAS';
16 : mArquivoNomeOcorrenciaRet.AsString := 'INSTRUÇÕES REJEITADAS';
17 : mArquivoNomeOcorrenciaRet.AsString := 'ALTERAÇÃO DE DADOS REJEITADOS ';
18 : mArquivoNomeOcorrenciaRet.AsString := 'COBRANÇA CONTRATUAL - ABATIMENTO E BAIXA BLOQUEADOS';
19 : mArquivoNomeOcorrenciaRet.AsString := 'CONFIRMA RECEBIMENTO DE INSTRUÇÃO DE PROTESTO';
20 : mArquivoNomeOcorrenciaRet.AsString := 'CONFIRMA RECEBIMENTO DE INSTRUÇÃO DE SUSTAÇÃO DE PROTESTO /TARIFA';
21 : mArquivoNomeOcorrenciaRet.AsString := 'CONFIRMA RECEBIMENTO DE INSTRUÇÃO DE NÃO PROTESTAR';
23 : mArquivoNomeOcorrenciaRet.AsString := 'PROTESTO ENVIADO A CARTÓRIO/TARIFA';
24 : mArquivoNomeOcorrenciaRet.AsString := 'INSTRUÇÃO DE PROTESTO REJEITADA / SUSTADA / PENDENTE';
25 : mArquivoNomeOcorrenciaRet.AsString := 'ALEGAÇÕES DO SACADO';
26 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA DE AVISO DE COBRANÇA';
27 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA DE EXTRATO POSIÇÃO';
28 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA DE RELAÇÃO DAS LIQUIDAÇÕES';
29 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA DE MANUTENÇÃO DE TÍTULOS VENCIDOS';
30 : mArquivoNomeOcorrenciaRet.AsString := 'DÉBITO MENSAL DE TARIFAS (PARA ENTRADAS E BAIXAS)';
32 : mArquivoNomeOcorrenciaRet.AsString := 'BAIXA POR TER SIDO PROTESTADO';
33 : mArquivoNomeOcorrenciaRet.AsString := 'CUSTAS DE PROTESTO';
34 : mArquivoNomeOcorrenciaRet.AsString := 'CUSTAS DE SUSTAÇÃO';
35 : mArquivoNomeOcorrenciaRet.AsString := 'CUSTAS DE CARTÓRIO DISTRIBUIDOR';
36 : mArquivoNomeOcorrenciaRet.AsString := 'CUSTAS DE EDITAL';
37 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA DE EMISSÃO DE BLOQUETO/TARIFA DE ENVIO DE DUPLICATA';
38 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA DE INSTRUÇÃO';
39 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA DE OCORRÊNCIAS';
40 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA MENSAL DE EMISSÃO DE BLOQUETO/TARIFA MENSAL DE ENVIO DE DUPLICATA';
41 : mArquivoNomeOcorrenciaRet.AsString := 'DÉBITO MENSAL DE TARIFAS - EXTRATO DE POSIÇÃO (B4EP/B4OX)';
42 : mArquivoNomeOcorrenciaRet.AsString := 'DÉBITO MENSAL DE TARIFAS - OUTRAS INSTRUÇÕES';
43 : mArquivoNomeOcorrenciaRet.AsString := 'DÉBITO MENSAL DE TARIFAS - MANUTENÇÃO DE TÍTULOS VENCIDOS';
44 : mArquivoNomeOcorrenciaRet.AsString := 'DÉBITO MENSAL DE TARIFAS - OUTRAS OCORRÊNCIAS';
45 : mArquivoNomeOcorrenciaRet.AsString := 'DÉBITO MENSAL DE TARIFAS - PROTESTO';
46 : mArquivoNomeOcorrenciaRet.AsString := 'DÉBITO MENSAL DE TARIFAS - SUSTAÇÃO DE PROTESTO';
47 : mArquivoNomeOcorrenciaRet.AsString := 'BAIXA COM TRANSFERÊNCIA PARA DESCONTO';
48 : mArquivoNomeOcorrenciaRet.AsString := 'CUSTAS DE SUSTAÇÃO JUDICIAL';
51 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA MENSAL REF A ENTRADAS BANCOS CORRESPONDENTES NA CARTEIRA';
52 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA MENSAL BAIXAS NA CARTEIRA';
53 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA MENSAL BAIXAS EM BANCOS CORRESPONDENTES NA CARTEIRA';
54 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA MENSAL DE LIQUIDAÇÕES NA CARTEIRA';
55 : mArquivoNomeOcorrenciaRet.AsString := 'TARIFA MENSAL DE LIQUIDAÇÕES EM BANCOS CORRESPONDENTES NA CARTEIRA';
56 : mArquivoNomeOcorrenciaRet.AsString := 'CUSTAS DE IRREGULARIDADE';
57 : mArquivoNomeOcorrenciaRet.AsString := 'INSTRUÇÃO CANCELADA';
end;
mArquivoErros.AsString := Copy(Entrada,378,8);
vMotivo := '';
Motivo_Rejeicao(Trim(Copy(Entrada,378,8)));
mArquivoDtOcorrencia.AsString := Copy(Entrada,111,2) + '/' + Copy(Entrada,113,2) + '/' + '20' + Copy(Entrada,115,2);
mArquivoNumNota.AsString := Copy(Entrada,117,10);
mArquivoNumTitEmpresa.AsString := Copy(Entrada,38,25);
mArquivoDtVenc.AsString := Copy(Entrada,147,2) + '/' + Copy(Entrada,149,2) + '/' + '20' + Copy(Entrada,151,2);
mArquivoVlrTitulo.AsString := Copy(Entrada,153,11) + ',' + Copy(Entrada,164,2);
if Trim(Copy(Entrada,174,2)) <> '' then
begin
case StrToInt(Copy(Entrada,174,2)) of
01 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'DUPLICATA MERCANTIL';
02 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'NOTA PROMISSÓRIA';
03 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'NOTA DE SEGURO';
04 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'MENSALIDADE ESCOLAR';
05 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'RECIBO';
06 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'CONTRATO';
07 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'COSSEGUROS';
08 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'DUPLICATA DE SERVIÇO';
09 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'LETRA DE CÂMBIO';
13 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'NOTA DE DÉBITOS';
99 : mArquivoEspecieDoc.AsString := Copy(Entrada,174,2) + '-' + 'DIVERSOS';
end;
end;
mArquivoVlrDespesaCobranca.AsString := Copy(Entrada,176,11) + ',' + Copy(Entrada,187,2);
mArquivoVlrAbatimento.AsString := Copy(Entrada,228,11) + ',' + Copy(Entrada,239,2);
mArquivoVlrDesconto.AsString := Copy(Entrada,241,11) + ',' + Copy(Entrada,252,2);
mArquivoVlrPago.AsString := Copy(Entrada,254,11) + ',' + Copy(Entrada,265,2);
mArquivoVlrJurosPagos.AsString := Copy(Entrada,267,11) + ',' + Copy(Entrada,278,2);
if (Copy(Entrada,296,2) = ' ') or (Copy(Entrada,296,2) = '') then
mArquivoDtLiquidacao.AsString := ''
else
mArquivoDtLiquidacao.AsString := Copy(Entrada,296,2) + '/' + Copy(Entrada,298,2) + '/' + '20' + Copy(Entrada,300,2);
vFlag := False;
texto1 := Trim(Copy(mArquivoNumTitEmpresa.AsString,8,Length(mArquivoNumTitEmpresa.AsString)));
for i := 1 to Length(texto1) do
begin
if (Copy(texto1,i,1) = '/') then
vFlag := True
else
begin
case vFlag of
True : mArquivoParcela.AsString := mArquivoParcela.AsString + copy(texto1,i,1);
False : mArquivoNumNota.AsString := mArquivoNumNota.AsString + copy(texto1,i,1);
end;
end;
end;
mArquivoTipo.AsString := Copy(Entrada,38,1);
//********************
if mArquivoNumNota.AsString <> '' then
begin
qCReceberParc.Close;
qCReceberParc.SQL.Clear;
qCReceberParc.SQL.Add('SELECT *');
qCReceberParc.SQL.Add('FROM CRECEBERPARC');
qCReceberParc.SQL.Add('WHERE codcliente = :CodCliente');
qCReceberParc.SQL.Add(' AND Parcela = :Parcela');
if mArquivoTipo.AsString = 'A' then
qCReceberParc.SQL.Add(' AND NumCReceber = :NumNota')
else
qCReceberParc.SQL.Add(' AND NumNota = :NumNota');
qCReceberParc.ParamByName('CodCliente').AsString := Copy(Entrada,39,5);
qCReceberParc.ParamByName('Parcela').AsString := mArquivoParcela.AsString;
qCReceberParc.ParamByName('NumNota').AsString := mArquivoNumNota.AsString;
qCReceberParc.Open;
if not qCReceberParc.IsEmpty then
begin
mArquivoNumCReceber.AsInteger := qCReceberParcNumCReceber.AsInteger;
mArquivoCodCliente.AsInteger := qCReceberParcCODCLIENTE.AsInteger;
mArquivoNomeCliente.AsString := Copy(Entrada,325,30);
end
else
begin
mArquivoCodCliente.AsInteger := 0;
mArquivoNomeCliente.AsString := '...NÃO ACHOU TÍTULO, verificar...';
end;
end;
mArquivo.Post;
end;
end;
end;
CloseFile(Txt);
except
end;
end
else
begin
ShowMessage('Você deve informar um arquivo p/ gerar a busca!');
JvFilenameEdit1.SetFocus;
end;
end;
procedure TfArqRetornoItau.BitBtn3Click(Sender: TObject);
var
TD : TTransactionDesc;
begin
try
TD.TransactionID := 1;
TD.IsolationLevel := xilREADCOMMITTED;
Fdm1.Conexao.StartTransaction(TD);
mArquivo.First;
while not mArquivo.Eof do
begin
if mArquivoNumNota.AsString <> '' then
begin
Fdm1.tCReceberParc.Close;
Fdm1.CReceberParc.Params[0].AsInteger := mArquivoNumCReceber.AsInteger;
Fdm1.CReceberParc.Params[1].AsString := mArquivoParcela.AsString;
Fdm1.tCReceberParc.Open;
Fdm1.tCReceberParc.Edit;
Fdm1.tCReceberParcCODBANCO.AsInteger := Fdm1.tBcoItauCODCONTA.AsInteger;
Fdm1.tCReceberParcVLRDESPESA.AsFloat := mArquivoVlrDespesaCobranca.AsFloat;
Fdm1.tCReceberParcVLRDESCONTO.AsFloat := mArquivoVlrDesconto.AsFloat;
if (mArquivoCodOcorrenciaRet.AsString = '06') or (mArquivoCodOcorrenciaRet.AsString = '08')
or (mArquivoCodOcorrenciaRet.AsString = '09') or (mArquivoCodOcorrenciaRet.AsString = '10') then
begin
if mArquivoVlrPago.AsFloat > 0 then
begin
Fdm1.tCReceberParcVLRRESTANTE.AsFloat := Fdm1.tCReceberParcVLRRESTANTE.AsFloat - mArquivoVlrPago.AsFloat;
Fdm1.tCReceberParcVLRPAGTO.AsFloat := mArquivoVlrPago.AsFloat;
end
else
begin
Fdm1.tCReceberParcVLRRESTANTE.AsFloat := Fdm1.tCReceberParcVLRRESTANTE.AsFloat - mArquivoVlrTitulo.AsFloat;
Fdm1.tCReceberParcVLRPAGTO.AsFloat := mArquivoVlrTitulo.AsFloat;
end;
if (mArquivoDtLiquidacao.AsString <> '') and (mArquivoDtLiquidacao.AsString <> ' / / ') then
Fdm1.tCReceberParcDTPAGTO.AsDateTime := mArquivoDtLiquidacao.AsDateTime
else
Fdm1.tCReceberParcDTPAGTO.AsDateTime := mArquivoDtOcorrencia.AsDateTime;
Fdm1.tCReceberParcJUROSPAGOS.AsFloat := mArquivoVlrJurosPagos.AsFloat;
if StrToFloat(FormatFloat('0.00',Fdm1.tCReceberParcVLRRESTANTE.AsFloat)) > 0 then
Fdm1.tCReceberParcQUITADO.AsString := 'N'
else
Fdm1.tCReceberParcQUITADO.AsString := 'S';
if Fdm1.tCReceberParcDTPAGTO.AsDateTime > Fdm1.tCReceberParcDTVENCIMENTO.AsDateTime then
Fdm1.tCReceberParcDIASATRASO.AsFloat := Fdm1.tCReceberParcDTPAGTO.AsDateTime - Fdm1.tCReceberParcDTVENCIMENTO.AsDateTime;
end;
Grava_Historico;
Fdm1.tCReceberParc.Post;
Fdm1.tCReceberParc.ApplyUpdates(0);
end;
mArquivo.Next;
end;
Fdm1.Conexao.Commit(TD);
except
on E:Exception do
begin
Fdm1.Conexao.Rollback(TD);
ShowMessage('Erro ao tentar gravar o registro : ' + E.Message);
end;
end;
if MessageDlg('Atualizar o contas a receber?',mtconfirmation,[mbok,mbno],0)=mrok then
begin
mArquivo.First;
while not mArquivo.Eof do
begin
if mArquivoCodCliente.AsInteger > 0 then
begin
// Abre_CReceber;
end;
mArquivo.Next;
end;
end;
end;
procedure TfArqRetornoItau.SMDBGrid1GetCellParams(Sender: TObject;
Field: TField; AFont: TFont; var Background: TColor; Highlight: Boolean);
begin
{ if (mArquivoAtualizado.AsBoolean) and (mArquivoCodOcorrenciaRet.AsInteger = 2) then
begin
Background := clAqua;
AFont.Color := clBlack;
end
else
if (mArquivoAtualizado.AsBoolean) and ((mArquivoCodOcorrenciaRet.AsInteger = 6) or
(mArquivoCodOcorrenciaRet.AsInteger = 7) or (mArquivoCodOcorrenciaRet.AsInteger = 15)) then
begin
Background := clTeal;
AFont.Color := clBlack;
end
else
if (mArquivoAtualizado.AsBoolean) and (mArquivoCodOcorrenciaRet.AsInteger = 19) then
begin
Background := clRed;
AFont.Color := clBlack;
end
else
if mArquivoCodOcorrenciaRet.AsInteger = 3 then
begin
Background := clYellow;
AFont.Color := clBlack;
end
else
if mArquivoCodOcorrenciaRet.AsInteger = 14 then
begin
Background := clMaroon;
AFont.Color := clYellow;
end;}
end;
end.
|
unit glButtonPattern;
interface
uses
{$IFDEF VER230} WinAPI.Windows, WinAPI.Messages {$ELSE} Windows, Messages
{$ENDIF}, SysUtils, Classes, Controls, Graphics, PNGimage;
type
TglButtonPattern = class(TComponent)
private
FImageLeave, FImageEnter, FImageDown: TPicture;
procedure SetImageLeave(value: TPicture);
procedure SetImageEnter(value: TPicture);
procedure SetImageDown(value: TPicture);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property ImageLeave: TPicture read FImageLeave write SetImageLeave;
property ImageEnter: TPicture read FImageEnter write SetImageEnter;
property ImageDown: TPicture read FImageDown write SetImageDown;
end;
procedure Register;
implementation
{ TglButtonPattern }
procedure Register;
begin
RegisterComponents('Golden Line', [TglButtonPattern]);
end;
constructor TglButtonPattern.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FImageLeave := TPicture.Create;
FImageEnter := TPicture.Create;
FImageDown := TPicture.Create;
end;
destructor TglButtonPattern.Destroy;
begin
FImageLeave.Free;
FImageEnter.Free;
FImageDown.Free;
inherited;
end;
procedure TglButtonPattern.SetImageDown(value: TPicture);
begin
FImageDown.Assign(value);
end;
procedure TglButtonPattern.SetImageEnter(value: TPicture);
begin
FImageEnter.Assign(value);
end;
procedure TglButtonPattern.SetImageLeave(value: TPicture);
begin
FImageLeave.Assign(value);
end;
end.
|
unit CollectionProp;
interface
uses
Classes, dcedit, dcfdes, dcsystem, dcdsgnstuff;
type
TCollectionProp = class(TPropertyEditor)
public
function Collection: TCollection;
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
procedure RegisterCollectionPropertyEditor;
implementation
uses
CollectionEditor;
procedure RegisterCollectionPropertyEditor;
begin
RegisterPropertyEditor(TypeInfo(TCollection), nil, '', TCollectionProp);
end;
{ TCollectionProp }
function TCollectionProp.Collection: TCollection;
begin
Result := TCollection(GetOrdValue);
end;
procedure TCollectionProp.Edit;
var
n: string;
begin
n := GetComponent(0).GetNamePath + '.' + GetName;
//n := Collection.Owner.GetNamePath + '.' + GetName;
//n := Collection.GetNamePath + '.Items';
// if cached editor, show it
// if Collection.Editor <> nil then
// TCollectionEditorForm(Collection.Editor).Show
// else
with TCollectionEditorForm.Create(nil) do
begin
Designer := Self.Designer;
Collection := Self.Collection;
CollectionName := n;
Show;
end;
end;
function TCollectionProp.GetAttributes: TPropertyAttributes;
begin
Result := [ paDialog ];
end;
function TCollectionProp.GetValue: string;
begin
Result := '(' + Collection.ClassName + ')';
end;
end.
|
unit uFrmMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, XiButton, ExtCtrls, StdCtrls, cxControls, cxContainer, cxEdit,
cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar;
type
TfrmMain = class(TForm)
pnlBottom: TPanel;
btnOk: TXiButton;
btnCancel: TXiButton;
Notebook: TNotebook;
edtPetDate: TcxDateEdit;
lbSaleDate: TLabel;
Image1: TImage;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
chkSaledata: TCheckBox;
chkInventoryData: TCheckBox;
Label8: TLabel;
procedure FormShow(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure btnOkClick(Sender: TObject);
procedure chkSaledataClick(Sender: TObject);
private
procedure SaleControl;
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
uses uDM;
{$R *.dfm}
procedure TfrmMain.FormShow(Sender: TObject);
begin
edtPetDate.Date := Trunc(Now);
Notebook.PageIndex := 1;
DM.FEnableLog := False;
if ParamCount > 0 then
begin
if ParamStr(1) <> '' then
try
edtPetDate.Date := StrToDate(ParamStr(1));
except
edtPetDate.Date := Trunc(Now-1);
end;
if ParamCount > 1 then
try
chkInventoryData.Checked := (ParamStr(2) = '1');
except
chkInventoryData.Checked := True;
end;
if ParamCount > 2 then
DM.FEnableLog := (ParamStr(3) = '1');
btnOkClick(Self);
Close;
end;
end;
procedure TfrmMain.btnCancelClick(Sender: TObject);
begin
Close;
end;
procedure TfrmMain.btnOkClick(Sender: TObject);
begin
try
Screen.Cursor := crHourGlass;
btnOk.Enabled := False;
btnCancel.Enabled := False;
Notebook.PageIndex := 0;
Application.ProcessMessages;
Sleep(0);
// DM.SendPetDate(edtPetDate.Date, chkSaledata.Checked, chkInventoryData.Checked);
DM.SendPetDate(edtPetDate.Date, chkSaledata.Checked, false);
finally
Screen.Cursor := crDefault;
btnOk.Enabled := True;
btnCancel.Enabled := True;
Notebook.PageIndex := 1;
Application.ProcessMessages;
end;
end;
procedure TfrmMain.SaleControl;
begin
lbSaleDate.Visible := chkSaledata.Checked;
edtPetDate.Visible := chkSaledata.Checked;
end;
procedure TfrmMain.chkSaledataClick(Sender: TObject);
begin
SaleControl;
end;
end.
|
{*
* Outliner Lighto
* Copyright (C) 2011 Kostas Michalopoulos
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* Kostas Michalopoulos <badsector@runtimelegend.com>
*}
unit Nodes;
interface
{$MODE OBJFPC}{$H+}
uses SysUtils;
type
TNode = class;
TNodeType = (ntNormal, ntTickable, ntPointer);
TNodeChildren = array of TNode;
{ TNode }
TNode = class
private
FTarget: TNode;
FTargetAddress: string;
FText: string;
FNodeType: TNodeType;
FTick: Boolean;
FParent: TNode;
FChildren: TNodeChildren;
FOpen: Boolean;
FWasOpen: Boolean;
FFresh: Boolean;
function GetChildren: TNodeChildren;
function GetTargetNodeType: TNodeType;
function GetText: string;
function GetTick: Boolean;
procedure SetFresh(const AValue: Boolean);
procedure SetNodeType(const AValue: TNodeType);
procedure SetOpen(const AValue: Boolean);
procedure SetParent(const AValue: TNode);
procedure SetTarget(const AValue: TNode);
procedure SetText(const AValue: string);
procedure SetTick(const AValue: Boolean);
procedure SetWasOpen(const AValue: Boolean);
public
constructor Create;
destructor Destroy; override;
procedure Add(AChild: TNode);
function AddStr(Str: string): TNode;
procedure Remove(AChild: TNode);
procedure Insert(AChild: TNode; AIndex: Integer);
function IndexOf(AChild: TNode): Integer;
procedure OrderChildren;
function HasChildren: Boolean;
function TickPercent: Integer;
function Address: string;
procedure Save(var f: TextFile);
procedure Load(var f: TextFile);
property Text: string read GetText write SetText;
property NodeType: TNodeType read FNodeType write SetNodeType;
property TargetNodeType: TNodeType read GetTargetNodeType;
property Tick: Boolean read GetTick write SetTick;
property Parent: TNode read FParent;
property Children: TNodeChildren read GetChildren;
property Open: Boolean read FOpen write SetOpen;
property WasOpen: Boolean read FWasOpen write SetWasOpen;
property Fresh: Boolean read FFresh write SetFresh;
property Target: TNode read FTarget write SetTarget;
property TargetAddress: string read FTargetAddress write FTargetAddress; // note: used for loading
end;
implementation
procedure TNode.SetText(const AValue: string);
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then FTarget.Text:=AValue;
end else begin
if FText=AValue then Exit;
FText:=AValue;
end;
end;
function TNode.GetChildren: TNodeChildren;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then Result:=FTarget.Children else Result:=nil;
end else Result:=FChildren;
end;
function TNode.GetTargetNodeType: TNodeType;
begin
if FNodeType=ntPointer then begin
if Assigned(FTarget) then Exit(FTarget.TargetNodeType) else Exit(ntNormal);
end else Exit(FNodeType);
end;
function TNode.GetText: string;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then Result:=FTarget.Text else Result:='(no target)';
end else Result:=FText;
end;
function TNode.GetTick: Boolean;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then Result:=FTarget.Tick else Result:=False;
end else Result:=FTick;
end;
procedure TNode.SetFresh(const AValue: Boolean);
begin
if FFresh=AValue then Exit;
FFresh:=AValue;
end;
procedure TNode.SetNodeType(const AValue: TNodeType);
begin
if FNodeType=AValue then Exit;
FNodeType:=AValue;
end;
procedure TNode.SetOpen(const AValue: Boolean);
begin
if FOpen=AValue then Exit;
FOpen:=AValue;
end;
procedure TNode.SetParent(const AValue: TNode);
begin
if FParent=AValue then Exit;
FParent:=AValue;
end;
procedure TNode.SetTarget(const AValue: TNode);
begin
if FTarget=AValue then Exit;
FTarget:=AValue;
end;
procedure TNode.SetTick(const AValue: Boolean);
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then FTarget.Tick:=AValue;
end else begin
if FTick=AValue then Exit;
FTick:=AValue;
end;
end;
procedure TNode.SetWasOpen(const AValue: Boolean);
begin
if FWasOpen=AValue then Exit;
FWasOpen:=AValue;
end;
constructor TNode.Create;
begin
end;
destructor TNode.Destroy;
var
i: Integer;
begin
for i:=0 to Length(FChildren) - 1 do FreeAndNil(FChildren[i]);
end;
procedure TNode.Add(AChild: TNode);
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then FTarget.Add(AChild);
Exit;
end;
if AChild.Parent <> nil then AChild.Parent.Remove(AChild);
AChild.FParent:=self;
SetLength(FChildren, Length(FChildren) + 1);
FChildren[Length(FChildren) - 1]:=AChild;
end;
function TNode.AddStr(Str: string): TNode;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then Result:=FTarget.AddStr(Str) else Result:=nil;
Exit;
end;
Result:=TNode.Create;
Result.Text:=Str;
Add(Result);
end;
procedure TNode.Remove(AChild: TNode);
var
Idx, i: Integer;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then FTarget.Remove(AChild);
Exit;
end;
Idx:=IndexOf(AChild);
if Idx=-1 then Exit;
for i:=Idx to Length(FChildren) - 2 do FChildren[i]:=FChildren[i + 1];
SetLength(FChildren, Length(FChildren) - 1);
AChild.FParent:=nil;
end;
procedure TNode.Insert(AChild: TNode; AIndex: Integer);
var
i: Integer;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then FTarget.Insert(AChild, AIndex);
Exit;
end;
if AChild.FParent <> nil then AChild.FParent.Remove(AChild);
SetLength(FChildren, Length(FChildren) + 1);
for i:=Length(FChildren) - 1 downto AIndex + 1 do FChildren[i]:=FChildren[i - 1];
FChildren[AIndex]:=AChild;
AChild.FParent:=Self;
end;
function TNode.IndexOf(AChild: TNode): Integer;
var
i: Integer;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then Result:=FTarget.IndexOf(AChild) else Result:=-1;
Exit;
end;
for i:=0 to Length(FChildren) - 1 do if FChildren[i]=AChild then Exit(i);
Result:=-1;
end;
procedure TNode.OrderChildren;
var
i, j: Integer;
Tmp: TNode;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then FTarget.OrderChildren;
Exit;
end;
for i:=1 to Length(FChildren) - 1 do begin
Tmp:=FChildren[i];
j:=i - 1;
while True do begin
if AnsiCompareStr(FChildren[j].Text, Tmp.Text) > 0 then begin
Children[j + 1]:=FChildren[j];
j:=j - 1;
if j < 0 then break;
end else break;
end;
FChildren[j + 1]:=Tmp;
end;
end;
function TNode.HasChildren: Boolean;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then Result:=FTarget.HasChildren else Result:=False;
Exit;
end;
Result:=Length(FChildren) > 0;
end;
function TNode.TickPercent: Integer;
var
i, Per: Integer;
Done, From: Int64;
begin
if NodeType=ntPointer then begin
if Assigned(FTarget) then Exit(FTarget.TickPercent) else Exit(100);
end;
if NodeType <> ntTickable then Exit(100);
if not HasChildren then
if Tick then Exit(100) else Exit(0);
Done:=0;
From:=0;
for i:=0 to Length(FChildren) - 1 do begin
if not (FChildren[i].NodeType in [ntTickable, ntPointer]) then Continue;
Per:=FChildren[i].TickPercent;
Done:=Done + Per;
Inc(From);
end;
if From=0 then Exit(0);
Result:=Done div From;
end;
function TNode.Address: string;
begin
if Assigned(FParent) then Address:=Trim(FParent.Address + ' ' + IntToStr(FParent.IndexOf(Self)));
end;
procedure TNode.Save(var f: TextFile);
var
i: Integer;
begin
WriteLn(f, 'NODE ', Text);
case NodeType of
ntNormal: WriteLn(f, 'TYPE NORMAL');
ntTickable: WriteLn(f, 'TYPE TICKABLE');
ntPointer: begin
WriteLn(f, 'TYPE POINTER');
if Assigned(FTarget) then WriteLn(f, 'LINK ', FTarget.Address);
end;
end;
if Tick then WriteLn(f, 'TICK');
if Open and WasOpen then WriteLn(f, 'OPEN');
for i:=0 to Length(FChildren) - 1 do begin
if FChildren[i].Fresh and (FChildren[i].Text='') then Continue;
FChildren[i].Save(f);
end;
WriteLn(f, 'DONE');
end;
procedure TNode.Load(var f: TextFile);
var
s, Cmd, Arg: string;
begin
while not Eof(f) do begin
Readln(f, s);
if Length(s) < 4 then Continue;
Cmd:=Copy(s, 1, 4);
Arg:=Copy(s, 6, Length(s));
if Cmd='DONE' then break
else if Cmd='TYPE' then begin
if Arg='NORMAL' then NodeType:=ntNormal
else if Arg='TICKABLE' then NodeType:=ntTickable
else if Arg='POINTER' then NodeType:=ntPointer;
end else if Cmd='TICK' then
Tick:=True
else if Cmd='OPEN' then begin
Open:=True;
WasOpen:=True;
end else if Cmd='NODE' then begin
AddStr(Arg).Load(f);
end else if Cmd='LINK' then begin
TargetAddress:=Arg;
end;
end;
end;
end.
|
//
// VXScene Component Library, based on GLScene http://glscene.sourceforge.net
//
{
Support-code to load OCT Files into TVXFreeForm-Components in GLScene.
(OCT being the format output from FSRad, http://www.fluidstudios.com/fsrad.html).
}
unit VXS.FileOCT;
interface
{$I VXScene.inc}
uses
System.SysUtils,
System.Classes,
FMX.Graphics,
VXS.VectorFileObjects,
VXS.VectorGeometry,
VXS.ApplicationFileIO,
VXS.Texture,
VXS.Material,
VXS.Graphics,
VXS.CrossPlatform,
VXS.State,
VXS.Utils,
VXS.TextureFormat,
uFileOCT;
type
{ The OCT vector file (FSRad output). }
TVXOCTVXVectorFile = class(TVXVectorFile)
public
class function Capabilities: TVXDataFileCapabilities; override;
procedure LoadFromStream(aStream: TStream); override;
end;
var
vFileOCTLightmapBrightness: single = 1;
// Mrqzzz : scaling factor, 1.0 = unchanged
vFileOCTLightmapGammaCorrection: single = 1;
// Mrqzzz : scaling factor, 1.0 = unchanged
vFileOCTAllocateMaterials: boolean = True;
// Mrqzzz : Flag to avoid loading materials (useful for IDE Extensions or scene editors)
// ------------------------------------------------------------------
implementation
// ------------------------------------------------------------------
// ------------------
// ------------------ TVXOCTVXVectorFile ------------------
// ------------------
// Capabilities
class function TVXOCTVXVectorFile.Capabilities: TVXDataFileCapabilities;
begin
Result := [dfcRead];
end;
procedure TVXOCTVXVectorFile.LoadFromStream(aStream: TStream);
var
i, y, n: integer;
oct: TOCTFile;
octFace: POCTFace;
octLightmap: POCTLightmap;
mo: TVXMeshObject;
fg: TFGVertexIndexList;
lightmapLib: TVXMaterialLibrary;
lightmapBmp: TBitmap;
libMat: TVXLibMaterial;
begin
oct := TOCTFile.Create(aStream);
try
mo := TVXMeshObject.CreateOwned(Owner.MeshObjects);
mo.Mode := momFaceGroups;
lightmapLib := Owner.LightmapLibrary;
if (Assigned(lightmapLib)) and (vFileOCTAllocateMaterials) then
begin
// import lightmaps
n := oct.Header.numLightmaps;
lightmapBmp := TBitmap.Create;
try
{ TODO : E2129 Cannot assign to a read-only property }
(*lightmapBmp.PixelFormat := glpf24bit;*)
lightmapBmp.Width := 128;
lightmapBmp.Height := 128;
for i := 0 to n - 1 do
begin
octLightmap := @oct.Lightmaps[i];
// Brightness correction
if vFileOCTLightmapBrightness <> 1.0 then
BrightenRGBArray(@octLightmap.map,
lightmapBmp.Width * lightmapBmp.Height,
vFileOCTLightmapBrightness);
// Gamma correction
if vFileOCTLightmapGammaCorrection <> 1.0 then
GammaCorrectRGBArray(@octLightmap.map,
lightmapBmp.Width * lightmapBmp.Height,
vFileOCTLightmapGammaCorrection);
// convert RAW RGB to BMP
for y := 0 to 127 do
{ TODO : E2003 Undeclared identifier: 'ScanLine' }
(*
Move(octLightmap.map[y * 128 * 3],
lightmapBmp.ScanLine[127 - y]^, 128 * 3);
*)
// spawn lightmap
libMat := lightmapLib.AddTextureMaterial(IntToStr(i), lightmapBmp);
with libMat.Material.Texture do
begin
MinFilter := miLinear;
TextureWrap := twNone;
TextureFormat := tfRGB;
end;
end;
finally
lightmapBmp.Free;
end;
end;
// import geometry
n := oct.Header.numVerts;
mo.Vertices.AdjustCapacityToAtLeast(n);
mo.TexCoords.AdjustCapacityToAtLeast(n);
mo.LightMapTexCoords.AdjustCapacityToAtLeast(n);
for i := 0 to n - 1 do
with oct.Vertices[i] do
begin
mo.Vertices.Add(pos.X, pos.Y, pos.Z);
mo.TexCoords.Add(tv.s, tv.t);
mo.LightMapTexCoords.Add(lv.s, lv.t);
end;
// import faces
n := oct.Header.numFaces;
for i := 0 to n - 1 do
begin
octFace := @oct.Faces[i];
fg := TFGVertexIndexList.CreateOwned(mo.FaceGroups);
fg.Mode := fgmmTriangleFan;
fg.VertexIndices.AddSerie(octFace.start, 1, octFace.num);
if (Assigned(lightmapLib)) and (vFileOCTAllocateMaterials) then
fg.LightMapIndex := octFace.lid;
end;
finally
oct.Free;
end;
end;
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
initialization
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
RegisterVectorFileFormat('oct', 'FSRad OCT files', TVXOCTVXVectorFile);
end.
|
unit TextureAtlasExtractorBase;
interface
uses BasicMathsTypes, BasicDataTypes, Geometry, NeighborhoodDataPlugin, MeshPluginBase, Math,
NeighborDetector, IntegerList, LOD;
{$INCLUDE source/Global_Conditionals.inc}
type
TTextureSeed = record
MinBounds, MaxBounds: TVector2f;
TransformMatrix : TMatrix;
MeshID : integer;
end;
TSeedSet = array of TTextureSeed;
TTexCompareFunction = function (const _Seed1, _Seed2 : TTextureSeed): real of object;
CTextureAtlasExtractorBase = class
protected
FLOD: TLOD;
// Get Mesh Seeds related functions.
procedure SetupMeshSeeds(var _Vertices : TAVector3f; var _FaceNormals : TAVector3f; var _Faces : auint32;_VerticesPerFace: integer; var _Seeds: TSeedSet; var _VertsSeed : aint32; var _FaceNeighbors: TNeighborDetector; var _TexCoords: TAVector2f; var _MaxVerts: integer; var _FaceSeed : aint32; var _FacePriority: AFloat; var _FaceOrder : auint32; var _CheckFace: abool); virtual;
procedure ReAlignSeedsToCenter(var _Seeds: TSeedSet; var _VertsSeed : aint32; var _FaceNeighbors: TNeighborDetector; var _TexCoords: TAVector2f; var _FacePriority: AFloat; var _FaceOrder : auint32; var _CheckFace: abool; var _NeighborhoodPlugin: PMeshPluginBase);
// Sort related functions
function isVLower(_UMerge, _VMerge, _UMax, _VMax: single): boolean;
function CompareU(const _Seed1, _Seed2 : TTextureSeed): real;
function CompareV(const _Seed1, _Seed2 : TTextureSeed): real;
procedure QuickSortSeeds(_min, _max : integer; var _OrderedList: auint32; const _Seeds : TSeedSet; _CompareFunction: TTexCompareFunction);
procedure QuickSortPriority(_min, _max : integer; var _FaceOrder: auint32; const _FacePriority : afloat);
function SeedBinarySearch(const _Value, _min, _max : integer; var _OrderedList: auint32; const _Seeds : TSeedSet; _CompareFunction: TTexCompareFunction; var _current,_previous : integer): integer;
public
// Constructors and Destructors
constructor Create(var _LOD: TLOD);
destructor Destroy; override;
procedure Initialize; virtual;
procedure Reset;
procedure Clear; virtual;
// Executes
procedure Execute(); virtual; abstract;
procedure ExecuteWithDiffuseTexture(_Size: integer); virtual; abstract;
// Texture atlas buildup: step by step.
function GetMeshSeeds(_MeshID: integer; var _Vertices : TAVector3f; var _FaceNormals,_VertsNormals : TAVector3f; var _VertsColours : TAVector4f; var _Faces : auint32; _VerticesPerFace: integer; var _Seeds: TSeedSet; var _VertsSeed : aint32; var _NeighborhoodPlugin: PMeshPluginBase): TAVector2f; virtual; abstract;
procedure MergeSeeds(var _Seeds: TSeedSet); virtual;
procedure GetFinalTextureCoordinates(var _Seeds: TSeedSet; var _VertsSeed : aint32; var _TexCoords: TAVector2f);
end;
implementation
constructor CTextureAtlasExtractorBase.Create(var _LOD: TLOD);
begin
FLOD := _LOD;
Initialize;
end;
destructor CTextureAtlasExtractorBase.Destroy;
begin
Clear;
inherited Destroy;
end;
procedure CTextureAtlasExtractorBase.Initialize;
begin
// do nothing
end;
procedure CTextureAtlasExtractorBase.Clear;
begin
// do nothing
end;
procedure CTextureAtlasExtractorBase.Reset;
begin
Clear;
Initialize;
end;
procedure CTextureAtlasExtractorBase.SetupMeshSeeds(var _Vertices : TAVector3f; var _FaceNormals : TAVector3f; var _Faces : auint32;_VerticesPerFace: integer; var _Seeds: TSeedSet; var _VertsSeed : aint32; var _FaceNeighbors: TNeighborDetector; var _TexCoords: TAVector2f; var _MaxVerts: integer; var _FaceSeed : aint32; var _FacePriority: AFloat; var _FaceOrder : auint32; var _CheckFace: abool);
var
i: integer;
begin
// Get the neighbours of each face.
_FaceNeighbors := TNeighborDetector.Create(C_NEIGHBTYPE_FACE_FACE_FROM_EDGE);
_FaceNeighbors.BuildUpData(_Faces,_VerticesPerFace,High(_Vertices)+1);
// Setup FaceSeed, FaceOrder and FacePriority.
SetLength(_FaceSeed,High(_FaceNormals)+1);
SetLength(_FaceOrder,High(_FaceSeed)+1);
SetLength(_FacePriority,High(_FaceSeed)+1);
SetLength(_CheckFace,High(_FaceNormals)+1);
for i := Low(_FaceSeed) to High(_FaceSeed) do
begin
_FaceSeed[i] := -1;
_FaceOrder[i] := i;
_FacePriority[i] := Max(Max(abs(_FaceNormals[i].X),abs(_FaceNormals[i].Y)),abs(_FaceNormals[i].Z));
end;
QuickSortPriority(Low(_FaceOrder),High(_FaceOrder),_FaceOrder,_FacePriority);
// Setup VertsSeed.
_MaxVerts := High(_Vertices)+1;
SetLength(_VertsSeed,_MaxVerts);
for i := Low(_VertsSeed) to High(_VertsSeed) do
begin
_VertsSeed[i] := -1;
end;
// Setup Texture Coordinates (Result)
SetLength(_TexCoords,_MaxVerts);
end;
procedure CTextureAtlasExtractorBase.ReAlignSeedsToCenter(var _Seeds: TSeedSet; var _VertsSeed : aint32; var _FaceNeighbors: TNeighborDetector; var _TexCoords: TAVector2f; var _FacePriority: AFloat; var _FaceOrder : auint32; var _CheckFace: abool; var _NeighborhoodPlugin: PMeshPluginBase);
var
i: integer;
begin
// Re-align vertexes and seed bounds to start at (0,0)
for i := Low(_VertsSeed) to High(_VertsSeed) do
begin
_TexCoords[i].U := _TexCoords[i].U - _Seeds[_VertsSeed[i]].MinBounds.U;
_TexCoords[i].V := _TexCoords[i].V - _Seeds[_VertsSeed[i]].MinBounds.V;
end;
for i := Low(_Seeds) to High(_Seeds) do
begin
_Seeds[i].MaxBounds.U := _Seeds[i].MaxBounds.U - _Seeds[i].MinBounds.U;
_Seeds[i].MinBounds.U := 0;
_Seeds[i].MaxBounds.V := _Seeds[i].MaxBounds.V - _Seeds[i].MinBounds.V;
_Seeds[i].MinBounds.V := 0;
end;
if _NeighborhoodPlugin = nil then
begin
_FaceNeighbors.Free;
end;
SetLength(_FacePriority,0);
SetLength(_FaceOrder,0);
SetLength(_CheckFace,0);
end;
procedure CTextureAtlasExtractorBase.MergeSeeds(var _Seeds: TSeedSet);
var
i, x, Current, Previous: integer;
UOrder,VOrder : auint32;
UMerge,VMerge,UMax,VMax,PushValue: real;
HiO,HiS: integer;
SeedTree : TSeedTree;
List : CIntegerList;
SeedSeparatorSpace: single;
begin
// Now, we need to setup two lists: one ordered by u and another ordered by v.
HiO := High(_Seeds); // That's the index for the last useful element of the U and V order buffers
SetLength(UOrder,HiO+1);
SetLength(VOrder,HiO+1);
for i := Low(UOrder) to High(UOrder) do
begin
UOrder[i] := i;
VOrder[i] := i;
end;
QuickSortSeeds(Low(UOrder),HiO,UOrder,_Seeds,CompareU);
QuickSortSeeds(Low(VOrder),HiO,VOrder,_Seeds,CompareV);
HiS := HiO; // That's the index for the last useful seed and seed tree item.
SetLength(_Seeds,(2*HiS)+1);
// Let's calculate the required space to separate one seed from others.
// Get the smallest dimension of the smallest partitions.
SeedSeparatorSpace := 0.03 * max(_Seeds[VOrder[Low(VOrder)]].MaxBounds.V - _Seeds[VOrder[Low(VOrder)]].MinBounds.V,_Seeds[UOrder[Low(UOrder)]].MaxBounds.U - _Seeds[UOrder[Low(UOrder)]].MinBounds.U);
// Then, we start a SeedTree, which we'll use to ajust the bounds from seeds
// inside bigger seeds.
SetLength(SeedTree,High(_Seeds)+1);
for i := Low(SeedTree) to High(SeedTree) do
begin
SeedTree[i].Left := -1;
SeedTree[i].Right := -1;
end;
// Setup seed tree detection list
List := CIntegerList.Create;
List.UseSmartMemoryManagement(true);
// We'll now start the main loop. We merge the smaller seeds into bigger seeds until we only have on seed left.
while HiO > 0 do
begin
// Select the last two seeds from UOrder and VOrder and check which merge
// uses less space.
UMerge := ( (_Seeds[UOrder[HiO]].MaxBounds.U - _Seeds[UOrder[HiO]].MinBounds.U) + SeedSeparatorSpace + (_Seeds[UOrder[HiO-1]].MaxBounds.U - _Seeds[UOrder[HiO-1]].MinBounds.U) ) * max((_Seeds[UOrder[HiO]].MaxBounds.V - _Seeds[UOrder[HiO]].MinBounds.V),(_Seeds[UOrder[HiO-1]].MaxBounds.V - _Seeds[UOrder[HiO-1]].MinBounds.V));
VMerge := ( (_Seeds[VOrder[HiO]].MaxBounds.V - _Seeds[VOrder[HiO]].MinBounds.V) + SeedSeparatorSpace + (_Seeds[VOrder[HiO-1]].MaxBounds.V - _Seeds[VOrder[HiO-1]].MinBounds.V) ) * max((_Seeds[VOrder[HiO]].MaxBounds.U - _Seeds[VOrder[HiO]].MinBounds.U),(_Seeds[VOrder[HiO-1]].MaxBounds.U - _Seeds[VOrder[HiO-1]].MinBounds.U));
UMax := max(( (_Seeds[UOrder[HiO]].MaxBounds.U - _Seeds[UOrder[HiO]].MinBounds.U) + SeedSeparatorSpace + (_Seeds[UOrder[HiO-1]].MaxBounds.U - _Seeds[UOrder[HiO-1]].MinBounds.U) ),max((_Seeds[UOrder[HiO]].MaxBounds.V - _Seeds[UOrder[HiO]].MinBounds.V),(_Seeds[UOrder[HiO-1]].MaxBounds.V - _Seeds[UOrder[HiO-1]].MinBounds.V)));
VMax := max(( (_Seeds[VOrder[HiO]].MaxBounds.V - _Seeds[VOrder[HiO]].MinBounds.V) + SeedSeparatorSpace + (_Seeds[VOrder[HiO-1]].MaxBounds.V - _Seeds[VOrder[HiO-1]].MinBounds.V) ),max((_Seeds[VOrder[HiO]].MaxBounds.U - _Seeds[VOrder[HiO]].MinBounds.U),(_Seeds[VOrder[HiO-1]].MaxBounds.U - _Seeds[VOrder[HiO-1]].MinBounds.U)));
inc(HiS);
_Seeds[HiS].MinBounds.U := 0;
_Seeds[HiS].MinBounds.V := 0;
if IsVLower(UMerge,VMerge,UMax,VMax) then
begin
// So, we'll merge the last two elements of VOrder into a new sector.
// -----------------------
// Finish the creation of the new seed.
_Seeds[HiS].MaxBounds.U := max((_Seeds[VOrder[HiO]].MaxBounds.U - _Seeds[VOrder[HiO]].MinBounds.U),(_Seeds[VOrder[HiO-1]].MaxBounds.U - _Seeds[VOrder[HiO-1]].MinBounds.U));
_Seeds[HiS].MaxBounds.V := (_Seeds[VOrder[HiO]].MaxBounds.V - _Seeds[VOrder[HiO]].MinBounds.V) + SeedSeparatorSpace + (_Seeds[VOrder[HiO-1]].MaxBounds.V - _Seeds[VOrder[HiO-1]].MinBounds.V);
// Insert the last two elements from VOrder at the new seed tree element.
SeedTree[HiS].Left := VOrder[HiO-1];
SeedTree[HiS].Right := VOrder[HiO];
// Now we translate the bounds of the element in the 'right' down, where it
// belongs, and do it recursively.
PushValue := (_Seeds[VOrder[HiO-1]].MaxBounds.V - _Seeds[VOrder[HiO-1]].MinBounds.V) + SeedSeparatorSpace;
List.Add(SeedTree[HiS].Right);
while List.GetValue(i) do
begin
_Seeds[i].MinBounds.V := _Seeds[i].MinBounds.V + PushValue;
_Seeds[i].MaxBounds.V := _Seeds[i].MaxBounds.V + PushValue;
if SeedTree[i].Left <> -1 then
List.Add(SeedTree[i].Left);
if SeedTree[i].Right <> -1 then
List.Add(SeedTree[i].Right);
end;
// Remove the last two elements of VOrder from UOrder and add the new seed.
i := 0;
x := 0;
while i <= HiO do
begin
if (UOrder[i] = VOrder[HiO]) or (UOrder[i] = VOrder[HiO-1]) then
inc(x)
else
UOrder[i - x] := UOrder[i];
inc(i);
end;
dec(HiO);
Current := HiO div 2;
SeedBinarySearch(HiS,0,HiO-1,UOrder,_Seeds,CompareU,Current,Previous);
i := HiO;
while i > (Previous+1) do
begin
UOrder[i] := UOrder[i-1];
dec(i);
end;
UOrder[Previous+1] := HiS;
// Now we remove the last two elements from VOrder and add the new seed.
Current := HiO div 2;
SeedBinarySearch(HiS,0,HiO-1,VOrder,_Seeds,CompareV,Current,Previous);
i := HiO;
while i > (Previous+1) do
begin
VOrder[i] := VOrder[i-1];
dec(i);
end;
VOrder[Previous+1] := HiS;
end
else // UMerge <= VMerge
begin
// So, we'll merge the last two elements of UOrder into a new sector.
// -----------------------
// Finish the creation of the new seed.
_Seeds[HiS].MaxBounds.U := (_Seeds[UOrder[HiO]].MaxBounds.U - _Seeds[UOrder[HiO]].MinBounds.U) + SeedSeparatorSpace + (_Seeds[UOrder[HiO-1]].MaxBounds.U - _Seeds[UOrder[HiO-1]].MinBounds.U);
_Seeds[HiS].MaxBounds.V := max((_Seeds[UOrder[HiO]].MaxBounds.V - _Seeds[UOrder[HiO]].MinBounds.V),(_Seeds[UOrder[HiO-1]].MaxBounds.V - _Seeds[UOrder[HiO-1]].MinBounds.V));
// Insert the last two elements from UOrder at the new seed tree element.
SeedTree[HiS].Left := UOrder[HiO-1];
SeedTree[HiS].Right := UOrder[HiO];
// Now we translate the bounds of the element in the 'right' to the right,
// where it belongs, and do it recursively.
PushValue := (_Seeds[UOrder[HiO-1]].MaxBounds.U - _Seeds[UOrder[HiO-1]].MinBounds.U) + SeedSeparatorSpace;
List.Add(SeedTree[HiS].Right);
while List.GetValue(i) do
begin
_Seeds[i].MinBounds.U := _Seeds[i].MinBounds.U + PushValue;
_Seeds[i].MaxBounds.U := _Seeds[i].MaxBounds.U + PushValue;
if SeedTree[i].Left <> -1 then
List.Add(SeedTree[i].Left);
if SeedTree[i].Right <> -1 then
List.Add(SeedTree[i].Right);
end;
// Remove the last two elements of UOrder from VOrder and add the new seed.
i := 0;
x := 0;
while i <= HiO do
begin
if (VOrder[i] = UOrder[HiO]) or (VOrder[i] = UOrder[HiO-1]) then
inc(x)
else
VOrder[i - x] := VOrder[i];
inc(i);
end;
dec(HiO);
Current := HiO div 2;
SeedBinarySearch(HiS,0,HiO-1,VOrder,_Seeds,CompareV,Current,Previous);
i := HiO;
while i > (Previous+1) do
begin
VOrder[i] := VOrder[i-1];
dec(i);
end;
VOrder[Previous+1] := HiS;
// Now we remove the last two elements from UOrder and add the new seed.
Current := HiO div 2;
SeedBinarySearch(HiS,0,HiO-1,UOrder,_Seeds,CompareU,Current,Previous);
i := HiO;
while i > (Previous+1) do
begin
UOrder[i] := UOrder[i-1];
dec(i);
end;
UOrder[Previous+1] := HiS;
end;
end;
// Force a seed separator space at the left of the seeds.
for i := Low(_Seeds) to High(_Seeds) do
begin
_Seeds[i].MinBounds.U := _Seeds[i].MinBounds.U + SeedSeparatorSpace;
_Seeds[i].MinBounds.V := _Seeds[i].MinBounds.V + SeedSeparatorSpace;
_Seeds[i].MaxBounds.U := _Seeds[i].MaxBounds.U + SeedSeparatorSpace;
_Seeds[i].MaxBounds.V := _Seeds[i].MaxBounds.V + SeedSeparatorSpace;
end;
// Force seeds separator space at the end of the main seed.
_Seeds[High(_Seeds)].MaxBounds.U := _Seeds[High(_Seeds)].MaxBounds.U + SeedSeparatorSpace;
_Seeds[High(_Seeds)].MaxBounds.V := _Seeds[High(_Seeds)].MaxBounds.V + SeedSeparatorSpace;
// The texture must be a square, so we'll centralize the smallest dimension.
{
if (_Seeds[High(_Seeds)].MaxBounds.U > _Seeds[High(_Seeds)].MaxBounds.V) then
begin
PushValue := (_Seeds[High(_Seeds)].MaxBounds.U - _Seeds[High(_Seeds)].MaxBounds.V) / 2;
for i := Low(_Seeds) to (High(_Seeds)-1) do
begin
_Seeds[i].MinBounds.V := _Seeds[i].MinBounds.V + PushValue;
_Seeds[i].MaxBounds.V := _Seeds[i].MaxBounds.V + PushValue;
end;
_Seeds[High(_Seeds)].MaxBounds.V := _Seeds[High(_Seeds)].MaxBounds.U;
end
else if (_Seeds[High(_Seeds)].MaxBounds.U < _Seeds[High(_Seeds)].MaxBounds.V) then
begin
PushValue := (_Seeds[High(_Seeds)].MaxBounds.V - _Seeds[High(_Seeds)].MaxBounds.U) / 2;
for i := Low(_Seeds) to (High(_Seeds)-1) do
begin
_Seeds[i].MinBounds.U := _Seeds[i].MinBounds.U + PushValue;
_Seeds[i].MaxBounds.U := _Seeds[i].MaxBounds.U + PushValue;
end;
_Seeds[High(_Seeds)].MaxBounds.U := _Seeds[High(_Seeds)].MaxBounds.V;
end;
}
// Clean up memory.
SetLength(SeedTree,0);
SetLength(UOrder,0);
SetLength(VOrder,0);
List.Free;
end;
procedure CTextureAtlasExtractorBase.GetFinalTextureCoordinates(var _Seeds: TSeedSet; var _VertsSeed : aint32; var _TexCoords: TAVector2f);
var
i : integer;
ScaleU, ScaleV: real;
begin
// We'll ensure that our main seed spreads from (0,0) to (1,1) for both axis.
ScaleU := (max(_Seeds[High(_Seeds)].MaxBounds.U,_Seeds[High(_Seeds)].MaxBounds.V)) / _Seeds[High(_Seeds)].MaxBounds.U;
ScaleV := (max(_Seeds[High(_Seeds)].MaxBounds.U,_Seeds[High(_Seeds)].MaxBounds.V)) / _Seeds[High(_Seeds)].MaxBounds.V;
for i := Low(_Seeds) to High(_Seeds) do
begin
_Seeds[i].MinBounds.U := _Seeds[i].MinBounds.U * ScaleU;
_Seeds[i].MaxBounds.U := _Seeds[i].MaxBounds.U * ScaleU;
_Seeds[i].MinBounds.V := _Seeds[i].MinBounds.V * ScaleV;
_Seeds[i].MaxBounds.V := _Seeds[i].MaxBounds.V * ScaleV;
end;
// Let's get the final texture coordinates for each vertex now.
for i := Low(_TexCoords) to High(_TexCoords) do
begin
_TexCoords[i].U := (_Seeds[_VertsSeed[i]].MinBounds.U + (_TexCoords[i].U * ScaleU)) / _Seeds[High(_Seeds)].MaxBounds.U;
_TexCoords[i].V := (_Seeds[_VertsSeed[i]].MinBounds.V + (_TexCoords[i].V * ScaleV)) / _Seeds[High(_Seeds)].MaxBounds.V;
end;
end;
// Seed related
function CTextureAtlasExtractorBase.isVLower(_UMerge, _VMerge, _UMax, _VMax: single): boolean;
begin
if _VMax < _UMax then
begin
Result := true;
end
else if _VMax > _UMax then
begin
Result := false;
end
else if _VMerge < _UMerge then
begin
Result := true;
end
else
begin
Result := false;
end;
end;
// Sort
function CTextureAtlasExtractorBase.CompareU(const _Seed1, _Seed2 : TTextureSeed): real;
begin
Result := (_Seed1.MaxBounds.U - _Seed1.MinBounds.U) - (_Seed2.MaxBounds.U - _Seed2.MinBounds.U);
end;
function CTextureAtlasExtractorBase.CompareV(const _Seed1, _Seed2 : TTextureSeed): real;
begin
Result := (_Seed1.MaxBounds.V - _Seed1.MinBounds.V) - (_Seed2.MaxBounds.V - _Seed2.MinBounds.V);
end;
// Adapted from OMC Manager
procedure CTextureAtlasExtractorBase.QuickSortSeeds(_min, _max : integer; var _OrderedList: auint32; const _Seeds : TSeedSet; _CompareFunction: TTexCompareFunction);
var
Lo, Hi, Mid, T: Integer;
begin
Lo := _min;
Hi := _max;
Mid := (Lo + Hi) div 2;
repeat
while _CompareFunction(_Seeds[_OrderedList[Lo]],_Seeds[_OrderedList[Mid]]) > 0 do Inc(Lo);
while _CompareFunction(_Seeds[_OrderedList[Hi]],_Seeds[_OrderedList[Mid]]) < 0 do Dec(Hi);
if Lo <= Hi then
begin
T := _OrderedList[Lo];
_OrderedList[Lo] := _OrderedList[Hi];
_OrderedList[Hi] := T;
if (Lo = Mid) and (Hi <> Mid) then
Mid := Hi
else if (Hi = Mid) and (Lo <> Mid) then
Mid := Lo;
Inc(Lo);
Dec(Hi);
end;
until Lo > Hi;
if Hi > _min then
QuickSortSeeds(_min, Hi, _OrderedList, _Seeds, _CompareFunction);
if Lo < _max then
QuickSortSeeds(Lo, _max, _OrderedList, _Seeds, _CompareFunction);
end;
procedure CTextureAtlasExtractorBase.QuickSortPriority(_min, _max : integer; var _FaceOrder: auint32; const _FacePriority : afloat);
var
Lo, Hi, Mid, T: Integer;
begin
Lo := _min;
Hi := _max;
Mid := (Lo + Hi) div 2;
repeat
while (_FacePriority[_FaceOrder[Lo]] - _FacePriority[_FaceOrder[Mid]]) > 0 do Inc(Lo);
while (_FacePriority[_FaceOrder[Hi]] - _FacePriority[_FaceOrder[Mid]]) < 0 do Dec(Hi);
if Lo <= Hi then
begin
T := _FaceOrder[Lo];
_FaceOrder[Lo] := _FaceOrder[Hi];
_FaceOrder[Hi] := T;
if (Lo = Mid) and (Hi <> Mid) then
Mid := Hi
else if (Hi = Mid) and (Lo <> Mid) then
Mid := Lo;
Inc(Lo);
Dec(Hi);
end;
until Lo > Hi;
if Hi > _min then
QuickSortPriority(_min, Hi, _FaceOrder, _FacePriority);
if Lo < _max then
QuickSortPriority(Lo, _max, _FaceOrder, _FacePriority);
end;
// binary search with decrescent order (borrowed from OS BIG Editor)
function CTextureAtlasExtractorBase.SeedBinarySearch(const _Value, _min, _max : integer; var _OrderedList: auint32; const _Seeds : TSeedSet; _CompareFunction: TTexCompareFunction; var _current,_previous : integer): integer;
var
Comparison : real;
Current : integer;
begin
Comparison := _CompareFunction(_Seeds[_Value],_Seeds[_OrderedList[_current]]);
if Comparison = 0 then
begin
_previous := _current - 1;
Result := _current;
end
else if Comparison < 0 then
begin
if _min < _max then
begin
Current := _current;
_current := (_current + _max) div 2;
Result := SeedBinarySearch(_Value,Current+1,_max,_OrderedList,_Seeds,_CompareFunction,_current,_previous);
end
else
begin
_previous := _current;
Result := -1;
end;
end
else // > 0
begin
if _min < _max then
begin
Current := _current;
_current := (_current + _min) div 2;
Result := SeedBinarySearch(_Value,_min,Current-1,_OrderedList,_Seeds,_CompareFunction,_current,_previous);
end
else
begin
_previous := _current - 1;
Result := -1;
end;
end;
end;
end.
|
{*******************************************************************************
Title: T2Ti ERP
Description: VO relacionado à tabela [PATRIM_BEM]
The MIT License
Copyright: Copyright (C) 2016 T2Ti.COM
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
The author may be contacted at:
t2ti.com@gmail.com
@author Albert Eije (t2ti.com@gmail.com)
@version 2.0
*******************************************************************************}
unit PatrimBemVO;
{$mode objfpc}{$H+}
interface
uses
VO, Classes, SysUtils, FGL,
SetorVO, PatrimGrupoBemVO, PatrimTipoAquisicaoBemVO, PatrimEstadoConservacaoVO,
PatrimDocumentoBemVO, PatrimDepreciacaoBemVO, PatrimMovimentacaoBemVO,
ViewPessoaFornecedorVO, ViewPessoaColaboradorVO;
type
TPatrimBemVO = class(TVO)
private
FID: Integer;
FID_CENTRO_RESULTADO: Integer;
FID_PATRIM_TIPO_AQUISICAO_BEM: Integer;
FID_PATRIM_ESTADO_CONSERVACAO: Integer;
FID_PATRIM_GRUPO_BEM: Integer;
FID_SETOR: Integer;
FID_FORNECEDOR: Integer;
FID_COLABORADOR: Integer;
FNUMERO_NB: String;
FNOME: String;
FDESCRICAO: String;
FNUMERO_SERIE: String;
FDATA_AQUISICAO: TDateTime;
FDATA_ACEITE: TDateTime;
FDATA_CADASTRO: TDateTime;
FDATA_CONTABILIZADO: TDateTime;
FDATA_VISTORIA: TDateTime;
FDATA_MARCACAO: TDateTime;
FDATA_BAIXA: TDateTime;
FVENCIMENTO_GARANTIA: TDateTime;
FNUMERO_NOTA_FISCAL: String;
FCHAVE_NFE: String;
FVALOR_ORIGINAL: Extended;
FVALOR_COMPRA: Extended;
FVALOR_ATUALIZADO: Extended;
FVALOR_BAIXA: Extended;
FDEPRECIA: String;
FMETODO_DEPRECIACAO: String;
FINICIO_DEPRECIACAO: TDateTime;
FULTIMA_DEPRECIACAO: TDateTime;
FTIPO_DEPRECIACAO: String;
FTAXA_ANUAL_DEPRECIACAO: Extended;
FTAXA_MENSAL_DEPRECIACAO: Extended;
FTAXA_DEPRECIACAO_ACELERADA: Extended;
FTAXA_DEPRECIACAO_INCENTIVADA: Extended;
FFUNCAO: String;
//Transientes
FSetorNome: String;
FColaboradorPessoaNome: String;
FFornecedorPessoaNome: String;
FPatrimGrupoBemNome: String;
FPatrimTipoAquisicaoBemNome: String;
FPatrimEstadoConservacaoNome: String;
FSetorVO: TSetorVO;
FColaboradorVO: TViewPessoaColaboradorVO;
FFornecedorVO: TViewPessoaFornecedorVO;
FPatrimGrupoBemVO: TPatrimGrupoBemVO;
FPatrimTipoAquisicaoBemVO: TPatrimTipoAquisicaoBemVO;
FPatrimEstadoConservacaoVO: TPatrimEstadoConservacaoVO;
FListaPatrimDocumentoBemVO: TListaPatrimDocumentoBemVO;
FListaPatrimDepreciacaoBemVO: TListaPatrimDepreciacaoBemVO;
FListaPatrimMovimentacaoBemVO: TListaPatrimMovimentacaoBemVO;
published
constructor Create; override;
destructor Destroy; override;
property Id: Integer read FID write FID;
property IdCentroResultado: Integer read FID_CENTRO_RESULTADO write FID_CENTRO_RESULTADO;
property IdPatrimTipoAquisicaoBem: Integer read FID_PATRIM_TIPO_AQUISICAO_BEM write FID_PATRIM_TIPO_AQUISICAO_BEM;
property PatrimTipoAquisicaoBemNome: String read FPatrimTipoAquisicaoBemNome write FPatrimTipoAquisicaoBemNome;
property IdPatrimEstadoConservacao: Integer read FID_PATRIM_ESTADO_CONSERVACAO write FID_PATRIM_ESTADO_CONSERVACAO;
property PatrimEstadoConservacaoNome: String read FPatrimEstadoConservacaoNome write FPatrimEstadoConservacaoNome;
property IdPatrimGrupoBem: Integer read FID_PATRIM_GRUPO_BEM write FID_PATRIM_GRUPO_BEM;
property PatrimGrupoBemNome: String read FPatrimGrupoBemNome write FPatrimGrupoBemNome;
property IdSetor: Integer read FID_SETOR write FID_SETOR;
property SetorNome: String read FSetorNome write FSetorNome;
property IdFornecedor: Integer read FID_FORNECEDOR write FID_FORNECEDOR;
property FornecedorPessoaNome: String read FFornecedorPessoaNome write FFornecedorPessoaNome;
property IdColaborador: Integer read FID_COLABORADOR write FID_COLABORADOR;
property ColaboradorPessoaNome: String read FColaboradorPessoaNome write FColaboradorPessoaNome;
property NumeroNb: String read FNUMERO_NB write FNUMERO_NB;
property Nome: String read FNOME write FNOME;
property Descricao: String read FDESCRICAO write FDESCRICAO;
property NumeroSerie: String read FNUMERO_SERIE write FNUMERO_SERIE;
property DataAquisicao: TDateTime read FDATA_AQUISICAO write FDATA_AQUISICAO;
property DataAceite: TDateTime read FDATA_ACEITE write FDATA_ACEITE;
property DataCadastro: TDateTime read FDATA_CADASTRO write FDATA_CADASTRO;
property DataContabilizado: TDateTime read FDATA_CONTABILIZADO write FDATA_CONTABILIZADO;
property DataVistoria: TDateTime read FDATA_VISTORIA write FDATA_VISTORIA;
property DataMarcacao: TDateTime read FDATA_MARCACAO write FDATA_MARCACAO;
property DataBaixa: TDateTime read FDATA_BAIXA write FDATA_BAIXA;
property VencimentoGarantia: TDateTime read FVENCIMENTO_GARANTIA write FVENCIMENTO_GARANTIA;
property NumeroNotaFiscal: String read FNUMERO_NOTA_FISCAL write FNUMERO_NOTA_FISCAL;
property ChaveNfe: String read FCHAVE_NFE write FCHAVE_NFE;
property ValorOriginal: Extended read FVALOR_ORIGINAL write FVALOR_ORIGINAL;
property ValorCompra: Extended read FVALOR_COMPRA write FVALOR_COMPRA;
property ValorAtualizado: Extended read FVALOR_ATUALIZADO write FVALOR_ATUALIZADO;
property ValorBaixa: Extended read FVALOR_BAIXA write FVALOR_BAIXA;
property Deprecia: String read FDEPRECIA write FDEPRECIA;
property MetodoDepreciacao: String read FMETODO_DEPRECIACAO write FMETODO_DEPRECIACAO;
property InicioDepreciacao: TDateTime read FINICIO_DEPRECIACAO write FINICIO_DEPRECIACAO;
property UltimaDepreciacao: TDateTime read FULTIMA_DEPRECIACAO write FULTIMA_DEPRECIACAO;
property TipoDepreciacao: String read FTIPO_DEPRECIACAO write FTIPO_DEPRECIACAO;
property TaxaAnualDepreciacao: Extended read FTAXA_ANUAL_DEPRECIACAO write FTAXA_ANUAL_DEPRECIACAO;
property TaxaMensalDepreciacao: Extended read FTAXA_MENSAL_DEPRECIACAO write FTAXA_MENSAL_DEPRECIACAO;
property TaxaDepreciacaoAcelerada: Extended read FTAXA_DEPRECIACAO_ACELERADA write FTAXA_DEPRECIACAO_ACELERADA;
property TaxaDepreciacaoIncentivada: Extended read FTAXA_DEPRECIACAO_INCENTIVADA write FTAXA_DEPRECIACAO_INCENTIVADA;
property Funcao: String read FFUNCAO write FFUNCAO;
//Transientes
property SetorVO: TSetorVO read FSetorVO write FSetorVO;
property ColaboradorVO: TViewPessoaColaboradorVO read FColaboradorVO write FColaboradorVO;
property FornecedorVO: TViewPessoaFornecedorVO read FFornecedorVO write FFornecedorVO;
property PatrimGrupoBemVO: TPatrimGrupoBemVO read FPatrimGrupoBemVO write FPatrimGrupoBemVO;
property PatrimTipoAquisicaoBemVO: TPatrimTipoAquisicaoBemVO read FPatrimTipoAquisicaoBemVO write FPatrimTipoAquisicaoBemVO;
property PatrimEstadoConservacaoVO: TPatrimEstadoConservacaoVO read FPatrimEstadoConservacaoVO write FPatrimEstadoConservacaoVO;
property ListaPatrimDocumentoBemVO: TListaPatrimDocumentoBemVO read FListaPatrimDocumentoBemVO write FListaPatrimDocumentoBemVO;
property ListaPatrimDepreciacaoBemVO: TListaPatrimDepreciacaoBemVO read FListaPatrimDepreciacaoBemVO write FListaPatrimDepreciacaoBemVO;
property ListaPatrimMovimentacaoBemVO: TListaPatrimMovimentacaoBemVO read FListaPatrimMovimentacaoBemVO write FListaPatrimMovimentacaoBemVO;
end;
TListaPatrimBemVO = specialize TFPGObjectList<TPatrimBemVO>;
implementation
constructor TPatrimBemVO.Create;
begin
inherited;
FSetorVO := TSetorVO.Create;
FColaboradorVO := TViewPessoaColaboradorVO.Create;
FFornecedorVO := TViewPessoaFornecedorVO.Create;
FPatrimGrupoBemVO := TPatrimGrupoBemVO.Create;
FPatrimTipoAquisicaoBemVO := TPatrimTipoAquisicaoBemVO.Create;
FPatrimEstadoConservacaoVO := TPatrimEstadoConservacaoVO.Create;
FListaPatrimDocumentoBemVO := TListaPatrimDocumentoBemVO.Create;
FListaPatrimDepreciacaoBemVO := TListaPatrimDepreciacaoBemVO.Create;
FListaPatrimMovimentacaoBemVO := TListaPatrimMovimentacaoBemVO.Create;
end;
destructor TPatrimBemVO.Destroy;
begin
FreeAndNil(FSetorVO);
FreeAndNil(FColaboradorVO);
FreeAndNil(FFornecedorVO);
FreeAndNil(FPatrimGrupoBemVO);
FreeAndNil(FPatrimTipoAquisicaoBemVO);
FreeAndNil(FPatrimEstadoConservacaoVO);
FreeAndNil(FListaPatrimDocumentoBemVO);
FreeAndNil(FListaPatrimDepreciacaoBemVO);
FreeAndNil(FListaPatrimMovimentacaoBemVO);
inherited;
end;
initialization
Classes.RegisterClass(TPatrimBemVO);
finalization
Classes.UnRegisterClass(TPatrimBemVO);
end.
|
//---------------------------------------------------------------------------
// This software is Copyright (c) 2015 Embarcadero Technologies, Inc.
// You may only use this software if you are an authorized licensee
// of an Embarcadero developer tools product.
// This software is considered a Redistributable as defined under
// the software license agreement that comes with the Embarcadero Products
// and is subject to that software license agreement.
//---------------------------------------------------------------------------
unit FormShareContract;
interface
uses
System.Win.ShareContract, System.Win.WinRT, System.Classes, WinAPI.ApplicationModel.DataTransfer,
Vcl.Forms, Vcl.StdCtrls, Vcl.Controls, Vcl.ShareContract, Vcl.ExtCtrls, System.ImageList, Vcl.ImgList;
type
TFormSharingContract = class(TForm)
Memo1: TMemo;
Panel1: TPanel;
Label1: TLabel;
ButtonShare: TButton;
EditShareText: TEdit;
Label2: TLabel;
EditApplicationName: TEdit;
Label3: TLabel;
EditDescription: TEdit;
Label4: TLabel;
EditPackageName: TEdit;
Label5: TLabel;
EditWebAddress: TEdit;
Label6: TLabel;
EditContentSourceWebLink: TEdit;
Label7: TLabel;
EditContentSourceApplicationLink: TEdit;
Label8: TLabel;
EditDataTitle: TEdit;
ImageList1: TImageList;
procedure ButtonShareClick(Sender: TObject);
procedure ShareContractAppChosen(const Sender: TObject; const AManager: IDataTransferManager;
const Args: ITargetApplicationChosenEventArgs);
procedure ShareContractTranferImage(const Sender: TObject; const ARequest: IDataProviderRequest);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
FShareWrapper: TShareContract;
public
{ Public declarations }
end;
var
FormSharingContract: TFormSharingContract;
implementation
uses
System.SysUtils,
System.IOUtils;
{$R *.dfm}
procedure TFormSharingContract.ButtonShareClick(Sender: TObject);
begin
// Set the shared properties
FShareWrapper.ApplicationName := EditApplicationName.Text;
FShareWrapper.Description := EditDescription.Text;
FShareWrapper.DataTitle := EditDataTitle.Text;
FShareWrapper.DataText := EditShareText.Text;
FShareWrapper.PackageName := EditPackageName.Text;
FShareWrapper.ContentSourceApplicationLink := EditContentSourceApplicationLink.Text;
FShareWrapper.ContentSourceWebLink := EditContentSourceWebLink.Text;
FShareWrapper.IconFile := 'Penguins.bmp';
FShareWrapper.ImageFile := 'Penguins.jpg';
FShareWrapper.LogoFile := 'Penguins.bmp';
FShareWrapper.RtfText := 'This is the RTF Text. Should be a large RTF text that is shared...';
FShareWrapper.HTML := '<p>Here is our store logo: <img src=''Penguins.bmp''>.</p>';
FShareWrapper.WebAddress := EditWebAddress.Text;
// Launch Sharing process. Shows applications that can receive our shared information.
FShareWrapper.InitSharing;
end;
procedure TFormSharingContract.FormCreate(Sender: TObject);
begin
TShareContract.OnProcessMessages := Application.ProcessMessages;
TShareContract.BasePath := ExtractFilePath(Application.ExeName);
FShareWrapper := TShareContract.Create(Self.Handle);
FShareWrapper.OnAppChosen := ShareContractAppChosen;
FShareWrapper.OnTranferImage := ShareContractTranferImage;
end;
procedure TFormSharingContract.FormDestroy(Sender: TObject);
begin
FShareWrapper.Free;
end;
procedure TFormSharingContract.ShareContractAppChosen(const Sender: TObject; const AManager: IDataTransferManager;
const Args: ITargetApplicationChosenEventArgs);
begin
// With this event we can know which application is going to receive our data.
Memo1.Lines.Add('Application Chosen: ' + args.ApplicationName.ToString);
end;
procedure TFormSharingContract.ShareContractTranferImage(const Sender: TObject; const ARequest: IDataProviderRequest);
begin
Memo1.Lines.Add('Transfering Image');
// We must provide the stream with the data, the source of the stream can be any we can imagine. Hence the event
// to retrieve it.
// For testing purposes we do the same that we do in the TShareContract class.
ARequest.SetData(TShareContract.FileNameToStream(TShareContract(Sender).ImageFile));
end;
end.
|
unit userscript;
uses mteFunctions;
uses userUtilities;
const
target_filename = 'Deadly Wenches - Less Deadly Patch.esp';
var
dw_npc_names, template_npc_names, inventory_rec, slMasters, slSignatures, slExclusions, slVampireKeywords : TStringList;
target_file, skyrimFile, dwFile : IInterface;
//---------------------------------------------------------------------------------------
// File IO
//---------------------------------------------------------------------------------------
procedure getUserFile;
begin
target_file := getOrCreateFile(target_filename);
if not Assigned(target_file) then begin
AddMessage('File not created or retrieved!');
Exit;
end;
AddMastersToFile(target_file, slMasters, True);
end;
// For each npc in npcs
// Create override
// Get corresponding template_npc_names and element
// Copy respective elements from template to override
// Copy respective FULL name
//
procedure replaceClass;
var
i : integer;
target : integer;
new_override : IInterface;
npc, npcs : IInterface;
template_rec, inven_rec : IInterface;
begin
npcs := getFileElements('deadly wenches.esp', 'NPC_');
for i := 0 to Pred(ElementCount(npcs)) do begin
npc := ElementByIndex(npcs, i);
// Check names
target := dw_npc_names.IndexOf(GetElementEditValues(npc, 'FULL'));
//AddMessage(GetElementEditValues(npc, 'FULL'));
if target = -1 then
Continue;
//AddMessage('Passed check!');
new_override := wbCopyElementToFile(npc, target_file, False, True);
template_rec := MasterOrSelf(MainRecordByEditorID(GroupBySignature(skyrimFile, 'NPC_'), template_npc_names[target]));
inven_rec := MainRecordByEditorID(GroupBySignature(dwFile, 'OTFT'), inventory_rec[target]);
if not Assigned(template_rec) then begin
AddMessage('Template record not assigned! ' + template_npc_names[target]);
Exit;
end;
if not Assigned(inven_rec) then begin
AddMessage('Inventory record not assigned!' + inventory_rec[target]);
if not Assigned(dwFile) then AddMessage('DW file not assigned!');
Exit;
end;
replaceAttributes(new_override, template_rec, inven_rec);
handleNonTemplateIssues(new_override);
end;
end;
procedure handleNonTemplateIssues(e : IInterface);
var
s : string;
begin
if pos('DW_EncSoldier', EditorID(e)) <> 0 then begin
// Adjust ACBS Fields
s := 'ACBS\Calc min level';
SetElementEditValues(e, s, '1');
s := 'ACBS\Calc max level';
SetElementEditValues(e, s, '50');
end;
end;
function getNameFromExemplarTemplate(exemplar : IInterface) : string;
var
cur_rec : IInterface;
hasParent : boolean;
begin
cur_rec := exemplar;
hasParent := false;
repeat
if Assigned(ElementBySignature(cur_rec, 'FULL')) then
Break;
hasParent := Assigned(ElementBySignature(cur_rec, 'TPLT'));
cur_rec := LinksTo(ElementBySignature(cur_rec, 'TPLT'));
until not hasParent;
if Assigned(ElementBySignature(cur_rec, 'FULL')) then
Result := GetElementEditValues(cur_rec, 'FULL');
end;
procedure replaceAttributes(src, target, inven : IInterface);
var
i : integer;
elem, elem_tar, elem_src : IInterface;
s : string;
s_index : integer;
begin
// Remove all target elements from record
for i := Pred(ElementCount(src)) downto 0 do begin
elem := ElementByIndex(src, i);
s := Name(elem);
s_index := slExclusions.IndexOf(s);
if s_index <> -1 then Continue;
Remove(elem);
end;
// Add all target elements using the target record
for i := 0 to Pred(ElementCount(target)) do begin
elem_tar := ElementByIndex(target, i);
s := Name(elem_tar);
s_index := slExclusions.IndexOf(s);
if s_index <> -1 then Continue;
if not Assigned(Signature(elem_tar)) then begin
elem_src := Add(src, s, False);
end else begin
elem_src := Add(src, Signature(elem_tar), False);
end;
ElementAssign(elem_src, LowInteger, elem_tar, False);
end;
Add(src, 'EDID', False);
// Mark Inventory
SetEditValue(ElementByPath(src, 'DOFT'), Name(inven));
// Figure out FULL Name
SetElementEditValues(src, 'FULL', getNameFromExemplarTemplate(target));
// Handle Vampire keywords
if isVampire(src) then addKeyword(src, slVampireKeywords);
// Adjust ACBS Fields
s := 'ACBS\Calc min level';
SetElementEditValues(src, s, GetElementEditValues(target, s));
s := 'ACBS\Calc max level';
SetElementEditValues(src, s, GetElementEditValues(target, s));
s := 'ACBS\Speed Multiplier';
SetElementEditValues(src, s, GetElementEditValues(target, s));
// Adjust Template Flags
s := 'ACBS\Template Flags';
SetElementNativeValues(src, s, $0801);
end;
function isVampire(npc : IInterface) : boolean;
var
i, j : integer;
factions, faction : IInterface;
begin
factions := ElementByName(npc, 'Factions');
for i:= 0 to Pred(ElementCount(factions)) do begin
faction := ElementByIndex(factions, i);
faction := LinksTo(ElementByPath(faction, 'Faction'));
if EditorID(faction) = 'VampireFaction' then
Result := true;
Exit;
end;
Result := false;
end;
//---------------------------------------------------------------------------------------
// Global Variables
//---------------------------------------------------------------------------------------
procedure freeGlobalVariables;
begin
dw_npc_names.Free;
template_npc_names.Free;
inventory_rec.Free;
slMasters.Free;
slSignatures.Free;
slExclusions.Free;
slVampireKeywords.Free;
end;
function getFileObject(filename : string): IInterface;
var
i : integer;
f : IInterface;
s : string;
begin
for i := 0 to FileCount - 1 do begin
f := FileByIndex(i);
s := GetFileName(f);
if SameText(s, filename) then begin
Result := f;
Exit;
end;
end;
end;
procedure setupGlobalVariables;
begin
skyrimFile := getFileObject('Skyrim.esm');
dwFile := getFileObject('Deadly Wenches.esp');
slMasters := TStringList.Create;
slMasters.Add('Skyrim.esm');
slMasters.Add('Update.esm');
slMasters.Add('Dawnguard.esm');
slMasters.Add('Dragonborn.esm');
//slMasters.Add('Unofficial Skyrim Legendary Edition Patch.esp');
slMasters.Add('Immersive Wenches.esp');
slMasters.Add('Deadly Wenches.esp');
dw_npc_names := TStringList.Create;
template_npc_names := TStringList.Create;
inventory_rec := TStringList.Create;
slSignatures := TStringList.Create;
// Used closes
dw_npc_names.Add('Bandit Blademaster Marauder'); // 0 Boss 1H
dw_npc_names.Add('Bandit Berserker Marauder'); // 1 Boss 2H
dw_npc_names.Add('Bandit Defender Marauder'); // 2 Boss 1H + Shield
dw_npc_names.Add('Bandit Ranger Marauder'); // 3 Boss Missile
dw_npc_names.Add('Bandit Warmage Marauder'); // 4 Boss Mage
dw_npc_names.Add('Bandit Necromancer Marauder'); // 5 Boss Mage
dw_npc_names.Add('Bandit Crusher Marauder'); // 6 Boss 2H
dw_npc_names.Add('Bandit Mage Marauder'); // 7 Mage
dw_npc_names.Add('Bandit Necromancer'); // 8 Mage
dw_npc_names.Add('Bandit Blademaster'); // 9 1H
dw_npc_names.Add('Bandit Defender'); // 10 1H + Shield
dw_npc_names.Add('Bandit Berserker'); // 11 2H
dw_npc_names.Add('Bandit Ranger'); // 12 Missile
dw_npc_names.Add('Forsworn Ravager'); // 13 1H Dualwield
dw_npc_names.Add('Forsworn Defender'); // 14 1H Tank
dw_npc_names.Add('Forsworn Warlord'); // 15 1H Tank (Forsworn Defender Mistake)
dw_npc_names.Add('Forsworn Crusher'); // 16 2H
dw_npc_names.Add('Forsworn Ranger'); // 17 Missile
dw_npc_names.Add('Forsworn Warmage'); // 18 Mage
dw_npc_names.Add('Forsworn Shaman'); // 19 Mage
dw_npc_names.Add('Imperial Soldier'); // 20
dw_npc_names.Add('Stormcloak Soldier'); // 21
dw_npc_names.Add('Vampire'); // 22
dw_npc_names.Add('Vigilant of Stendarr'); // 23
// If don't have FULL, need to grab from template's template recursively
template_npc_names.Add('EncBandit06Boss1HNordF'); // 0
template_npc_names.Add('EncBandit06Boss2HNordM'); // 1
template_npc_names.Add('EncBandit06Boss1HNordF'); // 2
template_npc_names.Add('EncBandit06MissileNordF'); // 3
template_npc_names.Add('EncBandit06MagicNordF'); // 4
template_npc_names.Add('EncBandit06MagicNordF'); // 5
template_npc_names.Add('EncBandit06Boss2HNordM'); // 6
template_npc_names.Add('EncBandit06MagicNordF'); // 7
template_npc_names.Add('EncBandit06MagicNordF'); // 8
template_npc_names.Add('EncBandit06Melee1HNordF'); // 9
template_npc_names.Add('EncBandit06Melee1HTankNordF'); // 10
template_npc_names.Add('EncBandit06Melee2HNordF'); // 11
template_npc_names.Add('EncBandit06MissileNordF'); // 12
template_npc_names.Add('EncForsworn06Melee1HBretonF01'); // 13
template_npc_names.Add('EncForsworn06Melee1HBretonF01'); // 14
template_npc_names.Add('EncForsworn06Melee1HBretonF01'); // 15
template_npc_names.Add('EncForsworn06Melee1HBretonF01'); // 16
template_npc_names.Add('EncForsworn06MissileBretonF01'); // 17
template_npc_names.Add('EncForsworn06MagicBretonF01'); // 18
template_npc_names.Add('EncForsworn06MagicBretonF01'); // 19
template_npc_names.Add('EncGuardImperialM01MaleNordCommander'); // 20
template_npc_names.Add('EncGuardSonsF01FemaleNord'); // 21
template_npc_names.Add('EncVampire06NordF'); // 22
template_npc_names.Add('EncVigilantOfStendarr05NordF'); // 23
inventory_rec.Add('DW_BanditBossOutfit_2wench_Light'); // 0
inventory_rec.Add('DW_BanditBossOutfit_3wench_heavy'); // 1
inventory_rec.Add('DW_BanditBossOutfit_2wench_Light'); // 2
inventory_rec.Add('DW_BanditBossOutfit_2wench_Light'); // 3
inventory_rec.Add('DW_BanditBossOutfit_1wench_Clothes'); // 4
inventory_rec.Add('DW_BanditBossOutfit_1wench_Clothes'); // 5
inventory_rec.Add('DW_BanditBossOutfit_3wench_heavy'); // 6
inventory_rec.Add('DW_BanditMageOutfit_1wench_Clothes'); // 7
inventory_rec.Add('DW_BanditMageOutfit_1wench_Clothes'); // 8
inventory_rec.Add('DW_BanditMeleeLightOutfit_2wench_Light'); // 9
inventory_rec.Add('DW_BanditHTankOutfit_3wench_Heavy'); // 10
inventory_rec.Add('DW_BanditHMelee2HOutfit_3wench_Heavy'); // 11
inventory_rec.Add('DW_BanditMissileOutfit_2wench_Light'); // 12
inventory_rec.Add('DW_ForswornArmorOutfit_2wench_Light'); // 13
inventory_rec.Add('DW_ForswornArmorOutfit_3wench_Heavy'); // 14
inventory_rec.Add('DW_ForswornArmorOutfit_3wench_Heavy'); // 15
inventory_rec.Add('DW_ForswornArmorOutfit_3wench_Heavy'); // 16
inventory_rec.Add('DW_ForswornArmorOutfit_2wench_Light'); // 17
inventory_rec.Add('DW_ForswornArmorOutfit_1wench_Clothes'); // 18
inventory_rec.Add('DW_ForswornArmorOutfit_1wench_Clothes'); // 19
inventory_rec.Add('DW_GuardImperialOutfit_2wench_Light'); // 20
inventory_rec.Add('DW_GuardSonsOutfit_2wench_Light'); // 21
inventory_rec.Add('DW_vampireOutfit_1wench_Clothes'); // 22
inventory_rec.Add('DW_StendarrOutfit_3wench_Heavy'); // 23
slExclusions := TStringList.Create;
slExclusions.Add('Record Header');
slExclusions.Add('EDID - Editor ID');
slExclusions.Add('OBND - Object Bounds');
slExclusions.Add('ACBS - Configuration');
slExclusions.Add('ATKR - Attack Race');
slExclusions.Add('VTCK - Voice');
slExclusions.Add('TPLT - Template');
slExclusions.Add('RNAM - Race');
slExclusions.Add('DNAM - Player SKills');
slExclusions.Add('Head Parts');
slExclusions.Add('HCLF - Hair Color');
slExclusions.Add('DOFT - Default outfit');
slExclusions.Add('QNAM - Texture lighting');
slExclusions.Add('NAM9 - Face morph');
slExclusions.Add('NAMA - Face parts');
slExclusions.Add('Tint Layers');
slExclusions.Add('FTST - Head texture');
slExclusions.Add('Packages');
slExclusions.Add('KWDA - Keywords');
slVampireKeywords := TStringList.Create;
slVampireKeywords.Add('00013794'); //ActorTypeNPC
slVampireKeywords.Add('00013796'); //ActorTypeUndead
slVampireKeywords.Add('000A82BB'); //Vampire
//slSignatures.Add
//EDID
//OBND
//ACBS
//Fa
end;
//---------------------------------------------------------------------------------------
// Required Tes5Edit Script Functions
//---------------------------------------------------------------------------------------
// Called before processing
// You can remove it if script doesn't require initialization code
function Initialize: integer;
begin
setupGlobalVariables;
getUserFile;
replaceClass;
Result := 0;
end;
// called for every record selected in xEdit
function Process(e: IInterface): integer;
begin
Result := 0;
// comment this out if you don't want those messages
//AddMessage('Processing: ' + FullPath(e));
// processing code goes here
end;
// Called after processing
// You can remove it if script doesn't require finalization code
function Finalize: integer;
begin
freeGlobalVariables;
Result := 0;
end;
//template_npc_names.Add('EncBandit06Boss1HNordF [NPC_:0003DF08]'); // 0
//template_npc_names.Add('EncBandit06Boss2HNordM [NPC_:0003DF0C]'); // 1
//template_npc_names.Add('EncBandit06Boss1HNordF [NPC_:0003DF08]'); // 2
//template_npc_names.Add('EncBandit06MissileNordF [NPC_:00037C46]'); // 3
//template_npc_names.Add('EncBandit06MagicNordF [NPC_:00039D5D]'); // 4
//template_npc_names.Add('EncBandit06MagicNordF [NPC_:00039D5D]'); // 5
//template_npc_names.Add('EncBandit06Boss2HNordM [NPC_:0003DF0C]'); // 6
//template_npc_names.Add('EncBandit06MagicNordF [NPC_:00039D5D]'); // 7
//template_npc_names.Add('EncBandit06MagicNordF [NPC_:00039D5D]'); // 8
//template_npc_names.Add('EncBandit06Melee1HNordF [NPC_:00039D20]'); // 9
//template_npc_names.Add('EncBandit06Melee1HTankNordF [NPC_:0003DEB2]'); // 10
//template_npc_names.Add('EncBandit06Melee2HNordF [NPC_:0003DE69]'); // 11
//template_npc_names.Add('EncBandit06MissileNordF [NPC_:00037C46]'); // 12
//template_npc_names.Add('EncForsworn06Melee1HBretonF01 [NPC_:0004429E]'); // 13
//template_npc_names.Add('EncForsworn06Melee1HBretonF01 [NPC_:0004429E]'); // 14
//template_npc_names.Add('EncForsworn06Melee1HBretonF01 [NPC_:0004429E]'); // 15
//template_npc_names.Add('EncForsworn06Melee1HBretonF01 [NPC_:0004429E]'); // 16
//template_npc_names.Add('EncForsworn06MissileBretonF01 [NPC_:000442A4]'); // 17
//template_npc_names.Add('EncForsworn06MagicBretonF01 [NPC_:0004429B]'); // 18
//template_npc_names.Add('EncForsworn06MagicBretonF01 [NPC_:0004429B]'); // 19
//template_npc_names.Add('EncGuardImperialM01MaleNordCommander "Imperial Soldier" [NPC_:000AA8D4]'); // 20
//template_npc_names.Add('EncGuardSonsF01FemaleNord "Stormcloak Soldier" [NPC_:000AA922]'); // 21
//template_npc_names.Add('EncVampire06NordF [NPC_:0003392F]'); // 22
//template_npc_names.Add('EncVigilantOfStendarr05NordF [NPC_:0010C484]'); // 23
end. |
{
@abstract Implements @link(TNtTreeViewTranslator) translator extension class that translates TTreeView.
TTreeView component stores nodes as defined binary property into the form file.
@link(TNtTranslator) can not automatically translate defined binary properties
because it does not know the format that is used. This extension knows and it
enables runtime language switch for nodes of TTreeView.
To enable runtime language switch of tree views just add this unit into your project
or add unit into any uses block.
@longCode(#
implementation
uses
NtTreeViewTranslator;
#)
See @italic(Samples\Delphi\VCL\LanguageSwitch) sample to see how to use the unit.
}
unit NtTreeViewTranslator;
{$I NtVer.inc}
interface
uses
Classes, NtBaseTranslator;
type
{ @abstract Translator extension class that translates TTreeView component. }
TNtTreeViewTranslator = class(TNtTranslatorExtension)
public
{ @seealso(TNtTranslatorExtension.CanTranslate) }
function CanTranslate(obj: TObject): Boolean; override;
{ @seealso(TNtTranslatorExtension.Translate) }
procedure Translate(
component: TComponent;
obj: TObject;
const name: String;
value: Variant;
index: Integer); override;
class procedure ForceUse;
end;
implementation
uses
SysUtils, ComCtrls, NtBase;
function TNtTreeViewTranslator.CanTranslate(obj: TObject): Boolean;
begin
Result := obj is TTreeNodes;
end;
procedure TNtTreeViewTranslator.Translate(
component: TComponent;
obj: TObject;
const name: String;
value: Variant;
index: Integer);
var
stream: TNtStream;
procedure ProcessOld(node: TTreeNode);
var
i, size: Integer;
info: TNodeInfo;
begin
size := stream.ReadInteger;
stream.Read(info, size);
node.ImageIndex := info.ImageIndex;
node.SelectedIndex := info.SelectedIndex;
node.OverlayIndex := info.OverlayIndex;
node.Text := TNtConvert.AnsiToUnicode(info.Text);
for i := 0 to info.Count - 1 do
ProcessOld(node[i]);
end;
{$IFDEF DELPHI2006}
procedure Process(node: TTreeNode);
var
i: Integer;
info: TNodeDataInfo;
str: UnicodeString;
begin
stream.ReadInteger; // size
stream.Read(info, SizeOf(info));
SetLength(str, info.TextLen);
if info.TextLen > 0 then
stream.Read(str[1], 2*info.TextLen);
node.ImageIndex := info.ImageIndex;
node.SelectedIndex := info.SelectedIndex;
node.OverlayIndex := info.OverlayIndex;
node.Text := str;
for i := 0 to info.Count - 1 do
Process(node[i]);
end;
{$ENDIF}
{$IFDEF UNICODE}
procedure Process2(node: TTreeNode);
var
i: Integer;
info: {$IFDEF DELPHIXE2}TNodeDataInfo2x86{$ELSE}TNodeDataInfo2{$ENDIF};
str: UnicodeString;
begin
stream.ReadInteger;
stream.Read(info, SizeOf(info));
SetLength(str, info.TextLen);
if info.TextLen > 0 then
stream.Read(str[1], 2*info.TextLen);
node.ImageIndex := info.ImageIndex;
node.SelectedIndex := info.SelectedIndex;
node.OverlayIndex := info.OverlayIndex;
node.Text := str;
for i := 0 to info.Count - 1 do
Process2(node[i]);
end;
{$ENDIF}
{$IFDEF DELPHIXE2}
procedure Process264(node: TTreeNode);
var
i: Integer;
info: TNodeDataInfo2x64;
str: UnicodeString;
begin
stream.ReadInteger;
stream.Read(info, SizeOf(info));
SetLength(str, info.TextLen);
if info.TextLen > 0 then
stream.Read(str[1], 2*info.TextLen);
node.ImageIndex := info.ImageIndex;
node.SelectedIndex := info.SelectedIndex;
node.OverlayIndex := info.OverlayIndex;
node.Text := str;
for i := 0 to info.Count - 1 do
Process2(node[i]);
end;
{$ENDIF}
const
VERSION_32_2 = $03;
VERSION_64_2 = $04;
var
i, count: Integer;
node: TTreeNode;
nodes: TTreeNodes;
{$IFDEF UNICODE}
version: Byte;
{$ENDIF}
begin
nodes := obj as TTreeNodes;
{$IFDEF DELPHIXE}
stream := TNtStream.Create(TBytes(value));
{$ELSE}
stream := TNtStream.Create(AnsiString(value));
{$ENDIF}
try
if name = 'Items.Data' then
begin
count := stream.ReadInteger;
node := nodes.GetFirstNode;
for i := 0 to count - 1 do //FI:W528
begin
ProcessOld(node);
node := node.GetNextSibling;
end;
end
{$IFDEF DELPHI2006}
else
begin
{$IFDEF UNICODE}version := {$ENDIF}stream.ReadByte;
count := stream.ReadInteger;
node := nodes.GetFirstNode;
for i := 0 to count - 1 do //FI:W528
begin
{$IFDEF UNICODE}
{$IFDEF DELPHIXE2}
if version >= VERSION_64_2 then
Process264(node)
else
{$ENDIF}
if version = VERSION_32_2 then
Process2(node)
else
{$ENDIF}
Process(node);
node := node.GetNextSibling;
end;
end;
{$ENDIF}
finally
stream.Free;
end;
end;
class procedure TNtTreeViewTranslator.ForceUse;
begin
end;
initialization
NtTranslatorExtensions.Register(TNtTreeViewTranslator);
end.
|
unit UMyFPImage;
{$mode objfpc}{$H+}
{ Simple unit to load PNG and JPEG images with FP Image
Copyright (c) 2020 by Andrzej Kilijański (digitalkarabela.com)
Public domain license.
No warranty, use at your own risk.
}
interface
uses
Classes, SysUtils, FPImage, FPReadJPEG, FPReadPNG;
type
// Simple FPImage code to load jpeg and png images
// -------------------------------------------------------------------------
TMyRGB8BitImage = class(TFPCompactImgRGB8Bit)
public
property Data : PFPCompactImgRGB8BitValue read FData;
end;
TMyRGBA8BitImage = class(TFPCompactImgRGBA8Bit)
public
property Data : PFPCompactImgRGBA8BitValue read FData;
end;
function LoadJpegImage(ImageFile: string; FlipVertical: Boolean): TMyRGB8BitImage;
function LoadPNGImage(ImageFile: string; FlipVertical: Boolean): TMyRGBA8BitImage;
function LoadImage(ImageFile: string; FlipVertical: Boolean): TFPCompactImgBase;
implementation
procedure FlipVert(Data:PByte; RowSize:Integer; ImageHeight: Integer);
var
Y: Integer;
SourceRow: PByte;
DestRow: PByte;
BuffArray: array of Byte;
begin
SetLength(BuffArray, RowSize);
SourceRow := PByte(Data); // first row
DestRow := PByte(Data) + (ImageHeight - 1) * RowSize; // last row
for Y := 0 to ImageHeight div 2 - 1 do
begin
{ Copy DestRow to buffer }
Move(DestRow^, BuffArray[0], RowSize);
{ Copy SourceRow to DestRow }
Move(SourceRow^, DestRow^, RowSize);
{ Copy Buffer to Source }
Move(BuffArray[0], SourceRow^, RowSize);
{ Update pointers }
Inc(SourceRow, RowSize);
Dec(DestRow, RowSize);
end;
end;
function LoadJpegImage(ImageFile: string; FlipVertical: Boolean): TMyRGB8BitImage;
var
MyImage: TMyRGB8BitImage;
Reader: TFPReaderJPEG;
// flip variables
RowSize: Integer;
begin
MyImage := nil;
Reader := nil;
try
try
MyImage := TMyRGB8BitImage.Create(0, 0);
Reader := TFPReaderJPEG.Create;
MyImage.LoadFromFile(ImageFile, Reader);
if FlipVertical and (MyImage.Height > 1) then
begin
RowSize := MyImage.Width * 3; // RGB (three bytes)
FlipVert(PByte(MyImage.FData), RowSize, MyImage.Height);
end;
except
on E: Exception do
begin
FreeAndNil(MyImage);
WriteLn('Failed to load texture: '+ E.Message);
end;
end;
finally
FreeAndNil(Reader);
end;
Result := MyImage;
end;
function LoadPNGImage(ImageFile: string; FlipVertical: Boolean): TMyRGBA8BitImage;
var
MyImage: TMyRGBA8BitImage;
Reader: TFPReaderPNG;
// flip variables
RowSize: Integer;
begin
MyImage := nil;
Reader := nil;
try
try
MyImage := TMyRGBA8BitImage.Create(0, 0);
Reader := TFPReaderPNG.Create;
MyImage.LoadFromFile(ImageFile, Reader);
if FlipVertical and (MyImage.Height > 1) then
begin
RowSize := MyImage.Width * 4; // RGBA (four bytes)
FlipVert(PByte(MyImage.FData), RowSize, MyImage.Height);
end;
except
on E: Exception do
begin
FreeAndNil(MyImage);
WriteLn('Failed to load texture: '+ E.Message);
end;
end;
finally
FreeAndNil(Reader);
end;
Result := MyImage;
end;
function LoadImage(ImageFile: string; FlipVertical: Boolean): TFPCompactImgBase;
var
Extension: string;
begin
Extension := ExtractFileExt(ImageFile);
if Extension = '.jpg' then
begin
Result := LoadJpegImage(ImageFile, FlipVertical);
Exit;
end;
if Extension = '.png' then
begin
Result := LoadPNGImage(ImageFile, FlipVertical);
Exit;
end;
Result := nil;
end;
end.
|
unit MeshSmoothGaussian;
// This is a Taubin like mesh smooth that uses gaussian functions. It works with
// manifold meshes that are regular (or as regular as possible) and all its edges
// should be in the same size. In short, it is a terrible way to smooth meshes
// and it is here just for comparison purposes. However, it is very quick and
// using a good filter with an almost regular mesh may make the results look
// good with a single interaction.
interface
uses MeshProcessingBase, Mesh, BasicMathsTypes, BasicDataTypes, NeighborDetector;
{$INCLUDE source/Global_Conditionals.inc}
type
TMeshSmoothGaussian = class (TMeshProcessingBase)
protected
procedure MeshSmoothOperation(var _Vertices: TAVector3f; _NumVertices: integer; const _NeighborDetector : TNeighborDetector; const _VertexEquivalences: auint32);
procedure DoMeshProcessing(var _Mesh: TMesh); override;
end;
implementation
uses Math, GlConstants, MeshPluginBase, NeighborhoodDataPlugin;
procedure TMeshSmoothGaussian.DoMeshProcessing(var _Mesh: TMesh);
var
NeighborDetector : TNeighborDetector;
NeighborhoodPlugin : PMeshPluginBase;
NumVertices: integer;
VertexEquivalences: auint32;
begin
NeighborhoodPlugin := _Mesh.GetPlugin(C_MPL_NEIGHBOOR);
if NeighborhoodPlugin <> nil then
begin
NeighborDetector := TNeighborhoodDataPlugin(NeighborhoodPlugin^).VertexNeighbors;
NumVertices := TNeighborhoodDataPlugin(NeighborhoodPlugin^).InitialVertexCount;
VertexEquivalences := TNeighborhoodDataPlugin(NeighborhoodPlugin^).VertexEquivalences;
end
else
begin
NeighborDetector := TNeighborDetector.Create;
NeighborDetector.BuildUpData(_Mesh.Geometry,High(_Mesh.Vertices)+1);
NumVertices := High(_Mesh.Vertices)+1;
VertexEquivalences := nil;
end;
MeshSmoothOperation(_Mesh.Vertices,NumVertices,NeighborDetector,VertexEquivalences);
_Mesh.ForceRefresh;
// Free memory
if NeighborhoodPlugin = nil then
begin
NeighborDetector.Free;
end;
end;
procedure TMeshSmoothGaussian.MeshSmoothOperation(var _Vertices: TAVector3f; _NumVertices: integer; const _NeighborDetector : TNeighborDetector; const _VertexEquivalences: auint32);
const
C_2PI = 2 * Pi;
C_E = 2.718281828;
var
HitCounter: single;
OriginalVertexes : TAVector3f;
VertexWeight : TVector3f;
v,v1 : integer;
Distance: single;
Deviation: single;
begin
SetLength(OriginalVertexes,High(_Vertices)+1);
BackupVector3f(_Vertices,OriginalVertexes);
// Sum up vertices with its neighbours, using the desired distance formula.
// Do an average for all vertices.
for v := Low(_Vertices) to (_NumVertices-1) do
begin
// get the standard deviation.
Deviation := 0;
v1 := _NeighborDetector.GetNeighborFromID(v); // get vertex neighbor from vertex
HitCounter := 0;
VertexWeight.X := 0;
VertexWeight.Y := 0;
VertexWeight.Z := 0;
while v1 <> -1 do
begin
Deviation := Deviation + Power(OriginalVertexes[v1].X - OriginalVertexes[v].X,2) + Power(OriginalVertexes[v1].Y - OriginalVertexes[v].Y,2) + Power(OriginalVertexes[v1].Z - OriginalVertexes[v].Z,2);
HitCounter := HitCounter + 1;
VertexWeight.X := VertexWeight.X + (OriginalVertexes[v1].X - OriginalVertexes[v].X);
VertexWeight.Y := VertexWeight.Y + (OriginalVertexes[v1].Y - OriginalVertexes[v].Y);
VertexWeight.Z := VertexWeight.Z + (OriginalVertexes[v1].Z - OriginalVertexes[v].Z);
v1 := _NeighborDetector.GetNextNeighbor;
end;
if HitCounter > 0 then
Deviation := Sqrt(Deviation / HitCounter);
// calculate the vertex position.
if (HitCounter > 0) and (Deviation <> 0) then
begin
Distance := ((C_FREQ_NORMALIZER * VertexWeight.X) / HitCounter);
if Distance > 0 then
_Vertices[v].X := OriginalVertexes[v].X + (1 / (sqrt(C_2PI) * Deviation)) * Power(C_E,(Distance * Distance) / (-2 * Deviation * Deviation))
else if Distance < 0 then
_Vertices[v].X := OriginalVertexes[v].X - (1 / (sqrt(C_2PI) * Deviation)) * Power(C_E,(Distance * Distance) / (-2 * Deviation * Deviation));
Distance := ((C_FREQ_NORMALIZER * VertexWeight.Y) / HitCounter);
if Distance > 0 then
_Vertices[v].Y := OriginalVertexes[v].Y + (1 / (sqrt(C_2PI) * Deviation)) * Power(C_E,(Distance * Distance) / (-2 * Deviation * Deviation))
else if Distance < 0 then
_Vertices[v].Y := OriginalVertexes[v].Y - (1 / (sqrt(C_2PI) * Deviation)) * Power(C_E,(Distance * Distance) / (-2 * Deviation * Deviation));
Distance := ((C_FREQ_NORMALIZER * VertexWeight.Z) / HitCounter);
if Distance > 0 then
_Vertices[v].Z := OriginalVertexes[v].Z + (1 / (sqrt(C_2PI) * Deviation)) * Power(C_E,(Distance * Distance) / (-2 * Deviation * Deviation))
else if Distance < 0 then
_Vertices[v].Z := OriginalVertexes[v].Z - (1 / (sqrt(C_2PI) * Deviation)) * Power(C_E,(Distance * Distance) / (-2 * Deviation * Deviation));
end;
end;
v := _NumVertices;
while v <= High(_Vertices) do
begin
v1 := GetEquivalentVertex(v,_NumVertices,_VertexEquivalences);
_Vertices[v].X := _Vertices[v1].X;
_Vertices[v].Y := _Vertices[v1].Y;
_Vertices[v].Z := _Vertices[v1].Z;
inc(v);
end;
// Free memory
SetLength(OriginalVertexes,0);
end;
end.
|
unit uCheckException_Controller;
interface
uses
System.SysUtils, Forms, System.Classes;
type
TException = class
private
FLogFile: String;
public
constructor Create;
procedure CheckException(Sender: TObject; e: Exception);
procedure SaveLog(Value: String);
end;
implementation
uses
Vcl.Dialogs;
{ TException }
procedure TException.CheckException(Sender: TObject; e: Exception);
begin
SaveLog('=====================================================');
if TComponent(Sender) is TForm then
begin
SaveLog('Form: ' + TForm(Sender).Name);
SaveLog('Caption: ' + TForm(Sender).Caption);
SaveLog('Classe: ' + e.ClassName);
SaveLog('Erro: ' + e.Message);
end
else
begin
SaveLog('Form: ' + TForm(TComponent(Sender).Owner).Name);
SaveLog('Caption: ' + TForm(TComponent(Sender).Owner).Caption);
SaveLog('Classe: ' + e.ClassName);
SaveLog('Erro: ' + e.Message);
end;
ShowMessage(e.Message);
end;
constructor TException.Create;
begin
FLogFile := ChangeFileExt(ParamStr(0), '.log');
Application.OnException := CheckException;
end;
procedure TException.SaveLog(Value: String);
var
txtLog: TextFile;
begin
AssignFile(txtLog, FLogFile);
if FileExists(FLogFile) then
Append(txtLog)
else
Rewrite(txtLog);
Writeln(txtLog, FormatDateTime('dd-mm-yyyy hh:nn:ss - ', Now) + Value);
CloseFile(txtLog);
end;
var
MyException: TException;
initialization
MyException := TException.Create;
finalization
MyException.Free;
end.
|
unit Ueberschriftenpanel_norm;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, StdCtrls, Graphics;
type
TUeberschriftenpanel = class(TPanel)
private
{ Private-Deklarationen }
FImageList : TImageList;
FIndex : integer;
FText : string;
FHeight : integer;
Icon : TImage;
Ueberschrift : TLabel;
Strich : TPanel;
procedure PanelErzeugen;
procedure aktualIcon;
procedure setIconIndex(const Value: integer);
procedure setText(const Value: string);
procedure setImageList(const Value: TImageList);
procedure setHeight(const Value: integer);
protected
{ Protected-Deklarationen }
procedure Loaded; override;
public
{ Public-Deklarationen }
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
published
{ Published-Deklarationen }
property NF_ImgList: TImageList read FImageList write setImageList;
property NF_Index : integer read FIndex write setIconIndex;
property NF_Text : string read FText write setText;
property NF_Height : integer read FHeight write setHeight;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('new frontiers', [TUeberschriftenpanel]);
end;
{ TUeberschriftenpanel }
constructor TUeberschriftenpanel.Create(aOwner: TComponent);
begin
inherited;
PanelErzeugen;
end;
procedure TUeberschriftenpanel.aktualIcon;
begin
if FImageList = nil then
begin
Ueberschrift.Left := 8;
exit;
end;
Ueberschrift.Left := 26;
FImageList.getBitmap(FIndex, Icon.Picture.Bitmap);
Icon.Transparent := true;
self.Repaint;
Icon.Repaint;
end;
destructor TUeberschriftenpanel.Destroy;
begin
inherited;
end;
procedure TUeberschriftenpanel.Loaded;
begin
inherited;
// Überschrift ggf. in der DFM gespeicherte Werte
if (self.Height = 24) then
self.Height := 25;
self.BevelOuter := bvNone;
self.BevelInner := bvNone;
end;
procedure TUeberschriftenpanel.PanelErzeugen;
begin
self.ParentFont := false;
self.Color := clWhite;
self.BevelOuter := bvNone;
self.BevelInner := bvNone;
self.Align := alTop;
self.Height := 25;
self.Caption := ' ';
{$IfDef VER180}
self.ParentBackground := false;
{$EndIf}
FHeight := self.Height;
self.Font.Name := 'Segoe UI';
self.Font.Size := 10;
Strich := TPanel.Create(self);
Strich.Parent := self;
Strich.Align := alBottom;
Strich.Height := 2;
Strich.ParentBackground := false;
Strich.BevelOuter := bvNone;
Strich.BevelInner := bvNone;
Strich.Caption := '';
Strich.Color := 14526722;
Icon := TImage.Create(self);
Icon.Parent := self;
Icon.Left := 3;
Icon.Top := 3;
Icon.Width := 18;
Icon.Height := 18;
Ueberschrift := TLabel.Create(self);
Ueberschrift.ParentFont := false;
Ueberschrift.Parent := self;
Ueberschrift.Font.Assign(self.Font);
Ueberschrift.Autosize := true;
Ueberschrift.Caption := '(c) new | frontiers software gmbh';
Ueberschrift.Left := 26;
Ueberschrift.Top := 4;
FText := '(c) new | frontiers software gmbh';
FIndex := 0;
end;
procedure TUeberschriftenpanel.setIconIndex(const Value: integer);
begin
FIndex := Value;
aktualIcon;
end;
procedure TUeberschriftenpanel.setText(const Value: string);
begin
FText := Value;
if Ueberschrift <> nil then Ueberschrift.Caption := FText;
end;
procedure TUeberschriftenpanel.setImageList(const Value: TImageList);
begin
FImageList := Value;
aktualIcon;
end;
procedure TUeberschriftenpanel.setHeight(const Value: integer);
begin
FHeight := Value;
self.Height := FHeight;
Icon.Top := Round((FHeight - Icon.Height) / 2);
Ueberschrift.Top := Round((FHeight - Ueberschrift.Height) / 2);
end;
end.
|
unit EasyEditState;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
EasyClasses, EasyParser, EasyEditor, EasyEditSource;
type
TEasyEditState = class
public
WindowChar: Integer;
WindowLine: Integer;
Cursor: TPoint;
procedure GetState(inEdit: TEasyEdit);
procedure SetState(inEdit: TEasyEdit);
end;
implementation
{ TEasyEditState }
procedure TEasyEditState.GetState(inEdit: TEasyEdit);
begin
WindowChar := inEdit.WindowChar;
WindowLine := inEdit.WindowLine;
Cursor := inEdit.CurrentPosition;
end;
procedure TEasyEditState.SetState(inEdit: TEasyEdit);
begin
inEdit.WindowChar := WindowChar;
inEdit.WindowLine := WindowLine;
inEdit.CurrentPosition := Cursor;
end;
end.
|
unit frmManageParametersUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, frmCustomGoPhastUnit, Grids, StdCtrls, RbwDataGrid4, Math,
ModflowParameterUnit, OrderedCollectionUnit,
ModflowTransientListParameterUnit, HufDefinition, Buttons, Mask, JvExMask,
JvSpin, ExtCtrls, RequiredDataSetsUndoUnit, UndoItemsScreenObjects,
ModflowPackageSelectionUnit;
type
TParamColumn = (pcName, pcPackage, pcType, pcValue, pcMult, pcZone);
TfrmManageParameters = class(TfrmCustomGoPhast)
rdgParameters: TRbwDataGrid4;
pnlBottom: TPanel;
lblNumParameters: TLabel;
seNumberOfParameters: TJvSpinEdit;
btnDelete: TBitBtn;
btnOK: TBitBtn;
btnCancel: TBitBtn;
btnHelp: TBitBtn;
btnImportPval: TButton;
dlgOpenPval: TOpenDialog;
procedure FormCreate(Sender: TObject); override;
procedure FormDestroy(Sender: TObject); override;
procedure rdgParametersSetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: string);
procedure rdgParametersStateChange(Sender: TObject; ACol, ARow: Integer;
const Value: TCheckBoxState);
procedure btnDeleteClick(Sender: TObject);
procedure seNumberOfParametersChange(Sender: TObject);
procedure rdgParametersMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure btnOKClick(Sender: TObject);
procedure rdgParametersBeforeDrawCell(Sender: TObject; ACol, ARow: Integer);
procedure rdgParametersSelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
procedure btnImportPvalClick(Sender: TObject);
private
FSteadyParameters: TModflowSteadyParameters;
FHufParameters: THufModflowParameters;
FTransientListParameters: TModflowTransientListParameters;
FSfrParamInstances: TSfrParamInstances;
FParamList: TList;
FDeletingParam: Boolean;
procedure GetData;
procedure SetData;
procedure UpdateParameterTable;
function ParamValid(ParamType: TParameterType): boolean;
procedure CreateParameter(ParamIndex: TParameterType; ARow: Integer);
procedure UpdateParameter(ParamIndex: TParameterType;
var AParam: TModflowParameter; ARow: Integer);
procedure CreateOrUpdateParameter(ARow: Integer);
procedure DeleteAParam(ARow: Integer);
{ Private declarations }
public
{ Public declarations }
end;
Type
TUndoChangeParameters = class(TCustomUndoChangeParameters)
private
FExistingScreenObjects: TScreenObjectEditCollection;
FOldProperties: TScreenObjectEditCollection;
public
Constructor Create(var NewSteadyParameters: TModflowSteadyParameters;
var NewTransientParameters: TModflowTransientListParameters;
var NewHufModflowParameters: THufModflowParameters;
var NewSfrParamInstances: TSfrParamInstances);
Destructor Destroy; override;
procedure DoCommand; override;
procedure Undo; override;
end;
implementation
uses
Contnrs, frmGoPhastUnit, PhastModelUnit, ModflowDiscretizationWriterUnit,
ScreenObjectUnit, frmShowHideObjectsUnit, ModflowPackagesUnit, ReadPvalUnit,
IntListUnit;
resourcestring
StrErrorReadingPvalF = 'Error reading Pval file. Check that it is a valid ' +
'Pval file.';
StrErrorReadingPvalF2 = 'Error reading Pval file. The following parameter n' +
'ames from the Pval file are not included in the model.'#13#10'%s';
StrName = 'Name';
StrPackage = 'Package';
StrType = 'Type';
StrValue = 'Value';
StrMultiplierArray = 'Multiplier Array';
StrZoneArray = 'Zone Array';
{$R *.dfm}
type
TParamClassType = (pctUnknown, pctSteady, pctTransient, pctHUF);
TParamRecord = record
Package: string;
PType: string;
PClass: TParamClassType;
end;
const
ParamRecords: array[Low(TParameterType).. High(TParameterType)]
of TParamRecord =
((Package: 'Unknown'; PType: 'Unknown'; PClass: pctUnknown),
(Package: 'LPF, UPW'; PType: 'HK'; PClass: pctSteady),
(Package: 'LPF, UPW'; PType: 'HANI'; PClass: pctSteady),
(Package: 'LPF, UPW'; PType: 'VK'; PClass: pctSteady),
(Package: 'LPF, UPW'; PType: 'VANI'; PClass: pctSteady),
(Package: 'LPF, UPW'; PType: 'SS'; PClass: pctSteady),
(Package: 'LPF, UPW'; PType: 'SY'; PClass: pctSteady),
(Package: 'LPF, UPW'; PType: 'VKCB'; PClass: pctSteady),
(Package: 'RCH'; PType: 'RCH'; PClass: pctTransient),
(Package: 'EVT'; PType: 'EVT'; PClass: pctTransient),
(Package: 'ETS'; PType: 'ETS'; PClass: pctTransient),
(Package: 'CHD'; PType: 'CHD'; PClass: pctTransient),
(Package: 'GHB'; PType: 'GHB'; PClass: pctTransient),
(Package: 'WEL'; PType: 'Q'; PClass: pctTransient),
(Package: 'RIV'; PType: 'RIV'; PClass: pctTransient),
(Package: 'DRN'; PType: 'DRN'; PClass: pctTransient),
(Package: 'DRT'; PType: 'DRT'; PClass: pctTransient),
(Package: 'SFR'; PType: 'SFR'; PClass: pctTransient),
(Package: 'HFB'; PType: 'HFB'; PClass: pctSteady),
(Package: 'HUF'; PType: 'HK'; PClass: pctHUF),
(Package: 'HUF'; PType: 'HANI'; PClass: pctHUF),
(Package: 'HUF'; PType: 'VK'; PClass: pctHUF),
(Package: 'HUF'; PType: 'VANI'; PClass: pctHUF),
(Package: 'HUF'; PType: 'SS'; PClass: pctHUF),
(Package: 'HUF'; PType: 'SY'; PClass: pctHUF),
(Package: 'HUF'; PType: 'SYTP'; PClass: pctSteady),
(Package: 'HUF'; PType: 'KDEP'; PClass: pctHUF),
(Package: 'HUF'; PType: 'LVDA'; PClass: pctSteady),
(Package: 'STR'; PType: 'STR'; PClass: pctTransient),
(Package: 'FMP'; PType: 'QMAX'; PClass: pctTransient)
);
Type
TCompareMethod = class(TObject)
Method: TParamColumn;
end;
var
SortOrder: TList = nil;
function CompareParamNames(Item1, Item2: Pointer): Integer;
var
P1, P2: TModflowParameter;
begin
P1 := Item1;
P2 := Item2;
result := AnsiCompareText(P1.ParameterName, P2.ParameterName);
end;
function ComparePackages(Item1, Item2: Pointer): Integer;
var
P1, P2: TModflowParameter;
Pkg1, Pkg2: string;
begin
P1 := Item1;
P2 := Item2;
Pkg1 := ParamRecords[P1.ParameterType].Package;
Pkg2 := ParamRecords[P2.ParameterType].Package;
result := AnsiCompareText(Pkg1, Pkg2);
end;
function CompareTypes(Item1, Item2: Pointer): Integer;
var
P1, P2: TModflowParameter;
Type1, Type2: string;
begin
P1 := Item1;
P2 := Item2;
Type1 := ParamRecords[P1.ParameterType].PType;
Type2 := ParamRecords[P2.ParameterType].PType;
result := AnsiCompareText(Type1, Type2);
end;
function CompareValues(Item1, Item2: Pointer): Integer;
var
P1, P2: TModflowParameter;
begin
P1 := Item1;
P2 := Item2;
Result := Sign(P1.Value - P2.Value);
end;
function CompareMult(Item1, Item2: Pointer): Integer;
var
P1, P2: TModflowParameter;
PS1, PS2: TModflowSteadyParameter;
begin
P1 := Item1;
P2 := Item2;
if P1 is TModflowSteadyParameter then
begin
if P2 is TModflowSteadyParameter then
begin
PS1 := TModflowSteadyParameter(P1);
PS2 := TModflowSteadyParameter(P2);
result := Sign(Ord(PS1.UseMultiplier) - Ord(PS2.UseMultiplier));
end
else
begin
result := 1;
end;
end
else
begin
if P2 is TModflowSteadyParameter then
begin
result := -1;
end
else
begin
result := 0;
end;
end;
end;
function CompareZone(Item1, Item2: Pointer): Integer;
var
P1, P2: TModflowParameter;
PS1, PS2: TModflowSteadyParameter;
begin
P1 := Item1;
P2 := Item2;
if P1 is TModflowSteadyParameter then
begin
if P2 is TModflowSteadyParameter then
begin
PS1 := TModflowSteadyParameter(P1);
PS2 := TModflowSteadyParameter(P2);
result := Sign(Ord(PS1.UseZone) - Ord(PS2.UseZone));
end
else
begin
result := 1;
end;
end
else
begin
if P2 is TModflowSteadyParameter then
begin
result := -1;
end
else
begin
result := 0;
end;
end;
end;
function CompareParameters(Item1, Item2: Pointer): Integer;
var
Index: Integer;
CM: TCompareMethod;
begin
result := 0;
for Index := 0 to SortOrder.Count - 1 do
begin
CM := SortOrder[Index];
case CM.Method of
pcName: result := CompareParamNames(Item1, Item2);
pcPackage: result := ComparePackages(Item1, Item2);
pcType: result := CompareTypes(Item1, Item2);
pcValue: result := CompareValues(Item1, Item2);
pcMult: result := CompareMult(Item1, Item2);
pcZone: result := CompareZone(Item1, Item2);
else Assert(False);
end;
if result <> 0 then
begin
Exit;
end;
end;
end;
procedure TfrmManageParameters.btnImportPvalClick(Sender: TObject);
var
PvalList: TParamList;
MyList: TStringList;
ValIndex: Integer;
Item: TParamItem;
RowIndex: Integer;
IntList: TIntegerList;
InvalidParameters: TStringList;
begin
inherited;
if dlgOpenPval.Execute then
begin
PvalList := TParamList.Create;
try
if ReadPvalFile(dlgOpenPval.FileName, PvalList) then
begin
MyList := TStringList.Create;
IntList := TIntegerList.Create;
InvalidParameters := TStringList.Create;
try
MyList.Assign(rdgParameters.Cols[Ord(pcName)]);
MyList.Delete(0);
MyList.CaseSensitive := False;
for ValIndex := 0 to PvalList.Count - 1 do
begin
Item := PvalList[ValIndex];
RowIndex := MyList.IndexOf(Item.Name)+1;
if RowIndex >= 1 then
begin
IntList.Add(RowIndex);
end
else
begin
InvalidParameters.Add(Item.Name);
end;
end;
if InvalidParameters.Count > 0 then
begin
Beep;
MessageDlg(Format(StrErrorReadingPvalF2, [InvalidParameters.Text]),
mtError, [mbOK], 0);
end
else
begin
Assert(IntList.Count = PvalList.Count);
for ValIndex := 0 to PvalList.Count - 1 do
begin
Item := PvalList[ValIndex];
RowIndex := IntList[ValIndex];
rdgParameters.Cells[Ord(pcValue), RowIndex] :=
FloatToStr(Item.Value);
rdgParametersSetEditText(rdgParameters, Ord(pcValue), RowIndex,
rdgParameters.Cells[Ord(pcValue), RowIndex]);
end;
end;
finally
MyList.Free;
IntList.Free;
InvalidParameters.Free;
end;
end
else
begin
Beep;
MessageDlg(StrErrorReadingPvalF, mtError, [mbOK], 0);
end;
finally
PvalList.Free;
end;
end;
end;
procedure TfrmManageParameters.btnOKClick(Sender: TObject);
begin
inherited;
SetData;
end;
procedure TfrmManageParameters.btnDeleteClick(Sender: TObject);
begin
inherited;
DeleteAParam(rdgParameters.SelectedRow);
seNumberOfParameters.AsInteger := seNumberOfParameters.AsInteger -1;
end;
procedure TfrmManageParameters.FormCreate(Sender: TObject);
var
PackageList: TStringList;
Index: TParameterType;
ParamTypeList: TStringList;
begin
inherited;
rdgParameters.BeginUpdate;
try
rdgParameters.Cells[Ord(pcName), 0] := StrName;
rdgParameters.Cells[Ord(pcPackage), 0] := StrPackage;
rdgParameters.Cells[Ord(pcType), 0] := StrType;
rdgParameters.Cells[Ord(pcValue), 0] := StrValue;
rdgParameters.Cells[Ord(pcMult), 0] := StrMultiplierArray;
rdgParameters.Cells[Ord(pcZone), 0] := StrZoneArray;
finally
rdgParameters.EndUpdate;
end;
PackageList := TStringList.Create;
try
for Index := Low(TParameterType) to High(TParameterType) do
begin
if ParamValid(Index)
and (PackageList.IndexOf(ParamRecords[Index].Package) < 0) then
begin
PackageList.Add(ParamRecords[Index].Package)
end;
end;
PackageList.Sort;
rdgParameters.Columns[Ord(pcPackage)].PickList := PackageList;
finally
PackageList.Free;
end;
ParamTypeList := TStringList.Create;
try
for Index := Low(TParameterType) to High(TParameterType) do
begin
if ParamValid(Index)
and (ParamTypeList.IndexOf(ParamRecords[Index].PType) < 0) then
begin
ParamTypeList.Add(ParamRecords[Index].PType)
end;
end;
ParamTypeList.Sort;
rdgParameters.Columns[Ord(pcType)].PickList := ParamTypeList;
finally
ParamTypeList.Free;
end;
FSteadyParameters := TModflowSteadyParameters.Create(nil);
FHufParameters := THufModflowParameters.Create(nil);
FTransientListParameters := TModflowTransientListParameters.Create(nil);
FSfrParamInstances := TSfrParamInstances.Create(nil);
GetData;
end;
procedure TfrmManageParameters.FormDestroy(Sender: TObject);
begin
inherited;
FSfrParamInstances.Free;
FTransientListParameters.Free;
FHufParameters.Free;
FSteadyParameters.Free;
FParamList.Free;
end;
procedure TfrmManageParameters.GetData;
var
Index: Integer;
PhastModel: TPhastModel;
AParam: TModflowParameter;
begin
FParamList := TList.Create;
PhastModel := frmGoPhast.PhastModel;
FSteadyParameters.Assign(PhastModel.ModflowSteadyParameters);
FHufParameters.Assign(PhastModel.HufParameters);
FTransientListParameters.Assign(PhastModel.ModflowTransientParameters);
FSfrParamInstances.Assign(PhastModel.ModflowPackages.
SfrPackage.ParameterInstances);
FParamList.Capacity := FSteadyParameters.Count
+ FTransientListParameters.Count
+ FHufParameters.Count;
seNumberOfParameters.AsInteger := FParamList.Capacity;
for Index := 0 to FSteadyParameters.Count - 1 do
begin
AParam := FSteadyParameters[Index];
FParamList.Add(AParam);
end;
for Index := 0 to FTransientListParameters.Count - 1 do
begin
AParam := FTransientListParameters[Index];
FParamList.Add(AParam);
end;
for Index := 0 to FHufParameters.Count - 1 do
begin
AParam := FHufParameters[Index];
FParamList.Add(AParam);
end;
UpdateParameterTable;
end;
function TfrmManageParameters.ParamValid(ParamType: TParameterType): boolean;
var
TransientModel: Boolean;
begin
result := False;
TransientModel := frmGoPhast.PhastModel.ModflowStressPeriods.TransientModel;
case ParamType of
ptUndefined: result := False;
ptLPF_HK: result := frmGoPhast.PhastModel.LpfIsSelected or frmGoPhast.PhastModel.UpwIsSelected;
ptLPF_HANI: result := frmGoPhast.PhastModel.LpfIsSelected or frmGoPhast.PhastModel.UpwIsSelected;
ptLPF_VK: result := frmGoPhast.PhastModel.LpfIsSelected or frmGoPhast.PhastModel.UpwIsSelected;
ptLPF_VANI: result := frmGoPhast.PhastModel.LpfIsSelected or frmGoPhast.PhastModel.UpwIsSelected;
ptLPF_SS: result := (frmGoPhast.PhastModel.LpfIsSelected or frmGoPhast.PhastModel.UpwIsSelected) and TransientModel;
ptLPF_SY: result := (frmGoPhast.PhastModel.LpfIsSelected or frmGoPhast.PhastModel.UpwIsSelected) and TransientModel;
ptLPF_VKCB: result := frmGoPhast.PhastModel.LpfIsSelected or frmGoPhast.PhastModel.UpwIsSelected;
ptRCH: result := frmGoPhast.PhastModel.RchIsSelected;
ptEVT: result := frmGoPhast.PhastModel.EvtIsSelected;
ptETS: result := frmGoPhast.PhastModel.EtsIsSelected;
ptCHD: result := frmGoPhast.PhastModel.ChdIsSelected;
ptGHB: result := frmGoPhast.PhastModel.GhbIsSelected;
ptQ: result := frmGoPhast.PhastModel.WelIsSelected;
ptRIV: result := frmGoPhast.PhastModel.RivIsSelected;
ptDRN: result := frmGoPhast.PhastModel.DrnIsSelected;
ptDRT: result := frmGoPhast.PhastModel.DrtIsSelected;
ptSFR: result := frmGoPhast.PhastModel.SfrIsSelected;
ptHFB: result := frmGoPhast.PhastModel.HfbIsSelected;
ptHUF_HK: result := frmGoPhast.PhastModel.HufIsSelected;
ptHUF_HANI: result := frmGoPhast.PhastModel.HufIsSelected;
ptHUF_VK: result := frmGoPhast.PhastModel.HufIsSelected;
ptHUF_VANI: result := frmGoPhast.PhastModel.HufIsSelected;
ptHUF_SS: result := frmGoPhast.PhastModel.HufIsSelected and TransientModel;
ptHUF_SY: result := frmGoPhast.PhastModel.HufIsSelected and TransientModel;
ptHUF_SYTP: result := frmGoPhast.PhastModel.HufIsSelected and TransientModel;
ptHUF_KDEP: result := frmGoPhast.PhastModel.HufIsSelected;
ptHUF_LVDA: result := frmGoPhast.PhastModel.HufIsSelected;
ptSTR: result := frmGoPhast.PhastModel.StrIsSelected;
ptQMAX: result := frmGoPhast.PhastModel.FarmProcessIsSelected;
else Assert(False);
end;
end;
procedure TfrmManageParameters.CreateParameter(ParamIndex: TParameterType; ARow: Integer);
var
AParam: TModflowParameter;
begin
AParam := nil;
case ParamRecords[ParamIndex].PClass of
pctUnknown:
begin
Assert(False);
end;
pctSteady:
begin
AParam := FSteadyParameters.Add as TModflowParameter;
rdgParameters.UseSpecialFormat[Ord(pcMult), ARow] := True;
rdgParameters.UseSpecialFormat[Ord(pcZone), ARow] := True;
rdgParameters.SpecialFormat[Ord(pcMult), ARow] := rcf4Boolean;
rdgParameters.SpecialFormat[Ord(pcZone), ARow] := rcf4Boolean;
end;
pctTransient:
begin
AParam := FTransientListParameters.Add as TModflowParameter;
rdgParameters.UseSpecialFormat[Ord(pcMult), ARow] := False;
rdgParameters.UseSpecialFormat[Ord(pcZone), ARow] := False;
end;
pctHUF:
begin
AParam := FHufParameters.Add as TModflowParameter;
rdgParameters.UseSpecialFormat[Ord(pcMult), ARow] := False;
rdgParameters.UseSpecialFormat[Ord(pcZone), ARow] := False;
end;
else
Assert(False);
end;
rdgParameters.Objects[Ord(pcName), ARow] := AParam;
FParamList.Add(AParam);
AParam.ParameterType := ParamIndex;
AParam.ParameterName := rdgParameters.Cells[Ord(pcName), ARow];
if AParam.ParameterName <> rdgParameters.Cells[Ord(pcName), ARow] then
begin
rdgParameters.Cells[Ord(pcName), ARow] := AParam.ParameterName;
end;
AParam.Value := StrToFloatDef(rdgParameters.Cells[Ord(pcValue), ARow], 0);
end;
procedure TfrmManageParameters.UpdateParameter(ParamIndex: TParameterType;
var AParam: TModflowParameter; ARow: Integer);
begin
case ParamRecords[ParamIndex].PClass of
pctUnknown:
begin
Assert(False);
end;
pctSteady:
begin
if AParam is TModflowSteadyParameter then
begin
AParam.ParameterType := ParamIndex;
end
else
begin
FParamList.Remove(AParam);
AParam.Free;
AParam := nil;
rdgParameters.Objects[Ord(pcName), ARow] := nil;
end;
end;
pctTransient:
begin
if AParam is TModflowTransientListParameter then
begin
AParam.ParameterType := ParamIndex;
end
else
begin
FParamList.Remove(AParam);
AParam.Free;
AParam := nil;
rdgParameters.Objects[Ord(pcName), ARow] := nil;
end;
end;
pctHUF:
begin
if AParam is THufParameter then
begin
AParam.ParameterType := ParamIndex;
end
else
begin
FParamList.Remove(AParam);
AParam.Free;
AParam := nil;
rdgParameters.Objects[Ord(pcName), ARow] := nil;
end;
end;
else
Assert(False);
end;
end;
procedure TfrmManageParameters.CreateOrUpdateParameter(ARow: Integer);
var
ParamIndex: TParameterType;
AParam: TModflowParameter;
begin
for ParamIndex := ptLPF_HK to High(TParameterType) do
begin
if ParamValid(ParamIndex)
and (rdgParameters.Cells[Ord(pcPackage), ARow] =
ParamRecords[ParamIndex].Package)
and (rdgParameters.Cells[Ord(pcType), ARow] =
ParamRecords[ParamIndex].PType) then
begin
if rdgParameters.Objects[Ord(pcName), ARow] <> nil then
begin
AParam := rdgParameters.Objects[Ord(pcName), ARow] as TModflowParameter;
if AParam.ParameterType = ParamIndex then
begin
break;
end;
UpdateParameter(ParamIndex, AParam, ARow);
end
else
begin
AParam := nil;
end;
if AParam = nil then
begin
CreateParameter(ParamIndex, ARow);
end;
break;
end;
end;
end;
procedure TfrmManageParameters.DeleteAParam(ARow: Integer);
var
AParam: TModflowParameter;
ColIndex: Integer;
begin
FDeletingParam := True;
try
AParam := rdgParameters.Objects[Ord(pcName), ARow] as TModflowParameter;
if AParam <> nil then
begin
FSfrParamInstances.DeleteInstancesOfParameter(AParam.ParameterName);
end;
AParam.Free;
rdgParameters.Objects[Ord(pcName), ARow] := nil;
if rdgParameters.RowCount > 2 then
begin
rdgParameters.DeleteRow(ARow);
end
else
begin
for ColIndex := 0 to rdgParameters.ColCount - 1 do
begin
rdgParameters.Cells[ColIndex, 1] := '';
end;
end;
finally
FDeletingParam := False;
end;
end;
procedure TfrmManageParameters.UpdateParameterTable;
var
SteadyParam: TModflowSteadyParameter;
AModflowParam: TModflowParameter;
ParamIndex: Integer;
begin
FParamList.Sort(CompareParameters);
rdgParameters.BeginUpdate;
try
rdgParameters.RowCount := Max(FParamList.Count + 1, 2);
seNumberOfParameters.AsInteger := FParamList.Count;
for ParamIndex := 0 to FParamList.Count - 1 do
begin
AModflowParam := FParamList[ParamIndex];
rdgParameters.Objects[Ord(pcName), ParamIndex + 1] := AModflowParam;
rdgParameters.Cells[Ord(pcName), ParamIndex + 1] :=
AModflowParam.ParameterName;
rdgParameters.Cells[Ord(pcPackage), ParamIndex + 1] :=
ParamRecords[AModflowParam.ParameterType].Package;
rdgParameters.Cells[Ord(pcType), ParamIndex + 1] :=
ParamRecords[AModflowParam.ParameterType].PType;
rdgParameters.Cells[Ord(pcValue), ParamIndex + 1] :=
FloatToStr(AModflowParam.Value);
if AModflowParam is TModflowSteadyParameter then
begin
SteadyParam := TModflowSteadyParameter(AModflowParam);
if SteadyParam.ParameterType <> ptHFB then
begin
rdgParameters.UseSpecialFormat[Ord(pcMult), ParamIndex + 1] := True;
rdgParameters.UseSpecialFormat[Ord(pcZone), ParamIndex + 1] := True;
rdgParameters.SpecialFormat[Ord(pcMult), ParamIndex + 1] :=
rcf4Boolean;
rdgParameters.SpecialFormat[Ord(pcZone), ParamIndex + 1] :=
rcf4Boolean;
rdgParameters.Checked[Ord(pcMult), ParamIndex + 1] :=
SteadyParam.UseMultiplier;
rdgParameters.Checked[Ord(pcZone), ParamIndex + 1] :=
SteadyParam.UseZone;
end
else
begin
rdgParameters.UseSpecialFormat[Ord(pcMult), ParamIndex + 1] := False;
rdgParameters.UseSpecialFormat[Ord(pcZone), ParamIndex + 1] := False;
end;
end
else
begin
rdgParameters.UseSpecialFormat[Ord(pcMult), ParamIndex + 1] := False;
rdgParameters.UseSpecialFormat[Ord(pcZone), ParamIndex + 1] := False;
end;
end;
finally
rdgParameters.EndUpdate;
end;
end;
type TGridCrack = class(TRbwDataGrid4);
procedure TfrmManageParameters.rdgParametersBeforeDrawCell(Sender: TObject;
ACol, ARow: Integer);
var
Names: TStringList;
ParamIndex: TParameterType;
OK_Combination: Boolean;
begin
inherited;
if (ARow > 0) then
begin
if (ACol = Ord(pcName)) then
begin
Names := TStringList.Create;
try
Names.Assign(rdgParameters.Cols[Ord(pcName)]);
if Names.IndexOf(rdgParameters.Cells[ACol, ARow]) <> ARow then
begin
rdgParameters.Canvas.Brush.Color := clRed;
end;
finally
Names.Free;
end;
end;
if TParamColumn(ACol) in [pcPackage, pcType] then
begin
OK_Combination := False;
for ParamIndex := ptLPF_HK to High(TParameterType) do
begin
if (rdgParameters.Cells[Ord(pcPackage), ARow] =
ParamRecords[ParamIndex].Package)
and (rdgParameters.Cells[Ord(pcType), ARow] =
ParamRecords[ParamIndex].PType) then
begin
OK_Combination := True;
break;
end;
end;
if not OK_Combination then
begin
rdgParameters.Canvas.Brush.Color := clRed;
end;
end;
end;
end;
procedure TfrmManageParameters.rdgParametersMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
ACol: Integer;
ARow: Integer;
ParCol: TParamColumn;
Index: Integer;
CM: TCompareMethod;
begin
inherited;
rdgParameters.MouseToCell(X, Y, ACol, ARow);
if (ARow = 0) and (ACol >= 0) and (ACol < rdgParameters.ColCount) then
begin
TGridCrack(rdgParameters).HideEditor;
ParCol := TParamColumn(ACol);
for Index := 0 to SortOrder.Count - 1 do
begin
CM := SortOrder[Index];
if CM.Method = ParCol then
begin
SortOrder.Extract(CM);
SortOrder.Insert(0, CM);
UpdateParameterTable;
break;
end;
end;
end;
end;
procedure TfrmManageParameters.rdgParametersSelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
inherited;
if (ARow > 0) and (ACol >= 0) and (ACol < rdgParameters.ColCount) then
begin
case TParamColumn(ACol) of
pcName, pcType, pcValue: ; // do nothing
pcPackage: CanSelect := False;
pcMult, pcZone: CanSelect := rdgParameters.UseSpecialFormat[ACol, ARow];
else Assert(False);
end;
end;
end;
procedure TfrmManageParameters.rdgParametersSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: string);
var
PCol: TParamColumn;
ParamIndex: TParameterType;
AParam: TModflowParameter;
NewPackage: string;
NewName: string;
begin
inherited;
if FDeletingParam then
Exit;
if (ARow > 0) and (ACol >= 0) and (ACol < rdgParameters.ColCount) then
begin
PCol := TParamColumn(ACol);
case PCol of
pcName:
begin
CreateOrUpdateParameter(ARow);
if rdgParameters.Objects[Ord(pcName), ARow] <> nil then
begin
AParam := rdgParameters.Objects[Ord(pcName), ARow]
as TModflowParameter;
NewName := string(AnsiString(rdgParameters.Cells[Ord(pcName), ARow]));
if AParam.ParameterType = ptSFR then
begin
FSfrParamInstances.UpdateParamName(AParam.ParameterName, NewName);
end;
AParam.ParameterName := NewName;
if AParam.ParameterName <>
rdgParameters.Cells[Ord(pcName), ARow] then
begin
rdgParameters.Cells[Ord(pcName), ARow] := AParam.ParameterName;
end;
end;
end;
pcPackage, pcType:
begin
if rdgParameters.Cells[Ord(pcName), ARow] <> '' then
begin
if PCol = pcType then
begin
for ParamIndex := Low(TParameterType) to High(TParameterType) do
begin
if ParamValid(ParamIndex)
and (rdgParameters.Cells[Ord(pcType), ARow] =
ParamRecords[ParamIndex].PType) then
begin
NewPackage := ParamRecords[ParamIndex].Package;
rdgParameters.Cells[Ord(pcPackage), ARow] := NewPackage;
break;
end;
end;
end;
CreateOrUpdateParameter(ARow);
end;
end;
pcValue:
begin
if rdgParameters.Objects[Ord(pcName), ARow] <> nil then
begin
AParam := rdgParameters.Objects[Ord(pcName), ARow]
as TModflowParameter;
AParam.Value := StrToFloatDef(rdgParameters.Cells[
Ord(pcValue), ARow], 0);
end;
end;
pcMult, pcZone: ; // do nothing
else
Assert(False);
end;
end;
end;
procedure TfrmManageParameters.rdgParametersStateChange(Sender: TObject; ACol,
ARow: Integer; const Value: TCheckBoxState);
var
PCol: TParamColumn;
AParam : TModflowParameter;
SteadyParam : TModflowSteadyParameter;
begin
inherited;
if (ARow > 0) and (ACol >= 0) and (ACol < rdgParameters.ColCount) then
begin
if rdgParameters.Objects[Ord(pcName), ARow] <> nil then
begin
AParam := rdgParameters.Objects[Ord(pcName), ARow]
as TModflowParameter;
if AParam is TModflowSteadyParameter then
begin
SteadyParam := TModflowSteadyParameter(AParam);
PCol := TParamColumn(ACol);
case PCol of
pcMult:
begin
SteadyParam.UseMultiplier :=
rdgParameters.Checked[Ord(pcMult), ARow];
end;
pcZone:
begin
SteadyParam.UseZone := rdgParameters.Checked[Ord(pcZone), ARow];
end
else Assert(False);
end;
end;
end;
end;
end;
procedure TfrmManageParameters.seNumberOfParametersChange(Sender: TObject);
var
FirstNewRow: Integer;
RowIndex: Integer;
ColIndex: Integer;
NewRowCount: Integer;
begin
inherited;
if seNumberOfParameters.AsInteger > rdgParameters.RowCount -1 then
begin
FirstNewRow := rdgParameters.RowCount;
rdgParameters.RowCount := Max(seNumberOfParameters.AsInteger + 1, 2);
for RowIndex := FirstNewRow to rdgParameters.RowCount - 1 do
begin
for ColIndex := 0 to rdgParameters.ColCount - 1 do
begin
rdgParameters.Cells[ColIndex,RowIndex] := '';
end;
rdgParameters.UseSpecialFormat[Ord(pcMult), RowIndex] := False;
rdgParameters.UseSpecialFormat[Ord(pcZone), RowIndex] := False;
end;
end
else if seNumberOfParameters.AsInteger < rdgParameters.RowCount -1 then
begin
for RowIndex := rdgParameters.RowCount -1 downto
seNumberOfParameters.AsInteger+1 do
begin
DeleteAParam(RowIndex);
// rdgParameters.Objects[Ord(pcName), RowIndex].Free;
end;
NewRowCount := seNumberOfParameters.AsInteger+1;
if NewRowCount = 1 then
begin
NewRowCount := 2
end;
rdgParameters.RowCount := NewRowCount;
end;
end;
procedure TfrmManageParameters.SetData;
var
Undo: TUndoChangeParameters;
begin
Undo := TUndoChangeParameters.Create(FSteadyParameters,
FTransientListParameters, FHufParameters, FSfrParamInstances);
frmGoPhast.UndoStack.Submit(Undo);
end;
{ TUndoChangeParameters }
constructor TUndoChangeParameters.Create(
var NewSteadyParameters: TModflowSteadyParameters;
var NewTransientParameters: TModflowTransientListParameters;
var NewHufModflowParameters: THufModflowParameters;
var NewSfrParamInstances: TSfrParamInstances);
var
ScreenObjectIndex: Integer;
Item: TScreenObjectEditItem;
AScreenObject: TScreenObject;
ScreenObjectClass: TScreenObjectClass;
begin
inherited;
FExistingScreenObjects := TScreenObjectEditCollection.Create;
FExistingScreenObjects.OwnScreenObject := False;
FOldProperties := TScreenObjectEditCollection.Create;
FOldProperties.OwnScreenObject := True;
for ScreenObjectIndex := 0 to frmGoPhast.PhastModel.ScreenObjectCount - 1 do
begin
Item := FExistingScreenObjects.Add;
AScreenObject := frmGoPhast.PhastModel.ScreenObjects[ScreenObjectIndex];
Item.ScreenObject := AScreenObject;
Item := FOldProperties.Add as TScreenObjectEditItem;
ScreenObjectClass := TScreenObjectClass(AScreenObject.ClassType);
Item.ScreenObject := ScreenObjectClass.Create(nil);
Item.ScreenObject.Assign(AScreenObject);
end;
end;
destructor TUndoChangeParameters.Destroy;
begin
FOldProperties.Free;
FExistingScreenObjects.Free;
inherited;
end;
procedure TUndoChangeParameters.DoCommand;
begin
inherited;
if (frmShowHideObjects <> nil) then
begin
frmShowHideObjects.UpdateScreenObjects;
end;
end;
procedure TUndoChangeParameters.Undo;
begin
inherited;
FExistingScreenObjects.Assign(FOldProperties);
if (frmShowHideObjects <> nil) then
begin
frmShowHideObjects.UpdateScreenObjects;
end;
end;
procedure InitializeSortOrder;
var
Index: TParamColumn;
CM: TCompareMethod;
begin
SortOrder.Free;
SortOrder := TObjectList.Create;
for Index := Low(TParamColumn) to High(TParamColumn) do
begin
CM := TCompareMethod.Create;
CM.Method := Index;
SortOrder.Add(CM)
end;
CM := SortOrder[Ord(pcName)];
SortOrder.Extract(CM);
SortOrder.Insert(2, CM);
end;
initialization
InitializeSortOrder;
finalization
SortOrder.Free;
end.
|
unit fos_firmbox_dhcp_mod;
{$mode objfpc}{$H+}
{$modeswitch nestedprocvars}
interface
uses
Classes, SysUtils, FRE_SYSTEM,
FOS_TOOL_INTERFACES,
FRE_DB_INTERFACE,
FRE_DB_COMMON,
fos_firmbox_subnet_ip_mod,
fre_hal_schemes,fre_dbbusiness;
type
{ TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD }
TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD = class (TFRE_DB_APPLICATION_MODULE)
private
fSubnetIPMod : TFRE_FIRMBOX_SUBNET_IP_MOD;
function _addDHCPChooseZone (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const panelId: String): IFRE_DB_Object;
function _addModifyDHCP (const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object; const panelId: String): IFRE_DB_Object;
protected
procedure SetupAppModuleStructure ; override;
public
class procedure RegisterSystemScheme (const scheme: IFRE_DB_SCHEMEOBJECT); override;
class procedure InstallDBObjects (const conn:IFRE_DB_SYS_CONNECTION; var currentVersionId: TFRE_DB_NameType; var newVersionId: TFRE_DB_NameType); override;
procedure MySessionInitializeModule (const session : TFRE_DB_UserSession);override;
function canAddService (const conn: IFRE_DB_CONNECTION): Boolean;
function canAddService (const conn: IFRE_DB_CONNECTION; const zone: TFRE_DB_ZONE): Boolean;
function canModifyService (const conn: IFRE_DB_CONNECTION): Boolean;
function canModifyService (const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
function canEnableService (const conn: IFRE_DB_CONNECTION): Boolean;
function canEnableService (const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
function canDisableService (const conn: IFRE_DB_CONNECTION): Boolean;
function canDisableService (const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
function canDeleteService (const conn: IFRE_DB_CONNECTION): Boolean;
function canDeleteService (const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
function canApplyService (const conn: IFRE_DB_CONNECTION): Boolean;
function canApplyService (const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
function applyConfig (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object):IFRE_DB_Object;
function enableService (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object):IFRE_DB_Object;
function disableService (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object):IFRE_DB_Object;
procedure deleteServiceConfiguration (const conn: IFRE_DB_CONNECTION; const ses: IFRE_DB_Usersession; service: IFRE_DB_Object);
function modifyService (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object; const panelId: String):IFRE_DB_Object;
function deleteService (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object):IFRE_DB_Object;
function addService (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
published
function WEB_AddService (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_RebuildAddModify (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_StoreService (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ApplyConfigConfirmed (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DeleteServiceConfirmed (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
end;
{ TFRE_FIRMBOX_DHCP_MOD }
TFRE_FIRMBOX_DHCP_MOD = class (TFRE_DB_APPLICATION_MODULE)
private
fSubnetIPMod : TFRE_FIRMBOX_SUBNET_IP_MOD;
fServiceIFMod : TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD;
function _AddModifyTemplate (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const isModify:Boolean):IFRE_DB_Object;
function _AddModifySubnetEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const dbo:IFRE_DB_Object):IFRE_DB_Object;
function _AddModifyFixedEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const dbo:IFRE_DB_Object):IFRE_DB_Object;
procedure _StoreHandleTemplates (const conn: IFRE_DB_CONNECTION; const input:IFRE_DB_Object; const entryObj: IFRE_DB_Object; const isModify: Boolean);
procedure _AddModifyHandleTemplates (const conn: IFRE_DB_CONNECTION; const ses: IFRE_DB_Usersession; const dbo: IFRE_DB_Object; const res: TFRE_DB_FORM_DESC; const store: TFRE_DB_STORE_DESC; const isSubnet: Boolean);
protected
procedure SetupAppModuleStructure ; override;
public
class procedure RegisterSystemScheme (const scheme: IFRE_DB_SCHEMEOBJECT); override;
class procedure InstallDBObjects (const conn:IFRE_DB_SYS_CONNECTION; var currentVersionId: TFRE_DB_NameType; var newVersionId: TFRE_DB_NameType); override;
procedure MySessionInitializeModule (const session : TFRE_DB_UserSession);override;
published
function WEB_Content (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;override;
function WEB_ContentGeneral (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ContentTemplates (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ContentEntries (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_AddDHCP (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DeleteDHCP (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ApplyConfig (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_EnableDHCP (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DisableDHCP (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ServiceSC (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ServiceMenu (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ServiceObjChanged (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_AddTemplate (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ModifyTemplate (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_StoreTemplate (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DeleteTemplate (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DeleteTemplateConfirmed (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_TemplateSC (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_TemplateMenu (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_AddStandardOption (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_StoreStandardOption (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_AddCustomOption (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_StoreCustomOption (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DeleteOption (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_CleanupTemplateDiag (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_CleanupAddOptionDiag (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_AddSubnetEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_AddFixedEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_ModifyEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_StoreSubnetEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_StoreFixedEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DeleteEntry (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_DeleteEntryConfirmed (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_EntrySC (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
function WEB_EntryMenu (const input:IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION):IFRE_DB_Object;
end;
procedure Register_DB_Extensions;
implementation
procedure Register_DB_Extensions;
begin
fre_hal_schemes.Register_DB_Extensions;
GFRE_DBI.RegisterObjectClassEx(TFRE_FIRMBOX_DHCP_MOD);
GFRE_DBI.RegisterObjectClassEx(TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD);
end;
{ TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD }
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canAddService(const conn: IFRE_DB_CONNECTION; const zone: TFRE_DB_ZONE): Boolean;
begin
Result:=conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP,zone.DomainID);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canModifyService(const conn: IFRE_DB_CONNECTION): Boolean;
begin
Result:=conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP) and
conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP_FIXED) and
conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP_SUBNET) and
conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP_TEMPLATE);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canModifyService(const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
var
domain_id: TFRE_DB_GUID;
begin
domain_id:=dbo.DomainID;
Result:=conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,domain_id) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_FIXED,domain_id) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_SUBNET,domain_id) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_TEMPLATE,domain_id);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canEnableService(const conn: IFRE_DB_CONNECTION): Boolean;
begin
Result:=canModifyService(conn);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canEnableService(const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
var
splugin: TFRE_DB_SERVICE_STATUS_PLUGIN;
begin
dbo.GetPlugin(TFRE_DB_SERVICE_STATUS_PLUGIN,splugin);
Result:=canModifyService(conn,dbo) and splugin.isServiceDisabled;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canDisableService(const conn: IFRE_DB_CONNECTION): Boolean;
begin
Result:=canModifyService(conn);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canDisableService(const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
var
splugin: TFRE_DB_SERVICE_STATUS_PLUGIN;
begin
dbo.GetPlugin(TFRE_DB_SERVICE_STATUS_PLUGIN,splugin);
Result:=canModifyService(conn,dbo) and not splugin.isServiceDisabled;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canDeleteService(const conn: IFRE_DB_CONNECTION): Boolean;
begin
Result:=conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP) and
conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_FIXED) and
conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_SUBNET) and
conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION) and
conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_TEMPLATE);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canDeleteService(const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
var
domain_id: TFRE_DB_GUID;
begin
domain_id:=dbo.DomainID;
Result:=conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP,domain_id) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_FIXED,domain_id) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_SUBNET,domain_id) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,domain_id) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_TEMPLATE,domain_id);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canApplyService(const conn: IFRE_DB_CONNECTION): Boolean;
begin
Result:=canModifyService(conn);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canApplyService(const conn: IFRE_DB_CONNECTION; const dbo: IFRE_DB_Object): Boolean;
var
splugin: TFRE_DB_SERVICE_STATUS_PLUGIN;
begin
dbo.GetPlugin(TFRE_DB_SERVICE_STATUS_PLUGIN,splugin);
Result:=canModifyService(conn,dbo) and not splugin.isConfigApplied;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD._addModifyDHCP(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object; const panelId: String): IFRE_DB_Object;
var
res : TFRE_DB_FORM_DESC;
sf : TFRE_DB_SERVER_FUNC_DESC;
zone : TFRE_DB_ZONE;
scheme : IFRE_DB_SchemeObject;
isModify : Boolean;
editable : Boolean;
caption : TFRE_DB_String;
zoneId : TFRE_DB_GUID;
langres : TFRE_DB_StringArray;
zoneStatusPlugin : TFRE_DB_ZONESTATUS_PLUGIN;
group : TFRE_DB_INPUT_GROUP_DESC;
servicePlugin : TFRE_DB_SERVICE_STATUS_PLUGIN;
pId : TFRE_DB_String;
dc : IFRE_DB_DERIVED_COLLECTION;
block : TFRE_DB_INPUT_BLOCK_DESC;
addIPSf : TFRE_DB_SERVER_FUNC_DESC;
selectedId : String;
serviceId : String;
begin
CheckClassVisibility4AnyDomain(ses);
if input.FieldExists('panelId') then begin
pId:=input.Field('panelId').AsString;
end else begin
pId:=panelId;
end;
sf:=CWSF(@WEB_StoreService);
sf.AddParam.Describe('panelId',pId);
if Assigned(service) then begin
isModify:=true;
editable:=canModifyService(conn,service);
zoneId:=service.Field('serviceParent').AsObjectLink;
CheckDbResult(conn.FetchAs(zoneId,TFRE_DB_ZONE,zone));
serviceId:=service.UID_String;
sf.AddParam.Describe('serviceId',serviceId);
selectedId:=service.UID_String;
caption:=FetchModuleTextShort(ses,'dhcp_modify_caption');
end else begin
isModify:=false;
editable:=true;
if input.FieldExists('zoneId') or input.FieldPathExists('data.zone') then begin
if input.FieldExists('zoneId') then begin
zoneId:=FREDB_H2G(input.Field('zoneId').AsString);
end else begin
zoneId:=FREDB_H2G(input.FieldPath('data.zone').AsString);
end;
sf.AddParam.Describe('zoneId',zoneId.AsHexString);
CheckDbResult(conn.FetchAs(zoneId,TFRE_DB_ZONE,zone));
if not canAddService(conn,zone) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
end else begin
Result:=_addDHCPChooseZone(input,ses,app,conn,pId);
exit;
end;
serviceId:='';
selectedId:=zone.UID_String;
caption:=FetchModuleTextShort(ses,'dhcp_new_caption');
end;
if pId='' then begin
res:=TFRE_DB_FORM_DIALOG_DESC.create.Describe(caption,600,true,true,false);
end else begin
res:=TFRE_DB_FORM_PANEL_DESC.create.Describe('',false,editable);
res.contentId:=pId;
end;
dc := ses.FetchDerivedCollection(CFRE_DB_DHCP_INTERFACE_CHOOSER_DC);
dc.Filters.RemoveFilter('zone');
dc.Filters.AddUIDFieldFilter('zone','zuid',zoneId,dbnf_OneValueFromFilter);
dc := ses.FetchDerivedCollection(CFRE_DB_DHCP_IP_CHOOSER_DC);
dc.Filters.RemoveFilter('domain');
dc.Filters.AddUIDFieldFilter('domain','domainid',zone.DomainID,dbnf_OneValueFromFilter);
dc.Filters.RemoveFilter('scheme');
dc.filters.AddSchemeObjectFilter('scheme',[TFRE_DB_IPV4.ClassName]);
GetSystemScheme(TFRE_DB_DHCP,scheme);
group:=res.AddSchemeFormGroup(scheme.GetInputGroup('main'),ses,false,false,'',true,true);
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'local_address_block'));
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('local_address'),ses,[],'',false,true);
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4,zone.DomainID) and conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4_SUBNET,zone.DomainID) then begin
addIPSf:=CWSF(@fSubnetIPMod.WEB_AddIP);
addIPSf.AddParam.Describe('cbclass',self.ClassName);
addIPSf.AddParam.Describe('cbuidpath',FREDB_CombineString(self.GetUIDPath,','));
addIPSf.AddParam.Describe('cbfunc','RebuildAddModify');
addIPSf.AddParam.Describe('cbparamnames','panelId,zoneId,serviceId');
addIPSf.AddParam.Describe('cbparamvalues',pId+','+zoneId.AsHexString+','+serviceId);
addIPSf.AddParam.Describe('field','local_address');
addIPSf.AddParam.Describe('ipversion','ipv4');
addIPSf.AddParam.Describe('selected',selectedId);
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_general_new_ip_button'),addIPSf,true);
end;
group.AddSchemeFormGroup(scheme.GetInputGroup('settings'),ses,false,false,'',true,true);
if isModify then begin
service.GetPlugin(TFRE_DB_SERVICE_STATUS_PLUGIN,servicePlugin);
langres:=TFRE_DB_SERVICE_STATUS_PLUGIN.getStatusLangres(conn);
CheckDbResult(conn.FetchAs(service.Field('serviceParent').AsObjectLink,TFRE_DB_ZONE,zone));
zone.GetPlugin(TFRE_DB_ZONESTATUS_PLUGIN,zoneStatusPlugin);
group:=res.AddGroup.Describe(FetchModuleTextShort(ses,'dhcp_general_status_group'),false,false);
group.AddDescription.Describe(FetchModuleTextShort(ses,'dhcp_general_status_label'),G_getServiceStatusText(servicePlugin,zoneStatusPlugin,langres),'status');
group.AddDescription.Describe(FetchModuleTextShort(ses,'dhcp_general_config_status_label'),G_getServiceConfigStatusText(servicePlugin,langres),'config_status');
res.FillWithObjectValues(service,ses);
end else begin
res.SetElementValue('all_interfaces','true');
end;
if editable then begin
res.AddButton.Describe(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('button_save')),sf,fdbbt_submit);
end;
Result:=res;
end;
procedure TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.deleteServiceConfiguration(const conn: IFRE_DB_CONNECTION; const ses: IFRE_DB_Usersession; service: IFRE_DB_Object);
var
subnets : TFRE_DB_GUIDArray;
subnetIdx : Integer;
fixed : TFRE_DB_GUIDArray;
fixedIdx : Integer;
templates : TFRE_DB_GUIDArray;
templateIdx : Integer;
relObjs : TFRE_DB_GUIDArray;
relObjIdx : Integer;
serviceUid : TFRE_DB_GUID;
zone : TFRE_DB_ZONE;
begin
if not canDeleteService(conn,service) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
subnets:=conn.GetReferences(service.UID,false,TFRE_DB_DHCP_SUBNET.ClassName,'dhcp_id');
for subnetIdx := 0 to High(subnets) do begin
CheckDbResult(conn.Delete(subnets[subnetIdx]));
end;
fixed:=conn.GetReferences(service.UID,false,TFRE_DB_DHCP_FIXED.ClassName,'dhcp_id');
for fixedIdx := 0 to High(fixed) do begin
CheckDbResult(conn.Delete(fixed[fixedIdx]));
end;
templates:=conn.GetReferences(service.UID,false,TFRE_DB_DHCP_TEMPLATE.ClassName,'dhcp_id');
for templateIdx := 0 to High(templates) do begin
relObjs:=conn.GetReferences(templates[templateIdx],false,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION.ClassName,'template');
for relObjIdx := 0 to High(relObjs) do begin
CheckDbResult(conn.Delete(relObjs[relObjIdx]));
end;
CheckDbResult(conn.Delete(templates[templateIdx]));
end;
CheckDbResult(conn.FetchAs(service.Field('serviceParent').AsObjectLink,TFRE_DB_ZONE,zone));
serviceUid:=service.UID;
CheckDbResult(conn.Delete(serviceUid));
zone.RemoveServiceEmbedded(conn,ses,serviceUid.AsHexString);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD._addDHCPChooseZone(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const panelId: String): IFRE_DB_Object;
var
res: TFRE_DB_FORM_DESC;
sf : TFRE_DB_SERVER_FUNC_DESC;
dc : IFRE_DB_DERIVED_COLLECTION;
begin
dc:=ses.FetchDerivedCollection('DHCP_ZONE_CHOOSER');
if dc.ItemCount=0 then begin
Result:=TFRE_DB_MESSAGE_DESC.Create.Describe(FetchModuleTextShort(ses,'dhcp_create_error_no_zone_cap'),FetchModuleTextShort(ses,'dhcp_create_error_no_zone_msg'),fdbmt_error);
end else begin
sf:=CWSF(@WEB_AddService);
if panelId='' then begin
res:=TFRE_DB_FORM_DIALOG_DESC.create.Describe(FetchModuleTextShort(ses,'dhcp_new_caption'),600,true,true,false);
end else begin
res:=TFRE_DB_FORM_PANEL_DESC.create.Describe('',false);
res.contentId:=panelId;
sf.AddParam.Describe('panelId',panelId);
end;
res.AddChooser.Describe(FetchModuleTextShort(ses,'zone_chooser_label'),'zone',dc.GetStoreDescription.Implementor_HC as TFRE_DB_STORE_DESC,dh_chooser_combo,true);
res.AddButton.Describe(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('button_save')),sf,fdbbt_submit);
Result:=res;
end;
end;
procedure TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.SetupAppModuleStructure;
begin
inherited SetupAppModuleStructure;
fSubnetIPMod:=TFRE_FIRMBOX_SUBNET_IP_MOD.create;
AddApplicationModule(fSubnetIPMod);
end;
class procedure TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.RegisterSystemScheme(const scheme: IFRE_DB_SCHEMEOBJECT);
begin
inherited RegisterSystemScheme(scheme);
scheme.SetParentSchemeByName('TFRE_DB_APPLICATION_MODULE');
end;
class procedure TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.InstallDBObjects(const conn: IFRE_DB_SYS_CONNECTION; var currentVersionId: TFRE_DB_NameType; var newVersionId: TFRE_DB_NameType);
begin
newVersionId:='1.0';
if currentVersionId='' then begin
currentVersionId := '1.0';
CreateModuleText(conn,'dhcp_new_caption','New DHCP Server');
CreateModuleText(conn,'dhcp_modify_caption','Modify DHCP Server');
CreateModuleText(conn,'zone_chooser_label','Zone');
CreateModuleText(conn,'zone_chooser_value','%zone_str% (%service_obj_str%)');
CreateModuleText(conn,'zone_chooser_value_no_service_obj','%zone_str%');
CreateModuleText(conn,'dhcp_create_error_exists_cap','Error: New DHCP Service');
CreateModuleText(conn,'dhcp_create_error_exists_msg','The DHCP Service already exists!');
CreateModuleText(conn,'dhcp_create_error_no_zone_cap','Error: New DHCP Service');
CreateModuleText(conn,'dhcp_create_error_no_zone_msg','There is no zone available for a new DHCP Service. Please use the infrastructure module to create a zone.');
CreateModuleText(conn,'apply_service_diag_cap','Apply Configuration');
CreateModuleText(conn,'apply_service_diag_msg','This will apply the DHCP "%service_str%" configuration and restart the service! Are you sure?');
CreateModuleText(conn,'delete_service_diag_cap','Delete DHCP Service');
CreateModuleText(conn,'delete_service_diag_msg','This will delete the DHCP "%service_str%" service and its configuration. This operation is irreversible! Are you sure?');
CreateModuleText(conn,'dhcp_general_status_group','Status Information');
CreateModuleText(conn,'dhcp_general_status_label','Service Status');
CreateModuleText(conn,'dhcp_general_config_status_label','Configuration Status');
CreateModuleText(conn,'dhcp_general_new_ip_button','New IP');
CreateModuleText(conn,'local_address_block','Local Address');
end;
end;
procedure TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.MySessionInitializeModule(const session: TFRE_DB_UserSession);
var
app : TFRE_DB_APPLICATION;
conn : IFRE_DB_CONNECTION;
transform: IFRE_DB_SIMPLE_TRANSFORM;
dc : IFRE_DB_DERIVED_COLLECTION;
procedure _setCaption(const input,transformed_object : IFRE_DB_Object;const langres: TFRE_DB_StringArray);
var
str: String;
begin
if transformed_object.Field('serviceObj').AsString<>'' then begin
str:=StringReplace(langres[0],'%zone_str%',transformed_object.Field('objname').AsString,[rfReplaceAll]);
str:=StringReplace(str,'%service_obj_str%',transformed_object.Field('serviceObj').AsString,[rfReplaceAll]);
end else begin
str:=StringReplace(langres[1],'%zone_str%',transformed_object.Field('objname').AsString,[rfReplaceAll]);
end;
transformed_object.Field('label').AsString:=str;
end;
begin
inherited MySessionInitializeModule(session);
if session.IsInteractiveSession then begin
app := GetEmbeddingApp;
conn := session.GetDBConnection;
GFRE_DBI.NewObjectIntf(IFRE_DB_SIMPLE_TRANSFORM,transform);
with transform do begin
AddOneToOnescheme('objname');
AddOneToOnescheme('label');
AddMatchingReferencedField(['<SERVICEDOMAIN'],'objname','serviceObj','',true,dt_string,true,true,1,'','',nil,'',false,'domainid');
AddMatchingReferencedField(['TEMPLATEID>TFRE_DB_FBZ_TEMPLATE'],'serviceclasses');
AddMatchingReferencedField(['TFRE_DB_DHCP<SERVICEPARENT'],'uid','dhcp','',false,dt_string,false,false,1,'','OK');
AddOneToOnescheme('disabledSCs');
SetSimpleFuncTransformNested(@_setCaption,[FetchModuleTextShort(session,'zone_chooser_value'),FetchModuleTextShort(session,'zone_chooser_value_no_service_obj')]);
end;
dc := session.NewDerivedCollection('DHCP_ZONE_CHOOSER');
with dc do begin
SetDeriveParent(conn.GetCollection(CFOS_DB_ZONES_COLLECTION));
SetDeriveTransformation(transform);
SetDisplayType(cdt_Chooser,[],'');
SetDefaultOrderField('objname',true);
Filters.AddStdClassRightFilter('rights','domainid','','',TFRE_DB_DHCP.ClassName,[sr_STORE],session.GetDBConnection.SYS.GetCurrentUserTokenClone);
Filters.AddStringFieldFilter('serviceclasses','serviceclasses',TFRE_DB_DHCP.ClassName,dbft_EXACTVALUEINARRAY);
Filters.AddStringFieldFilter('disabledSCs','disabledSCs',TFRE_DB_DHCP.ClassName,dbft_EXACTVALUEINARRAY,false,true);
Filters.AddStringFieldFilter('used','dhcp','OK',dbft_EXACT);
end;
end;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.canAddService(const conn: IFRE_DB_CONNECTION): Boolean;
begin
Result:=conn.sys.CheckClassRight4AnyDomain(sr_STORE,TFRE_DB_DHCP);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.addService(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
Result:=_addModifyDHCP(input,ses,app,conn,nil,'');
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.WEB_RebuildAddModify(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
panelId : String;
begin
if input.Field('serviceId').AsString<>'' then begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('serviceId').AsString),service));
input.DeleteField('serviceId');
end else begin
service:=nil;
end;
panelId:=input.Field('panelId').AsString;
Result:=_addModifyDHCP(input,ses,app,conn,service,panelId);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.WEB_StoreService(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
zoneId : TFRE_DB_String;
zone : TFRE_DB_ZONE;
scheme : IFRE_DB_SchemeObject;
dhcp : TFRE_DB_DHCP;
coll : IFRE_DB_COLLECTION;
isModify : Boolean;
begin
if input.FieldExists('serviceId') then begin
CheckDbResult(conn.FetchAs(FREDB_H2G(input.Field('serviceId').AsString),TFRE_DB_DHCP,dhcp));
if not canModifyService(conn,dhcp) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
CheckDbResult(conn.FetchAs(dhcp.Field('serviceParent').AsObjectLink,TFRE_DB_ZONE,zone));
isModify:=true;
end else begin
if input.FieldPathExists('data.zone') then begin
zoneId:=input.FieldPath('data.zone').AsString;
input.Field('data').AsObject.DeleteField('zone');
end else begin
if input.FieldExists('zoneId') then begin
zoneId:=input.Field('zoneId').AsString;
end else begin
raise EFRE_DB_Exception.Create('Missing required parameter serviceId, data.zone or zoneId');
end;
end;
CheckDbResult(conn.FetchAs(FREDB_H2G(zoneId),TFRE_DB_ZONE,zone));
if not canAddService(conn,zone) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
dhcp:=TFRE_DB_DHCP.CreateForDB;
dhcp.SetDomainID(zone.DomainID);
dhcp.Field('serviceParent').AsObjectLink:=zone.UID;
dhcp.UCT:=TFRE_DB_DHCP.ClassName + '@' + zone.UID_String;
coll:=conn.GetCollection(CFOS_DB_SERVICES_COLLECTION);
if coll.ExistsIndexedFieldval(dhcp.field('uct'))>0 then begin
Result:=TFRE_DB_MESSAGE_DESC.Create.Describe(FetchModuleTextShort(ses,'dhcp_create_error_exists_cap'),FetchModuleTextShort(ses,'dhcp_create_error_exists_msg'),fdbmt_error);
exit;
end;
isModify:=false;
end;
GetSystemScheme(TFRE_DB_DHCP,scheme);
scheme.SetObjectFieldsWithScheme(input.Field('data').AsObject,dhcp,not isModify,conn);
if isModify then begin
G_setServiceConfigChanged(conn,ses,dhcp);
CheckDbResult(conn.Update(dhcp));
end else begin
CheckDbResult(coll.Store(dhcp));
end;
if input.Field('panelId').AsString='' then begin
Result:=TFRE_DB_CLOSE_DIALOG_DESC.create.Describe();
end else begin
Result:=GFRE_DB_NIL_DESC;
end;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.applyConfig(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object): IFRE_DB_Object;
var
sf: TFRE_DB_SERVER_FUNC_DESC;
begin
if not canApplyService(conn,service) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf:=CWSF(@WEB_ApplyConfigConfirmed);
sf.AddParam.Describe('serviceId',service.UID_String);
Result:=TFRE_DB_MESSAGE_DESC.create.Describe(FetchModuleTextShort(ses,'apply_service_diag_cap'),StringReplace(FetchModuleTextShort(ses,'apply_service_diag_msg'),'%service_str%',service.Field('objname').AsString,[rfReplaceAll]),fdbmt_confirm,sf);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.enableService(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object): IFRE_DB_Object;
var
servicePlugin: TFRE_DB_SERVICE_STATUS_PLUGIN;
begin
if not canEnableService(conn,service) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
service.GetPlugin(TFRE_DB_SERVICE_STATUS_PLUGIN,servicePlugin);
servicePlugin.setEnabled;
CheckDbResult(conn.Update(service));
Result:=GFRE_DB_NIL_DESC;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.disableService(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object): IFRE_DB_Object;
var
servicePlugin: TFRE_DB_SERVICE_STATUS_PLUGIN;
begin
if not canDisableService(conn,service) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
service.GetPlugin(TFRE_DB_SERVICE_STATUS_PLUGIN,servicePlugin);
servicePlugin.setDisabled;
CheckDbResult(conn.Update(service));
Result:=GFRE_DB_NIL_DESC;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.modifyService(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object; const panelId: String): IFRE_DB_Object;
begin
Result:=_addModifyDHCP(input,ses,app,conn,service,panelId);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.deleteService(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const service: IFRE_DB_Object): IFRE_DB_Object;
var
sf: TFRE_DB_SERVER_FUNC_DESC;
begin
if not canDeleteService(conn,service) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf:=CWSF(@WEB_DeleteServiceConfirmed);
sf.AddParam.Describe('serviceId',service.UID_String);
Result:=TFRE_DB_MESSAGE_DESC.create.Describe(FetchModuleTextShort(ses,'delete_service_diag_cap'),StringReplace(FetchModuleTextShort(ses,'delete_service_diag_msg'),'%service_str%',service.Field('objname').AsString,[rfReplaceAll]),fdbmt_confirm,sf);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.WEB_AddService(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
Result:=addService(input,ses,app,conn);
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.WEB_ApplyConfigConfirmed(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : TFRE_DB_DHCP;
servicePlugin : TFRE_DB_SERVICE_STATUS_PLUGIN;
zone : TFRE_DB_ZONE;
begin
if input.field('confirmed').AsBoolean then begin
CheckDbResult(conn.FetchAs(FREDB_H2G(input.Field('serviceId').AsString),TFRE_DB_DHCP,service));
if not canApplyService(conn,service) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
service.GetPlugin(TFRE_DB_SERVICE_STATUS_PLUGIN,servicePlugin);
servicePlugin.setConfigApplied;
CheckDbResult(conn.Update(service.CloneToNewObject()));
CheckDbResult(conn.FetchAs(service.Field('serviceParent').AsObjectLink,TFRE_DB_ZONE,zone));
zone.UpdateServiceEmbedded(conn,ses,service);
end;
Result:=GFRE_DB_NIL_DESC;
end;
function TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.WEB_DeleteServiceConfirmed(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
begin
Result:=GFRE_DB_NIL_DESC;
if input.field('confirmed').AsBoolean then begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('serviceId').AsString),service));
deleteServiceConfiguration(conn,ses,service);
Result:=GFRE_DB_NIL_DESC;
end;
end;
{ TFRE_FIRMBOX_DHCP_MOD }
class procedure TFRE_FIRMBOX_DHCP_MOD.RegisterSystemScheme(const scheme: IFRE_DB_SCHEMEOBJECT);
begin
inherited RegisterSystemScheme(scheme);
scheme.SetParentSchemeByName('TFRE_DB_APPLICATION_MODULE');
end;
function TFRE_FIRMBOX_DHCP_MOD._AddModifyTemplate(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const isModify: Boolean): IFRE_DB_Object;
var
scheme : IFRE_DB_SchemeObject;
res : TFRE_DB_FORM_DIALOG_DESC;
sf : TFRE_DB_SERVER_FUNC_DESC;
diagCap : TFRE_DB_String;
dbo : IFRE_DB_Object;
service : IFRE_DB_Object;
dc : IFRE_DB_DERIVED_COLLECTION;
group : TFRE_DB_INPUT_GROUP_DESC;
block : TFRE_DB_INPUT_BLOCK_DESC;
baseAddIPSf : TFRE_DB_SERVER_FUNC_DESC;
addIPSf : TFRE_DB_SERVER_FUNC_DESC;
opSf : TFRE_DB_SERVER_FUNC_DESC;
i : Integer;
begin
sf:=CWSF(@WEB_StoreTemplate);
baseAddIPSf:=CWSF(@fSubnetIPMod.WEB_AddIP);
baseAddIPSf.AddParam.Describe('cbclass',self.ClassName);
baseAddIPSf.AddParam.Describe('cbuidpath',FREDB_CombineString(self.GetUIDPath,','));
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
if isModify then begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),dbo));
if not (conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_TEMPLATE,dbo.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,dbo.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
if not ses.GetSessionModuleData(ClassName).FieldExists('templateDiagData') then begin //FIRST CALL - REFILL templateDiagData
for i := 0 to dbo.Field('standard_options').ValueCount - 1 do begin
ses.GetSessionModuleData(ClassName).FieldPathCreate('templateDiagData.standard').AddObject(dbo.Field('standard_options').AsObjectItem[i].CloneToNewObject());
end;
for i := 0 to dbo.Field('custom_options').ValueCount - 1 do begin
ses.GetSessionModuleData(ClassName).FieldPathCreate('templateDiagData.custom').AddObject(dbo.Field('custom_options').AsObjectItem[i].CloneToNewObject());
end;
end;
sf.AddParam.Describe('templateId',dbo.UID_String);
diagCap:=FetchModuleTextShort(ses,'template_modify_diag_cap');
baseAddIPSf.AddParam.Describe('cbfunc','ModifyTemplate');
baseAddIPSf.AddParam.Describe('selected',dbo.UID_String);
end else begin
if not (conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_TEMPLATE,service.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf.AddParam.Describe('dhcpId',service.UID_String);
diagCap:=FetchModuleTextShort(ses,'template_create_diag_cap');
baseAddIPSf.AddParam.Describe('cbfunc','AddTemplate');
baseAddIPSf.AddParam.Describe('selected',service.UID_String);
end;
dc := ses.FetchDerivedCollection(CFRE_DB_DHCP_IP_CHOOSER_DC);
dc.Filters.RemoveFilter('domain');
dc.Filters.AddUIDFieldFilter('domain','domainid',service.DomainID,dbnf_OneValueFromFilter);
dc.Filters.RemoveFilter('scheme');
dc.filters.AddSchemeObjectFilter('scheme',[TFRE_DB_IPV4.ClassName]);
GetSystemScheme(TFRE_DB_DHCP_TEMPLATE,scheme);
res:=TFRE_DB_FORM_DIALOG_DESC.create.Describe(diagCap,600,true,true,false,true,nil,0,CWSF(@WEB_CleanupTemplateDiag));
group:=res.AddSchemeFormGroup(scheme.GetInputGroup('general'),ses);
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'router_block'));
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('router'),ses,[],'',false,true);
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4,service.DomainID) and conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4_SUBNET,service.DomainID) then begin
addIPSf:=baseAddIPSf.CloneToNewObject(true).Implementor_HC as TFRE_DB_SERVER_FUNC_DESC;
addIPSf.AddParam.Describe('field','routers');
addIPSf.AddParam.Describe('ipversion','ipv4');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_new_ip_button'),addIPSf,true);
end;
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'dns_block'));
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('dns'),ses,[],'',false,true);
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4,service.DomainID) and conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4_SUBNET,service.DomainID) then begin
addIPSf:=baseAddIPSf.CloneToNewObject(true).Implementor_HC as TFRE_DB_SERVER_FUNC_DESC;
addIPSf.AddParam.Describe('field','domain-name-servers');
addIPSf.AddParam.Describe('ipversion','ipv4');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_new_ip_button'),addIPSf,true);
end;
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'dns_block'),'dns2');
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('dns'),ses,[],'dns2',false,true);
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4,service.DomainID) and conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4_SUBNET,service.DomainID) then begin
addIPSf:=baseAddIPSf.CloneToNewObject(true).Implementor_HC as TFRE_DB_SERVER_FUNC_DESC;
addIPSf.AddParam.Describe('field','dns2.domain-name-servers');
addIPSf.AddParam.Describe('ipversion','ipv4');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_new_ip_button'),addIPSf,true);
end;
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'ntp_block'));
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('ntp'),ses,[],'',false,true);
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4,service.DomainID) and conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4_SUBNET,service.DomainID) then begin
addIPSf:=baseAddIPSf.CloneToNewObject(true).Implementor_HC as TFRE_DB_SERVER_FUNC_DESC;
addIPSf.AddParam.Describe('field','ntp-servers');
addIPSf.AddParam.Describe('ipversion','ipv4');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_new_ip_button'),addIPSf,true);
end;
group.AddSchemeFormGroup(scheme.GetInputGroup('settings'),ses,false,false,'',true,true);
group:=res.AddGroup.Describe(FetchModuleTextShort(ses,'dhcp_template_diag_advanced_group'),true,input.Field('advancedCollapsed').AsBoolean);
if ses.GetSessionModuleData(ClassName).FieldExists('templateDiagData') then begin
for i := 0 to ses.GetSessionModuleData(ClassName).Field('templateDiagData').AsObject.Field('standard').ValueCount-1 do begin
block:=group.AddBlock.Describe(StringReplace(FetchModuleTextShort(ses,'dhcp_template_diag_standard_option_label'),'%name_str%',ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.standard').AsObjectItem[i].Field('name').AsString,[rfReplaceAll]));
block.AddInput.Describe('',ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.standard').AsObjectItem[i].UID_String,false,false,true,false,
ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.standard').AsObjectItem[i].Field('value').AsString);
opSf:=CWSF(@WEB_DeleteOption);
opSf.AddParam.Describe('selected',input.Field('selected').AsString);
opSf.AddParam.Describe('idx',IntToStr(i));
opSf.AddParam.Describe('type','standard');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_delete_option'),opSf,true);
end;
for i := 0 to ses.GetSessionModuleData(ClassName).Field('templateDiagData').AsObject.Field('custom').ValueCount-1 do begin
group.AddInput.Describe(FetchModuleTextShort(ses,'dhcp_template_diag_custom_option_label'),ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.custom').AsObjectItem[i].UID_String+'_d',false,false,true,false,
ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.custom').AsObjectItem[i].Field('declaration').AsString);
block:=group.AddBlock.Describe('','',true);
block.AddInput.Describe('',ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.custom').AsObjectItem[i].UID_String+'_u',false,false,true,false,
ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.custom').AsObjectItem[i].Field('usage').AsString);
opSf:=CWSF(@WEB_DeleteOption);
opSf.AddParam.Describe('selected',input.Field('selected').AsString);
opSf.AddParam.Describe('idx',IntToStr(i));
opSf.AddParam.Describe('type','custom');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_delete_option'),opSf,true);
end;
end;
block:=group.AddBlock.Describe();
opSf:=CWSF(@WEB_AddStandardOption);
opSf.AddParam.Describe('selected',input.Field('selected').AsString);
block.AddInputButton().Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_add_standard_option'),opSf,true);
opSf:=CWSF(@WEB_AddCustomOption);
opSf.AddParam.Describe('selected',input.Field('selected').AsString);
block.AddInputButton().Describe('',FetchModuleTextShort(ses,'dhcp_template_diag_add_custom_option'),opSf,true);
res.AddButton.Describe(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('button_save')),sf,fdbbt_submit);
if isModify then begin
res.FillWithObjectValues(dbo,ses);
if dbo.Field('domain-name-servers').ValueCount>1 then begin
res.SetElementValue('dns2.domain-name-servers',FREDB_G2H(dbo.Field('domain-name-servers').AsObjectLinkItem[1]));
end;
end;
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD._AddModifySubnetEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const dbo:IFRE_DB_Object): IFRE_DB_Object;
var
scheme : IFRE_DB_SchemeObject;
res : TFRE_DB_FORM_DIALOG_DESC;
sf : TFRE_DB_SERVER_FUNC_DESC;
diagCap : TFRE_DB_String;
isModify : Boolean;
service : IFRE_DB_Object;
dc : IFRE_DB_DERIVED_COLLECTION;
addSubnetSf : TFRE_DB_SERVER_FUNC_DESC;
group : TFRE_DB_INPUT_GROUP_DESC;
block : TFRE_DB_INPUT_BLOCK_DESC;
begin
sf:=CWSF(@WEB_StoreSubnetEntry);
addSubnetSf:=CWSF(@fSubnetIPMod.WEB_AddSubnet);
addSubnetSf.AddParam.Describe('cbclass',self.ClassName);
addSubnetSf.AddParam.Describe('cbuidpath',FREDB_CombineString(self.GetUIDPath,','));
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
if Assigned(dbo) then begin
isModify:=true;
if not (conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_SUBNET,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,dbo.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf.AddParam.Describe('entryId',dbo.UID_String);
diagCap:=FetchModuleTextShort(ses,'subnet_entry_modify_diag_cap');
addSubnetSf.AddParam.Describe('cbfunc','ModifyEntry');
addSubnetSf.AddParam.Describe('selected',dbo.UID_String);
end else begin
isModify:=false;
if not (conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_SUBNET,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf.AddParam.Describe('dhcpId',service.UID_String);
diagCap:=FetchModuleTextShort(ses,'subnet_entry_create_diag_cap');
addSubnetSf.AddParam.Describe('cbfunc','AddSubnetEntry');
addSubnetSf.AddParam.Describe('selected',service.UID_String);
end;
dc := ses.FetchDerivedCollection(CFRE_DB_DHCP_SUBNET_CHOOSER_DC);
dc.Filters.RemoveFilter('domain');
dc.Filters.AddUIDFieldFilter('domain','domainid',service.DomainID,dbnf_OneValueFromFilter);
dc.Filters.RemoveFilter('scheme');
dc.filters.AddSchemeObjectFilter('scheme',[TFRE_DB_IPV4_SUBNET.ClassName]);
dc := ses.FetchDerivedCollection('DHCP_TEMPLATE_CHOOSER');
dc.Filters.RemoveFilter('service');
dc.Filters.AddUIDFieldFilter('service','dhcp_uid',[service.UID],dbnf_OneValueFromFilter);
GetSystemScheme(TFRE_DB_DHCP_SUBNET,scheme);
res:=TFRE_DB_FORM_DIALOG_DESC.create.Describe(diagCap,600);
group:=res.AddSchemeFormGroup(scheme.GetInputGroup('general'),ses);
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'subnet_block'));
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('subnet'),ses,[],'',true,true);
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4,service.DomainID) and conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4_SUBNET,service.DomainID) then begin
addSubnetSf.AddParam.Describe('field','subnet');
addSubnetSf.AddParam.Describe('ipversion','ipv4');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_subnet_diag_new_subnet_button'),addSubnetSf,true);
end;
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'range_block'));
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('range'),ses,[]);
_AddModifyHandleTemplates(conn,ses,dbo,res,dc.GetStoreDescription as TFRE_DB_STORE_DESC,true);
res.AddButton.Describe(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('button_save')),sf,fdbbt_submit);
if isModify then begin
res.FillWithObjectValues(dbo,ses);
end;
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD._AddModifyFixedEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION; const dbo:IFRE_DB_Object): IFRE_DB_Object;
var
scheme : IFRE_DB_SchemeObject;
res : TFRE_DB_FORM_DIALOG_DESC;
sf : TFRE_DB_SERVER_FUNC_DESC;
diagCap : TFRE_DB_String;
isModify : Boolean;
service : IFRE_DB_Object;
dc : IFRE_DB_DERIVED_COLLECTION;
addIPSf : TFRE_DB_SERVER_FUNC_DESC;
group : TFRE_DB_INPUT_GROUP_DESC;
block : TFRE_DB_INPUT_BLOCK_DESC;
begin
sf:=CWSF(@WEB_StoreFixedEntry);
addIPSf:=CWSF(@fSubnetIPMod.WEB_AddIP);
addIPSf.AddParam.Describe('cbclass',self.ClassName);
addIPSf.AddParam.Describe('cbuidpath',FREDB_CombineString(self.GetUIDPath,','));
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
if Assigned(dbo) then begin
isModify:=true;
if not (conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_FIXED,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,dbo.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,dbo.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf.AddParam.Describe('entryId',dbo.UID_String);
diagCap:=FetchModuleTextShort(ses,'fixed_entry_modify_diag_cap');
addIPSf.AddParam.Describe('cbfunc','ModifyEntry');
addIPSf.AddParam.Describe('selected',dbo.UID_String);
end else begin
isModify:=false;
if not (conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_FIXED,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf.AddParam.Describe('dhcpId',service.UID_String);
diagCap:=FetchModuleTextShort(ses,'fixed_entry_create_diag_cap');
addIPSf.AddParam.Describe('cbfunc','AddFixedEntry');
addIPSf.AddParam.Describe('selected',service.UID_String);
end;
dc := ses.FetchDerivedCollection(CFRE_DB_DHCP_IP_CHOOSER_DC);
dc.Filters.RemoveFilter('domain');
dc.Filters.AddUIDFieldFilter('domain','domainid',service.DomainID,dbnf_OneValueFromFilter);
dc.Filters.RemoveFilter('scheme');
dc.filters.AddSchemeObjectFilter('scheme',[TFRE_DB_IPV4.ClassName]);
dc := ses.FetchDerivedCollection('DHCP_TEMPLATE_CHOOSER');
dc.Filters.RemoveFilter('service');
dc.Filters.AddUIDFieldFilter('service','dhcp_uid',[service.UID],dbnf_OneValueFromFilter);
GetSystemScheme(TFRE_DB_DHCP_FIXED,scheme);
res:=TFRE_DB_FORM_DIALOG_DESC.create.Describe(diagCap,600);
group:=res.AddSchemeFormGroup(scheme.GetInputGroup('general'),ses);
block:=group.AddBlock.Describe(FetchModuleTextShort(ses,'ip_block'));
block.AddSchemeFormGroupInputs(scheme.GetInputGroup('ip'),ses,[],'',true,true);
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4,service.DomainID) and conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_IPV4_SUBNET,service.DomainID) then begin
addIPSf.AddParam.Describe('field','ip');
addIPSf.AddParam.Describe('ipversion','ipv4');
block.AddInputButton(3).Describe('',FetchModuleTextShort(ses,'dhcp_fixed_diag_new_ip_button'),addIPSf,true);
end;
_AddModifyHandleTemplates(conn,ses,dbo,res,dc.GetStoreDescription as TFRE_DB_STORE_DESC,false);
res.AddButton.Describe(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('button_save')),sf,fdbbt_submit);
if isModify then begin
res.FillWithObjectValues(dbo,ses);
end;
Result:=res;
end;
procedure TFRE_FIRMBOX_DHCP_MOD._StoreHandleTemplates(const conn: IFRE_DB_CONNECTION; const input: IFRE_DB_Object; const entryObj: IFRE_DB_Object; const isModify: Boolean);
var
i : Integer;
tPostFix : String;
coll : IFRE_DB_COLLECTION;
relObj : TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION;
relObjExists: Boolean;
relObjs : TFRE_DB_ObjLinkArray;
begin
coll:=conn.GetCollection(CFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION_COLLECTION);
relObjs:=entryObj.Field('template').AsObjectLinkArray;
if isModify then begin
entryObj.DeleteField('template');
CheckDbResult(conn.Update(entryObj.CloneToNewObject));
end;
for i := 0 to 3 do begin
tPostFix:=IntToStr(i);
if Length(relObjs)>i then begin
CheckDbResult(conn.FetchAs(relObjs[i],TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,relObj));
relObjExists:=true;
end else begin
relObjExists:=false;
end;
if input.FieldPathExistsAndNotMarkedClear('data.template_'+tPostFix+'.template') then begin
if not relObjExists then begin
relObj:=TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION.CreateForDB;
end;
relObj.Field('template').AsObjectLink:=FREDB_H2G(input.FieldPath('data.template_'+tPostFix+'.template').AsString);
if input.FieldPathExistsAndNotMarkedClear('data.template_'+tPostFix+'.class_value') then begin
relObj.Field('class_value').AsString:=input.FieldPath('data.template_'+tPostFix+'.class_value').AsString;
if input.FieldPathExistsAndNotMarkedClear('data.template_'+tPostFix+'.class_type') then begin
relObj.Field('class_type').AsString:=input.FieldPath('data.template_'+tPostFix+'.class_type').AsString;
end else begin
relObj.Field('class_type').AsString:='user-class';
end;
end else begin
if relObjExists then begin
relObj.Field('class_type').AsString:='user-class';
relObj.Field('class_value').AsString:='';
end;
end;
if relObjExists then begin
CheckDbResult(conn.Update(relObj));
end else begin
CheckDbResult(coll.Store(relObj));
end;
entryObj.Field('template').AddObjectLink(relObj.UID);
end else begin
if relObjExists then begin //NO LONGER USED => DELETE
CheckDbResult(conn.Delete(relObj.UID));
end;
end;
input.Field('data').AsObject.DeleteField('template_'+tPostFix);
end;
end;
procedure TFRE_FIRMBOX_DHCP_MOD._AddModifyHandleTemplates(const conn: IFRE_DB_CONNECTION; const ses: IFRE_DB_Usersession; const dbo: IFRE_DB_Object; const res: TFRE_DB_FORM_DESC; const store: TFRE_DB_STORE_DESC; const isSubnet: Boolean);
var
default : String;
defaultCV : String;
defaultCT : String;
i : Integer;
ch : TFRE_DB_INPUT_CHOOSER_DESC;
block : TFRE_DB_INPUT_BLOCK_DESC;
cstore : TFRE_DB_STORE_DESC;
relObj : TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION;
postFix : String;
begin
if isSubnet then begin
cstore:=TFRE_DB_STORE_DESC.create.Describe('id');
cstore.AddEntry.Describe(FetchModuleTextShort(ses,'template_type_user_class'),'user-class');
cstore.AddEntry.Describe(FetchModuleTextShort(ses,'template_type_client_id'),'client_id');
end;
for i := 0 to 3 do begin
if Assigned(dbo) and (dbo.Field('template').ValueCount>i) then begin
CheckDbResult(conn.FetchAs(dbo.Field('template').AsObjectLinkItem[i],TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,relObj));
default:=FREDB_G2H(relObj.Field('template').AsObjectLink);
defaultCV:=relObj.Field('class_value').AsString;
defaultCT:=relObj.Field('class_type').AsString;
end else begin
default:='';
defaultCV:='';
defaultCT:='';
end;
postFix:=IntToStr(i);
block:=res.AddBlock.Describe(FetchModuleTextShort(ses,'template_chooser_label'),'template_'+postFix);
ch:=block.AddChooser.Describe('','template_'+postFix+'.template',store,dh_chooser_combo,false,false,true,false,default);
if isSubnet then begin
block.AddChooser(5).Describe('','template_'+postFix+'.class_type',cstore,dh_chooser_combo,true,false,false,false,defaultCT);
block.AddInput(5).Describe('','template_'+postFix+'.class_value',false,false,false,false,defaultCV);
end else begin
block.AddInput(5).Describe(FetchModuleTextShort(ses,'template_user_class_label'),'template_'+postFix+'.class_value',false,false,false,false,defaultCV);
end;
if i<3 then begin
ch.addDependentInput('template_'+IntToStr(i+1),'',fdv_hidden);
end;
end;
end;
procedure TFRE_FIRMBOX_DHCP_MOD.SetupAppModuleStructure;
begin
inherited SetupAppModuleStructure;
InitModuleDesc('dhcp_description');
fSubnetIPMod:=TFRE_FIRMBOX_SUBNET_IP_MOD.create;
AddApplicationModule(fSubnetIPMod);
fServiceIFMod:=TFRE_FIRMBOX_DHCP_SERVICE_IF_MOD.create;
AddApplicationModule(fServiceIFMod);
end;
class procedure TFRE_FIRMBOX_DHCP_MOD.InstallDBObjects(const conn: IFRE_DB_SYS_CONNECTION; var currentVersionId: TFRE_DB_NameType; var newVersionId: TFRE_DB_NameType);
begin
newVersionId:='1.0';
if currentVersionId='' then begin
currentVersionId := '1.0';
CreateModuleText(conn,'dhcp_description','DHCP','DHCP','DHCP');
CreateModuleText(conn,'general_tab','General');
CreateModuleText(conn,'hosts_tab','Ranges/Hosts');
CreateModuleText(conn,'templates_tab','Templates');
CreateModuleText(conn,'error_delete_single_select','Exactly one object has to be selected for deletion.');
CreateModuleText(conn,'dhcp_details_select_one','Please select a dhcp service to get detailed information');
CreateModuleText(conn,'service_grid_objname','Name');
CreateModuleText(conn,'service_grid_status','Status');
CreateModuleText(conn,'service_grid_zone','Zone');
CreateModuleText(conn,'tb_create_dhcp','Add');
CreateModuleText(conn,'tb_delete_dhcp','Delete');
CreateModuleText(conn,'cm_delete_dhcp','Delete');
CreateModuleText(conn,'tb_apply_config','Apply Configuration');
CreateModuleText(conn,'tb_enable_dhcp','Enable');
CreateModuleText(conn,'tb_disable_dhcp','Disable');
CreateModuleText(conn,'cm_apply_config','Apply Configuration');
CreateModuleText(conn,'cm_enable_dhcp','Enable');
CreateModuleText(conn,'cm_disable_dhcp','Disable');
CreateModuleText(conn,'templates_grid_objname','Name');
CreateModuleText(conn,'tb_create_template','Add');
CreateModuleText(conn,'tb_modify_template','Modify');
CreateModuleText(conn,'tb_delete_template','Delete');
CreateModuleText(conn,'cm_modify_template','Modify');
CreateModuleText(conn,'cm_delete_template','Delete');
CreateModuleText(conn,'template_create_diag_cap','Add DHCP Template');
CreateModuleText(conn,'template_modify_diag_cap','Modify DHCP Template');
CreateModuleText(conn,'template_delete_diag_cap','Delete DHCP Template');
CreateModuleText(conn,'template_delete_diag_msg','Delete DHCP Template %template_str%?');
CreateModuleText(conn,'template_delete_error_used_diag_cap','Delete DHCP Template');
CreateModuleText(conn,'template_delete_error_used_diag_msg','DHCP Template cannot be deleted because it is used by at least on DHCP entry.');
CreateModuleText(conn,'entries_grid_objname','Name');
CreateModuleText(conn,'entries_grid_details','Details');
CreateModuleText(conn,'entries_grid_details_fixed','Mac: %mac_str% IP: %ip_str%');
CreateModuleText(conn,'entries_grid_details_subnet','Subnet: %subnet_str% Range: %range_start_str% - %range_end_str%');
CreateModuleText(conn,'entries_grid_descr_template_entry','Template %template_str%');
CreateModuleText(conn,'entries_grid_descr_template_class_entry','Template %template_str% (%class_type%: %class_value%)');
CreateModuleText(conn,'entries_grid_descr_template_delimiter',' - ');
CreateModuleText(conn,'tb_create_subnet_entry','Add Subnet');
CreateModuleText(conn,'tb_create_fixed_entry','Add Fixed');
CreateModuleText(conn,'tb_modify_entry','Modify');
CreateModuleText(conn,'tb_delete_entry','Delete');
CreateModuleText(conn,'cm_modify_entry','Modify');
CreateModuleText(conn,'cm_delete_entry','Delete');
CreateModuleText(conn,'subnet_entry_create_diag_cap','Add Subnet');
CreateModuleText(conn,'fixed_entry_create_diag_cap','Add Fixed IP');
CreateModuleText(conn,'subnet_entry_modify_diag_cap','Modify Subnet');
CreateModuleText(conn,'fixed_entry_modify_diag_cap','Modify Fixed IP');
CreateModuleText(conn,'subnet_entry_delete_diag_cap','Delete Subnet');
CreateModuleText(conn,'fixed_entry_delete_diag_cap','Delete Fixed IP');
CreateModuleText(conn,'subnet_entry_delete_diag_msg','Delete Subnet %entry_str%?');
CreateModuleText(conn,'fixed_entry_delete_diag_msg','Delete Fixed IP %entry_str%?');
CreateModuleText(conn,'template_chooser_label','Template');
CreateModuleText(conn,'template_user_class_label','UserClass');
CreateModuleText(conn,'template_type_user_class','UserClass');
CreateModuleText(conn,'template_type_client_id','ClientID');
CreateModuleText(conn,'dhcp_fixed_diag_new_ip_button','New IP');
CreateModuleText(conn,'ip_block','IP');
CreateModuleText(conn,'dhcp_subnet_diag_new_subnet_button','New Subnet');
CreateModuleText(conn,'subnet_block','Subnet');
CreateModuleText(conn,'range_block','Range');
CreateModuleText(conn,'dhcp_template_diag_new_ip_button','New IP');
CreateModuleText(conn,'router_block','Router');
CreateModuleText(conn,'dns_block','Name Server');
CreateModuleText(conn,'ntp_block','NTP Server');
CreateModuleText(conn,'dhcp_template_diag_advanced_group','Advanced');
CreateModuleText(conn,'dhcp_template_diag_add_standard_option','Add Standard Option');
CreateModuleText(conn,'dhcp_template_diag_add_custom_option','Add Custom Option');
CreateModuleText(conn,'dhcp_template_diag_standard_option_label','Standard Option %name_str%');
CreateModuleText(conn,'dhcp_template_diag_custom_option_label','Custom Option');
CreateModuleText(conn,'dhcp_template_diag_delete_option','Delete');
CreateModuleText(conn,'dhcp_template_add_standard_option_diag_cap','Add Standard Option');
CreateModuleText(conn,'dhcp_template_add_standard_option_name','Name');
CreateModuleText(conn,'dhcp_template_add_standard_option_value','Value');
CreateModuleText(conn,'dhcp_template_add_custom_option_diag_cap','Add Custom Option');
CreateModuleText(conn,'dhcp_template_add_custom_option_declaration','Declaration');
CreateModuleText(conn,'dhcp_template_add_custom_option_usage','Usage');
end;
end;
procedure TFRE_FIRMBOX_DHCP_MOD.MySessionInitializeModule(const session: TFRE_DB_UserSession);
var
app : TFRE_DB_APPLICATION;
conn : IFRE_DB_CONNECTION;
transform : IFRE_DB_SIMPLE_TRANSFORM;
dc : IFRE_DB_DERIVED_COLLECTION;
servicesGrid : IFRE_DB_DERIVED_COLLECTION;
procedure _setEntryDetails(const input,transformed_object : IFRE_DB_Object;const langres: TFRE_DB_StringArray);
var
str : String;
i : Integer;
delimiter: String;
begin
if (transformed_object.Field('subnet_ip').AsString<>'') then begin
str:=StringReplace(langres[1],'%subnet_str%',transformed_object.Field('subnet_ip').AsString + '/' + transformed_object.Field('subnet_bits').AsString,[rfReplaceAll]);
str:=StringReplace(str,'%range_start_str%',input.Field('range_start').AsString,[rfReplaceAll]);
str:=StringReplace(str,'%range_end_str%',input.Field('range_end').AsString,[rfReplaceAll]);
end else begin
str:=StringReplace(langres[0],'%mac_str%',input.Field('mac').AsString,[rfReplaceAll]);
str:=StringReplace(str,'%ip_str%',transformed_object.Field('fixed_ip').AsString,[rfReplaceAll]);
end;
transformed_object.Field('details').AsString:=str;
delimiter:='';
for i := 0 to transformed_object.Field('template').ValueCount - 1 do begin
//if (transformed_object.Field('template_ct').ValueCount>i) and (transformed_object.Field('template_cv').ValueCount>i) and (transformed_object.Field('template_cv').AsStringItem[i]<>'') then begin
// str:=StringReplace(langres[3],'%template_str%',transformed_object.Field('template').AsStringItem[i],[rfReplaceAll]);
// str:=StringReplace(str,'%class_type%',transformed_object.Field('template_ct').AsStringItem[i],[rfReplaceAll]);
// str:=StringReplace(str,'%class_value%',transformed_object.Field('template_cv').AsStringItem[i],[rfReplaceAll]);
//end else begin
str:=StringReplace(langres[2],'%template_str%',transformed_object.Field('template').AsStringItem[i],[rfReplaceAll]);
//end;
transformed_object.Field('descr').AsString:=transformed_object.Field('descr').AsString + delimiter + str;
delimiter:=langres[4];
end;
end;
begin
inherited MySessionInitializeModule(session);
if session.IsInteractiveSession then begin
app := GetEmbeddingApp;
conn := session.GetDBConnection;
fre_hal_schemes.InitDerivedCollections(session,conn);
GFRE_DBI.NewObjectIntf(IFRE_DB_SIMPLE_TRANSFORM,transform);
with transform do begin
AddOneToOnescheme('objname','',FetchModuleTextShort(session,'entries_grid_objname'));
AddMatchingReferencedFieldArray(['DHCP_ID>TFRE_DB_DHCP'],'uid','dhcp_uid','',false);
end;
dc := session.NewDerivedCollection('DHCP_TEMPLATE_CHOOSER');
with dc do begin
SetDeriveParent(conn.GetCollection(CFRE_DB_DHCP_TEMPLATE_COLLECTION));
SetDeriveTransformation(transform);
SetDisplayType(cdt_Chooser,[],'');
SetDefaultOrderField('objname',true);
end;
GFRE_DBI.NewObjectIntf(IFRE_DB_SIMPLE_TRANSFORM,transform);
with transform do begin
AddOneToOnescheme('objname','',FetchModuleTextShort(session,'service_grid_objname'),dt_string,true,false,false,true,4);
AddMatchingReferencedFieldArray(['SERVICEPARENT>TFRE_DB_ZONE'],'objname','zone',FetchModuleTextShort(session,'service_grid_zone'),true,dt_string,false,false,4);
AddOneToOnescheme('status_icons','',FetchModuleTextShort(session,'service_grid_status'),dt_icon,true,false,false,true,1,'','','',nil,'status_icon_tooltips');
AddMatchingReferencedField(['<SERVICEDOMAIN'],'objname','serviceObj','',true,dt_description,false,false,1,'','',nil,'',false,'domainid');
AddMatchingReferencedObjPlugin(['SERVICEPARENT>'],TFRE_DB_ZONESTATUS_PLUGIN,'zplugin');
SetSimpleFuncTransformNested(@G_setServiceStatusAndConfigFields,TFRE_DB_SERVICE_STATUS_PLUGIN.getStatusLangres(conn));
end;
servicesGrid := session.NewDerivedCollection('DHCP_SERVICES_GRID');
with servicesGrid do begin
SetDeriveParent(conn.GetCollection(CFOS_DB_SERVICES_COLLECTION));
SetDeriveTransformation(transform);
SetDisplayType(cdt_Listview,[cdgf_ShowSearchbox],'',CWSF(@WEB_ServiceMenu),nil,CWSF(@WEB_ServiceSC));
SetDefaultOrderField('objname',true);
Filters.AddSchemeObjectFilter('service',[TFRE_DB_DHCP.ClassName]);
end;
GFRE_DBI.NewObjectIntf(IFRE_DB_SIMPLE_TRANSFORM,transform);
with transform do begin
AddOneToOnescheme('objname','',FetchModuleTextShort(session,'templates_grid_objname'));
AddMatchingReferencedFieldArray(['DHCP_ID>TFRE_DB_DHCP'],'uid','dhcp_uid','',false);
end;
dc := session.NewDerivedCollection('DHCP_TEMPLATES_GRID');
with dc do begin
SetDeriveParent(conn.GetCollection(CFRE_DB_DHCP_TEMPLATE_COLLECTION));
SetDeriveTransformation(transform);
SetDisplayType(cdt_Listview,[],'',CWSF(@WEB_TemplateMenu),nil,CWSF(@WEB_TemplateSC));
SetUseDependencyAsUidFilter('dhcp_uid');
servicesGrid.AddSelectionDependencyEvent(CollectionName);
SetDefaultOrderField('objname',true);
end;
GFRE_DBI.NewObjectIntf(IFRE_DB_SIMPLE_TRANSFORM,transform);
with transform do begin
AddOneToOnescheme('objname','',FetchModuleTextShort(session,'entries_grid_objname'));
AddOneToOnescheme('details','',FetchModuleTextShort(session,'entries_grid_details'),dt_string);
AddOneToOnescheme('descr','','',dt_description);
AddMatchingReferencedField(['SUBNET>','BASE_IP>'],'ip','subnet_ip','',false);
AddMatchingReferencedField(['SUBNET>'],'subnet_bits','subnet_bits','',false);
AddMatchingReferencedField(['IP>'],'ip','fixed_ip','',false);
//AddMatchingReferencedFieldArray(['TEMPLATE>TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION'],'class_type','template_ct','',false); //FIXXME
//AddMatchingReferencedFieldArray(['TEMPLATE>TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION'],'class_value','template_cv','',false);
AddMatchingReferencedFieldArray(['TEMPLATE>TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION','TEMPLATE>TFRE_DB_DHCP_TEMPLATE'],'objname','template','',false);
AddMatchingReferencedFieldArray(['DHCP_ID>TFRE_DB_DHCP'],'uid','dhcp_uid','',false);
SetSimpleFuncTransformNested(@_setEntryDetails,[FetchModuleTextShort(session,'entries_grid_details_fixed'),FetchModuleTextShort(session,'entries_grid_details_subnet'),
FetchModuleTextShort(session,'entries_grid_descr_template_entry'),FetchModuleTextShort(session,'entries_grid_descr_template_class_entry'),FetchModuleTextShort(session,'entries_grid_descr_template_delimiter')]);
end;
dc := session.NewDerivedCollection('DHCP_ENTRIES_GRID');
with dc do begin
SetDeriveParent(conn.GetCollection(CFRE_DB_DHCP_ENTRY_COLLECTION));
SetDeriveTransformation(transform);
SetDisplayType(cdt_Listview,[],'',CWSF(@WEB_EntryMenu),nil,CWSF(@WEB_EntrySC));
SetUseDependencyAsUidFilter('dhcp_uid');
servicesGrid.AddSelectionDependencyEvent(CollectionName);
SetDefaultOrderField('objname',true);
end;
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_Content(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
subs : TFRE_DB_SUBSECTIONS_DESC;
dc : IFRE_DB_DERIVED_COLLECTION;
servicesDC : IFRE_DB_DERIVED_COLLECTION;
layout : TFRE_DB_LAYOUT_DESC;
servicesGrid: TFRE_DB_VIEW_LIST_DESC;
service : IFRE_DB_Object;
tg : IFRE_DB_DERIVED_COLLECTION;
begin
CheckClassVisibility4AnyDomain(ses);
tg:=ses.FetchDerivedCollection('DHCP_TEMPLATES_GRID');
tg.Filters.RemoveFilter('service');
ses.GetSessionModuleData(ClassName).DeleteField('selectedDHCP');
subs:=TFRE_DB_SUBSECTIONS_DESC.Create.Describe();
subs.AddSection.Describe(CWSF(@WEB_ContentGeneral),FetchModuleTextShort(ses,'general_tab'),1);
subs.AddSection.Describe(CWSF(@WEB_ContentEntries),FetchModuleTextShort(ses,'hosts_tab'),2);
subs.AddSection.Describe(CWSF(@WEB_ContentTemplates),FetchModuleTextShort(ses,'templates_tab'),3);
servicesDC:=ses.FetchDerivedCollection('DHCP_SERVICES_GRID');
if (Length(conn.sys.GetDomainsForClassRight(sr_FETCH,TFRE_DB_DHCP))>1) or //multidomain
fServiceIFMod.canAddService(conn) or //can add service
fServiceIFMod.canDeleteService(conn) or //can delete service
(servicesDC.ItemCount>1) then begin //has more than one service
layout:=TFRE_DB_LAYOUT_DESC.create.Describe();
servicesGrid:=servicesDC.GetDisplayDescription as TFRE_DB_VIEW_LIST_DESC;
if fServiceIFMod.canAddService(conn) then begin
servicesGrid.AddButton.Describe(CWSF(@WEB_AddDHCP),'',FetchModuleTextShort(ses,'tb_create_dhcp'));
end;
if fServiceIFMod.canDeleteService(conn) then begin
servicesGrid.AddButton.DescribeManualType('delete_dhcp',CWSF(@WEB_DeleteDHCP),'',FetchModuleTextShort(ses,'tb_delete_dhcp'),'',true);
end;
layout.SetLayout(servicesGrid,subs);
Result:=layout;
end else begin
if servicesDC.ItemCount=1 then begin //set service filters
service:=servicesDC.First;
ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID:=service.UID;
tg.Filters.AddUIDFieldFilter('service','dhcp_uid',[service.UID],dbnf_OneValueFromFilter);
end else begin
tg.Filters.AddUIDFieldFilter('service','dhcp_uid',[CFRE_DB_NullGUID],dbnf_OneValueFromFilter);
end;
Result:=subs;
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ContentGeneral(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
menu : TFRE_DB_MENU_DESC;
addMenu : Boolean;
begin
CheckClassVisibility4AnyDomain(ses);
if ses.GetSessionModuleData(ClassName).FieldExists('selectedDHCP') then begin
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
Result:=fServiceIFMod.modifyService(input,ses,app,conn,service,'DHCP_GENERAL');
menu:=TFRE_DB_MENU_DESC.create.Describe;
addMenu:=false;
if fServiceIFMod.canApplyService(conn) then begin //right in any domain => add button
addMenu:=true;
menu.AddEntry.Describe(FetchModuleTextShort(ses,'tb_apply_config'),'',CWSF(@WEB_ApplyConfig),not fServiceIFMod.canApplyService(conn,service),'apply_config');
end;
if fServiceIFMod.canEnableService(conn) then begin //right in any domain => add button
addMenu:=true;
menu.AddEntry.Describe(FetchModuleTextShort(ses,'tb_enable_dhcp'),'',CWSF(@WEB_EnableDHCP),not fServiceIFMod.canEnableService(conn,service),'enable_service');
end;
if fServiceIFMod.canDisableService(conn) then begin //right in any domain => add button
addMenu:=true;
menu.AddEntry.Describe(FetchModuleTextShort(ses,'tb_disable_dhcp'),'',CWSF(@WEB_DisableDHCP),not fServiceIFMod.canDisableService(conn,service),'disable_service');
end;
if addMenu then begin
(Result.Implementor_HC as TFRE_DB_FORM_PANEL_DESC).SetMenu(menu);
end;
end else begin
Result:=TFRE_DB_HTML_DESC.create.Describe(FetchModuleTextShort(ses,'dhcp_details_select_one'));
(Result.Implementor_HC as TFRE_DB_CONTENT_DESC).contentId:='DHCP_GENERAL';
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ContentTemplates(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
res : TFRE_DB_VIEW_LIST_DESC;
addDisabled : Boolean;
service : IFRE_DB_Object;
applyDisabled : Boolean;
begin
CheckClassVisibility4AnyDomain(ses);
if ses.GetSessionModuleData(ClassName).FieldExists('selectedDHCP') then begin
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
end else begin
service:=nil;
end;
res:=ses.FetchDerivedCollection('DHCP_TEMPLATES_GRID').GetDisplayDescription as TFRE_DB_VIEW_LIST_DESC;
if fServiceIFMod.canApplyService(conn) then begin
if Assigned(service) then begin
applyDisabled:=not fServiceIFMod.canApplyService(conn,service);
end else begin
applyDisabled:=true;
end;
res.AddButton.DescribeManualType('apply_config',CWSF(@WEB_ApplyConfig),'',FetchModuleTextShort(ses,'tb_apply_config'),FetchModuleTextHint(ses,'tb_apply_config'),applyDisabled);
end;
if conn.sys.CheckClassRight4AnyDomain(sr_STORE,TFRE_DB_DHCP_TEMPLATE) and conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP) then begin
if Assigned(service) then begin
addDisabled:=not (conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_TEMPLATE,service.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID));
end else begin
addDisabled:=true;
end;
res.AddButton.DescribeManualType('add_template',CWSF(@WEB_AddTemplate),'',FetchModuleTextShort(ses,'tb_create_template'),FetchModuleTextHint(ses,'tb_create_template'),addDisabled);
end;
if conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP_TEMPLATE) and conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP) then begin
res.AddButton.DescribeManualType('modify_template',CWSF(@WEB_ModifyTemplate),'',FetchModuleTextShort(ses,'tb_modify_template'),FetchModuleTextHint(ses,'tb_modify_template'),true);
end;
if conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_TEMPLATE) and conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP) then begin
res.AddButton.DescribeManualType('delete_template',CWSF(@WEB_DeleteTemplate),'',FetchModuleTextShort(ses,'tb_delete_template'),FetchModuleTextHint(ses,'tb_delete_template'),true);
end;
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ContentEntries(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
res : TFRE_DB_VIEW_LIST_DESC;
addSubnetDisabled: Boolean;
addFixedDisabled : Boolean;
service : IFRE_DB_Object;
applyDisabled : Boolean;
begin
CheckClassVisibility4AnyDomain(ses);
if ses.GetSessionModuleData(ClassName).FieldExists('selectedDHCP') then begin
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
end else begin
service:=nil;
end;
res:=ses.FetchDerivedCollection('DHCP_ENTRIES_GRID').GetDisplayDescription as TFRE_DB_VIEW_LIST_DESC;
if fServiceIFMod.canApplyService(conn) then begin
if Assigned(service) then begin
applyDisabled:=not fServiceIFMod.canApplyService(conn,service);
end else begin
applyDisabled:=true;
end;
res.AddButton.DescribeManualType('apply_config',CWSF(@WEB_ApplyConfig),'',FetchModuleTextShort(ses,'tb_apply_config'),FetchModuleTextHint(ses,'tb_apply_config'),applyDisabled);
end;
if conn.sys.CheckClassRight4AnyDomain(sr_STORE,TFRE_DB_DHCP_SUBNET) and conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP) then begin
if Assigned(service) then begin
addSubnetDisabled:=not (conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_SUBNET,service.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID));
end else begin
addSubnetDisabled:=true;
end;
res.AddButton.DescribeManualType('add_subnet_entry',CWSF(@WEB_AddSubnetEntry),'',FetchModuleTextShort(ses,'tb_create_subnet_entry'),FetchModuleTextHint(ses,'tb_create_subnet_entry'),addSubnetDisabled);
end;
if conn.sys.CheckClassRight4AnyDomain(sr_STORE,TFRE_DB_DHCP_FIXED) and conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP) then begin
if ses.GetSessionModuleData(ClassName).FieldExists('selectedDHCP') then begin
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
addFixedDisabled:=not (conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_FIXED,service.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID));
end else begin
addFixedDisabled:=true;
end;
res.AddButton.DescribeManualType('add_fixed_entry',CWSF(@WEB_AddFixedEntry),'',FetchModuleTextShort(ses,'tb_create_fixed_entry'),FetchModuleTextHint(ses,'tb_create_fixed_entry'),addFixedDisabled);
end;
if (conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP_SUBNET) or conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP_FIXED)) and conn.sys.CheckClassRight4AnyDomain(sr_UPDATE,TFRE_DB_DHCP) then begin
res.AddButton.DescribeManualType('modify_entry',CWSF(@WEB_ModifyEntry),'',FetchModuleTextShort(ses,'tb_modify_entry'),FetchModuleTextHint(ses,'tb_modify_entry'),true);
end;
if (conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_SUBNET) or conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_FIXED) and conn.sys.CheckClassRight4AnyDomain(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID)) then begin
res.AddButton.DescribeManualType('delete_entry',CWSF(@WEB_DeleteEntry),'',FetchModuleTextShort(ses,'tb_delete_entry'),FetchModuleTextHint(ses,'tb_delete_entry'),true);
end;
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_AddDHCP(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
Result:=fServiceIFMod.addService(input,ses,app,conn);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_DeleteDHCP(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
serviceId : TFRE_DB_GUID;
begin
if input.FieldExists('selected') then begin
serviceId:=FREDB_H2G(input.Field('selected').AsString);
end else begin
serviceId:=ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID;
end;
CheckDbResult(conn.Fetch(serviceId,service));
Result:=fServiceIFMod.deleteService(input,ses,app,conn,service);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ServiceSC(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
addTemplateDisabled: Boolean;
addSubnetDisabled : Boolean;
addFixedDisabled : Boolean;
service : IFRE_DB_Object;
zone : TFRE_DB_ZONE;
deleteDisabled : Boolean;
applyDisabled : Boolean;
begin
addTemplateDisabled:=true;
addSubnetDisabled:=true;
addFixedDisabled:=true;
deleteDisabled:=true;
applyDisabled:=true;
if ses.GetSessionModuleData(ClassName).FieldExists('selectedDHCP') then begin
ses.UnregisterDBOChangeCB('dhcpMod');
end;
if input.FieldExists('selected') and (input.Field('selected').ValueCount=1) then begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),service));
ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID:=service.UID;
ses.RegisterDBOChangeCB(service.UID,CWSF(@WEB_ServiceObjChanged),'dhcpMod');
CheckDbResult(conn.FetchAs(service.Field('serviceParent').AsObjectLink,TFRE_DB_ZONE,zone));
ses.RegisterDBOChangeCB(zone.UID,CWSF(@WEB_ServiceObjChanged),'dhcpMod');
if conn.SYS.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID) then begin
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_TEMPLATE,service.DomainID) then begin
addTemplateDisabled:=false;
end;
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_SUBNET,service.DomainID) then begin
addSubnetDisabled:=false;
end;
if conn.SYS.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_FIXED,service.DomainID) then begin
addFixedDisabled:=false;
end;
end;
deleteDisabled:=not fServiceIFMod.canDeleteService(conn,service);
applyDisabled:=not fServiceIFMod.canApplyService(conn,service);
end else begin
ses.GetSessionModuleData(ClassName).DeleteField('selectedDHCP');
end;
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.create.DescribeStatus('delete_dhcp',deleteDisabled));
if not ses.isUpdatableContentVisible('DHCP_GENERAL') then begin
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.Create.DescribeStatus('add_template',addTemplateDisabled));
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.Create.DescribeStatus('add_subnet_entry',addSubnetDisabled));
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.Create.DescribeStatus('add_fixed_entry',addFixedDisabled));
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.Create.DescribeStatus('apply_config',applyDisabled));
end;
if ses.isUpdatableContentVisible('DHCP_GENERAL') then begin
Result:=WEB_ContentGeneral(input,ses,app,conn);
end else begin
Result:=GFRE_DB_NIL_DESC;
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ServiceMenu(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service: IFRE_DB_Object;
res : TFRE_DB_MENU_DESC;
func : TFRE_DB_SERVER_FUNC_DESC;
begin
res:=TFRE_DB_MENU_DESC.create.Describe;
if input.Field('selected').ValueCount=1 then begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),service));
if fServiceIFMod.canApplyService(conn) then begin
func:=CWSF(@WEB_ApplyConfig);
func.AddParam.Describe('selected',input.Field('selected').AsString);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_apply_config'),'',func,not fServiceIFMod.canApplyService(conn,service));
end;
if fServiceIFMod.canEnableService(conn) then begin
func:=CWSF(@WEB_EnableDHCP);
func.AddParam.Describe('selected',input.Field('selected').AsString);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_enable_dhcp'),'',func,not fServiceIFMod.canEnableService(conn,service));
end;
if fServiceIFMod.canDisableService(conn) then begin
func:=CWSF(@WEB_DisableDHCP);
func.AddParam.Describe('selected',input.Field('selected').AsString);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_disable_dhcp'),'',func,not fServiceIFMod.canDisableService(conn,service));
end;
if fServiceIFMod.canDeleteService(conn) then begin
func:=CWSF(@WEB_DeleteDHCP);
func.AddParam.Describe('selected',input.Field('selected').AsString);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_delete_dhcp'),'',func,not fServiceIFMod.canDeleteService(conn,service));
end;
end;
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ServiceObjChanged(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
begin
Result:=GFRE_DB_NIL_DESC;
if input.Field('type').AsString='UPD' then begin
if ses.GetSessionModuleData(ClassName).FieldExists('selectedDHCP') then begin
if not ses.isUpdatableContentVisible('DHCP_GENERAL') then begin
CheckDbResult(conn.Fetch(ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID,service));
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.create.DescribeStatus('apply_config',not fServiceIFMod.canApplyService(conn,service)));
end;
end;
if ses.isUpdatableContentVisible('DHCP_GENERAL') then begin
Result:=WEB_ContentGeneral(input,ses,app,conn);
end;
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ApplyConfig(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
serviceId : TFRE_DB_GUID;
begin
if input.FieldExists('selected') then begin
serviceId:=FREDB_H2G(input.Field('selected').AsString);
end else begin
serviceId:=ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID;
end;
CheckDbResult(conn.Fetch(serviceId,service));
Result:=fServiceIFMod.applyConfig(input,ses,app,conn,service);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_EnableDHCP(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
serviceId : TFRE_DB_GUID;
begin
if input.FieldExists('selected') then begin
serviceId:=FREDB_H2G(input.Field('selected').AsString);
end else begin
serviceId:=ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID;
end;
CheckDbResult(conn.Fetch(serviceId,service));
Result:=fServiceIFMod.enableService(input,ses,app,conn,service);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_DisableDHCP(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
service : IFRE_DB_Object;
serviceId : TFRE_DB_GUID;
begin
if input.FieldExists('selected') then begin
serviceId:=FREDB_H2G(input.Field('selected').AsString);
end else begin
serviceId:=ses.GetSessionModuleData(ClassName).Field('selectedDHCP').AsGUID;
end;
CheckDbResult(conn.Fetch(serviceId,service));
Result:=fServiceIFMod.disableService(input,ses,app,conn,service);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_AddTemplate(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
WEB_CleanupTemplateDiag(input,ses,app,conn);
input.Field('advancedCollapsed').AsBoolean:=true;
Result:=_AddModifyTemplate(input,ses,app,conn,false);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ModifyTemplate(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
WEB_CleanupTemplateDiag(input,ses,app,conn);
input.Field('advancedCollapsed').AsBoolean:=true;
Result:=_AddModifyTemplate(input,ses,app,conn,true);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_StoreTemplate(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
scheme : IFRE_DB_SchemeObject;
templateObj : TFRE_DB_DHCP_TEMPLATE;
isNew : Boolean;
service : IFRE_DB_Object;
i: Integer;
begin
GetSystemScheme(TFRE_DB_DHCP_TEMPLATE,scheme);
if input.FieldExists('templateId') then begin
CheckDbResult(conn.FetchAs(FREDB_H2G(input.Field('templateId').AsString),TFRE_DB_DHCP_TEMPLATE,templateObj));
if not (conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_TEMPLATE,templateObj.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,templateObj.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
CheckDbResult(conn.Fetch(templateObj.Field('dhcp_id').AsObjectLink,service));
isNew:=false;
end else begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('dhcpId').AsString),service));
if not (conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_TEMPLATE,service.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
templateObj:=TFRE_DB_DHCP_TEMPLATE.CreateForDB;
templateObj.SetDomainID(service.DomainID);
templateObj.Field('dhcp_id').AsObjectLink:=service.UID;
isNew:=true;
end;
if input.FieldPathExistsAndNotMarkedClear('data.dns2.domain-name-servers') then begin
input.FieldPathCreate('data.domain-name-servers').AddString(input.FieldPath('data.dns2.domain-name-servers').AsString);
end;
input.Field('data').AsObject.DeleteField('dns2');
scheme.SetObjectFieldsWithScheme(input.Field('data').AsObject,templateObj,isNew,conn);
templateObj.DeleteField('standard_options');
templateObj.DeleteField('custom_options');
if ses.GetSessionModuleData(ClassName).FieldExists('templateDiagData') then begin
for i := 0 to ses.GetSessionModuleData(ClassName).Field('templateDiagData').AsObject.Field('standard').ValueCount-1 do begin
templateObj.Field('standard_options').AddObject(ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.standard').AsObjectItem[i].CloneToNewObject());
end;
for i := 0 to ses.GetSessionModuleData(ClassName).Field('templateDiagData').AsObject.Field('custom').ValueCount-1 do begin
templateObj.Field('custom_options').AddObject(ses.GetSessionModuleData(ClassName).FieldPath('templateDiagData.custom').AsObjectItem[i].CloneToNewObject());
end;
end;
G_setServiceConfigChanged(conn,ses,service);
if isNew then begin
CheckDbResult(conn.GetCollection(CFRE_DB_DHCP_TEMPLATE_COLLECTION).Store(templateObj));
end else begin
CheckDbResult(conn.Update(templateObj));
end;
Result:=TFRE_DB_CLOSE_DIALOG_DESC.Create.Describe();
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_DeleteTemplate(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
sf : TFRE_DB_SERVER_FUNC_DESC;
cap,msg : String;
template : IFRE_DB_Object;
begin
if input.Field('selected').ValueCount<>1 then raise EFRE_DB_Exception.Create(FetchModuleTextShort(ses,'error_delete_single_select'));
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsStringArr[0]),template));
if not (conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_TEMPLATE,template.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,template.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
if conn.GetReferencesCount(template.UID,false,'','')>0 then begin
Result:=TFRE_DB_MESSAGE_DESC.create.Describe(FetchModuleTextShort(ses,'template_delete_error_used_diag_cap'),FetchModuleTextShort(ses,'template_delete_error_used_diag_msg'),fdbmt_error);
exit;
end;
sf:=CWSF(@WEB_DeleteTemplateConfirmed);
sf.AddParam.Describe('selected',input.Field('selected').AsStringArr);
cap:=FetchModuleTextShort(ses,'template_delete_diag_cap');
msg:=StringReplace(FetchModuleTextShort(ses,'template_delete_diag_msg'),'%template_str%',template.Field('objname').AsString,[rfReplaceAll]);
Result:=TFRE_DB_MESSAGE_DESC.create.Describe(cap,msg,fdbmt_confirm,sf);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_DeleteTemplateConfirmed(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
i : NativeInt;
template : IFRE_DB_Object;
service: IFRE_DB_Object;
begin
if input.field('confirmed').AsBoolean then begin
for i:= 0 to input.Field('selected').ValueCount-1 do begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsStringArr[i]),template));
if not (conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_TEMPLATE,template.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,template.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
CheckDbResult(conn.Fetch(template.Field('dhcp_id').AsObjectLink,service));
G_setServiceConfigChanged(conn,ses,service);
CheckDbResult(conn.Delete(template.UID));
end;
result := GFRE_DB_NIL_DESC;
end else begin
result := GFRE_DB_NIL_DESC;
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_TemplateSC(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
modify_disabled : Boolean;
del_disabled : Boolean;
template : IFRE_DB_Object;
begin
CheckClassVisibility4AnyDomain(ses);
modify_disabled:=true;
del_disabled:=true;
if input.FieldExists('selected') and (input.Field('selected').ValueCount=1) then begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),template));
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,template.DomainID) then begin
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_TEMPLATE,template.DomainID) then begin
modify_disabled:=false;
end;
if conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_TEMPLATE,template.DomainID) then begin
del_disabled:=false;
end;
end;
end;
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.create.DescribeStatus('modify_template',modify_disabled));
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.create.DescribeStatus('delete_template',del_disabled));
Result:=GFRE_DB_NIL_DESC;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_TemplateMenu(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
res : TFRE_DB_MENU_DESC;
func : TFRE_DB_SERVER_FUNC_DESC;
template : IFRE_DB_Object;
begin
res:=TFRE_DB_MENU_DESC.create.Describe;
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),template));
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,template.DomainID) then begin
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_TEMPLATE,template.DomainID) then begin
func:=CWSF(@WEB_ModifyTemplate);
func.AddParam.Describe('selected',input.Field('selected').AsStringArr);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_modify_template'),'',func);
end;
if conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_TEMPLATE,template.DomainID) then begin
func:=CWSF(@WEB_DeleteTemplate);
func.AddParam.Describe('selected',input.Field('selected').AsStringArr);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_delete_template'),'',func);
end;
end;
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_AddStandardOption(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
res: TFRE_DB_FORM_DIALOG_DESC;
sf : TFRE_DB_SERVER_FUNC_DESC;
begin
CheckClassVisibility4AnyDomain(ses);
ses.GetSessionModuleData(ClassName).Field('Add_templateDiagData').AsObject:=input.Field('data').AsObject.CloneToNewObject();
res:=TFRE_DB_FORM_DIALOG_DESC.create.Describe(FetchModuleTextShort(ses,'dhcp_template_add_standard_option_diag_cap'),600,true,true,false,true,nil,0,CWSF(@WEB_CleanupAddOptionDiag));
res.AddInput.Describe(FetchModuleTextShort(ses,'dhcp_template_add_standard_option_name'),'name',true);
res.AddInput.Describe(FetchModuleTextShort(ses,'dhcp_template_add_standard_option_value'),'value',true);
sf:=CWSF(@WEB_StoreStandardOption);
sf.AddParam.Describe('selected',input.Field('selected').AsString);
res.AddButton.Describe(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('button_save')),sf,fdbbt_submit);
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_StoreStandardOption(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
obj : IFRE_DB_Object;
res : TFRE_DB_FORM_DIALOG_DESC;
begin
obj:=GFRE_DBI.NewObject;
obj.Field('name').AsString:=input.FieldPath('data.name').Asstring;
obj.Field('value').AsString:=input.FieldPath('data.value').AsString;
ses.GetSessionModuleData(ClassName).Field('templateDiagData').AsObject.Field('standard').AddObject(obj);
ses.SendServerClientRequest(TFRE_DB_CLOSE_DIALOG_DESC.create.Describe); //CLOSE ADD
ses.GetSessionModuleData(ClassName).Field('templateDiagRefresh').AsBoolean:=true;
ses.SendServerClientRequest(TFRE_DB_CLOSE_DIALOG_DESC.create.Describe); //CLOSE TEMPLATE DIAG
input.DeleteField('data');
input.Field('advancedCollapsed').AsBoolean:=false;
res:=_AddModifyTemplate(input,ses,app,conn,input.Field('selected').AsString<>'').Implementor_HC as TFRE_DB_FORM_DIALOG_DESC ; //REBUILD TEMPLATE DIAG
res.FillWithObjectValues(ses.GetSessionModuleData(ClassName).Field('Add_templateDiagData').AsObject,ses,'',false);
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_AddCustomOption(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
res: TFRE_DB_FORM_DIALOG_DESC;
sf : TFRE_DB_SERVER_FUNC_DESC;
begin
CheckClassVisibility4AnyDomain(ses);
ses.GetSessionModuleData(ClassName).Field('Add_templateDiagData').AsObject:=input.Field('data').AsObject.CloneToNewObject();
res:=TFRE_DB_FORM_DIALOG_DESC.create.Describe(FetchModuleTextShort(ses,'dhcp_template_add_custom_option_diag_cap'),600,true,true,false,true,nil,0,CWSF(@WEB_CleanupAddOptionDiag));
res.AddInput.Describe(FetchModuleTextShort(ses,'dhcp_template_add_custom_option_declaration'),'declaration',true);
res.AddInput.Describe(FetchModuleTextShort(ses,'dhcp_template_add_custom_option_usage'),'usage',true);
sf:=CWSF(@WEB_StoreCustomOption);
sf.AddParam.Describe('selected',input.Field('selected').AsString);
res.AddButton.Describe(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('button_save')),sf,fdbbt_submit);
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_StoreCustomOption(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
obj : IFRE_DB_Object;
res : TFRE_DB_FORM_DIALOG_DESC;
begin
obj:=GFRE_DBI.NewObject;
obj.Field('declaration').AsString:=input.FieldPath('data.declaration').AsString;
obj.Field('usage').AsString:=input.FieldPath('data.usage').AsString;
ses.GetSessionModuleData(ClassName).Field('templateDiagData').AsObject.Field('custom').AddObject(obj);
ses.SendServerClientRequest(TFRE_DB_CLOSE_DIALOG_DESC.create.Describe); //CLOSE ADD
ses.GetSessionModuleData(ClassName).Field('templateDiagRefresh').AsBoolean:=true;
ses.SendServerClientRequest(TFRE_DB_CLOSE_DIALOG_DESC.create.Describe); //CLOSE TEMPLATE DIAG
input.DeleteField('data');
input.Field('advancedCollapsed').AsBoolean:=false;
res:=_AddModifyTemplate(input,ses,app,conn,input.Field('selected').AsString<>'').Implementor_HC as TFRE_DB_FORM_DIALOG_DESC ; //REBUILD TEMPLATE DIAG
res.FillWithObjectValues(ses.GetSessionModuleData(ClassName).Field('Add_templateDiagData').AsObject,ses,'',false);
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_DeleteOption(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
res : TFRE_DB_FORM_DIALOG_DESC;
begin
ses.GetSessionModuleData(ClassName).Field('templateDiagData').AsObject.Field(input.Field('type').AsString).RemoveObject(input.Field('idx').AsInt32);
ses.GetSessionModuleData(ClassName).Field('templateDiagRefresh').AsBoolean:=true;
ses.SendServerClientRequest(TFRE_DB_CLOSE_DIALOG_DESC.create.Describe); //CLOSE TEMPLATE DIAG
input.Field('advancedCollapsed').AsBoolean:=false;
res:=_AddModifyTemplate(input,ses,app,conn,input.Field('selected').AsString<>'').Implementor_HC as TFRE_DB_FORM_DIALOG_DESC ; //REBUILD TEMPLATE DIAG
res.FillWithObjectValues(input.Field('data').AsObject,ses,'',false);
Result:=res;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_CleanupTemplateDiag(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
if ses.GetSessionModuleData(ClassName).FieldExists('templateDiagRefresh') then begin
ses.GetSessionModuleData(ClassName).DeleteField('templateDiagRefresh');
end else begin
ses.GetSessionModuleData(ClassName).DeleteField('templateDiagData');
end;
Result:=GFRE_DB_NIL_DESC;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_CleanupAddOptionDiag(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
ses.GetSessionModuleData(ClassName).DeleteField('Add_templateDiagData');
Result:=GFRE_DB_NIL_DESC;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_AddSubnetEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
Result:=_AddModifySubnetEntry(input,ses,app,conn,nil);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_AddFixedEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
begin
Result:=_AddModifyFixedEntry(input,ses,app,conn,nil);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_ModifyEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
dbo: IFRE_DB_Object;
begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),dbo));
if dbo.Implementor_HC is TFRE_DB_DHCP_SUBNET then begin
Result:=_AddModifySubnetEntry(input,ses,app,conn,dbo);
end else begin
Result:=_AddModifyFixedEntry(input,ses,app,conn,dbo);
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_StoreSubnetEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
scheme : IFRE_DB_SchemeObject;
entryObj : TFRE_DB_DHCP_SUBNET;
isNew : Boolean;
service : IFRE_DB_Object;
begin
GetSystemScheme(TFRE_DB_DHCP_SUBNET,scheme);
if input.FieldExists('entryId') then begin
CheckDbResult(conn.FetchAs(FREDB_H2G(input.Field('entryId').AsString),TFRE_DB_DHCP_SUBNET,entryObj));
if not (conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_SUBNET,entryObj.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entryObj.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entryObj.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,entryObj.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
CheckDbResult(conn.Fetch(entryObj.Field('dhcp_id').AsObjectLink,service));
isNew:=false;
end else begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('dhcpId').AsString),service));
if not (conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_SUBNET,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
entryObj:=TFRE_DB_DHCP_SUBNET.CreateForDB;
entryObj.SetDomainID(service.DomainID);
entryObj.Field('dhcp_id').AsObjectLink:=service.UID;
isNew:=true;
end;
_StoreHandleTemplates(conn,input,entryObj,not isNew);
scheme.SetObjectFieldsWithScheme(input.Field('data').AsObject,entryObj,isNew,conn);
G_setServiceConfigChanged(conn,ses,service);
if isNew then begin
CheckDbResult(conn.GetCollection(CFRE_DB_DHCP_ENTRY_COLLECTION).Store(entryObj));
end else begin
CheckDbResult(conn.Update(entryObj));
end;
Result:=TFRE_DB_CLOSE_DIALOG_DESC.Create.Describe();
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_StoreFixedEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
scheme : IFRE_DB_SchemeObject;
entryObj : TFRE_DB_DHCP_FIXED;
isNew : Boolean;
service : IFRE_DB_Object;
begin
GetSystemScheme(TFRE_DB_DHCP_FIXED,scheme);
if input.FieldExists('entryId') then begin
CheckDbResult(conn.FetchAs(FREDB_H2G(input.Field('entryId').AsString),TFRE_DB_DHCP_FIXED,entryObj));
if not (conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_FIXED,entryObj.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entryObj.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entryObj.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entryObj.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,entryObj.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
CheckDbResult(conn.Fetch(entryObj.Field('dhcp_id').AsObjectLink,service));
isNew:=false;
end else begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('dhcpId').AsString),service));
if not (conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_FIXED,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,service.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,service.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
entryObj:=TFRE_DB_DHCP_FIXED.CreateForDB;
entryObj.SetDomainID(service.DomainID);
entryObj.Field('dhcp_id').AsObjectLink:=service.UID;
isNew:=true;
end;
_StoreHandleTemplates(conn,input,entryObj,not isNew);
scheme.SetObjectFieldsWithScheme(input.Field('data').AsObject,entryObj,isNew,conn);
G_setServiceConfigChanged(conn,ses,service);
if isNew then begin
CheckDbResult(conn.GetCollection(CFRE_DB_DHCP_ENTRY_COLLECTION).Store(entryObj));
end else begin
CheckDbResult(conn.Update(entryObj));
end;
Result:=TFRE_DB_CLOSE_DIALOG_DESC.Create.Describe();
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_DeleteEntry(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
sf : TFRE_DB_SERVER_FUNC_DESC;
cap,msg : String;
entry : IFRE_DB_Object;
begin
if input.Field('selected').ValueCount<>1 then raise EFRE_DB_Exception.Create(FetchModuleTextShort(ses,'error_delete_single_select'));
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsStringArr[0]),entry));
if not (conn.sys.CheckClassRight4DomainId(sr_DELETE,entry.Implementor_HC.ClassType,entry.DomainID) and conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,entry.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
sf:=CWSF(@WEB_DeleteEntryConfirmed);
sf.AddParam.Describe('selected',input.Field('selected').AsStringArr);
if entry.Implementor_HC is TFRE_DB_DHCP_SUBNET then begin
cap:=FetchModuleTextShort(ses,'subnet_entry_delete_diag_cap');
msg:=FetchModuleTextShort(ses,'subnet_entry_delete_diag_msg');
end else begin
cap:=FetchModuleTextShort(ses,'fixed_entry_delete_diag_cap');
msg:=FetchModuleTextShort(ses,'fixed_entry_delete_diag_msg');
end;
msg:=StringReplace(msg,'%entry_str%',entry.Field('objname').AsString,[rfReplaceAll]);
Result:=TFRE_DB_MESSAGE_DESC.create.Describe(cap,msg,fdbmt_confirm,sf);
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_DeleteEntryConfirmed(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
i,j : NativeInt;
entry : IFRE_DB_Object;
refs : TFRE_DB_GUIDArray;
service : IFRE_DB_Object;
begin
if input.field('confirmed').AsBoolean then begin
for i:= 0 to input.Field('selected').ValueCount-1 do begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsStringArr[i]),entry));
if not (conn.sys.CheckClassRight4DomainId(sr_DELETE,entry.Implementor_HC.ClassType,entry.DomainID) and conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) and conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,entry.DomainID)) then
raise EFRE_DB_Exception.Create(conn.FetchTranslateableTextShort(FREDB_GetGlobalTextKey('error_no_access')));
CheckDbResult(conn.Fetch(entry.Field('dhcp_id').AsObjectLink,service));
refs:=conn.GetReferences(entry.UID,true,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION.ClassName,'template');
G_setServiceConfigChanged(conn,ses,service);
for j := 0 to High(refs) do begin
CheckDbResult(conn.Delete(refs[j]));
end;
CheckDbResult(conn.Delete(entry.UID));
end;
result := GFRE_DB_NIL_DESC;
end else begin
result := GFRE_DB_NIL_DESC;
end;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_EntrySC(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
modify_disabled : Boolean;
del_disabled : Boolean;
entry : IFRE_DB_Object;
begin
CheckClassVisibility4AnyDomain(ses);
modify_disabled:=true;
del_disabled:=true;
if input.FieldExists('selected') and (input.Field('selected').ValueCount=1) then begin
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),entry));
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,entry.DomainID) then begin
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,entry.Implementor_HC.ClassType,entry.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) then begin
modify_disabled:=false;
end;
if (conn.sys.CheckClassRight4DomainId(sr_DELETE,entry.Implementor_HC.ClassType,entry.DomainID) and conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID)) then begin
del_disabled:=false;
end;
end;
end;
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.create.DescribeStatus('modify_entry',modify_disabled));
ses.SendServerClientRequest(TFRE_DB_UPDATE_UI_ELEMENT_DESC.create.DescribeStatus('delete_entry',del_disabled));
Result:=GFRE_DB_NIL_DESC;
end;
function TFRE_FIRMBOX_DHCP_MOD.WEB_EntryMenu(const input: IFRE_DB_Object; const ses: IFRE_DB_Usersession; const app: IFRE_DB_APPLICATION; const conn: IFRE_DB_CONNECTION): IFRE_DB_Object;
var
res : TFRE_DB_MENU_DESC;
func : TFRE_DB_SERVER_FUNC_DESC;
entry : IFRE_DB_Object;
begin
res:=TFRE_DB_MENU_DESC.create.Describe;
CheckDbResult(conn.Fetch(FREDB_H2G(input.Field('selected').AsString),entry));
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP,entry.DomainID) then begin
if conn.sys.CheckClassRight4DomainId(sr_UPDATE,entry.Implementor_HC.ClassType,entry.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_STORE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_UPDATE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) then begin
func:=CWSF(@WEB_ModifyEntry);
func.AddParam.Describe('selected',input.Field('selected').AsStringArr);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_modify_entry'),'',func);
end;
if conn.sys.CheckClassRight4DomainId(sr_DELETE,entry.Implementor_HC.ClassType,entry.DomainID) and
conn.sys.CheckClassRight4DomainId(sr_DELETE,TFRE_DB_DHCP_ENTRY_TEMPLATE_RELATION,entry.DomainID) then begin
func:=CWSF(@WEB_DeleteEntry);
func.AddParam.Describe('selected',input.Field('selected').AsStringArr);
res.AddEntry.Describe(FetchModuleTextShort(ses,'cm_delete_entry'),'',func);
end;
end;
Result:=res;
end;
end.
|
namespace CirrusCalculatorInterfaceAspectLibrary;
interface
uses
RemObjects.Elements.Cirrus;
type
// This attribute will be transformed into RemObjects Cirrus Aspect later.
// Note how RemObjects.Elements.Cirrus.IMethodDefinition and RemObjects.Elements.Cirrus.ITypeImplementationDecorator
// interfaces are implemented
//
// Also note how GetItemFromCache and AddItemToCache method declarations are marked. These methods will be injected into target
// class of aspect
//
// Aspects should be declared in separate library so Cirrus framework will be able to apply them to target classes
// In most cases nor this library assembly containing Aspects nor RemObjects.Elements.Cirrus assembly aren't needed to
// run resulting application
[AttributeUsage(AttributeTargets.Class)]
CalculatorInterfaceAttribute = public class(Attribute, RemObjects.Elements.Cirrus.ITypeInterfaceDecorator)
public
//[Aspect:RemObjects.Elements.Cirrus.AutoInjectIntoTarget]
//class method GetItemFromCache(aArguments: array of Object; aCache: System.Collections.Hashtable): Object;
//
//[Aspect:RemObjects.Elements.Cirrus.AutoInjectIntoTarget]
//class method AddItemToCache(aArguments: array of Object; aCache: System.Collections.Hashtable; aValue: Object);
//public
//method HandleImplementation(Services: RemObjects.Elements.Cirrus.IServices; aMethod: RemObjects.Elements.Cirrus.IMethodDefinition);
//method HandleImplementation(Services: RemObjects.Elements.Cirrus.IServices; aType: RemObjects.Elements.Cirrus.ITypeDefinition);
method HandleInterface(Services: RemObjects.Elements.Cirrus.IServices; aType: RemObjects.Elements.Cirrus.ITypeDefinition);
end;
implementation
//
//method CachedCalculationsAttribute.HandleImplementation(Services: RemObjects.Elements.Cirrus.IServices; aMethod: RemObjects.Elements.Cirrus.IMethodDefinition);
//begin
//// Here target class constructor is modified.
//// Note how added thru this aspect private field fCache is accessed nad initialized
//if (String.Equals(aMethod.Name, '.ctor', StringComparison.OrdinalIgnoreCase)) then begin
//aMethod.SetBody(Services,
//method begin
//Aspects.OriginalBody;
//
//unquote<System.Collections.Hashtable>(new RemObjects.Elements.Cirrus.Values.FieldValue(new RemObjects.Elements.Cirrus.Values.SelfValue(), aMethod.Owner.GetField('fCache'))) := new System.Collections.Hashtable();
//end);
//exit;
//end;
//
//if (not String.Equals(aMethod.Name, 'Calculate', StringComparison.OrdinalIgnoreCase)) then exit;
//
//// Only method with name Calculate will be modified
//// Note how field fCache is accessed
//// Also note how target method is modified and caching capatibilies are added there
//aMethod.SetBody(Services,
//method begin
//var lCache := unquote<System.Collections.Hashtable>(new RemObjects.Elements.Cirrus.Values.FieldValue(new RemObjects.Elements.Cirrus.Values.SelfValue(), aMethod.Owner.GetField('fCache')));
//
//var lValue: Object := GetItemFromCache(Aspects.GetParameters(), lCache);
//if (assigned(lValue)) then
//exit Int64(lValue);
//
//var lMethodResult: Int64;
//try
//Aspects.OriginalBody;
//lMethodResult := Aspects.RequireResult;
//finally
//AddItemToCache(Aspects.GetParameters(), lCache, lMethodResult);
//end;
//end);
//end;
//
//// This method implements interface RemObjects.Elements.Cirrus.ITypeImplementationDecorator
//// Note how new field is added to target class
//method CachedCalculationsAttribute.HandleImplementation(Services: RemObjects.Elements.Cirrus.IServices; aType: RemObjects.Elements.Cirrus.ITypeDefinition);
//begin
//aType.AddField('fCache', aType.GetContextType('System.Collections.Hashtable'), false);
//end;
//
//
//// This method will be injected into target class because it is marked as
//// [Aspect:RemObjects.Elements.Cirrus.AutoInjectIntoTarget]
//// in interface section
//// It returns value stored in cache, if this is possible or nil otherwise
//class method CachedCalculationsAttribute.GetItemFromCache(aArguments: array of Object; aCache: System.Collections.Hashtable): Object;
//begin
//if (not assigned(aArguments)) then
//exit (nil);
//
//if (Length(aArguments) <> 1) then
//exit (nil);
//
//var lKey: Int32 := Int32(aArguments[0]);
//
//if (aCache.ContainsKey(lKey)) then
//exit (aCache[lKey]);
//
//exit (nil);
//end;
//
//
//// This method will be injected into target class because it is marked as
//// [Aspect:RemObjects.Elements.Cirrus.AutoInjectIntoTarget]
//// in interface section
//// It put value provided to the cache
//class method CachedCalculationsAttribute.AddItemToCache(aArguments: array of Object; aCache: System.Collections.Hashtable; aValue: Object);
//begin
//if (not assigned(aArguments)) then
//exit;
//
//if (Length(aArguments) <> 1) then
//exit;
//
//var lKey: Int32 := Int32(aArguments[0]);
//
//if (aCache.ContainsKey(lKey)) then
//aCache[lKey] := aValue
//else
//aCache.Add(lKey, aValue);
//end;
//
method CalculatorInterfaceAttribute.HandleInterface(Services: RemObjects.Elements.Cirrus.IServices; aType: RemObjects.Elements.Cirrus.ITypeDefinition);
begin
aType.AddInterface(aType.GetContextType('CalculatorLibrary.ICalculator'));
end;
//
end.
|
unit NtTranslatorEx;
interface
uses
Forms;
{ Translates the form.
@param form Form to be translated. }
procedure _T(form: TCustomForm); overload;
implementation
uses
NtTranslator;
procedure _T(form: TCustomForm);
var
translator: TNtTranslator;
begin
translator := TNtTranslator.Create;
try
translator.TranslateForm(form);
finally
translator.Free;
end;
end;
end.
|
// Web Open Font Format 1.0
unit fi_woff;
interface
implementation
uses
fi_common,
fi_info_reader,
fi_sfnt,
fi_utils,
classes,
sysutils,
zstream;
const
WOFF_SIGN = $774f4646; // 'wOFF'
type
TWOFFHeader = packed record
signature,
flavor,
length: LongWord;
numTables,
reserved: Word;
// totalSfntSize: LongWord;
// majorVersion,
// minorVersion: Word;
// metaOffset,
// metaLength,
// metaOrigLength,
// privOffset,
// privLength: LongWord;
end;
TWOFFTableDirEntry = packed record
tag,
offset,
compLength,
origLength: LongWord;
// origChecksum: LongWord;
end;
procedure ReadWOFFTable(
stream: TStream; var info: TFontInfo; dir: TWOFFTableDirEntry);
var
reader: TSFNTTableReader;
start: Int64;
zs: TDecompressionStream;
decompressedData: TBytes;
decompressedDataStream: TBytesStream;
begin
reader := SFNT_FindTableReader(dir.tag);
if reader = NIL then
exit;
if dir.compLength > dir.origLength then
raise EStreamError.CreateFmt(
'Compressed size (%u) of the "%s" WOFF table is greater than '
+ 'decompressed size (%u)',
[dir.compLength, TagToString(dir.tag), dir.origLength]);
if dir.compLength = dir.origLength then
begin
SFNT_ReadTable(reader, stream, info, dir.offset);
exit;
end;
start := stream.Position;
stream.Seek(dir.offset, soBeginning);
// We don't pass TDecompressionStream directly to the reader, since
// TDecompressionStream will have to re-decode the data from the
// beginning each time the reader seeks backward.
zs := TDecompressionStream.Create(stream);
try
SetLength(decompressedData, dir.origLength);
zs.ReadBuffer(decompressedData[0], dir.origLength);
finally
zs.Free;
end;
stream.Seek(start, soBeginning);
decompressedDataStream := TBytesStream.Create(decompressedData);
try
SFNT_ReadTable(reader, decompressedDataStream, info, 0);
finally
decompressedDataStream.Free;
end;
end;
procedure ReadWOFFInfo(stream: TStream; var info: TFontInfo);
var
header: TWOFFHeader;
i: LongInt;
dir: TWOFFTableDirEntry;
hasLayoutTables: Boolean = FALSE;
begin
stream.ReadBuffer(header, SizeOf(header));
{$IFDEF ENDIAN_LITTLE}
with header do
begin
signature := SwapEndian(signature);
flavor := SwapEndian(flavor);
length := SwapEndian(length);
numTables := SwapEndian(numTables);
reserved := SwapEndian(reserved);
end;
{$ENDIF}
if header.signature <> WOFF_SIGN then
raise EStreamError.Create('Not a WOFF font');
if header.length <> stream.Size then
raise EStreamError.CreateFmt(
'Size in WOFF header (%u) does not match the file size (%d)',
[header.length, stream.Size]);
if header.numTables = 0 then
raise EStreamError.Create('WOFF has no tables');
if header.reserved <> 0 then
raise EStreamError.CreateFmt(
'Reserved field in WOFF header is not 0 (%u)',
[header.reserved]);
stream.Seek(SizeOf(Word) * 2 + SizeOf(LongWord) * 6, soCurrent);
for i := 0 to header.numTables - 1 do
begin
stream.ReadBuffer(dir, SizeOf(dir));
// Skip origChecksum.
stream.Seek(SizeOf(LongWord), soCurrent);
{$IFDEF ENDIAN_LITTLE}
with dir do
begin
tag := SwapEndian(tag);
offset := SwapEndian(offset);
compLength := SwapEndian(compLength);
origLength := SwapEndian(origLength);
end;
{$ENDIF}
ReadWOFFTable(stream, info, dir);
hasLayoutTables := hasLayoutTables or SFNT_IsLayoutTable(dir.tag);
end;
info.format := SFNT_GetFormatSting(
header.flavor, hasLayoutTables);
end;
initialization
RegisterReader(@ReadWOFFInfo, ['.woff']);
end.
|
unit Player;
interface
uses
Errors;
type
TPlayerInfo = record
wID_Player:word;
sName:string[30];
wCurSit:word;
bHealth:byte;
sPassword:string[32];
end;
TPlayerFile = file of TPlayerInfo;
TPlayer = class
private
isFileAssigned:boolean;
piPlayerInfo:TPlayerInfo;
public
constructor Create;
destructor Destroy;
function CreateNewPlayer(psPlayerName:string;
pisRewriteIfExists:boolean):byte;
function LoadPlayerFromFile(fName:string):byte;
function UpdatePlayerFile:byte;
//Set methods
procedure SetName(psName:string);
procedure SetSituation(pwSituation:word);
procedure SetHealth(pbHealth:byte);
procedure SetPlayerPassword(psPassword:string);
//Get methods
function GetName:string;
function GetSituation:word;
function GetHealth:byte;
function GetPlayerPassword:string;
function GetPlayerID:word;
function isAssigned:boolean;
end;
implementation
{TPlayer}
function TPlayer.LoadPlayerFromFile(fName:string):byte;
var
pfFile:TPlayerFile;
begin
result:=ERROR_SUCCESS;
//Checking if file exists. If not - ERROR_NOT_EXISTS
if not FileExists(fName) then begin
result:=ERROR_NOT_EXISTS;
exit;
end;{if}
AssignFile(pfFile, fName);
//If something goes worng - set result to ERROR_UNKNOWN and exit;
try
Reset(pfFile);
except
on e:Exception do begin
result:=ERROR_UNKNOWN;
exit;
end;{on}
end;{try}
//If amount of records is not equal to one - set result to ERROR_FORMAT and exit;
if FileSize(pfFile)<>1 then begin
result:=ERROR_FORMAT;
exit;
end;{if}
//If PC reached here - we have pfFile opened. This file contains only one record about the player.
Seek(pfFile, 0);
read(pfFile, piPlayerInfo);
isFileAssigned:=true;
//Now we should close the file.
CloseFile(pfFile);
end;{LoadPlayerFromFile}
function TPlayer.CreateNewPlayer(psPlayerName:string;
pisRewriteIfExists:boolean):byte;
var
lfFile:TPlayerFile;
begin
if FileExists(psPlayerName+'.pl') and (not pisRewriteIfExists) then begin
result:=ERROR_FILE_EXISTS;
exit;
end;
AssignFile(lfFile, psPlayerName+'.pl');
try
Rewrite(lfFile);
except
on e:Exception do begin
result:=ERROR_UNKNOWN;
exit;
end;
end;
write(lfFile, piPlayerInfo);
piPlayerInfo.sName:=psPlayerName;
Randomize;
piPlayerInfo.wID_Player:=Random(256);
isFileAssigned:=true;
CloseFile(lfFile);
end;{CreateNewPlayer}
function TPlayer.UpdatePlayerFile:byte;
var
fPlayerFile:TPlayerFile;
begin
//Если мы не открыли или не создали до сих пор игрока.
if not isFileAssigned then begin
result:=ERROR_FILE_NOT_ASSIGNED;
exit;
end;{if}
AssignFile(fPlayerFile, piPlayerInfo.sName+'.pl');
try
Rewrite(fPlayerFile);
except
on e:Exception do begin
result:=ERROR_UNKNOWN;
exit;
end;{on}
end;{try..except}
write(fPlayerFile, piPlayerInfo);
CloseFile(fPlayerFile);
end;{UpdatePlayerFile}
procedure TPlayer.SetName(psName:string);
begin
piPlayerInfo.sName:=psName;
end;
procedure TPlayer.SetSituation(pwSituation:word);
begin
piPlayerInfo.wCurSit:=pwSituation;
end;
procedure TPlayer.SetHealth(pbHealth:byte);
begin
piPlayerInfo.bHealth:=pbHealth;
end;
procedure TPlayer.SetPlayerPassword(psPassword:string);
begin
piPlayerInfo.sPassword:=psPassword;
end;
function TPlayer.GetName:string;
begin
result:=piPlayerInfo.sName;
end;
function TPlayer.GetSituation:word;
begin
result:=piPlayerInfo.wCurSit;
end;
function TPlayer.GetHealth:byte;
begin
result:=piPlayerInfo.bHealth;
end;
function TPlayer.GetPlayerPassword:string;
begin
result:=piPlayerInfo.sPassword;
end;
function TPlayer.GetPlayerID:word;
begin
result:=piPlayerInfo.wID_Player;
end;
function TPlayer.isAssigned:boolean;
begin
result:=self.isFileAssigned;
end;
constructor TPlayer.Create;
begin
inherited;
Randomize;
self.isFileAssigned:=false;
self.piPlayerInfo.bHealth:=0;
self.piPlayerInfo.sName:='';
self.piPlayerInfo.sPassword:='';
self.piPlayerInfo.wCurSit:=0;
self.piPlayerInfo.wID_Player:=Random(256);
end;
destructor TPlayer.Destroy;
begin
end;
{TPlayer}
end.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.