public IenResult SavePerson(string patientDfn, Person person)
        {
            // *** Performs operations to save the FOF ***

            IenResult result = new IenResult();

            if (this.broker != null)
            {
                // *** Create the command ***

                DsioSavePersonCommand command = new DsioSavePersonCommand(this.broker);

                // *** Get the linked person ***
                DsioLinkedPerson dsioFof = GetDsioPerson(patientDfn, person);

                // *** Add as argument ***
                command.AddCommandArguments(dsioFof);

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

                // *** Set return values ***
                result.Success = (response.Status == RpcResponseStatus.Success);
                result.Message = response.InformationalMessage;

                if (result.Success)
                {
                    result.Ien = command.Ien;
                }
            }

            return(result);
        }
Esempio n. 2
0
        public void TestSavePerson()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioSavePersonCommand command = new DsioSavePersonCommand(broker);

                DsioLinkedPerson fof = new DsioLinkedPerson();

                fof.PatientDfn = "715";

                DsioAddress addr = new DsioAddress();
                addr.StreetLine1 = "1234 Five Street";
                addr.StreetLine2 = "#3";
                addr.City        = "Seven";
                addr.State       = "SC";
                addr.ZipCode     = "90099";

                fof.Address = addr;

                List <DsioTelephone> telList = new List <DsioTelephone>();
                telList.Add(new DsioTelephone()
                {
                    Number = "800-800-8000", Usage = DsioTelephone.HomePhoneUsage
                });
                telList.Add(new DsioTelephone()
                {
                    Number = "900-900-9000", Usage = DsioTelephone.WorkPhoneUsage
                });
                telList.Add(new DsioTelephone()
                {
                    Number = "700-700-7000", Usage = DsioTelephone.MobilePhoneUsage
                });

                fof.TelephoneList.AddRange(telList);

                string temp = Guid.NewGuid().ToString();

                // TODO: Need random name generator to test this successfully repeatedly...
                fof.Name        = "Test,NamedOB";// +Guid.NewGuid().ToString();
                fof.DOB         = DateTime.Now.Subtract(new TimeSpan(10000, 0, 0, 0)).ToShortDateString();
                fof.YearsSchool = "18";

                command.AddCommandArguments(fof);

                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 void TestSaveBadPerson()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioSavePersonCommand command = new DsioSavePersonCommand(broker);

                DsioLinkedPerson fof = new DsioLinkedPerson();

                DsioAddress addr = new DsioAddress();
                addr.StreetLine1 = "1234 Five Street";
                addr.City        = "Six";
                addr.State       = "SC";
                addr.ZipCode     = "90099";

                fof.Address = addr;

                List <DsioTelephone> telList = new List <DsioTelephone>();
                telList.Add(new DsioTelephone()
                {
                    Number = "800-800-8000", Usage = DsioTelephone.HomePhoneUsage
                });
                telList.Add(new DsioTelephone()
                {
                    Number = "900-900-9000", Usage = DsioTelephone.WorkPhoneUsage
                });
                telList.Add(new DsioTelephone()
                {
                    Number = "700-700-7000", Usage = DsioTelephone.MobilePhoneUsage
                });

                fof.TelephoneList.AddRange(telList);

                command.AddCommandArguments(fof);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Fail, response.Status);
            }
        }