Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var       bus = (BeBooking)Session["bus"];
                DataTable dt  = bal.SearchBus(bus);
                foreach (DataRow dr in dt.Rows)
                {
                    cost       = dr["cost"].ToString();
                    dr["cost"] = cost.Substring(0, 6);
                }
                txtSrc.Value = bus.start.ToString();
                txtDst.Value = bus.destination.ToString();
                txtDoj.Value = bus.dte.Date.ToString().Substring(0, 9);

                //GridView2.Columns[0].
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }
Пример #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BalBooking2 bal = new BalBooking2();

            bus.uid         = Convert.ToInt32(lbl_custid.Text);
            bus.start       = ddlFrom.SelectedValue.ToString();
            bus.destination = ddlTo.SelectedValue.ToString();
            bus.dte         = Convert.ToDateTime(txtDate.Text).Date;
            Session["bus"]  = bus;
            DataTable dt = bal.SearchBus(bus);

            if (dt.Rows.Count == 0)
            {
                string script = "alert('No Route Found');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true);
                txtDate.Text = "";
            }
            else
            {
                Response.Redirect("BookingBus.aspx");
            }
        }