Пример #1
0
        public DetailVol(int Id)
        {
            InitializeComponent();

            Vol_Controller vol = Vol_Model.ExistingVols.Find(v => v.IdProperty == Id);

            //Dictionary<string, string> dicString = Vol_Model.GetInfosString(Id);
            //Dictionary<string, int> dicInt = Vol_Model.GetInfosInt(Id);

            //Vol_Controller vol = new Vol_Controller(dicInt["idvol"], Avion_Model.CheckExistsThenAdd(dicInt["idavion"]),
            //    Aeroport_Model.CheckExistsThenAdd(dicString["adepart"]),
            //    Aeroport_Model.CheckExistsThenAdd(dicString["aarrivee"]),
            //    dicString["date"].ToString(),
            //    dicString["heuredepart"].ToString(),
            //    dicString["heurearrivee"].ToString());
            //Console.WriteLine(dicString["adepart"]);
            this.Title = Id.ToString();

            ADepart.Text      = vol.ADepartProperty.NomProperty;
            AArrivee.Text     = vol.AArriveeProperty.NomProperty;
            HeureArrivee.Text = vol.HeureArriveeProperty;
            HeureDepart.Text  = vol.HeureDepartProperty;
            Date.Text         = vol.DateProperty;
            Avion.Text        = vol.AvionProperty.ModeleProperty.LabelProperty;
            VolNum.Text       = vol.IdProperty.ToString();

            this.DataContext = this;
            Modif.Tag        = Id;
        }
Пример #2
0
        public ModifVol(int Id)
        {
            InitializeComponent();
            Vol_Controller          vol    = Vol_Model.ExistingVols.Find(v => v.IdProperty == Id);
            List <Avion_Controller> myList = Avion_Model.ExistingAvions.Where(x => x.MaintenanceProperty == false && x.EnVolProperty == false).ToList();

            ADepart.ItemsSource   = Aeroport_Model.ExistingAeroports;
            ADepart.SelectedIndex = Aeroport_Model.ExistingAeroports.FindIndex(a => a.IdProperty == vol.ADepartProperty.IdProperty);
            ADepart.Text          = Aeroport_Model.ExistingAeroports.Find(a => a.IdProperty == vol.ADepartProperty.IdProperty).NomProperty;

            AArrivee.ItemsSource   = Aeroport_Model.ExistingAeroports;
            AArrivee.SelectedIndex = Aeroport_Model.ExistingAeroports.FindIndex(a => a.IdProperty == vol.AArriveeProperty.IdProperty);
            AArrivee.Text          = Aeroport_Model.ExistingAeroports.Find(a => a.IdProperty == vol.AArriveeProperty.IdProperty).NomProperty;

            Avion.ItemsSource   = myList;
            Avion.SelectedIndex = Avion_Model.ExistingAvions.FindIndex(av => av.IdProperty == vol.AvionProperty.IdProperty);
            Avion.Text          = Avion_Model.ExistingAvions.Find(av => av.IdProperty == vol.AvionProperty.IdProperty).ModeleProperty.LabelProperty;

            HDepart.Value = DateTime.Parse(vol.HeureDepartProperty);

            HArrivee.Value    = DateTime.Parse(vol.HeureArriveeProperty);
            Date.SelectedDate = DateTime.Parse(vol.DateProperty);

            System.Windows.Forms.DateTimePicker dtp = new System.Windows.Forms.DateTimePicker();
            DateTime dt = DateTime.Now;

            this.Title = Id.ToString();
        }
Пример #3
0
        private void DeleteVol(object sender, RoutedEventArgs e)
        {
            if (System.Windows.Forms.MessageBox.Show("Confirmer la suppression de ce vol ?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                     MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                Vol_Controller.DeleteVol(Convert.ToInt32(this.Title));

                System.Windows.MessageBox.Show("Vol supprimé avec succès");
                this.Close();
            }
        }
Пример #4
0
 public static void GetExistingVols()
 {
     using (MySqlConnection c = BddSQL.InitConnexion())
     {
         MySqlCommand command = c.CreateCommand();
         command.CommandText = "SELECT * FROM vols";
         using (MySqlDataReader dr = command.ExecuteReader())
         {
             DataTable table = new DataTable();
             table.Load(dr);
             foreach (DataRow row in table.Rows)
             {
                 if (!ExistingVols.Any(vol => vol.IdProperty == Convert.ToInt32(row["idvol"])))
                 {
                     Vol_Controller v = new Vol_Controller(Convert.ToInt32(row["idvol"]), Avion_Model.CheckExistsThenAdd(Convert.ToInt32(row["avion"])), Aeroport_Model.CheckExistsThenAdd(row["adepart"].ToString()), Aeroport_Model.CheckExistsThenAdd(row["aarrivee"].ToString()), row["datedepart"].ToString(), row["heuredepart"].ToString(), row["heurearrivee"].ToString());
                     v.HeaderProperty = GetHeader(v);
                     ExistingVols.Add(v);
                 }
             }
         }
     }
 }
Пример #5
0
        static public string GetHeader(Vol_Controller vol)
        {
            string header = vol.ADepartProperty.IdProperty + " - " + vol.AArriveeProperty.IdProperty + "  " + vol.DateProperty;

            return(header);
        }