public static String[] GetRoutes(String Sorting, String Filter)
    {
        String[] returnval = null;
        try
        {
            BaseClass baseCls = new BaseClass();
            baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

            if (Filter.ToLower() == "reset" && Sorting.ToLower() == "reset")
            {
                HttpContext.Current.Session["travelOperatorSelected"] = null;
                DataTable dt = (DataTable)HttpContext.Current.Session["dtRoutes"];
                returnval = GetDataset(dt);
            }

            else if (Sorting.ToLower() == "modify")
            {

                HttpContext.Current.Session["travelOperatorSelected"] = null;
                String[] filterparams = Filter.Split('*');

                baseCls.preLoadParams[0] = filterparams[0].ToString();
                baseCls.preLoadParams[1] = filterparams[1].ToString();
                baseCls.preLoadParams[2] = filterparams[2].ToString();
                baseCls.preLoadParams[3] = baseCls.preLoadParams[3].ToString();
                baseCls.preLoadParams[4] = filterparams[3].ToString();
                baseCls.preLoadParams[5] = filterparams[4].ToString();
                baseCls.preLoadParams[6] = baseCls.preLoadParams[6].ToString();

                HttpContext.Current.Session["Parameters"] = baseCls;

                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

                DataTable dtroutes = null;

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[2].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }

            else if (Filter.ToUpper() != "NONE")
            {
                String[] filterparams = Filter.Split(',');

                string minPrice = filterparams[5].ToString();
                string maxPrice = filterparams[6].ToString();
                string minDepTime = filterparams[7].ToString();
                string maxDepTime = filterparams[8].ToString();

                FilterBusesWithSliders(minPrice, maxPrice, minDepTime, maxDepTime);

                returnval = FilterBuses(
                    Boolean.Parse(filterparams[0])
                    , Boolean.Parse(filterparams[1])
                    , Boolean.Parse(filterparams[2])
                    , Boolean.Parse(filterparams[3])
                    , filterparams[4].ToString(), Sorting);
            }

            else
            {
                HttpContext.Current.Session["travelOperatorSelected"] = null;
                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

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

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[2].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }
        }
        catch (Exception ex)
        {

        }
        return returnval;
    }
    public static String[] GetSeatLayout(String args)
    {
        String[] returnval = new String[4];
        try
        {
            BaseClass baseCls = new BaseClass();
            baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

            KesineniDetails kesineniDetails;
            AbhiBusDetails abhiBusDetails;
            BitlaDetails bitlaDetails;
            KABCommon objCommon;
            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);

            string[] strArray = args.Split('~');

            string TripType = baseCls.preLoadParams[6].ToString();

            string type = strArray[7].ToString();//Onward,Return

            #region Boarding Points

            System.Text.StringBuilder sbBoardingPoints = new System.Text.StringBuilder();

            DataTable dtBoardingPoints = new DataTable();
            DataTable dtDroppiongPoints = null;
            DataTable dtBitlaSeatLayout = null;

            if (strArray[0].ToString() == "Abh")
            {
                DataTable dtBP = new DataTable();
                dtBP.Columns.Add("Name");
                dtBP.Columns.Add("Id");
                dtBP.Columns.Add("Address");
                dtBP.Columns.Add("ContactNumber");
                dtBP.Columns.Add("Landmark");

                string strBP = strArray[6].ToString();

                if (strBP != "")
                {
                    string[] str = new string[1];
                    str[0] = "%&%";
                    string[] ssstr = strBP.Split(str, StringSplitOptions.None);
                    foreach (string st in ssstr)
                    {
                        if (st != "")
                        {
                            string[] sp = new string[1];
                            sp[0] = "%&&%";

                            string[] strAA = st.Split(sp, StringSplitOptions.None);

                            string[] strArr = strAA[0].ToString().Split('-');

                            DataRow dr = dtBP.NewRow();
                            if (strArr.Length == 3)
                            {
                                dr["Name"] = strArr[0].ToString() + " - " + strArr[1].ToString();
                                dr["Id"] = strArr[2].ToString().Trim().ToString();
                                dr["Address"] = "";
                                dr["ContactNumber"] = strAA[1].ToString();
                                dr["Landmark"] = "";
                                dtBP.Rows.Add(dr);
                            }
                            else if (strArr.Length == 5)
                            {
                                dr["Name"] = strArr[0].ToString() + "" + strArr[1].ToString() + "" + strArr[2].ToString() + " - " + strArr[3].ToString();
                                dr["Id"] = strArr[4].ToString().Trim().ToString();
                                dr["Address"] = "";
                                dr["ContactNumber"] = strAA[1].ToString();
                                dr["Landmark"] = "";
                                dtBP.Rows.Add(dr);
                            }
                        }
                    }
                }
                dtBoardingPoints = dtBP;
            }
            else
            {
                if (strArray[0].ToString() == "Bit")
                {
                    dtBitlaSeatLayout = objCommon.GetBitlaSeatLayoutAndBoardingPoints(strArray[1].ToString(), out dtBoardingPoints);
                }
                else
                {
                    dtBoardingPoints = objCommon.GetBoardingPoints(strArray[1].ToString(), strArray[0].ToString());
                }
                if (strArray[0].ToString() == "Kes")
                {
                    dtDroppiongPoints = objCommon.GetDropingPoints(strArray[1].ToString(), strArray[0].ToString());
                    DataRow dr = dtDroppiongPoints.Rows[Convert.ToInt32(dtDroppiongPoints.Rows.Count - 1)];
                }
            }

            HttpContext.Current.Session["dtBPForAddressAndLandmark"] = dtBoardingPoints;
            HttpContext.Current.Session["dtDPForAddressAndLandmark"] = dtDroppiongPoints;

            HttpContext.Current.Session["lblB"] = strArray[4].ToString();
            HttpContext.Current.Session["ServiceNumber"] = strArray[5].ToString();

            sbBoardingPoints.Append("<a href='' id=\"lblBP\" class=\"fg-button fg-button-icon-right ui-widget ui-state-default ui-corner-all\" onclick=\"$('#ulbp').slideDown('fast'); return false; \">" + " <span class=\"ui-icon ui-icon-triangle-1-s\"></span>" + "Boarding Points</a>");
            sbBoardingPoints.Append("<label id=\"lblBoardingPoint\" style=\"display: none;\" class=\"add_cont\"></label>");
            sbBoardingPoints.Append("<input id=\"boardingpoint\" type=\"hidden\" value='' name=\"boardingpoint\">");
            sbBoardingPoints.Append("<ul class=\"boardingpoints\" style=\"display: none; position: absolute;\" id='ulbp'>");
            sbBoardingPoints.Append("<img src='images/closeseatlayout.png' onclick=\"$('#ulbp').slideUp('meduim');\" title='close' style=\"float: right;\"/>");

            foreach (DataRow dr in dtBoardingPoints.Rows)
            {
                dr["Address"] = dr["Address"].ToString().Replace("\n", "&nbsp;");
                sbBoardingPoints.Append("<li id=\"" + dr["Id"].ToString() + "\"><span onmouseover=\"showPanel(event, 'boardingpoint_info', '" + dr["ContactNumber"].ToString() + "~" + dr["Landmark"].ToString() + "~" + dr["Address"].ToString() + "');\" ");
                sbBoardingPoints.Append("onmouseout=\"closePanel('boardingpoint_info');\" onclick=\"closePanel('boardingpoint_info'); $('#boardingpoint').val($(this).parent()[0].id); $('#lblBP').html($(this).html()); $('#lblBoardingPoint').html($(this).html()); $('#ulbp').fadeOut('meduim');\">" + dr["Name"].ToString() + "</span> </li>"); //alert( $('#boardingpoint').val());
            }

            sbBoardingPoints.Append("</ul>");

            #endregion

            string strNoLayout = "";
            string strNoBp = "";
            StringBuilder sbSeatLayout = new StringBuilder();
            DataTable dtMain = null;
            if (strArray[0].ToString() == "Bit")
            {
                dtMain = dtBitlaSeatLayout;
                if (dtMain.Rows.Count == 0)
                {
                    strNoLayout = " <div style=\"\"><h1> Service is no longer available. </h1></div>";
                    strNoBp = " --- ";
                }
            }
            else
            {
                dtMain = objCommon.GetSeatLayout(strArray[0].ToString(), strArray[1].ToString()).Tables[0];
                if (dtMain.Rows.Count == 0)
                {
                    strNoLayout = " <div style=\"\"><h1> Service is no longer available. </h1></div>";
                    strNoBp = " --- ";
                }
            }

            returnval[0] = sbBoardingPoints.ToString();

            if (strNoLayout != "")
            {
                returnval[1] = strNoLayout;
            }
            else { returnval[1] = GetSeatLayout(dtMain, strArray[3].ToString(), strArray[2].ToString()); }

            returnval[2] = strArray[2].ToString() + " || " + strArray[3].ToString();

            returnval[3] = "btnContinue";
        }
        catch (Exception ex)
        {
            //
            Mailsender.SendErrorEmail("*****@*****.**", "[email protected];",
                                         "", "SeatLayoutIssue // LoveJourney.in", args.ToString()
                                         + "////////////////////////////////////////////////////////////////////////////////////"
                                         + ex.Message + ex.Source + ex.InnerException + ex.StackTrace);
        }
        return returnval;
    }
    public static string GetPoints(String BDParams, String api, String boardingOrDropping, string stringPoints)
    {
        try
        {
            BaseClass baseCls = new BaseClass();
            baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

            StringBuilder sbBoardingPoints = new StringBuilder();
            KesineniDetails kesineniDetails;
            AbhiBusDetails abhiBusDetails;
            BitlaDetails bitlaDetails;
            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;

            DataTable dt = null;
            KABCommon commonCls = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

            if (boardingOrDropping == "Boarding")
            {
                if (api != "Abh")
                {
                    dt = commonCls.GetBoardingPoints(BDParams, api);
                }
                else
                {
                    DataTable dtBP = new DataTable();
                    dtBP.Columns.Add("Name");
                    dtBP.Columns.Add("Id");
                    dtBP.Columns.Add("Address");
                    dtBP.Columns.Add("ContactNumber");
                    dtBP.Columns.Add("Landmark");

                    string strBP = stringPoints;

                    if (strBP != "")
                    {
                        string[] str = new string[1];
                        str[0] = "%&%";
                        string[] ssstr = strBP.Split(str, StringSplitOptions.None);
                        foreach (string st in ssstr)
                        {
                            if (st != "")
                            {
                                string[] sp = new string[1];
                                sp[0] = "%&&%";

                                string[] strAA = st.Split(sp, StringSplitOptions.None);

                                string[] strArr = strAA[0].ToString().Split('-');

                                DataRow dr = dtBP.NewRow();
                                if (strArr.Length == 3)
                                {
                                    dr["Name"] = strArr[0].ToString() + " - " + strArr[1].ToString();
                                    dr["Id"] = strArr[2].ToString().Trim().ToString();
                                    dr["Address"] = "";
                                    dr["ContactNumber"] = strAA[1].ToString();
                                    dr["Landmark"] = "";
                                    dtBP.Rows.Add(dr);
                                }
                                else if (strArr.Length == 5)
                                {
                                    dr["Name"] = strArr[0].ToString() + "" + strArr[1].ToString() + "" + strArr[2].ToString() + " - " + strArr[3].ToString();
                                    dr["Id"] = strArr[4].ToString().Trim().ToString();
                                    dr["Address"] = "";
                                    dr["ContactNumber"] = strAA[1].ToString();
                                    dr["Landmark"] = "";
                                    dtBP.Rows.Add(dr);
                                }
                            }
                        }
                    }
                    dt = dtBP;
                }
            }
            else if (boardingOrDropping == "Dropping")
            {
                if (api != "Abh")
                {
                    dt = commonCls.GetDropingPoints(BDParams, api);
                }
                else
                {
                    DataTable dtBP = new DataTable();
                    dtBP.Columns.Add("Name");
                    dtBP.Columns.Add("Id");
                    dtBP.Columns.Add("Address");
                    dtBP.Columns.Add("ContactNumber");
                    dtBP.Columns.Add("Landmark");

                    string strBP = stringPoints;

                    if (strBP != "")
                    {
                        string[] str = new string[1];
                        str[0] = "%&%";
                        string[] ssstr = strBP.Split(str, StringSplitOptions.None);
                        foreach (string st in ssstr)
                        {
                            if (st != "")
                            {
                                string[] strArr = st.Split('-');
                                DataRow dr = dtBP.NewRow();
                                if (strArr.Length == 3)
                                {
                                    dr["Name"] = strArr[0].ToString() + " - " + strArr[1].ToString();
                                    dr["Id"] = strArr[2].ToString().Trim().ToString();
                                    dr["Address"] = "";
                                    dr["ContactNumber"] = "";
                                    dr["Landmark"] = "";
                                    dtBP.Rows.Add(dr);
                                }
                            }
                        }
                    }
                    dt = dtBP;
                }
            }
            if (dt.Rows.Count > 0)
            {
                sbBoardingPoints.Append("<table cellpadding='5'>");
                sbBoardingPoints.Append("<tr>");
                sbBoardingPoints.Append("<th>");
                sbBoardingPoints.Append(boardingOrDropping + " Points");
                sbBoardingPoints.Append("</th>");
                sbBoardingPoints.Append("</tr>");
                foreach (DataRow dr in dt.Rows)
                {
                    sbBoardingPoints.Append("<tr><td>");
                    sbBoardingPoints.Append(dr["Name"]);
                    sbBoardingPoints.Append("</tr></td>");
                }
                sbBoardingPoints.Append("</table>");
            }
            else
            {
                sbBoardingPoints.Append("<table cellpadding='5'>");
                sbBoardingPoints.Append("<tr>");
                sbBoardingPoints.Append("<th>");
                sbBoardingPoints.Append(boardingOrDropping + " Points");
                sbBoardingPoints.Append("</th>");
                sbBoardingPoints.Append("</tr>");
                sbBoardingPoints.Append("<tr><td>");

                if (boardingOrDropping != "Dropping")
                {
                    sbBoardingPoints.Append("" + baseCls.preLoadParams[4].ToString() + "");
                }
                else { sbBoardingPoints.Append("" + baseCls.preLoadParams[5].ToString() + ""); }

                sbBoardingPoints.Append("</tr></td>");
                sbBoardingPoints.Append("</table>");
            }
            return sbBoardingPoints.ToString();
        }
        catch (Exception)
        {
            throw;
        }
    }
    public static String[] GetRoutes(String Sorting, String Filter)
    {
        String[] returnval = null;
        try
        {
            BaseClass baseCls = new BaseClass();
            baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

            if (Filter.ToLower() == "reset" && Sorting.ToLower() == "reset")
            {
                travelOperatorSelected = "";
                DataTable dt = (DataTable)HttpContext.Current.Session["dtRoutes"];
                returnval = GetDataset(dt);
            }

            else if (Sorting.ToLower() == "modify")
            {

                travelOperatorSelected = "";
                String[] filterparams = Filter.Split('*');

                //if (Convert.ToDateTime(filterparams[2].ToString()) < Convert.ToDateTime(System.DateTime.Now.Date.ToShortDateString()))
                //{
                //    ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('" + "Travel Date should not be less than Current Date." + "');</script>", false);
                //}

                //baseCls.preLoadParams[0] = filterparams[0].ToString();
                //baseCls.preLoadParams[1] = filterparams[1].ToString();
                baseCls.preLoadParams[3] = filterparams[2].ToString();

                //baseCls.preLoadParams[4] = filterparams[3].ToString();
                //baseCls.preLoadParams[5] = filterparams[4].ToString();

                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

                DataTable dtroutes = null;

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[3].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }

            else if (Filter.ToUpper() != "NONE")
            {
                String[] filterparams = Filter.Split(',');

                string minPrice = filterparams[5].ToString();
                string maxPrice = filterparams[6].ToString();
                string minDepTime = filterparams[7].ToString();
                string maxDepTime = filterparams[8].ToString();

                FilterBusesWithSliders(minPrice, maxPrice, minDepTime, maxDepTime);

                returnval = FilterBuses(
                    Boolean.Parse(filterparams[0])
                    , Boolean.Parse(filterparams[1])
                    , Boolean.Parse(filterparams[2])
                    , Boolean.Parse(filterparams[3])
                    , filterparams[4].ToString(), Sorting);
            }

            else
            {
                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

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

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[3].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }
        }
        catch (Exception ex)
        {

        }
        return returnval;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objBitlaAPILayer = BitlaFactoryManager.GetBitlaAPILayerObject();
        objBitlaAPILayer.ApiKey = BitlaConstants.API_KEY;
        objBitlaAPILayer.URL = BitlaConstants.URL;
        objKesineniAPILayer = KesineniFactoryManager.GetKesineniAPILayerObject();
        objKesineniAPILayer.LoginId = KesineniConstants.LoginId;
        objKesineniAPILayer.Password = KesineniConstants.Password;
        objAbhiBusAPILayer = AbhiBusFactoryManager.GetAbhiBusAPILayerObject();

        kesineniDetails = new KesineniDetails();
        kesineniDetails.LoginId = KesineniConstants.LoginId;
        kesineniDetails.PassWord = KesineniConstants.Password;

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

        objKalladaAPILayer = KalladaFactoryManager.GetKalladaAPILayerObject();

        objTicketGooseAPILayer = TicketGooseFactoryManager.GetTicketGooseAPILayerObject();
        objTicketGooseAPILayer.UserId = TicketGooseConstants.USERID;
        objTicketGooseAPILayer.Password = TicketGooseConstants.PASSWORD;

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

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

        if (!IsPostBack)
        {
            this.Page.Title = "LoveJourney - Bus - ProceedToBook";
            if (
                Session["ddlSources"] != null && Session["ddlDestinations"] != null && Session["DOJ"] != null
                   && Session["From"] != null && Session["To"] != null
                   && Session["OneWayOrRoundTrip"] != null && Session["ddlSourcesReturn"] != null
                   && Session["ddlDestinationsReturn"] != null && Session["DOJReturn"] != null
                   && Session["FromReturn"] != null && Session["ToReturn"] != null
                )
            {
                MVIEW.ActiveViewIndex = 0;
                ViewState["ddlSources"] = Session["ddlSources"].ToString();
                ViewState["ddlDestinations"] = Session["ddlDestinations"].ToString();
                ViewState["DOJ"] = Session["DOJ"].ToString();
                ViewState["From"] = Session["From"].ToString();
                ViewState["To"] = Session["To"].ToString();

                ViewState["ddlSourcesReturn"] = Session["ddlSourcesReturn"].ToString();
                ViewState["ddlDestinationsReturn"] = Session["ddlDestinationsReturn"].ToString();
                ViewState["DOJReturn"] = Session["DOJReturn"].ToString();
                ViewState["FromReturn"] = Session["FromReturn"].ToString();
                ViewState["ToReturn"] = Session["ToReturn"].ToString();

                ViewState["OneWayOrRoundTrip"] = Session["OneWayOrRoundTrip"].ToString();

                lblMsg.Text = "";
                DataTable dt = (DataTable)Session["dtTicketInfo"];
                pnlOnwardTicketDetails.Visible = true;
                pnlreturnticketdetails.Visible = false;
                lblRouteValue.Text = dt.Rows[0]["Route"].ToString();
                lblJourneyDate.Text = dt.Rows[0]["JourneyDate"].ToString();
                lblBusOperator.Text = dt.Rows[0]["Travels"].ToString();
                lblBusType.Text = dt.Rows[0]["BusType"].ToString();
                lblSeatNos.Text = dt.Rows[0]["SeatNos"].ToString();
                lblFare.Text = dt.Rows[0]["TotalFare"].ToString();
                lblTotalAmountPayable.Text = dt.Rows[0]["TotalFare"].ToString();
                lblBoardingPoint.Text = dt.Rows[0]["BoardingPoint"].ToString();
                ViewState["CashCouponcode"] = null;
                ViewState["Promocode"] = null;
                DataTable dt1 = null;
                DataTable dtseats = new DataTable();
                dtseats.Columns.Add("SeatNos");
                char[] separator = { ',' };
                string[] seatnos = lblSeatNos.Text.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                foreach (string item in seatnos)
                {
                    DataRow dr = dtseats.NewRow();
                    dr["SeatNos"] = item;
                    dtseats.Rows.Add(dr);
                }

                if (dtseats != null)
                {
                    ddlPrimaryPassenger.DataSource = dtseats;
                    ddlPrimaryPassenger.DataTextField = "SeatNos";
                    ddlPrimaryPassenger.DataBind();
                    rptPassengersonward.DataSource = dtseats;
                    rptPassengersonward.DataBind();
                }
                int NoOFSeats = seatnos.Length;
                if (NoOFSeats == 1)
                {
                    pnlPriamryPassenger.Visible = false;
                }
                if (ViewState["OneWayOrRoundTrip"].ToString() == "RoundTrip")
                {
                    pnlOnwardTicketDetails.Visible = true;
                    pnlreturnticketdetails.Visible = true;
                    dt1 = (DataTable)Session["dtTicketInfoReturn"];
                    lblRoutereturn.Text = dt1.Rows[0]["Route"].ToString();
                    lblJourneydatereturn.Text = dt1.Rows[0]["JourneyDate"].ToString();

                    if (Convert.ToDateTime(lblJourneyDate.Text.ToString()) >= Convert.ToDateTime(lblJourneydatereturn.Text.ToString()))
                    {
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('" + "ReturnDate should be greater than TravelingDate." + "');</script>", false);
                        return;
                    }


                    lblbusoperatorreturn.Text = dt1.Rows[0]["Travels"].ToString();
                    lblbustypereturn.Text = dt1.Rows[0]["BusType"].ToString();
                    lblseatNosReturn.Text = dt1.Rows[0]["SeatNos"].ToString();
                    lbltotalFarereturn.Text = dt1.Rows[0]["TotalFare"].ToString();
                    double totalamntPayable = Convert.ToDouble(dt1.Rows[0]["TotalFare"].ToString()) + Convert.ToDouble(dt.Rows[0]["TotalFare"].ToString());
                    lblTotalAmountPayable.Text = Convert.ToString(totalamntPayable);
                    lblBoardingpointreturn.Text = dt1.Rows[0]["BoardingPoint"].ToString();
                    DataTable dtseatsreturn = new DataTable();
                    dtseatsreturn.Columns.Add("SeatNosreturn");

                    string[] seatnosreturn = lblseatNosReturn.Text.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string item in seatnosreturn)
                    {
                        DataRow dr = dtseats.NewRow();
                        DataRow drreturn = dtseatsreturn.NewRow();
                        dr["SeatNos"] = item;
                        drreturn["SeatNosreturn"] = item;
                        dtseats.Rows.Add(dr);
                        dtseatsreturn.Rows.Add(drreturn);
                    }
                    if (dtseats != null && dtseatsreturn != null)
                    {
                        ddlPrimaryPassenger.DataSource = dtseats.DefaultView.ToTable(true, "SeatNos");
                        ddlPrimaryPassenger.DataTextField = "SeatNos";
                        ddlPrimaryPassenger.DataBind();
                        rptrPsgrDetailsReturn.DataSource = dtseatsreturn;
                        rptrPsgrDetailsReturn.DataBind();
                    }
                    NoOFSeats = seatnos.Length + seatnosreturn.Length;
                    if (NoOFSeats == 1)
                    {
                        pnlPriamryPassenger.Visible = false;
                    }
                }
            }
            else { Response.Redirect("~/Users/Bus/Bus_Search.aspx", false); }
        }
    }
    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)
    {
        objArzooHotelAPILayer = ArzooHotelFactoryManager.GetArzooHotelAPILayerObject();
         objArzooHotelAPILayer.UserName = ArzooHotelConstants.USERNAME;
         objArzooHotelAPILayer.UserId = ArzooHotelConstants.USERID;
         objArzooHotelAPILayer.UserType = ArzooHotelConstants.USERTYPE;
         objArzooHotelAPILayer.Password = ArzooHotelConstants.PASSWORD;
         objArzooHotelAPILayer.PartnerId = ArzooHotelConstants.PARTNERID;
        //if (!IsPostBack)
        //{
        //  BindRemainders();
        //   BindNotices();
        //}
        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)
            {

                Panel pnl = (Panel)this.Master.FindControl("pnl");
                pnl.Visible = false;

                pnlAdminDomesticFlights.Visible = false;
                BindRemainders();
                // BindNotices();
                 adminPanelBuses.Visible = false;
               // CheckPermission("Book Ticket", Session["Role"].ToString());
                 pnlAdminHotels.Visible = false;
                 #region DomesticFlights
                // CheckPermission("Domestic Availability", Session["Role"].ToString());
                 //  GetIntFlightsAvailability();
                 gdvFlights.Visible = true;
                 round.Visible = false;
        #endregion

                 #region BusesSearch

                 objDataSet = null;
                if (objDataSet == null)
                {
                    objBAL = new ClsBAL();
                    objDataSet = objBAL.GetSourcess();
                }
                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, "----------");
                            ddlDestinations.Items.Clear();
                            ddlDestinations.Items.Insert(0, "----------");
                        }
                    }
                }
                ddlSources.SelectedValue = ddlSources.Items.FindByText("Hyderabad").Value;
                ddlSources_SelectedIndexChanged(sender, e);
                ddlDestinations.SelectedValue = ddlDestinations.Items.FindByText("Bangalore").Value;

                Session["DOJ"] = txtFromDate.Text.ToString();
                Session["From"] = ddlSources.SelectedItem.Text.ToString();
                Session["To"] = ddlDestinations.SelectedItem.Text.ToString();
                 #endregion

            }
        }
        catch (Exception)
        {
            throw;
        }
    }