function OnError(xhr, errorType, exception) { alert("error"); var responseText; try { responseText = jQuery.parseJSON(xhr.responseText); var errmessage = exception + "\n" + responseText.ExceptionType +"\n" + responseText.StackTrace +"\n" + responseText.Message; alert(errmessage); return false; } catch (e) { return false; } } function checkSession (user){ //alert("calling checkSession " + user); var webMethod = getPServiceURL('CheckSession'); var status = null; // alert("2 calling checkSession" + user + " URL: " + webMethod); //Call the page method jq142.ajax({ type: "POST", url: webMethod, data: "{'u': '" + user +"'}", contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { //alert(msg.d); if(String(msg.d) === 'true'){ status = true; } else { ShowSmartMessageOnly('Your Session has expired. You will be redirected to login page in a few seconds.','Session Expired'); //window.location = 'https://ess.wilmot.ca/IHRWebDNSessionExpired.aspx'; if(typeof uiDialogInclude !== 'undefined'){ setTimeout(function() { window.location = 'https://ess.wilmot.ca/IHRWebDN/infohr.aspx' }, 5000); } else{ window.location = 'https://ess.wilmot.ca/IHRWebDN/infohr.aspx'; } status = false; } }, error: function(e) { alert(e); status = false; } }); if(status == null){ status = false; } return status; } function checkSessionNoMessage (user){ //alert("calling checkSession " + user); var webMethod = getPServiceURL('CheckSession'); var status = null; // alert("2 calling checkSession" + user + " URL: " + webMethod); //Call the page method jq142.ajax({ type: "POST", url: webMethod, data: "{'u': '" + user +"'}", contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { //alert(msg.d); if(String(msg.d) === 'true'){ status = true; } else { window.location = 'https://ess.wilmot.ca/IHRWebDN/SessionExpired.aspx'; //setTimeout(function() { window.location = 'https://ess.wilmot.ca/IHRWebDN/infohr.aspx' }, 5000); status = false; } }, error: function(e) { alert(e); status = false; } }); if(status == null){ status = false; } return status; } function getURL(str) { var https = false; if (serviceurl.indexOf("https") > -1) { https = true; } var webMethod = serviceurl + '/'+ str; webMethod = webMethod.replace("http://", ""); webMethod = webMethod.replace("https://", ""); webMethod = webMethod.replace("//", "/"); if (https) { webMethod = "https://" + webMethod; } else { webMethod = "http://" + webMethod; } // alert("url: " + webMethod); return webMethod; } function getPServiceURL(str) { var https = false; if (publicserviceurl.indexOf("https") > -1) { https = true; } var webMethod = publicserviceurl + '/'+ str; webMethod = webMethod.replace("http://", ""); webMethod = webMethod.replace("https://", ""); webMethod = webMethod.replace("//", "/"); if (https) { webMethod = "https://" + webMethod; } else { webMethod = "http://" + webMethod; } // alert("url: " + webMethod); return webMethod; } function GetBalances(){ if(checkSession("")){ // console.log('Stlll logged in'); } var divToBeWorkedOn = '#tmpdiv'; var html; var parameters = "{'serial':'" + '' + "','userid':'" + '' + "','empnbr':'" + '' + "','useempnbr':'false'}"; //"{'sDate':'" + sDate + "','eDate':'" + eDate + "'}" jq142.ajax({ type: "POST", url: getURL('GetAllOutStandingBalances'), data: parameters, contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { jq142(divToBeWorkedOn).html(msg.d); html = msg.d; }, error: function(e) { jq142(divToBeWorkedOn).html("Unavailable"); html = "Unavailable"; } }); // alert(webMethod + ' ' + html); return html; } function GetEmployeeSchedule() { if(checkSession("")){ //console.log('Stlll logged in'); } var divToBeWorkedOn = '#tmpdiv'; var html; var webMethod = getURL('GetWorkSchedule'); var parameters = "{'serial':'" + '' + "','userid':'" + '' + "','empnbr':'" + '' + "','useempnbr':'false'}"; //"{'sDate':'" + sDate + "','eDate':'" + eDate + "'}" jq142.ajax({ type: "POST", url: webMethod, data: parameters, contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { jq142(divToBeWorkedOn).html(msg.d); html = msg.d; }, error: function(e) { jq142(divToBeWorkedOn).html("Unavailable"); html = "Unavailable"; } }); // alert(webMethod + ' ' + html); return html; } function ShowMessageOnly(msg,t) { jq142('body').append("
" + msg + "
"); jq142('#dialog').dialog ({ height:140, modal:true, resizable:false, draggable:false, close:function(event,ui) { jq142('body').find('#dialog').remove(); } }); //return dialogConfirmed; } function ShowSmartMessageOnly(msg,t) { if(typeof uiDialogInclude !== 'undefined'){ jq142('body').append("
" + msg + "
"); jq142('#Div1').dialog ({ height:140, modal:true, resizable:false, draggable:false, close:function(event,ui) { jq142('body').find('#Div1').remove(); } }); } else{ alert(msg); } //return dialogConfirmed; } function ShowTip(objid, c){ // By suppling no content attribute, the library uses each elements title attribute by default jq142('#' + objid).qtip({ // Simply use an HTML img tag within the HTML string content: c, style: { classes: 'ui-tooltip-blue ui-tooltip-shadow', width: 400 }, show: { ready: true } }); } function ShowTip(objid, c,w){ // By suppling no content attribute, the library uses each elements title attribute by default jq142('#' + objid).qtip({ // Simply use an HTML img tag within the HTML string content: c, style: { classes: 'ui-tooltip-blue ui-tooltip-shadow', width: 400 }, show: { ready: true } }); } function GetHTML(p) { if(checkSession("")){ //console.log('Stlll logged in'); } var divToBeWorkedOn = '#dashdata'; var html; var webMethod = getURL('RenderUC'); var parameters = "{'path':'" + p + "'}"; jq142.ajax({ type: "POST", url: webMethod, data: parameters, contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(msg) { jq142(divToBeWorkedOn).html(msg.d); html = msg.d; }, error: function(e) { jq142(divToBeWorkedOn).html("Unavailable"); html = "Unavailable " + e; } }); // alert(webMethod + ' ' + html); //ShowMessageOnly(html,'Title'); return html; } function ShowFrameMessage(){ //alert('I here'); if(typeof document.frames['showmessageframe'] !== 'undefined' && typeof document.frames['showmessageframe'].ShowDetails === 'function'){ //alert('I here'); try{ document.frames['showmessageframe'].ShowDetails(GetHTML('~/shared/UCEmployeeDB.ascx'),'Dashboard'); //Call the function available in the iframe window from the parent window. }catch(e){ //alert('I here2' + e.message); } } // document.getElementById("showmessageframe").contentWindow // alert('I here'); }