Ejemplo n.º 1
0
 public static bool SaveUserPreference(UserPreference item)
 {
     MyLogger.Information (logTag, string.Format ("User Preferece: Saving {0}.", item.UserId));
     MyDatabase.SaveUserPreference (item);
     var pref = GetUserPreference (item.UserId);
     MyLogger.Information (logTag, string.Format ("User Preferece: {0} Saved.", pref != null ? pref.UserId : "Not"));
     return pref != null;
 }
Ejemplo n.º 2
0
		//TODO: [GROUP 32] just creating a default preference so that
		//all devices are subscribed for all events by default.
		//Remove in proto 3
		private void CreateDefaultPreference ()
		{
			var pref = new UserPreference () {
				UserId = Client.CurrentUser.UserName		
			};
			pref.AddAllToSubscriptionList (EventType.TowStart, UserDevices);
			MyDataManager.SaveUserPreference (pref);
		}
Ejemplo n.º 3
0
		private void LoadUserPreference ()
		{
			MyLogger.Information (this.LocalClassName, string.Format ("Loading User Preference for {0}.", Client.CurrentUser.UserName));
			var r = MyDataManager.GetUserPreference (Client.CurrentUser.UserName);
			if (r != null) {
				CurrentUserPreference = r;
				MyLogger.Information (this.LocalClassName, string.Format ("User Preference Retrieved for {0}.", Client.CurrentUser.UserName));
			} else {
				CurrentUserPreference = new UserPreference () { UserId = Client.CurrentUser.UserName };				
				MyLogger.Information (this.LocalClassName, string.Format ("Default User Preference Created for {0}.", Client.CurrentUser.UserName));
			}
		}
Ejemplo n.º 4
0
 public static void SaveUserPreference(UserPreference item)
 {
     lock (padLock) {
         MyLogger.Information (logTag, string.Format ("User Preferece: Saving {0}.", item.UserId));
         var pref = myDB.Table<UserPreference> ().FirstOrDefault (x => x.Id == item.Id);
         if (pref == null) {
             myDB.Insert (item);
             MyLogger.Information (logTag, string.Format ("User Preferece: {0} Inserted.", item.UserId));
         } else {
             myDB.Update (item);
             MyLogger.Information (logTag, string.Format ("User Preferece: {0} Updated.", item.UserId));
         }
     }
 }
Ejemplo n.º 5
0
 public void Setup()
 {
     userPreference = new UserPreference ();
 }