//VIEW GENERAL HISTORY
        public GeneralHistory SeeGeneralHistoryData(string SSN)
        {
            if (SSN == null)
                return null;

            #if DEBUG
            account = CloudStorageAccount.DevelopmentStorageAccount;
            #else
            account = new CloudStorageAccount(accountAndKey, true);
            #endif
            client = account.CreateCloudTableClient();
            client.CreateTableIfNotExist("PatientDetails");
            tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);

            IQueryable<GeneralHistory> data = (from i in tableContext.CreateQuery<GeneralHistory>("PatientDetails") where i.PartitionKey == "GeneralHistory" select i).AsQueryable<GeneralHistory>();
            //Label1.Text = "";
            if (data.AsEnumerable<GeneralHistory>().Any<GeneralHistory>())
            {

                GeneralHistory z = new GeneralHistory();

                var y = (from GeneralHistory i in data where i.PatientIDLinkRowKey == SSN select i).FirstOrDefault<GeneralHistory>() as GeneralHistory;

                if (y != null)
                {

                    z = y;

                }

                else
                {
                    z = null;

                }
                return z;

            }
            else return null;
        }
        //UPDATE GENERAL HISTORY
        public void UpdateGeneralHistory(string SSN, GeneralHistory GenHistData)
        {
            if (SSN == null)
                return;

            #if DEBUG
            account = CloudStorageAccount.DevelopmentStorageAccount;
            #else
            account = new CloudStorageAccount(accountAndKey, true);
            #endif
            client = account.CreateCloudTableClient();
            client.CreateTableIfNotExist("PatientDetails");
            tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);

            IQueryable<GeneralHistory> data = (from i in tableContext.CreateQuery<GeneralHistory>("PatientDetails") where i.PartitionKey == "GeneralHistory" select i).AsQueryable<GeneralHistory>();
            //Label1.Text = "";
            if (data.AsEnumerable<GeneralHistory>().Any<GeneralHistory>())
            {

                var x = (from GeneralHistory i in data where i.PatientIDLinkRowKey == SSN select i).FirstOrDefault<GeneralHistory>() as GeneralHistory;

                if (x != null)
                {
                    x.Allergies = GenHistData.Allergies;
                    x.BloodPressure = GenHistData.BloodPressure;
                    x.BloodType = GenHistData.BloodType;
                    x.BMI = GenHistData.BMI;
                    x.Conditions = GenHistData.Conditions;
                    x.Height = GenHistData.Height;
                    x.Weight = GenHistData.Weight;
                    x.Others = GenHistData.Others;
                    //x.PatientIDLinkRowKey = GenHistData.PatientIDLinkRowKey;

                    //tableContext.AddObject("PatientDetails", x);
                    tableContext.UpdateObject(x);
                    tableContext.SaveChanges();
                }
            }
        }
        //ADD GENERAL HISTORY
        public void AddGeneralHistoryData(GeneralHistory GenHistData)
        {
            #if DEBUG
            account = CloudStorageAccount.DevelopmentStorageAccount;
            #else
            account = new CloudStorageAccount(accountAndKey, true);
            #endif
            client = account.CreateCloudTableClient();
            client.CreateTableIfNotExist("PatientDetails");
            tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);

            GeneralHistory x = new GeneralHistory();
            x.Allergies = GenHistData.Allergies;
            x.BloodPressure = GenHistData.BloodPressure;
            x.BloodType = GenHistData.BloodType;
            x.BMI = GenHistData.BMI;
            x.Conditions = GenHistData.Conditions;
            x.Height = GenHistData.Height;
            x.Weight = GenHistData.Weight;
            x.Others = GenHistData.Others;
            x.PatientIDLinkRowKey = GenHistData.PatientIDLinkRowKey;

            tableContext.AddObject("PatientDetails", x);
            tableContext.SaveChanges();
        }