public static byte[] ConvertImageToByte(String imagefile) { MemoryStream ms = new MemoryStream(); ExceptionCatcher.ExceptionFinder(() => { System.Drawing.Image img = System.Drawing.Image.FromFile(imagefile); img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); }); return(ms.ToArray()); }
public static List <UserPermisson> Permisson(int roleID) { List <UserPermisson> list = new List <UserPermisson>(); ExceptionCatcher.ExceptionFinder(() => { if (roleID == 1) { } if (roleID == 3) { list.Add(new UserPermisson() { CompenetName = "navBar_uruntanim", EnabledState = false }); list.Add(new UserPermisson() { CompenetName = "navBar_raporList", EnabledState = false }); list.Add(new UserPermisson() { CompenetName = "navBar_personeltanim", EnabledState = false }); list.Add(new UserPermisson() { CompenetName = "navBar_musteritanim", EnabledState = false }); } if (roleID == 4) { list.Add(new UserPermisson() { CompenetName = "navBar_raporList", EnabledState = false }); list.Add(new UserPermisson() { CompenetName = "navBar_urunList", EnabledState = false }); list.Add(new UserPermisson() { CompenetName = "Ribbonpage_AlimSatim", EnabledState = false }); } }); return(list); }
public static BitmapImage ConvertByteToImage(byte[] byteArr) { BitmapImage btm = null; ExceptionCatcher.ExceptionFinder(() => { using (MemoryStream ms = new MemoryStream(byteArr)) { btm = new BitmapImage(); btm.BeginInit(); btm.StreamSource = ms; btm.CacheOption = BitmapCacheOption.OnLoad; btm.EndInit(); btm.Freeze(); } }); return(btm); }