public async Task <Response> guardarUbigeo(UbicacionGeograficaG param) { try { // www.admeli.com/demo2/services.php/ubigeo Response response = await webService.POST <UbicacionGeograficaG, Response>("ubigeo", param); return(response); } catch (Exception ex) { throw ex; } }
private async void btnAceptar_Click(object sender, EventArgs e) { // GUARDAR UBICACion if (formClienteNuevo.nuevo) { UbicacionGeograficaG UG = new UbicacionGeograficaG(); int i = cbxPaises.SelectedIndex; UG.idPais = (int)cbxPaises.SelectedValue; UG.idNivel1 = (int)cbxNivel1.SelectedValue; UG.idNivel2 = (int)cbxNivel2.SelectedValue; if (cbxNivel3.IsAccessible) { UG.idNivel3 = (int)cbxNivel3.SelectedValue; } Response respuesta = await locationModel.guardarUbigeo(UG); ClienteG CG = new ClienteG(); CG.celular = textCelular.Text; CG.direccion = textDireccion.Text; CG.email = textEmail.Text; CG.esEventual = false; CG.estado = chkEstado.Checked ? 1 : 0; CG.idDocumento = (int)cbxDocumento.SelectedValue; CG.idGrupoCliente = (int)cbxTipoGrupo.SelectedValue; CG.idUbicacionGeografica = respuesta.id; CG.nombre = cbxDocumento.Text; CG.nombreCliente = txtNombreCliente.Text; CG.nombreGrupo = cbxTipoGrupo.Text; CG.nroVentasCotizaciones = 0; CG.numeroDocumento = textNIdentificacion.Text; CG.observacion = txtDatosEnvio.Text; CG.sexo = cbxSexo.Text; CG.telefono = textTelefono.Text; CG.tipoDocumento = "Natural"; CG.zipCode = textZipCode.Text; rest = await clienteModel.guardar(CG); if (rest.id > 0) { MessageBox.Show(rest.msj, "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Information); this.formClienteNuevo.Close(); } else { MessageBox.Show("error en guardar" + rest.msj, "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { UbicacionGeograficaG UG = new UbicacionGeograficaG(); int i = cbxPaises.SelectedIndex; UG.idPais = (int)cbxPaises.SelectedValue; UG.idNivel1 = (int)cbxNivel1.SelectedValue; if (cbxNivel2.IsAccessible) { UG.idNivel2 = (int)cbxNivel2.SelectedValue; } if (cbxNivel3.IsAccessible) { UG.idNivel3 = (int)cbxNivel3.SelectedValue; } Response respuesta = await locationModel.guardarUbigeo(UG); Response respuesta1 = await locationModel.guardarUbigeo(UG); Cliente CG = new Cliente(); CG.idCliente = formClienteNuevo.currentCliente.idCliente; CG.celular = textCelular.Text; CG.direccion = textDireccion.Text; CG.email = textEmail.Text; CG.esEventual = false; CG.estado = chkEstado.Checked ? 1 : 0; CG.idDocumento = (int)cbxDocumento.SelectedValue; CG.idGrupoCliente = (int)cbxTipoGrupo.SelectedValue; CG.idUbicacionGeografica = respuesta.id; CG.nombre = cbxDocumento.Text; CG.nombreCliente = txtNombreCliente.Text; CG.nombreGrupo = cbxTipoGrupo.Text; CG.nroVentasCotizaciones = "0"; CG.numeroDocumento = textNIdentificacion.Text; CG.observacion = txtDatosEnvio.Text; CG.sexo = cbxSexo.Text; CG.telefono = textTelefono.Text; CG.tipoDocumento = "Natural";// es detalle q falta aclarar CG.zipCode = textZipCode.Text; Response rest = await clienteModel.modificar(CG); if (rest.id > 0) { MessageBox.Show(rest.msj, "Modificar", MessageBoxButtons.OK, MessageBoxIcon.Information); this.formClienteNuevo.Close(); } else { MessageBox.Show("error en Modificar " + rest.msj, "Modificar", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }