void UpdateEverySecond()
    {
        if (clients > 0)
        {
            var sendMsg = new ClientLocations();
            int count   = 0;
            foreach (GameObject player in connectedPlayerDictionary.Values)
            {
                switch (count)
                {
                case 0:
                    sendMsg.devicePosition1 = player.transform.position;
                    sendMsg.deviceRotation1 = player.transform.rotation;
                    break;

                case 1:
                    sendMsg.devicePosition2 = player.transform.position;
                    sendMsg.deviceRotation2 = player.transform.rotation;
                    break;

                case 2:
                    sendMsg.devicePosition3 = player.transform.position;
                    sendMsg.deviceRotation3 = player.transform.rotation;
                    break;

                case 3:
                    sendMsg.devicePosition4 = player.transform.position;
                    sendMsg.deviceRotation4 = player.transform.rotation;
                    break;

                case 4:
                    sendMsg.devicePosition5 = player.transform.position;
                    sendMsg.deviceRotation5 = player.transform.rotation;
                    break;

                case 5:
                    sendMsg.devicePosition6 = player.transform.position;
                    sendMsg.deviceRotation6 = player.transform.rotation;
                    break;

                case 6:
                    sendMsg.devicePosition7 = player.transform.position;
                    sendMsg.deviceRotation7 = player.transform.rotation;
                    break;

                case 7:
                    sendMsg.devicePosition8 = player.transform.position;
                    sendMsg.deviceRotation8 = player.transform.rotation;
                    break;

                default:
                    print("Trying to add 9th player at server side. Please check");
                    break;
                }

                count++;
            }
            NetworkServer.SendToAll(778, sendMsg);
        }
    }
Exemplo n.º 2
0
        public async Task Create_ClientLocation_Test()
        {
            var    clientLocationName = "Martin Memorial Medical Center - North Campus";
            var    clientId           = "120722";
            string facilityId         = null;
            var    tpId       = "196320";
            var    lastUserId = "kris.lindsey";

            IDbConnection smartAgentDb         = new SqlConnection(ConfigurationManager.ConnectionStrings[_devAppConfigName].ConnectionString);
            var           kernel               = new StandardKernel(new RepoTestsModule(smartAgentDb));
            IEnumerable <ClientMaster> clients = null;
            var clientMasterRepo               = kernel.Get <IAsyncRepository <ClientMaster> >();
            var clientLocationRepo             = kernel.Get <IAsyncRepository <ClientLocations> >();


            clients = await clientMasterRepo.FindByName("Martin");

            foreach (var item in clients)
            {
                writeToConsole(item.ClientName + " ", item.ClientKey);
            }
            if (clients.Any())
            {
                var locations      = new List <ClientLocations>();
                var client         = clients.FirstOrDefault();
                var clientKey      = client.ClientKey;
                var clientLocation = ClientLocations.CreateClientLocation(
                    clientLocationName,
                    clientKey,
                    Guid.NewGuid(),
                    clientId,
                    tpId,
                    facilityId
                    );
                var deviceId = clientLocationName.Split(' ').FirstOrDefault();

                clientLocation.ClientKey          = clientKey;
                clientLocation.ClientLocationKey  = Guid.NewGuid();
                clientLocation.ClientLocationName = clientLocationName;
                clientLocation.DeviceId           = deviceId;
                clientLocation.ClientId           = clientId;
                clientLocation.TpId       = tpId;
                clientLocation.FacilityId = facilityId;
                clientLocation.LastUserId = lastUserId;

                locations.Add(clientLocation);

                Guid locationKey;

                smartAgentDb.Open();
                locationKey = await clientLocationRepo.AddAsync(locations);

                smartAgentDb.Close();

                writeToConsole(clientLocationName + " ", locationKey);
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public async Task Add_ClientLocation_Test()
        {
            //var cl2 = new ClientLocations();
            //cl2.ClientLocationName = "Norton Kosair Children Medical Center - Brownsboro";
            //cl2.ClientKey = new Guid("f3ed1f27-4023-4c31-a1ec-75498bad2da9");
            //cl2.ClientLocationKey = new Guid("79f149f3-716d-4a44-b67b-ce72fa56725a");
            //cl2.DeviceId = "NortonKY";
            //cl2.ClientId = "114173";
            //cl2.FacilityId = "NHSG-KCHB";
            //cl2.TpId = "178916";

            //var cl = new ClientLocations();
            //cl.ClientLocationName = "Norton Diagnostic Center- Fern Creek";
            //cl.ClientKey = new Guid("f3ed1f27-4023-4c31-a1ec-75498bad2da9");
            //cl.ClientLocationKey = new Guid("e1c67e84-31f6-4d7f-af10-3d6114391bb6");
            //cl.DeviceId = "NortonFern";
            //cl.ClientId = "105979";
            //cl.FacilityId = "NHSG-NS";
            //cl.TpId = "178916";

            //var cl3 = new ClientLocations();
            //cl3.ClientLocationName = "Norton Specialists";
            //cl3.ClientKey = new Guid("f3ed1f27-4023-4c31-a1ec-75498bad2da9");
            //cl3.ClientLocationKey = new Guid("f6ee6759-da08-4768-8d35-d1d54e749d5e");
            //cl3.DeviceId = "NortonLouis";
            //cl3.ClientId = "114993";
            //cl3.FacilityId = "NHSG-NS";
            //cl3.TpId = "178916";

            var cl4 = ClientLocations.CreateClientLocation(
                "Norton Women's and Kosair Children's Hospital",
                new Guid("f3ed1f27-4023-4c31-a1ec-75498bad2da9"),
                new Guid("d16d3868-e814-44f6-a6ff-08daf5e77874"),
                "102745",
                "178916",
                "NHSG-KCH"
                );

            //var cl5 = new ClientLocations();
            //cl5.ClientLocationName = "Norton Women's and Kosair Children's Hospital(old Suburban)";
            //cl5.ClientKey = new Guid("f3ed1f27-4023-4c31-a1ec-75498bad2da9");
            //cl5.ClientLocationKey = new Guid("d16d3868-e814-44f6-a6ff-08daf5e77874");
            //cl5.DeviceId = "NortonLPCC";
            //cl5.ClientId = "102745";
            //cl5.FacilityId = "NHSG-KCH";
            //cl5.TpId = "178916";

            var cls = new List <ClientLocations>();

            // cls.Add(cl);
            //  cls.Add(cl2);
            //cls.Add(cl3);
            cls.Add(cl4);
            // cls.Add(cl5);


            var container = new UnityContainer();

            using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings[_devAppConfigName].ConnectionString))
            {
                container.RegisterType <ISmartAgentRepository, SmartAgentRepo>(new InjectionConstructor(db));
                var repo = container.Resolve <ISmartAgentRepository>();
                await repo.AddClientLocationRecords(cls);
            }

            //Action<IEnumerable<ClientLocations>, string> AddClientLocation = async (locations, source) =>
            //{
            //    var container = new UnityContainer();
            //    using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings[source].ConnectionString))
            //    {
            //        container.RegisterType<ISmartAgentRepository, SmartAgentRepo>(new InjectionConstructor(db));
            //        var repo = container.Resolve<ISmartAgentRepository>();
            //        await repo.AddClientLocationRecords(locations);
            //    }
            //};

            //AddClientLocation(cls, _devAppConfigName);
            Console.WriteLine("complete..");
        }
Exemplo n.º 5
0
        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);
            }
        }