Procedure

TfrmRemDlg.ClearMHTest

Module

fReminderDialog

Last Modified

7/15/2014 3:26:38 PM

Visibility

Protected

Owner

TfrmRemDlg

Declaration

procedure ClearMHTest(Rien: string);

Calls Hierarchy


TfrmRemDlg.ClearMHTest
 ├TReminderDialog.GetIEN
 └RemoveMHTest
   ├LoadMHDLL
   └UnloadMHDLL

Called-By Hierarchy


    TfrmRemDlg.ClearMHTest
TfrmRemDlg.btnClearClick┘ 

Calls

Name Declaration Comments
TReminderDialog.GetIEN function GetIEN: string; virtual; -
RemoveMHTest procedure RemoveMHTest(TestName: string); -

Called-By

Name Declaration Comments
TfrmRemDlg.btnClearClick procedure btnClearClick(Sender: TObject); -


Source

470   procedure TfrmRemDlg.ClearMHTest(Rien: string);
471   var
472   MHKillArray: TStringList;
473   i,idx, j: integer;
474   TestName: string;
475   begin
476     MHKillArray := TStringList.Create;
477     idx := RemindersInProcess.IndexOf(RIEN);
478     //Find All MH Test in the current Reminders and stored them in a temp Array
479     if idx > -1 then
480       begin
481          if (TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray <> nil) and
482          (TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray.Count > 0) then
483            begin
484              for j := 0 to TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray.Count - 1 do
485                begin
486                  TestName := Piece(TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray.Strings[j], U, 1);
487                  //TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray.Delete(j);
488                  MHKillArray.Add(TestName);
489                end;
490            end;
491          if Assigned(TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray) then
492             TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray.Free;
493         (* if (TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray <> nil) and
494          (TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray.Count = 0) then
495             TReminderDialog(TReminder(RemindersInProcess.Objects[idx])).MHTestArray.Free; *)
496       end;
497     //Check to see if other reminders contains any of the MH test in the temp Array if so set entry to null
498     if (MHKillArray.Count > 0) and (RemindersInProcess.Count > 1) then
499       begin
500         for I := 0 to RemindersInProcess.Count - 1 do
501           begin
502             if (TReminderDialog(TReminder(RemindersInProcess.Objects[i])).IEN <> RIEN) and
503                (TReminderDialog(TReminder(RemindersInProcess.Objects[i])).MHTestArray <> nil) and
504                (TReminderDialog(TReminder(RemindersInProcess.Objects[i])).MHTestArray.Count > 0) then
505                  begin
506                     for j := 0 to TReminderDialog(TReminder(RemindersInProcess.Objects[i])).MHTestArray.Count - 1 do
507                       begin
508                         TestName := Piece(TReminderDialog(TReminder(RemindersInProcess.Objects[i])).MHTestArray.Strings[j], U, 1);
509                         idx := MHKillArray.IndexOf(TestName);
510                         if idx > -1 then MHKillArray.Strings[idx] := '';
511                       end;
512                  end;
513           end;
514       end;
515     //Delete the temp file stored in the MH dll for any MH tests names left in the temp array
516     if MHKillArray.Count > 0 then
517       begin
518         for I := 0 to MHKillArray.Count - 1 do
519           begin
520             if MHKillArray.Strings[i] <> '' then RemoveMHTest(MHKillArray.Strings[i]);
521           end;
522       end;
523     if Assigned(MHKillArray) then FreeandNil(MHKillArray);
524   end;