Esempio n. 1
0
        public void Reload()
        {
            Type type = typeof(AppSetting);
            List <AppSetting> list = DB.AppSettings.ToList();

            var l = type
                    .GetMembers(BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty)
                    .Where(r => r is PropertyInfo)
                    .Select(r => r as PropertyInfo);

            foreach (var item in l)
            {
                var    value = list.Where(r => r.Key == item.Name).Select(r => r.Value).FirstOrDefault();
                object oVal  = value;
                if (item.PropertyType == typeof(Guid))
                {
                    oVal = value.ToGuid();
                }
                else if (item.PropertyType == typeof(int))
                {
                    oVal = value.ToInt();
                }
                else if (item.PropertyType == typeof(bool))
                {
                    bool oV;
                    Boolean.TryParse(value, out oV);
                    oVal = oV;
                }
                item.SetValue(type, oVal, null);
            }

            GeoRepository geoRepository = new GeoRepository();

            AppSetting.DefaultGeo1Name = geoRepository.GetName(AppSetting.DefaultGeoID);
        }
Esempio n. 2
0
        public JsonResult ListGeo2(string parentFullName)
        {
            GeoRepository geoRepository = new GeoRepository();

            Geo e = geoRepository.GetByFullname(parentFullName);

            return Json(e.Children.Select(r => new { r.ID, r.FullName }).OrderBy(r => r.FullName));
        }
Esempio n. 3
0
        public void UpdateGeo(Site e)
        {
            GeoRepository geoRepository = new GeoRepository();

            geoRepository.Set3LevelByFullname(e.NewGeoFullName, e.UpdateGeo);
        }
Esempio n. 4
0
 public void UpdateGeo(Site e)
 {
     GeoRepository geoRepository = new GeoRepository();
     geoRepository.Set3LevelByFullname(e.NewGeoFullName, e.UpdateGeo);
 }