/// <summary> /// José Oñate:: /// Mostrar etiquetas (label) trabajo conjunto con la validación. /// Autoformato de N° Identificación /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void txtRut_TextChanged(object sender, EventArgs e) { rfRUT.Enabled = false; ProductorHabilitadoBEL prohabBEL = new ProductorHabilitadoBEL(); if (txtRut.Text.Trim().Length > 1) { string rut = txtRut.Text; rut = rut.Replace(".", ""); rut = rut.Replace("-", ""); string formatRut = rut.Substring(0, rut.Length - 1) + "-" + rut.Substring(rut.Length - 1); txtRut.Text = formatRut; if (validarRut(txtRut.Text)) { String[] separadorRut = txtRut.Text.Split('-'); ProductorHabilitadoBLL prohabBLL = new ProductorHabilitadoBLL(); ProductorHabilitadoBEL prohab = prohabBLL.Productor_Habilitados_Sel(Int32.Parse(separadorRut[0])); if (prohab.Equals(null)) { lblValRut.Visible = true; } else { txtApellidos.Text = prohab.Apellido; txtNombre.Text = prohab.Nombre; txtFecha.Text = Convert.ToString(prohab.Fecha); } lblValRut.Visible = false; } else { lblValRut.Visible = true; } } else { lblValRut.Visible = true; } }
public ProductorHabilitadoBEL Productor_Habilitados_Sel(int rut) { fru.WebServicePruebaSoapClient servicio = new fru.WebServicePruebaSoapClient(); DataSet custDS = servicio.Productores_Hab_Sel(rut); if (custDS.Tables["Productores_Hab"].Rows.Count > 0) { ProductorHabilitadoBEL prodhabBEL = new ProductorHabilitadoBEL(); prodhabBEL.Rut = Convert.ToInt32(custDS.Tables["Productores_Hab"].Rows[0]["rut"].ToString()); prodhabBEL.Dv = Convert.ToChar(custDS.Tables["Productores_Hab"].Rows[0]["dv"].ToString()); prodhabBEL.Nombre = custDS.Tables["Productores_Hab"].Rows[0]["nombre"].ToString(); prodhabBEL.Apellido = custDS.Tables["Productores_Hab"].Rows[0]["apellido"].ToString(); prodhabBEL.Fecha = Convert.ToDateTime(custDS.Tables["Productores_Hab"].Rows[0]["fecha"].ToString()); return(prodhabBEL); } else { return(null); } }