partial void DeleteGrucoxVO2MaxProgramSession(GrucoxVO2MaxProgramSession instance);
public static bool StoreDataVO2Max_RemoteDB(DataClasses.VO2MaxProgram1 vO2MaxProgram1, int UserID) { GrucoxVO2MaxProgramSession VO2MaxProgramSession = new GrucoxVO2MaxProgramSession(); VO2MaxProgramSession.DeviceUID = (new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString)).GetDeviceMacAddress(); VO2MaxProgramSession.LiveUserID = UserID; VO2MaxProgramSession.SessionDate = DateTime.Now.Subtract(TimeSpan.FromMinutes(10)); VO2MaxProgramSession.SessionDuration = TimeSpan.FromSeconds(vO2MaxProgram1.SessionDuration.Value); VO2MaxProgramSession.LeftMaxConcP = Convert.ToDecimal(vO2MaxProgram1.LeftMaxConcP); VO2MaxProgramSession.LeftMaxEcceP = Convert.ToDecimal(vO2MaxProgram1.LeftMaxEcceP); VO2MaxProgramSession.RightMaxConcP = Convert.ToDecimal(vO2MaxProgram1.RightMaxConcP); VO2MaxProgramSession.RightMaxEcceP = Convert.ToDecimal(vO2MaxProgram1.RightMaxEcceP); VO2MaxProgramSession.LeftAvgConcP = Convert.ToDecimal(vO2MaxProgram1.LeftAvgConcP); VO2MaxProgramSession.LeftAvgEcceP = Convert.ToDecimal(vO2MaxProgram1.LeftAvgEcceP); VO2MaxProgramSession.RightAvgConcP = Convert.ToDecimal(vO2MaxProgram1.RightAvgConcP); VO2MaxProgramSession.RightAvgEcceP = Convert.ToDecimal(vO2MaxProgram1.RightAvgEcceP); VO2MaxProgramSession.LeftStrengthIndex = Convert.ToDecimal(vO2MaxProgram1.LeftStrengthIndex); VO2MaxProgramSession.LeftEnduranceIndex = Convert.ToDecimal(vO2MaxProgram1.LeftEnduranceIndex); VO2MaxProgramSession.RightStrengthIndex = Convert.ToDecimal(vO2MaxProgram1.RightStrengthIndex); VO2MaxProgramSession.RightEnduranceIndex = Convert.ToDecimal(vO2MaxProgram1.RightEnduranceIndex); VO2MaxProgramSession.DistConc = Convert.ToDecimal(vO2MaxProgram1.DistConc); VO2MaxProgramSession.DistEcce = Convert.ToDecimal(vO2MaxProgram1.DistEcce); VO2MaxProgramSession.EnergyBurned = Convert.ToDecimal(vO2MaxProgram1.EnergyBurned); VO2MaxProgramSession.VO2MaxProgramEnum = vO2MaxProgram1.VO2MaxProgramEnum.Value; VO2MaxProgramSession.SessionDescription = "VO2 Max Program " + vO2MaxProgram1.VO2MaxProgramEnum.Value; DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext(); var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxVO2MaxProgramSession>() //************************************** where sessions.ItemID == VO2MaxProgramSession.ItemID //******Check if customer already exists select sessions).SingleOrDefault(); //************************************** if (matchedItem == null) //If customer does not exist { try { dc.GrucoxVO2MaxProgramSessions.InsertOnSubmit(VO2MaxProgramSession); dc.GrucoxVO2MaxProgramSessions.Context.SubmitChanges(); //Add the new customer to the Customers Table return true; } catch (Exception ex) { return false; } } else //Customer already exists { try { dc.SubmitChanges(); return true; } catch (Exception ex) { return false; } } }
partial void InsertGrucoxVO2MaxProgramSession(GrucoxVO2MaxProgramSession instance);