private void buscar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(nombrePersona.Text)) { MessageBox.Show("Ingrese un nombre"); return; } if (string.IsNullOrEmpty(apellidoPersona.Text)) { MessageBox.Show("Ingrese un apellido"); return; } var persona = personasController.ObtenerPersonas().Where(_ => _.Nombre.ToUpper() == nombrePersona.Text.ToUpper() && _.Apellido.ToUpper() == apellidoPersona.Text.ToUpper()).FirstOrDefault(); if (persona == null) { MessageBox.Show("Persona no encontrada!"); return; } ; personaSelect = persona; emailPersona.Text = persona.Email; cuilPersona.Text = persona.Cuil; celularPersona.Text = persona.Celular; localidadPersona.Text = persona.Localidad.Nombre; cotizar.Enabled = true; }
public void AgregarPersona(Model.Persona persona) { var context = Model.Context.GetInstance(); context.Persona.Add(persona); context.SaveChanges(); }
public async Task AddPerson(Model.Persona persona) { var item = await GetPerson(persona.Identificacion); if (item == null) { await firebase.Child("Persona").PostAsync(persona); } }
private void confirmar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(nombre.Text)) { MessageBox.Show("Ingrese un nombre"); return; } if (string.IsNullOrEmpty(apellido.Text)) { MessageBox.Show("Ingrese un apellido"); return; } if (string.IsNullOrEmpty(dni.Text)) { MessageBox.Show("Ingrese un dni"); return; } if (string.IsNullOrEmpty(edad.Text)) { MessageBox.Show("Ingrese una edad"); return; } if (string.IsNullOrEmpty(email.Text)) { MessageBox.Show("Ingrese un email"); return; } if (string.IsNullOrEmpty(Celular.Text)) { MessageBox.Show("Ingrese un celular"); return; } if (string.IsNullOrEmpty(direccion.Text)) { MessageBox.Show("Ingrese una direccion"); return; } if (localidadBindingSource.Current == null) { MessageBox.Show("Seleccione una localidad"); return; } var persona = new Model.Persona(); persona.Nombre = nombre.Text; persona.Apellido = apellido.Text; persona.Dni = dni.Text; persona.Cuil = cuil.Text; persona.Cuit = cuil.Text; var edadout = 0; int.TryParse(edad.Text, out edadout); persona.Edad = edadout; persona.Email = email.Text; persona.Celular = Celular.Text; persona.Direccion = new Model.Direccion { Calle = direccion.Text }; persona.IdLocalidad = ((Model.Localidad)localidadBindingSource.Current).IdLocalidad; personController.AgregarPersona(persona); Close(); }
public IActionResult Delete(DeleteViewModel modelo) { if (modelo.IdPersona != null) { Model.Persona x = _context.Persona.Single(p => p.IdPersona == modelo.IdPersona); _context.Persona.Remove(x); _context.SaveChanges(); return(RedirectToAction("Index", new Microsoft.AspNetCore.Routing.RouteValueDictionary( new { controller = "Home", action = "Index" }))); } return(View(modelo)); }
private dynamic Data(Model.Persona person) { return new { IdPersona = person.IdPersona, Nombre = person.Nombre, Apellido = person.Apellido, Dni = person.Dni, Cuit = person.Cuit, Cuil = person.Cuil, Edad = person.Edad, Celular = person.Celular, Email = person.Email, Localidad = person.Localidad.Nombre, Direccion = person.Direccion.Calle + " " + person.Direccion.Numero, Activo = person.Activo }; }
private void Reset() { marcas.SelectedIndex = -1; modelos.SelectedIndex = -1; versiones.SelectedIndex = -1; coberturasTipos.SelectedIndex = 0; personaSelect = null; nombrePersona.Text = string.Empty; apellidoPersona.Text = string.Empty; emailPersona.Text = string.Empty; cuilPersona.Text = string.Empty; celularPersona.Text = string.Empty; localidadPersona.Text = string.Empty; cotizar.Enabled = false; prima.Text = string.Empty; premio.Text = string.Empty; cuotas.Text = string.Empty; precio.Text = string.Empty; auto.Text = string.Empty; emision.Enabled = false; }
private void btnGuardar_Click(object sender, EventArgs e) { try { ValidateForm(); var vigente = rbNo.Checked ? true : false; var altura = decimal.Parse(txtAltura.Text); bool esInsert; if (_editObject == null || _editObject.Id == 0) { esInsert = true; var direccion = new Model.Direccion( txtCalle.Text, decimal.Parse(txtAltura.Text), decimal.Parse(string.IsNullOrEmpty(txtPiso.Text) ? "-1" : txtPiso.Text), txtDepartamento.Text, txtCiudad.Text, (Model.Pais)cbPais.SelectedValue); var datosPersona = new Model.Persona( txtNombre.Text, txtApellido.Text, dtFechaNacimiento.Value, txtTelefono.Text, (Model.TipoDocumento)cbTipoDocumento.SelectedValue, decimal.Parse(txtNroDocumento.Text), direccion, txtMail.Text, (Model.Pais)cbNacionalidad.SelectedValue, false); _editObject = new Model.Cliente(datosPersona, vigente); } else { esInsert = false; _editObject.Baja = vigente; _editObject.Persona.Nombre = txtNombre.Text; _editObject.Persona.Apellido = txtApellido.Text; _editObject.Persona.Mail = txtMail.Text; _editObject.Persona.Telefono = txtTelefono.Text; _editObject.Persona.TipoDocumento = (Model.TipoDocumento)cbTipoDocumento.SelectedValue; _editObject.Persona.NumeroDocumento = decimal.Parse(txtNroDocumento.Text); _editObject.Persona.FechaNacimiento = dtFechaNacimiento.Value; _editObject.Persona.Direccion.Calle = txtCalle.Text; _editObject.Persona.Direccion.NumeroCalle = decimal.Parse(txtAltura.Text); _editObject.Persona.Direccion.Piso = decimal.Parse(string.IsNullOrEmpty(txtPiso.Text) ? "-1" : txtPiso.Text); _editObject.Persona.Direccion.Departamento = txtDepartamento.Text; _editObject.Persona.Direccion.Ciudad = txtCiudad.Text; _editObject.Persona.Direccion.Pais = (Model.Pais)cbPais.SelectedValue; _editObject.Persona.Nacionalidad = (Model.Pais)cbNacionalidad.SelectedValue; } DAO.DAOFactory.ClienteDAO.CreateOrUpdate(_editObject, esInsert); if (_listado != null) { _listado.UpdateClientes(); } MessageBox.Show("Se ha " + (esInsert ? "ingresado" : "actualizado") + " correctamente al cliente", "", MessageBoxButtons.OK); Close(); } catch (Exception ex) { string message = ex.Message; string caption = "Error de Validación"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } }
private void btnSave_Click(object sender, EventArgs e) { try { ValidateForm(); var vigente = rdNo.Checked ? true : false; var roles = lbRoles.Items.Cast <Model.Rol>().ToList(); var hoteles = lbHoteles.Items.Cast <Model.Hotel>().ToList(); if (_editObject == null || _editObject.Id == 0) { var direccion = new Model.Direccion( txtCalle.Text, Decimal.Parse(txtNumeroCalle.Text), 0, "", "", null); var datosPersona = new Model.Persona( txtNombre.Text, txtApellido.Text, dtFechaNacimiento.Value, txtTelefono.Text, (Model.TipoDocumento)cbTipoDocumento.SelectedValue, Decimal.Parse(txtNumeroDocumento.Text), direccion, txtMail.Text, null, false); _editObject = new Model.Usuario( txtNombreUsuario.Text, txtPassword.Text, vigente, datosPersona, roles, hoteles); } else { _editObject.NombreUsuario = txtNombreUsuario.Text; _editObject.Password = txtPassword.Text; _editObject.Baja = vigente; _editObject.Persona.Nombre = txtNombre.Text; _editObject.Persona.Apellido = txtApellido.Text; _editObject.Persona.Mail = txtMail.Text; _editObject.Persona.Telefono = txtTelefono.Text; _editObject.Persona.TipoDocumento = (Model.TipoDocumento)cbTipoDocumento.SelectedValue; _editObject.Persona.NumeroDocumento = Decimal.Parse(txtNumeroDocumento.Text); _editObject.Persona.FechaNacimiento = dtFechaNacimiento.Value; _editObject.Persona.Direccion.Calle = txtCalle.Text; _editObject.Persona.Direccion.NumeroCalle = Decimal.Parse(txtNumeroCalle.Text); _editObject.Roles = roles; _editObject.HotelesAsignados = hoteles; } DAO.DAOFactory.UsuarioDAO.CreateOrUpdate(_editObject); if (_listado != null) { _listado.UpdateUsuarios(); } Close(); } catch (Exception ex) { string message = ex.Message; string caption = "Error de Validación"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } }
public async Task UpdatePerson(Model.Persona persona) { var toUpdatePerson = (await firebase.Child("Persona").OnceAsync <Model.Persona>()).Where(a => a.Object.Identificacion == persona.Identificacion).FirstOrDefault(); await firebase.Child("Persona").Child(toUpdatePerson.Key).PutAsync(persona); }