コード例 #1
0
        public BrokerOperationResult TestServerConnection(string serverName, string serverPort)
        {
            BrokerOperationResult returnResult = new BrokerOperationResult();

            int port = 0;

            if (int.TryParse(serverPort, out port))
            {
                //using (RpcBroker broker = new RpcBroker(serverName, port))
                ServerConfig config = new ServerConfig()
                {
                    ServerName = serverName, ListenerPort = port
                };

                IRpcBroker broker = RpcBrokerUtility.GetNewConnectedRpcBroker(config);

                if (broker != null)
                {
                    returnResult.SetResult(true, "");
                    broker.Disconnect();
                }
            }

            return(returnResult);
        }
コード例 #2
0
        protected bool CreateBroker()
        {
            // *** Create the broker to use for data calls ***

            bool returnVal = false;

            if (this.rpcBroker == null)
            {
                // *** Get server settings ***
                ServerConfigResult opResult = this.DashboardRepository.Settings.GetServerData();

                if (opResult.Success)
                {
                    // *** Get connected broker ***
                    this.rpcBroker = RpcBrokerUtility.GetNewConnectedRpcBroker(opResult.ServerConfig);

                    // *** Check for broker ***
                    if (this.rpcBroker != null)
                    {
                        // *** Add broker to store ***
                        this.BrokerKey = BrokerStore.Add(this.rpcBroker);

                        returnVal = true;
                    }
                    else
                    {
                        ErrorLogger.Log("Could not get a connected broker");
                    }
                }
            }
            else // *** We already have a broker ***
            {
                returnVal = true;
            }

            // *** Add Prenatal Lab File Name to repository ***
            this.DashboardRepository.PrenatalLabFileName = this.Request.MapPath("~/Content/PrenatalLabs.csv");

            // *** Add Content Path to Checklist Repository ***
            if (this.DashboardRepository.Checklist != null)
            {
                this.DashboardRepository.Checklist.ContentPath = this.Request.MapPath("~/Content/");
            }

            // *** Add broker to DashboardBroker ***
            if (this.rpcBroker != null)
            {
                this.DashboardRepository.SetRpcBroker(this.rpcBroker);
            }

            return(returnVal);
        }