private TelefonosDetalle LlenaClase() { TelefonosDetalle tipo = new TelefonosDetalle(); tipo.Id = Convert.ToInt32(IdDetallenumericUpDown.Value); tipo.TipoTelefono = TipoDetalletextBox.Text; return(tipo); }
private void btnRemoverFila_Click(object sender, EventArgs e) { if (DetalleDataGridView1.Rows.Count > 0 && DetalleDataGridView1.CurrentRow != null) { if (RowSelected >= 0) { Personas persona = LlenaClase(); TelefonosDetalle tel = persona.Telefonos.ElementAt(RowSelected); Detalle.Add(new TelefonosDetalle(tel.Id, tel.PersonaId, tel.TipoTelefono, tel.Telefono)); persona.Telefonos.RemoveAt(RowSelected); DetalleDataGridView1.DataSource = null; DetalleDataGridView1.DataSource = persona.Telefonos; RowSelected = -1; MessageBox.Show("Eliminado!"); } } }
private void button1_Click(object sender, EventArgs e) { if (DetalleDataGridView1.DataSource != null) { this.Detalle = (List <TelefonosDetalle>)DetalleDataGridView1.DataSource; } if (Utilidades.ValidarGroupBox(TelefonoGroupBox, MyErrorProvider) == true) { TelefonosDetalle telefonosDetalle = new TelefonosDetalle(); telefonosDetalle.Id = 0; telefonosDetalle.PersonaId = (int)IDPersonaNumericUpDown.Value; telefonosDetalle.Telefono = TelefonoMaskedTextBox.Text; telefonosDetalle.TipoTelefono = TipoTextBox.Text; this.Detalle.Add(telefonosDetalle); CargarGrid(); TelefonoMaskedTextBox.Focus(); TelefonoMaskedTextBox.Clear(); TipoTextBox.Clear(); } }
public static bool GuardarDetalle(TelefonosDetalle tel) { bool paso = false; Contexto contexto = new Contexto(); try { if (contexto.TelefonosDetalle.Add(tel) != null) { paso = contexto.SaveChanges() > 0; } } catch (Exception) { throw; } finally { contexto.Dispose(); } return(paso); }
internal static bool Guardar(TelefonosDetalle tipo) { throw new NotImplementedException(); }