Ejemplo n.º 1
0
        public void SaveWeatherSettings(WeatherSettings ws)
        {
            using (var db = new DefaultContext())
            {
                WeatherSettings currentWeatherSettings = db.WeatherSettings.SingleOrDefault(x => x.Pk_WeatherId == ws.Pk_WeatherId);
                currentWeatherSettings.Enabled    = ws.Enabled;
                currentWeatherSettings.Farenheit  = ws.Farenheit;
                currentWeatherSettings.Cloudiness = ws.Cloudiness;
                currentWeatherSettings.Humidity   = ws.Humidity;
                currentWeatherSettings.WindSpeed  = ws.WindSpeed;
                currentWeatherSettings.Location   = ws.Location;

                db.WeatherSettings.Attach(currentWeatherSettings);
                db.Entry(currentWeatherSettings).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        /* * * * * * * * * * * * * * * * * * * * * * * * * * *
        *
        *          Save individual settings section
        *
        * * * * * * * * * * * * * * * * * * * * * * * * * * */

        public void SaveNewsSettings(NewsSettings ns)
        {
            using (var db = new DefaultContext())
            {
                NewsSettings currentNewsSettings = db.NewsSettings.SingleOrDefault(x => x.Pk_NewsId == ns.Pk_NewsId);
                currentNewsSettings.Enabled    = ns.Enabled;
                currentNewsSettings.Domains    = ns.Domains;
                currentNewsSettings.Sources    = ns.Sources;
                currentNewsSettings.Queries    = ns.Queries;
                currentNewsSettings.OldestDate = ns.OldestDate;
                currentNewsSettings.NewestDate = ns.NewestDate;
                currentNewsSettings.Language   = ns.Language;
                currentNewsSettings.PageSize   = ns.PageSize;

                db.NewsSettings.Attach(currentNewsSettings);
                db.Entry(currentNewsSettings).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        public void SaveTrafficSettings(TrafficSettings ts)
        {
            using (var db = new DefaultContext())
            {
                TrafficSettings currentTrafficSettings = db.TrafficSettings.SingleOrDefault(x => x.Pk_TrafficId == ts.Pk_TrafficId);
                currentTrafficSettings.Enabled            = ts.Enabled;
                currentTrafficSettings.Address            = ts.Address;
                currentTrafficSettings.WorkAddress        = ts.WorkAddress;
                currentTrafficSettings.Driving            = ts.Driving;
                currentTrafficSettings.AddressPlaceId     = ts.AddressPlaceId;
                currentTrafficSettings.WorkAddressPlaceId = ts.WorkAddressPlaceId;
                currentTrafficSettings.LatLng             = ts.LatLng;


                db.TrafficSettings.Attach(currentTrafficSettings);
                db.Entry(currentTrafficSettings).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Ejemplo n.º 4
0
 public TrafficSettings GetTrafficSettings(int trafficSettingsId)
 {
     using (var db = new DefaultContext())
         return(db.TrafficSettings.SingleOrDefault(x => x.Pk_TrafficId == trafficSettingsId));
 }
Ejemplo n.º 5
0
 public WeatherSettings GetWeatherSettings(int weatherSettingsId)
 {
     using (var db = new DefaultContext())
         return(db.WeatherSettings.SingleOrDefault(x => x.Pk_WeatherId == weatherSettingsId));
 }
Ejemplo n.º 6
0
        /* * * * * * * * * * * * * * * * * * * * * * * * * * *
        *
        *          Get individual settings section
        *
        * * * * * * * * * * * * * * * * * * * * * * * * * * */

        public NewsSettings GetNewsSettings(int newsSettingsId)
        {
            using (var db = new DefaultContext())
                return(db.NewsSettings.SingleOrDefault(x => x.Pk_NewsId == newsSettingsId));
        }
Ejemplo n.º 7
0
 public int GetWeatherId(string userId)
 {
     using (var db = new DefaultContext())
         return(db.SettingsTable.SingleOrDefault(x => x.Pk_Email == userId).Fk_WeatherId);
 }