public async Task Create_PayerWebsiteMappingValues_Test() { var clientLocationName = "Sid Peterson Memorial Hospital"; IDbConnection smartAgentDb = new SqlConnection(ConfigurationManager.ConnectionStrings[_prodAppConfigName].ConnectionString); var kernel = new StandardKernel(new RepoTestsModule(smartAgentDb)); var clientLocationsRepo = kernel.Get <IAsyncRepository <ClientLocations> >(); var clientLocations = await clientLocationsRepo.FindByName(clientLocationName); if (clientLocations.Any()) { var pwmvRepo = kernel.Get <IAsyncRepository <PayerWebsiteMappingValue> >(); var location = clientLocations.FirstOrDefault(); var check = await pwmvRepo.FindWith2GuidsAsync(location.ClientKey, location.ClientLocationKey); if (check.Any()) { Console.WriteLine("Already have website mapping values for client location!!"); } else { var values = new List <PayerWebsiteMappingValue>(); var websiteMappingValues = PayerWebsiteMappingValue.CreateWebisteMappingValue ( location.ClientKey, location.ClientLocationKey ); values.Add(websiteMappingValues); var mappingValues = await pwmvRepo.AddAsync(values); Console.WriteLine(mappingValues); } } }
public async Task Create_Client_Master_Test() { IDbConnection smartAgentDb = new SqlConnection(ConfigurationManager.ConnectionStrings[_devAppConfigName].ConnectionString); var kernel = new StandardKernel(new RepoTestsModule(smartAgentDb)); var clientKey = Guid.NewGuid(); var clientLocationKey = Guid.NewGuid(); var clientName = "Test1"; var howToDeliver = "OSVC"; var newClient = new ClientMaster(clientName: clientName, clientKey: clientKey, howToDeliver: howToDeliver); var testlocation = ClientLocations.CreateClientLocation("Test1", clientKey, clientLocationKey, "clientId", "tpid", "facilityID"); testlocation.LastUserId = "kris.lindsey"; var clients = new List <ClientMaster>(); clients.Add(newClient); var creator = new SmartAgentClientCreator(smartAgentDb); var result = await creator.Create <ClientMaster>(clients); if (result != new Guid("00000000-0000-0000-0000-000000000000")) { var clientlocations = new List <ClientLocations>(); clientlocations.Add(testlocation); var clientlocation = await creator.Create <ClientLocations>(clientlocations); if (clientlocation != null) { var mappingValues = PayerWebsiteMappingValue.CreateWebisteMappingValue(clientKey, clientlocation); } } Console.Write("*******************"); Console.WriteLine(clientKey); Assert.AreEqual(newClient.ClientKey, result); }
public async Task Create_Client_Test() { // Get connection prepare for data entry IDbConnection smartAgentDb = new SqlConnection(ConfigurationManager.ConnectionStrings[_devAppConfigName].ConnectionString); // Instantiate Repositories needed for data entry var kernel = new StandardKernel(new RepoTestsModule(smartAgentDb)); // Start client creation process. var clientName = "Community Health Systems (CHS)"; var clientKey = new Guid("5ee74d8b-f1f9-4464-a1e3-aa7c4335d12d"); var howToDeliver = "OCSVC"; if (clientKey == new Guid("00000000-0000-0000-0000-000000000000")) { clientKey = Guid.NewGuid(); } var client = new ClientMaster(clientName: clientName, clientKey: clientKey, howToDeliver: howToDeliver); var clientLocationName = "CHS - Deaconess Med Ctr"; var clientId = "109781"; string facilityId = "VAC"; var tpId = "178995"; var lastUserId = "kris.lindsey"; IEnumerable <ClientMaster> clients = new List <ClientMaster>(); var clientMasterRepo = kernel.Get <IAsyncRepository <ClientMaster> >(); var clientLocationRepo = kernel.Get <IAsyncRepository <ClientLocations> >(); //Check to see if client already exists in data clients = await clientMasterRepo.FindByName(client.ClientName); // If one exits add location data if (clients.Any()) { var locations = new List <ClientLocations>(); var clientLocationKey = Guid.NewGuid(); var clientLocation = ClientLocations.CreateClientLocation ( clientLocationName, clientKey, clientLocationKey, clientId, tpId, facilityId ); clientLocation.LastUserId = lastUserId; locations.Add(clientLocation); var clientLocationEntryResult = await clientLocationRepo.AddAsync(locations); if (clientLocationEntryResult == clientLocation.ClientLocationKey) { var facilityRepo = kernel.Get <IAsyncRepository <FacilityMaster> >(); var newFacility = FacilityMaster.CreateFaciltiy ( clientLocation.ClientLocationName, Guid.NewGuid(), "0144300301443003", clientLocation.ClientKey, clientLocation.ClientLocationKey ); var facilites = new List <FacilityMaster>(); facilites.Add(newFacility); var result = await facilityRepo.AddAsync(facilites); var mappingValues = new List <PayerWebsiteMappingValue>(); var newMappingValue = PayerWebsiteMappingValue.CreateWebisteMappingValue ( clientKey, clientLocationKey ); mappingValues.Add(newMappingValue); var pwmvRepo = kernel.Get <IAsyncRepository <PayerWebsiteMappingValue> >(); var mvresult = await pwmvRepo.AddAsync(mappingValues); if (!string.IsNullOrWhiteSpace(clientLocationName)) { var criteriaRepo = new CreateSmartAgentUserRepo(smartAgentDb); var criteriaSearchRepo = kernel.Get <IAsyncRepository <CriteriaDetails> >(); //var criteriaSetName = ""; var insuranceName = "Emblem Submit"; var clientkey = new Guid("6648E492-D332-443B-8273-77992C36CD3E"); var criteriaSetname = clientName + insuranceName; var scriptKey = new Guid("CD2D1C15-D197-E211-B890-000C29729DFF"); var criteriaSetKey = Guid.NewGuid(); var iprkey = "PCEMBLEM01"; var c = Criteria.CreateCriteria ( criteriaSetname, criteriaSetKey, scriptKey, iprkey, clientkey, clientLocationKey, "kris.lindsey", "" ); var critera = await criteriaSearchRepo.FindByName(clientLocationName); if (critera.Any()) { Console.WriteLine("Found records! nothing to do hear :)"); return; } else { var results = await criteriaRepo.CreateCriteraRecords(c); Console.WriteLine("criteria created: ", result); } } } } //If not create client master record and then procedd to enter client data. else { var cs = new List <ClientMaster>(); cs.Add(client); var result = await clientMasterRepo.AddAsync(cs); if (result == clientKey) { } } foreach (var item in clients) { writeToConsole(item.ClientName + " ", item.ClientKey); } }