protected void ReceivePostEnableApp(PacketHeader header, Connection connection, long appId) { // ######################################################################## // This method requires authentication. // If user is not authorized then send UnAuthorized and end method. if (!accountManager.Authorized(connection)) { TCPConnection.GetConnection(connection.ConnectionInfo).SendObject( PacketName.ReUnauthorized.ToString(), 1); return; } // ######################################################################## if (accountManager.Administrator(connection)) { moduleRepository.EnableService(appId); TCPConnection.GetConnection(connection.ConnectionInfo).SendObject( PacketName.ReUpdateAccountInformation.ToString(), GenericResponse.Success); } }
/// <summary> /// Enable service. /// </summary> /// <param name="serviceId">The service identifier.</param> public void EnableService(long serviceId) { if (services.ContainsKey(serviceId)) { ModuleInstance service = services[serviceId]; Module module = moduleRepository.Get(serviceId); if (module.type == (int)ModuleType.Service && module.enabled == 0) { try { if (service.Load()) { moduleRepository.EnableService(serviceId); } } catch (Exception err) { logManager.Add(module.id, err.ToString()); } } } }