Beispiel #1
0
 private async void saveButton_Click(object sender, RoutedEventArgs e)
 {
     purchase.PurchaseDate = PurchaseDate.SelectedDate.Value;
     purchase.SupplierName = SupplierName.SelectedItem.ToString();
     purchase.InvoiceID    = PurchaseInvoiceID.Text;
     purchase.TotalPrice   = Convert.ToInt32(TotalPurchasePrice.Text);
     purchase.TotalItems   = Convert.ToInt32(TotalPurchaseItems.Text);
     handleDatabase.executePurchaseMaster(purchase);
     try
     {
         int affectedLines = 0;
         affectedLines  = handleDatabase.executePurchaseDetails(dt);
         affectedLines += handleDatabase.updatePurchaseStockDetails(dt, purchase);
         if (affectedLines > 0)
         {
             await this.ShowMessageAsync("Successfull", "New Purchase have been Successfully Entered", MessageDialogStyle.Affirmative);
         }
         else
         {
             await this.ShowMessageAsync("Error", "Sorry Can not add, Please Try again", MessageDialogStyle.Affirmative);
         }
     }
     catch (SqlException sqlException)
     {
         Console.WriteLine(sqlException);
     }
     dt.Clear();
     PurchaseInvoiceID.Text  = "";
     Quantity.Text           = "";
     SalePrice.Text          = "";
     PurchasePrice.Text      = "";
     TotalPurchaseItems.Text = "";
     TotalPurchasePrice.Text = "";
 }