/// <summary>
        /// Update or Register a new user
        /// </summary>
        /// <param name="NewUser"></param>
        public static bool RegisterNewUser(DataClasses.UserProfile NewUser)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();
            try
            {
                var matchedItem = (from users in dc.GetTable<DataClasses.UserProfile>()        //**************************************
                                   where users.id == NewUser.id                                 //******Check if customer already exists
                                   select users).SingleOrDefault();                             //**************************************

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

                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                frmMessageDialog.DisplayBriefMessage("Local Database Connection Error");
                return false;
            }
            catch (Exception ex)
            {
                frmMessageDialog.DisplayBriefMessage(ex.Message);
                return false;
            }
        }
        public static void DeleteUser(DataClasses.UserProfile CurrentUser)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();
            var matchedUser = (from sessions in dc.GetTable<DataClasses.UserProfile>()
                               where sessions.id == CurrentUser.id
                               select sessions).SingleOrDefault();

            try
            {
                dc.UserProfiles.DeleteOnSubmit(matchedUser);
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public static bool StoreDataVO2Max_LocalDB(DataClasses.VO2MaxProgram1 vO2MaxProgram1, int UserID)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

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

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

            }
        }
        private static bool StoreDataDynamicStrength_LocalDB(DataClasses.DynamicStrengthTest dynamicStrengthTest, int UserID)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

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

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.DynamicStrengthTests.InsertOnSubmit(dynamicStrengthTest);
                    dc.DynamicStrengthTests.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;
                }
            }
        }
        private static bool StoreDataProprioceptionProgram_LocalDB(DataClasses.ProprioceptionProgram proprioceptionProgram, int UserID, int DifficultyLevel)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

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

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

            }
        }
        public static void ResetUserData(DataClasses.UserProfile CurrentUser)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();
            var matchedEntries = (from sessions in dc.GetTable<DataClasses.CustomProgram>()
                                  where sessions.UserID == CurrentUser.id
                                  select sessions).ToList<DataClasses.CustomProgram>();

            try
            {
                foreach (DataClasses.CustomProgram entry in matchedEntries)
                    dc.CustomPrograms.DeleteOnSubmit(entry);
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        public static bool StoreDataRehabLeft_LocalDB(DataClasses.RehabProgramLeft rehabProgramLeft, int UserID)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.RehabProgramLeft>()
                               where sessions.id == rehabProgramLeft.id
                               select sessions).SingleOrDefault();

            if (matchedItem == null)
            {
                try
                {
                    dc.RehabProgramLefts.InsertOnSubmit(rehabProgramLeft);
                    dc.RehabProgramLefts.Context.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }