public static void SyncZoneInDatabase() { using (var db = new DB.JustFoodDBEntities()) { var zones = db.TimeZones.ToList(); var change = false; foreach (var timezone in SystemTimeZones) { if (!zones.Any(n => n.TimeZoneInfoId == timezone.Id)) { //not in the database. var timeZoneDb = new DB.TimeZone() { TimeZoneInfoId = timezone.Id, TimeZoneDisplay = timezone.DisplayName }; change = true; db.TimeZones.Add(timeZoneDb); } } if (change) { db.SaveChanges(); } dbTimeZones = db.TimeZones.ToList(); } }
public static void RefreshSetting() { using (var db = new DB.JustFoodDBEntities()) { setting = db.Configs.FirstOrDefault(); AppVar.Name = Setting.ApplicationName.ToString(); AppVar.Subtitle = Setting.ApplicationSubtitle.ToString(); AppVar.DeveloperEmail = Setting.DeveloperEmail.ToString(); AppVar.AdminEmail = Setting.AdminEmail.ToString(); AppVar.IsNotifyAdmin = Setting.IsNotifyAdminOnError; AppVar.IsNotifyDeveloper = Setting.IsNotifyDeveloperOnError; AppVar.CompanyName = Setting.CompanyName; InitalizeDevelopersOrganismComponent(); } }
public HomeController() { db = new DB.JustFoodDBEntities(); userinfo = new UserInfo(); }