Changeset 15


Ignore:
Timestamp:
Nov 15, 2012, 12:34:33 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Doplněno zobrazení formuláře pro úpravu všech tabulek docházky.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Dochazka.lpi

    r14 r15  
    101101      </Item7>
    102102    </RequiredPackages>
    103     <Units Count="13">
     103    <Units Count="14">
    104104      <Unit0>
    105105        <Filename Value="Dochazka.lpr"/>
     
    183183        <IsPartOfProject Value="True"/>
    184184        <ComponentName Value="DataModuleAttendance"/>
     185        <HasResources Value="True"/>
    185186        <ResourceBaseClass Value="DataModule"/>
    186187        <UnitName Value="UModuleAttendance"/>
    187188      </Unit12>
     189      <Unit13>
     190        <Filename Value="Application/UDataModel.pas"/>
     191        <IsPartOfProject Value="True"/>
     192        <UnitName Value="UDataModel"/>
     193      </Unit13>
    188194    </Units>
    189195  </ProjectOptions>
  • trunk/Dochazka.lpr

    r14 r15  
    1111  CoolTranslator, UFormSetting, SysUtils, UFormList, UFormEdit, UDataView,
    1212  URegistredModules, TemplateGenerics, synapse, UFormConnection,
    13 UModuleAttendance
     13UModuleAttendance, UDataModel
    1414  { you can add units after this };
    1515
  • trunk/Forms/UFormEdit.lfm

    r10 r15  
    11object FormEdit: TFormEdit
    2   Left = 383
     2  Left = 368
    33  Height = 341
    44  Top = 172
    5   Width = 538
     5  Width = 553
    66  Caption = 'Edit item'
    77  ClientHeight = 341
    8   ClientWidth = 538
     8  ClientWidth = 553
    99  OnCreate = FormCreate
    1010  OnDestroy = FormDestroy
    1111  LCLVersion = '1.1'
    1212  object ButtonOk: TButton
    13     Left = 456
     13    Left = 471
    1414    Height = 25
    1515    Top = 305
     
    2121  end
    2222  object ButtonCancel: TButton
    23     Left = 368
     23    Left = 383
    2424    Height = 25
    2525    Top = 305
     
    3434    Height = 2
    3535    Top = 297
    36     Width = 523
     36    Width = 538
    3737    Anchors = [akLeft, akRight, akBottom]
    3838  end
    3939  object PanelControls: TPanel
    40     Left = 4
    41     Height = 473
    42     Top = 4
    43     Width = 530
     40    Left = 0
     41    Height = 290
     42    Top = 0
     43    Width = 553
    4444    Align = alTop
    4545    Anchors = [akTop, akLeft, akRight, akBottom]
    46     BorderSpacing.Around = 4
    4746    BevelOuter = bvNone
    4847    TabOrder = 2
  • trunk/Forms/UFormEdit.pas

    r10 r15  
    4848    ButtonOk: TButton;
    4949    ButtonCancel: TButton;
     50    CalcEdit1: TCalcEdit;
    5051    PanelControls: TPanel;
    5152    procedure FormCreate(Sender: TObject);
     
    244245      NewControl := TDateEdit.Create(Self);
    245246      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);
    249250      NewControl.Show;
    250251    end else
     
    252253      NewControl := TEdit.Create(Self);
    253254      NewControl.Parent := PanelControls;
    254       TEdit(NewControl).Text := TimeToStr(MySQLStrToFloat(Values.Values[Name]));
     255      TEdit(NewControl).Text := TimeToStr(SQLToTime(Values.Values[Name]));
    255256      NewControl.SetBounds(Rect.Left * W, Rect.Top * H,
    256257       (Rect.Right - Rect.Left) * W, (Rect.Bottom - Rect.Top) * H);
     
    258259    end else
    259260    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);
    271268      NewControl.Show;
    272269    end;
  • trunk/Languages/Dochazka.cs.po

    r14 r15  
    1111"X-Generator: Poedit 1.5.4\n"
    1212
     13#: tdatamoduleattendance.areadfromterminal.caption
     14msgid "Read from terminal"
     15msgstr ""
     16
     17#: tdatamoduleattendance.areadfromterminal.hint
     18msgid "Read new data from terminal"
     19msgstr ""
     20
    1321#: tform1.actionexit.caption
    1422msgctxt "tform1.actionexit.caption"
     
    549557msgid "Year"
    550558msgstr "Rok"
     559
  • trunk/Languages/Dochazka.po

    r14 r15  
    11msgid ""
    22msgstr "Content-Type: text/plain; charset=UTF-8"
     3
     4#: tdatamoduleattendance.areadfromterminal.caption
     5msgid "Read from terminal"
     6msgstr ""
     7
     8#: tdatamoduleattendance.areadfromterminal.hint
     9msgid "Read new data from terminal"
     10msgstr ""
    311
    412#: tform1.actionexit.caption
  • trunk/Modules/Attendance/UModuleAttendance.lfm

    r12 r15  
    55  VerticalOffset = 238
    66  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
    717end
  • trunk/Modules/Attendance/UModuleAttendance.pas

    r14 r15  
    77uses
    88  Classes, SysUtils, FileUtil, UModularSystem, UFormList, UFormEdit, Controls,
    9   SpecializedList, Forms;
     9  SpecializedList, Forms, ActnList, UDataModel;
    1010
    1111type
     12
     13  { TDataModuleAttendance }
     14
    1215  TDataModuleAttendance = class(TDataModule)
     16    AReadFromTerminal: TAction;
     17    ActionList1: TActionList;
     18    procedure AReadFromTerminalExecute(Sender: TObject);
    1319  private
    1420    { private declarations }
     
    2127  TModuleAttendance = class(TModule)
    2228  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;
    2550    procedure InitModels;
    2651  protected
     
    7499  SLog = 'Log';
    75100
     101{ TDataModuleAttendance }
     102
     103procedure TDataModuleAttendance.AReadFromTerminalExecute(Sender: TObject);
     104begin
     105
     106end;
     107
    76108
    77109{ TModuleAttendance }
     
    81113  NewDataView: TDataViewList;
    82114  NewDataView2: TDataViewForm;
    83 begin
    84   NewDataView := TDataViewList.Create;
    85   with NewDataView do begin
     115  NewModel: TDataModel;
     116begin
     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
    86135    with Columns do begin
    87136      AddItem(SEnabled, 'Enabled', True, 30);
     
    99148    ImageIndex := 9;
    100149  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
    105153    Name := 'User';
    106154    Caption := SUser;
     
    117165    end;
    118166  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
    124171    with Columns do begin
    125172      AddItem(STime, 'Time', True, 150);
     
    132179    ImageIndex := 12;
    133180  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
    138184    with Items do begin
    139185      AddItem(STime, 'Time', ctDate, True, Bounds(0, 0, 1, 1));
     
    149195    ImageIndex := 12;
    150196  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
    156201    with Columns do begin
    157202      AddItem(SDate, 'Date', True, 80);
     
    164209    ImageIndex := 14;
    165210  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
    170214    with Items do begin
    171215      AddItem(SUser, 'User', ctReference, True, Bounds(1, 0, 1, 1));
     
    178222    ImageIndex := 14;
    179223  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
    185228    with Columns do begin
    186229      AddItem(SEnabled, 'Enabled', True, 30);
     
    194237    ImageIndex := 10;
    195238  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
    201257    with Columns do begin
    202258      AddItem(SName, 'Name', True, 100);
     
    207263    ImageIndex := 13;
    208264  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
    214280    with Columns do begin
    215281      AddItem(SName, 'Name', True, 80);
     
    224290    ImageIndex := 8;
    225291  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
    231311    with Columns do begin
    232312      AddItem(STime, 'Time', True, 120);
     
    238318    ImageIndex := 11;
    239319  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);
    242333end;
    243334
     
    247338  Application.Title := SAttendance;
    248339  FormMain.Caption := SAttendance;
    249   DataViewLists := TListObject.Create;
    250   DataViewForms := TListObject.Create;
    251340  DataModuleAttendance := TDataModuleAttendance.Create(FormMain);
    252341  InitModels;
     
    257346  I: Integer;
    258347begin
    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);
    265362  FreeAndNil(DataModuleAttendance);
    266363  inherited DoStop;
  • trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas

    r4 r15  
    9090  function MySQLStrToFloat(S: string): Real;
    9191  function SQLToDateTime(Value: string): TDateTime;
     92  function SQLToTime(Value: string): TDateTime;
    9293  function DateTimeToSQL(Value: TDateTime): string;
    9394
     
    175176end;
    176177
     178function SQLToTime(Value: string): TDateTime;
     179var
     180  TimeParts: TListString;
     181begin
     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;
     190end;
     191
    177192{ TSqlDatabase }
    178193
Note: See TracChangeset for help on using the changeset viewer.