partial void InsertGrucoxRehabBilateralSession(GrucoxRehabBilateralSession instance);
partial void DeleteGrucoxRehabBilateralSession(GrucoxRehabBilateralSession instance);
private static bool StoreDataRehabBilateral_RemoteDB(DataClasses.RehabProgram rehabProgram, int UserID) { GrucoxRehabBilateralSession RehabBilateralSession = new GrucoxRehabBilateralSession(); RehabBilateralSession.DeviceUID = (new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString)).GetDeviceMacAddress(); RehabBilateralSession.LiveUserID = UserID; RehabBilateralSession.SessionDate = DateTime.Now.Subtract(TimeSpan.FromMinutes(10)); RehabBilateralSession.SessionDuration = TimeSpan.FromSeconds(rehabProgram.SessionDuration.Value); RehabBilateralSession.LeftMaxConcP = Convert.ToDecimal(rehabProgram.LeftMaxConcP.Value); RehabBilateralSession.LeftMaxEcceP = Convert.ToDecimal(rehabProgram.LeftMaxEcceP.Value); RehabBilateralSession.RightMaxConcP = Convert.ToDecimal(rehabProgram.RightMaxConcP.Value); RehabBilateralSession.RightMaxEcceP = Convert.ToDecimal(rehabProgram.RightMaxEcceP.Value); RehabBilateralSession.LeftAvgConcP = Convert.ToDecimal(rehabProgram.LeftAvgConcP.Value); RehabBilateralSession.LeftAvgEcceP = Convert.ToDecimal(rehabProgram.LeftAvgEcceP.Value); RehabBilateralSession.RightAvgConcP = Convert.ToDecimal(rehabProgram.RightAvgConcP.Value); RehabBilateralSession.RightAvgEcceP = Convert.ToDecimal(rehabProgram.RightAvgEcceP.Value); RehabBilateralSession.LeftStrengthIndex = Convert.ToDecimal(rehabProgram.LeftStrengthIndex.Value); RehabBilateralSession.LeftEnduranceIndex = Convert.ToDecimal(rehabProgram.LeftEnduranceIndex.Value); RehabBilateralSession.RightStrengthIndex = Convert.ToDecimal(rehabProgram.RightStrengthIndex.Value); RehabBilateralSession.RightEnduranceIndex = Convert.ToDecimal(rehabProgram.RightEnduranceIndex.Value); RehabBilateralSession.DistConc = Convert.ToDecimal(rehabProgram.DistConc.Value); RehabBilateralSession.DistEcce = Convert.ToDecimal(rehabProgram.DistEcce.Value); RehabBilateralSession.EnergyBurned = Convert.ToDecimal(rehabProgram.EnergyBurned.Value); RehabBilateralSession.SessionDescription = "Rehab Program - Bilateral"; DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext(); var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxRehabBilateralSession>() //************************************** where sessions.ItemID == RehabBilateralSession.ItemID //******Check if customer already exists select sessions).SingleOrDefault(); //************************************** if (matchedItem == null) //If customer does not exist { try { dc.GrucoxRehabBilateralSessions.InsertOnSubmit(RehabBilateralSession); dc.GrucoxRehabBilateralSessions.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; } } }