private void Eliminar() { Entities.Agenda Med = Obtener(); Business.Agenda bo = new Business.Agenda(); if (Med != null) { DialogResult mnsj = MessageBox.Show("¿Desea eliminar el registro seleccionado?", "", MessageBoxButtons.YesNo); if (mnsj == DialogResult.Yes) { bo.Delete(Med); LLenarGrid(); } } }
private void CargarDatos() { if (IdContacto != 0) { Entities.Agenda Med = new Entities.Agenda(true); Med.ID = this.IdContacto; Business.Agenda bo = new Business.Agenda(); bo.PrepareEntityForEdition(Med); this.txtNombre.Text = Med.Nombre; this.txtApPaterno.Text = Med.ApPaterno; this.txtApMaterno.Text = Med.ApMaterno; this.txtTel.Text = Med.Telefeno1; this.txtTel2.Text = Med.Telefeno2; this.txtCorreo.Text = Med.Email; this.txtDirecion.Text = Med.Direccion; } }
private void btnSave_Click(object sender, EventArgs e) { ValidarDatos(); bool valido; Business.Agenda Med = new Business.Agenda(); valido = ValidarDatos(); if (valido == true) { Entities.Agenda M = new Entities.Agenda(IdContacto != 0); M.ID = this.IdContacto; M.Nombre = txtNombre.Text; M.ApPaterno = txtApPaterno.Text; M.ApMaterno = txtApMaterno.Text; M.Telefeno1 = txtTel.Text; M.Telefeno2 = txtTel2.Text; M.Email = txtCorreo.Text; M.Direccion = txtDirecion.Text; Med.Save(M); this.Close(); } }
private void LLenarGrid() { Business.Agenda bo = new Business.Agenda(); this.dataGridView1.DataSource = bo.ListaAgenda(txtBuscar.Text); }