Changeset 15
- Timestamp:
- Nov 15, 2012, 12:34:33 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Dochazka.lpi
r14 r15 101 101 </Item7> 102 102 </RequiredPackages> 103 <Units Count="1 3">103 <Units Count="14"> 104 104 <Unit0> 105 105 <Filename Value="Dochazka.lpr"/> … … 183 183 <IsPartOfProject Value="True"/> 184 184 <ComponentName Value="DataModuleAttendance"/> 185 <HasResources Value="True"/> 185 186 <ResourceBaseClass Value="DataModule"/> 186 187 <UnitName Value="UModuleAttendance"/> 187 188 </Unit12> 189 <Unit13> 190 <Filename Value="Application/UDataModel.pas"/> 191 <IsPartOfProject Value="True"/> 192 <UnitName Value="UDataModel"/> 193 </Unit13> 188 194 </Units> 189 195 </ProjectOptions> -
trunk/Dochazka.lpr
r14 r15 11 11 CoolTranslator, UFormSetting, SysUtils, UFormList, UFormEdit, UDataView, 12 12 URegistredModules, TemplateGenerics, synapse, UFormConnection, 13 UModuleAttendance 13 UModuleAttendance, UDataModel 14 14 { you can add units after this }; 15 15 -
trunk/Forms/UFormEdit.lfm
r10 r15 1 1 object FormEdit: TFormEdit 2 Left = 3 832 Left = 368 3 3 Height = 341 4 4 Top = 172 5 Width = 5 385 Width = 553 6 6 Caption = 'Edit item' 7 7 ClientHeight = 341 8 ClientWidth = 5 388 ClientWidth = 553 9 9 OnCreate = FormCreate 10 10 OnDestroy = FormDestroy 11 11 LCLVersion = '1.1' 12 12 object ButtonOk: TButton 13 Left = 4 5613 Left = 471 14 14 Height = 25 15 15 Top = 305 … … 21 21 end 22 22 object ButtonCancel: TButton 23 Left = 3 6823 Left = 383 24 24 Height = 25 25 25 Top = 305 … … 34 34 Height = 2 35 35 Top = 297 36 Width = 5 2336 Width = 538 37 37 Anchors = [akLeft, akRight, akBottom] 38 38 end 39 39 object PanelControls: TPanel 40 Left = 441 Height = 47342 Top = 443 Width = 5 3040 Left = 0 41 Height = 290 42 Top = 0 43 Width = 553 44 44 Align = alTop 45 45 Anchors = [akTop, akLeft, akRight, akBottom] 46 BorderSpacing.Around = 447 46 BevelOuter = bvNone 48 47 TabOrder = 2 -
trunk/Forms/UFormEdit.pas
r10 r15 48 48 ButtonOk: TButton; 49 49 ButtonCancel: TButton; 50 CalcEdit1: TCalcEdit; 50 51 PanelControls: TPanel; 51 52 procedure FormCreate(Sender: TObject); … … 244 245 NewControl := TDateEdit.Create(Self); 245 246 NewControl.Parent := PanelControls; 246 TDateEdit(NewControl).Date := MySQLStrToFloat(Values.Values[Name]);247 NewControl.SetBounds(Rect.Left * W, Rect.Top * H, 248 (Rect.Right - Rect.Left) * W - 28, (Rect.Bottom - Rect.Top) * H);247 TDateEdit(NewControl).Date := SQLToDateTime(Values.Values[Name]); 248 NewControl.SetBounds(Rect.Left * W, Rect.Top * H, 249 (Rect.Right - Rect.Left) * W - TEditButton(NewControl).Button.Width, (Rect.Bottom - Rect.Top) * H); 249 250 NewControl.Show; 250 251 end else … … 252 253 NewControl := TEdit.Create(Self); 253 254 NewControl.Parent := PanelControls; 254 TEdit(NewControl).Text := TimeToStr( MySQLStrToFloat(Values.Values[Name]));255 TEdit(NewControl).Text := TimeToStr(SQLToTime(Values.Values[Name])); 255 256 NewControl.SetBounds(Rect.Left * W, Rect.Top * H, 256 257 (Rect.Right - Rect.Left) * W, (Rect.Bottom - Rect.Top) * H); … … 258 259 end else 259 260 if ControlType = ctReference then begin 260 NewControl := TEdit.Create(Self); 261 NewControl.Parent := PanelControls; 262 TEdit(NewControl).Text := Values.Values[Name]; 263 NewControl.SetBounds(Rect.Left * W, Rect.Top * H, 264 (Rect.Right - Rect.Left) * W - 28, (Rect.Bottom - Rect.Top) * H); 265 NewControl.Show; 266 NewControl := TBitBtn.Create(Self); 267 NewControl.Parent := PanelControls; 268 TBitBtn(NewControl).Caption := ''; 269 NewControl.SetBounds(Rect.Right * W - 28, Rect.Top * H, 24, 24); 270 FormMain.ImageList1.GetBitmap(4, TBitBtn(NewControl).Glyph); 261 NewControl := TEditButton.Create(Self); 262 NewControl.Parent := PanelControls; 263 TEditButton(NewControl).Text := Values.Values[Name]; 264 FormMain.ImageList1.GetBitmap(4, TEditButton(NewControl).Glyph); 265 NewControl.SetBounds(Rect.Left * W, Rect.Top * H, 266 (Rect.Right - Rect.Left) * W - TEditButton(NewControl).Button.Width, 267 (Rect.Bottom - Rect.Top) * H); 271 268 NewControl.Show; 272 269 end; -
trunk/Languages/Dochazka.cs.po
r14 r15 11 11 "X-Generator: Poedit 1.5.4\n" 12 12 13 #: tdatamoduleattendance.areadfromterminal.caption 14 msgid "Read from terminal" 15 msgstr "" 16 17 #: tdatamoduleattendance.areadfromterminal.hint 18 msgid "Read new data from terminal" 19 msgstr "" 20 13 21 #: tform1.actionexit.caption 14 22 msgctxt "tform1.actionexit.caption" … … 549 557 msgid "Year" 550 558 msgstr "Rok" 559 -
trunk/Languages/Dochazka.po
r14 r15 1 1 msgid "" 2 2 msgstr "Content-Type: text/plain; charset=UTF-8" 3 4 #: tdatamoduleattendance.areadfromterminal.caption 5 msgid "Read from terminal" 6 msgstr "" 7 8 #: tdatamoduleattendance.areadfromterminal.hint 9 msgid "Read new data from terminal" 10 msgstr "" 3 11 4 12 #: tform1.actionexit.caption -
trunk/Modules/Attendance/UModuleAttendance.lfm
r12 r15 5 5 VerticalOffset = 238 6 6 Width = 380 7 object ActionList1: TActionList 8 Images = FormMain.ImageList1 9 left = 300 10 top = 104 11 object AReadFromTerminal: TAction 12 Caption = 'Read from terminal' 13 Hint = 'Read new data from terminal' 14 OnExecute = AReadFromTerminalExecute 15 end 16 end 7 17 end -
trunk/Modules/Attendance/UModuleAttendance.pas
r14 r15 7 7 uses 8 8 Classes, SysUtils, FileUtil, UModularSystem, UFormList, UFormEdit, Controls, 9 SpecializedList, Forms ;9 SpecializedList, Forms, ActnList, UDataModel; 10 10 11 11 type 12 13 { TDataModuleAttendance } 14 12 15 TDataModuleAttendance = class(TDataModule) 16 AReadFromTerminal: TAction; 17 ActionList1: TActionList; 18 procedure AReadFromTerminalExecute(Sender: TObject); 13 19 private 14 20 { private declarations } … … 21 27 TModuleAttendance = class(TModule) 22 28 private 23 DataViewLists: TListObject; 24 DataViewForms: TListObject; 29 ModelLog: TDataModel; 30 ViewFormLog: TDataViewForm; 31 ViewListLog: TDataViewList; 32 ModelTerminal: TDataModel; 33 ViewFormTerminal: TDataViewForm; 34 ViewListTerminal: TDataViewList; 35 ModelOperation: TDataModel; 36 ViewFormOperation: TDataViewForm; 37 ViewListOperation: TDataViewList; 38 ModelAttendance: TDataModel; 39 ViewFormAttendance: TDataViewForm; 40 ViewListAttendance: TDataViewList; 41 ModelHoliday: TDataModel; 42 ViewFormHoliday: TDataViewForm; 43 ViewListHoliday: TDataViewList; 44 ModelPassage: TDataModel; 45 ViewFormPassage: TDataViewForm; 46 ViewListPassage: TDataViewList; 47 ModelUser: TDataModel; 48 ViewFormUser: TDataViewForm; 49 ViewListUser: TDataViewList; 25 50 procedure InitModels; 26 51 protected … … 74 99 SLog = 'Log'; 75 100 101 { TDataModuleAttendance } 102 103 procedure TDataModuleAttendance.AReadFromTerminalExecute(Sender: TObject); 104 begin 105 106 end; 107 76 108 77 109 { TModuleAttendance } … … 81 113 NewDataView: TDataViewList; 82 114 NewDataView2: TDataViewForm; 83 begin 84 NewDataView := TDataViewList.Create; 85 with NewDataView do begin 115 NewModel: TDataModel; 116 begin 117 ModelUser := TDataModel.Create; 118 with ModelUser do begin 119 with Items do begin 120 AddItem(SEnabled, 'Enabled', dtBoolean); 121 AddItem(SPersonalId, 'PersonalId', dtString); 122 AddItem(SLogin, 'Login', dtString); 123 AddItem(SPassword, 'Password', dtString); 124 AddItem(SFirstName, 'FirstName', dtString); 125 AddItem(SSecondName, 'SecondName', dtString); 126 AddItem(SCardCode, 'CardCode', dtString); 127 AddItem(SFingerPrint, 'FingerPrint', dtString); 128 AddItem(SNote, 'Note', dtText); 129 end; 130 Name := 'User'; 131 Caption := SUser; 132 end; 133 ViewListUser := TDataViewList.Create; 134 with ViewListUser do begin 86 135 with Columns do begin 87 136 AddItem(SEnabled, 'Enabled', True, 30); … … 99 148 ImageIndex := 9; 100 149 end; 101 DataViewLists.Add(NewDataView); 102 FormMain.RegisterDataViewList(NewDataView); 103 NewDataView2 := TDataViewForm.Create; 104 with NewDataView2 do begin 150 FormMain.RegisterDataViewList(ViewListUser); 151 ViewFormUser := TDataViewForm.Create; 152 with ViewFormUser do begin 105 153 Name := 'User'; 106 154 Caption := SUser; … … 117 165 end; 118 166 end; 119 DataViewForms.Add(NewDataView2); 120 FormMain.RegisterDataViewForm(NewDataView2); 121 122 NewDataView := TDataViewList.Create; 123 with NewDataView do begin 167 FormMain.RegisterDataViewForm(ViewFormUser); 168 169 ViewListPassage := TDataViewList.Create; 170 with ViewListPassage do begin 124 171 with Columns do begin 125 172 AddItem(STime, 'Time', True, 150); … … 132 179 ImageIndex := 12; 133 180 end; 134 DataViewLists.Add(NewDataView); 135 FormMain.RegisterDataViewList(NewDataView); 136 NewDataView2 := TDataViewForm.Create; 137 with NewDataView2 do begin 181 FormMain.RegisterDataViewList(ViewListPassage); 182 ViewFormPassage := TDataViewForm.Create; 183 with ViewFormPassage do begin 138 184 with Items do begin 139 185 AddItem(STime, 'Time', ctDate, True, Bounds(0, 0, 1, 1)); … … 149 195 ImageIndex := 12; 150 196 end; 151 DataViewForms.Add(NewDataView2); 152 FormMain.RegisterDataViewForm(NewDataView2); 153 154 NewDataView := TDataViewList.Create; 155 with NewDataView do begin 197 FormMain.RegisterDataViewForm(ViewFormPassage); 198 199 ViewListAttendance := TDataViewList.Create; 200 with ViewListAttendance do begin 156 201 with Columns do begin 157 202 AddItem(SDate, 'Date', True, 80); … … 164 209 ImageIndex := 14; 165 210 end; 166 DataViewLists.Add(NewDataView); 167 FormMain.RegisterDataViewList(NewDataView); 168 NewDataView2 := TDataViewForm.Create; 169 with NewDataView2 do begin 211 FormMain.RegisterDataViewList(ViewListAttendance); 212 ViewFormAttendance := TDataViewForm.Create; 213 with ViewFormAttendance do begin 170 214 with Items do begin 171 215 AddItem(SUser, 'User', ctReference, True, Bounds(1, 0, 1, 1)); … … 178 222 ImageIndex := 14; 179 223 end; 180 DataViewForms.Add(NewDataView2); 181 FormMain.RegisterDataViewForm(NewDataView2); 182 183 NewDataView := TDataViewList.Create; 184 with NewDataView do begin 224 FormMain.RegisterDataViewForm(ViewFormAttendance); 225 226 ViewListHoliday := TDataViewList.Create; 227 with ViewListHoliday do begin 185 228 with Columns do begin 186 229 AddItem(SEnabled, 'Enabled', True, 30); … … 194 237 ImageIndex := 10; 195 238 end; 196 DataViewLists.Add(NewDataView); 197 FormMain.RegisterDataViewList(NewDataView); 198 199 NewDataView := TDataViewList.Create; 200 with NewDataView do begin 239 FormMain.RegisterDataViewList(ViewListHoliday); 240 ViewFormHoliday := TDataViewForm.Create; 241 with ViewFormHoliday do begin 242 with Items do begin 243 AddItem(SEnabled, 'Enabled', ctCheckBox, True, Bounds(1, 0, 1, 1)); 244 AddItem(SName, 'Name', ctEdit, True, Bounds(3, 0, 1, 1)); 245 AddItem(SDay, 'Day', ctSpinEdit, True, Bounds(1, 1, 1, 1)); 246 AddItem(SMonth, 'Month', ctSpinEdit, True, Bounds(3, 1, 1, 1)); 247 AddItem(SYear, 'Year', ctSpinEdit, True, Bounds(1, 2, 1, 1)); 248 end; 249 Name := 'Holiday'; 250 Caption := SHoliday; 251 ImageIndex := 10; 252 end; 253 FormMain.RegisterDataViewForm(ViewFormHoliday); 254 255 ViewListOperation := TDataViewList.Create; 256 with ViewListOperation do begin 201 257 with Columns do begin 202 258 AddItem(SName, 'Name', True, 100); … … 207 263 ImageIndex := 13; 208 264 end; 209 DataViewLists.Add(NewDataView); 210 FormMain.RegisterDataViewList(NewDataView); 211 212 NewDataView := TDataViewList.Create; 213 with NewDataView do begin 265 FormMain.RegisterDataViewList(ViewListOperation); 266 ViewFormOperation := TDataViewForm.Create; 267 with ViewFormOperation do begin 268 with Items do begin 269 AddItem(SName, 'Name', ctEdit, True, Bounds(1, 0, 1, 1)); 270 AddItem(SKeyNumber, 'KeyId', ctEdit, True, Bounds(3, 0, 1, 1)); 271 end; 272 Name := 'Operation'; 273 Caption := SOperation; 274 ImageIndex := 13; 275 end; 276 FormMain.RegisterDataViewForm(ViewFormOperation); 277 278 ViewListTerminal := TDataViewList.Create; 279 with ViewListTerminal do begin 214 280 with Columns do begin 215 281 AddItem(SName, 'Name', True, 80); … … 224 290 ImageIndex := 8; 225 291 end; 226 DataViewLists.Add(NewDataView); 227 FormMain.RegisterDataViewList(NewDataView); 228 229 NewDataView := TDataViewList.Create; 230 with NewDataView do begin 292 FormMain.RegisterDataViewList(ViewListTerminal); 293 ViewFormTerminal := TDataViewForm.Create; 294 with ViewFormTerminal do begin 295 with Items do begin 296 AddItem(SName, 'Name', ctEdit, True, Bounds(1, 0, 1, 1)); 297 AddItem(SEnabled, 'Enabled', ctCheckBox, True, Bounds(3, 0, 1, 1)); 298 AddItem(SAddress, 'Address', ctEdit, True, Bounds(1, 1, 1, 1)); 299 AddItem(SPort, 'Port', ctSpinEdit, True, Bounds(3, 1, 1, 1)); 300 AddItem(SType, 'Type', ctComboBox, True, Bounds(1, 2, 1, 1)); 301 AddItem(SNote, 'Note', ctMemo, True, Bounds(3, 2, 1, 1)); 302 end; 303 Name := 'Terminal'; 304 Caption := STerminal; 305 ImageIndex := 8; 306 end; 307 FormMain.RegisterDataViewForm(ViewFormTerminal); 308 309 ViewListLog := TDataViewList.Create; 310 with ViewListLog do begin 231 311 with Columns do begin 232 312 AddItem(STime, 'Time', True, 120); … … 238 318 ImageIndex := 11; 239 319 end; 240 DataViewLists.Add(NewDataView); 241 FormMain.RegisterDataViewList(NewDataView); 320 FormMain.RegisterDataViewList(ViewListLog); 321 ViewFormLog := TDataViewForm.Create; 322 with ViewFormLog do begin 323 with Items do begin 324 AddItem(STime, 'Time', ctDateTime, True, Bounds(1, 0, 1, 1)); 325 AddItem(SUser, 'User', ctReference, True, Bounds(3, 0, 1, 1)); 326 AddItem(SText, 'Text', ctEdit, True, Bounds(1, 1, 1, 1)); 327 end; 328 Name := 'Log'; 329 Caption := SLog; 330 ImageIndex := 11; 331 end; 332 FormMain.RegisterDataViewForm(ViewFormLog); 242 333 end; 243 334 … … 247 338 Application.Title := SAttendance; 248 339 FormMain.Caption := SAttendance; 249 DataViewLists := TListObject.Create;250 DataViewForms := TListObject.Create;251 340 DataModuleAttendance := TDataModuleAttendance.Create(FormMain); 252 341 InitModels; … … 257 346 I: Integer; 258 347 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); 348 FormMain.UnregisterDataViewList(ViewListUser); 349 FormMain.UnregisterDataViewForm(ViewFormUser); 350 FormMain.UnregisterDataViewList(ViewListAttendance); 351 FormMain.UnregisterDataViewForm(ViewFormAttendance); 352 FormMain.UnregisterDataViewList(ViewListHoliday); 353 FormMain.UnregisterDataViewForm(ViewFormHoliday); 354 FormMain.UnregisterDataViewList(ViewListLog); 355 FormMain.UnregisterDataViewForm(ViewFormLog); 356 FormMain.UnregisterDataViewList(ViewListOperation); 357 FormMain.UnregisterDataViewForm(ViewFormOperation); 358 FormMain.UnregisterDataViewList(ViewListPassage); 359 FormMain.UnregisterDataViewForm(ViewFormPassage); 360 FormMain.UnregisterDataViewList(ViewListTerminal); 361 FormMain.UnregisterDataViewForm(ViewFormTerminal); 265 362 FreeAndNil(DataModuleAttendance); 266 363 inherited DoStop; -
trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas
r4 r15 90 90 function MySQLStrToFloat(S: string): Real; 91 91 function SQLToDateTime(Value: string): TDateTime; 92 function SQLToTime(Value: string): TDateTime; 92 93 function DateTimeToSQL(Value: TDateTime): string; 93 94 … … 175 176 end; 176 177 178 function SQLToTime(Value: string): TDateTime; 179 var 180 TimeParts: TListString; 181 begin 182 try 183 TimeParts := TListString.Create; 184 TimeParts.Explode(Value, ':', StrToStr); 185 Result := Result + EncodeTime(StrToInt(TimeParts[0]), StrToInt(TimeParts[1]), 186 StrToInt(TimeParts[2]), 0); 187 finally 188 TimeParts.Free; 189 end; 190 end; 191 177 192 { TSqlDatabase } 178 193
Note:
See TracChangeset
for help on using the changeset viewer.