Ejemplo n.º 1
0
        private TelefonosDetalle LlenaClase()
        {
            TelefonosDetalle tipo = new TelefonosDetalle();

            tipo.Id           = Convert.ToInt32(IdDetallenumericUpDown.Value);
            tipo.TipoTelefono = TipoDetalletextBox.Text;


            return(tipo);
        }
Ejemplo n.º 2
0
        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!");
                }
            }
        }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 internal static bool Guardar(TelefonosDetalle tipo)
 {
     throw new NotImplementedException();
 }