protected void grvCatalogo_RowCommand(object sender, GridViewCommandEventArgs e) { try { string intPrimaryCatalogoID = ""; stp_getListCatalogo_Result mdl = new stp_getListCatalogo_Result(); switch (e.CommandName) { case "Estatus": intPrimaryCatalogoID = e.CommandArgument.ToString(); mdl = lstCat.First(x => x.vchCatalogoID == intPrimaryCatalogoID); mdl.bitActivo = !mdl.bitActivo; CatalogoRequest request = new CatalogoRequest(); clsCatalogo cat = new clsCatalogo(); request.mdlUser = Usuario; cat.intCatalogoID = Convert.ToInt32(ddlListCatalogo.SelectedValue.ToString()); cat.intPrimaryKey = Convert.ToInt32(intPrimaryCatalogoID); cat.bitActivo = (bool)mdl.bitActivo; request.mdlCat = cat; stp_updateCatEstatus_Result result = new stp_updateCatEstatus_Result(); result = RisService.updateCatalogoEstatus(request); if (result != null) { if (result.vchMensaje == "OK") { ShowMessage("Se actualizó correctamente.", MessageType.Correcto, "alert_container"); //fillCat(); cargaCatalgo(); } else { ShowMessage("Existe un error al actualizar: " + result.vchDescripcion, MessageType.Error, "alert_container"); } } else { ShowMessage("Existe un error al actualizar, favor de revisar la información. ", MessageType.Correcto, "alert_container"); } break; case "viewEditar": intPrimaryCatalogoID = e.CommandArgument.ToString(); mdl = lstCat.First(x => x.vchCatalogoID == intPrimaryCatalogoID); txtValorCatalogo.Text = mdl.vchCatalogo; lblCatalogo.Text = ddlListCatalogo.SelectedItem.Text; lblPrimary.Text = "ID = " + mdl.vchCatalogoID; bitEdicion = true; break; } } catch (Exception eRU) { Log.EscribeLog("Existe un error grvCatalogo_RowCommand: " + eRU.Message, 3, Usuario.vchUsuario); } }
protected void grvCatalogo_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.Pager) { Label lblTotalNumDePaginas = (Label)e.Row.FindControl("lblBandejaTotal"); lblTotalNumDePaginas.Text = grvCatalogo.PageCount.ToString(); TextBox txtIrAlaPagina = (TextBox)e.Row.FindControl("txtBandeja"); txtIrAlaPagina.Text = (grvCatalogo.PageIndex + 1).ToString(); DropDownList ddlTamPagina = (DropDownList)e.Row.FindControl("ddlBandeja"); ddlTamPagina.SelectedValue = grvCatalogo.PageSize.ToString(); } if (e.Row.RowType != DataControlRowType.DataRow) { return; } if (e.Row.DataItem != null) { stp_getListCatalogo_Result _mdl = (stp_getListCatalogo_Result)e.Row.DataItem; ImageButton ibtEstatus = (ImageButton)e.Row.FindControl("imbEstatus"); ibtEstatus.Attributes.Add("onclick", "javascript:return confirm('¿Desea realizar el cambio de estatus del item seleccionado?');"); if ((bool)_mdl.bitActivo) { ibtEstatus.ImageUrl = @"~/Images/ic_action_tick.png"; } else { ibtEstatus.ImageUrl = @"~/Images/ic_action_cancel.png"; } } } catch (Exception eGUP) { throw eGUP; } }