public static Result guardar(PersonasViewModel persona, int usuarioAsociado) { Result r = ValidateSession.validarSession(persona.usuarioId, HttpContext.Current.Session["usuarioId"]); if (r.error != "") { return(r); } try { PersonasController pc = new PersonasController(); Personas p = pc.getModel(persona); return(pc.guardarPersonas(p, usuarioAsociado)); } catch (Exception ex) { return(new Result() { error = ex.Message, id = 0, tipoAlerta = "warning" }); } }
public PersonasPage() { InitializeComponent(); BindingContext = viewModel = new PersonasViewModel(async ex => await this.DisplayAlert("Error", ex.Message, "Ok").ConfigureAwait(false)); }
public Personas getModel(PersonasViewModel persona) { DateTime f = new DateTime(1800, 01, 01); if (persona.fechaExpedicionCedula == null) { persona.fechaExpedicionCedula = f; } if (persona.fechaNacimiento == null) { persona.fechaNacimiento = f; } if (persona.peso == null) { persona.peso = 0; } if (persona.barrioId == null) { persona.barrioId = 0; } if (persona.documentoIdentidadId == null) { persona.documentoIdentidadId = 0; } if (persona.estadoCivilId == null) { persona.estadoCivilId = 0; } if (persona.estatura == null) { persona.estatura = 0; } if (persona.grupoSanguineoId == null) { persona.grupoSanguineoId = 0; } if (persona.municipioExpedicionId == null) { persona.municipioExpedicionId = 0; } if (persona.municipioId == null) { persona.municipioId = 0; } if (persona.sexoId == null) { persona.sexoId = 0; } if (persona.telefonoCelular == null) { persona.telefonoCelular = 0; } if (persona.telefonoFijo == null) { persona.telefonoFijo = 0; } if (persona.id == null) { persona.id = 0; } Personas p = new Personas() { barrioId = persona.barrioId.Value, correo = persona.correo, direcccion = persona.correo, documentoIdentidadId = persona.documentoIdentidadId.Value, estadoCivilId = persona.estadoCivilId.Value, estatura = persona.estatura.Value, fechaExpedicionCedula = persona.fechaExpedicionCedula.Value, fechaNacimiento = persona.fechaNacimiento.Value, grupoSanguineoId = persona.grupoSanguineoId.Value, id = persona.id.Value, municipioExpedicionId = persona.municipioExpedicionId.Value, municipioId = persona.municipioId.Value, numeroDocumento = persona.numeroDocumento, peso = persona.peso.Value, primerApellido = persona.primerApellido.TrimStart(' ').TrimEnd(' '), primerNombre = persona.primerNombre.TrimStart(' ').TrimEnd(' '), segundoApellido = persona.segundoApellido.TrimStart(' ').TrimEnd(' '), segundoNombre = persona.segundoNombre.TrimStart(' ').TrimEnd(' '), sexoId = persona.sexoId.Value, telefonoCelular = persona.telefonoCelular.Value, telefonoFijo = persona.telefonoFijo.Value , usuarioId = persona.usuarioId }; return(p); }
public PersonasPage() { InitializeComponent(); BindingContext = viewModel = new PersonasViewModel(); }