Пример #1
0
        public void UpdateDoctorHospitalConnectionDetails(string DocID, DoctorHospitalConnectionDetails DocHospData)
        {
            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<DoctorHospitalConnectionDetails> data = (from i in tableContext.CreateQuery<DoctorHospitalConnectionDetails>("DoctorDetails") where i.PartitionKey == "DoctorHospitalConnectionDetails" select i).AsQueryable<DoctorHospitalConnectionDetails>();
            //Label1.Text = "";
            if (data.AsEnumerable<DoctorHospitalConnectionDetails>().Any<DoctorHospitalConnectionDetails>())
            {

                DoctorHospitalConnectionDetails z = new DoctorHospitalConnectionDetails();

                var x = (from DoctorHospitalConnectionDetails i in data where i.DoctorIDLinkRowKey == DocID select i).FirstOrDefault<DoctorHospitalConnectionDetails>() as DoctorHospitalConnectionDetails;

                if (x != null)
                {
                    //x.DoctorIDLinkRowKey = DocHospData.DoctorIDLinkRowKey;
                    x.HospitalIDLinkRowKey = DocHospData.HospitalIDLinkRowKey;
                    x.DoctorHospitalPhoneNumber = DocHospData.DoctorHospitalPhoneNumber;

                    tableContext.UpdateObject(x);
                    tableContext.SaveChanges();

                }

            }
        }
Пример #2
0
        public void AddDoctorHospitalConnectionDetails(DoctorHospitalConnectionDetails DocHospData)
        {
            #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);

            DoctorHospitalConnectionDetails x = new DoctorHospitalConnectionDetails();

            x.DoctorIDLinkRowKey = DocHospData.DoctorIDLinkRowKey;
            x.HospitalIDLinkRowKey = DocHospData.HospitalIDLinkRowKey;
            x.DoctorHospitalPhoneNumber = DocHospData.DoctorHospitalPhoneNumber;

            tableContext.AddObject("DoctorDetails", x);
            tableContext.SaveChanges();
        }
Пример #3
0
        public DoctorHospitalConnectionDetails SeeDoctorHospitalConnectionDetails(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<DoctorHospitalConnectionDetails> data = (from i in tableContext.CreateQuery<DoctorHospitalConnectionDetails>("DoctorDetails") where i.PartitionKey == "DoctorHospitalConnectionDetails" select i).AsQueryable<DoctorHospitalConnectionDetails>();
            //Label1.Text = "";
            if (data.AsEnumerable<DoctorHospitalConnectionDetails>().Any<DoctorHospitalConnectionDetails>())
            {

                DoctorHospitalConnectionDetails z = new DoctorHospitalConnectionDetails();

                var y = (from DoctorHospitalConnectionDetails i in data where i.DoctorIDLinkRowKey == DocID select i).FirstOrDefault<DoctorHospitalConnectionDetails>() as DoctorHospitalConnectionDetails;

                if (y != null)
                {

                    z = y;

                }

                else
                {
                    z = null;

                }
                return z;

            }
            else return null;
        }