AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Geburtstagsabfrage

Ein Thema von Walter Landwehr · begonnen am 23. Apr 2023 · letzter Beitrag vom 26. Apr 2023
Antwort Antwort
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.533 Beiträge
 
Delphi 12 Athens
 
#1

AW: Geburtstagsabfrage

  Alt 24. Apr 2023, 16:46
and not Geburtstagheute
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von Union
Union

Registriert seit: 18. Mär 2004
Ort: Luxembourg
3.492 Beiträge
 
Delphi 7 Enterprise
 
#2

AW: Geburtstagsabfrage

  Alt 24. Apr 2023, 16:52
and not Geburtstagheute
Wie peinlich
Ibi fas ubi proxima merces
sudo /Developer/Library/uninstall-devtools --mode=all
  Mit Zitat antworten Zitat
Delphi.Narium

Registriert seit: 27. Nov 2017
2.587 Beiträge
 
Delphi 7 Professional
 
#3

AW: Geburtstagsabfrage

  Alt 24. Apr 2023, 18:19
Wenn dann eher andersherum
if not Geburtstagheute and (CalcBirthday(Patient1Qry.FieldByName('GEBURTSDATUM').AsDateTime)) then
Dann können wir uns ggfls. auch noch die mehr oder weniger komplexe Berechnung in CalcBirthday sparen, jedenfalls dann, wenn boolsche Ausdrücke nicht vollständig ausgewertet werden müssen
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.533 Beiträge
 
Delphi 12 Athens
 
#4

AW: Geburtstagsabfrage

  Alt 24. Apr 2023, 19:28
Und auch das Doppelte rauswerfen.

Delphi-Quellcode:
if CalcBirthday(Patient1Qry.FieldByName('GEBURTSDATUM').AsDateTime) and (Geburtstagheute = False) then
    begin
      //lblAlter.Font.Color := clRed;
      MessageDlg('Patient / Klient / Kunde hat heute Geburtstag.?', mtConfirmation, [mbOK],0);
      Geburtstagheute := True;
    end
;
// else
// begin
      if CalcBirthday(Patient1Qry.FieldByName('GEBURTSDATUM').AsDateTime) then
        lblAlter.Font.Color := clRed
      else
        lblAlter.Font.Color := clBlack;
// end;
Im ersten IF ist etwas, was auch im 2. IF nochmal drin ist -> die Farbe.

Delphi-Quellcode:
HatGeburtstag := CalcBirthday(Patient1Qry.FieldByName('GEBURTSDATUM').AsDateTime);
if HatGeburtstag and not GeburtstagHeute then
  MessageDlg('Patient / Klient / Kunde hat heute Geburtstag?', mtConfirmation, [mbOK], 0);
GeburtstagHeute := True;

//if HatGeburtstag then
// lblAlter.Font.Color := clRed
//else
// lblAlter.Font.Color := clBlack;
lblAlter.Font.Color := IfThen(HatGeburtstag, clRed, clBlack);
2 Drittel weniger Code, nichts Mehrfach und vermutlich auch übersichtlicher/verständlicher.


wobei

Delphi-Quellcode:
HatGeburtstag := CalcBirthday(Patient1Qry.FieldByName('GEBURTSDATUM').AsDateTime);
//if HatGeburtstag and not GeburtstagHeute then GeburtstagHeute := MessageDlg('Patient / Klient / Kunde hat heute Geburtstag?', mtConfirmation, [mbClose,mbIgnore], 0) = mrIgnore;
//if HatGeburtstag then GeburtstagHeute := GeburtstagHeute or (MessageDlg('Patient / Klient / Kunde hat heute Geburtstag?', mtConfirmation, [mbClose,mbIgnore], 0) = mrIgnore);
GeburtstagHeute := GeburtstagHeute or (HatGeburtstag and (MessageDlg('Patient / Klient / Kunde hat heute Geburtstag?', mtConfirmation, [mbClose,mbIgnore], 0) = mrIgnore));
lblAlter.Font.Color := IfThen(HatGeburtstag, clRed, clBlack);
Ein Therapeut entspricht 1024 Gigapeut.

Geändert von himitsu (24. Apr 2023 um 19:34 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz