public void TestGetPersonsList()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetPersonCommand command = new DsioGetPersonCommand(broker);

                command.AddCommandArguments(TestConfiguration.DefaultPatientDfn, "");

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
Esempio n. 2
0
        public void TestGetSpouse()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetPersonCommand command = new DsioGetPersonCommand(broker);

                command.AddCommandArguments("740", "SPOUSE");

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
        public void TestAndRetrievePerson()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                // *** First save the person ***

                DsioSavePersonCommand command = new DsioSavePersonCommand(broker);

                DsioLinkedPerson person = new DsioLinkedPerson()
                {
                    PatientDfn = TestConfiguration.DefaultPatientDfn,
                    Name       = "Third, Today"
                };

                command.AddCommandArguments(person);
                RpcResponse response = command.Execute();
                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsNotNull(command.Ien);

                // *** Then get by ien ***
                DsioGetPersonCommand getCommand = new DsioGetPersonCommand(broker);
                getCommand.AddCommandArguments("", command.Ien);
                response = getCommand.Execute();
                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsNotNull(getCommand.PersonList);
                Assert.IsTrue(getCommand.PersonList.Count > 0);
                Assert.AreEqual(person.Name, getCommand.PersonList[0].Name);
                Assert.AreEqual(person.PatientDfn, getCommand.PersonList[0].PatientDfn);

                // *** Then get by patient ***
                getCommand.PersonList.Clear();
                getCommand.AddCommandArguments(person.PatientDfn, "");
                response = getCommand.Execute();
                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsNotNull(getCommand.PersonList);
                Assert.IsTrue(getCommand.PersonList.Count > 0);
                //Assert.AreEqual(person.Name, getCommand.PersonList[0].Name);
                //Assert.AreEqual(person.PatientDfn, getCommand.PersonList[0].PatientDfn);
            }
        }
        public PersonListResult GetPersons(string patientDfn, string personIen)
        {
            // *** Get a person or list of persons associated with a patient ***

            // *** Leave personIen empty to get a list of all associated persons ***

            PersonListResult result = new PersonListResult();

            // *** Create the command ***
            DsioGetPersonCommand command = new DsioGetPersonCommand(this.broker);

            // *** Add the arguments ***
            command.AddCommandArguments(patientDfn, personIen);

            // *** Execute the command ***
            RpcResponse response = command.Execute();

            // *** Add response to result ***
            result.SetResult(response.Status == RpcResponseStatus.Success, response.InformationalMessage);

            // *** Check for success ***
            if (result.Success)
            {
                result.TotalResults = command.TotalResults;

                if (result.TotalResults > 0)
                {
                    // *** Loop through all the persons ***
                    foreach (DsioLinkedPerson dsioPerson in command.PersonList)
                    {
                        // *** Convert from dsio person ***
                        Person person = GetPerson(dsioPerson);

                        // *** Add to result ***
                        result.PersonList.Add(person);
                    }
                }
            }

            return(result);
        }