private BusesSearchFilter GetCityIDsOfProviders(BusesSearchFilter objBusesSearchFilter, ClientAPIDetails objClientAPIDetails,
            int sourceId, int destinationId, String dateofjourney)
        {
            DataSet dsProviders = new DataSet();
            if (objClientAPIDetails.ProviderName != "MORNINGSTAR")
            {
                ClsBAL bal = new ClsBAL();
                bal.ProviderID = objClientAPIDetails.ProviderID;
                bal.sourceId = sourceId;
                bal.destionationId = destinationId;
                dsProviders = bal.GetAPIID();

                //DataTable DtRSources = new DataTable();
                //DataSet DsRSources = new DataSet();
                //DsRSources.ReadXml(System.Web.HttpContext.Current.Server.MapPath("~/App_Data/" + "SourcesAPI.xml"));
                //IEnumerable<DataRow> API_Source_ID = from i in DsRSources.Tables[0].AsEnumerable()
                //                                     where i.Field<string>("Source_ID") == sourceId.ToString() && i.Field<string>("Provider_Id") == objClientAPIDetails.ProviderID.ToString()
                //                                     select i;
                //if (API_Source_ID.Count() > 0)
                //{
                //    DtRSources = API_Source_ID.CopyToDataTable();
                //    DataSet ds = new DataSet();
                //    ds.Tables.Add(DtRSources);

                //}

            }
            else
            {
                ClsBAL bal = new ClsBAL();
                bal.ProviderID = 102;
                bal.sourceId = sourceId;
                bal.destionationId = destinationId;
                dsProviders = bal.GetAPIID();
            }

            //DataSet dsProviders = ExecuteDataSet("SELECT " + objClientAPIDetails.ProviderName + " FROM dbo.tbl_Sources WHERE Source_ID = '" + sourceId + "' " +
            //                                       "SELECT " + objClientAPIDetails.ProviderName + " FROM dbo.tbl_Sources WHERE Source_ID = '" + destinationId + "'");

            if (dsProviders.Tables[0].Rows.Count > 0 && dsProviders.Tables[1].Rows.Count > 0)
            {
            if (objClientAPIDetails.ProviderName == "BITLA")
            {
                foreach (DataRow bsdr in dsProviders.Tables[0].Rows)
                {
                    if (source_ids.ToString() == "")
                    {
                        source_ids = bsdr[0].ToString();
                    }
                    else
                    {
                        source_ids = source_ids + "," + bsdr[0].ToString();
                    }
                }
                foreach (DataRow bddr in dsProviders.Tables[1].Rows)
                {
                    if (Destination_Ids.ToString() == "")
                    {
                        Destination_Ids = bddr[0].ToString();
                    }
                    else
                    {
                        Destination_Ids = Destination_Ids + "," + bddr[0].ToString();
                    }
                }
            }
            else if (objClientAPIDetails.ProviderName == "TICKETGOOSE")
            {
                foreach (DataRow tsdr in dsProviders.Tables[0].Rows)
                {
                    if (Tsource_ids.ToString() == "")
                    {
                        Tsource_ids = tsdr[0].ToString();
                    }
                    else
                    {
                        Tsource_ids = Tsource_ids + "," + tsdr[0].ToString();
                    }
                }
                foreach (DataRow tddr in dsProviders.Tables[1].Rows)
                {
                    if (TDestination_Ids.ToString() == "")
                    {
                        TDestination_Ids = tddr[0].ToString();
                    }
                    else
                    {
                        TDestination_Ids = TDestination_Ids + "," + tddr[0].ToString();
                    }
                }
            }
            else if (objClientAPIDetails.ProviderName == "MORNINGSTAR")
            {
                foreach (DataRow msdr in dsProviders.Tables[0].Rows)
                {
                    if (Msource_ids.ToString() == "")
                    {
                        Msource_ids = msdr[0].ToString();
                    }
                    else
                    {
                        Msource_ids = Msource_ids + "," + msdr[0].ToString();
                    }
                }
                foreach (DataRow mddr in dsProviders.Tables[1].Rows)
                {
                    if (MDestination_Ids.ToString() == "")
                    {
                        MDestination_Ids = mddr[0].ToString();
                    }
                    else
                    {
                        MDestination_Ids = MDestination_Ids + "," + mddr[0].ToString();
                    }
                }
            }
            else if (objClientAPIDetails.ProviderName == "RAJESH")
            {
                foreach (DataRow rsdr in dsProviders.Tables[0].Rows)
                {
                    if (Rsource_ids.ToString() == "")
                    {
                        Rsource_ids = rsdr[0].ToString();
                    }
                    else
                    {
                        Rsource_ids = Rsource_ids + "," + rsdr[0].ToString();
                    }
                }
                foreach (DataRow rddr in dsProviders.Tables[1].Rows)
                {
                    if (RDestination_Ids.ToString() == "")
                    {
                        RDestination_Ids = rddr[0].ToString();
                    }
                    else
                    {
                        RDestination_Ids = RDestination_Ids + "," + rddr[0].ToString();
                    }
                }
            }
            else if (objClientAPIDetails.ProviderName == "KALLADA")
            {
                foreach (DataRow kdsdr in dsProviders.Tables[0].Rows)
                {
                    if (KDsource_ids.ToString() == "")
                    {
                        KDsource_ids = kdsdr[0].ToString();
                    }
                    else
                    {
                        KDsource_ids = KDsource_ids + "," + kdsdr[0].ToString();
                    }
                }
                foreach (DataRow kdddr in dsProviders.Tables[1].Rows)
                {
                    if (KDDestination_Ids.ToString() == "")
                    {
                        KDDestination_Ids = kdddr[0].ToString();
                    }
                    else
                    {
                        KDDestination_Ids = KDDestination_Ids + "," + kdddr[0].ToString();
                    }
                }
            }
            else if (objClientAPIDetails.ProviderName == "KAVERI")
            {
                foreach (DataRow ksdr in dsProviders.Tables[0].Rows)
                {
                    if (Ksource_ids.ToString() == "")
                    {
                        Ksource_ids = ksdr[0].ToString();
                    }
                    else
                    {
                        Ksource_ids = Ksource_ids + "," + ksdr[0].ToString();
                    }
                }
                foreach (DataRow kddr in dsProviders.Tables[1].Rows)
                {
                    if (KDestination_Ids.ToString() == "")
                    {
                        KDestination_Ids = kddr[0].ToString();
                    }
                    else
                    {
                        KDestination_Ids = KDestination_Ids + "," + kddr[0].ToString();
                    }
                }
            }
            else if (objClientAPIDetails.ProviderName == "SAIANJANA")
            {
                foreach (DataRow ssdr in dsProviders.Tables[0].Rows)
                {
                    if (SSsource_ids.ToString() == "")
                    {
                        SSsource_ids = ssdr[0].ToString();
                    }
                    else
                    {
                        SSsource_ids = SSsource_ids + "," + ssdr[0].ToString();
                    }
                }
                foreach (DataRow ssddr in dsProviders.Tables[1].Rows)
                {
                    if (SSDestination_Ids.ToString() == "")
                    {
                        SSDestination_Ids = ssddr[0].ToString();
                    }
                    else
                    {
                        SSDestination_Ids = SSDestination_Ids + "," + ssddr[0].ToString();
                    }
                }
            }
            else if (objClientAPIDetails.ProviderName == "SVR")
            {
                foreach (DataRow sdr in dsProviders.Tables[0].Rows)
                {
                    if (Ssource_ids.ToString() == "")
                    {
                        Ssource_ids = sdr[0].ToString();
                    }
                    else
                    {
                        Ssource_ids = Ssource_ids + "," + sdr[0].ToString();
                    }
                }
                foreach (DataRow sddr in dsProviders.Tables[1].Rows)
                {
                    if (SDestination_Ids.ToString() == "")
                    {
                        SDestination_Ids = sddr[0].ToString();
                    }
                    else
                    {
                        SDestination_Ids = SDestination_Ids + "," + sddr[0].ToString();
                    }
                }
            }
            //easybus
            else if (objClientAPIDetails.ProviderName == "EASYBUS")
            {
                foreach (DataRow Edr in dsProviders.Tables[0].Rows)
                {
                    if (Esource_ids.ToString() == "")
                    {
                        Esource_ids = Edr[0].ToString();
                        //Esource_ids = "38";
                    }
                    else
                    {
                        Esource_ids = Esource_ids + "," + Edr[0].ToString();
                    }
                }
                foreach (DataRow Eddr in dsProviders.Tables[1].Rows)
                {
                    if (EDestination_Ids.ToString() == "")
                    {
                        EDestination_Ids = Eddr[0].ToString();
                       // EDestination_Ids = "32";
                    }
                    else
                    {
                        EDestination_Ids = EDestination_Ids + "," + Eddr[0].ToString();
                    }
                }
                //EDestination_Ids=38+","+32;
            }

            objBusesSearchFilter.SourceID = 0;
            // objBusesSearchFilter.DestinationID = int.Parse(dsProviders.Tables[1].Rows[0][0].ToString());
            objBusesSearchFilter.DestinationID = 0;
            objBusesSearchFilter.JourneyDate = dateofjourney;
            }
            dsProviders.Dispose();
            return objBusesSearchFilter;
        }
        private AvailableTrips GETBITLROUTES(BusesSearchFilter objBusesSearchFilter, ClientAPIDetails objClientAPIDetails,
           int sourceId, int destinationId, String dateofjourney)
        {
            ClsBAL bal = new ClsBAL();
            bal.ProviderID = objClientAPIDetails.ProviderID;
            bal.sourceId = sourceId;
            bal.destionationId = destinationId;
            DataSet dsProviders = bal.GetAPIID();

            //DataSet dsProviders = ExecuteDataSet("SELECT " + objClientAPIDetails.ProviderName + " FROM dbo.tbl_Sources WHERE Source_ID = '" + sourceId + "' " +
            //                                       "SELECT " + objClientAPIDetails.ProviderName + " FROM dbo.tbl_Sources WHERE Source_ID = '" + destinationId + "'");

            if (dsProviders.Tables[0].Rows.Count > 0 && dsProviders.Tables[1].Rows.Count > 0)
            {
                if (objClientAPIDetails.ProviderName == "BITLA")
                {
                    for (int k = 0; k < dsProviders.Tables.Count; k++)
                    {

                        BSID = dsProviders.Tables[0].Rows[k][0].ToString() == "" ? 0 : int.Parse(dsProviders.Tables[0].Rows[k][0].ToString());
                        BDID = dsProviders.Tables[1].Rows[k][0].ToString() == "" ? 0 : Convert.ToInt32(dsProviders.Tables[1].Rows[k][0]);
                        if (BSID > 0 && BDID > 0)
                        {
                            BDate = dateofjourney;
                            BURL = objClientAPIDetails.APIURL + "/";
                            BConsumerKey = objClientAPIDetails.ConsumerKey;
                            BCOnsumerSecretKey = objClientAPIDetails.ConsumerSecret;
                            BPID = objClientAPIDetails.ProviderID;
                            BProviderName = objClientAPIDetails.ProviderName;
                            Tbus = BITLA(BURL, BConsumerKey, BCOnsumerSecretKey, BPID, BProviderName, BSID, BDID, BDate);
                            bus = trips(Tbus);
                        }
                    }
                }
            }

            dsProviders.Dispose();
            return bus;
        }