public void PopulateTerminalSettings( string unit, int term )
        {
            var settings = AlohaTerminalReader.Instance;

            AlohaTerminal terminal = new AlohaTerminal();

            foreach ( var t in settings.Terminals )
            {
                if ( t.UnitName.Equals( unit, StringComparison.InvariantCultureIgnoreCase ) && t.Term.Equals( term ) )
                {
                    terminal = t;
                }
            }

            TermTextBox.Text = terminal.Term.ToString();
            TermNameTextBox.Text = terminal.TermName;
            WorkgroupTextBox.Text = terminal.Workgroup;
            IPAddressTextBox.Text = terminal.IPAddress.ToString();
            SubnetMaskTextBox.Text = terminal.SubnetMask.ToString();
            DefaultGatewayTextBox.Text = terminal.DefaultGateway.ToString();
            DNS1TextBox.Text = terminal.DNS1.ToString();
            DNS2TextBox.Text = terminal.DNS2.ToString();
            FileserverNameTextBox.Text = terminal.FileserverName;
            NumberTerminalsTextBox.Text = terminal.NumberOfTerminals.ToString();
            MasterCapableTextBox.Text = terminal.MasterCapable.ToString();
            ServerCapableTextBox.Text = terminal.ServerCapable.ToString();
        }
예제 #2
0
        private void kbd_SaveAndReboot_Click( object sender, EventArgs e )
        {
            // Disable reboot button
            kbd_SaveAndReboot.Enabled = false;

            var model = new AlohaTerminal()
            {
                IPAddress = IPAddress.Parse( IPAddress_AddressTextBox.Text ),
                FileserverName = FileserverName_FileserverName.Text,
                Term = Convert.ToInt32( TerminalNumber_TerminalNumber.Text ),
                NumberOfTerminals = Convert.ToInt32( NumberOfTerminals_NumberOfTerminals.Text ),
                MasterCapable = true,
                ServerCapable = true
            };

            var config = new AlohaConfiguratorController( model );

            config.Configure();
        }
예제 #3
0
        public List<AlohaTerminal> ReadTerminals( string unitName, int? termNum )
        {
            var terminals = new List<AlohaTerminal>();

            Db.Open();

            using ( var cmd = new OleDbCommand() )
            {
                cmd.Connection = Db;

                if ( unitName != null )
                {
                    if ( termNum != null )
                    {
                        cmd.CommandText = @"SELECT * FROM [" + Filename + @"] WHERE UnitName=@unitname AND Term=@termnum ORDER BY UnitName, Term";
                        cmd.Parameters.Add( new OleDbParameter( "@unitname", unitName ) );
                        cmd.Parameters.Add( new OleDbParameter( "@termnum", termNum ) );
                    }
                    else
                    {
                        cmd.CommandText = @"SELECT * FROM [" + Filename + @"] WHERE UnitName=@unitnum ORDER BY UnitName, Term";
                        cmd.Parameters.Add( new OleDbParameter( "@unitname", unitName ) );
                    }
                }
                else
                {
                    cmd.CommandText = @"SELECT * FROM [" + Filename + @"] ORDER BY UnitName, Term";
                }

                using ( var reader = cmd.ExecuteReader() )
                {
                    while ( reader.Read() )
                    {
                        var term = new AlohaTerminal();

                        term.UnitName = Convert.ToString( reader["UnitName"] );

                        term.Term = Convert.ToInt32( reader["Term"] );
                        term.Workgroup = Convert.ToString( reader["Workgroup"] );

                        term.IPAddress = IPAddress.Parse( Convert.ToString( reader["IPAddress"] ) );
                        term.SubnetMask = IPAddress.Parse( Convert.ToString( reader["SubnetMask"] ) );
                        term.DefaultGateway = IPAddress.Parse( Convert.ToString( reader["DefaultGateway"] ) );
                        term.DNS1 = IPAddress.Parse( Convert.ToString( reader["DNS1"] ) );
                        term.DNS2 = IPAddress.Parse( Convert.ToString( reader["DNS2"] ) );

                        term.NumberOfTerminals = Convert.ToInt32( reader["NumberOfTerminals"] );
                        term.FileserverName = Convert.ToString( reader["FileserverName"] );

                        term.MasterCapable = Convert.ToBoolean( reader["MasterCapable"] );
                        term.ServerCapable = Convert.ToBoolean( reader["ServerCapable"] );

                        // term.TimeZone = ;

                        terminals.Add( term );
                    }
                }
            }
            Db.Close();

            return terminals;
        }