public static bool StoreDataProprioception(objDataSample DataSample, int UserID)
        {
            DataClasses.ProprioceptionProgram ProprioceptionProgram = new ProprioceptionProgram();
            ProprioceptionProgram.UserID = UserID;
            ProprioceptionProgram.Date = DateTime.Now;
            ProprioceptionProgram.SessionDuration = DataSample.SessionDuration.TotalSeconds;
            ProprioceptionProgram.LeftMaxConcP = DataSample.SessionMaxEcceTorqueAbs;
            ProprioceptionProgram.LeftMaxEcceP = DataSample.SessionMaxEcceTorqueBack;
            ProprioceptionProgram.RightMaxConcP = DataSample.SessionMaxConcTorqueAbs;
            ProprioceptionProgram.RightMaxEcceP = DataSample.SessionMaxConcTorqueBack;
            ProprioceptionProgram.LeftAvgConcP = DataSample.SessionAvgEcceTorqueAbs;
            ProprioceptionProgram.LeftAvgEcceP = DataSample.SessionAvgEcceTorqueAbs;
            ProprioceptionProgram.RightAvgConcP = DataSample.SessionAvgConcTorqueAbs;
            ProprioceptionProgram.RightAvgEcceP = DataSample.SessionAvgConcTorqueBack;
            ProprioceptionProgram.LeftStrengthIndex = DataSample.SessionStrengthIndexBack;
            ProprioceptionProgram.LeftEnduranceIndex = DataSample.SessionEnduranceIndexBack;
            ProprioceptionProgram.RightStrengthIndex = DataSample.SessionStrengthIndexAbs;
            ProprioceptionProgram.RightEnduranceIndex = DataSample.SessionEnduranceIndexAbs;
            ProprioceptionProgram.DistConc = DataSample.DistanceConc;
            ProprioceptionProgram.DistEcce = DataSample.DistanceEcce;
            ProprioceptionProgram.EnergyBurned = DataSample.TotalEnergyBurned;
            ProprioceptionProgram.DifficultyLevel = DataSample.DifficultyLevel;

            if (GlobalVariables.WriteToRemoteServer == true)
            {
                if (StoreDataProprioceptionProgram_RemoteDB(ProprioceptionProgram, UserID, DataSample.DifficultyLevel) == true)
                    return true;
                else
                    return false;
            }
            else if (GlobalVariables.WriteToRemoteServer == false)
            {
                if (StoreDataProprioceptionProgram_LocalDB(ProprioceptionProgram, UserID, DataSample.DifficultyLevel) == true)
                    return true;
                else
                    return false;
            }
            else
                return false;
        }
        public static bool StoreData_TrunkCustomProrgram(objDataSample DataSample, int Id)
        {
            DataClasses.GrucoxTrunkCustomSession customProgram = new GrucoxTrunkCustomSession();
            customProgram.Id = Id;
            customProgram.SessionDate = DateTime.Now;
            customProgram.Duration = DataSample.SessionDuration;
            customProgram.AbsMaxConcT = (decimal)DataSample.SessionMaxConcTorqueAbs;
            customProgram.AbsMaxEcceT = (decimal)DataSample.SessionMaxEcceTorqueAbs;
            customProgram.BackMaxConcT = (decimal)DataSample.SessionMaxConcTorqueBack;
            customProgram.BackMaxEcceT = (decimal)DataSample.SessionMaxEcceTorqueBack;
            customProgram.AbsAvgConcT = (decimal)DataSample.SessionAvgConcTorqueAbs;
            customProgram.AbsAvgEcceT = (decimal)DataSample.SessionAvgEcceTorqueAbs;
            customProgram.BackAvgConcT = (decimal)DataSample.SessionAvgConcTorqueBack;
            customProgram.BackAvgEcceT = (decimal)DataSample.SessionAvgEcceTorqueBack;
            customProgram.AbsStrengthIndex = (decimal)DataSample.SessionStrengthIndexAbs;
            customProgram.AbsEnduranceIndex = (decimal)DataSample.SessionEnduranceIndexAbs;
            customProgram.BackStrengthIndex = (decimal)DataSample.SessionStrengthIndexBack;
            customProgram.BackEnduranceIndex = (decimal)DataSample.SessionEnduranceIndexBack;
            customProgram.EnergyBurned = (decimal)DataSample.TotalEnergyBurned;

            if (GlobalVariables.WriteToRemoteServer == true)
            {
                if (StoreData_RemoteDB1(customProgram, Id) == true)
                    return true;
                else
                    return false;
            }
            else if (GlobalVariables.WriteToRemoteServer == false)
            {
                if (StoreData_LocalDB(customProgram, Id) == true)
                    return true;
                else
                    return false;
            }
            else
                return false;
        }
        public static bool StoreDataVO2Max(objDataSample DataSample, int UserID, int VO2MaxProgramEnum)
        {
            DataClasses.VO2MaxProgram1 vO2MaxProgram1 = new DataClasses.VO2MaxProgram1();
            vO2MaxProgram1.UserID = UserID;
            vO2MaxProgram1.Date = DateTime.Now;
            vO2MaxProgram1.SessionDuration = DataSample.SessionDuration.TotalSeconds;
            vO2MaxProgram1.LeftMaxConcP = DataSample.SessionMaxEcceTorqueAbs;
            vO2MaxProgram1.LeftMaxEcceP = DataSample.SessionMaxEcceTorqueBack;
            vO2MaxProgram1.RightMaxConcP = DataSample.SessionMaxConcTorqueAbs;
            vO2MaxProgram1.RightMaxEcceP = DataSample.SessionMaxConcTorqueBack;
            vO2MaxProgram1.LeftAvgConcP = DataSample.SessionAvgEcceTorqueAbs;
            vO2MaxProgram1.LeftAvgEcceP = DataSample.SessionAvgEcceTorqueAbs;
            vO2MaxProgram1.RightAvgConcP = DataSample.SessionAvgConcTorqueAbs;
            vO2MaxProgram1.RightAvgEcceP = DataSample.SessionAvgConcTorqueBack;
            vO2MaxProgram1.LeftStrengthIndex = DataSample.SessionStrengthIndexBack;
            vO2MaxProgram1.LeftEnduranceIndex = DataSample.SessionEnduranceIndexBack;
            vO2MaxProgram1.RightStrengthIndex = DataSample.SessionStrengthIndexAbs;
            vO2MaxProgram1.RightEnduranceIndex = DataSample.SessionEnduranceIndexAbs;
            vO2MaxProgram1.DistConc = DataSample.DistanceConc;
            vO2MaxProgram1.DistEcce = DataSample.DistanceEcce;
            vO2MaxProgram1.EnergyBurned = DataSample.TotalEnergyBurned;
            vO2MaxProgram1.VO2MaxProgramEnum = VO2MaxProgramEnum;

            if (GlobalVariables.WriteToRemoteServer == true)
            {
                if (StoreDataVO2Max_RemoteDB(vO2MaxProgram1, UserID) == true)
                    return true;
                else
                    return false;
            }
            else if (GlobalVariables.WriteToRemoteServer == false)
            {
                if (StoreDataVO2Max_LocalDB(vO2MaxProgram1, UserID) == true)
                    return true;
                else
                    return false;
            }
            else
                return false;
        }
 public ThreadClassCustomProgram(objDataSample DataSample, int UserID, CustomProgramCallback callbackDelegate)
 {
     dataSample = DataSample;
     userID = UserID;
     callback = callbackDelegate;
 }
        public static bool StoreData_CustomProgram(objDataSample DataSample, int UserID)
        {
            DataClasses.CustomProgram customProgram = new CustomProgram();
            customProgram.UserID = UserID;
            customProgram.Date = DateTime.Now;
            customProgram.SessionDuration = DataSample.SessionDuration.TotalSeconds;
            customProgram.LeftMaxConcP = DataSample.SessionMaxEcceTorqueAbs;
            customProgram.LeftMaxEcceP = DataSample.SessionMaxEcceTorqueBack;
            customProgram.RightMaxConcP = DataSample.SessionMaxConcTorqueAbs;
            customProgram.RightMaxEcceP = DataSample.SessionMaxConcTorqueBack;
            customProgram.LeftAvgConcP = DataSample.SessionAvgEcceTorqueAbs;
            customProgram.LeftAvgEcceP = DataSample.SessionAvgEcceTorqueAbs;
            customProgram.RightAvgConcP = DataSample.SessionAvgConcTorqueAbs;
            customProgram.RightAvgEcceP = DataSample.SessionAvgConcTorqueBack;
            customProgram.LeftStrengthIndex = DataSample.SessionStrengthIndexBack;
            customProgram.LeftEnduranceIndex = DataSample.SessionEnduranceIndexBack;
            customProgram.RightStrengthIndex = DataSample.SessionStrengthIndexAbs;
            customProgram.RightEnduranceIndex = DataSample.SessionEnduranceIndexAbs;
            customProgram.DistConc = DataSample.DistanceConc;
            customProgram.DistEcce = DataSample.DistanceEcce;
            customProgram.EnergyBurned = DataSample.TotalEnergyBurned;

            if (GlobalVariables.WriteToRemoteServer == true)
            {
                if (StoreData_RemoteDB1(customProgram, UserID) == true)
                    return true;
                else
                    return false;
            }
            else if (GlobalVariables.WriteToRemoteServer == false)
            {
                if (StoreData_LocalDB(customProgram, UserID) == true)
                    return true;
                else
                    return false;
            }
            else
                return false;
        }