void CargarCobertura() { string parametro = this.Request.QueryString["IdCobertura"]; //validar si el parametro es correcto if (String.IsNullOrEmpty(parametro)) { Response.Write("<script>alert('Parámetro nulo')</script>"); } else { int IdCobertura = Convert.ToInt32(parametro); BLCobertura coberturaObtenido = new BLCobertura(); sp_RetornaCoberturaID_Result resultado = new sp_RetornaCoberturaID_Result(); ///invocar al procedimiento resultado = coberturaObtenido.RetornaCoberturaID(IdCobertura); if (resultado == null) { Response.Redirect("frmListaCobertura.aspx"); } else { this.txtnombre.Text = resultado.NombreCobertura; this.txtdescripcion.Text = resultado.Descripcion; this.txtporcentaje.Text = resultado.Procentaje; /////asignar al hidden field /////el valor de la llave primaria hdidCobertura.Value = resultado.IdCobertura.ToString(); } } }
void CargarCobertura() { ///Obtener El Parametro De Consulta Seleccionado Desde ///Formulario Lista Cobertura string parametro = this.Request.QueryString["IdCobertura"]; ///Validar si el parametro es correcto if (String.IsNullOrEmpty(parametro)) { ///Lanzar Alerta De Que No Hay Ningun Parametro Response.Write("<script>alert('Parámetro nulo')</script>"); } else { ///Convertir La Variable De Consulta A INT int IdCobertura = Convert.ToInt32(parametro); /// Se Crea Una Instancia De BLCobertura BLCobertura coberturaObtenido = new BLCobertura(); /// Se Crea Una Instancia Del Modelo De BD sp_RetornaCoberturaID_Result resultado = new sp_RetornaCoberturaID_Result(); ///Invocar Al Procedimiento Almacenado ///Que Retorna una cobertura Por ID De La Clase BL ///Y Se Asigna A Result resultado = coberturaObtenido.RetornaCoberturaID(IdCobertura); ///Si RESULT Es Vacio Redireccionar A Lista cobertura if (resultado == null) { Response.Redirect("frmListaCobertura.aspx"); } else { ///Se Asignan A Los TextBox Los Datos Del la cobertura this.txtNombre.Text = resultado.NombreCobertura; this.txtDescripcion.Text = resultado.Descripcion; this.txtPorcentaje.Text = resultado.Procentaje; this.hdCobertura.Value = resultado.IdCobertura.ToString(); } } }