コード例 #1
0
ファイル: MappeurAvion.cs プロジェクト: Franck420/Epatair
 //Fonction pour mapper a partir d'un sqlDataReader
 public void Map(SqlDataReader source, AvionDTO cible)
 {
     cible.IdAvion   = (int)source["IdAvion"];
     cible.Nom       = (string)source["Nom"];
     cible.IdLogbook = (int)source["IdLogbook"];
     cible.Tarif     = (double)source["Tarif"];
 }
コード例 #2
0
ファイル: MappeurAvion.cs プロジェクト: Franck420/Epatair
 //Fonction pour mapper a partir des informations entrées
 public void Map(int IdAvion, string Nom, int IdLogbook, AvionDTO cible, double tarif)
 {
     cible.IdAvion   = IdAvion;
     cible.Nom       = Nom;
     cible.IdLogbook = IdLogbook;
     cible.Tarif     = tarif;
 }
コード例 #3
0
        //Fonction pour remplir le ListView
        private ListViewItem GetListViewAvion(AvionDTO Avion)
        {
            ListViewItem item = new ListViewItem(Avion.IdAvion.ToString());

            item.SubItems.Add(Avion.Nom);
            item.SubItems.Add(Avion.IdLogbook.ToString());
            return(item);
        }
コード例 #4
0
ファイル: FrmModifierAvion.cs プロジェクト: Franck420/Epatair
 public FrmModifierAvion(GestionAvion gestionAvion, AvionDTO Avion)
 {
     gestionAvions = gestionAvion;
     InitializeComponent();
     txtIdAvion.Text   = Avion.IdAvion.ToString();
     txtNom.Text       = Avion.Nom;
     txtIdLogbook.Text = Avion.IdLogbook.ToString();
     txtTarif.Text     = Avion.Tarif.ToString("C");
 }
コード例 #5
0
ファイル: RepositoryAvion.cs プロジェクト: Franck420/Epatair
        //Fonction pour modifier un avion
        public void ModifierAvion(AvionDTO Avion)
        {
            using (SqlConnection connexion = new SqlConnection(ChaineConnexion))
            {
                SqlCommand commande = new SqlCommand("update Tbl_Avion set Nom = @Nom, IdLogbook = @IdLogbook, Tarif = @Tarif where IdAvion = @IdAvion", connexion);

                commande.Parameters.AddWithValue("@IdAvion", Avion.IdAvion);
                commande.Parameters.AddWithValue("@Nom", Avion.Nom);
                commande.Parameters.AddWithValue("@IdLogbook", Avion.IdLogbook);
                commande.Parameters.AddWithValue("@Tarif", Avion.Tarif);
                connexion.Open();
                commande.ExecuteNonQuery();
            }
        }
コード例 #6
0
        //Fonction pour créer une nouvelle facture
        public double NouvelleFacture(AvionDTO avion, PiloteDTO instruteur, PiloteDTO pilote, DateTime HeureDemarrage, DateTime HeureArret, DateTime HeureAtterissage, DateTime HeureDecolage, double TarifAvion)
        {
            double HeuredeVol, HeureSol;

            HeuredeVol = calculertempsVol(HeureDecolage, HeureAtterissage);
            HeureSol   = calculertempssol(HeureDemarrage, HeureDecolage, HeureAtterissage, HeureArret);

            Mappeur.MappeurFacture mappeur = new Mappeur.MappeurFacture();
            facture = mappeur.Map(avion, instruteur, pilote, HeuredeVol, HeureSol, HeureDemarrage, HeureArret, HeureAtterissage, HeureDecolage, tarifHrVol, tarifHrSol, facture);


            RepositoryFacture.NouvelleFacture(facture);

            return(calculertotalFacture(facture, TarifAvion));
        }
コード例 #7
0
ファイル: MappeurFacture.cs プロジェクト: Franck420/Epatair
        //Fonction pour mapper a partir des informations de la facture
        public FactureDto  Map(AvionDTO avion, PiloteDTO instruteur, PiloteDTO pilote, double HeuredeVol, double HeureSol, DateTime HeureDemarrage, DateTime HeureArret, DateTime HeureAtterissage, DateTime HeureDecolage, double tarifHrVol, double tarifHrSol, FactureDto cible)
        {
            cible.HrVol      = HeuredeVol;
            cible.HrSol      = HeureSol;
            cible.TarifHrVol = tarifHrVol;
            cible.TarifHrSol = tarifHrSol;

            cible.avion       = avion.IdAvion;
            cible.Instructeur = instruteur.IdPilote;
            cible.Pilote      = pilote.IdPilote;

            cible.HrDemarrage   = HeureDemarrage;
            cible.HrDecollage   = HeureDecolage;
            cible.HrArret       = HeureArret;
            cible.HrAtterissage = HeureAtterissage;

            return(cible);
        }
コード例 #8
0
ファイル: RepositoryAvion.cs プロジェクト: Franck420/Epatair
        //Fonction pour aller chercher un avion avec son ID
        public AvionDTO GetAvion(int IdAvion)
        {
            using (SqlConnection connexion = new SqlConnection(ChaineConnexion))
            {
                SqlCommand commande = new SqlCommand("select * from Tbl_Avion where IdAvion=@IdAvion", connexion);
                commande.Parameters.AddWithValue("@IdAvion", IdAvion);
                connexion.Open();

                using (SqlDataReader reader = commande.ExecuteReader())
                    if (reader.Read())
                    {
                        var dto = new AvionDTO();
                        mapper.Map(reader, dto);
                        return(dto);
                    }
                    else
                    {
                        return(null);
                    }
            }
        }
コード例 #9
0
ファイル: RepositoryAvion.cs プロジェクト: Franck420/Epatair
        //fonctions pour aller chercher et retourner la liste des avions
        public List <AvionDTO> GetListeAvion()
        {
            var listeAvion = new List <AvionDTO>();

            using (SqlConnection connexion = new SqlConnection(ChaineConnexion))
            {
                SqlCommand commande = new SqlCommand("select * from Tbl_Avion", connexion);
                connexion.Open();

                using (SqlDataReader reader = commande.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var dto = new AvionDTO();
                        mapper.Map(reader, dto);
                        listeAvion.Add(dto);
                    }
                }
                return(listeAvion);
            }
        }
コード例 #10
0
 private void btnModifier_Click(object sender, EventArgs e)
 {
     if (int.TryParse(txtModifier.Text, out int Id))
     {
         foreach (var Avion in ListeAvions)
         {
             if (Avion.IdAvion == Id)
             {
                 avionDTO = Avion;
                 break;
             }
         }
         Form ModifierAvion = new FrmModifierAvion(gestionAvions, avionDTO);
         ModifierAvion.ShowDialog();
         lstViewAvion.Items.Clear();
         RemplirListe();
         txtModifier.Clear();
     }
     else
     {
         MessageBox.Show("Veuillez entrez un Id valide svp");
     }
 }