protected void fillGridConceptoDeCobro() { string numFinca = (string)Session["numFinca"]; try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connDB"].ConnectionString)) { string procedure = getConceptosDeCobroDePropiedadSPname; SqlCommand cmd = new SqlCommand(procedure, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@inNumfinca", SqlDbType.VarChar).Value = numFinca; cmd.Connection = conn; conn.Open(); GridConceptosDeCobro.DataSource = cmd.ExecuteReader(); GridConceptosDeCobro.DataBind(); GridConceptosDeCobro.Visible = true; } } catch (SqlException ex) { string alertMessage = Utilidad.mensajeAlerta(ex); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + alertMessage + "')", true); } }
protected void fillGridConceptoDeCobro() { int opcionDeBusqueda; try { opcionDeBusqueda = (int)HttpContext.Current.Session["opcionDeBusqueda"]; } catch (NullReferenceException ex) { opcionDeBusqueda = -1; } // Opcion propiedades de propietario por nombre if (opcionDeBusqueda == 1) { string numFinca = (string)HttpContext.Current.Session["numFinca"]; try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connDB"].ConnectionString)) { string procedure = getConceptosDeCobroDePropiedadSPname; SqlCommand cmd = new SqlCommand(procedure, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@inNumfinca", SqlDbType.VarChar).Value = numFinca; cmd.Connection = conn; conn.Open(); GridConceptosDeCobro.DataSource = cmd.ExecuteReader(); GridConceptosDeCobro.DataBind(); GridConceptosDeCobro.Visible = true; } } catch (SqlException ex) { string alertMessage = Utilidad.mensajeAlerta(ex); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + alertMessage + "')", true); } } else { try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connDB"].ConnectionString)) { string procedure = getConceptosDeCobroSPname; SqlCommand cmd = new SqlCommand(procedure, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@inId", DBNull.Value)); cmd.Connection = conn; conn.Open(); GridConceptosDeCobro.DataSource = cmd.ExecuteReader(); GridConceptosDeCobro.DataBind(); GridConceptosDeCobro.Visible = true; } } catch (SqlException ex) { string alertMessage = Utilidad.mensajeAlerta(ex); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + alertMessage + "')", true); } } }