Ejemplo n.º 1
0
 public static List <LastUpdated> GetLastUpdateData()
 {
     try
     {
         if (pocClientServiceForAutoRefresh == null)
         {
             pocClientServiceForAutoRefresh = new POCServiceClient("NetTcpBinding_IPOCService");
         }
         if (pocClientServiceForAutoRefresh.ChannelFactory.State == CommunicationState.Faulted ||
             pocClientServiceForAutoRefresh.ChannelFactory.State == CommunicationState.Closed)
         {
             pocClientServiceForAutoRefresh.Close();
             pocClientServiceForAutoRefresh = null;
             pocClientServiceForAutoRefresh = new POCServiceClient("NetTcpBinding_IPOCService");
         }
         var lastUpdate     = pocClientServiceForAutoRefresh.GetLastUpdateData();
         var decryptionData = lastUpdate;
         var lupds          = JsonConvert.DeserializeObject <List <LastUpdated> >(decryptionData);
         return(lupds);
     }
     catch (Exception ex)
     {
         _log.Error(ex);
         throw;
     }
 }
Ejemplo n.º 2
0
        public static void Invoke(ServiceClientHandler handler)
        {
            var sc = new POCServiceClient("NetTcpBinding_IPOCService");

            try
            {
                _log.Info("ServiceClientHandler: " + handler.Method);
                handler(sc);
            }
            catch (TimeoutException ex)
            {
                _log.Error("Timeout error: {0}" + ex.Message, ex);
                sc.Abort();
            }
            catch (FaultException fe)
            {
                _log.Error("Timeout error: {0}" + fe.Message, fe);
                sc.Abort();
            }
            catch (CommunicationException ce)
            {
                _log.Error("Timeout error: {0}" + ce.Message, ce);
                sc.Abort();
            }
            finally
            {
                if (sc.State != CommunicationState.Closed)
                {
                    sc.Close();
                }
            }
        }