public static bool StoreData_VO2MaxTest(int UserID, float VO2MaxRel, float VO2Max, float MaxConcPower) { DataClasses.VO2MaxTestConcForward vO2MaxTestConcForw = new DataClasses.VO2MaxTestConcForward(); vO2MaxTestConcForw.UserID = UserID; vO2MaxTestConcForw.Date = DateTime.Now; vO2MaxTestConcForw.VO2Max = VO2Max; vO2MaxTestConcForw.VO2MaxRel = VO2MaxRel; vO2MaxTestConcForw.MaxConcPower = MaxConcPower; if (GlobalVariables.WriteToRemoteServer == true) { if (StoreData_VO2MaxTest_RemoteDB(vO2MaxTestConcForw, UserID) == true) return true; else return false; } else if (GlobalVariables.WriteToRemoteServer == false) { if (StoreData_VO2MaxTest_LocalDB(vO2MaxTestConcForw, UserID) == true) return true; else return false; } else return false; }
public static DataClasses.VO2MaxTestConcForward GetVO2MaxConcForwRemotePB(int UserID) { DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext(); List<DataClasses.VO2MaxTestConcForward> ListVO2MaxConcForwPB = new List<DataClasses.VO2MaxTestConcForward>(); DataClasses.VO2MaxTestConcForward VO2MaxConForwPB = new DataClasses.VO2MaxTestConcForward(); try { ListVO2MaxConcForwPB = (from sessions in dc.GetTable<DataClasses.VO2MaxTestConcForward>() where sessions.UserID == UserID select sessions).ToList<DataClasses.VO2MaxTestConcForward>(); } catch (Exception) { } finally { if (ListVO2MaxConcForwPB.Count > 0) { VO2MaxConForwPB = (ListVO2MaxConcForwPB.First(x => x.VO2Max == (double)ListVO2MaxConcForwPB.Max(i => i.VO2Max))); } else { VO2MaxConForwPB.VO2Max = 0; VO2MaxConForwPB.VO2MaxRel = 0; } } return VO2MaxConForwPB; }