Exemple #1
0
        /// <summary>
        /// Send service command to active service.
        /// </summary>
        /// <param name="serviceId">The service identifier.</param>
        /// <param name="command">The command to send.</param>
        /// <returns>The result from the service.</returns>
        public string ExecuteServiceCommand(long serviceId, string command)
        {
            string commandResult = "";

            if (services.ContainsKey(serviceId))
            {
                ModuleInstance service = services[serviceId];

                Module module = moduleRepository.Get(serviceId);

                if (module.type == (int)ModuleType.Service && module.enabled == 1)
                {
                    commandResult = service.ExecuteServiceCommand(command);
                }
                else
                {
                    commandResult = "Service is not enabled.";
                }
            }
            else
            {
                commandResult = "Service does not exist.";
            }

            return(commandResult);
        }