private void reshersher_Click(object sender, RoutedEventArgs e) { gestion_stockEntities td1 = new gestion_stockEntities(); int ids = int.Parse(id.Text); fornisuer fors = td1.fornisuers.Where(a => a.id_fornisuer == ids).First(); nime.Visibility = Visibility.Visible; adress.Visibility = Visibility.Visible; note.Visibility = Visibility.Visible; telephone.Visibility = Visibility.Visible; usericon.Visibility = Visibility.Visible; adressicon.Visibility = Visibility.Visible; noteicon.Visibility = Visibility.Visible; phoneicon.Visibility = Visibility.Visible; reshersher.Visibility = Visibility.Hidden; modifier.Visibility = Visibility.Visible; nime.Text = fors.nom_fourniseur; telephone.Text = fors.tele_forniseur; note.Text = fors.note_forniseur; }
private void ajouter_Click(object sender, RoutedEventArgs e) { UserControluser usercont = new UserControluser(); byte[] image = null; FileStream stream = new FileStream(source, FileMode.Open, FileAccess.Read); BinaryReader brs = new BinaryReader(stream); image = brs.ReadBytes((int)stream.Length); fornisuer ls = new fornisuer(); gestion_stockEntities td1 = new gestion_stockEntities(); int ids = int.Parse(id.Text); var forni = td1.fornisuers.Where(a => a.id_fornisuer == ids).Count(); if (forni == 0) { ls.id_fornisuer = ids; ls.nom_fourniseur = nime.Text; ls.tele_forniseur = telephone.Text; ls.address_forniseur = adress.Text; ls.image = image; ls.note_forniseur = note.Text; td1.fornisuers.Add(ls); td1.SaveChanges(); accpet lm = new accpet(); lm.Show(); this.Hide(); } else { accpet lm = new accpet(); lm.Show(); lm.acp.Visibility = Visibility.Hidden; lm.bacp.Visibility = Visibility.Hidden; lm.textp.Text = ""; lm.textp.Text = "fourniseur n'est pas accepte"; [email protected] = Visibility.Visible; lm.bref.Visibility = Visibility.Visible; } }