コード例 #1
0
        private void busSearchBtn_Click(object sender, EventArgs e)
        {
            string coach = busSearchBox.Text.Trim();
            var    bus   = BusesController.searchBus(coach);

            if (bus == null)
            {
                MessageBox.Show("Bus not found", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            busCoachBox.Text = bus.Coach;
            if (bus.Type == "AC")
            {
                busAcRadio.Checked = true;
            }
            else
            {
                busNonAcRadio.Checked = true;
            }
            busesTime.Text = bus.Time;

            busId = bus.Id;

            //busAddBtn.Enabled = false;
            busTrash.Visible = true;
        }
コード例 #2
0
        private void coachBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var coach = BusesController.searchBus(coachBox.Text);

            if (coach != null)
            {
                bustype = coach.Type;
                if (bustype.Equals("AC"))
                {
                    acRadioButton.Checked    = true;
                    nonAcRadioButton.Checked = false;
                }
                else if (bustype == "Non AC")
                {
                    nonAcRadioButton.Checked = true;
                    acRadioButton.Checked    = false;
                }
                journeyTime.Text = coach.Time;
            }
        }