Changeset 17
- Timestamp:
- Nov 15, 2012, 2:56:05 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormEdit.pas
r16 r17 139 139 W := 130; 140 140 H := 24; 141 for I := PanelControls.ControlCount - 1 downto 0 do 142 PanelControls.Controls[I].Free; 141 143 for I := 0 to View.Items.Count - 1 do 142 144 with TFormItem(View.Items[I]) do begin … … 232 234 NewControl := TDateEdit.Create(Self); 233 235 NewControl.Parent := PanelControls; 234 TDateEdit(NewControl).Date := SQLToDate Time(Values.Values[Name]);236 TDateEdit(NewControl).Date := SQLToDate(Values.Values[Name]); 235 237 NewControl.SetBounds(Rect.Left * W, Rect.Top * H, 236 238 (Rect.Right - Rect.Left) * W - TEditButton(NewControl).Button.Width, (Rect.Bottom - Rect.Top) * H); … … 269 271 with TFormItem(View.Items[I]) do begin 270 272 case ControlType of 271 ctSpinEdit, ctDate, ctTime, ctDateTime, ctReference: Values.Add(Name, '0'); 273 ctCheckBox, ctSpinEdit, ctReference: Values.Add(Name, '0'); 274 ctDateTime: Values.Add(Name, '0000-00-00 00:00:00'); 275 ctDate: Values.Add(Name, '0000-00-00'); 276 ctTime: Values.Add(Name, '00:00:00'); 272 277 else Values.Add(Name, ''); 273 278 end; -
trunk/Languages/Dochazka.cs.po
r16 r17 13 13 #: tdatamoduleattendance.areadfromterminal.caption 14 14 msgid "Read from terminal" 15 msgstr " "15 msgstr "ÄÃst z terminálu" 16 16 17 17 #: tdatamoduleattendance.areadfromterminal.hint 18 18 msgid "Read new data from terminal" 19 msgstr " "19 msgstr "ÄÃst nová data z terminálu" 20 20 21 21 #: tform1.actionexit.caption … … 257 257 #: uformedit.sitemnotfound 258 258 msgid "Item not found" 259 msgstr " "259 msgstr "PoloÅŸka nenalezena" 260 260 261 261 #: uformlist.sadditem 262 262 msgid "Add item" 263 msgstr " "263 msgstr "PÅidat poloÅŸku" 264 264 265 265 #: uformlist.sdoyouwanttodeleteitem … … 571 571 msgid "Year" 572 572 msgstr "Rok" 573 -
trunk/Modules/Attendance/UModuleAttendance.pas
r16 r17 183 183 with ViewFormPassage do begin 184 184 with Items do begin 185 AddItem(STime, 'Time', ctDate , True, Bounds(1, 0, 1, 1));185 AddItem(STime, 'Time', ctDateTime, True, Bounds(1, 0, 1, 1)); 186 186 with AddItem(SUser, 'User', ctReference, True, Bounds(3, 0, 1, 1)) do 187 187 ReferencedTable := 'User'; -
trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas
r16 r17 91 91 function SQLToDateTime(Value: string): TDateTime; 92 92 function SQLToTime(Value: string): TDateTime; 93 function SQLToDate(Value: string): TDateTime; 93 94 function DateTimeToSQL(Value: TDateTime): string; 94 95 function TimeToSQL(Value: TDateTime): string; … … 173 174 end; 174 175 176 function SQLToDate(Value: string): TDateTime; 177 var 178 DateParts: TListString; 179 Date: TDateTime; 180 begin 181 try 182 DateParts := TListString.Create; 183 DateParts.Explode(Value, '-', StrToStr); 184 if TryEncodeDate(StrToInt(DateParts[0]), StrToInt(DateParts[1]), 185 StrToInt(DateParts[2]), Date) then 186 Result := Date else Result := 0; 187 finally 188 DateParts.Free; 189 end; 190 end; 191 175 192 function DateTimeToSQL(Value: TDateTime): string; 176 193 begin 177 Result := FormatDateTime('yyyy-mm-dd hh .nn.ss', Value);194 Result := FormatDateTime('yyyy-mm-dd hh:nn:ss', Value); 178 195 end; 179 196 180 197 function TimeToSQL(Value: TDateTime): string; 181 198 begin 182 Result := FormatDateTime('hh .nn.ss', Value);199 Result := FormatDateTime('hh:nn:ss', Value); 183 200 end; 184 201 … … 191 208 var 192 209 TimeParts: TListString; 210 Time: TDateTime; 193 211 begin 194 212 try 195 213 TimeParts := TListString.Create; 196 214 TimeParts.Explode(Value, ':', StrToStr); 197 Result := Result + EncodeTime(StrToInt(TimeParts[0]), StrToInt(TimeParts[1]), 198 StrToInt(TimeParts[2]), 0); 215 if TryEncodeTime(StrToInt(TimeParts[0]), StrToInt(TimeParts[1]), 216 StrToInt(TimeParts[2]), 0, time) then 217 Result := Time else Result := 0; 199 218 finally 200 219 TimeParts.Free;
Note:
See TracChangeset
for help on using the changeset viewer.