public static string GetWsUrl(ConverterType convertType, string wsToSkip = "") { ServiceLog objUrl = null; var objIstance = GetIstance(); if (convertType == ConverterType.OpenOffice) { objUrl = objIstance.servicesOpenOffice.Select(x => x.Value).Where(x => x.FailedCount < objIstance.maxFailedCount && (wsToSkip == "" || x.WsUrl != wsToSkip)).FirstOrDefault(); } else { objUrl = objIstance.services.Select(x => x.Value).Where(x => x.FailedCount < objIstance.maxFailedCount && (wsToSkip == "" || x.WsUrl != wsToSkip)).FirstOrDefault(); } if (objUrl != null) { objUrl.LastCall = DateTime.Now; return(objUrl.WsUrl); } else { objIstance.logger.Warn("Attenzione...nessun server di stampa conforme OFFICE disponibile per la chiamata. Try to call first...."); if (convertType == ConverterType.OpenOffice) { return(objIstance.servicesOpenOffice.Select(x => x.Value).OrderBy(x => x.LastCall).First().WsUrl); } else { return(objIstance.services.Select(x => x.Value).OrderBy(x => x.LastCall).First().WsUrl); } } }
private static void IncreasePriority(ConverterType convertType, PrintRedirectConfigurations objIstance, ServiceLog failedCount) { if (failedCount.Priority < Int32.MaxValue - 1) { failedCount.Priority += 1; } else { ResetPriority(convertType, objIstance); } }