async protected void btnAgregar_Click(object sender, EventArgs e) { if (ValidarInsertar()) { Models.Aerolinea aerolineaIngresado = new Models.Aerolinea(); Models.Aerolinea aerolinea = new Models.Aerolinea() { AER_RUC = txtAerolineaRuc.Text.ToString(), AER_NOMBRE = txtAerolineaNombre.Text.ToString(), AER_ESTADO = drpEstado.SelectedValue.ToString() }; aerolineaIngresado = await aerolineaManager.Ingresar(aerolinea, VG.usuarioActual.CadenaToken); if (aerolineaIngresado != null) { lblStatus.Text = "Aerolinea ingresada correctamente"; lblStatus.Visible = true; InicializarControles(); } else { lblStatus.Text = "Hubo un error al ingresar la aerolinea"; lblStatus.ForeColor = Color.Maroon; lblStatus.Visible = true; } } }
protected async void grdAerolineas_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblCode = (Label)grdAerolineas.Rows[e.RowIndex].Cells[0].FindControl("lblCodigoAerolinea"); string aerRuc = (grdAerolineas.Rows[e.RowIndex].FindControl("txtAerolineaRucEdit") as TextBox).Text; string aerNombre = (grdAerolineas.Rows[e.RowIndex].FindControl("txtAerolineaNombreEdit") as TextBox).Text; string aerEstado = (grdAerolineas.Rows[e.RowIndex].FindControl("drpEstadoEdit") as DropDownList).Text; if (ValidarModificar(aerRuc, aerNombre)) { Models.Aerolinea aerolineaModificado = new Models.Aerolinea(); Models.Aerolinea aerolinea = new Models.Aerolinea() { AER_CODIGO = Convert.ToInt32(lblCode.Text), AER_RUC = aerRuc, AER_NOMBRE = aerNombre, AER_ESTADO = aerEstado }; aerolineaModificado = await aerolineaManager.Actualizar(aerolinea, VG.usuarioActual.CadenaToken); if (aerolineaModificado != null) { lblStatus.Text = "Aerolinea modificada correctamente"; lblStatus.Visible = true; InicializarControles(); } else { lblStatus.Text = "Hubo un error al modificar la aerolinea"; lblStatus.ForeColor = Color.Maroon; lblStatus.Visible = true; } grdAerolineas.EditIndex = -1; InicializarControles(); } }