private void LotButton_Click(object sender, RoutedEventArgs e) { try { myDataObjectLot.idLotProperty = LotDAL.getMaxIdLot() + 1; lot.Add(myDataObjectLot); LotORM.insertLot(myDataObjectLot); compteur = lot.Count(); /*listeLot.Items.Refresh();*/ myDataObjectLot = new LotViewModel(); nomTextBox.DataContext = myDataObjectLot; descriptionTextBox.DataContext = myDataObjectLot; idEnchereComboBox.DataContext = myDataObjectLot; /*idLotTextBox.DataContext = myDataObjectLot;*/ LotButton.DataContext = myDataObjectLot; } catch (Exception ex) { MessageBox.Show("A handled exception just occurred: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning); } }
void loadLots() { lp = LotORM.listeLots(); myDataObject = new LotViewModel(); //LIEN AVEC la VIEW listeLots.ItemsSource = lp; // bind de la liste avec la source, permettant le binding. }
void loadLots() { rt = LotORM.listeLots(); myDataObjectLot = new LotViewModel(); lotComboBox.ItemsSource = rt; //LIEN AVEC la VIEW }
void loadLot() { lot = LotORM.listeLot(); myDataObjectLot = new LotViewModel(); //LIEN AVEC la VIEW /*listeLot.ItemsSource = lot; // bind de la liste avec la source, permettant le binding.#1#*/ }
private void ModifyEnchere(object sender, RoutedEventArgs e) { if (InputDateHeureVente.SelectedDate != null || !string.IsNullOrEmpty(InputPrixProposer.Text)) { _enchere.PrixProposer = int.TryParse(InputPrixProposer.Text, out _) ? int.Parse(InputPrixProposer.Text) : 0; _enchere.IsAdjuger = InputIsAdjuger.IsChecked ?? false; _enchere.DateHeureVente = InputDateHeureVente.SelectedDate ?? DateTime.Now; if (_utilisateur == null) { InputOrdreAchat.Text = "ordreAchat1"; } if (string.IsNullOrEmpty(InputLotId.Text)) { InputLotId.Text = "lot1"; } if (string.IsNullOrEmpty(InputCommissaireId.Text)) { InputCommissaireId.Text = "commissaire1"; } // Donc ça c'est bon if (!string.IsNullOrEmpty(InputOrdreAchat.Text)) { _enchere.OrdreAchatEnchere = OrdreAchatORM.GetOrdreAchatById(InputOrdreAchat.Text); } if (!string.IsNullOrEmpty(InputLotId.Text)) { _enchere.LotEnchere = LotORM.GetLotById(InputLotId.Text); } if (!string.IsNullOrEmpty(InputCommissaireId.Text)) { _enchere.CommissaireEnchere = CommissaireORM.GetCommissaireById(InputCommissaireId.Text); } _enchere.UtilisateurEnchere = _utilisateur; EnchereORM.UpadateEnchere(_enchere); _win.Close(); } else { MessageBox.Show("Veuillez compléter tout les champs !"); } }
private void supprimerLot(object sender, RoutedEventArgs e) { if (listeLots.SelectedItem is LotViewModel) { LotViewModel toRemove = (LotViewModel)listeLots.SelectedItem; lp.Remove(toRemove); listeLots.Items.Refresh(); LotORM.supprimerLot(selectedLotsId); } }
private void Btn_Sppr(object sender, RoutedEventArgs e) { if (List_Lot.SelectedItem is LotViewModel) { LotViewModel toRemove = (LotViewModel)List_Lot.SelectedItem; lp.Remove(toRemove); List_Lot.Items.Refresh(); LotORM.supprimerLot(selectedLotId); } }
private void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); this.PropertyChanged(this, new PropertyChangedEventArgs(info)); LotORM.updateLot(this); } }
private void btnAjouter(object sender, RoutedEventArgs e) { myDataObject.id = LotDAL.getMaxIdLot() + 1; lp.Add(myDataObject); LotORM.insertLot(myDataObject); compteur = lp.Count(); // Comme on a inséré une Lot, on crée un nouvel objet LotViewModel // Et on réatache tout ce qu'il faut pour que la vue soit propre myDataObject = new LotViewModel(); // Comme le contexte des élément de la vue est encore l'ancien LotViewModel, // On refait les liens entre age, slider, textbox, bouton et le nouveau LotViewModel ComboBoxEnchere.DataContext = myDataObject; description.DataContext = myDataObject; }
void loadLots() { lp = LotORM.listeLots(); myDataObject = new LotViewModel(); //LIEN AVEC la VIEW }