/// <summary> /// /// </summary> /// <param name="catalogueID"></param> /// <param name="sysno"></param> /// <param name="isbn"></param> /// <returns></returns> public static string SearchCoverUrl(string zserverUrl, Book book) { if (book == null) throw new ArgumentNullException("book"); string frontCoverUrl = null; ObalkyKnihRequest request = new ObalkyKnihRequest(); request.zserverUrl = zserverUrl; ObalkyKnihBibInfo bibinfo = new ObalkyKnihBibInfo(); bibinfo.sysno = book.SysNo; bibinfo.authors = new List<string>() { book.Author }; bibinfo.title = book.Title; bibinfo.year = book.Year; bibinfo.isbn = book.ISBN; bibinfo.nbn = book.NBN; bibinfo.oclc = book.OCLC; request.bibinfo = bibinfo; ObalkyKnihResponse response = AuthController.GetProxy().Execute(client => client.SearchObalkyKnihCZ(request)); if (response != null) { frontCoverUrl = response.cover_medium_url; } return frontCoverUrl; }
public static bool SearchCoverOK(string zserverUrl, Book book, string fullName) { if (book == null) throw new ArgumentNullException("book"); if (String.IsNullOrEmpty(fullName)) throw new ArgumentNullException("Nebyla zadána cesta k souboru", "fullName"); bool result = false; ObalkyKnihRequest request = new ObalkyKnihRequest(); request.zserverUrl = zserverUrl; ObalkyKnihBibInfo bibinfo = new ObalkyKnihBibInfo(); bibinfo.sysno = book.SysNo; bibinfo.authors = new List<string>() { book.Author }; bibinfo.title = book.Title; bibinfo.year = book.Year; bibinfo.isbn = book.ISBN; bibinfo.nbn = book.NBN; bibinfo.oclc = book.OCLC; request.bibinfo = bibinfo; ObalkyKnihResponse response = AuthController.GetProxy().Execute(client => client.SearchObalkyKnihCZ(request)); if (response != null && response.cover_image != null && response.cover_image.Length > 0) { result = (ImageFunctions.WriteFile(fullName, response.cover_image, true) > 0); } return result; }