Subversion Repositories delphiutils

Rev

Rev 83 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 83 Rev 88
Line 198... Line 198...
198
end;
198
end;
199
 
199
 
200
procedure TForm1.ReorgAll;
200
procedure TForm1.ReorgAll;
201
var
201
var
202
  saldo: integer;
202
  saldo: integer;
203
  baks: string;
203
  baks, baku: string;
204
  bakEv: TDataSetNotifyEvent;
204
  bakEv: TDataSetNotifyEvent;
205
  dead: boolean;
205
  dead: boolean;
206
begin
206
begin
207
  if ADOTable1TAG.IsNull then
207
  if ADOTable1TAG.IsNull then
208
  begin
208
  begin
Line 213... Line 213...
213
    if Copy(ADOTable1TAG.AsString, 5, 1) = '-' then
213
    if Copy(ADOTable1TAG.AsString, 5, 1) = '-' then
214
      baks := ADOTable1TAG.AsString
214
      baks := ADOTable1TAG.AsString
215
    else
215
    else
216
      DateTimeToString(baks, 'YYYY-MM-DD', ADOTable1TAG.AsDateTime);
216
      DateTimeToString(baks, 'YYYY-MM-DD', ADOTable1TAG.AsDateTime);
217
  end;
217
  end;
-
 
218
  baku := ADOTable1USERNAME.AsString;
218
  ADOTable1.Requery();
219
  ADOTable1.Requery();
219
 
220
 
220
  bakEv := ADOTable1.AfterPost;
221
  bakEv := ADOTable1.AfterPost;
221
  ADOTable1.AfterPost := nil;
222
  ADOTable1.AfterPost := nil;
222
  ADOTable1.DisableControls;
223
  ADOTable1.DisableControls;
Line 241... Line 242...
241
      end;
242
      end;
242
      ADOTable1.Post;
243
      ADOTable1.Post;
243
      ADOTable1.Next;
244
      ADOTable1.Next;
244
    end;
245
    end;
245
  finally
246
  finally
246
    if baks <> '' then ADOTable1.Locate('USERNAME;TAG', VarArrayOf([WUserName, baks]), []);
247
    if baks <> '' then ADOTable1.Locate('USERNAME;TAG', VarArrayOf([baku, baks]), []);
247
    ADOTable1.AfterPost := bakEv;
248
    ADOTable1.AfterPost := bakEv;
248
    ADOTable1.EnableControls;
249
    ADOTable1.EnableControls;
249
  end;
250
  end;
250
end;
251
end;
251
 
252
 
Line 371... Line 372...
371
procedure TForm1.ADOTable1NewRecord(DataSet: TDataSet);
372
procedure TForm1.ADOTable1NewRecord(DataSet: TDataSet);
372
var
373
var
373
  test: TADOQuery;
374
  test: TADOQuery;
374
begin
375
begin
375
  ADOTable1FREIER_TAG.AsBoolean := false;
376
  ADOTable1FREIER_TAG.AsBoolean := false;
376
  ADOTable1USERNAME.AsString := WUserName;
377
  ADOTable1USERNAME.AsString := ComboBox1.Text;
377
  test := TADOQuery.Create(nil);
378
  test := TADOQuery.Create(nil);
378
  try
379
  try
379
    test.Connection := ADOConnection1;
380
    test.Connection := ADOConnection1;
380
    test.Close;
381
    test.Close;
381
    test.SQL.Text := 'select * from TAGE where TAG = ''' + DateToStr(Date) + ''' and USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
382
    test.SQL.Text := 'select * from TAGE where TAG = ''' + DateToStr(Date) + ''' and USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
Line 552... Line 553...
552
  ADOTable1.Active := true;
553
  ADOTable1.Active := true;
553
 
554
 
554
  ReorgAll;
555
  ReorgAll;
555
 
556
 
556
  ADOTable1.Active := false;
557
  ADOTable1.Active := false;
557
  ADOTable1.ReadOnly := ComboBox1.Text <> WUserName;
558
  ADOTable1.ReadOnly := (ComboBox1.Text <> WUserName) and (WUserName <> 'Administrator');
558
  ADOTable1.Active := true;
559
  ADOTable1.Active := true;
559
 
560
 
560
  ADOTable1.Last;
561
  ADOTable1.Last;
561
  Button1.Enabled := not ADOTable1.ReadOnly;
562
  Button1.Enabled := not ADOTable1.ReadOnly;
562
 
563
 
Line 581... Line 582...
581
procedure TForm1.FormShow(Sender: TObject);
582
procedure TForm1.FormShow(Sender: TObject);
582
var
583
var
583
  test: TADOQuery;
584
  test: TADOQuery;
584
  ini: TMemIniFile;
585
  ini: TMemIniFile;
585
resourcestring
586
resourcestring
586
  DefaultConnectionString = 'Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Zeiterfassung;' +
587
  DefaultConnectionString = 'Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ZEITERFASSUNG;' +
587
                            'Data Source=SHS\FiVe,49007;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MARSCHALL;Use Encryption for Data=False;Tag with column collation when possible=False;';
588
                            'Data Source=SHS\CORA2017,49011;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MARSCHALL;Use Encryption for Data=False;Tag with column collation when possible=False;';
588
begin
589
begin
589
  ini := TMemIniFile.Create(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + ChangeFileExt(ExtractFileName(ParamStr(0)), '.ini'));
590
  ini := TMemIniFile.Create(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + ChangeFileExt(ExtractFileName(ParamStr(0)), '.ini'));
590
  try
591
  try
591
    ADOConnection1.ConnectionString := ini.ReadString('Connection', 'ConnectionString', DefaultConnectionString);
592
    ADOConnection1.ConnectionString := ini.ReadString('Connection', 'ConnectionString', DefaultConnectionString);
592
  finally
593
  finally
Line 611... Line 612...
611
    test.Free;
612
    test.Free;
612
  end;
613
  end;
613
 
614
 
614
  if ComboBox1.Items.IndexOf(WUserName) = -1 then
615
  if ComboBox1.Items.IndexOf(WUserName) = -1 then
615
    ComboBox1.Items.Add(WUserName);
616
    ComboBox1.Items.Add(WUserName);
616
 
-
 
617
  ComboBox1.Sorted := true;
617
  ComboBox1.Sorted := true;
618
 
-
 
619
  ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(WUserName);
618
  ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(WUserName);
620
 
619
 
621
  ComboBox1Change(ComboBox1);
620
  ComboBox1Change(ComboBox1);
622
  {$ENDREGION}
621
  {$ENDREGION}
623
 
622