private void DgvDatos_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { if (dgvDatos.Items.Count > 0 && dgvDatos.SelectedItem != null) { try { modif(); DataRowView dataRow = (DataRowView)dgvDatos.SelectedItem; int id = int.Parse(dataRow.Row.ItemArray[0].ToString()); teacherimpl = new TeacherImpl(); teacher = teacherimpl.Get(id); txtid.Text = teacher.PersonId.ToString(); txtnameMod.Text = teacher.Names; txtnameDel.Text = teacher.Names; txtlastnameMod.Text = teacher.LastName; txtlastnameDel.Text = teacher.LastName; txtsecondlastnameMod.Text = teacher.SecondLastName; txtemailMod.Text = teacher.Email; txtPhoneMod.Text = teacher.Phone; txtAddressMod.Text = teacher.Address; image = new BitmapImage(); image.BeginInit(); image.CacheOption = BitmapCacheOption.OnLoad; image.UriSource = new Uri(DBImplementation.pathImages + teacher.Photo + ".png"); image.EndInit(); imagesector.Source = image; pathImagePortada = DBImplementation.pathImages + teacher.Photo + ".png"; pathup = pathImagePortada; Location ubi = new Location(teacher.Latitude, teacher.Longitude); MyMap.Center = ubi; ubicationPoint = ubi; Pushpin point = new Pushpin(); point.Location = ubi; MyMap.Children.Clear(); MyMap.Children.Add(point); idmodi = teacher.TownId; llamarmuni(teacher.TownId); Modif.IsEnabled = true; Delete.IsEnabled = true; } catch (Exception ex) { } } }
private void DgvDatos_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { if (dgvDatos.Items.Count > 0 && dgvDatos.SelectedItem != null) { try { Disabledbtn.IsEnabled = true; subjects.IsEnabled = true; DataRowView dataRow = (DataRowView)dgvDatos.SelectedItem; int id = int.Parse(dataRow.Row.ItemArray[0].ToString()); teacherimpl = new TeacherImpl(); teacher = teacherimpl.Get(id); txtid.Text = teacher.PersonId.ToString(); namenabled.Content = teacher.Names; lastenabled.Content = teacher.LastName; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }