protected void GVBusqueda_RowCommand(object sender, GridViewCommandEventArgs e) { try{ if (e.CommandName == "AutorizarEmpleado") { string vIdPermiso = e.CommandArgument.ToString(); LbNumeroPermiso.Text = vIdPermiso; UpdateLabelPermiso.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } if (e.CommandName == "AutorizarEmpleadoRecursosHumanos") { string vIdPermiso = e.CommandArgument.ToString(); LbFinalizarPermiso.Text = vIdPermiso; UpdatePanel1.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openFinalizarModal();", true); } if (e.CommandName == "MotivoPermiso") { string vIdPermiso = e.CommandArgument.ToString(); String vQuery = "RSP_ObtenerPermisos 3," + Session["USUARIO"] + "," + vIdPermiso; DataTable vDatos = vConexion.obtenerDataTable(vQuery); String vMotivo = "Ningun motivo"; if (!vDatos.Rows[0]["Motivo"].ToString().Equals("")) { vMotivo = vDatos.Rows[0]["Motivo"].ToString(); } String vMensaje = String.Empty; vMensaje += "Motivo: " + vMotivo + "\\n"; vMensaje += "Fecha Solicitud: " + vDatos.Rows[0]["FechaSolicitud"].ToString() + "\\n"; vMensaje += "Fecha Autorización: " + vDatos.Rows[0]["fechaAutorizacion"].ToString(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Pop", "window.alert('" + vMensaje + "')", true); } if (e.CommandName == "DocumentoPermiso") { string vIdPermiso = e.CommandArgument.ToString(); String vQuery = "RSP_ObtenerPermisos 3," + Session["USUARIO"] + "," + vIdPermiso; DataTable vDatos = vConexion.obtenerDataTable(vQuery); String vDocumento = ""; if (!vDatos.Rows[0]["documento"].ToString().Equals("")) { vDocumento = vDatos.Rows[0]["documento"].ToString(); } if (!vDocumento.Equals("")) { LbPermisoDescarga.Text = vIdPermiso; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openDescargarModal();", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Pop", "window.alert('No existe documento en este permiso')", true); } } if (e.CommandName == "CambiarAprobacion") { string vIdPermiso = e.CommandArgument.ToString(); LtPermiso.Text = vIdPermiso; UPCambio.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalCambio();", true); } CargarAutorizaciones(); }catch (Exception Ex) { Mensaje(Ex.Message, WarningType.Danger); } }
protected void GVBusqueda_RowCommand(object sender, GridViewCommandEventArgs e) { try{ if (e.CommandName == "AutorizarEmpleado") { string vIdPermiso = e.CommandArgument.ToString(); LbNumeroPermiso.Text = vIdPermiso; UpdateLabelPermiso.Update(); DDLOpciones.SelectedValue = "1"; DivMotivoJefe.Visible = false; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } if (e.CommandName == "AutorizarEmpleadoRecursosHumanos") { String vQuery = "RSP_ObtenerPermisos 3," + Session["USUARIO"] + "," + e.CommandArgument.ToString(); DataTable vDatos = vConexion.obtenerDataTable(vQuery); if (!Convert.ToBoolean(vDatos.Rows[0]["Autorizado"].ToString())) { throw new Exception("Este permiso no ha sido autorizado por el jefe inmediato."); } string vIdPermiso = e.CommandArgument.ToString(); LbFinalizarPermiso.Text = vIdPermiso; UpdatePanel1.Update(); DDlFinalizarPermiso.SelectedValue = "1"; DivMotivo.Visible = false; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openFinalizarModal();", true); } if (e.CommandName == "MotivoPermiso") { string vIdPermiso = e.CommandArgument.ToString(); String vQuery = "RSP_ObtenerPermisos 3," + Session["USUARIO"] + "," + vIdPermiso; DataTable vDatos = vConexion.obtenerDataTable(vQuery); String vMotivo = "Ningun motivo"; if (!vDatos.Rows[0]["Motivo"].ToString().Equals("")) { vMotivo = vDatos.Rows[0]["Motivo"].ToString(); } String vMensaje = String.Empty; vMensaje += "Motivo: " + vMotivo + "\\n"; vMensaje += "Fecha Solicitud: " + vDatos.Rows[0]["FechaSolicitud"].ToString() + "\\n"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Pop", "window.alert('" + vMensaje + "')", true); } if (e.CommandName == "DocumentoPermiso") { string vIdPermiso = e.CommandArgument.ToString(); String vQuery = "RSP_ObtenerPermisos 3," + Session["USUARIO"] + "," + vIdPermiso; DataTable vDatos = vConexion.obtenerDataTable(vQuery); String vDocumento = ""; if (!vDatos.Rows[0]["documento"].ToString().Equals("")) { vDocumento = vDatos.Rows[0]["documento"].ToString(); } if (!vDocumento.Equals("")) { LbPermisoDescarga.Text = vIdPermiso; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openDescargarModal();", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Pop", "window.alert('No existe documento en este permiso')", true); } } CargarAutorizaciones(); } catch (Exception Ex) { Mensaje(Ex.Message, WarningType.Danger); } }