/// <summary> /// todoComment /// </summary> /// <param name="AKey"></param> /// <param name="AValue"></param> public static void SetUserDefault(String AKey, String AValue) { Int32 FoundInRow; DataRowView Tmp; FoundInRow = UUserDefaults.Find(AKey); if (FoundInRow != -1) { // User default found if (AValue != UUserDefaults[FoundInRow][SUserDefaultsTable.GetDefaultValueDBName()].ToString()) { // Update only if the value is actually different UUserDefaults[FoundInRow][SUserDefaultsTable.GetDefaultValueDBName()] = AValue; } } else { // User default not found, add it to the user defaults table Tmp = UUserDefaults.AddNew(); Tmp[SUserDefaultsTable.GetUserIdDBName()] = Ict.Petra.Shared.UserInfo.GUserInfo.UserID; Tmp[SUserDefaultsTable.GetDefaultCodeDBName()] = AKey; Tmp[SUserDefaultsTable.GetDefaultValueDBName()] = AValue; Tmp.EndEdit(); } }
/// <summary> /// todoComment /// </summary> /// <param name="AKey"></param> /// <param name="ADefaultValue"></param> /// <returns></returns> public static String GetUserDefault(String AKey, String ADefaultValue) { String ReturnValue; Int32 FoundInRow; ReturnValue = ""; FoundInRow = UUserDefaults.Find(AKey); if (FoundInRow != -1) { // User default found ReturnValue = (UUserDefaults[FoundInRow][SUserDefaultsTable.GetDefaultValueDBName()]).ToString(); } else { // User default not found, return default value ReturnValue = ADefaultValue; } return(ReturnValue); }
/// <summary> /// todoComment /// </summary> /// <param name="AKey"></param> /// <returns></returns> public static bool HasUserDefault(String AKey) { return(UUserDefaults.Find(AKey) != -1); }