コード例 #1
0
        public static ComputerSystem SetupKiosk()
        {
            string         hostName = Dns.GetHostName();
            ComputerSystem system   = new ComputerSystem(hostName, true);
            IPHostEntry    ipEntry;

            if (system.SystemId == Constants.NULL_INT)
            {
                ipEntry = Dns.GetHostEntry(hostName);
                var ipAddress = ipEntry.AddressList.First();

                foreach (var ip in ipEntry.AddressList)
                {
                    system.LoadByKioskIp(ip.ToString());

                    if (system.SystemId != Constants.NULL_INT)
                    {
                        ipAddress = ip;
                        break;
                    }
                }

                system.Kiosk          = true;
                system.Active         = true;
                system.OrganizationId = CheckInTestConstants.ORG_ID;

                if (system.SystemId == Constants.NULL_INT)
                {
                    system.SystemName = string.Format("Test System - {0}", ipAddress);
                    system.Save();
                    system.RegisterIpAddresses(ipEntry.AddressList);
                }
                else
                {
                    system.Save();
                }
            }

            return(system);
        }