Ejemplo n.º 1
0
        private void CreateAvailableEndpoints(dynamic data)
        {
            if (string.IsNullOrEmpty(data.alias))
                return;

            string alias = data.alias;
            string description = data.description;
            string disclaimer = data.disclaimer;

            var esa = new AvailableEndpoint
            {
                PartitionKey = alias,
                RowKey = "",
                alias = alias,
                description = description,
                disclaimer = disclaimer,
                storageaccountname = data.storagename,
                storageaccountkey = data.storagekey
            };

            CloudStorageAccount ta = CloudStorageAccount.Parse(string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", data.storagename, data.storagekey));
            var ctx = new TableServiceContext(ta.TableEndpoint.AbsoluteUri, ta.Credentials);
            var tableClient = ta.CreateCloudTableClient();
            tableClient.CreateTableIfNotExist(ENDPOINTS_TABLENAME);
            ctx.AddObject(ENDPOINTS_TABLENAME, esa);
            ctx.SaveChanges();
        }
Ejemplo n.º 2
0
        //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();
        }
        protected void DelAllBut_Click(object sender, EventArgs e)
        {
            #if AZURE
            var storageAccount = CloudStorageAccount.Parse(Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue("fiftyonedegrees"));
            var serviceContext = new TableServiceContext(storageAccount.TableEndpoint.ToString(), storageAccount.Credentials);
            storageAccount.CreateCloudTableClient().CreateTableIfNotExist("log");

            foreach (var row in serviceContext.CreateQuery<LogMessageEntity>("log"))
            {
                serviceContext.DeleteObject(row);
            }
            serviceContext.SaveChanges();

            Page.Response.Redirect(Page.Request.Url.ToString(), true);
            #endif
        }
        public void CanCreateTable()
        {
            var tableName = "ReviewEntity";

            var tableServiceContext = new TableServiceContext(_account.TableEndpoint.ToString(), _account.Credentials);

            _account.CreateCloudTableClient().DeleteTableIfExist(tableName);
            _account.CreateCloudTableClient().CreateTableIfNotExist(tableName);

            tableServiceContext.AddObject(tableName, new ReviewEntity() { Title = "blah", PublicationDate = DateTime.Now });
            tableServiceContext.AddObject(tableName, new ReviewEntity() { Title = "test", PublicationDate = DateTime.Now.AddDays(-7) });
            tableServiceContext.SaveChanges();

            var results = from c in tableServiceContext.CreateQuery<ReviewEntity>(tableName) select c;

            var query = results.AsTableServiceQuery<ReviewEntity>();
            var queryResults = query.Execute();
            queryResults.Count().ShouldEqual(2);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The main loop for the log table service thread.
        /// </summary>
        protected void Run(Object stateInfo)
        {
            // Initialise the Azure table service creating the table if it does not exist.
            var storageAccount = CloudStorageAccount.Parse(Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(FiftyOne.Foundation.Mobile.Constants.AZURE_STORAGE_NAME));
            var serviceContext = new TableServiceContext(storageAccount.TableEndpoint.ToString(), storageAccount.Credentials);
            var tableName = Regex.Replace(LogFile, "[^A-Za-z]+", String.Empty);
            storageAccount.CreateCloudTableClient().CreateTableIfNotExist(tableName);

            while (IsQueueEmpty() == false)
            {
                try
                {
                    while (IsQueueEmpty() == false)
                    {
                        lock (_syncQueue)
                        {
                            string message = _queue.Peek();
                            if (message != null)
                            {
                                var entity = new LogMessageEntity(message);
                                serviceContext.AddObject(tableName, entity);
                                _queue.Dequeue();
                            }
                        }
                    }
                    // Commit the new log entries to the database.
                    serviceContext.SaveChanges();
                }
                catch
                {
                    // End the thread and wait until another message comes
                    // arrives to resume writing.
                    _running = false;
                    return;
                }

                // Sleep for 50ms incase any new messages come in.
                Thread.Sleep(50);
            }
            _running = false;
        }
Ejemplo n.º 6
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();

                }

            }
        }
Ejemplo n.º 7
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();
        }
Ejemplo n.º 8
0
        public void UpdateHospitalBasicDetails(string HospID, HospitalBasicDetails HospitalData)
        {
            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<HospitalBasicDetails> data = (from i in tableContext.CreateQuery<HospitalBasicDetails>("DoctorDetails") where i.PartitionKey == "HospitalBasicDetails" select i).AsQueryable<HospitalBasicDetails>();
            //Label1.Text = "";
            if (data.AsEnumerable<HospitalBasicDetails>().Any<HospitalBasicDetails>())
            {

                HospitalBasicDetails z = new HospitalBasicDetails();

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

                if (x != null)
                {

                    //x.HospitalID = HospitalData.HospitalID;
                    x.HospitalName = HospitalData.HospitalName;
                    x.Address = HospitalData.Address;
                    x.Latitude = HospitalData.Latitude;
                    x.Longitude = HospitalData.Longitude;
                    x.Facilities = HospitalData.Facilities;
                    x.Departments = HospitalData.Departments;
                    x.Beds_Rooms = HospitalData.Beds_Rooms;
                    x.Type = HospitalData.Type;

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

                }

            }
        }
Ejemplo n.º 9
0
        //UPDATE GENERAL HISTORY
        public void UpdateGeneralHistory(string SSN, GeneralHistory GenHistData)
        {
            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<GeneralHistory> data = (from i in tableContext.CreateQuery<GeneralHistory>("PatientDetails") where i.PartitionKey == "GeneralHistory" select i).AsQueryable<GeneralHistory>();
            //Label1.Text = "";
            if (data.AsEnumerable<GeneralHistory>().Any<GeneralHistory>())
            {

                var x = (from GeneralHistory i in data where i.PatientIDLinkRowKey == SSN select i).FirstOrDefault<GeneralHistory>() as GeneralHistory;

                if (x != null)
                {
                    x.Allergies = GenHistData.Allergies;
                    x.BloodPressure = GenHistData.BloodPressure;
                    x.BloodType = GenHistData.BloodType;
                    x.BMI = GenHistData.BMI;
                    x.Conditions = GenHistData.Conditions;
                    x.Height = GenHistData.Height;
                    x.Weight = GenHistData.Weight;
                    x.Others = GenHistData.Others;
                    //x.PatientIDLinkRowKey = GenHistData.PatientIDLinkRowKey;

                    //tableContext.AddObject("PatientDetails", x);
                    tableContext.UpdateObject(x);
                    tableContext.SaveChanges();
                }
            }
        }
Ejemplo n.º 10
0
        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();

                }

            }
        }
Ejemplo n.º 11
0
        //UPDATE BASIC DETAILS
        public void UpdateBasicDetails(string SSN, BasicDetails PatientData)
        {
            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<BasicDetails> data = (from i in tableContext.CreateQuery<BasicDetails>("PatientDetails") where i.PartitionKey == "BasicDetails" select i).AsQueryable<BasicDetails>();
            //Label1.Text = "";
            if (data.AsEnumerable<BasicDetails>().Any<BasicDetails>())
            {
                var y = (from BasicDetails i in data where i.SSN == SSN select i).FirstOrDefault<BasicDetails>() as BasicDetails;

                if (y != null)
                {

                    y.Name = PatientData.Name;
                    //y.SSN = PatientData.SSN;
                    y.DOB = PatientData.DOB;
                    y.LegalStatus = PatientData.LegalStatus;
                    y.MedicalInsurance = PatientData.MedicalInsurance;
                    y.Gender = PatientData.Gender;
                    y.Address = PatientData.Address;
                    y.Nationality = PatientData.Nationality;
                    y.NextOfKin = PatientData.NextOfKin;
                    y.PhoneNumber = PatientData.PhoneNumber;

                    //tableContext.AddObject("PatientDetails", x);
                    tableContext.UpdateObject(y);
                    tableContext.SaveChanges();
                }
            }
        }
Ejemplo n.º 12
0
        //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();
        }
Ejemplo n.º 13
0
        //ADD BASIC DETAILS
        public void AddPatientData(BasicDetails PatientData)
        {
            #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);

            BasicDetails x = new BasicDetails();
            x.Name = PatientData.Name;
            x.SSN = PatientData.SSN;
            x.DOB = PatientData.DOB;
            x.LegalStatus = PatientData.LegalStatus;
            x.MedicalInsurance = PatientData.MedicalInsurance;
            x.Gender = PatientData.Gender;
            x.Address = PatientData.Address;
            x.Nationality = PatientData.Nationality;
            x.NextOfKin = PatientData.NextOfKin;
            x.PhoneNumber = PatientData.PhoneNumber;
            x.Longitude = PatientData.Longitude;
            x.Latitude = PatientData.Latitude;

            tableContext.AddObject("PatientDetails", x);
            tableContext.SaveChanges();
        }
Ejemplo n.º 14
0
        public void AddHospitalBasicDetails(HospitalBasicDetails HospitalData)
        {
            #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);

            HospitalBasicDetails x = new HospitalBasicDetails();

            x.HospitalID = HospitalData.HospitalID;
            x.HospitalName = HospitalData.HospitalName;
            x.Address = HospitalData.Address;
            x.Latitude = HospitalData.Latitude;
            x.Longitude = HospitalData.Longitude;
            x.Facilities = HospitalData.Facilities;
            x.Departments = HospitalData.Departments;
            x.Beds_Rooms = HospitalData.Beds_Rooms;
            x.Type = HospitalData.Type;

            tableContext.AddObject("DoctorDetails", x);
            tableContext.SaveChanges();
        }
Ejemplo n.º 15
0
        //ADD GENERAL HISTORY
        public void AddGeneralHistoryData(GeneralHistory GenHistData)
        {
            #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);

            GeneralHistory x = new GeneralHistory();
            x.Allergies = GenHistData.Allergies;
            x.BloodPressure = GenHistData.BloodPressure;
            x.BloodType = GenHistData.BloodType;
            x.BMI = GenHistData.BMI;
            x.Conditions = GenHistData.Conditions;
            x.Height = GenHistData.Height;
            x.Weight = GenHistData.Weight;
            x.Others = GenHistData.Others;
            x.PatientIDLinkRowKey = GenHistData.PatientIDLinkRowKey;

            tableContext.AddObject("PatientDetails", x);
            tableContext.SaveChanges();
        }
Ejemplo n.º 16
0
        //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();
                }
            }
        }