protected override void ProcessResponse() { // *** Process the return data *** // *** Use the default processor first *** if (this.ProcessQueryResponse()) { // *** If ok, create the return list *** this.ProviderList = new List <DsioProvider>(); // *** Get the data as array of lines *** string[] lines = this.Response.Lines; // *** Loop through the lines *** foreach (string line in lines) { // *** Create a provider *** DsioProvider prov = new DsioProvider(); // *** Get data from pieces *** prov.Ien = Util.Piece(line, Caret, 1); prov.Name = Util.Piece(line, Caret, 2); // *** Address *** DsioAddress addr = this.GetSixPieceAddress(line, 3); if (addr != null) { prov.Address = addr; } // *** Telephone *** string tel = Util.Piece(line, Caret, 9); if (!string.IsNullOrWhiteSpace(tel)) { prov.TelephoneList.Add(new DsioTelephone() { Usage = DsioTelephone.WorkPhoneUsage, Number = tel }); } prov.Title = Util.Piece(line, Caret, 10); prov.Service = Util.Piece(line, Caret, 11); prov.Npi = Util.Piece(line, Caret, 12); this.ProviderList.Add(prov); } //10958^BHATJEPDYIHU,ZDJELHA^1K Shird Tt.^Appt. 123^MN TS. LIIUHTT #3^troy^NEW YORK^00001^^2:COMPUTER SPECIALIST^1043:INFORMATION SYSTEMS CENTER^ this.Response.Status = RpcResponseStatus.Success; } }
protected DsioAddress GetSixPieceAddress(string line, int startingIndex) { DsioAddress returnAddress = new DsioAddress(); returnAddress.StreetLine1 = Util.Piece(line, Caret, startingIndex); returnAddress.StreetLine2 = Util.Piece(line, Caret, startingIndex + 1); returnAddress.StreetLine3 = Util.Piece(line, Caret, startingIndex + 2); returnAddress.City = Util.Piece(line, Caret, startingIndex + 3); returnAddress.State = Util.Piece(line, Caret, startingIndex + 4); returnAddress.ZipCode = Util.Piece(line, Caret, startingIndex + 5); return(returnAddress); }
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 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); } }