public void RaiseCallbackEvent(string eventArg) { string sResultado = "", sCad = ""; //1º Si hubiera argumentos, se recogen y tratan. //string MisArg = eventArg; string[] aArgs = Regex.Split(eventArg, "@#@"); sResultado = aArgs[0] + @"@#@"; if (Session["IDRED"] == null) { _callbackResultado = aArgs[0] + @"@#@Error@#@SESIONCADUCADA"; return; } ; //2º Aquí realizaríamos el acceso a BD, etc,... switch (aArgs[0]) { case ("tramitar"): try { sResultado += "OK@#@" + CABECERAGV.TramitarNotaEstandar(aArgs[1], aArgs[2]); } catch (Exception ex) { string[] aMsg = Regex.Split(ex.Message, "##EC##"); if (aMsg[0] == "ErrorControlado") { sResultado += "Error@#@" + aMsg[1]; } else { sResultado += "Error@#@" + Errores.mostrarError("Error al tramitar la nota estándar.", ex); } } break; case ("getDatosPestana"): switch (int.Parse(aArgs[1])) { case 0: //Gastos //nada porque al ser la primera pestaña se carga directamente en el Page_Load break; case 1: //Anticipos //sCad = ObtenerRecursosAsociados(aArgs[2], aArgs[4], false); if (sCad.IndexOf("Error@#@") >= 0) { sResultado += sCad; } else { sResultado += "OK@#@" + aArgs[1] + "@#@" + sCad; } break; case 2: //Otros datos try { sResultado += "OK@#@" + aArgs[1] + "@#@" + CABECERAGV.ObtenerHistorial((aArgs[2] == "")?0:int.Parse(aArgs[2])); } catch (Exception ex) { sResultado += "Error@#@" + aArgs[1] + "@#@" + Errores.mostrarError("Error al obtener el historial.", ex); } break; } break; } //3º Damos contenido a la variable que se envía de vuelta al cliente. _callbackResultado = sResultado; }