aucune réponse!!! :'(
try { ServiceReferenceEnvoiCommande.Service1 service = new ServiceReferenceEnvoiCommande.Service1(); //service.Open(); ServiceReferenceEnvoiCommande.Commande commandeAenvoyer = new ServiceReferenceEnvoiCommande.Commande(); transmettreProgressBar.Value=40; ServiceReferenceEnvoiCommande.Commande commandeReponse = new ServiceReferenceEnvoiCommande.Commande(); //Recuperer la date de la commande commandeAenvoyer.DateCommande = DateTime.Now; commandeAenvoyer.nbr_Lignes_Commande =int.Parse(dr[0]["nbr_lignes_entete_commande"].ToString()); commandeAenvoyer.nbr_Produits_Commande = iNbreProduit; commandeAenvoyer.codeCommande = dr[0]["id_commande"].ToString(); //recuperer le pharmacien commandeAenvoyer.pharmacien = new ServiceReferenceEnvoiCommande.Pharmacien(); commandeAenvoyer.pharmacien.CodePharmacien = sCodePharmacie; commandeAenvoyer.pharmacien.NomPharmacien = sNomPharmacie; commandeAenvoyer.MedCommandee = new ServiceReferenceEnvoiCommande.Medicament[dr.Length]; transmettreProgressBar.Value=55; for (int i=0;i<dr.Length;i++) { string codeBare = dr[i]["code_bare"].ToString(); if (codeBare == String.Empty || codeBare == null) codeBare = "00000"; long quantitn = Convert.ToInt64(dr[i]["qte_detail_commande"].ToString()); int Quantite = (int)quantitn; if(Quantite>0) // quand la quantité commandée=0, on ne l'envoie pas { commandeAenvoyer.MedCommandee[i] = new ServiceReferenceEnvoiCommande.Medicament(); commandeAenvoyer.MedCommandee[i].ID = dr[i]["ID_ARTICLE"].ToString();; commandeAenvoyer.MedCommandee[i].CodeBarre = codeBare; commandeAenvoyer.MedCommandee[i].Designation =dr[i]["designation_article"].ToString(); commandeAenvoyer.MedCommandee[i].Quantite = Quantite; commandeAenvoyer.MedCommandee[i].PrixVente = float.Parse(dr[i]["prix_vente_detail_commande"].ToString()); } } reponseCommande = service.EnvoyerCommande(commandeAenvoyer);//numero de commande transmettreProgressBar.Value=80; if (int.Parse(reponseCommande) != 0) { Labelreponse.Text = "Votre commande a été enregistrée sous le N° " + reponseCommande; string numeroApprovisionnement=string.Empty; if(DScom!=null) { if(DScom.Tables[0].Rows.Count>0) { if(DScom.Tables[0].Rows.Count==1) { if(DScom.Tables[0].Rows[0]["id_commande"]!=null) { numeroApprovisionnement=DScom.Tables[0].Rows[0]["id_commande"].ToString(); } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionbool error = false; do { try { error = taFonction(); // ou bien tout ton code } catch(Exception e) { // gestion erreur error = true; } } while (error);
il est dans le catch : catch(WebException Wex) { // //prevoir la suppression des produits insérés // MessageBox.Show(Wex.Message); MessageBox.Show("Une erreur s'est produite lors de la transmission. Merci de réessayer."); StreamWriter txt1 = File.AppendText("c:\\Log\\Journal_Erreur.txt"); txt1.WriteLine("\nError :"+DateTime.Now.ToString()+" :"+Wex.Message); txt1.Flush(); txt1.Close(); BtnTransmission.Enabled = true; transmettreProgressBar.Visible=false; error= true; }