/// <summary> /// Emails the report as PDF action. /// </summary> /// <param name="_viewTag">The view tag.</param> /// <param name="action">The action.</param> public override void EmailReportAsPdfAction(int _viewTag, Menu action) { #if PORTING if (!reportFileName && ((UPWebContentMetadataClientReport)this.WebContentMetadata).PdfFileName) { reportFileName = this.CalcReportFileName(); } reportFileName = reportFileName ? reportFileName : "report.pdf"; UPMail mail = UPMail.TheNew(); if (action != null) { ViewReference sendEmailActionViewReference = action.ViewReference(); sendEmailActionViewReference = sendEmailActionViewReference.ViewReferenceWithRecordIdentification(recordIdentification); bool attachReport = "true".CompareOptions(viewReference.ContextValueForKey("SendByEmailAttachReport"), NSCaseInsensitiveSearch) == NSOrderedSame; string fieldGroup = sendEmailActionViewReference.ContextValueForKey("EmailFieldgroup"); string recordId = sendEmailActionViewReference.ContextValueForKey("RecordId"); mail.FillFromEmailTemplateFieldGroupForRecord(fieldGroup, recordId); if (attachReport) { NSData pdfDataOut = this.CreatePdfData(_viewTag); mail.AddAttachment(new UPMailAttachment(pdfDataOut, "application/pdf", reportFileName)); } } else { NSData pdfDataOut = this.CreatePdfData(_viewTag); string title = this.ParentOrganizerModelController.Organizer.TitleText; mail.Subject = NSString.StringWithFormat(upText_OrderReportEmailSubject, title); mail.AddAttachment(new UPMailAttachment(pdfDataOut, "application/pdf", reportFileName)); } this.ModelControllerDelegate.SendMailModal(mail, true); #endif }
/// <summary> /// Sends the report. /// </summary> /// <param name="xmlString">The XML string.</param> public void SendReport(string xmlString) { #if PORTING UPMail mail = new UPMail(); mail.Subject = "Sync-conflict reports"; mail.AddRecipient(((UPMSyncConflictsPage)this.Page).SyncConflictEmail); string filename = $"SyncConflicts_{ServerSession.CurrentSession().UserName}_{StringExtensions.CrmValueFromDate(DateTime.UtcNow)}.xml"; UPMailAttachment attachment = new UPMailAttachment(xmlString, "application/xml", filename); mail.AddAttachment(attachment); this.ModelControllerDelegate.SendMailModal(mail, false); #endif }
/// <summary> /// Sends the report for offline request. /// </summary> /// <param name="request">The request.</param> void SendReportForOfflineRequest(UPOfflineRequest request) { #if PORTING string xmlData = request.Xml(); UPMail mail = new UPMail(); mail.Subject = NSString.StringWithFormat("SyncConflict from %@ at %@ of type %@", ServerSession.CurrentSession().UserName, request.ServerDateTime, request.ProcessType); mail.AddRecipient(((UPMSyncConflictsPage)this.Page).SyncConflictEmail); string filename = NSString.StringWithFormat("SyncConflict_%@_%@_%ld.xml", ServerSession.CurrentSession().UserName, request.ProcessType, request.RequestNr); UPMailAttachment attachment = new UPMailAttachment(xmlData, "application/xml", filename); mail.AddAttachment(attachment); this.ModelControllerDelegate.SendMailModal(mail, false); #endif }