protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            kesineniDetails = new KesineniDetails();
            kesineniDetails.LoginId = KesineniConstants.LoginId;
            kesineniDetails.PassWord = KesineniConstants.Password;

            abhiBusDetails = new AbhiBusDetails();
            abhiBusDetails.Url = AbhiBusConstants.URL;

            bitlaDetails = new BitlaDetails();
            bitlaDetails.ApiKey = BitlaConstants.API_KEY;
            bitlaDetails.Url = BitlaConstants.URL;

            objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);
            this.Page.Title = "LoveJourney - Bus - Search";

            if (!IsPostBack)
            {
                getservices();
                if (val != "true")
                {
                    if (Session["Role"] != null)
                    {
                        CheckPermission("Book Ticket", Session["Role"].ToString());

                        objDataSet = null;
                        if (objDataSet == null)
                        {
                            objBAL = new ClsBAL();
                            objDataSet = objBAL.GetCities();
                            //HttpContext.Current.Session["Cities"] = objDataSet;

                        }
                        if (objDataSet != null)
                        {
                            if (objDataSet.Tables.Count > 0)
                            {
                                if (objDataSet.Tables[0].Rows.Count > 0)
                                {
                                    ddlSources.DataSource = objDataSet.Tables[0];
                                    ddlSources.DataTextField = "SourceName";
                                    ddlSources.DataValueField = "ID";
                                    ddlSources.DataBind();

                                    ddlDestinations.Items.Clear();
                                    ddlDestinations.DataSource = objDataSet.Tables[0];
                                    ddlDestinations.DataTextField = "SourceName";
                                    ddlDestinations.DataValueField = "ID";
                                    ddlDestinations.DataBind();

                                    if (Request.QueryString.Count == 0)
                                    {
                                        ddlSources.SelectedValue = ddlSources.Items.FindByText("Hyderabad").Value;
                                        ddlDestinations.SelectedValue = ddlDestinations.Items.FindByText("Bangalore").Value;
                                    }

                                    if (ddlSources.SelectedItem != null)
                                    {
                                        Session["From"] = ddlSources.SelectedItem.Text.ToString();
                                        Session["To"] = ddlDestinations.SelectedItem.Text.ToString();
                                    }
                                }
                            }
                        }

                        Session["DOJ"] = txtFromDate.Text.ToString();
                        Session["From"] = ddlSources.SelectedItem.Text.ToString();
                        Session["To"] = ddlDestinations.SelectedItem.Text.ToString();
                    }
                    else
                    {
                        Response.Redirect("~/Default.aspx", false);
                    }
                }
                else
                {
                    lblMainMsg.Text = "This Service is temporarily unavaliable";
                    lblMainMsg.ForeColor = System.Drawing.Color.Maroon;
                    tdmsg.Visible = true;
                    pnlBook.Visible = false;

                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblUPDOWNDate.Text = lblUPDOWNDateReturn.Text = "";
        try
        {
            if (!IsPostBack)
            {
                HttpContext.Current.Session["travelOperatorSelected"] = "";

                BaseClass baseCls = new BaseClass();
                baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

                lblRoute.Text = baseCls.preLoadParams[4].Trim() + "<span style='color:Blue;'> to </span>" + baseCls.preLoadParams[5].Trim()
                    + "<span style='color:Blue;'> on </span>" + baseCls.preLoadParams[2].Trim();

                Boolean tempParams = false;
                //Loop through baseCls.preLoadParams and check if all required values are set
                foreach (String item in baseCls.preLoadParams)
                {
                    //If return type is one way ReturnJourneyDate is optional
                    if (baseCls.preLoadParams[6].ToUpper().Equals("ONEWAY"))
                        if (baseCls.preLoadParams[3].Trim() == String.Empty)
                            continue;

                    if (item.Trim() == String.Empty)
                    {
                        tempParams = true;
                        break;
                    }
                }

                //If all required parameters are not set, reqirect user to default page.
                if (tempParams)
                {
                    Response.Redirect("~/Default.aspx", false);
                }
                else
                {
                    HttpContext.Current.Session["btnType"] = "btnContinue";

                    #region Load Sources and destinations in dropdowns

                    if (ObjDataset == null)
                    {
                        objBAL = new ClsBAL();
                        ObjDataset = objBAL.GetCities();
                    }
                    if (ObjDataset != null)
                    {
                        if (ObjDataset.Tables.Count > 0)
                        {
                            if (ObjDataset.Tables[0].Rows.Count > 0)
                            {
                                ddlSources.DataSource = ObjDataset.Tables[0];
                                ddlSources.DataTextField = "SourceName";
                                ddlSources.DataValueField = "ID";
                                ddlSources.DataBind();
                                ddlSources.Items.Insert(0, "----------");
                                //Session["sesDTDestinations"] = ObjDataset.Tables[0];
                            }
                        }
                    }

                    #endregion

                    DateTime dt = Convert.ToDateTime(baseCls.preLoadParams[2].ToString());
                    string sss = dt.ToString("dd-MMMM-yyyy");
                    lblJD.Text = sss;

                    ListItem lt = ddlSources.Items.FindByText(baseCls.preLoadParams[4].ToString());
                    ddlSources.SelectedValue = lt.Value;

                    DataTable dtDestinations = ObjDataset.Tables[0];//(DataTable)Session["sesDTDestinations"];
                    StringBuilder sbTravels = new StringBuilder();
                    if (dtDestinations.Rows.Count > 0)
                    {
                        sbTravels.Append("<select id=\"ddldestinationsDiv\" name=\"ddldestinationsDiv\" class=\"Dropdownlist\" >");

                        sbTravels.Append("<option value=''>----------</option>");
                        foreach (DataRow item in dtDestinations.Rows)
                        {
                            if (baseCls.preLoadParams[5].ToString() != item["SourceName"].ToString())
                            {
                                sbTravels.Append("<option value=" + item["ID"].ToString() + ">" + item["SourceName"].ToString() + "</option>");
                            }
                            else
                            {
                                sbTravels.Append("<option selected='selected' value=" + item["ID"].ToString() + ">" + item["SourceName"].ToString() + "</option>");
                            }
                        }
                        sbTravels.Append("</select>");
                    }
                    destinationsDiv.InnerHtml = sbTravels.ToString();

                    if (baseCls.preLoadParams[6].ToString() == "OneWay")
                    {
                        lblOnwardJourneyHeader.Visible = false;
                    }
                    else { lblOnwardJourneyHeader.Visible = true; }
                }
            }
        }
        catch (Exception ex)
        {
            if (ex.Message == "Object reference not set to an instance of an object.") { Response.Redirect("~/Default.aspx", false); }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.UserAgent.IndexOf("AppleWebKit") > 0) { Request.Browser.Adapters.Clear(); }
        //kesineniDetails = new KesineniDetails();
        //kesineniDetails.LoginId = KesineniConstants.LoginId;
        //kesineniDetails.PassWord = KesineniConstants.Password;

        //abhiBusDetails = new AbhiBusDetails();
        //abhiBusDetails.Url = AbhiBusConstants.URL;

        //bitlaDetails = new BitlaDetails();
        //bitlaDetails.ApiKey = BitlaConstants.API_KEY;
        //bitlaDetails.Url = BitlaConstants.URL;

        //objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

        lblUPDOWNDate.Text = lblUPDOWNDateReturn.Text = "";

        try
        {
            if (!IsPostBack)
            {
                if (Session["UserName"] != null)
                {
                    if (Session["Role"].ToString() == "Admin" || Session["Role"].ToString() == "CSE")
                    {
                        showmenus();
                        lblUsername.Text = "Welcome " + Session["UserName"].ToString();
                    }
                    else if (Session["Role"].ToString() == "User")
                    {
                        showmenus();
                        lblUsername.Text = "Welcome " + Session["UserName"].ToString();
                    }

                }
                BaseClass baseCls = new BaseClass();
                baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);
                travelOperatorSelected = "";

                lblRoute.Text = baseCls.preLoadParams[4].Trim() + "<span style='color:Black;'> <i>to</i> </span>" + baseCls.preLoadParams[5].Trim()
                    + "<span style='color:Black;'> <i>on</i> </span>" + baseCls.preLoadParams[2].Trim();

                Boolean tempParams = false;
                //Loop through baseCls.preLoadParams and check if all required values are set
                foreach (String item in baseCls.preLoadParams)
                {
                    //If return type is one way ReturnJourneyDate is optional
                    if (baseCls.preLoadParams[6].ToUpper().Equals("ONEWAY"))
                        if (baseCls.preLoadParams[3].Trim() == String.Empty)
                            continue;

                    if (item.Trim() == String.Empty)
                    {
                        tempParams = true;
                        break;
                    }
                }

                //If all required parameters are not set, reqirect user to default page.
                if (tempParams)
                {
                    Response.Redirect("~/Default.aspx", false);
                }
                else
                {
                    HttpContext.Current.Session["btnType"] = "btnContinue";

                    #region Load Sources and destinations in dropdowns

                    if (ObjDataset == null)
                    {
                        objManabusBAL = new ClsBAL();
                        ObjDataset = objManabusBAL.GetCities();
                    }
                    if (ObjDataset != null)
                    {
                        if (ObjDataset.Tables.Count > 0)
                        {
                            if (ObjDataset.Tables[0].Rows.Count > 0)
                            {
                                ddlSources.DataSource = ObjDataset.Tables[0];
                                ddlSources.DataTextField = "SourceName";
                                ddlSources.DataValueField = "ID";
                                ddlSources.DataBind();
                                ddlSources.Items.Insert(0, "----------");
                                //Session["sesDTDestinations"] = ObjDataset.Tables[0];
                            }
                        }
                    }

                    #endregion

                    DateTime dt = Convert.ToDateTime(baseCls.preLoadParams[2].ToString());
                    string sss = dt.ToString("dd-MMMM-yyyy");
                    lblJD.Text = sss;

                    ListItem lt = ddlSources.Items.FindByText(baseCls.preLoadParams[4].ToString());
                    ddlSources.SelectedValue = lt.Value;

                    DataTable dtDestinations = ObjDataset.Tables[0];//(DataTable)Session["sesDTDestinations"];
                    StringBuilder sbTravels = new StringBuilder();
                    if (dtDestinations.Rows.Count > 0)
                    {
                        sbTravels.Append("<select id=\"ddldestinationsDiv\" name=\"ddldestinationsDiv\" class=\"Dropdownlist\" >");

                        sbTravels.Append("<option value=''>----------</option>");
                        foreach (DataRow item in dtDestinations.Rows)
                        {
                            if (baseCls.preLoadParams[5].ToString() != item["SourceName"].ToString())
                            {
                                sbTravels.Append("<option value=" + item["ID"].ToString() + ">" + item["SourceName"].ToString() + "</option>");
                            }
                            else
                            {
                                sbTravels.Append("<option selected='selected' value=" + item["ID"].ToString() + ">" + item["SourceName"].ToString() + "</option>");
                            }
                        }
                        sbTravels.Append("</select>");
                    }
                    destinationsDiv.InnerHtml = sbTravels.ToString();

                    if (baseCls.preLoadParams[6].ToString() == "OneWay")
                    {
                        lblOnwardJourneyHeader.Visible = false;
                    }
                    else { lblOnwardJourneyHeader.Visible = true; }
                }
            }
        }
        catch (Exception ex)
        {
            if (ex.Message == "Object reference not set to an instance of an object.") { Response.Redirect("~/Default.aspx", false); }
        }
    }