Esempio n. 1
0
 public HistoryInfoPage(Dose dose)
 {
     InitializeComponent();
     BindingContext = dose;
     //doseQuantityLabel.Text = dose.PrescriptionTaken.Quantity.ToString();
     //doseRemainingLabel.Text = dose.PrescriptionTaken.Remaining.ToString();
     //doseTakenLabel.Text = dose.QuantityTaken.ToString();
 }
Esempio n. 2
0
 public Task <int> SaveItemAsync(Dose item)
 {
     if (item.DID != 0)
     {
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
Esempio n. 3
0
        private async void MyHistoryList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            ListView tappedItem = (ListView)sender;

            if (tappedItem.SelectedItem != null)
            {
                Dose tappedDose = (Dose)tappedItem.SelectedItem;
                //await Navigation.PushAsync(new HistoryInfoPage(tappedDose));
                await PopupNavigation.Instance.PushAsync(new HistoryInfoPage(tappedDose));

                tappedItem.SelectedItem = null;
            }
        }
Esempio n. 4
0
        private async void AddToHistory_Clicked(object sender, EventArgs e)
        {
            //int difference = p2.Remaining - (int)DosageStepper.Value;
            //remainingLabel.Text = difference.ToString();
            if (p_copy.Remaining - (double)DosageStepper.Value < 0)
            {
                await DisplayAlert("Error:", "Not enough to take dosage!", "OK");
            }
            else
            {
                p_copy.Remaining -= (double)DosageStepper.Value;

                remainingLabel.Text = p_copy.Remaining.ToString();

                //update prescription with correct remaining value
                await App.MyPrescriptionDatabase.SaveItemAsync(p_copy);

                Dose d1 = new Dose
                {
                    //should not need to copy over pid, since we want
                    Name                = p_copy.Name,
                    ProperName          = p_copy.ProperName,
                    Strength            = p_copy.Strength,
                    StrengthUnits       = p_copy.StrengthUnits,
                    Instructions        = p_copy.Instructions,
                    PrescribedDosage    = p_copy.PrescribedDosage,
                    PhysicalDescription = p_copy.PhysicalDescription,
                    Quantity            = p_copy.Quantity,
                    Remaining           = p_copy.Remaining,
                    DateTimeTaken       = myDatePicker.Date + myTimePicker.Time,
                    QuantityTaken       = (double)DosageStepper.Value
                };

                //d1.PrescriptionTaken.Remaining -= d1.QuantityTaken;
                await App.MyDoseDatabase.SaveItemAsync(d1);

                App.MyHistory.Add(d1);

                Analytics.TrackEvent("Successfully added dose");

                await DisplayAlert("Added to History:", "Taken " + " (" + d1.QuantityTaken + ") " + d1.ProperName + " " + d1.Strength + d1.StrengthUnits + " at " + d1.DateTimeTaken.ToString(), "OK");

                await Navigation.PopAsync();
            }
        }
Esempio n. 5
0
 public Task <int> DeleteItemAsync(Dose item)
 {
     return(database.DeleteAsync(item));
 }