[453] | 1 | //kt -- Modified with SourceScanner on 7/15/2007
|
---|
| 2 | unit fDefaultEvent;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
| 6 | uses
|
---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 8 | StdCtrls, ORCtrls, ExtCtrls, rOrders, ORFn, uCore, DKLang;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 11 | TfrmDefaultEvent = class(TForm)
|
---|
| 12 | pnlTop: TPanel;
|
---|
| 13 | lblCaption: TLabel;
|
---|
| 14 | cboEvents: TORComboBox;
|
---|
| 15 | pnlBottom: TPanel;
|
---|
| 16 | btnOK: TButton;
|
---|
| 17 | btnCancel: TButton;
|
---|
| 18 | DKLanguageController1: TDKLanguageController;
|
---|
| 19 | procedure btnCancelClick(Sender: TObject);
|
---|
| 20 | procedure FormCreate(Sender: TObject);
|
---|
| 21 | procedure btnOKClick(Sender: TObject);
|
---|
| 22 | private
|
---|
| 23 | //kt Begin Mod (change Consts to Vars) 7/15/2007
|
---|
| 24 | TXT_1 : string; //kt
|
---|
| 25 | TXT_2 : string; //kt
|
---|
| 26 | TXT_3 : string; //kt
|
---|
| 27 | //kt End Mod -------------------
|
---|
| 28 | OKPressed: boolean;
|
---|
| 29 | FDefaultEvtName: string;
|
---|
| 30 | FPreDefaultEvtID: string;
|
---|
| 31 | FPreDefaultEvtName: string;
|
---|
| 32 | procedure SetupVars; //kt 7-15-07
|
---|
| 33 | public
|
---|
| 34 | { Public declarations }
|
---|
| 35 | end;
|
---|
| 36 |
|
---|
| 37 | function ExcueteDefaultEvntSetting: string;
|
---|
| 38 |
|
---|
| 39 | var
|
---|
| 40 | frmDefaultEvent: TfrmDefaultEvent;
|
---|
| 41 |
|
---|
| 42 | implementation
|
---|
| 43 |
|
---|
| 44 | {$R *.DFM}
|
---|
| 45 |
|
---|
| 46 | function ExcueteDefaultEvntSetting: string;
|
---|
| 47 | var
|
---|
| 48 | frmDefaultEvent: TfrmDefaultEvent;
|
---|
| 49 | begin
|
---|
| 50 | frmDefaultEvent := TfrmDefaultEvent.Create(Application);
|
---|
| 51 | try
|
---|
| 52 | ResizeAnchoredFormToFont(frmDefaultEvent);
|
---|
| 53 | frmDefaultEvent.ShowModal;
|
---|
| 54 | Result := frmDefaultEvent.FDefaultEvtName;
|
---|
| 55 | finally
|
---|
| 56 | frmDefaultEvent.Free;
|
---|
| 57 | end;
|
---|
| 58 | end;
|
---|
| 59 |
|
---|
| 60 | procedure TfrmDefaultEvent.btnCancelClick(Sender: TObject);
|
---|
| 61 | begin
|
---|
| 62 | Close;
|
---|
| 63 | end;
|
---|
| 64 |
|
---|
| 65 | procedure TfrmDefaultEvent.FormCreate(Sender: TObject);
|
---|
| 66 | var
|
---|
| 67 | i : integer;
|
---|
| 68 | begin
|
---|
| 69 | FPreDefaultEvtID := '';
|
---|
| 70 | FPreDefaultEvtName := '';
|
---|
| 71 | FDefaultEvtName := '';
|
---|
| 72 | FPreDefaultEvtID := GetDefaultEvt(IntToStr(User.DUZ));
|
---|
| 73 | ListSpecialtiesED(#0,cboEvents.Items);
|
---|
| 74 | with cboEvents do
|
---|
| 75 | begin
|
---|
| 76 | for i := 0 to Items.Count - 1 do
|
---|
| 77 | begin
|
---|
| 78 | if FPreDefaultEvtID = Piece(Items[i],'^',1) then
|
---|
| 79 | begin
|
---|
| 80 | ItemIndex := i;
|
---|
| 81 | FPreDefaultEvtName := Piece(Items[i],'^',9);
|
---|
| 82 | if Length(FPreDefaultEvtName)<1 then
|
---|
| 83 | FPreDefaultEvtName := Piece(Items[i],'^',2);
|
---|
| 84 | break;
|
---|
| 85 | end;
|
---|
| 86 | end;
|
---|
| 87 | end;
|
---|
| 88 | OKPressed := False;
|
---|
| 89 | end;
|
---|
| 90 |
|
---|
| 91 | procedure TfrmDefaultEvent.SetupVars;
|
---|
| 92 | //kt Added entire function to replace constant declarations 7/15/2007
|
---|
| 93 | begin
|
---|
| 94 | SetupVars; //kt added 7/15/2007 to replace constants with vars.
|
---|
| 95 | TXT_1 := DKLangConstW('fDefaultEvent_Would_you_like_to_change_the_default_event_from_');
|
---|
| 96 | TXT_2 := DKLangConstW('fDefaultEvent__to_');
|
---|
| 97 | TXT_3 := DKLangConstW('fDefaultEvent_Would_you_like_set_your_default_event_to_');
|
---|
| 98 | end;
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | procedure TfrmDefaultEvent.btnOKClick(Sender: TObject);
|
---|
| 102 | //const
|
---|
| 103 | //TXT_1 = 'Would you like to change the default event from "'; <-- original line. //kt 7/15/2007
|
---|
| 104 | //TXT_2 = '" to "'; <-- original line. //kt 7/15/2007
|
---|
| 105 | //TXT_3 = 'Would you like set your default event to "'; <-- original line. //kt 7/15/2007
|
---|
| 106 | var
|
---|
| 107 | errMsg: string;
|
---|
| 108 | begin
|
---|
| 109 | if cboEvents.ItemIndex < 0 then
|
---|
| 110 | begin
|
---|
| 111 | // ShowMessage('You have to select an event first!'); <-- original line. //kt 7/15/2007
|
---|
| 112 | ShowMessage(DKLangConstW('fDefaultEvent_You_have_to_select_an_event_first')); //kt added 7/15/2007
|
---|
| 113 | Exit;
|
---|
| 114 | end;
|
---|
| 115 | if (Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1) <> FPreDefaultEvtID) and ( Length(FPreDefaultEvtID)>0 )then
|
---|
| 116 | begin
|
---|
| 117 | // if InfoBox(TXT_1 + FPreDefaultEvtName + TXT_2 + cboEvents.Text + '"?','Warning', MB_OKCANCEL or MB_ICONWARNING) = IDOK then <-- original line. //kt 7/15/2007
|
---|
| 118 | if InfoBox(TXT_1 + FPreDefaultEvtName + TXT_2 + cboEvents.Text + '"?',DKLangConstW('fDefaultEvent_Warning'), MB_OKCANCEL or MB_ICONWARNING) = IDOK then //kt added 7/15/2007
|
---|
| 119 | begin
|
---|
| 120 | errMsg := '';
|
---|
| 121 | SetDefaultEvent(errMsg, Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1));
|
---|
| 122 | if length(errMsg)>0 then
|
---|
| 123 | ShowMessage(errMsg)
|
---|
| 124 | else
|
---|
| 125 | // ShowMessage('The default release event "' + cboEvents.Text + '" has been set successfully!'); <-- original line. //kt 7/15/2007
|
---|
| 126 | ShowMessage(DKLangConstW('fDefaultEvent_The_default_release_event_') + cboEvents.Text + DKLangConstW('fDefaultEvent__has_been_set_successfully')); //kt added 7/15/2007
|
---|
| 127 | FDefaultEvtName := cboEvents.Text;
|
---|
| 128 | OKPressed := True;
|
---|
| 129 | Close;
|
---|
| 130 | end;
|
---|
| 131 | end
|
---|
| 132 | else if (Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1) <> FPreDefaultEvtID) and ( Length(FPreDefaultEvtID)=0 )then
|
---|
| 133 | begin
|
---|
| 134 | // if InfoBox(TXT_3 + cboEvents.Text + '"?','Warning', MB_OKCANCEL or MB_ICONWARNING) = IDOK then <-- original line. //kt 7/15/2007
|
---|
| 135 | if InfoBox(TXT_3 + cboEvents.Text + '"?',DKLangConstW('fDefaultEvent_Warning'), MB_OKCANCEL or MB_ICONWARNING) = IDOK then //kt added 7/15/2007
|
---|
| 136 | begin
|
---|
| 137 | errMsg := '';
|
---|
| 138 | SetDefaultEvent(errMsg, Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1));
|
---|
| 139 | if length(errMsg)>0 then
|
---|
| 140 | ShowMessage(errMsg)
|
---|
| 141 | else
|
---|
| 142 | // ShowMessage('The default release event "' + cboEvents.Text + '" has been set successfully!'); <-- original line. //kt 7/15/2007
|
---|
| 143 | ShowMessage(DKLangConstW('fDefaultEvent_The_default_release_event_') + cboEvents.Text + DKLangConstW('fDefaultEvent__has_been_set_successfully')); //kt added 7/15/2007
|
---|
| 144 | FDefaultEvtName := cboEvents.Text;
|
---|
| 145 | OKPressed := True;
|
---|
| 146 | Close;
|
---|
| 147 | end;
|
---|
| 148 | end;
|
---|
| 149 | end;
|
---|
| 150 |
|
---|
| 151 | end.
|
---|