protected void Btnreponse_Click(object sender, EventArgs e) { MsgNum.Text = ""; AstreeDonnees a = new AstreeDonnees(); //if (txtetat.Text == "VALIDEE") //{ AstreeDonnees ad = new AstreeDonnees(); if (txtNum.Text != "") { serviceDB ser = a.GetServices().Where(w => w.code_service == Convert.ToInt16(txtNum.Text)).FirstOrDefault(); DetailCommandeDB detailComm = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == 404 && w.code_service == Convert.ToInt16(txtNum.Text) && w.LibelleProduit.Trim() == txtProduit.Text.Trim()).FirstOrDefault(); if (txtQteLivree.Text == "") { txtQteLivree.Text = "Vous devez remplir la quantité à livrée"; } if (detailComm != null) { detailComm.reponse = txtReponse.Text; detailComm.QteLivree = Convert.ToInt16(txtQteLivree.Text); ad.maj_DetailCommande(detailComm); } List <DetailCommandeDB> lstDetailComm = a.GetDetailCommande().Where(w => w.LibelleService.Trim() == "Commande" && w.code_dest == 404 && w.code_service == Convert.ToInt16(txtNum.Text) && w.QteLivree == 0).ToList(); if (ser != null && lstDetailComm.Count == 0) { ser.etat = "V"; ser.dateReponse = DateTime.Now; ser.reponse = txtReponse.Text; ser.code_service = Convert.ToInt16(txtNum.Text); ser.QteLivree = Convert.ToInt16(txtQteLivree.Text); a.maj_Commande(ser); gv_Detail.Visible = false; Label x = (Label)Master.FindControl("lblNotifCommande") as Label; Label y = (Label)Master.FindControl("lblNotifCommandeInterFourn") as Label; Label z = (Label)Master.FindControl("nbNotification") as Label; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A") && w.codeDest == 404).ToList(); x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande" && w.etat.Trim() == "A" && w.codeDest == 404).Count().ToString(); List <serviceDB> lsNotificationFourn = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "V") && w.codeDest != 404 && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); y.Text = lsNotificationFourn.Count().ToString(); z.Text = (Convert.ToInt16(z.Text.ToString()) - 1).ToString(); notificationDB notif = new notificationDB(); notif.codeService = ser.code_service; notif.contenuNotification = ser.reponse; notif.etatNotif = "N";// NON LU notif.dateNotification = ser.dateReponse; a.InsertNotification(notif); // Label x = (Label)Master.FindControl("lblNotifCommande") as Label; // Label y = (Label)Master.FindControl("lblNotifCommandeInterFourn") as Label; //Label z = (Label)Master.FindControl("nbNotification") as Label; //List<serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A") && w.codeDest == 404).ToList(); // x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande" && w.etat.Trim() == "A" && w.codeDest == 404).Count().ToString(); //List<serviceDB> lsNotificationFourn = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "V") && w.codeDest != 404 && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); //y.Text = lsNotificationFourn.Count().ToString(); //z.Text = (Convert.ToInt16(x.Text) + Convert.ToInt16(y.Text)).ToString(); BindGrid(); } } else { MsgNum.Text = "Vous devez séléctionner une commande!"; } // } }