Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure MakeInvoiceClick(Sender: TObject)
- begin
- if MakeInvoice(SelectedParcelList) then
- UpDateParcels(SelectedParcelList)
- else
- ShowMessage('Make invoice failed');
- end;
- function MakeInvoice(ASelectedParcelList: TParcelList): Boolean;
- var
- oParcel: TParcel;
- begin
- for oParcel in ASelectedParcelList do
- begin
- if oParcel.Electronic then
- Result := MakeEInvoice(oParcel)
- else if oParcel.MailByPDF then
- Result := MakePDFInvoice(oParcel);
- end;
- end;
- function MakePDFInvoice(AParcel: TParcel): Boolean
- var
- oPDF: string;
- begin
- oPDF := MakePDF(AParcel);
- Result := Mail.SendWait(UserData, oPDF);
- end;
- function TMail.SendWait(AUserData: TUSerData; const APDF: string): Boolean;
- begin
- if GetSetting.UseSendGrid then
- Result := SendMailWithGrid(AUserData, APDF) // <-- Blocking
- else if GetSetting.UseOutLook then
- Result := SendMailWithOutLook(AUserData, APDF) // <-- None blocking
- else if GetSetting.UseSMTP then
- Result := SendMailWithSMTP(AUserData, APDF); // <-- Blocking
- end
- function TMail.SendWaitWithOutLook(AUserData: TUSerData; const APDF: string): Boolean;
- begin
- InitAuthentication;
- Connect;
- end;
- // Event called after successful authentication and Connect
- procedure TMail.Connected(Sender: TObject);
- begin
- ConfigureEmail;
- SendEmailMessage(UserData, Attachement);
- end;
- // Event called after successful send an email
- procedure TMail.MessageSent(Sender: TObject; ARequestResult: TMailResult);
- begin
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement