private void btnConfirmer_Click(object sender, RoutedEventArgs e) { RadioButton btnChecked = wrapMontant.Children.OfType<RadioButton>().FirstOrDefault(r => r.IsChecked == true); int valeurRadio; string stringContent = btnChecked.Content.ToString(); bool IsInt = int.TryParse(stringContent.Remove(stringContent.Length - 1), out valeurRadio); if (IsInt) { valeurDon = valeurRadio; MontreLabelErreur(); if (isNomGood && isNoCarteGood && isExpirationGood && isCSCGood) { Transaction transaction = new Transaction(txtProprietaire.Text, valeurDon, modePaiement); if (String.IsNullOrWhiteSpace(App.MembreCourant.NomUtilisateur)) donService.Insert(transaction); else donService.Insert(App.MembreCourant, transaction); VideChamps(); (new FenetreRecuDon(transaction)).ShowDialog(); } else SystemSounds.Beep.Play(); } }
public FenetreRecuDon(Transaction transaction) { InitializeComponent(); lblDate.Content = transaction.DateHeureTransaction.ToString("dd/mm/yy"); lblHeure.Content = transaction.DateHeureTransaction.ToString("HH:mm"); lblModePaiement.Content = transaction.ModePaiementTransaction.ToString(); lblMontant.Content = transaction.Montant.ToString() + "$"; lblNom.Content = transaction.NomAuteur; //lblNoTransaction.Content += " " + transaction.NoTransaction.ToString(); imgQrCode.Source = QrCodeHelper.getQrBitmap(transaction.ToString()); }
public void Insert(Transaction don) { try { connexion = new MySqlConnexion(); string requete = string.Format("INSERT INTO Dons (idModePaiement, nom, montant, noTransaction) VALUES ( (SELECT idModePaiement FROM ModesPaiement WHERE nom = '{0}'), '{1}', {2}, '{3}')", don.ModePaiementTransaction, don.NomAuteur, don.Montant, don.NoTransaction); connexion.Query(requete); } catch (MySqlException) { throw; } }
public void Insert(Membre membre, Transaction transaction) { Insert(transaction); try { connexion = new MySqlConnexion(); string requete = string.Format("INSERT INTO DonsMembres (idMembre, idDon) VALUES ( (SELECT idMembre FROM Membres WHERE nomUtilisateur = '{0}'), (SELECT idDon FROM Dons WHERE noTransaction = '{1}')) ", membre.NomUtilisateur, transaction.NoTransaction); connexion.Query(requete); } catch (MySqlException) { throw; } }