private void DataGridBonProd_MouseUp(object sender, MouseButtonEventArgs e) { object item = DataGridBonProd.SelectedItem; try { TBId.Text = (DataGridBonProd.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; if (!TBIdBon.Text.Equals("") && (BonProductionC.IdExiste(Int16.Parse(TBIdBon.Text)) > 0)) { BonProduction bonTemp = BonProductionC.GetAllFactures(Int16.Parse(TBIdBon.Text)); TBIdArticle.Text = bonTemp.IDARTICLE + ""; TBNbArticle.Text = bonTemp.NBARTICLE + ""; TBDateDepart.Text = bonTemp.DATEDEPART + ""; TBCout.Text = bonTemp.COUT + ""; TBIdBon.Text = (DataGridBonProd.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; listeClasseurProduit = ClasseurProduitC.GetAllClasseur("idFactureProduction", TBIdBon.Text); LoadAllProduitTemp(); } else { Afficher_Msg_Erreur("Veuillez saisir un identifiant valide"); } } catch (Exception exp) { } }
private void TBIdClient_KeyUp(object sender, KeyEventArgs e) { TextBox textBox = sender as TextBox; Int32 selectionStart = textBox.SelectionStart; Int32 selectionLength = textBox.SelectionLength; String newText = String.Empty; int count = 0; foreach (Char c in textBox.Text.ToCharArray()) { if (Char.IsDigit(c) || Char.IsControl(c) || (c == '.' && count == 0)) { newText += c; if (c == '.') { count += 1; } } } TBIdBon.Text = newText; if (!TBIdBon.Text.Equals("") && (BonProductionC.IdExiste(Int16.Parse(TBIdBon.Text)) > 0)) { BonProduction bonTemp = BonProductionC.GetAllFactures(Int16.Parse(TBIdBon.Text)); TBIdArticle.Text = bonTemp.IDARTICLE + ""; TBNbArticle.Text = bonTemp.NBARTICLE + ""; TBDateDepart.Text = bonTemp.DATEDEPART + ""; TBCout.Text = bonTemp.COUT + ""; listeClasseurProduit = ClasseurProduitC.GetAllClasseur("idFactureProduction", TBIdBon.Text); LoadAllProduitTemp(); } else { Afficher_Msg_Erreur("Veuillez saisir un identifiant valide"); } }