partial void InsertGrucoxRehabRightLegSession(GrucoxRehabRightLegSession instance);
 partial void DeleteGrucoxRehabRightLegSession(GrucoxRehabRightLegSession instance);
コード例 #3
0
        private static bool StoreDataRehabRight_RemoteDB(DataClasses.RehabProgramRight rehabProgramLeft, int UserID)
        {
            GrucoxRehabRightLegSession RehabRightLegSession = new GrucoxRehabRightLegSession();
            RehabRightLegSession.DeviceUID = (new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString)).GetDeviceMacAddress();
            RehabRightLegSession.LiveUserID = UserID;
            RehabRightLegSession.SessionDate = DateTime.Now.Subtract(TimeSpan.FromMinutes(10));
            RehabRightLegSession.SessionDuration = TimeSpan.FromSeconds(rehabProgramLeft.SessionDuration.Value);
            RehabRightLegSession.LeftMaxConcP = Convert.ToDecimal(rehabProgramLeft.LeftMaxConcP.Value);
            RehabRightLegSession.LeftMaxEcceP = Convert.ToDecimal(rehabProgramLeft.LeftMaxEcceP.Value);
            RehabRightLegSession.RightMaxConcP = Convert.ToDecimal(rehabProgramLeft.RightMaxConcP.Value);
            RehabRightLegSession.RightMaxEcceP = Convert.ToDecimal(rehabProgramLeft.RightMaxEcceP.Value);
            RehabRightLegSession.LeftAvgConcP = Convert.ToDecimal(rehabProgramLeft.LeftAvgConcP.Value);
            RehabRightLegSession.LeftAvgEcceP = Convert.ToDecimal(rehabProgramLeft.LeftAvgEcceP.Value);
            RehabRightLegSession.RightAvgConcP = Convert.ToDecimal(rehabProgramLeft.RightAvgConcP.Value);
            RehabRightLegSession.RightAvgEcceP = Convert.ToDecimal(rehabProgramLeft.RightAvgEcceP.Value);
            RehabRightLegSession.LeftStrengthIndex = Convert.ToDecimal(rehabProgramLeft.LeftStrengthIndex.Value);
            RehabRightLegSession.LeftEnduranceIndex = Convert.ToDecimal(rehabProgramLeft.LeftEnduranceIndex.Value);
            RehabRightLegSession.RightStrengthIndex = Convert.ToDecimal(rehabProgramLeft.RightStrengthIndex.Value);
            RehabRightLegSession.RightEnduranceIndex = Convert.ToDecimal(rehabProgramLeft.RightEnduranceIndex.Value);
            RehabRightLegSession.DistConc = Convert.ToDecimal(rehabProgramLeft.DistConc.Value);
            RehabRightLegSession.DistEcce = Convert.ToDecimal(rehabProgramLeft.DistEcce.Value);
            RehabRightLegSession.EnergyBurned = Convert.ToDecimal(rehabProgramLeft.EnergyBurned.Value);
            RehabRightLegSession.SessionDescription = "Rehab Program - Right Leg";


            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxRehabRightLegSession>()                           //**************************************
                               where sessions.ItemID == RehabRightLegSession.ItemID                                             //******Check if customer already exists
                               select sessions).SingleOrDefault();                                                             //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.GrucoxRehabRightLegSessions.InsertOnSubmit(RehabRightLegSession);
                    dc.GrucoxRehabRightLegSessions.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;
                }
            }
        }