Пример #1
0
        public HospitalPatientConnectionDetails SeeHospitalPatientConnectionDetails(string HospID)
        {
            if (HospID == null)
                return null;

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

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

                HospitalPatientConnectionDetails z = new HospitalPatientConnectionDetails();

                var y = (from HospitalPatientConnectionDetails i in data where i.HospitalIDLinkRowKey == HospID select i).FirstOrDefault<HospitalPatientConnectionDetails>() as HospitalPatientConnectionDetails;

                if (y != null)
                {

                    z = y;

                }

                else
                {
                    z = null;

                }
                return z;

            }
            else return null;
        }
Пример #2
0
        public void UpdateHospitalPatientConnectionDetails(string HospID, HospitalPatientConnectionDetails HospPatientData)
        {
            if (HospID == 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<HospitalPatientConnectionDetails> data = (from i in tableContext.CreateQuery<HospitalPatientConnectionDetails>("DoctorDetails") where i.PartitionKey == "HospitalPatientConnectionDetails" select i).AsQueryable<HospitalPatientConnectionDetails>();
            //Label1.Text = "";
            if (data.AsEnumerable<HospitalPatientConnectionDetails>().Any<HospitalPatientConnectionDetails>())
            {

                HospitalPatientConnectionDetails z = new HospitalPatientConnectionDetails();

                var x = (from HospitalPatientConnectionDetails i in data where i.HospitalIDLinkRowKey == HospID select i).FirstOrDefault<HospitalPatientConnectionDetails>() as HospitalPatientConnectionDetails;

                if (x != null)
                {

                    //x.HospitalIDLinkRowKey = HospPatientData.HospitalIDLinkRowKey;
                    x.PatientIDLinkRowKey = HospPatientData.PatientIDLinkRowKey;

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

                }

            }
        }
Пример #3
0
        public void AddHospitalPatientConnectionDetails(HospitalPatientConnectionDetails HospPatientData)
        {
            #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);

            HospitalPatientConnectionDetails x = new HospitalPatientConnectionDetails();

            x.HospitalIDLinkRowKey = HospPatientData.HospitalIDLinkRowKey;
            x.PatientIDLinkRowKey = HospPatientData.PatientIDLinkRowKey;

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