public DoctorPatientConnectionDetails SeeDoctorPatientConnectionDetails(string DocID) { if (DocID == null) return null; #if DEBUG account = CloudStorageAccount.DevelopmentStorageAccount; #else account = new CloudStorageAccount(accountAndKey, true); #endif client = account.CreateCloudTableClient(); client.CreateTableIfNotExist("DoctorDetails"); tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials); IQueryable<DoctorPatientConnectionDetails> data = (from i in tableContext.CreateQuery<DoctorPatientConnectionDetails>("DoctorDetails") where i.PartitionKey == "DoctorPatientConnectionDetails" select i).AsQueryable<DoctorPatientConnectionDetails>(); //Label1.Text = ""; if (data.AsEnumerable<DoctorPatientConnectionDetails>().Any<DoctorPatientConnectionDetails>()) { DoctorPatientConnectionDetails z = new DoctorPatientConnectionDetails(); var y = (from DoctorPatientConnectionDetails i in data where i.DoctorIDLinkRowKey == DocID select i).FirstOrDefault<DoctorPatientConnectionDetails>() as DoctorPatientConnectionDetails; if (y != null) { z = y; } else { z = null; } return z; } else return null; }
public void UpdateDoctorPatientConnectionDetails(string DocID, DoctorPatientConnectionDetails DocPatientData) { if (DocID == null) return; #if DEBUG account = CloudStorageAccount.DevelopmentStorageAccount; #else account = new CloudStorageAccount(accountAndKey, true); #endif client = account.CreateCloudTableClient(); client.CreateTableIfNotExist("DoctorDetails"); tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials); IQueryable<DoctorPatientConnectionDetails> data = (from i in tableContext.CreateQuery<DoctorPatientConnectionDetails>("DoctorDetails") where i.PartitionKey == "DoctorPatientConnectionDetails" select i).AsQueryable<DoctorPatientConnectionDetails>(); //Label1.Text = ""; if (data.AsEnumerable<DoctorPatientConnectionDetails>().Any<DoctorPatientConnectionDetails>()) { DoctorPatientConnectionDetails z = new DoctorPatientConnectionDetails(); var x = (from DoctorPatientConnectionDetails i in data where i.DoctorIDLinkRowKey == DocID select i).FirstOrDefault<DoctorPatientConnectionDetails>() as DoctorPatientConnectionDetails; if (x != null) { //x.DoctorIDLinkRowKey = DocPatientData.DoctorIDLinkRowKey; x.PatientIDLinkRowKey = DocPatientData.PatientIDLinkRowKey; x.AilmentDetailRowKey = DocPatientData.AilmentDetailRowKey; tableContext.UpdateObject(x); tableContext.SaveChanges(); } } }
public void AddDoctorPatientConnectionDetails(DoctorPatientConnectionDetails DocPatientData) { #if DEBUG account = CloudStorageAccount.DevelopmentStorageAccount; #else account = new CloudStorageAccount(accountAndKey, true); #endif client = account.CreateCloudTableClient(); client.CreateTableIfNotExist("DoctorDetails"); tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials); DoctorPatientConnectionDetails x = new DoctorPatientConnectionDetails(); x.DoctorIDLinkRowKey = DocPatientData.DoctorIDLinkRowKey; x.PatientIDLinkRowKey = DocPatientData.PatientIDLinkRowKey; x.AilmentDetailRowKey = DocPatientData.AilmentDetailRowKey; tableContext.AddObject("DoctorDetails", x); tableContext.SaveChanges(); }