public Contrat(int n, double mtb, double mtn, bool d, bool f, int e, Pigiste p, Magazine m) { _numContrat = n; _lettreAccordContrat = "1m2p-la-" + m.NumMagazine + "-" + p.NumPigiste; _montantBrutContrat = mtb; _montantNetContrat = mtn; _declarationAgessaContrat = d; _factureContrat = f; _etatContrat = e; _pigisteContrat = p; _magazineContrat = m; }
public Contrat(int n, string la, double mtb, double mtn, bool d, bool f, int e, Pigiste p, Magazine m) { _numContrat = n; _lettreAccordContrat = la; _montantBrutContrat = mtb; _montantNetContrat = mtn; _declarationAgessaContrat = d; _factureContrat = f; _etatContrat = e; _pigisteContrat = p; _magazineContrat = m; }
public static List <Contrat> SelectContrat() { //Select statement string query = "SELECT * FROM Collaboration"; //Create a list to store the result List <Contrat> dbContrat = new List <Contrat>(); List <Pigiste> dbPigiste = SelectPigiste(); List <Magazine> dbMagazine = SelectMagazine(); //Ouverture connection if (bdd.OpenConnection() == true) { //Creation Command MySQL MySqlCommand cmd = new MySqlCommand(query, connection); //Création d'un DataReader et execution de la commande MySqlDataReader dataReader = cmd.ExecuteReader(); //Lecture des données et stockage dans la collection while (dataReader.Read()) { Pigiste trouvepigiste = dbPigiste.Find(r => r.NumPigiste == Convert.ToInt16(dataReader["NumPigiste"])); Magazine trouveMagazine = dbMagazine.Find(r => r.NumMagzine == Convert.ToInt16(dataReader["NumMagazine"])); Contrat leContrat = new Contrat (Convert.ToInt32(dataReader["NumCollaboration"]), Convert.ToString(dataReader["LettreAccordCollaboration"]), Convert.ToInt32(dataReader["MontantCollaboration"]), Convert.ToInt32(dataReader["MontantNCollaboration"]), Convert.ToBoolean(dataReader["EtatCollaboration"]), Convert.ToBoolean(dataReader["FactureCollaboration"]), Convert.ToInt32(dataReader["AgessaCollaboration"]), trouvepigiste, trouveMagazine, Convert.ToString(dataReader["DatePaiementCollaboration"])); dbContrat.Add(leContrat); } //fermeture du Data Reader dataReader.Close(); //fermeture Connection bdd.CloseConnection(); //retour de la collection pour être affichée return(dbContrat); } else { return(dbContrat); } }
private void btnSupprimerMagazine_Click(object sender, RoutedEventArgs e) { try { Magazine SupprMag = dtgMagazine.SelectedItem as Magazine; cMagazine.Remove(SupprMag); cMagazine.Clear(); cMagazine = bdd.SelectMagazine(); dtgMagazine.ItemsSource = cMagazine; } catch (Exception) { MessageBox.Show("Erreur dans la suppréssion"); } }
private void btnAjouterMagazine_Click(object sender, RoutedEventArgs e) { try { Magazine unMagazine = new Magazine(cMagazine.Count + 1, dtpBouclageMagazine.Text, dtpParutionMagazine.Text, dtpPaiementMagazine.Text, Convert.ToInt32(txtBudgetMagazine.Text)); cMagazine.Add(unMagazine); cMagazine.Clear(); cMagazine = bdd.SelectMagazine(); dtgMagazine.ItemsSource = cMagazine; } catch (Exception) { MessageBox.Show("Erreur de saisi"); } }
private void dtgMagazine_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dtgMagazine.SelectedIndex == -1) { dtgMagazine.SelectedIndex = 0; } Magazine selectedMagzine = dtgMagazine.SelectedItem as Magazine; txtBudgetMagazine.Text = Convert.ToString(selectedMagzine.BudgetMagazine); txtNumMagazine.Text = Convert.ToString(selectedMagzine.NumMagzine); dtpBouclageMagazine.Text = Convert.ToString(selectedMagzine.DateBouclageMagazine); dtpParutionMagazine.Text = Convert.ToString(selectedMagzine.DateParutionMagazine); dtpPaiementMagazine.Text = Convert.ToString(selectedMagzine.DatePaiementMagazine); }
public static List <Magazine> SelectMagazine() { //Select statement string query = "SELECT * FROM Magazine"; //Create a list to store the result List <Magazine> dbMagazine = new List <Magazine>(); //Ouverture connection if (bdd.OpenConnection() == true) { //Creation Command MySQL MySqlCommand cmd = new MySqlCommand(query, connection); //Création d'un DataReader et execution de la commande MySqlDataReader dataReader = cmd.ExecuteReader(); //Lecture des données et stockage dans la collection while (dataReader.Read()) { Magazine leMagazine = new Magazine (Convert.ToInt32(dataReader["NumMagazine"]), Convert.ToString(dataReader["DateBouclageMagazine"]), Convert.ToString(dataReader["DateSortieMagazine"]), Convert.ToString(dataReader["DatePaiementMagazine"]), Convert.ToInt32(dataReader["BudgetMagazine"])); dbMagazine.Add(leMagazine); } //fermeture du Data Reader dataReader.Close(); //fermeture Connection bdd.CloseConnection(); //retour de la collection pour être affichée return(dbMagazine); } else { return(dbMagazine); } }
public ContratFacture(int numcon, string lettacccon, double montbrutcon, double montnetcon, bool factcon, int etatcon, Pigiste pigcon, Magazine magcon, string datepaie) : base(numcon, lettacccon, montbrutcon, montnetcon, etatcon, pigcon, magcon, datepaie) { _factureContrat = factcon; }
public ContratAgessa(int numcon, string lettacccon, double montbrutcon, double montnetcon, bool declagessacon, int etatcon, Pigiste pigcon, Magazine magcon, string datepaie) : base(numcon, lettacccon, montbrutcon, montnetcon, etatcon, pigcon, magcon, datepaie) { _declarationAgessaContrat = declagessacon; }
public static void InsertContrat(string la, double mttB, double mttN, int etat, bool fact, bool agessa, Pigiste lePigiste, Magazine leMagazine) { //Requête Insertion Contrat string query = "INSERT INTO Contrat (LettreAccordContrat, MontantBrutContrat, MontantNetContrat, EtatContrat, FactureContrat, DeclarationAgessaContrat, PigisteContrat, MagazineContrat ) VALUES('" + la + "','" + mttB + "'," + mttN + "'," + etat + "'," + fact + "'," + agessa + "'," + lePigiste + "'," + leMagazine + ")"; Console.WriteLine(query); //open connection if (bdd.OpenConnection() == true) { //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(query, connection); //Execute command cmd.ExecuteNonQuery(); //close connection bdd.CloseConnection(); } }