Changeset 24 for trunk/Modules/Attendance
- Timestamp:
- Nov 19, 2012, 12:31:19 PM (12 years ago)
- Location:
- trunk/Modules/Attendance
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Attendance/UAccessControler.pas
r20 r24 6 6 7 7 uses 8 Classes, SysUtils ;8 Classes, SysUtils, UAttendance, UCommPin; 9 9 10 10 type 11 12 11 { TAccessControler } 13 12 14 13 TAccessControler = class 15 (* function GetUser(Id: Integer): TUser; 16 function GetUserCount: Integer; 17 function GetPassage(Id: Integer): TPassage; 18 function GetPassageCount: Integer;*) 14 private 15 FActive: Boolean; 16 protected 17 procedure SetActive(AValue: Boolean); virtual; 18 public 19 Id: Integer; 20 Pin: TCommPin; 21 constructor Create; virtual; 22 destructor Destroy; override; 23 function GetUser(Id: Integer; User: TUser): Boolean; virtual; 24 function GetUserCount: Integer; virtual; 25 function GetPassage(Id: Integer; Passage: TUserPassage): Boolean; virtual; 26 function GetPassageCount: Integer; virtual; 27 property Active: Boolean read FActive write SetActive; 19 28 end; 20 29 … … 23 32 { TAccessControler } 24 33 25 (*function TAccessControler.GetUser(Id: Integer): TUser; 34 procedure TAccessControler.SetActive(AValue: Boolean); 35 begin 36 if FActive = AValue then Exit; 37 FActive := AValue; 38 end; 39 40 constructor TAccessControler.Create; 41 begin 42 Pin := TCommPin.Create; 43 Id := 1; 44 end; 45 46 destructor TAccessControler.Destroy; 47 begin 48 FreeAndNil(Pin); 49 inherited Destroy; 50 end; 51 52 function TAccessControler.GetUser(Id: Integer; User: TUser): Boolean; 26 53 begin 27 54 … … 33 60 end; 34 61 35 function TAccessControler.GetPassage(Id: Integer ): TPassage;62 function TAccessControler.GetPassage(Id: Integer; Passage: TUserPassage): Boolean; 36 63 begin 37 64 … … 41 68 begin 42 69 43 end; *)70 end; 44 71 45 72 end. -
trunk/Modules/Attendance/UFormVirtualTerminal.lfm
r20 r24 5 5 Width = 353 6 6 Caption = 'Virtual Access Controler' 7 ClientHeight = 276 8 ClientWidth = 353 7 9 LCLVersion = '1.1' 10 object SpinEditUser: TSpinEdit 11 Left = 72 12 Height = 21 13 Top = 8 14 Width = 83 15 TabOrder = 0 16 end 17 object Label1: TLabel 18 Left = 6 19 Height = 13 20 Top = 10 21 Width = 37 22 Caption = 'User id:' 23 ParentColor = False 24 end 25 object Label2: TLabel 26 Left = 7 27 Height = 13 28 Top = 41 29 Width = 33 30 Caption = 'Key id:' 31 ParentColor = False 32 end 33 object SpinEditKey: TSpinEdit 34 Left = 72 35 Height = 21 36 Top = 40 37 Width = 82 38 TabOrder = 1 39 end 40 object Label3: TLabel 41 Left = 9 42 Height = 13 43 Top = 72 44 Width = 26 45 Caption = 'Time:' 46 ParentColor = False 47 end 48 object LabelTime: TLabel 49 Left = 72 50 Height = 13 51 Top = 72 52 Width = 12 53 Caption = ' ' 54 ParentColor = False 55 end 56 object ButtonPress: TButton 57 Left = 72 58 Height = 25 59 Top = 113 60 Width = 75 61 Caption = 'Press' 62 TabOrder = 2 63 end 64 object Timer1: TTimer 65 OnTimer = Timer1Timer 66 left = 241 67 top = 78 68 end 8 69 end -
trunk/Modules/Attendance/UFormVirtualTerminal.lrt
r20 r24 1 1 TFORMVIRTUALACCESSCONTROLER.CAPTION=Virtual Access Controler 2 TFORMVIRTUALACCESSCONTROLER.LABEL1.CAPTION=User id: 3 TFORMVIRTUALACCESSCONTROLER.LABEL2.CAPTION=Key id: 4 TFORMVIRTUALACCESSCONTROLER.LABEL3.CAPTION=Time: 5 TFORMVIRTUALACCESSCONTROLER.LABELTIME.CAPTION= 6 TFORMVIRTUALACCESSCONTROLER.BUTTONPRESS.CAPTION=Press -
trunk/Modules/Attendance/UFormVirtualTerminal.pas
r20 r24 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs; 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin, 9 StdCtrls, ExtCtrls; 9 10 10 11 type … … 12 13 end; 13 14 15 { TFormVirtualAccessControler } 16 14 17 TFormVirtualAccessControler = class(TForm) 18 ButtonPress: TButton; 19 Label1: TLabel; 20 Label2: TLabel; 21 Label3: TLabel; 22 LabelTime: TLabel; 23 SpinEditUser: TSpinEdit; 24 SpinEditKey: TSpinEdit; 25 Timer1: TTimer; 26 procedure Timer1Timer(Sender: TObject); 15 27 private 16 28 { private declarations } … … 26 38 {$R *.lfm} 27 39 40 { TFormVirtualAccessControler } 41 42 procedure TFormVirtualAccessControler.Timer1Timer(Sender: TObject); 43 begin 44 LabelTime.Caption := DateTimeToStr(Now); 45 end; 46 28 47 end. 29 48 -
trunk/Modules/Attendance/UModuleAttendance.lfm
r20 r24 7 7 object ActionList1: TActionList 8 8 Images = FormMain.ImageList1 9 left = 30010 top = 1049 left = 160 10 top = 56 11 11 object AReadFromTerminal: TAction 12 12 Caption = 'Read from terminal' … … 15 15 end 16 16 end 17 object PopupMenu1: TPopupMenu 18 Images = FormMain.ImageList1 19 left = 56 20 top = 56 21 object MenuItem1: TMenuItem 22 Action = AReadFromTerminal 23 end 24 end 17 25 end -
trunk/Modules/Attendance/UModuleAttendance.pas
r20 r24 7 7 uses 8 8 Classes, SysUtils, FileUtil, UModularSystem, UFormList, UFormEdit, Controls, 9 SpecializedList, Forms, ActnList, UDataModel;9 SpecializedList, Forms, ActnList, Menus, UDataModel, Dialogs, SpecializedDictionary; 10 10 11 11 type … … 16 16 AReadFromTerminal: TAction; 17 17 ActionList1: TActionList; 18 MenuItem1: TMenuItem; 19 PopupMenu1: TPopupMenu; 18 20 procedure AReadFromTerminalExecute(Sender: TObject); 19 21 private … … 68 70 69 71 uses 70 UFormMain, UCore ;72 UFormMain, UCore, UTerminalBF630, UAccessControler, UAttendance; 71 73 72 74 resourcestring … … 100 102 SHoliday = 'Holiday'; 101 103 SLog = 'Log'; 104 SUsersRead = 'User read: %s'; 102 105 103 106 { TDataModuleAttendance } 104 107 105 108 procedure TDataModuleAttendance.AReadFromTerminalExecute(Sender: TObject); 106 begin 107 109 var 110 AccessControler: TAccessControler; 111 VirtualAccessControler: TVirtualTerminalBF630; 112 UserCount: Integer; 113 UserRec: TUser; 114 Data: TDictionaryStringString; 115 I: Integer; 116 begin 117 Data := nil; 118 UserRec := nil; 119 AccessControler := nil; 120 try 121 VirtualAccessControler := TVirtualTerminalBF630.Create; 122 VirtualAccessControler.InitDemoData; 123 VirtualAccessControler.Active := True; 124 125 AccessControler := TTerminalBF630.Create; 126 AccessControler.Active := True; 127 UserCount := AccessControler.GetUserCount; 128 129 UserRec := TUser.Create; 130 Data := TDictionaryStringString.Create; 131 for I := 0 to UserCount - 1 do begin 132 Data.Clear; 133 AccessControler.GetUser(I, UserRec); 134 Data.Add('FirstName', UserRec.FirstName); 135 Data.Add('SecondName', UserRec.SecondName); 136 Core.Database.Insert('User', Data); 137 end; 138 ShowMessage(SUsersRead + IntToStr(UserCount)); 139 finally 140 if Assigned(Data) then Data.Free; 141 if Assigned(UserRec) then UserRec.Free; 142 if Assigned(AccessControler) then AccessControler.Free; 143 VirtualAccessControler.Free; 144 end; 108 145 end; 109 146
Note:
See TracChangeset
for help on using the changeset viewer.