public void GetCurrentMeters(IList <int> installations, Action <int, int, int> action)
 {
     try
     {
         MachineManagerInterface machineManager = this.GetMachineManager();
         int i     = 1;
         int count = installations.Count;
         foreach (int installationNo in installations)
         {
             try
             {
                 if (action != null)
                 {
                     try
                     {
                         action(installationNo, i++, count);
                     }
                     catch { }
                 }
                 machineManager.MeterForcePeriodicForSIandSC(installationNo);
             }
             catch (System.Exception ex)
             {
                 ExceptionManager.Publish(ex);
             }
             Thread.Sleep(10);
         }
     }
     finally
     {
         this.ReleaseMachineManager();
     }
 }
Example #2
0
        public void ExchangeAft(object _aftAsset)
        {
            try
            {
                Transport.AftAssets aftAsset         = _aftAsset as Transport.AftAssets;
                AftAssets           aftEnableDisable = new AftAssets();
                //
                MachineManagerInterface machineManagerInterface = new MachineManagerInterface();
                int nRet = 0;
                nRet = machineManagerInterface.EnableDisableAFT(aftAsset.InstallationNo, aftAsset.IsChecked);
                if (nRet == 0)
                {
                    aftAsset.Status = aftAsset.IsChecked;
                    aftEnableDisable.UpdateAftStatus(aftAsset.InstallationNo, aftAsset.IsChecked);
                }

                aftAsset.Message = nRet == 0 ? "Success" : nRet == -1 ? "Timed Out" : nRet == -2 ? "NACK" : "UnKnown Error";
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("ExchangeAft: " + ex.Message, LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
            }
            finally
            {
            }
        }
 public void ReleaseMachineManager()
 {
     if (machineManagerInterface != null)
     {
         lock (_objLock)
         {
             if (machineManagerInterface != null)
             {
                 machineManagerInterface.Dispose();
                 machineManagerInterface = null;
             }
         }
     }
 }
 public MachineManagerInterface GetMachineManager()
 {
     if (machineManagerInterface == null)
     {
         lock (_objLock)
         {
             if (machineManagerInterface == null)
             {
                 machineManagerInterface = new MachineManagerInterface();
             }
         }
     }
     return(machineManagerInterface);
 }
 public void ReleaseMachineManager()
 {
     if (machineManagerInterface != null)
     {
         lock (_objLock)
         {
             if (machineManagerInterface != null)
             {
                 machineManagerInterface.Dispose();
                 machineManagerInterface = null;
             }
         }
     }
 }
 public MachineManagerInterface GetMachineManager()
 {
     if (machineManagerInterface == null)
     {
         lock (_objLock)
         {
             if (machineManagerInterface == null)
             {
                 machineManagerInterface = new MachineManagerInterface();
             }
         }
     }
     return machineManagerInterface;
 }
Example #7
0
 public CMachineMaintenance()
 {
     objMachineMaintenanceDataAccess = new CMachineMaintenanceDataAccess(CommonUtilities.ExchangeConnectionString);
     objMachineManagerInterface      = new MachineManagerInterface();
 }
        public CMachineMaintenance() {

            objMachineMaintenanceDataAccess = new CMachineMaintenanceDataAccess(CommonUtilities.ExchangeConnectionString);
            objMachineManagerInterface = new MachineManagerInterface();
        }