示例#1
0
        public ActionResult GetNearCars(double Lat, double Lng)
        {
            object result = "";

            try
            {
                var cars    = new B_Location().GetNearDrivers(Lat, Lng).ToList();
                var markers = new List <object>();
                foreach (var li in cars)
                {
                    markers.Add(new
                    {
                        center   = new { lat = li.Lat, lng = li.Lng },
                        iconOpts = new { iconUrl = "/Areas/User/Images/CarIcon.png", iconSize = new int[] { 30, 30 } }
                    });
                }
                var res = new Helper.ApiCall(@"https://api.cedarmaps.com/v1/geocode/cedarmaps.streets/" + Lat + "," + Lng + ".json?access_token=7775fb1e47034c4ae978aae1b3ac3f6f0b4ec6b3", "").CallApiGet();
                result = new { markers = markers, Address = res };
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
示例#2
0
        public ActionResult SearchOnMap(double Lat, double Lng, string SearchText)
        {
            object result = "";

            try
            {
                if (string.IsNullOrEmpty(SearchText))
                {
                    throw F_ExeptionFactory.MakeExeption("مقدار فیلد جستجو خالی است",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                var res = new Helper.ApiCall(@"https://api.cedarmaps.com/v1/geocode/cedarmaps.streets/" + SearchText + "?location=" + Lat + "," + Lng + "&distance=50&access_token=7775fb1e47034c4ae978aae1b3ac3f6f0b4ec6b3", "").CallApiGet();
                result = res;
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }