using System; using BeWo.Report.ReportObjects; using BeWo.Report; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Text.RegularExpressions; using BS.Shared.Core; using DevExpress.XtraReports.UI; namespace ProBeWoDueren { public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport { public Stundenzettel() { InitializeComponent(); } public void SetReportDataSource(ServicesOverviewRO pRO) { if (pRO.Services != null) { List servicesBillable = new List(); foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services) { if (s.IsBillable) { ServicesOverviewRO.CreateSignatureString(s); servicesBillable.Add(s); } if (s.IsGroup) { s.Notice5 = String.Format("{0}/{1} {2:0.##}", s.GroupMinutes, s.CustomerCount, s.Minutes); s.ServiceCategory = "Gruppe"; } else { s.Notice5 = String.Format("{0}", s.Minutes); } } pRO.Services = servicesBillable; } this.bindingSource1.DataSource = pRO; } private void picSignature_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs 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) { Image returnImage = null; MemoryStream ms = new System.IO.MemoryStream(byteArrayIn); returnImage = Image.FromStream(ms); return returnImage; } } }