Esempio n. 1
0
        private void ShowInReportAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            var reportStorage = ReportStorage.GetInstance(SecuritySystem.CurrentUserName);

            reportStorage.Dokument     = e.SelectedObjects[0] as IDokumentPdf;
            reportStorage.PacjentEmail = "Email";
        }
        public override DocumentOperationResponse PerformOperation(DocumentOperationRequest request, PrintingSystemBase initialPrintingSystem, PrintingSystemBase printingSystemWithEditingFields)
        {
            userName = request.CustomData;

            var reportStorage = ReportStorage.GetInstance(userName);

            objectSpace = reportStorage.Application.CreateObjectSpace();

            var dokumentPdf  = objectSpace.GetObject(reportStorage.Dokument);
            var memoryStream = new MemoryStream();

            printingSystemWithEditingFields.ExportToPdf(memoryStream);
            memoryStream.Seek(0, SeekOrigin.Begin);
            reportStorage.MemoryStream = memoryStream;

            if (memoryStream != null)
            {
                if (memoryStream.Length > 0)
                {
                    if (dokumentPdf.DokumentPdf is null)
                    {
                        dokumentPdf.DokumentPdf = objectSpace.CreateObject <FileData>();
                    }
                    dokumentPdf.DokumentPdf.LoadFromStream($"Dokument.Pdf", memoryStream);

                    //var emailService = new EmailService("email", "password");
                    //emailService.SendEmail(memoryStream, dokumentPdf.PacjentEmail);
                    objectSpace.CommitChanges();
                }
            }

            return(base.PerformOperation(request, initialPrintingSystem, printingSystemWithEditingFields));
        }
        public void CustomizeReportViewerViewItem(ReportWebViewerDetailItem reportWebViewerDetailItem)
        {
            ReportStorage.GetInstance(SecuritySystem.CurrentUserName).Application = Application;
            var item = reportWebViewerDetailItem;

            item.ReportViewer.ClientSideEvents.CustomizeMenuActions = "onCustomizeMenuActions";
            item.ReportViewer.ClientSideEvents.CustomizeMenuActions = @"function(s,e) {
                e.Actions.push({  
                    text: 'Wyślij dokument',  
                    imageClassName: 'custom-image',  
                    disabled: ko.observable(false),  
                    visible: true,
                    hasSeparator: true,
                    clickAction: function() { s.PerformCustomDocumentOperation('" + SecuritySystem.CurrentUserName + "'); }});}";
        }