protected void BtnRepondre_Click(object sender, EventArgs e) { try { AstreeDonnees a = new AstreeDonnees(); serviceDB reclam = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A" && w.code_service == Convert.ToInt16(myCode.Text)).FirstOrDefault(); DataAccesDataContext dbcontext = new DataAccesDataContext(); if (reclam != null) { if (String.IsNullOrEmpty(message.Text)) { msgerror.Visible = true; msgerror.Text = "veuillez remplir la réponse "; lundi(sender, e); } else { reclam.dateReponse = DateTime.Now; reclam.etat = "V"; reclam.reponse = message.Text; a.maj_reclamation(reclam); message.Text = "écrivez votre réponse ici..."; lundi(sender, e); if (reclam.etatNotif == "") { notificationDB notif = new notificationDB(); notif.codeService = reclam.code_service; notif.contenuNotification = reclam.reponse; notif.etatNotif = "N";// NON LU notif.dateNotification = reclam.dateReponse; a.InsertNotification(notif); } UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <destinationDB> lstDestination = a.GetDestination(); List <serviceDB> lstReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").ToList(); List <serviceDB> lstReclamationFin = new List <serviceDB>(); foreach (serviceDB recl in lstReclamation) { if (lstDestination.Where(w => w.codeDest == recl.codeDest && w.codeProfil == user.code_profil).Count() > 0) { lstReclamationFin.Add(recl); } } lstReclamation = lstReclamationFin; Label y = (Label)Master.FindControl("nbNotification") as Label; Label x = (Label)Master.FindControl("lblNotifReclamation") as Label; x.Text = lstReclamation.Count().ToString(); y.Text = (Convert.ToInt16(y.Text.ToString()) - 1).ToString(); } } } catch (Exception ex) { lundi(sender, e); msgerror.Visible = true; msgerror.Text = "Il n'existe aucunne réclamation selectionner"; } }