protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { string strNumero; try { strNumero = Request.QueryString["Numero"]; dgPersonas.DataSource = ControlPersonasDal.ControlarDocumento(strNumero); dgPersonas.DataBind(); if (dgPersonas.Items.Count == 0) { btnCerrar_Click(null, null); } else { lblFiltro.Text = "Documento Nro.: " + strNumero; } } catch { btnCerrar_Click(null, null); } } }
public string GetServerTime(int valor) { string cuit = ""; string nombre = ""; string tmpDNI = ""; DataTable MyBase = ControlPersonasDal.ControlarDocumento(valor.ToString()); if (MyBase.Rows.Count > 0) { nombre = "1," + MyBase.Rows[0]["apellido"].ToString().Trim() + "," + MyBase.Rows[0]["nombre"].ToString().Trim(); } else { PadronDal padron = new PadronDal(); DataTable myTable = padron.TraerDatos(valor); if (myTable.Rows.Count > 0) { for (int j = 0; j < myTable.Rows.Count; j++) { //string tmpCuit = myTable.Rows[j]["cuit"].ToString(); //tmpDNI = tmpCuit.Substring(2, tmpCuit.Length - 3); //int dni = int.Parse(myTable.Rows[j]["dni"].ToString()); //if (dni == valor) //{ // cuit = myTable.Rows[j]["cuit"].ToString(); if (j > 0) { nombre = nombre + "|"; } nombre = nombre + "1," + myTable.Rows[j]["nombre"].ToString(); // dni = int.Parse(myTable.Rows[j]["dni"].ToString()); //} } } else { nombre = "1,Persona no existe en la base"; } } //string valorFinal = String.Format("DNI: " + tmpDNI + " // Fecha verificación: {0}", // DateTime.Now) + // "<br>Nombre: " + nombre+ // "<br>Cuit: " + cuit; string valorFinal = nombre;// +"," + cuit + "," + tmpDNI; return(valorFinal); }
protected void txtDocumento_TextChanged(object sender, EventArgs e) { if (txtDocumento.Text != "") { DataTable dt = null; if (cmbTipoDocumento.SelectedValue == "") { dt = ControlPersonasDal.ControlarDocumento(txtDocumento.Text); } else if (int.Parse(cmbTipoDocumento.SelectedValue) == 1) { dt = ControlPersonasDal.ControlarDocumento(int.Parse(cmbTipoDocumento.SelectedValue), txtDocumento.Text); } if (dt != null) { if (dt.Rows.Count != 0) { DataRow dr = dt.Rows[0]; txtApellido.Text = dr["Apellido"].ToString(); txtNombre.Text = dr["Nombre"].ToString(); CargarEstadoCivil(int.Parse(dr["EstadoCivil"].ToString())); CargarTipoDocumento(int.Parse(dr["Tipodni"].ToString())); txtPorcentaje.Focus(); lblResultado.Text = ""; } else { txtApellido.Focus(); lblResultado.Text = "*No hay resultados"; } } } /* * else * { * txtApellido.Focus(); * lblResultado.Text = ""; * } */ }