protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                Accordion_sefer_list.Visible = false;
                lbl_error.Visible            = false;
            }
            else
            {
                Sefer sefer1 = new Sefer("26PMK26-20200328-0315", "BURSA", "İSTANBUL-AVRUPA(ESENLER)", "2020-03-28", "03:15", "62");
                Sefer sefer2 = new Sefer("26PMK27-20200328-0700", "BURSA", "İSTANBUL-AVRUPA(ESENLER)", "2020-03-28", "07:00", "62");
                Sefer sefer3 = new Sefer("26PMK28-20200328-0900", "BURSA", "İSTANBUL-AVRUPA(ESENLER)", "2020-03-28", "09:00", "62");

                seferler.Add((Sefer)sefer1);
                seferler.Add((Sefer)sefer2);
                seferler.Add((Sefer)sefer3);

                secilen_koltuklar = (ArrayList)ViewState["secilen_koltuklar"];

                for (int i = 0; i < seferler.Count; i++)
                {
                    fill_accord(i);
                }
            }
        }
        public void fill_accord(int sefer_index)
        {
            Sefer current_sefer = (Sefer)seferler[sefer_index];

            OleDbCommand cmd_bus_capacity = new OleDbCommand("select BusCapacity from Booking where BookingID =  '" + current_sefer.BookingId.ToString() + "'", conn);

            conn.Open();
            OleDbDataReader dr_bus_capacity = cmd_bus_capacity.ExecuteReader();

            dr_bus_capacity.Read();
            String sayi         = dr_bus_capacity["BusCapacity"].ToString();
            int    bus_capacity = Int32.Parse(sayi);

            current_sefer.set_Seat_0(bus_capacity);
            conn.Close();

            OleDbCommand cmd_seats = new OleDbCommand("select PassengerGender,PassenderSeatID from Booking where BookingID =  '" + current_sefer.BookingId.ToString() + "'", conn);

            conn.Open();
            OleDbDataReader dr_seats = cmd_seats.ExecuteReader();

            while (dr_seats.Read())
            {
                if (dr_seats["PassengerGender"].ToString() == "F")
                {
                    current_sefer.Seat[Int32.Parse(dr_seats["PassenderSeatID"].ToString()) - 1] = 1;
                }
                else
                {
                    current_sefer.Seat[Int32.Parse(dr_seats["PassenderSeatID"].ToString()) - 1] = 2;
                }
            }

            conn.Close();

            int bus_row = bus_capacity / 8;

            if (bus_row == 2)
            {
                if (sefer_index == 0)
                {
                    build_otobus_panel(pnl_otobus_1, current_sefer.Seat, sefer_index.ToString());
                }
                else if (sefer_index == 1)
                {
                    build_otobus_panel(pnl_otobus_2, current_sefer.Seat, sefer_index.ToString());
                }
                else
                {
                    build_otobus_panel(pnl_otobus_3, current_sefer.Seat, sefer_index.ToString());
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            seferler          = (ArrayList)Session["Seferler"];
            secilen_koltuklar = (ArrayList)Session["Secilen_Koltuklar"];

            if (secilen_koltuklar == null)
            {
                Response.Redirect("MainPage.aspx");
            }

            string[] secilen_sefer = secilen_koltuklar[0].ToString().Split('-');
            Sefer    current_sefer = (Sefer)seferler[Int32.Parse(secilen_sefer[0])];

            if (!this.IsPostBack)
            {
                lbl_tarih.Text  = lbl_tarih.Text + current_sefer.Date;
                lbl_kalkis.Text = lbl_kalkis.Text + current_sefer.From;
                lbl_varis.Text  = lbl_varis.Text + current_sefer.To;
                lbl_saat.Text   = lbl_saat.Text + current_sefer.Hour;
            }

            for (int i = 0; i < secilen_koltuklar.Count; i++)
            {
                string[] secilen_koltuk = secilen_koltuklar[i].ToString().Split('-');

                HtmlGenericControl div_card = new HtmlGenericControl("div");
                div_card.Attributes.Add("class", "card border-light");
                div_card.Attributes.Add("style", "border-width: 3px;");

                HtmlGenericControl div_card_body = new HtmlGenericControl("div");
                div_card_body.Attributes.Add("class", "card-body");

                HtmlGenericControl div_row = new HtmlGenericControl("div");
                div_row.Attributes.Add("class", "row");

                HtmlGenericControl div_col_1 = new HtmlGenericControl("div");
                div_col_1.Attributes.Add("class", "col-md-1");

                ImageButton img_btn = new ImageButton();
                if (secilen_koltuk[2] == "F")
                {
                    img_btn.ImageUrl = "~/images/f.svg";
                }
                else
                {
                    img_btn.ImageUrl = "~/images/m.svg";
                }

                Label lbl_koltuk_no = new Label();
                lbl_koltuk_no.Text = secilen_koltuk[1];

                div_col_1.Controls.Add(img_btn);

                div_col_1.Controls.Add(new Literal()
                {
                    Text = "<hr/>"
                });

                div_col_1.Controls.Add(lbl_koltuk_no);

                HtmlGenericControl div_col_2 = new HtmlGenericControl("div");
                div_col_2.Attributes.Add("class", "col-md-2");

                TextBox txt_box_name = new TextBox();
                txt_box_name.ID = "txt_box_name_" + i.ToString();
                txt_box_name.Attributes.Add("class", "form-control");
                txt_box_name.Attributes.Add("placeholder", "Ad");
                txt_box_name.Attributes.Add("type", "text");
                div_col_2.Controls.Add(txt_box_name);

                HtmlGenericControl div_col_3 = new HtmlGenericControl("div");
                div_col_3.Attributes.Add("class", "col-md-2");

                TextBox txt_box_surname = new TextBox();
                txt_box_surname.ID = "txt_box_surname_" + i.ToString();
                txt_box_surname.Attributes.Add("class", "form-control");
                txt_box_surname.Attributes.Add("placeholder", "Soyad");
                txt_box_surname.Attributes.Add("type", "text");
                div_col_3.Controls.Add(txt_box_surname);

                HtmlGenericControl div_col_4 = new HtmlGenericControl("div");
                div_col_4.Attributes.Add("class", "col-md-2");

                TextBox txt_box_phone = new TextBox();
                txt_box_phone.ID = "txt_box_phone_" + i.ToString();
                txt_box_phone.Attributes.Add("class", "form-control");
                txt_box_phone.Attributes.Add("placeholder", "500-000-00-00");
                txt_box_phone.Attributes.Add("pattern", "[0-9]{3}-[0-9]{3}-[0-9]{2}-[0-9]{2}");
                txt_box_phone.Attributes.Add("title", "Telefon numarası 500-000-00-00 bu düzene uymalıdır. ");
                txt_box_phone.Attributes.Add("type", "tel");
                div_col_4.Controls.Add(txt_box_phone);

                HtmlGenericControl div_col_5 = new HtmlGenericControl("div");
                div_col_5.Attributes.Add("class", "col-md-2");

                TextBox txt_box_email = new TextBox();
                txt_box_email.ID = "txt_box_email_" + i.ToString();
                txt_box_email.Attributes.Add("class", "form-control");
                txt_box_email.Attributes.Add("placeholder", "Email");
                txt_box_email.Attributes.Add("type", "text");
                div_col_5.Controls.Add(txt_box_email);

                HtmlGenericControl div_col_6 = new HtmlGenericControl("div");
                div_col_6.Attributes.Add("class", "col-md-2");

                TextBox txt_box_tc = new TextBox();
                txt_box_tc.ID = "txt_box_tc_" + i.ToString();
                txt_box_tc.Attributes.Add("class", "form-control");
                txt_box_tc.Attributes.Add("placeholder", "TC");
                txt_box_tc.Attributes.Add("type", "number");
                txt_box_tc.Attributes.Add("pattern", "[0-9]{11}");
                txt_box_tc.Attributes.Add("title", "TC 11 haneli sayı olmalıdır.");
                txt_box_tc.Attributes.Add("type", "tel");
                div_col_6.Controls.Add(txt_box_tc);

                HtmlGenericControl div_col_7 = new HtmlGenericControl("div");
                div_col_7.Attributes.Add("class", "col-md-1 right");

                Button btn_register = new Button();
                btn_register.ID = "btn_register_" + i.ToString();
                btn_register.Attributes.Add("class", "btn btn-danger");
                btn_register.Text = "Register";
                div_col_7.Controls.Add(btn_register);
                btn_register.Click += Btn_register_Click;

                Label lbl_error = new Label();
                lbl_error.ID      = "lbl_error_" + i.ToString();
                lbl_error.Visible = false;
                lbl_error.Attributes.Add("class", "text-danger");

                div_row.Controls.Add(div_col_1);
                div_row.Controls.Add(div_col_2);
                div_row.Controls.Add(div_col_3);
                div_row.Controls.Add(div_col_4);
                div_row.Controls.Add(div_col_5);
                div_row.Controls.Add(div_col_6);
                div_row.Controls.Add(div_col_7);
                div_row.Controls.Add(lbl_error);
                div_card_body.Controls.Add(div_row);
                div_card.Controls.Add(div_card_body);
                pnl_list.Controls.Add(div_card);
            }
        }