protected void btEliminarTrama_Click(object sender, EventArgs e) { var id = ""; bool vl_bSeleccionTrama = false; foreach (GridViewRow vl_gvRow in gvTrama.Rows) { RadioButton vl_rbSeleccion = (RadioButton)vl_gvRow.FindControl("rbSeleccion"); if (vl_rbSeleccion.Checked) { vl_bSeleccionTrama = true; Label vl_lbEncID = (Label)vl_gvRow.FindControl("lbEncID"); Label vl_lbEncMTI = (Label)vl_gvRow.FindControl("lbEncMTI"); id = vl_lbEncID.Text; break; } } if (vl_bSeleccionTrama) { string vl_sMensajeError = string.Empty; var vl_cNegocioTramas = new Negocio.ADM.NTrama(); var vl_sDttID = vl_cNegocioTramas.EliminarTabla("123456789", id, ref vl_sMensajeError); CargarGrillaBusqueda(1); } else { MyMaster.AlertaMostrar("Debe Seleccionar una Trama."); } }
protected void btIngenieriaInversa_Click(object sender, EventArgs e) { if (this.tbTrama.Text == "") { MyMaster.AlertaMostrar("Ingrese la Trama"); return; } byte[] vl_baTramaString = new byte[this.tbTrama.Text.Length]; vl_baTramaString = System.Text.Encoding.ASCII.GetBytes(this.tbTrama.Text); var vl_cUnpackIso8583 = new ISO8583.Iso8583(vl_baTramaString, this.cbLongitud.Checked); this.lbMTI.Text = vl_cUnpackIso8583.MTI; for (int vl_iContador = 2; vl_iContador <= 128; vl_iContador++) { var vl_cCampoDato = vl_cUnpackIso8583.obtenerCampoDatos(vl_iContador); if (vl_cCampoDato != null) { TableRow vl_trRow = new TableRow(); TableCell vl_tcBit = new TableCell(); vl_tcBit.Text = "Bit " + vl_iContador.ToString(); TableCell vl_tcValor = new TableCell(); vl_tcValor.Text = vl_cCampoDato.ValorEnvio; vl_trRow.Cells.Add(vl_tcBit); vl_trRow.Cells.Add(vl_tcValor); tlInversa.Rows.Add(vl_trRow); } } this.tlInversa.Visible = true; }
protected void brCrearTrama_Click(object sender, EventArgs e) { if (this.tbTipoMensaje.Text == "") { MyMaster.AlertaMostrar("Ingrese el Indicador de Tipo de Mensaje (MTI)."); return; } if (this.tbDescripcionTrama.Text == "") { MyMaster.AlertaMostrar("Ingrese la Descripción."); return; } if (this.gvCampos.Rows.Count == 0) { MyMaster.AlertaMostrar("La Trama no Tiene Campos Adicionados."); return; } string vl_sMensajeError = string.Empty; var vl_cNegocioTramas = new Negocio.ADM.NTrama(); var vl_sDttID = vl_cNegocioTramas.CrearTrama("123456789", this.tbTipoMensaje.Text, this.tbDescripcionTrama.Text, this.lbIDTemporal.Text, ref vl_sMensajeError); if (vl_sMensajeError == string.Empty) { Regresar(); CargarGrillaBusqueda(1); MyMaster.AlertaMostrar("Trama Creada Correctamente.", "OK"); } else { MyMaster.AlertaMostrar(vl_sMensajeError); } }
private void LLenarCampos() { string vl_sMensajeError = string.Empty; var vl_cNegocio = new Negocio.ADM.NTrama(); var vl_dtDetalleTrama = vl_cNegocio.DetalleTrama("1234567890", this.lbEncID.Text, ref vl_sMensajeError); if (vl_sMensajeError == string.Empty) { foreach (DataRow vl_drRow in vl_dtDetalleTrama.Rows) { System.Web.UI.HtmlControls.HtmlTableRow vl_trCampo = (System.Web.UI.HtmlControls.HtmlTableRow)pnSimular.FindControl("trCampo" + vl_drRow["det_campo"].ToString()); vl_trCampo.Visible = true; Label vl_lbNombreCampo = (Label)pnSimular.FindControl("lbNombreCampo" + vl_drRow["det_campo"].ToString()); vl_lbNombreCampo.Text = vl_drRow["det_nombre"].ToString(); TextBox vl_tbCampo = (TextBox)pnSimular.FindControl("tbCampo" + vl_drRow["det_campo"].ToString()); Label vl_lbDescripcion = (Label)pnSimular.FindControl("lbDescripcion" + vl_drRow["det_campo"].ToString()); vl_lbDescripcion.Text = vl_drRow["det_descripcion"].ToString(); if (vl_drRow["det_estatico"].ToString().ToUpper() == "S") { vl_tbCampo.Text = vl_drRow["det_estatico_informacion"].ToString(); vl_tbCampo.Enabled = false; } else { vl_tbCampo.Text = ""; vl_tbCampo.Enabled = true; } } } else { MyMaster.AlertaMostrar(vl_sMensajeError); } }
protected void btSimular_Click(object sender, EventArgs e) { bool vl_bSeleccionTrama = false; foreach (GridViewRow vl_gvRow in gvTrama.Rows) { RadioButton vl_rbSeleccion = (RadioButton)vl_gvRow.FindControl("rbSeleccion"); if (vl_rbSeleccion.Checked) { vl_bSeleccionTrama = true; Label vl_lbEncID = (Label)vl_gvRow.FindControl("lbEncID"); Label vl_lbEncMTI = (Label)vl_gvRow.FindControl("lbEncMTI"); this.lbEncID.Text = vl_lbEncID.Text; this.lbMTI.Text = vl_lbEncMTI.Text; break; } } if (vl_bSeleccionTrama) { this.pnFiltroBusqueda.Visible = false; this.pnResultadoBusqueda.Visible = false; this.pnSimular.Visible = true; LLenarCampos(); LLenarDropConexion(); } else { MyMaster.AlertaMostrar("Debe Seleccionar una Trama."); } }
protected void btCrearTrama_Click(object sender, EventArgs e) { if (this.tbDescripcionNueva.Text == "") { MyMaster.AlertaMostrar("Ingrese la Descripción"); return; } if (this.tbIPNueva.Text == "") { MyMaster.AlertaMostrar("Ingrese la IP"); return; } if (this.tbPuerto.Text == "") { MyMaster.AlertaMostrar("Ingrese el Puerto"); return; } if (this.tbTimeOutEnvioSec.Text == "") { MyMaster.AlertaMostrar("Ingrese el Time Out de Envio"); return; } if (this.tbTimeOutRecepcionSec.Text == "") { MyMaster.AlertaMostrar("Ingrese el Time Out de Recepción"); return; } string vl_sMensajeError = string.Empty; var vl_cNegocioConexion = new Negocio.ADM.NConexion(); var vl_eConexion = new Entidades.EConexion(); vl_eConexion.con_descripcion = this.tbDescripcionNueva.Text; vl_eConexion.con_ip = this.tbIPNueva.Text; vl_eConexion.con_puerto = this.tbPuerto.Text; vl_eConexion.con_time_out_envio = this.tbTimeOutEnvioSec.Text; vl_eConexion.con_time_out_recepcion = this.tbTimeOutRecepcionSec.Text; var vl_sDttID = vl_cNegocioConexion.CrearConexion("123456789", vl_eConexion, ref vl_sMensajeError); if (vl_sMensajeError == string.Empty) { RegresarNueva(); MyMaster.AlertaMostrar("Conexión Creada Correctamente.", "OK"); } else { MyMaster.AlertaMostrar(vl_sMensajeError); } }
public void CargarGrillaBusqueda(int pi_iPagina) { string vl_sMensajeError = string.Empty; var vl_cNegocio = new Negocio.ADM.NTrama(); Negocio.GRL.NPaginaBD Datos; var vl_cDatos = new Entidades.EEncabezadoTrama(); Datos = vl_cNegocio.BuscarTrama("123456789", vl_cDatos, this.lbCampoOrden.Text, this.lbOrdenamiento.Text, pi_iPagina, vg_iCantidadPaginasGrilla, ref vl_sMensajeError); if (vl_sMensajeError == string.Empty) { gvTrama.DataSource = Datos.DataSource; gvTrama.DataBind(); // Carga Informacion de la consulta this.lbRegistroInicial.Text = ((vg_iCantidadPaginasGrilla * (pi_iPagina - 1)) + 1).ToString(); this.lbRegistroFinal.Text = ((vg_iCantidadPaginasGrilla * (pi_iPagina - 1)) + Datos.DataSource.Rows.Count).ToString(); lblTotalRegistros.Text = Datos.CantidadRegistros.ToString(); // Llena Drop de cantidad de Pags Datos.ComboPagina(ddlPaginas); Datos.VerificarLink(lnkPrimero , lnkAtras , lnkSiguiente , lnkUltimo); pnResultadoBusqueda.Visible = true; } else if (vl_sMensajeError.Equals("No se encontraron datos asociados a la búsqueda.")) { pnResultadoBusqueda.Visible = false; } else { MyMaster.AlertaMostrar(vl_sMensajeError); pnResultadoBusqueda.Visible = false; } }
public void CargarGrillaBusquedaDetalleTemporal() { string vl_sMensajeError = string.Empty; var vl_cNegocio = new Negocio.ADM.NTrama(); Negocio.GRL.NPaginaBD Datos; Datos = vl_cNegocio.BuscarDetalleTablaTemporal("123456789", this.lbIDTemporal.Text, ref vl_sMensajeError); if (Datos == null) { MyMaster.AlertaMostrar("No es posible realizar la búsqueda en este mometo, intente nuevamente."); return; } if (vl_sMensajeError == string.Empty) { this.lbTotalCampos.Text = Datos.DataSource.Rows.Count.ToString(); gvCampos.DataSource = Datos.DataSource; gvCampos.DataBind(); this.tbCamposTemporal.Visible = true; } else { MyMaster.AlertaMostrar(vl_sMensajeError); } }
protected void btAdicionarBit_Click(object sender, EventArgs e) { var vl_xCampos = new System.Xml.XmlDocument(); vl_xCampos.Load(Server.MapPath("~/XML/Campos.xml")); if (this.tbCampo.Text == "") { MyMaster.AlertaMostrar("Ingrese el Campo."); return; } else { int vl_iBit; if (int.TryParse(this.tbCampo.Text, out vl_iBit)) { if (vl_iBit > 128 || vl_iBit < 2) { MyMaster.AlertaMostrar("Valor del Campo Inválido se Espera un Entero Entre 2 y 128."); return; } else { if (vl_xCampos.SelectNodes("Trama/Campos/Campo[@bit='" + this.tbCampo.Text + "']").Count == 0) { MyMaster.AlertaMostrar("Campo no Configurado."); return; } else { if (vl_xCampos.SelectNodes("Trama/Campos/Campo[@bit='" + this.tbCampo.Text + "' and @valido = 'N']").Count == 1) { MyMaster.AlertaMostrar(vl_xCampos.SelectSingleNode("Trama/Campos/Campo[@bit='" + this.tbCampo.Text + "' and @valido='N']").Attributes["mensaje"].Value); return; } } } } else { MyMaster.AlertaMostrar("Formato de Campo Incorrecto se Espera un Entero."); return; } } //if (this.tbNombreCampo.Text == "") //{ // MyMaster.AlertaMostrar("Ingrese el Nombre."); // return; //} if (this.cbCampoEstatico.Checked && this.tbInformacionEstatica.Text == "") { MyMaster.AlertaMostrar("Ingrese la Información."); return; } string vl_sMensajeError = string.Empty; var vl_cNegocioTramas = new Negocio.ADM.NTrama(); var vl_cDetalleTrama = new Entidades.EDetalleTrama(); vl_cDetalleTrama.det_guid = this.lbIDTemporal.Text; vl_cDetalleTrama.det_campo = this.tbCampo.Text; vl_cDetalleTrama.det_nombre = this.tbNombreCampo.Text; vl_cDetalleTrama.det_estatico = (this.cbCampoEstatico.Checked ? "S" : "N"); vl_cDetalleTrama.det_estatico_informacion = this.tbInformacionEstatica.Text; vl_cDetalleTrama.det_descripcion = this.tbDescripcionCampo.Text; var vl_sDttID = vl_cNegocioTramas.CrearDetalleTramaTemporal("123456789", vl_cDetalleTrama, ref vl_sMensajeError); if (vl_sMensajeError != string.Empty) { MyMaster.AlertaMostrar(vl_sMensajeError); } else { this.tbCampo.Text = ""; this.tbNombreCampo.Text = ""; this.cbCampoEstatico.Checked = false; this.tbInformacionEstatica.Text = ""; this.trInformacion.Visible = false; this.tbDescripcionCampo.Text = ""; CargarGrillaBusquedaDetalleTemporal(); MyMaster.AlertaMostrar("Campo adicionado correctamente.", "OK"); } }
protected void btEnviar_Click(object sender, EventArgs e) { if (this.ddlConexion.SelectedItem.Value == "") { MyMaster.AlertaMostrar("Seleccione la conexión"); return; } var vl_isoTrama = new ISO8583.Iso8583(this.lbMTI.Text); for (int vl_iContador = 2; vl_iContador <= 128; vl_iContador++) { System.Web.UI.HtmlControls.HtmlTableRow vl_trCampo = (System.Web.UI.HtmlControls.HtmlTableRow)pnSimular.FindControl("trCampo" + vl_iContador.ToString()); if (vl_trCampo.Visible) { TextBox vl_tbCampo = (TextBox)pnSimular.FindControl("tbCampo" + vl_iContador.ToString()); var vl_cValidaCampo = vl_isoTrama.adicionarCampoDatos(vl_iContador, vl_tbCampo.Text); } } DateTime vl_dtInicio, vl_dtFin; int m_iBytes = 0; byte[] m_aBuffer = new byte[8000]; byte[] newArray; string[] vl_sDetalleConexion = this.ddlConexion.SelectedItem.Value.Split('|'); byte[] vl_baTrama = vl_isoTrama.obtieneTramaBytes(); this.tbTrama.Text = System.Text.Encoding.ASCII.GetString(vl_baTrama, 0, vl_baTrama.Length); var endPoint = new IPEndPoint(IPAddress.Parse(vl_sDetalleConexion[0]), int.Parse(vl_sDetalleConexion[1])); var vl_tcpSocket = new TcpClient(); vl_tcpSocket.SendTimeout = int.Parse(vl_sDetalleConexion[2]) * 1000; vl_tcpSocket.ReceiveTimeout = int.Parse(vl_sDetalleConexion[3]) * 1000; vl_dtInicio = DateTime.Now; try { vl_tcpSocket.Connect(endPoint); } catch { MyMaster.AlertaMostrar("No se pudo establecer la conexión."); return; } System.IO.Stream nsEscritura = vl_tcpSocket.GetStream(); nsEscritura.Write(vl_baTrama, 0, vl_baTrama.Length); try { m_iBytes = nsEscritura.Read(m_aBuffer, 0, m_aBuffer.Length); newArray = new byte[m_iBytes]; Array.Copy(m_aBuffer, 0, newArray, 0, m_iBytes); //Buffer.BlockCopy(m_aBuffer, 16, newArray, 0, m_iBytes); } catch { MyMaster.AlertaMostrar("Se agotó el tiempo de espera para la recepción del mensaje."); vl_tcpSocket.Close(); return; } vl_tcpSocket.Close(); vl_dtFin = DateTime.Now; this.tbTrama.Text = vl_isoTrama.generarMensaje(); this.tlEnvio.Visible = true; vl_isoTrama = new ISO8583.Iso8583(newArray); this.tbTramaRespuesta.Text = System.Text.Encoding.ASCII.GetString(newArray); this.lbTiempoRespuesta.Text = (vl_dtFin - vl_dtInicio).TotalSeconds.ToString(); this.tlRespuesta.Visible = true; }