Exemple #1
0
        //public void InsertFichier(UtilisateurDB fichier)
        //{

        //    using (DataAccesDataContext dbContext = new DataAccesDataContext())
        //    {
        //        Utilisateur newfichier = new Utilisateur
        //        {
        //            ContentType = fichier.ContentType,
        //            Data = fichier.Data,
        //            Name = fichier.Name,
        //            code_service = fichier.code_service
        //        };
        //        dbContext.fichierService.InsertOnSubmit(newfichier);
        //        dbContext.SubmitChanges();
        //    }

        //}

        public List <destinationDB> GetDestination()
        {
            try
            {
                DataAccesDataContext dbContext = new DataAccesDataContext();
                destinationDB        ls        = new destinationDB();
                var pm = (from c in dbContext.destination
                          join d in dbContext.profil on c.LibelleDest.ToString().Trim() equals d.description_profil.ToString().Trim()

                          select new destinationDB
                {
                    codeDest = c.code_dest,
                    libelleDest = c.LibelleDest,
                    codeProfil = d.code_profil,
                    descriptionProfil = d.description_profil
                });

                return(pm.ToList());
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                return(null);
            }
        }
        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();
        }