public bool boGetExported(IActivity activity) { if (activity != null) { #if !ST_2_1 int? ExportedCustData = (int?)(activity.GetCustomDataValue(FunbeatExportedField) as double?); #else int? ExportedCustData = null; #endif // Upgrade from old to new method of marking an activity to be exported if (ExportedCustData == null) { // Check if metadata string exists and update the cust data field bool boExported = (activity.Metadata.Source.IndexOf("Funbeated") >= 0); #if !ST_2_1 if (boExported) activity.SetCustomDataValue(FunbeatExportedField, (double?)1.0); else activity.SetCustomDataValue(FunbeatExportedField, (double?)0.0); #endif return boExported; } else { return (ExportedCustData != 0); } } else return false; }
public void SetExported(IActivity activity, bool boExported) { if (activity != null) { if (boExported) { // Use both old method (metadata string) and new method (cust data field) activity.Metadata.Source += "Funbeated"; #if !ST_2_1 activity.SetCustomDataValue(FunbeatExportedField, (double?)1.0); #endif } else { //TODO: Add code to remove the Funbeated string #if !ST_2_1 activity.SetCustomDataValue(FunbeatExportedField, (double?)0.0); #endif } } }
public void SetCustomFieldsData(IActivity activity, int? RPE, double? TE, int? Repetitions, int? Sets) { if (activity != null) { int? CurrentRPE, CurrentRepetitions, CurrentSets; double? CurrentTE; GetCustomFieldsData(activity, out CurrentRPE, out CurrentTE, out CurrentRepetitions, out CurrentSets); if (CurrentRPE != RPE) activity.SetCustomDataValue(RPEField, (double?)RPE); if (CurrentTE != TE) activity.SetCustomDataValue(TEField, TE); if (CurrentRepetitions != Repetitions) activity.SetCustomDataValue(RepetitionsField, (double?)Repetitions); if (CurrentSets != Sets) activity.SetCustomDataValue(SetsField, (double?)Sets); } }