Exemplo n.º 1
0
        public void TestUpdateNonVAItem()
        {
            using (RpcBroker broker = GetConnectedBroker())
            {
                this.SignonToBroker(broker, 3);

                string newIen = SaveNewNonVAItem(broker);

                DsioGetExternalEntityCommand getCommand = new DsioGetExternalEntityCommand(broker);

                getCommand.AddCommandArguments(newIen, 1, 10);

                RpcResponse response = getCommand.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);

                DsioSaveExternalEntityCommand command = new DsioSaveExternalEntityCommand(broker);

                Assert.IsNotNull(getCommand.NonVAEntities);
                Assert.IsTrue(getCommand.NonVAEntities.Count == 1);

                DsioNonVAItem nonVAEntity = getCommand.NonVAEntities[0];

                nonVAEntity.EntityName = string.Format("Updated {0} Hospital", GetRandom());

                command.AddCommandArguments(nonVAEntity);

                response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
        public IenResult SaveItem(NonVACareItem item)
        {
            // *** Creates a new Non VA Care Item ***

            IenResult result = new IenResult();

            // *** Create the command ***
            DsioSaveExternalEntityCommand command = new DsioSaveExternalEntityCommand(broker);

            // *** Create the entity to save ***
            DsioNonVAItem dsioItem = new DsioNonVAItem();

            //dsioItem.OriginalEntityName = item.OriginalName;
            dsioItem.Ien                 = item.Ien;
            dsioItem.EntityName          = item.Name;
            dsioItem.Address.StreetLine1 = item.AddressLine1;
            dsioItem.Address.StreetLine2 = item.AddressLine2;
            dsioItem.Address.City        = item.City;
            dsioItem.Address.State       = item.State;
            dsioItem.Address.ZipCode     = item.ZipCode;
            dsioItem.TelephoneList.Add(new DsioTelephone()
            {
                Number = item.PhoneNumber, Usage = DsioTelephone.WorkPhoneUsage
            });
            dsioItem.TelephoneList.Add(new DsioTelephone()
            {
                Number = item.FaxNumber, Usage = DsioTelephone.FaxUsage
            });
            dsioItem.PrimaryContact = item.PrimaryContact;

            //dsioItem.Inactive = (item.Inactive) ? "YES" : "NO";
            dsioItem.Inactive = (item.Inactive) ? "1" : "0";
            //dsioItem.EntityType = (item.ItemType== NonVACareItemType.Provider) ? "PROVIDER" : "FACILITY";
            dsioItem.EntityType = (item.ItemType == NonVACareItemType.Provider) ? "P" : "F";

            // *** Add the arguments ***
            command.AddCommandArguments(dsioItem);

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

            // *** Gather results ***
            result.Success = (response.Status == RpcResponseStatus.Success);
            result.Message = response.InformationalMessage;

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

            return(result);
        }
        private NonVACareItem GetNonVACareItem(DsioNonVAItem dsioItem)
        {
            // *** Create a strongly typed item ***
            NonVACareItem item = new NonVACareItem()
            {
                Ien          = dsioItem.Ien,
                Name         = dsioItem.EntityName,
                OriginalName = dsioItem.EntityName,
                AddressLine1 = dsioItem.Address.StreetLine1,
                AddressLine2 = dsioItem.Address.StreetLine2,
                City         = dsioItem.Address.City,
                State        = dsioItem.Address.State,
                ZipCode      = dsioItem.Address.ZipCode,
                //Inactive = (dsioItem.Inactive == "YES") ? true : false,
                Inactive       = (dsioItem.Inactive == "1") ? true : false,
                PrimaryContact = dsioItem.PrimaryContact
            };

            if (dsioItem.TelephoneList != null)
            {
                foreach (DsioTelephone dsioTel in dsioItem.TelephoneList)
                {
                    if (dsioTel.Usage == DsioTelephone.WorkPhoneUsage)
                    {
                        item.PhoneNumber = dsioTel.Number;
                    }
                    else if (dsioTel.Usage == DsioTelephone.FaxUsage)
                    {
                        item.FaxNumber = dsioTel.Number;
                    }
                }
            }

            switch (dsioItem.EntityType)
            {
            case "PROVIDER":
            case "P":
                item.ItemType = NonVACareItemType.Provider;
                break;

            case "FACILITY":
            case "F":
                item.ItemType = NonVACareItemType.Facility;
                break;

            default:
                item.ItemType = NonVACareItemType.Provider;
                break;
            }

            return(item);
        }
Exemplo n.º 4
0
        public void TestUpdateNonVAItem()
        {
            using (RpcBroker broker = GetConnectedBroker())
            {
                this.SignonToBroker(broker, 3);

                DsioGetExternalEntityCommand getCommand = new DsioGetExternalEntityCommand(broker);

                getCommand.AddCommandArguments("7", 1, 10);

                RpcResponse response = getCommand.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);

                DsioSaveExternalEntityCommand command = new DsioSaveExternalEntityCommand(broker);

                Assert.IsNotNull(getCommand.NonVAEntities);
                Assert.IsTrue(getCommand.NonVAEntities.Count == 1);

                DsioNonVAItem nonVAEntity = getCommand.NonVAEntities[0];

                nonVAEntity.EntityName = "Smallest Hospital Four";

                //nonVAEntity.Ien = "";
                //nonVAEntity.EntityName = "Smallish Hospital Four";
                //nonVAEntity.EntityType = "F";
                //nonVAEntity.Address.StreetLine1 = "789 Test Street";
                //nonVAEntity.Address.StreetLine2 = "Suite XFD";
                //nonVAEntity.Address.City = "Sacramento";
                //nonVAEntity.Address.State = "CA";
                //nonVAEntity.Address.ZipCode = "93939";
                //nonVAEntity.TelephoneList.Add(new DsioTelephone() { Number = "8009008000", Usage = DsioTelephone.WorkPhoneUsage });
                //nonVAEntity.TelephoneList.Add(new DsioTelephone() { Number = "8887776666", Usage = DsioTelephone.FaxUsage });

                //nonVAEntity.PrimaryContact = "Extra Important";
                //nonVAEntity.Inactive = "0";

                command.AddCommandArguments(nonVAEntity);

                response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
Exemplo n.º 5
0
        private string SaveNewNonVAItem(IRpcBroker broker)
        {
            string returnVal = "";

            DsioSaveExternalEntityCommand command = new DsioSaveExternalEntityCommand(broker);

            DsioNonVAItem nonVAEntity = new DsioNonVAItem();

            nonVAEntity.Ien                 = "";
            nonVAEntity.EntityName          = string.Format("New {0} Hospital", GetRandom());
            nonVAEntity.EntityType          = "F";
            nonVAEntity.Address.StreetLine1 = "789 Test Street";
            nonVAEntity.Address.StreetLine2 = "Suite XFD";
            nonVAEntity.Address.City        = "Sacramento";
            nonVAEntity.Address.State       = "CA";
            nonVAEntity.Address.ZipCode     = "93939";
            nonVAEntity.TelephoneList.Add(new DsioTelephone()
            {
                Number = "8009008000", Usage = DsioTelephone.WorkPhoneUsage
            });
            nonVAEntity.TelephoneList.Add(new DsioTelephone()
            {
                Number = "8887776666", Usage = DsioTelephone.FaxUsage
            });

            nonVAEntity.PrimaryContact = "Extra Important";
            nonVAEntity.Inactive       = "0";

            command.AddCommandArguments(nonVAEntity);

            RpcResponse response = command.Execute();

            Assert.AreEqual(RpcResponseStatus.Success, response.Status);

            returnVal = command.Ien;

            return(returnVal);
        }
Exemplo n.º 6
0
        public void TestSaveNonVAProvider()
        {
            using (RpcBroker broker = GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioSaveExternalEntityCommand command = new DsioSaveExternalEntityCommand(broker);

                DsioNonVAItem nonVAEntity = new DsioNonVAItem();

                nonVAEntity.Ien                 = "";
                nonVAEntity.EntityName          = "Wednesday Test OBGYNC";
                nonVAEntity.EntityType          = "P";
                nonVAEntity.Address.StreetLine1 = "789 Test Street";
                nonVAEntity.Address.StreetLine2 = "Suite XFD";
                nonVAEntity.Address.City        = "Sacramento";
                nonVAEntity.Address.State       = "CA";
                nonVAEntity.Address.ZipCode     = "93939";
                nonVAEntity.TelephoneList.Add(new DsioTelephone()
                {
                    Number = "8009008000", Usage = DsioTelephone.WorkPhoneUsage
                });
                nonVAEntity.TelephoneList.Add(new DsioTelephone()
                {
                    Number = "8887776666", Usage = DsioTelephone.FaxUsage
                });

                nonVAEntity.PrimaryContact = "Primary,Contact";
                nonVAEntity.Inactive       = "0";

                command.AddCommandArguments(nonVAEntity);

                RpcResponse response = command.Execute();

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

                DsioSaveExternalEntityCommand command = new DsioSaveExternalEntityCommand(broker);

                DsioNonVAItem nonVAEntity = new DsioNonVAItem();

                string randomName = string.Format("{0} Hospital", GetRandom());

                nonVAEntity.Ien                 = "";
                nonVAEntity.EntityType          = "P";
                nonVAEntity.EntityName          = randomName;
                nonVAEntity.Address.StreetLine1 = "789 Test Street";
                nonVAEntity.Address.StreetLine2 = "Suite XFD";
                nonVAEntity.Address.City        = "Sacramento";
                nonVAEntity.Address.State       = "CA";
                nonVAEntity.Address.ZipCode     = "93939";
                nonVAEntity.TelephoneList.Add(new DsioTelephone()
                {
                    Number = "(800)900-8000", Usage = DsioTelephone.WorkPhoneUsage
                });
                nonVAEntity.TelephoneList.Add(new DsioTelephone()
                {
                    Number = "(888)777-6666", Usage = DsioTelephone.FaxUsage
                });

                nonVAEntity.PrimaryContact = "Extra Important";
                nonVAEntity.Inactive       = "0";

                command.AddCommandArguments(nonVAEntity);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);

                Assert.IsFalse(string.IsNullOrWhiteSpace(command.Ien));

                DsioGetExternalEntityCommand getCommand = new DsioGetExternalEntityCommand(broker);

                getCommand.AddCommandArguments(command.Ien, 1, 100);

                response = getCommand.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsNotNull(getCommand.NonVAEntities);
                Assert.AreEqual(1, getCommand.NonVAEntities.Count);

                DsioNonVAItem item = getCommand.NonVAEntities[0];

                Assert.IsTrue(nonVAEntity.EntityName.Equals(item.EntityName, StringComparison.InvariantCultureIgnoreCase));
                //Assert.AreEqual(nonVAEntity.EntityType, item.EntityType);
                Assert.AreEqual(nonVAEntity.Address.StreetLine1, item.Address.StreetLine1);
                Assert.AreEqual(nonVAEntity.Address.StreetLine2, item.Address.StreetLine2);
                Assert.AreEqual(nonVAEntity.Address.City, item.Address.City);
                Assert.AreEqual(nonVAEntity.Address.State, item.Address.State);
                Assert.AreEqual(nonVAEntity.Address.ZipCode, item.Address.ZipCode);

                Assert.IsNotNull(item.TelephoneList);
                Assert.AreEqual(nonVAEntity.TelephoneList.Count, item.TelephoneList.Count);

                Assert.AreEqual(nonVAEntity.TelephoneList[0].Usage, item.TelephoneList[0].Usage);
                Assert.AreEqual(nonVAEntity.TelephoneList[0].Number, item.TelephoneList[0].Number);

                Assert.AreEqual(nonVAEntity.TelephoneList[1].Usage, item.TelephoneList[1].Usage);
                Assert.AreEqual(nonVAEntity.TelephoneList[1].Number, item.TelephoneList[1].Number);

                Assert.AreEqual(nonVAEntity.PrimaryContact, item.PrimaryContact);
                Assert.AreEqual(nonVAEntity.Inactive, item.Inactive);
            }
        }