using System.Linq; using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Text.RegularExpressions; using BeWo.Report.ReportObjects; using BS.Shared.Core; using DevExpress.XtraReports.UI; using BeWo.Report; namespace BeWo.BeWoAmrath { public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public Stundenzettel() { InitializeComponent(); } public void SetReportDataSource(ServicesOverviewRO pRO) { if (pRO.Services != null) { var servicesBillable = pRO.Services.Where(s => s.IsBillable).ToList(); foreach (var sd in servicesBillable) { ServicesOverviewRO.CreateSignatureString(sd); if (sd.ServiceDescription.ToLower().Contains("fehlkontakt")) { sd.Notice5 = "F - " + sd.Notice; } } pRO.Services = servicesBillable; } bindingSource1.DataSource = pRO; } private void picSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e) { XRPictureBox xrBox = sender as XRPictureBox; //var test = this.GetCurrent string base64String = xrBox.Tag as string; if (!String.IsNullOrWhiteSpace(base64String)) { var base64Data = Regex.Match(base64String, @"data:image/(?.+?),(?.+)").Groups["data"].Value; var binData = Convert.FromBase64String(base64Data); Image img = ByteArrayToImage(binData); xrBox.Image = Utils.CropImage(img); } else { xrBox.Image = null; } } public Image ByteArrayToImage(byte[] byteArrayIn) { using (var memoryStream = new MemoryStream(byteArrayIn)) { return Image.FromStream(memoryStream); } } } }