Ejemplo n.º 1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (Content)
     {
         App.Database.EraseContent(drug.ID);
         foreach (Ingredient i in list.SelectedItems)
         {
             DrugContent d = new DrugContent();
             d.drugID    = drug.ID;
             d.contentID = i.ID;
             App.Database.SaveDrugContentAsync(d);
         }
         frame.Navigate(new NewDrug(frame, drug));
     }
     else
     {
         App.Database.EraseAllergy(customer.ID);
         foreach (Ingredient i in list.SelectedItems)
         {
             CustomerAllergy d = new CustomerAllergy();
             d.AllergyID  = i.ID;
             d.CustomerID = customer.ID;
             App.Database.AllergySave(d);
         }
         frame.Navigate(new NewPatient(frame, customer));
     }
 }
Ejemplo n.º 2
0
 public Task <int> SaveDrugContentAsync(DrugContent item)
 {
     if (item.ID != 0)
     {
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
Ejemplo n.º 3
0
 public Task <int> DrugIngredientSave(DrugContent item)
 {
     {
         if (item.ID != 0)
         {
             return(database.UpdateAsync(item));
         }
         else
         {
             return(database.InsertAsync(item));
         }
     }
 }
Ejemplo n.º 4
0
        private async void GetId(Drug d)
        {
            long lastIdLong = await App.Database.GetLastID();

            int lastId = (Int32)lastIdLong;

            MessageBox.Show(lastId.ToString());

            DrugContent c = new DrugContent();

            c.drugID    = d.ID;
            c.contentID = lastId;
            await App.Database.DrugIngredientSave(c);
        }