public byte[] getByWebService(string hn) { try { using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls()) { var img = ws.GetPTImageByHN(hn).AsEnumerable().Select(x => x.Field <byte[]>("docData")).FirstOrDefault(); if (img != null) { return(img); } else { MemoryStream ms = new MemoryStream(); Properties.Resources.no_image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); return(ms.ToArray()); } } } catch { MemoryStream ms = new MemoryStream(); Properties.Resources.no_image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); return(ms.ToArray()); } }
public byte[] ByGetPTImageByHN(string hn) { try { using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls()) { var img = ws.GetPTImageByHN(hn).AsEnumerable().Select(x => x.Field <byte[]>("docData")).FirstOrDefault(); if (img == null) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); Properties.Resources.no_image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); return(ms.ToArray()); } return(img); } } catch (Exception ex) { Class.globalCls.MessageError("GetPatientImageCls", "ByGetPTImageByHN", ex.Message); throw ex; } }
public byte[] GetImageByWS(string hn) { try { using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls()) { var img = ws.GetPTImageByHN(hn).AsEnumerable().Select(x => x.Field <byte[]>("docData")).FirstOrDefault(); if (img == null) { return(GetDefaultImage()); } else { return(img); } } } catch (Exception ex) { Program.MessageError("GetPatientImageCls", "GetImageByWS(string hn)", ex, false); return(GetDefaultImage()); } }