예제 #1
0
 public void DeleteWeighingEntry(Weighing selectedWeighing)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.Delete(selectedWeighing);
     }
 }
        private async void AcceptButton_Click(object sender, RoutedEventArgs e)
        {
            Weighing myWeighing = new Weighing();

            myWeighing.WeighingDate = pckDate.Date.Date;

            if (!String.IsNullOrEmpty(txtWeight.Text))
            {
                myWeighing.Weight = Convert.ToDecimal(txtWeight.Text.Replace(',','.'));

                if (!String.IsNullOrEmpty(txtFat.Text))
                {
                    myWeighing.FatPercentage = Convert.ToDecimal(txtFat.Text.Replace(',','.'));
                }

                WeightDAO _dao = new WeightDAO();
                _dao.CreateWeighingEntry(myWeighing);

                Frame.GoBack();
            }
            else
            {
                MessageDialog msgbox = new MessageDialog("No weight entered.");
                await msgbox.ShowAsync();
            }
        }
예제 #3
0
 public void CreateWeighingEntry(Weighing myWeighing)
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.Insert(myWeighing);
     }
 }