Пример #1
0
        public string Put(int id, [FromBody] Meds value)
        {
            using (db)
            {
                try
                {
                    var entity = db.Meds.Where(x => x.Id == id).First <Meds>();

                    entity.Name                  = value.Name;
                    entity.Pieces                = value.Pieces;
                    entity.Type                  = value.Type;
                    entity.BestBefore            = value.BestBefore;
                    entity.Picture               = value.Picture;
                    entity.BaseSubstance         = value.BaseSubstance;
                    entity.BaseSubstanceQuantity = value.BaseSubstanceQuantity;
                    entity.Description           = value.Description;

                    db.SaveChanges();
                    Console.WriteLine("Updated med with name {3}\t {0}:{1}:{2}", DateTime.Now.Hour.ToString(), DateTime.Now.Minute.ToString(), DateTime.Now.Second.ToString(), value.Name);
                    return(true.ToString());
                }
                catch (InvalidOperationException)
                {
                    Console.WriteLine("Failed! There was and error!");
                    return(false.ToString());
                }
            }
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,rxName,rxNumber,rxAmount,doses,dosesLeft,fillDate,refillDate,rxPhone,email,text,acctID")] Meds meds)
        {
            if (id != meds.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meds);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MedsExists(meds.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(meds));
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Meds[] myArray = new Meds[10] {
                new Meds("Rifampicin", false, false),
                new Meds("Isoniazid", false, false),
                new Meds("Ethambutol", false, true),
                new Meds("Pyrazinamide", false, false),
                new Meds("Streptomycin", false, false),
                new Meds("Amikacin", true, false),
                new Meds("Kanamycin", false, false),
                new Meds("Capreomycin", false, false),
                new Meds("Ofloxacin", false, false),
                new Meds("Levofloxacin", false, false)
            };
            rgdTBDrugsSensitivity.DataSource = myArray;
            rgdTBDrugsSensitivity.DataBind();
            rgdTBDrugsSensitivity.Visible = true;


            rgContactRecTreatment.DataSource = myArray;
            rgContactRecTreatment.DataBind();

            //Complaints[] mycomplaints = new Complaints[5]{
            //    new Complaints("Fever", false),
            //    new Complaints("Shortness of breath", false),
            //    new Complaints("Cough", false),
            //    new Complaints("Fever 1", false),
            //    new Complaints("Fever 2", false)
            //};
            //rgComplaints.DataSource = mycomplaints;
            //rgComplaints.DataBind();
            //rgComplaints.Visible = true;
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("ID,rxName,rxNumber,rxAmount,doses,dosesLeft,fillDate,refillDate,rxPhone,email,text,acctID")] Meds meds)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meds);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(meds));
        }
Пример #5
0
        public PatientMedicalRecordTO(IndexedHashtable ihs)
        {
            initCollections();

            if (ihs == null || ihs.Count == 0)
            {
                return;
            }

            for (int i = 0; i < ihs.Count; i++)
            {
                object key = ihs.GetKey(i);

                if (!(key is string))
                {
                    continue;
                }

                string sitecode = key as string;

                if (!(ihs.GetValue(i) is Hashtable))
                {
                    continue;
                }

                Hashtable domains = ihs.GetValue(i) as Hashtable;

                Meds.add(sitecode, domains["meds"] as IList <Medication>);
                Patient = new PatientTO(domains["demographics"] as Patient);
                Allergies.add(sitecode, domains["reactions"] as IList <Allergy>);
                Notes.add(sitecode, domains["documents"] as IList <Note>);
                Problems.add(sitecode, domains["problems"] as IList <Problem>);
                Appointments.add(sitecode, domains["appointments"] as IList <Appointment>);
                ChemHemReports.add(sitecode, domains["labs"] as IList <LabReport>);

                IList <HealthSummary> healthSummaries = domains["healthFactors"] as IList <HealthSummary>;



                // TODO - implement the remaining hashtable keys
                //results.Add("healthFactors", healthSummaries);
                //results.Add("flags", flags);
                //results.Add("consults", consults);
                //results.Add("procedures", null);
                //results.Add("visits", visits);
                //results.Add("appointments", appointments);
                //results.Add("problems", problems);
                //results.Add("vitals", vitals);
                //results.Add("labs", labs);
                //results.Add("immunizations", null);
            }
        }
Пример #6
0
        public string Post([FromBody] Meds value)
        {
            using (db)
            {
                try
                {
                    db.Meds.Add(value);

                    db.SaveChanges();
                    Console.WriteLine("Added med with name {3}\t {0}:{1}:{2}", DateTime.Now.Hour.ToString(), DateTime.Now.Minute.ToString(), DateTime.Now.Second.ToString(), value.Name);
                    return(true.ToString());
                }
                catch (InvalidOperationException)
                {
                    Console.WriteLine("Failed! There was and error!");
                    return(false.ToString());
                }
            }
        }
Пример #7
0
        private void createRooms()
        {
            // create the rooms
            Room b3      = new Room("B3. at a local junkyard.", 0);
            Meds bandage = new Meds("bandage", "stops the bleeding", 2, 1.0f);
            Key  b3key   = new Key("greenkey", "A greenkeycard to open low tier doors", 2, 5.0f, 1);

            b3.GetInventory().AddItem(bandage);
            b3.GetInventory().AddItem(b3key);
            Room c2    = new Room("C2. at Sewer branch.", 1);
            Key  c2key = new Key("bluekey", "A blue keycard to open mid tier doors", 2, 5.0f, 3);

            c2.GetInventory().AddItem(c2key);
            c2.LockRoom();
            Room underc2 = new Room("C2 Basement. under Sewer branch.", 2);

            underc2.LockRoom();
            Room c3 = new Room("C3. at Launchsite.", 3);

            c3.LockRoom();
            Room c4    = new Room("C4. at the trainyard.", 2);
            Key  c4key = new Key("redkey", "A red keycard to open high tier doors", 2, 5.0f, 4);

            c4.GetInventory().AddItem(c4key);
            c4.LockRoom();
            Room d3    = new Room("D3. at the military tunnels.", 3);
            Key  d3key = new Key("masterkey", "A master keycard to open all doors", 999, 15.0f, 5);

            d3.GetInventory().AddItem(d3key);
            d3.LockRoom();
            Room b2    = new Room("B2. at a local spermket.", 0);
            Key  b2key = new Key("greenkey", "A greenkeycard to open low tier doors", 2, 5.0f, 1);

            b2.GetInventory().AddItem(b2key);
            Room b4    = new Room("B4. at a local gas station.", 0);
            Key  b4key = new Key("greenkey", "A greenkeycard to open low tier doors", 2, 5.0f, 1);

            b4.GetInventory().AddItem(b4key);
            Room d4    = new Room("D4. at a local spermket.", 0);
            Key  d4key = new Key("greenkey", "A greenkeycard to open low tier doors", 2, 5.0f, 1);

            d4.GetInventory().AddItem(d4key);
            Room d2    = new Room("D2. at a local gas station.", 0);
            Key  d2key = new Key("greenkey", "A greenkeycard to open low tier doors", 2, 5.0f, 1);

            d2.GetInventory().AddItem(d2key);


            Room a1 = new Room("A1. the beach. the spawn place for all nakeds.", 0);
            Room a2 = new Room("A2. the beach. the spawn place for all nakeds.", 0);
            Room a3 = new Room("A3. the beach. the spawn place for all nakeds.", 0);
            Room a4 = new Room("A4. the beach. the spawn place for all nakeds.", 0);
            Room a5 = new Room("A5. the beach. the spawn place for all nakeds.", 0);
            Room b1 = new Room("B1. the beach. the spawn place for all nakeds.", 0);
            Room b5 = new Room("B5. the beach. the spawn place for all nakeds.", 0);
            Room c1 = new Room("C1. the beach. the spawn place for all nakeds.", 0);
            Room c5 = new Room("C5. the beach. the spawn place for all nakeds.", 0);
            Room d1 = new Room("D1. the beach. the spawn place for all nakeds.", 0);
            Room d5 = new Room("D5. the beach. the spawn place for all nakeds.", 0);
            Room e1 = new Room("E1. the beach. the spawn place for all nakeds.", 0);
            Room e2 = new Room("E2. the beach. the spawn place for all nakeds.", 0);
            Room e3 = new Room("E3. the beach. the spawn place for all nakeds.", 0);
            Room e4 = new Room("E4. the beach. the spawn place for all nakeds.", 0);
            Room e5 = new Room("E5. the beach. the spawn place for all nakeds.", 0);

            //layer 1
            a1.setExit("east", b1);
            a1.setExit("south", a2);

            b1.setExit("south", b2);
            b1.setExit("east", c1);
            b1.setExit("west", a1);

            c1.setExit("south", c2);
            c1.setExit("east", d1);
            c1.setExit("west", e1);

            d1.setExit("south", d2);
            d1.setExit("east", e1);
            d1.setExit("west", c1);

            e1.setExit("west", b1);
            e1.setExit("south", e2);

            //layer 2
            a2.setExit("east", b2);
            a2.setExit("south", a3);
            a2.setExit("north", a1);

            b2.setExit("south", b3);
            b2.setExit("north", b1);
            b2.setExit("east", c2);
            b2.setExit("west", a2);

            c2.setExit("south", c3);
            c2.setExit("north", c1);
            c2.setExit("east", d2);
            c2.setExit("west", b2);
            c2.setExit("down", underc2);

            underc2.setExit("up", c2);

            d2.setExit("north", d1);
            d2.setExit("south", d3);
            d2.setExit("east", e2);
            d2.setExit("west", c2);

            e2.setExit("west", d2);
            e2.setExit("south", e3);
            e2.setExit("north", e1);

            //layer 3
            a3.setExit("east", b3);
            a3.setExit("south", a4);
            a3.setExit("north", a2);

            b3.setExit("south", b4);
            b3.setExit("north", b2);
            b3.setExit("east", c3);
            b3.setExit("west", a3);

            c3.setExit("south", c4);
            c3.setExit("north", c2);
            c3.setExit("east", d3);
            c3.setExit("west", b3);
            Room portalexit = new Room("space. the universe is all u see. the place where you will die.", 0);

            c3.setExit("portal", portalexit);
            Room empty = new Room("quit", 0);

            portalexit.setExit("quit", empty);

            d3.setExit("north", d2);
            d3.setExit("south", d4);
            d3.setExit("east", e3);
            d3.setExit("west", c3);

            e3.setExit("west", d3);
            e3.setExit("south", e4);
            e3.setExit("north", e2);

            //layer 4
            a4.setExit("east", b4);
            a4.setExit("south", a5);
            a4.setExit("north", a4);

            b4.setExit("south", b5);
            b4.setExit("north", b5);
            b4.setExit("east", c4);
            b4.setExit("west", a4);

            c4.setExit("south", c5);
            c4.setExit("north", c3);
            c4.setExit("east", d4);
            c4.setExit("west", b4);

            d4.setExit("north", d3);
            d4.setExit("south", d5);
            d4.setExit("east", e4);
            d4.setExit("west", c4);

            e4.setExit("west", d4);
            e4.setExit("south", e5);
            e4.setExit("north", e3);

            //layer 5
            a5.setExit("east", b5);
            a5.setExit("north", a4);

            b5.setExit("north", b4);
            b5.setExit("east", c5);
            b5.setExit("west", a5);

            c5.setExit("north", c4);
            c5.setExit("east", d5);
            c5.setExit("west", e5);

            d5.setExit("north", d4);
            d5.setExit("east", e5);
            d5.setExit("west", c5);

            e5.setExit("west", b5);
            e5.setExit("north", e4);

            player.SetCurrentRoom(a1);  // start game at beach
        }
Пример #8
0
 
        // create the notification
 public async void SaveAlarm()
 {
     //First remove all previous notifications
            UIApplication.SharedApplication.CancelAllLocalNotifications();

            //initialize variables. Counts the number of compartments with alarms set at that time
            List<int> wake = new List<int>();
            List<int> breakfast = new List<int>();
            List<int> lunch = new List<int>();
            List<int> dinner = new List<int>();
            List<int> sleep = new List<int>();

            Alarms alarmtime = await App.AlarmsDB.GetAlarmsAsync();

            //Check if any compartment has switch activated for alarm at specific times
            for (int i = 0; i < 4; i++)
            {
                Meds meds = await App.Database.GetMedsAsync(i);
                if (meds.Wake == true)
                {
                    wake.Add(i);
                }
                if (meds.Breakfast == true)
                {
                    breakfast.Add(i);
                }
                if (meds.Lunch == true)
                {
                    lunch.Add(i);
                }
                if (meds.Dinner == true)
                {
                    dinner.Add(i);
                }
                if (meds.Sleep == true)
                {
                    sleep.Add(i);
                }

            }

            //Set alarm to go off at particular times 
            if (wake.Count != 0)
            {
                SetNotification(alarmtime.WakeTime, wake);
            }
            if (breakfast.Count != 0)
            {
                SetNotification(alarmtime.BreakfastTime, breakfast);
            }
            if (lunch.Count != 0)
            {
                SetNotification(alarmtime.LunchTime, lunch);
            }
            if (dinner.Count != 0)
            {
                SetNotification(alarmtime.DinnerTime, dinner);
            }
            if (sleep.Count != 0)
            {
                SetNotification(alarmtime.SleepTime, sleep);
            }
           
 }

        public void SetNotification(TimeSpan alarmtime, List<int> bins)
        {
            string binz = string.Join(";", bins);


            //var notification = new UNNotificationRequest();
            //DateTime.Today;
            var notification = new UILocalNotification();
            //TimeSpan ts = new TimeSpan(1, 0, 0, 0, 0);

            //Change alarmtime to DateTime type
            DateTime notificationtime = DateTime.Today;
            notificationtime = notificationtime + alarmtime;
            if (notificationtime < DateTime.Now)
            {
                notificationtime = notificationtime + TimeSpan.FromDays(1);
            }

            System.Diagnostics.Debug.WriteLine("Notification Time is: " + notificationtime);

            //Create a new dose in Adhere database
            Adhere newdose = new Adhere();
            newdose.DoseDateTime = notificationtime;
            newdose.DoseTaken = false;

            int doseBins = 0;
            foreach (int i in bins)
            {
                System.Diagnostics.Debug.WriteLine("i = " + i);
                int j = i + 1;
                doseBins = doseBins + (j*j);
            }
            System.Diagnostics.Debug.WriteLine("doseBins = " + doseBins);
            newdose.DoseBins = doseBins;
            App.AdhereDB.SaveAdhereAsync(newdose);

            //Change newly created DateTime to NSDate type
            notificationtime = DateTime.SpecifyKind(notificationtime, DateTimeKind.Local);
            NSDate nsdate = new NSDate();
            nsdate = (NSDate)notificationtime;

            // set the fire date (the date time in which it will fire)
            notification.FireDate = nsdate;

            //UNCOMMENT THIS LINE TO REPEAT DAILY. COMMENTED OUT FOR DEV PUPOSES ONLY
            //notification.RepeatInterval = NSCalendarUnit.Day;

            // configure the alert
            notification.AlertAction = "View Alert";
            notification.AlertBody = "It is time to take your medication!";

            // modify the badge
            notification.ApplicationIconBadgeNumber = 1;

            // set the sound to be the default sound
            notification.SoundName = UILocalNotification.DefaultSoundName;

            notification.UserInfo = NSDictionary.FromObjectAndKey(new NSString(binz), new NSString("TaskID"));
            System.Diagnostics.Debug.WriteLine(notification.UserInfo);
            //notification.UserInfo = binz;
            //NSDictionary bin = binz;
            // schedule it
            UIApplication.SharedApplication.ScheduleLocalNotification(notification);
        }