Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdTipoTelefono,TipoDeTelefono1")] TipoDeTelefono tipoDeTelefono)
        {
            if (id != tipoDeTelefono.IdTipoTelefono)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tipoDeTelefono);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TipoDeTelefonoExists(tipoDeTelefono.IdTipoTelefono))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipoDeTelefono));
        }
Exemplo n.º 2
0
        private TipoDeTelefono LlenarClase()
        {
            TipoDeTelefono t = new TipoDeTelefono();

            t.ID   = Convert.ToInt32(IDnumericUpDown.Value);
            t.Tipo = TiptextBox.Text;

            return(t);
        }
Exemplo n.º 3
0
        private TipoDeTelefono LlenaClase()
        {
            TipoDeTelefono tipo = new TipoDeTelefono();

            tipo.Id   = Convert.ToInt32(IDnumericUpDown.Value);
            tipo.Tipo = TipotextBox.Text;


            return(tipo);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("IdTipoTelefono,TipoDeTelefono1")] TipoDeTelefono tipoDeTelefono)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tipoDeTelefono);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipoDeTelefono));
        }
        public static bool Guardar(TipoDeTelefono t)
        {
            bool     paso     = false;
            Contexto contexto = new Contexto();

            try
            {
                if (contexto.Tipo.Add(t) != null)
                {
                    paso = contexto.SaveChanges() > 0;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }
            return(paso);
        }
Exemplo n.º 6
0
        private void Button_AgregarTelefono(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtNumeroTelefonico.Text))
            {
                TipoDeTelefono a                  = (TipoDeTelefono)MyPicker.SelectedItem;
                string         Numero             = txtNumeroTelefonico.Text;
                string         TipoTelefono       = a.ID.ToString();
                string         NombreTipoTelefono = a.NOMBRE.ToString();

                if (!string.IsNullOrEmpty(txtIDTelefono.Text))
                {
                    MVTelefono.ActualizaRegistroEnListaDeTelefonos(txtIDTelefono.Text, TipoTelefono, txtNumeroTelefonico.Text);
                }
                else
                {
                    MVTelefono.AgregaTelefonoALista(TipoTelefono, txtNumeroTelefonico.Text, NombreTipoTelefono);
                }

                //Guarda los telefonos
                if (MVTelefono.ListaDeTelefonos != null)
                {
                    if (MVTelefono.ListaDeTelefonos.Count != 0)
                    {
                        MVTelefono.EliminaTelefonosUsuario(new Guid(AppCliente.App.Global1));
                        MVTelefono.GuardaTelefono(new Guid(AppCliente.App.Global1), "Usuario");
                    }
                }
                MVTelefono.BuscarTelefonos(UidPropietario: new Guid(AppCliente.App.Global1), ParadetroDeBusqueda: "Usuario");
                CargarNombreTelefono();
                MyListView.ItemsSource = null;
                MyListView.ItemsSource = MVTelefono.ListaDeTelefonos;
                Cargausuario();
                MyPicker.ItemsSource = MVTelefono.ListaDeTipoDeTelefono;

                txtNumeroTelefonico.Text = "";
                txtIDTelefono.Text       = "";
            }
        }
Exemplo n.º 7
0
 private void LlenaCampo(TipoDeTelefono tipo)
 {
     IDnumericUpDown.Value = tipo.Id;
     TipotextBox.Text      = tipo.Tipo;
 }
Exemplo n.º 8
0
 private void LlenarCampo(TipoDeTelefono t)
 {
     IDnumericUpDown.Value = t.ID;
     TiptextBox.Text       = t.Tipo;
 }