//ADD AILMENT DETAILS public void AddAilmentDetails(AilmentDetails AilData) { #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); AilmentDetails x = new AilmentDetails(); x.AttendingPhysician = AilData.AttendingPhysician; x.Diagnosis = AilData.Diagnosis; x.DiagnosisID = AilData.DiagnosisID; x.GeneralPhysician = AilData.GeneralPhysician; x.Hospital = AilData.Hospital; x.Lab_Pathology = AilData.Lab_Pathology; x.Lab_Physical = AilData.Lab_Physical; x.Lab_Radiology = AilData.Lab_Physical; x.Medication = AilData.Medication; x.PatientIDLinkRowKey = AilData.PatientIDLinkRowKey; x.ProgressNotes = AilData.ProgressNotes; x.Symptoms = AilData.Symptoms; x.TimeIn = AilData.TimeIn; x.TimeOut = AilData.TimeOut; x.Treatment = AilData.Treatment; x.AilmentDetailRowKey = AilData.AilmentDetailRowKey; tableContext.AddObject("PatientDetails", x); tableContext.SaveChanges(); }
//VIEW SPECIFIC AILMENT DETAILS public AilmentDetails SeeSpecificAilmentDetailsData(string SSN, string rowkey) { 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<AilmentDetails> data = (from i in tableContext.CreateQuery<AilmentDetails>("PatientDetails") where i.PartitionKey == "AilmentDetails" && i.PatientIDLinkRowKey == SSN && i.AilmentDetailRowKey == rowkey select i).AsQueryable<AilmentDetails>(); if (data.AsEnumerable<AilmentDetails>().Any<AilmentDetails>()) { AilmentDetails z = new AilmentDetails(); var y = (from AilmentDetails i in data select i).FirstOrDefault<AilmentDetails>() as AilmentDetails; if (y != null) { z = y; } else { z = null; } return z; } else return null; }
//UPDATE SPECIFIC AILMENT DETAILS public void UpdateSpecificAilmentsData(string SSN, string rowkey, AilmentDetails AilData) { 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<AilmentDetails> data = (from i in tableContext.CreateQuery<AilmentDetails>("PatientDetails") where i.PartitionKey == "AilmentDetails" select i).AsQueryable<AilmentDetails>(); //Label1.Text = ""; if (data.AsEnumerable<AilmentDetails>().Any<AilmentDetails>()) { var x = (from AilmentDetails i in data where i.PatientIDLinkRowKey == SSN && i.AilmentDetailRowKey == rowkey select i).FirstOrDefault<AilmentDetails>() as AilmentDetails; if (x != null) { //x.AilmentDetailRowKey = AilData.AilmentDetailRowKey; x.AttendingPhysician = AilData.AttendingPhysician; x.Diagnosis = AilData.Diagnosis; x.GeneralPhysician = AilData.GeneralPhysician; x.Hospital = AilData.Hospital; x.Lab_Pathology = AilData.Lab_Pathology; x.Lab_Physical = AilData.Lab_Physical; x.Lab_Radiology = AilData.Lab_Physical; x.Medication = AilData.Medication; //x.PatientIDLinkRowKey = AilData.PatientIDLinkRowKey; x.ProgressNotes = AilData.ProgressNotes; x.Symptoms = AilData.Symptoms; x.TimeIn = AilData.TimeIn; x.TimeOut = AilData.TimeOut; x.Treatment = AilData.Treatment; //tableContext.AddObject("PatientDetails", x); tableContext.UpdateObject(x); tableContext.SaveChanges(); } } }