Changeset 14 for trunk/Modules
- Timestamp:
- Nov 15, 2012, 9:48:48 AM (12 years ago)
- Location:
- trunk/Modules/Attendance
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Attendance/UModuleAttendance.pas
r12 r14 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, UModularSystem; 8 Classes, SysUtils, FileUtil, UModularSystem, UFormList, UFormEdit, Controls, 9 SpecializedList, Forms; 9 10 10 11 type … … 20 21 TModuleAttendance = class(TModule) 21 22 private 23 DataViewLists: TListObject; 24 DataViewForms: TListObject; 25 procedure InitModels; 22 26 protected 23 27 procedure DoStart; override; … … 37 41 38 42 uses 39 UFormMain ;43 UFormMain, UCore; 40 44 41 45 resourcestring 42 46 SAttendance = 'Attendance'; 47 SPersonalId = 'Personal Id'; 48 SFirstName = 'First name'; 49 SSecondName = 'Second name'; 50 SEnabled = 'Enabled'; 51 SAddress = 'Address'; 52 SPort = 'Port'; 53 SType = 'Type'; 54 SName = 'Name'; 55 SFingerPrint = 'Fingerprint'; 56 SCardCode = 'Card code'; 57 SNote = 'Note'; 58 SLogin = 'Login'; 59 SPassword = 'Password'; 60 STerminal = 'Terminal'; 61 SUser = 'User'; 62 SDate = 'Date'; 63 STime = 'Time'; 64 SOperation = 'Operation'; 65 SDay = 'Day'; 66 SMonth = 'Month'; 67 SYear = 'Year'; 68 SKeyNumber = 'Key number'; 69 SText = 'Text'; 70 SPassage = 'Passage'; 71 STimeFrom = 'Time from'; 72 STimeTo = 'Time to'; 73 SHoliday = 'Holiday'; 74 SLog = 'Log'; 43 75 44 76 45 77 { TModuleAttendance } 46 78 79 procedure TModuleAttendance.InitModels; 80 var 81 NewDataView: TDataViewList; 82 NewDataView2: TDataViewForm; 83 begin 84 NewDataView := TDataViewList.Create; 85 with NewDataView do begin 86 with Columns do begin 87 AddItem(SEnabled, 'Enabled', True, 30); 88 AddItem(SPersonalId, 'PersonalId', True, 80); 89 AddItem(SLogin, 'Login', False, 80); 90 AddItem(SPassword, 'Password', False, 80); 91 AddItem(SFirstName, 'FirstName', True, 80); 92 AddItem(SSecondName, 'SecondName', True, 80); 93 AddItem(SCardCode, 'CardCode', True, 80); 94 AddItem(SFingerPrint, 'FingerPrint', True, 80); 95 AddItem(SNote, 'Note', False, 80); 96 end; 97 Name := 'User'; 98 Caption := SUser; 99 ImageIndex := 9; 100 end; 101 DataViewLists.Add(NewDataView); 102 FormMain.RegisterDataViewList(NewDataView); 103 NewDataView2 := TDataViewForm.Create; 104 with NewDataView2 do begin 105 Name := 'User'; 106 Caption := SUser; 107 with Items do begin 108 AddItem(SEnabled, 'Enabled', ctCheckBox, True, Bounds(1, 0, 1, 1)); 109 AddItem(SPersonalId, 'PersonalId', ctSpinEdit, True, Bounds(3, 0, 1, 1)); 110 AddItem(SLogin, 'Login', ctEdit, True, Bounds(1, 1, 1, 1)); 111 AddItem(SPassword, 'Password', ctEdit, True, Bounds(3, 1, 1, 1)); 112 AddItem(SFirstName, 'FirstName', ctEdit, True, Bounds(1, 2, 1, 1)); 113 AddItem(SSecondName, 'SecondName', ctEdit, True, Bounds(3, 2, 1, 1)); 114 AddItem(SCardCode, 'CardCode', ctEdit, True, Bounds(1, 3, 1, 1)); 115 AddItem(SFingerPrint, 'FingerPrint', ctEdit, True, Bounds(3, 3, 1, 1)); 116 AddItem(SNote, 'Note', ctMemo, True, Bounds(0, 5, 4, 4), alTop); 117 end; 118 end; 119 DataViewForms.Add(NewDataView2); 120 FormMain.RegisterDataViewForm(NewDataView2); 121 122 NewDataView := TDataViewList.Create; 123 with NewDataView do begin 124 with Columns do begin 125 AddItem(STime, 'Time', True, 150); 126 AddItem(SUser, 'User', True, 80); 127 AddItem(SOperation, 'Operation', True, 80); 128 AddItem(STerminal, 'Terminal', True, 80); 129 end; 130 Name := 'Passage'; 131 Caption := SPassage; 132 ImageIndex := 12; 133 end; 134 DataViewLists.Add(NewDataView); 135 FormMain.RegisterDataViewList(NewDataView); 136 NewDataView2 := TDataViewForm.Create; 137 with NewDataView2 do begin 138 with Items do begin 139 AddItem(STime, 'Time', ctDate, True, Bounds(0, 0, 1, 1)); 140 with AddItem(SUser, 'User', ctReference, True, Bounds(3, 0, 1, 1)) do 141 ReferencedTable := 'User'; 142 with AddItem(SOperation, 'Operation', ctReference, True, Bounds(0, 1, 1, 1)) do 143 ReferencedTable := 'User'; 144 with AddItem(STerminal, 'Terminal', ctReference, True, Bounds(3, 1, 1, 1)) do 145 ReferencedTable := 'User'; 146 end; 147 Name := 'Passage'; 148 Caption := SPassage; 149 ImageIndex := 12; 150 end; 151 DataViewForms.Add(NewDataView2); 152 FormMain.RegisterDataViewForm(NewDataView2); 153 154 NewDataView := TDataViewList.Create; 155 with NewDataView do begin 156 with Columns do begin 157 AddItem(SDate, 'Date', True, 80); 158 AddItem(SUser, 'User', True, 80); 159 AddItem(STimeFrom, 'TimeFrom', True, 120); 160 AddItem(STimeTo, 'TimeTo', True, 120); 161 end; 162 Name := 'Attendance'; 163 Caption := SAttendance; 164 ImageIndex := 14; 165 end; 166 DataViewLists.Add(NewDataView); 167 FormMain.RegisterDataViewList(NewDataView); 168 NewDataView2 := TDataViewForm.Create; 169 with NewDataView2 do begin 170 with Items do begin 171 AddItem(SUser, 'User', ctReference, True, Bounds(1, 0, 1, 1)); 172 AddItem(SDate, 'Date', ctDate, True, Bounds(3, 0, 1, 1)); 173 AddItem(STimeFrom, 'TimeFrom', ctTime, True, Bounds(1, 1, 1, 1)); 174 AddItem(STimeTo, 'TimeTo', ctTime, True, Bounds(3, 1, 1, 1)); 175 end; 176 Name := 'Attendance'; 177 Caption := SAttendance; 178 ImageIndex := 14; 179 end; 180 DataViewForms.Add(NewDataView2); 181 FormMain.RegisterDataViewForm(NewDataView2); 182 183 NewDataView := TDataViewList.Create; 184 with NewDataView do begin 185 with Columns do begin 186 AddItem(SEnabled, 'Enabled', True, 30); 187 AddItem(SName, 'Name', True, 300); 188 AddItem(SDay, 'Day', True, 50); 189 AddItem(SMonth, 'Month', True, 50); 190 AddItem(SYear, 'Year', True, 50); 191 end; 192 Name := 'Holiday'; 193 Caption := SHoliday; 194 ImageIndex := 10; 195 end; 196 DataViewLists.Add(NewDataView); 197 FormMain.RegisterDataViewList(NewDataView); 198 199 NewDataView := TDataViewList.Create; 200 with NewDataView do begin 201 with Columns do begin 202 AddItem(SName, 'Name', True, 100); 203 AddItem(SKeyNumber, 'KeyId', True, 100); 204 end; 205 Name := 'Operation'; 206 Caption := SOperation; 207 ImageIndex := 13; 208 end; 209 DataViewLists.Add(NewDataView); 210 FormMain.RegisterDataViewList(NewDataView); 211 212 NewDataView := TDataViewList.Create; 213 with NewDataView do begin 214 with Columns do begin 215 AddItem(SName, 'Name', True, 80); 216 AddItem(SEnabled, 'Enabled', True, 30); 217 AddItem(SAddress, 'Address', True, 120); 218 AddItem(SPort, 'Port', True, 50); 219 AddItem(SType, 'Type', True, 80); 220 AddItem(SNote, 'Note', True, 80); 221 end; 222 Name := 'Terminal'; 223 Caption := STerminal; 224 ImageIndex := 8; 225 end; 226 DataViewLists.Add(NewDataView); 227 FormMain.RegisterDataViewList(NewDataView); 228 229 NewDataView := TDataViewList.Create; 230 with NewDataView do begin 231 with Columns do begin 232 AddItem(STime, 'Time', True, 120); 233 AddItem(SUser, 'User', True, 80); 234 AddItem(SText, 'Text', True, 400); 235 end; 236 Name := 'Log'; 237 Caption := SLog; 238 ImageIndex := 11; 239 end; 240 DataViewLists.Add(NewDataView); 241 FormMain.RegisterDataViewList(NewDataView); 242 end; 243 47 244 procedure TModuleAttendance.DoStart; 48 245 begin 49 246 inherited DoStart; 247 Application.Title := SAttendance; 248 FormMain.Caption := SAttendance; 249 DataViewLists := TListObject.Create; 250 DataViewForms := TListObject.Create; 50 251 DataModuleAttendance := TDataModuleAttendance.Create(FormMain); 252 InitModels; 51 253 end; 52 254 53 255 procedure TModuleAttendance.DoStop; 54 begin 256 var 257 I: Integer; 258 begin 259 for I := 0 to DataViewLists.Count - 1 do 260 FormMain.UnregisterDataViewList(TDataViewList(DataViewLists[I])); 261 FreeAndNil(DataViewLists); 262 for I := 0 to DataViewForms.Count - 1 do 263 FormMain.UnregisterDataViewForm(TDataViewForm(DataViewForms[I])); 264 FreeAndNil(DataViewForms); 55 265 FreeAndNil(DataModuleAttendance); 56 266 inherited DoStop; … … 64 274 Author := 'Chronos'; 65 275 License:= 'GNU/LGPLv3'; 66 Dependencies.Add('');67 276 end; 68 277
Note:
See TracChangeset
for help on using the changeset viewer.