コード例 #1
0
 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();
     }
 }
コード例 #2
0
ファイル: AppConfig.cs プロジェクト: adulenzy/JustFood
 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();
     }
 }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: adulenzy/JustFood
 public HomeController()
 {
     db       = new DB.JustFoodDBEntities();
     userinfo = new UserInfo();
 }