/// <summary>
 ///
 /// </summary>
 /// <param name="lat"></param>
 /// <param name="lng"></param>
 /// <param name="isService">True = google, false = BA</param>
 /// <returns></returns>
 public static string GetAddressByGeoBAV2(float lat, float lng, bool isService)
 {
     try
     {
         string strbuilding = "";
         if (lat <= 0 || lng <= 0)
         {
             return("");
         }
         if (isService)
         {
             return(WCF_GEO.TryGet(p => p.GetAddressByGeo_Google(WCF_GEO_Authen, lng, lat)).Value);
         }
         //return WCFService_Common.GetAddressByGeo_Google(lat, lng);
         else
         {
             return(WCF_GEO.TryGet(p => p.GetAddressByGeo(out strbuilding, WCF_GEO_Authen, lng, lat)).Value);
         }
         //return ServiceSoapClient.GetAddressByGeo(lat, lng);
     }
     catch
     {
         return("");
     }
 }
        /// <summary>
        /// Get dia chi, ham google co tra ve so nha
        /// </summary>
        /// <param name="lat"></param>
        /// <param name="lng"></param>
        /// <param name="building"></param>
        /// <returns></returns>
        public static string GetAddressByGeo_BA_WithBuilding(float lat, float lng, out string building)
        {
            string strbuilding = "";

            building = "";
            try
            {
                if (lat <= 0 || lng <= 0)
                {
                    return("");
                }
                if (Config_Common.GEOService == EnumGEOService.Google)
                {
                    string value = WCF_GEO.TryGet(p => p.GetAddressByGeo_Google_WithBuilding(out strbuilding, WCF_GEO_Authen, lng, lat)).Value;
                    building = strbuilding;
                    return(value);
                }
                //return WCFService_Common.GetAddressByGeo_Google(lat, lng);
                else
                {
                    string value = WCF_GEO.TryGet(p => p.GetAddressByGeo(out strbuilding, WCF_GEO_Authen, lng, lat)).Value;
                    building = strbuilding;
                    return(value);
                }
                //return ServiceSoapClient.GetAddressByGeo(lat, lng);
            }
            catch
            {
                return("");
            }
        }
 public static string GetGeobyAddressV2_Gooogle_Full(string address)
 {
     try
     {
         return(WCF_GEO.TryGet(p => p.GetGeoByAddress_GoogleV2(WCF_GEO_Authen, address)).Value);
     }
     catch
     {
         return("*");
     }
 }
        //private static BAGPS.ServiceSoapClient _ServiceSoapClient;

        //public static BAGPS.ServiceSoapClient ServiceSoapClient
        //{
        //    get
        //    {
        //        if (_ServiceSoapClient == null ||
        //            _ServiceSoapClient.State == System.ServiceModel.CommunicationState.Faulted)
        //        {
        //            _ServiceSoapClient = new BAGPS.ServiceSoapClient();
        //        }
        //        else if (_ServiceSoapClient.State == System.ServiceModel.CommunicationState.Closed)
        //        {
        //            _ServiceSoapClient.Open();
        //        }
        //        return _ServiceSoapClient;
        //    }
        //    set { _ServiceSoapClient = value; }
        //}

        /// <summary>
        /// Service Get dia chi uu tien Ha Noi
        /// </summary>
        public static string GetGeobyAddress(string address, string TenTinh)
        {
            try
            {
                if (Config_Common.GEOService == EnumGEOService.Google)
                {
                    return(WCF_GEO.TryGet(p => p.GetGeoByAddress_Google(WCF_GEO_Authen, address, TenTinh)).Value);
                }
                //return WCFService_Common.GetGeoByAddress_Google(address, TenTinh);
                else if (Config_Common.GEOService == EnumGEOService.BinhAnh)
                {
                    if (TenTinh.ToLower().Equals("hà nội") || TenTinh.ToLower().Equals("ha noi"))
                    {
                        return(WCF_GEO.TryGet(p => p.GetGeobyAddressBA_HN_First(WCF_GEO_Authen, address, TenTinh)).Value);
                    }
                    //return ServiceSoapClient.GetGeobyAddressBA_HN(String.Format("{0},{1}", address, TenTinh));
                    else
                    {
                        return(WCF_GEO.TryGet(p => p.GetGeobyAddressBA(WCF_GEO_Authen, address, TenTinh)).Value);
                    }
                    //return ServiceSoapClient.GetGeobyAddressBA3(String.Format("{0},{1}", address, TenTinh));
                }
                else
                {
                    string AddressReturn = "";

                    if (TenTinh.ToLower().Equals("hà nội") || TenTinh.ToLower().Equals("ha noi"))
                    {
                        AddressReturn = WCF_GEO.TryGet(p => p.GetGeobyAddressBA_HN_First(WCF_GEO_Authen, address, TenTinh)).Value;
                    }
                    //AddressReturn = ServiceSoapClient.GetGeobyAddressBA_HN(String.Format("{0},{1}", address, TenTinh));
                    else
                    {
                        AddressReturn = WCF_GEO.TryGet(p => p.GetGeobyAddressBA(WCF_GEO_Authen, address, TenTinh)).Value;
                    }
                    //AddressReturn = ServiceSoapClient.GetGeobyAddressBA3(String.Format("{0},{1}", address, TenTinh));

                    if (AddressReturn == "" || AddressReturn == "*")
                    {
                        AddressReturn = WCF_GEO.TryGet(p => p.GetGeoByAddress_Google(WCF_GEO_Authen, address, TenTinh)).Value;
                        //AddressReturn = WCFService_Common.GetGeoByAddress_Google(address, TenTinh);
                    }
                    return(AddressReturn);
                }
            }
            catch
            {
                return("*");
            }
        }
 /// <param name="isServiceGoogle">True: Google; false: Binh Anh</param>
 /// <returns></returns>
 public static string GetGeobyAddressV3(string tenTinh, string address, bool isServiceGoogle)
 {
     try
     {
         if (isServiceGoogle)
         {
             return(WCF_GEO.TryGet(p => p.GetGeoByAddress_Google(WCF_GEO_Authen, address, tenTinh)).Value);
         }
         else
         {
             return(WCF_GEO.TryGet(p => p.GetGeobyAddressBA(WCF_GEO_Authen, address, tenTinh)).Value);
         }
     }
     catch
     {
         return("*");
     }
 }
 public static string GetGeobyAddressV2_Full(string address)
 {
     try
     {
         if (Config_Common.GEOService == EnumGEOService.Google)
         {
             return(WCF_GEO.TryGet(p => p.GetGeoByAddress_GoogleV2(WCF_GEO_Authen, address)).Value);
         }
         else
         {
             return(WCF_GEO.TryGet(p => p.GetGeobyAddressBA_Full(WCF_GEO_Authen, address)).Value);
         }
     }
     catch
     {
         return("*");
     }
 }
 public static string GetGeobyAddressV2_NotProvince(string address)
 {
     try
     {
         if (Config_Common.GEOService == EnumGEOService.Google)
         {
             return(WCF_GEO.TryGet(p => p.GetGeoByAddress_Google(WCF_GEO_Authen, address, ThongTinCauHinh.GPS_TenTinh)).Value);
         }
         //return WCFService_Common.GetGeoByAddress_Google(address,ThongTinCauHinh.GPS_TenTinh);
         else
         {
             return(WCF_GEO.TryGet(p => p.GetGeobyAddressBA(WCF_GEO_Authen, address, ThongTinCauHinh.GPS_TenTinh)).Value);
         }
         //return ServiceSoapClient.GetGeobyAddressBA3(address);
     }
     catch
     {
         return("*");
     }
 }
 /// <summary>
 /// Service Get dia chi uu tien Ha Noi
 /// </summary>
 public static string GetGeobyAddressBA_HN_First(string address, string TenTinh)
 {
     try
     {
         string street = address;
         if (TenTinh.ToLower().Equals("hà nội") || TenTinh.ToLower().Equals("ha noi"))
         {
             return(WCF_GEO.TryGet(p => p.GetGeobyAddressBA_HN_First(WCF_GEO_Authen, address, TenTinh)).Value);
         }
         //return ServiceSoapClient.GetGeobyAddressBA_HN(String.Format("{0},{1}", street, TenTinh));
         else
         {
             return(WCF_GEO.TryGet(p => p.GetGeobyAddressBA(WCF_GEO_Authen, address, TenTinh)).Value);
         }
         //return ServiceSoapClient.GetGeobyAddressBA3(String.Format("{0},{1}", street, TenTinh));
     }
     catch
     {
         return("*");
     }
 }
 /// <summary>
 /// Lấy lộ trình và giá
 /// </summary>
 /// <param name="fromLat"></param>
 /// <param name="fromLng"></param>
 /// <param name="toLat"></param>
 /// <param name="toLng"></param>
 /// <param name="compid"></param>
 /// <param name="carType"></param>
 /// <returns></returns>
 public static PriceResponse GetPrice(float fromLat, float fromLng, float toLat, float toLng, int compid, int carType)
 {
     return(WCF_GEO.TryGet(p => p.GetPrice_FromTwoLocation(fromLat, fromLng, toLat, toLng, compid, carType)).Value);
 }