Ejemplo n.º 1
0
        public MonitorService(IIntFunctionService sqlDataService, IIntFunctionService webAppPoolService, LogService logService)
        {
            this.SqlDataService    = sqlDataService;
            this.WebAppPoolService = webAppPoolService;

            this.LogService = logService;
        }
Ejemplo n.º 2
0
        public void ExecuteMonitor(Monitor monitor, Input checkInput = null)
        {
            try
            {
                // Ilumination effect when executing a monitor.

                monitor.Status = (int)Monitor.StatusValues.Processing;
                Thread.Sleep(100);

                // Gets service by function type.

                IIntFunctionService functionService = this.GetServiceByFunctionType(monitor.Function.FunctionType);
                monitor.Executed = DateTime.Now;

                // Checks function service.

                if (checkInput != null)
                {
                    functionService.GetInt(
                        monitor.Function.Server,
                        monitor.FunctionId,
                        checkInput.TimeOutSeconds.Value,
                        checkInput.Parameters);
                }

                // Executes input in function service.

                monitor.IntValue = functionService.GetInt(
                    monitor.Function.Server,
                    monitor.FunctionId,
                    monitor.TimeOutSeconds.Value,
                    monitor.Input.Parameters);
            }
            catch (Exception ex)
            {
                monitor.Status = (int)Monitor.StatusValues.Error;
            }
            finally
            {
                monitor.Recalculate();

                this.LogService.WriteLog(string.Format(StringResource.LogMonitoringFormat, monitor.Id, Enum.Parse(typeof(Monitor.StatusValues), monitor.Status.ToString())));
            }
        }