protected void Page_Load(object sender, EventArgs e)
 {
     try {
         client = new WSVeterinarios.WS_VeterinariosClient();
         string    fileJSON = client.consultaVeterinarios();
         DataTable dt       = (DataTable)JsonConvert.DeserializeObject(fileJSON, typeof(DataTable));
         GridView_Veterinarios.DataSource = dt;
         if (!IsPostBack)
         {
             GridView_Veterinarios.DataBind();
         }
     } catch (Exception ex) {
         Response.Write("<script language=javascript> alert('" + ex.Message + "'); </script>");
     }
 }
    private void llenarListVeterinarios()
    {
        try
        {
            WSVeterinarios.WS_VeterinariosClient clientVeterinarios = new WSVeterinarios.WS_VeterinariosClient();
            string    fileJSON = clientVeterinarios.consultaVeterinarios();
            DataTable dt       = (DataTable)JsonConvert.DeserializeObject(fileJSON, typeof(DataTable));

            foreach (DataRow row in dt.Rows)
            {
                string descripcion = Convert.ToString(row["nombre"]);
                ddlVeterinario.Items.Add(descripcion);
                string id = Convert.ToString(row["id"]);
                ddlIDVeterinario.Items.Add(id);
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script language=javascript> alert('" + ex.Message + "'); </script>");
        }
    }
예제 #3
0
    private void cambiarContenidoVeterinario()
    {
        try
        {
            WSVeterinarios.WS_VeterinariosClient clientVeterinario = new WSVeterinarios.WS_VeterinariosClient();
            string    fileJSON = clientVeterinario.consultaVeterinarios();
            DataTable dt       = (DataTable)JsonConvert.DeserializeObject(fileJSON, typeof(DataTable));

            foreach (GridViewRow grid_row in GridView_Revisiones.Rows)
            {
                foreach (DataRow data_row in dt.Rows)
                {
                    if (grid_row.Cells[8].Text.Equals(Convert.ToString(data_row["id"])))
                    {
                        grid_row.Cells[8].Text = Convert.ToString(data_row["nombre"]);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script language=javascript> alert('" + ex.Message + "'); </script>");
        }
    }