Exemplo n.º 1
0
        private void ShowAllBtn_Click(object sender, EventArgs e)
        {
            List <Bus> listOfBus = br.GetAllBus();

            this.BusTable2.DataSource = listOfBus;

            for (int a = 0; a < listOfBus.Count; a++)
            {
                BusTable2.Rows[a].Cells[0].Value = listOfBus[a].BusId;
                BusTable2.Rows[a].Cells[1].Value = listOfBus[a].BusName;
                BusTable2.Rows[a].Cells[2].Value = listOfBus[a].From;
                BusTable2.Rows[a].Cells[3].Value = listOfBus[a].To;
                BusTable2.Rows[a].Cells[4].Value = listOfBus[a].Date;
                BusTable2.Rows[a].Cells[5].Value = listOfBus[a].Time;
                BusTable2.Rows[a].Cells[6].Value = listOfBus[a].Type;
                BusTable2.Rows[a].Cells[7].Value = listOfBus[a].NumberOfSeats;
                BusTable2.Rows[a].Cells[8].Value = listOfBus[a].Fare;
            }
        }
Exemplo n.º 2
0
        private void SearchBusbtn_Click(object sender, EventArgs e)
        {
            SeatBookBtn.Enabled = false;
            string from = FromCbox.Text;
            string to   = ToCbox.Text;
            string date = DateTimePicker1.Text;
            string type = null;

            if (AcRbtn.Checked == true)
            {
                type = "Ac";
            }
            else if (NonAcRbtn.Checked == true)
            {
                type = "Non-Ac";
            }
            else
            {
            }

            int flag = 0;

            BusTable.Rows.Clear();

            List <Bus> listOfBus = null;;

            listOfBus = br.GetAllBus(from, to, date, type);
            if (from != null && to != null && date != null && type != null)
            {
                for (int a = 0; a < listOfBus.Count; a++)
                {
                    BusTable.Rows.Add();
                    BusTable.Rows[a].Cells[0].Value = listOfBus[a].BusId;
                    BusTable.Rows[a].Cells[1].Value = listOfBus[a].BusName;
                    BusTable.Rows[a].Cells[2].Value = listOfBus[a].Date;
                    BusTable.Rows[a].Cells[3].Value = listOfBus[a].Time;
                    BusTable.Rows[a].Cells[4].Value = listOfBus[a].NumberOfSeats;
                    BusTable.Rows[a].Cells[5].Value = listOfBus[a].Fare;
                }

                flag = 1;

                if (flag == 1)
                {
                    BusTablePanel.Visible = true;
                    FromToPanel.Visible   = false;
                    WelcomePanel.Visible  = false;
                }
            }
            else
            {
                MessageBox.Show("oops! something is missing. Please check again!");
            }
        }