Пример #1
0
        public JsonResult GetDistrictByCity(string path)
        {
            try
            {
                // Get the geo locations
                var response = geoLocationService.GetGeoLocations(new GeoLocationRequest()
                {
                    GeoLocationParents = new List <string> {
                        path
                    }
                }).Result.ToList();

                return(Json(new headstoneControllerResponse <GeoLocation>()
                {
                    Result = response,
                    ReturnCode = 200
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Log(Headstone.Framework.Models.LogMode.Error, $"There is an error while getting district by city!", ex);

                return(Json(new headstoneControllerResponse <Category>()
                {
                    ReturnCode = -300
                }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Load the configuration
            ConfigurationService.Load();

            // Set the application wide configuration parameters
            Configuration = ConfigurationService.Records;

            //Log the application initialization
            LogService.Debug("Headstone.UI - Application initialized");

            // Load the geolocations
            Task.Factory.StartNew(() =>
            {
                var response = _geolocationService.GetGeoLocations(new GeoLocationRequest()
                {
                    Environment = _environment,
                    SessionId   = "x",
                    UserToken   = "x",
                });

                GeoLocations = response.Result;
            });
        }
Пример #3
0
        private UserViewModel CreateSelectLists(UserViewModel model)
        {
            var accountStatuses = new Dictionary <Lidia.Identity.Common.Models.AccountStatus, string>
            {
                { Lidia.Identity.Common.Models.AccountStatus.Active, "Aktif" },
                { Lidia.Identity.Common.Models.AccountStatus.Passive, "Pasif" },
                { Lidia.Identity.Common.Models.AccountStatus.Verified, "Onaylanmış" },
            };

            var genders = new Dictionary <string, string>();

            genders.Add("Erkek", "Erkek");
            genders.Add("Kadın", "Kadın");

            var cities = new Dictionary <string, string>();
            //cities.Add("İstanbul", "İstanbul");
            //cities.Add("Ankara", "Ankara");

            var request  = new GeoLocationRequest();
            var response = _geoLocationService.GetGeoLocations(request).Result.Where(x => x.Parent == "TR").OrderBy(x => x.Name).ToList();

            foreach (var city in response)
            {
                cities.Add(city.Name, city.Name);
            }

            model.GenderList        = new SelectList(genders.Select(x => new { Value = x.Key, Text = x.Value }), "Value", "Text", model.Gender);
            model.AccountStatusList = new SelectList(accountStatuses.Select(x => new { Value = x.Key, Text = x.Value }), "Value", "Text", (int)model.AccountStatus);
            model.CityList          = new SelectList(cities.Select(x => new { Value = x.Key, Text = x.Value }), "Value", "Text"); // EKIN

            // Load roles
            var roles = identityServiceClient.GetRoles(new RoleQuery()
            {
            }).Result;

            // Remove the not authorized role selections
            if (User.IsInRole("Superuser"))
            {
                roles.RemoveAll(r => r.Name == "Administrator");
            }
            else if (User.IsInRole("ResellerAdmin"))
            {
                roles.RemoveAll(r => r.Name == "Administrator");
                roles.RemoveAll(r => r.Name == "SuperUser");
            }
            else if (User.IsInRole("ResellerAgent"))
            {
                roles.RemoveAll(r => r.Name == "Administrator");
                roles.RemoveAll(r => r.Name == "SuperUser");
                roles.RemoveAll(r => r.Name == "ResellerAdmin");
            }

            // Set the selection list
            model.RoleList = new SelectList(roles.Select(x => new { Value = x.Id, Text = x.Name }), "Value", "Text", model.RoleId);

            return(model);
        }
Пример #4
0
        public void GetGeolocations()
        {
            var geoLocations = geoLocationService.GetGeoLocations(new Models.Requests.GeoLocationRequest());

            Assert.AreEqual(ServiceResponseTypes.Success, geoLocations.Type);
        }