1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
private void Form1_Load(object sender, EventArgs e)
{
System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatesPolicy();
}
public class TrustAllCertificatesPolicy : System.Net.ICertificatePolicy
{
public TrustAllCertificatesPolicy() { }
public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest req, int problem)
{
return true;
}
}
//fonction qui creer le flux xml
private static XmlNodeList MyGetChildNodes(String pPathString, String pPathXmlString)
{
// Crée XmlDocument
XmlDocument doc = new XmlDocument();
try
{
//load charge le document
doc.Load(pPathString);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
} return doc.SelectNodes(pPathXmlString);
}
private void button_tout_voir_Click(object sender, EventArgs e)
{
text = "";
Application.DoEvents();// reprend la main sur le formulaire sinon ecran figer
string bdd = ConfigurationManager.AppSettings["bdd"];
string server = ConfigurationManager.AppSettings["server"];
string utilisateur = ConfigurationManager.AppSettings["utilisateur"];
string pwd = ConfigurationManager.AppSettings["pwd"];
//initialisation de la progress bar
progressBar1.Minimum = 0;
//progressBar1.Maximum = 100;
progressBar1.Value = 0;
//Permet de recevoir l'id <clienid></clientid>
{
_WebPath = "https://drobeduaelbat.fr/api/?apikey=XxxXxxXxxXxxXxx=list_athlete"; //affiche tout les athlete
_XmlPathString = "/resu/item/ct";// chemin <resu><item><ct>
XmlNodeList athletes = MyGetChildNodes(_WebPath, _XmlPathString);//fonction creer le flux xml
//on definit la progressbar à nb athlete:
progressBar1.Maximum = athlete.Count;
foreach (XmlNode athlete in athletes)//on passe tout les athlete qui sont dans le flux xml
{
name = athlete["name"].InnerText;
client_id = athlete["clientid"].InnerText;
xed(requete_Insertion_xed, bdd, server, utilisateur, pwd);
parc_imprimante(requete_parc_imprimante, bdd, server, utilisateur, pwd);
client_id = recherche_code_client(text, name, bdd, server, utilisateur, pwd); //id athlete |
Partager