//ADD DOCTOR DETAILS public void AddDoctorBasicDetails(DoctorBasicDetails DocData) { #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); DoctorBasicDetails x = new DoctorBasicDetails(); x.DoctorID = DocData.DoctorID; x.Name = DocData.Name; x.Specialization = DocData.Specialization; x.PhoneNumber = DocData.PhoneNumber; x.Email = DocData.Email; x.PersonalClinicID = DocData.PersonalClinicID; tableContext.AddObject("DoctorDetails", x); tableContext.SaveChanges(); }
public void UpdateDoctorBasicDetails(string DocID, DoctorBasicDetails DocData) { 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<DoctorBasicDetails> data = (from i in tableContext.CreateQuery<DoctorBasicDetails>("DoctorDetails") where i.PartitionKey == "DoctorBasicDetails" select i).AsQueryable<DoctorBasicDetails>(); //Label1.Text = ""; if (data.AsEnumerable<DoctorBasicDetails>().Any<DoctorBasicDetails>()) { //DoctorBasicDetails z = new DoctorBasicDetails(); var x = (from DoctorBasicDetails i in data where i.DoctorID == DocID select i).FirstOrDefault<DoctorBasicDetails>() as DoctorBasicDetails; if (x != null) { //x.DoctorID = DocData.DoctorID; x.Name = DocData.Name; x.Specialization = DocData.Specialization; x.PhoneNumber = DocData.PhoneNumber; x.Email = DocData.Email; x.PersonalClinicID = DocData.PersonalClinicID; tableContext.UpdateObject(x); tableContext.SaveChanges(); } } }
public DoctorBasicDetails SeeDoctorBasicDetails(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<DoctorBasicDetails> data = (from i in tableContext.CreateQuery<DoctorBasicDetails>("DoctorDetails") where i.PartitionKey == "DoctorBasicDetails" select i).AsQueryable<DoctorBasicDetails>(); //Label1.Text = ""; if (data.AsEnumerable<DoctorBasicDetails>().Any<DoctorBasicDetails>()) { DoctorBasicDetails z = new DoctorBasicDetails(); var y = (from DoctorBasicDetails i in data where i.DoctorID == DocID select i).FirstOrDefault<DoctorBasicDetails>() as DoctorBasicDetails; if (y != null) { z = y; } else { z = null; } return z; } else return null; }