Exemplo n.º 1
0
 public List <MasterCityDTO> Admin_MasterCityCheckExists(MasterCityDTO masterCityDTO)
 {
     try
     {
         return(_dataAccessMasterCity.Admin_MasterCityCheckExists(masterCityDTO));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public void Admin_MasterCityUpdate(MasterCityDTO masterCityDTO)
 {
     try
     {
         _dataAccessMasterCity.Admin_MasterCityUpdate(masterCityDTO);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public void Admin_MasterCityUpdate(MasterCityDTO masterCityDTO)
 {
     try
     {
         _client.Admin_MasterCityUpdate(masterCityDTO);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
 public MasterCityDTO Admin_MasterCityGetOnCityId(int cityId)
 {
     try
     {
         MasterCityDTO _returnResult = SqlHelper.QuerySP <MasterCityDTO>("Admin_MasterCityGetOnCityId",
                                                                         new
         {
             CityId = cityId
         }).ToList().FirstOrDefault();
         return(_returnResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 5
0
        public ActionResult UpdateCity(int CityId)
        {
            ModelMasterCity model = new ModelMasterCity();

            if (CityId > 0)
            {
                MasterCityDTO _adminUser = _IMasterCity.Admin_MasterCityGetOnCityId(CityId);
                model.CountryId     = _adminUser.CountryId;
                model.StateId       = _adminUser.StateId;
                model.IsDefault     = _adminUser.IsDefault;
                model.CityId        = _adminUser.CityId;
                model.CityName      = _adminUser.CityName;
                model.CityShortName = _adminUser.CityShortName;
            }

            return(View(model));
        }
Exemplo n.º 6
0
 public List <MasterCityDTO> Admin_MasterCityCheckExists(MasterCityDTO masterCityDTO)
 {
     try
     {
         List <MasterCityDTO> _returnResult = SqlHelper.QuerySP <MasterCityDTO>("Admin_MasterCityCheckExists",
                                                                                new
         {
             CityId   = masterCityDTO.CityId,
             CityName = masterCityDTO.CityName
         }).ToList();
         return(_returnResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
0
        public ActionResult UpdateCity(ModelMasterCity model)
        {
            MasterCityDTO _dto = new MasterCityDTO();

            _dto.StateId       = userEntity.MasterStateId;
            _dto.IsDefault     = model.IsDefault;
            _dto.CityId        = model.CityId;
            _dto.CityName      = model.CityName;
            _dto.CityShortName = model.CityShortName;

            if (_IMasterCity.Admin_MasterCityCheckExists(_dto).Count > 0)
            {
                model.ErrorMessage = "City name already existed";
            }
            else
            {
                _IMasterCity.Admin_MasterCityUpdate(_dto);
                Response.Redirect("ManageCity");
            }
            return(View(model));
        }
Exemplo n.º 8
0
 public void Admin_MasterCityUpdate(MasterCityDTO masterCityDTO)
 {
     try
     {
         SqlHelper.QuerySP("Admin_MasterCityUpdate",
                           new
         {
             CityId = masterCityDTO.CityId
             ,
             CityName = masterCityDTO.CityName
             ,
             StateId = masterCityDTO.StateId
             ,
             CityShortName = masterCityDTO.CityShortName
             ,
             IsDefault = masterCityDTO.IsDefault
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 9
0
        private void NearestLocationApiCall(string latitude, string longitude,
                                            bool isCityInfo, MasterCityDTO masterCityDto, List <GoogleTypes> googleType, int countryId,
                                            int attractionId, MapsXAPIXFeature mapsXapixFeature, string attractionName, int attractionTravelStepsId = 0)
        {
            string radiusData = string.Empty;
            string url        = string.Empty;


            if (!string.IsNullOrEmpty(latitude) && !string.IsNullOrEmpty(longitude))
            {
                foreach (var googleTypes in googleType)
                {
                    try
                    {
                        radiusData = string.Empty;
                        url        = string.Empty;
                        switch (mapsXapixFeature.MapsId)
                        {
                        //google
                        case 1:
                        {
                            url =
                                mapsXapixFeature.API +
                                latitude +
                                "," +
                                longitude + "&radius=25000&key=" +
                                mapsXapixFeature.apiKeyOrapiId;

                            if (!string.IsNullOrEmpty(googleTypes.TypeName))
                            {
                                url = url + "&type=" + googleTypes.TypeName;
                            }

                            radiusData = webRequest.WebServiceInformation(url);
                            var returnsInformation =
                                JsonConvert.DeserializeObject <NearBySearchEntity>(
                                    radiusData);

                            if (returnsInformation != null && returnsInformation.results.Any())
                            {
                                if (isCityInfo)
                                {
                                    dALSchedulers.UpdateCityNearestLocationDont(masterCityDto
                                                                                .CityId);
                                }

                                InsertSearchResult(returnsInformation, countryId, url,
                                                   longitude,
                                                   latitude,
                                                   attractionId, attractionTravelStepsId, mapsXapixFeature.MapsId,
                                                   mapsXapixFeature);

                                dALSchedulers.Scheduler_MapsLogging("NearestLocationApiCall", mapsXapixFeature.MapsId,
                                                                    mapsXapixFeature.MapsCredentialsId, mapsXapixFeature.MapFeaturesId, radiusData,
                                                                    string.Empty, string.Empty, countryId, attractionId, url, false, attractionTravelStepsId);
                            }
                            else
                            {
                                dALSchedulers.Scheduler_MapsLogging("NearestLocationApiCall", mapsXapixFeature.MapsId,
                                                                    mapsXapixFeature.MapsCredentialsId, mapsXapixFeature.MapFeaturesId, radiusData,
                                                                    string.Empty, string.Empty, countryId, attractionId, url, true, attractionTravelStepsId);
                            }

                            break;
                        }

                        //locationiq
                        case 2:
                        {
                            url =
                                mapsXapixFeature.API +
                                "key=" + mapsXapixFeature.apiKeyOrapiId +
                                "&format=json" +
                                "&lat=" + latitude +
                                "&lon=" + longitude +
                                "&tag=" + googleTypes.TypeName;
                            radiusData = webRequest.WebServiceInformation(url);
                            var returnsInformation = JsonConvert
                                                     .DeserializeObject <List <NearBy> >(radiusData);


                            if (returnsInformation != null && returnsInformation.Any())
                            {
                                var result = returnsInformation.Where(x => !string.IsNullOrEmpty(x.name)).Select(
                                    y => new ResultsList
                                    {
                                        geometry = new geometryList
                                        {
                                            location = new locationList
                                            {
                                                lat = y.lat,
                                                lng = y.lon
                                            }
                                        },
                                        name  = y.name,
                                        types = (new List <string>()
                                        {
                                            googleTypes.TypeName
                                        }).ToArray()
                                    }).ToList();



                                InsertSearchResult(new NearBySearchEntity {
                                        results = result
                                    }, countryId, url,
                                                   longitude,
                                                   latitude,
                                                   attractionId, attractionTravelStepsId, mapsXapixFeature.MapsId,
                                                   mapsXapixFeature);

                                dALSchedulers.Scheduler_MapsLogging("NearestLocationApiCall",
                                                                    mapsXapixFeature.MapsId,
                                                                    mapsXapixFeature.MapsCredentialsId, mapsXapixFeature.MapFeaturesId,
                                                                    string.Empty,
                                                                    string.Empty, string.Empty, countryId, attractionId, url, false,
                                                                    attractionTravelStepsId);
                            }
                            else
                            {
                                dALSchedulers.Scheduler_MapsLogging("NearestLocationApiCall", mapsXapixFeature.MapsId,
                                                                    mapsXapixFeature.MapsCredentialsId, mapsXapixFeature.MapFeaturesId, radiusData,
                                                                    string.Empty, string.Empty, countryId, attractionId, url, true, attractionTravelStepsId);
                            }
                            //Every request after taking a break of one second
                            Thread.Sleep(1000);
                            break;
                        }

                        case 3:
                        {
                            if (!string.IsNullOrEmpty(attractionName))
                            {
                                url =
                                    mapsXapixFeature.API +
                                    "at=" + latitude + "," + longitude +
                                    "&q=" + attractionName +
                                    "&app_id=" + mapsXapixFeature.apiKeyOrapiId +
                                    "&app_code=" + mapsXapixFeature.apiCode;
                                radiusData = webRequest.WebServiceInformation(url);
                                var returnsInformation = JsonConvert
                                                         .DeserializeObject <BusinessEntites.Scheduler.here.NearBy>(radiusData);
                            }
                            break;
                        }
                        }
                    }
                    catch (Exception ex)
                    {
                        dALSchedulers.Scheduler_MapsLogging("NearestLocationApiCall", mapsXapixFeature.MapsId,
                                                            mapsXapixFeature.MapsCredentialsId, mapsXapixFeature.MapFeaturesId, radiusData,
                                                            ex.Message, ex.StackTrace, countryId, attractionId, url, true, attractionTravelStepsId);

                        if (ex.Message == "The remote server returned an error: (429) Too Many Requests.")
                        {
                            Thread.Sleep(1000 * 60);
                        }
                    }
                }
            }
        }