var finFindR = (function () { function SearchFoto() { $('#results').busy();//.html(WaitingIcon()); var pattern = $('#txtSearch').val(); $.ajax({ type: "GET", url: '/FinFindR/SearchImages?SearchPattern=' + pattern + '&IsBest=' + $('#chkBest').prop('checked'), success: function (data) { $('#results').busy('hide'); $('#results').hide().html(data).fadeIn('fast'); }, error: function () { $('#results').busy('hide'); } }); } function ExctractSelection() { //var ids = ''; var ids = {}; ids['IsCatalog'] = $('#chkBest').prop('checked'); $('.fotocheck').each(function () { if ($(this).prop('checked') === true) { ids[$(this).attr('data-fotoid')] = $(this).attr('data-fotoid'); // ids = ids+ $(this).attr('data-fotoid') + ','; } }); //if (ids === '') { // alert('No Image Selected!'); // return; //} //ids = ids.slice(0, ids.length - 1); var url = '/FinFindR/ExtractFoto/'; $('#btnExtractFoto').parent().append(WaitingIcon()); $.fileDownload(url, { httpMethod: "POST", data: ids, successCallback: function (url) { RemoveWaitingIcon(); $('.waiting-icon-small').remove(); }, failCallback: function (responseHtml, url) { $('.waiting-icon-small').remove(); alert('Errore nella generazione del documento.'); } }); } function CheckAllImages(ref) { $('.fotocheck').each(function () { $(this).prop('checked', $(ref).prop('checked')); }); } function DownloadCatalog() { $('#btnDownloadAll').parent().append(WaitingIcon()); var url = '/FinFindR/ExtractAllCatalog/'; $.fileDownload(url, { successCallback: function (url) { RemoveWaitingIcon(); $('.waiting-icon-small').remove(); }, failCallback: function (responseHtml, url) { $('.waiting-icon-small').remove(); alert('Errore nella generazione del documento.'); } }); } return { SearchFoto: SearchFoto, ExctractSelection: ExctractSelection, CheckAllImages: CheckAllImages, DownloadCatalog: DownloadCatalog } })();