source: cprs/branches/tmg-cprs/CPRS-Chart/fDefaultEvent.pas@ 1141

Last change on this file since 1141 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 5.2 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 7/15/2007
2unit fDefaultEvent;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 StdCtrls, ORCtrls, ExtCtrls, rOrders, ORFn, uCore, DKLang;
9
10type
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
37function ExcueteDefaultEvntSetting: string;
38
39var
40 frmDefaultEvent: TfrmDefaultEvent;
41
42implementation
43
44{$R *.DFM}
45
46function ExcueteDefaultEvntSetting: string;
47var
48 frmDefaultEvent: TfrmDefaultEvent;
49begin
50 frmDefaultEvent := TfrmDefaultEvent.Create(Application);
51 try
52 ResizeAnchoredFormToFont(frmDefaultEvent);
53 frmDefaultEvent.ShowModal;
54 Result := frmDefaultEvent.FDefaultEvtName;
55 finally
56 frmDefaultEvent.Free;
57 end;
58end;
59
60procedure TfrmDefaultEvent.btnCancelClick(Sender: TObject);
61begin
62 Close;
63end;
64
65procedure TfrmDefaultEvent.FormCreate(Sender: TObject);
66var
67 i : integer;
68begin
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;
89end;
90
91procedure TfrmDefaultEvent.SetupVars;
92//kt Added entire function to replace constant declarations 7/15/2007
93begin
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_');
98end;
99
100
101procedure 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
106var
107 errMsg: string;
108begin
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;
149end;
150
151end.
Note: See TracBrowser for help on using the repository browser.