public Image GetImg(int type, Guid id) { OrgService orgService = new OrgService(); ActService actService = new ActService(); Image img; string cacheID = id.ToString(); if (cache[cacheID] != null) { img = cache[cacheID] as Image; return(img); } else { string path = ""; if (type == 1) { path = "E:\\web\\Firewood\\" + orgService.GetPathByID(id); } else if (type == 2) { path = "E:\\web\\Firewood\\" + actService.GetPathByID(id); } else if (type == 3) { path = "E:\\web\\GHY_SSO\\" + AccountStrategy.GetAvatarByUserID(id); } if (!System.IO.File.Exists(path)) { return(null); } else { img = Bitmap.FromFile(path); cache.Add(cacheID, img, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(20), CacheItemPriority.Normal, null); return(img); } } }