protected void gv_Reclamation_SelectedIndexChanged(object sender, EventArgs e) { Btnsave.Visible = false; AstreeDonnees a = new AstreeDonnees(); GridViewRow row = gv_Reclamation.SelectedRow; serviceDB serv = a.GetServices().Where(w => w.code_service == Convert.ToInt32(row.Cells[1].Text)).FirstOrDefault(); UtilisateurDB user = a.GetUser(Convert.ToInt16(serv.codeUtilisateur)); TxtCode.Text = serv.codeUtilisateur.ToString(); List <destinationDB> lstDestination = a.GetDestination(); destinationDB dest = lstDestination.Where(w => w.codeDest == Convert.ToInt16(row.Cells[5].Text.Trim())).FirstOrDefault(); if (dest != null) { ddlDest.SelectedItem.Text = dest.libelleDest; } TxtCommentaire.Text = row.Cells[4].Text.Trim(); notificationDB notif = a.GetNotification().Where(w => w.codeService == serv.code_service).FirstOrDefault(); if (notif != null) { if (notif.etatNotif == "N") { notif.etatNotif = "L"; a.maj_notification(notif); row.ForeColor = System.Drawing.Color.Black; Label x = (Label)Master.FindControl("lblNotifReclamation") as Label; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); x.Text = lsNotification.Where(w => w.libelleService.Trim() == "Reclamation").Count().ToString(); Label nbNotification = (Label)Master.FindControl("nbNotification") as Label; nbNotification.Text = (Convert.ToInt16(nbNotification.Text) - 1).ToString(); } } BindGrid(); }
private void BindGrid() { AstreeDonnees a = new AstreeDonnees(); List <serviceDB> ls = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.codeUtilisateur == Convert.ToInt16(Session["Code_utilisateur"])).OrderBy(w => w.etat).ThenByDescending(w => w.code_service).ToList(); List <destinationDB> lstDestination = a.GetDestination(); foreach (serviceDB serv in ls) { destinationDB dest = lstDestination.Where(w => w.codeDest == serv.codeDest).FirstOrDefault(); if (dest != null) { serv.libelleDest = dest.libelleDest; } } List <serviceDB> lsFin = ls.OrderBy(w => w.etat.Trim()).ThenByDescending(w => w.etatNotif).ThenByDescending(w => w.dateReponse).ToList(); Session["lstReclamation"] = lsFin; gv_Reclamation.DataSource = lsFin; gv_Reclamation.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //li //li AstreeDonnees a = new AstreeDonnees(); List <serviceDB> lsNotification1 = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); liCommandeInter.Visible = false; liCommande.Visible = false; liCommandeFournisseur.Visible = false; accueil.Visible = false; Commande.Visible = false; EnvoiCommande.Visible = false; liCommandeRepondreInter.Visible = false; liCommandeFour.Visible = false; liCommandeRepondreFour.Visible = false; liCommandeConsultInter.Visible = false; liHistorique.Visible = false; liCommandeConsultFour.Visible = false; liDerogation.Visible = false; liEnvoiDero.Visible = false; liafficherDeroInter.Visible = false; liConsulterDero.Visible = false; liafficherDeroGest.Visible = false; Devis.Visible = false; liDemanderDevis.Visible = false; liafficherDevisInter.Visible = false; liTraiterDevis.Visible = false; liaffixherDevisGest.Visible = false; liReclamation.Visible = false; liEnvoyerReclamation.Visible = false; liaffiherReclamation.Visible = false; liConsulterStatistiques.Visible = false; liGestUser.Visible = false; liGestProfil.Visible = false; liGestPermission.Visible = false; //Notification liDevis.Visible = false; //liRepIndermidiaire.Visible = false; liRemise.Visible = false; liProrogatin.Visible = false; liSouscripton.Visible = false; liCommande.Visible = false; liCompteDesactive.Visible = false; liCommandeInter.Visible = false; liCommandeFournisseur.Visible = false; liCommandeInterFourn.Visible = false; liAfficheReclamation.Visible = false; // yjini erreur ! if (Session["code_utilisateur"] == null) { Response.Redirect("login.aspx"); } UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); profilDB P = a.Getprofil(Convert.ToInt32(user.code_profil)); TxtUserProfil.Text = user.Nom_utilisateur; TxtTitre.Text = P.libelle; // if (Session["code_profil"].Equals("101")) //Agent if (user.code_profil == 101) { //Li liConsulterStatistiques.Visible = true; Commande.Visible = true; EnvoiCommande.Visible = true; liCommandeConsultInter.Visible = false; liDerogation.Visible = true; liEnvoiDero.Visible = true; liafficherDeroInter.Visible = false; liReclamation.Visible = true; liEnvoyerReclamation.Visible = true; liDevis.Visible = false; liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; liConsulterStatistiques.Visible = true; liAfficheReclamation.Visible = true; liCommandeInter.Visible = true; // List<notificationDB> lsNotification = a.GetNotification().Where(w => w.etatNotif == "N" && w.codeUtilisateur== Convert.ToInt16(Session["code_utilisateur"])).ToList(); List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); //int nb = lsNotification.Count(); //if (nb>0) { nbNotification.Visible = true; } lblNotifRemise.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 1).Count().ToString(); lblNotifProrogation.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 2).Count().ToString(); lblNotifSouscription.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().ToString(); lblDevis.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().ToString(); lblNotifCommandeInter.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande" && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).Count().ToString(); List <serviceDB> lstNotifReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etatNotif.Trim() == "N" && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); lblNotifReclamation.Text = lstNotifReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblDevis.Text) + Convert.ToInt16(lblNotifRemise.Text) + Convert.ToInt16(lblNotifProrogation.Text) + Convert.ToInt16(lblNotifReclamation.Text) + Convert.ToInt16(lblNotifCommandeInter.Text) + Convert.ToInt16(lblNotifSouscription.Text)).ToString(); } //Courtier else if (user.code_profil == 202) { //LI Commande.Visible = true; EnvoiCommande.Visible = true; liCommandeConsultInter.Visible = false; liDerogation.Visible = true; liEnvoiDero.Visible = true; liafficherDeroInter.Visible = false; Devis.Visible = true; liDemanderDevis.Visible = true; liafficherDevisInter.Visible = false; liReclamation.Visible = true; liEnvoyerReclamation.Visible = true; // notification liCommandeInter.Visible = true; liDevis.Visible = true; liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; liConsulterStatistiques.Visible = false; liAfficheReclamation.Visible = true; nbNotification.Visible = true; // List<notificationDB> lsNotification = a.GetNotification().Where(w => w.etatNotif == "N" && w.codeUtilisateur== Convert.ToInt16(Session["code_utilisateur"])).ToList(); List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etatNotif.Trim() == "N") && (w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); //nbNotification.Text = lsNotification.Count().ToString(); int nb = lsNotification.Count(); if (nb <= 0) { nbNotification.Visible = false; } lblNotifRemise.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 1).Count().ToString(); lblNotifProrogation.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 2).Count().ToString(); lblNotifSouscription.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().ToString(); lblDevis.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().ToString(); lblNotifCommandeInter.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande").Count().ToString(); List <serviceDB> lstNotifReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etatNotif.Trim() == "N" && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); lblNotifReclamation.Text = lstNotifReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblDevis.Text) + Convert.ToInt16(lblNotifRemise.Text) + Convert.ToInt16(lblNotifProrogation.Text) + Convert.ToInt16(lblNotifReclamation.Text) + Convert.ToInt16(lblNotifCommandeInter.Text) + Convert.ToInt16(lblNotifSouscription.Text)).ToString(); } //Fournisseur else if (user.code_profil == 303) { Commande.Visible = true; liCommandeRepondreFour.Visible = true; liCommandeConsultFour.Visible = false; //notification liCommandeFournisseur.Visible = true; liCommandeFournisseur.Visible = true; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.codeDest == Convert.ToInt16(Session["code_utilisateur"]))).ToList(); lsNotification = lsNotification.Where(w => w.etat.Trim() == "A").ToList(); lblNotifCommandeFourn.Text = lsNotification.Where(w => w.libelleService.Trim() == "Commande").Count().ToString(); nbNotification.Text = lsNotification.Count().ToString(); } //Gestionnaire Commande else if (user.code_profil == 404) { //Li Commande.Visible = true; liHistorique.Visible = true; liCommandeFour.Visible = true; liCommandeRepondreInter.Visible = true; liReclamation.Visible = true; liaffiherReclamation.Visible = true; //notification liCommandeInterFourn.Visible = true; liCommandeInter.Visible = false; liCommande.Visible = true; liAfficheReclamation.Visible = true; // List<notificationDB> lsNotification = a.GetNotification().Where(w => w.etatNotif == "N" && w.codeUtilisateur== Convert.ToInt16(Session["code_utilisateur"])).ToList(); List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A") && w.codeDest == 404).ToList(); lblNotifCommande.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.etatNotif.Trim() != "L" && w.codeDest != 404 && w.codeUtilisateur == Convert.ToInt16(Session["code_utilisateur"])).ToList(); lblNotifCommandeInterFourn.Text = lsNotificationFourn.Count().ToString(); //lblNotifCommandeInterFourn.Text = lsNotificationFourn.Where(w => w.libelleService.Trim() == "Commande").Count().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; lblNotifReclamation.Text = lstReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblNotifCommandeInterFourn.Text) + Convert.ToInt16(lblNotifCommande.Text) + Convert.ToInt16(lblNotifReclamation.Text)).ToString(); } //Gestionnaire Devis else if (user.code_profil == 505) { //LI Devis.Visible = true; liTraiterDevis.Visible = true; liaffixherDevisGest.Visible = true; liReclamation.Visible = true; liaffiherReclamation.Visible = true; //notification liDevis.Visible = true; liAfficheReclamation.Visible = true; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A")).ToList(); lblDevis.Text = lsNotification.Where(w => w.libelleService.Trim() == "Devis").Count().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; lblNotifReclamation.Text = lstReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblDevis.Text) + Convert.ToInt16(lblNotifReclamation.Text)).ToString(); } //Gestionnaire Dérogations else if (user.code_profil == 606) { //LI liDerogation.Visible = true; liConsulterDero.Visible = true; liafficherDeroGest.Visible = false; liReclamation.Visible = true; liaffiherReclamation.Visible = true; //notification liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; // IntermidiaireProfil.Visible = true; liRemise.Visible = true; liProrogatin.Visible = true; liSouscripton.Visible = true; liAfficheReclamation.Visible = true; List <serviceDB> lsNotification = a.GetServices().Where(w => (w.libelleService != null) && (w.etat.Trim() == "A")).ToList(); lblNotifRemise.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 1).Count().ToString(); lblNotifProrogation.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 2).Count().ToString(); lblNotifSouscription.Text = lsNotification.Where(w => w.libelleService.Trim() == "Derogation" && w.idType == 3).Count().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; lblNotifReclamation.Text = lstReclamation.Count().ToString(); nbNotification.Text = (Convert.ToInt16(lblNotifReclamation.Text) + Convert.ToInt16(lblNotifRemise.Text) + Convert.ToInt16(lblNotifProrogation.Text) + Convert.ToInt16(lblNotifSouscription.Text)).ToString(); } //Admin else if (user.code_profil == 808) { //LI accueil.Visible = true; liGestUser.Visible = true; liGestProfil.Visible = true; liGestPermission.Visible = true; // IntermidiaireProfil.Visible = true; //notification liCompteDesactive.Visible = true; liGestUser.Visible = true; liGestProfil.Visible = true; List <UtilisateurDB> lsNotification = a.GetUser().Where(w => w.Etat.Trim() == "N").ToList(); nbNotification.Text = lsNotification.Count().ToString(); lblNotifCompteDesactive.Text = lsNotification.Count().ToString(); } }
protected void lundi(object sender, EventArgs e) { AstreeDonnees a = new AstreeDonnees(); List <destinationDB> lstDestination = a.GetDestination(); UtilisateurDB user = a.GetUser(Convert.ToInt16(Session["code_utilisateur"].ToString())); List <serviceDB> lstReclamation = a.GetServices().Where(w => w.libelleService.Trim() == "Reclamation" && w.etat.Trim() == "A").ToList(); DataAccesDataContext dbcontext = new DataAccesDataContext(); 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; int nb = lstReclamation.Count(); nbr.Text = nb.ToString(); var listedemande = from i in dbcontext.service select i.libelleService; //foreach (var Demande in listedemande) int k = 1; foreach (serviceDB Demande in lstReclamation) { string buttonName = "myBtn" + k.ToString(); string dataName = "txtDate" + k.ToString(); Pnl.Controls.Add(GetLiteral("<div class='itemdiv dialogdiv'>")); Pnl.Controls.Add(GetLiteral(" <div class='body'>")); Pnl.Controls.Add(GetLiteral("<br/><div class='name'>")); string Nom = "name_" + Demande.code_service; Pnl.Controls.Add(GetLiteral("<a href=# style='color:blue' id='" + Nom + "'>" + Demande.NomUtilisateur + "</a>")); Pnl.Controls.Add(GetLiteral("</div><br/>")); Pnl.Controls.Add(GetLiteral("<div class='time'> ")); Pnl.Controls.Add(GetLiteral("<i class='ace-icon fa fa-clock-o'></i>")); string date = "txtDate_" + Demande.code_service; Pnl.Controls.Add(GetLiteral("<span id='" + date + "' class='green'>" + Demande.dateDemande + "</span>")); Pnl.Controls.Add(GetLiteral("</div><br/>")); string rec = "txtcontenu_" + Demande.code_service; Pnl.Controls.Add(GetLiteral("<div class='text' id='" + rec + "'> " + Demande.contenuReclamation + "</div>")); Pnl.Controls.Add(GetLiteral("<div class='pull-right'><button id='" + buttonName + "' type='button' class='btn btn-minier btn-info' value='" + Demande.code_service + "' onclick='mercredi(this.value)' ><i class='icon-only ace-icon fa fa-share'></i></button></div>")); Pnl.Controls.Add(GetLiteral("</div></div><br/> <hr/>")); k = k + 1; } }
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"; } }