コード例 #1
0
        public IEnumerable <SelectListItem> GetListRedacteurItem()
        {
            using (var context = new redactapplicationEntities())
            {
                var redacteurs = from c in context.UTILISATEURs
                                 from p in context.UserRoles
                                 where p.idUser == c.userId && p.idRole == 2
                                 orderby c.userNom
                                 select c;

                List <SelectListItem> listredacteur = redacteurs
                                                      .Select(n =>
                                                              new SelectListItem
                {
                    Value = n.userId.ToString(),
                    Text  = n.userNom + " " + n.userPrenom
                }).ToList();
                var redacteurItem = new SelectListItem()
                {
                    Value = null,
                    Text  = "--- selectionner rédacteur ---"
                };
                listredacteur.Insert(0, redacteurItem);
                return(new SelectList(listredacteur, "Value", "Text"));
            }
        }
コード例 #2
0
        public List <FACTUREViewModel> GetListFacture()
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var req = db.FACTUREs.ToList();
            List <FACTUREViewModel> listeFacture = new List <FACTUREViewModel>();

            foreach (var facture in req)
            {
                listeFacture.Add(new FACTUREViewModel()
                {
                    factureId     = facture.factureId,
                    factureNumero = facture.factureNumero,
                    dateEmission  = facture.dateEmission,
                    COMMANDEs     = facture.COMMANDEs,
                    dateDebut     = facture.dateDebut,
                    dateFin       = facture.dateFin,
                    montant       = facture.montant,
                    etat          = facture.etat,
                    periode       = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(facture.dateFin.Month),
                    redacteurId   = facture.redacteurId,
                    REDACTEUR     = db.UTILISATEURs.Find(facture.redacteurId)
                });
            }
            return(listeFacture.OrderBy(x => x.dateEmission).ToList());
        }
コード例 #3
0
        public IEnumerable <SelectListItem> GetListThemeItem(Guid userGuid)
        {
            using (var context = new redactapplicationEntities())
            {
                var listUserTheme = context.REDACT_THEME.AsNoTracking()
                                    .Where(n => n.redactId == userGuid).Select(r => r.themeId).ToList();



                var selected = new[] { listUserTheme };

                List <SelectListItem> listtheme = context.THEMES.AsNoTracking()
                                                  .OrderBy(n => n.theme_name)
                                                  .Select(n =>
                                                          new SelectListItem
                {
                    Value = n.themeId.ToString(),
                    Text  = n.theme_name,
                }).ToList();
                //var themeItem = new SelectListItem()
                //{
                //    Value = null,
                //    Text = "--- selectionner thématique ---"
                //};
                //listtheme.Insert(0, themeItem);
                return(new SelectList(listtheme, "Value", "Text"));
            }
        }
コード例 #4
0
        public TEMPLATEViewModel GetDetailsTemplate(Guid?templateId)
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var template = db.TEMPLATEs.Find(templateId);

            var templateVm = new TEMPLATEViewModel();

            templateVm.dateCreation = template.dateCreation;
            templateVm.projetId     = template.projetId;
            templateVm.PROJET       = template.PROJET;
            templateVm.THEME        = template.THEME;
            templateVm.themeId      = template.themeId;
            templateVm.url          = template.url;
            templateVm.modeleId     = template.modeleId;
            templateVm.templateId   = template.templateId;

            templateVm.MODELE      = template.MODELE;
            templateVm.ftpUser     = template.ftpUser;
            templateVm.ftpPassword = template.ftpPassword;
            templateVm.userId      = template.userId;
            templateVm.UTILISATEUR = template.UTILISATEUR;
            templateVm.html        = template.html;
            templateVm.ip          = template.ip;

            return(templateVm);
        }
コード例 #5
0
        public List <UTILISATEURViewModel> GetListUtilisateur()
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var req = db.UTILISATEURs.ToList();
            List <UTILISATEURViewModel> listeUser = new List <UTILISATEURViewModel>();

            foreach (var user in req)
            {
                string stringRoleUser = this.GetUtilisateurRoleToString(user.userId);
                if (stringRoleUser != "5")
                {
                    listeUser.Add(new UTILISATEURViewModel
                    {
                        userId              = user.userId,
                        userNom             = user.userNom,
                        userPrenom          = user.userPrenom,
                        userMail            = user.userMail,
                        userRole            = stringRoleUser,
                        redactSkype         = user.redactSkype,
                        redactPhone         = user.redactPhone,
                        redactNiveau        = user.redactNiveau,
                        redactModePaiement  = user.redactModePaiement,
                        redactThemes        = user.redactThemes,
                        redactReferenceur   = user.redactReferenceur,
                        redactVolume        = user.redactVolume,
                        redactTarif         = user.redactTarif,
                        redactVolumeRestant = user.redactVolumeRestant
                    });
                }
            }
            return(listeUser.OrderBy(x => x.userNom).ThenBy(x => x.userPrenom).ToList());
        }
コード例 #6
0
        public MODELEViewModel GetMenu2Modele(Guid?modeleId)
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var modele = db.MODELEs.Find(modeleId);

            var modeleVm = new MODELEViewModel();

            modeleVm.modeleId = modele.modeleId;
            modeleVm.logoUrl  = modele.logoUrl;

            modeleVm.menu1_titre = modele.menu1_titre;
            modeleVm.menu2_titre = modele.menu2_titre;
            modeleVm.menu3_titre = modele.menu3_titre;
            modeleVm.menu4_titre = modele.menu4_titre;

            modeleVm.menu1_paragraphe1_titre    = modele.menu1_paragraphe1_titre;
            modeleVm.menu1_paragraphe2_titre    = modele.menu1_paragraphe2_titre;
            modeleVm.menu1_contenu1             = modele.menu1_contenu1;
            modeleVm.menu1_contenu2             = modele.menu1_contenu2;
            modeleVm.menu1_paragraphe1_photoUrl = modele.menu1_paragraphe1_photoUrl;


            modeleVm.photoALaUneUrl = modele.photoALaUneUrl;
            modeleVm.site_url       = modele.site_url;


            return(modeleVm);
        }
コード例 #7
0
        public List <NOTIFICATIONViewModel> GetListNotifications(Guid currentUser)
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var req = db.NOTIFICATIONs.Where(x => x.toId == currentUser && x.statut == true).ToList();
            List <NOTIFICATIONViewModel> listeNotif = new List <NOTIFICATIONViewModel>();

            foreach (var notification in req)
            {
                var fromUtilisateur = this.GetUtilisateur(notification.fromId);
                var toUtilisateur   = this.GetUtilisateur(notification.toId);
                var commande        = this.GetCommande(notification.commandeId);
                listeNotif.Add(new NOTIFICATIONViewModel()
                {
                    notificationId = notification.notificationId,
                    FROMUSER       = fromUtilisateur,
                    fromId         = notification.fromId,
                    TOUSER         = toUtilisateur,
                    toId           = notification.toId,
                    COMMANDE       = commande,
                    commandeId     = notification.commandeId,
                    statut         = notification.statut
                });
            }
            return(listeNotif.OrderBy(x => x.statut).ToList());
        }
コード例 #8
0
        public List <TEMPLATEViewModel> GetListTemplate()
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var req = db.TEMPLATEs.ToList();
            List <TEMPLATEViewModel> listeTemplate = new List <TEMPLATEViewModel>();

            foreach (var template in req)
            {
                listeTemplate.Add(new TEMPLATEViewModel()
                {
                    templateId   = template.templateId,
                    dateCreation = template.dateCreation,
                    projetId     = template.projetId,
                    PROJET       = template.PROJET,
                    THEME        = template.THEME,
                    themeId      = template.themeId,
                    url          = template.url,
                    modeleId     = template.modeleId,
                    MODELE       = template.MODELE,
                    ftpUser      = template.ftpUser,
                    ftpPassword  = template.ftpPassword,
                    userId       = template.userId,
                    UTILISATEUR  = template.UTILISATEUR,
                    html         = template.html,
                    ip           = template.ip
                });
            }
            return(listeTemplate.OrderByDescending(x => x.dateCreation).ToList());
        }
コード例 #9
0
        /// <summary>
        /// Retourne une liste des commandes suivant la recherche.
        /// </summary>
        /// <param name="valeur">chaine de recherche</param>
        /// <returns>List<COMMANDE></returns>
        public List <FACTUREViewModel> FactureSearch(string valeur)
        {
            if (string.IsNullOrEmpty(valeur) || (valeur.Trim() == ""))
            {
                return(null);
            }
            Func <List <FACTUREViewModel>, string, List <FACTUREViewModel> > testFactureContaints = (facturedata, factureValue) =>
            {
                if (facturedata != null)
                {
                    return((from facture in facturedata
                            where (
                                facture.factureNumero.ToString().ToLower().Contains(factureValue.ToLower()) ||
                                facture.dateEmission.ToString().ToLower().Contains(factureValue.ToLower()) ||
                                facture.montant.ToString().ToLower().Contains(factureValue.ToLower()) ||
                                facture.etat.ToString().ToLower().Contains(factureValue.ToLower()) ||
                                facture.periode.ToString().ToLower().Contains(factureValue.ToLower()))
                            select facture).Distinct().OrderBy(x => x.dateEmission).ToList());
                }
                return(null);
            };
            List <string> str  = new List <string>();
            int           test = 0;

            if (valeur.Contains(" "))
            {
                str  = valeur.Split(' ').ToList();
                test = 1;
            }
            redactapplicationEntities db          = new redactapplicationEntities();
            List <FACTUREViewModel>   tempFacture = new List <FACTUREViewModel>();

            foreach (var u in new Factures().GetListFacture())
            {
                var uCommande = db.FACTUREs.FirstOrDefault(x => x.factureId == u.factureId);
                if (uCommande != null)
                {
                    tempFacture.Add(u);
                }
            }

            switch (test)
            {
            case 0:
                return(testFactureContaints(tempFacture, valeur));

            case 1:
                List <FACTUREViewModel> data    = new List <FACTUREViewModel>();
                List <FACTUREViewModel> tempcmd = new List <FACTUREViewModel>();
                foreach (var val in str)
                {
                    data.AddRange(testFactureContaints(tempFacture, val));
                    data.AddRange(tempcmd);
                }
                return(data.Distinct().OrderBy(x => x.dateEmission).ToList());
            }
            return(null);
        }
コード例 #10
0
        public COMMANDEViewModel GetDetailsCommande(Guid?commandeId)
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var commande = db.COMMANDEs.Find(commandeId);


            var referenceur = commande.commandeReferenceurId != null?this.GetUtilisateurReferenceur(commande.commandeReferenceurId) : null;

            var cmdeType = this.GetCommandeType(commande.commandeTypeId);
            //var consigneType = this.GetCommandeContenuType(commande.consigne_type_contenuId);
            var    redacteur  = this.GetUtilisateurReferenceur(commande.commandeRedacteurId);
            string priorite   = commande.ordrePriorite == "0" ? "Moyen" : "Haut";
            var    projet     = GetProjet(commande.commandeProjetId);
            var    theme      = GetTheme(commande.commandeThemeId);
            var    statut     = (!string.IsNullOrEmpty(commande.commandeStatutId.ToString())) ? GetStatutCommande(commande.commandeStatutId) : GetStatutCommande(new Guid());
            string statutcmde = (statut != null) ? statut.statut_cmde : "En attente";
            var    tags       = this.GetCommandeTag(commande.tagId);
            var    site       = this.GetCommandeSite(commande.siteId);
            var    commandeVm = new COMMANDEViewModel();

            commandeVm.commandeId            = commande.commandeId;
            commandeVm.commandeDemandeur     = referenceur.userNom;
            commandeVm.commandeReferenceurId = referenceur.userId;
            commandeVm.commandeRedacteur     = redacteur.userNom;
            commandeVm.commandeRedacteurId   = redacteur.userId;
            commandeVm.date_cmde             = commande.date_cmde;
            commandeVm.date_livraison        = commande.date_livraison;
            commandeVm.commandeType          = cmdeType.Type;
            commandeVm.nombre_mots           = commande.nombre_mots;
            commandeVm.mot_cle_pricipal      = commande.mot_cle_pricipal;
            commandeVm.mot_cle_secondaire    = commande.mot_cle_secondaire;
            commandeVm.consigne_references   = commande.consigne_references;
            commandeVm.texte_ancrage         = commande.texte_ancrage;
            commandeVm.consigne_autres       = commande.consigne_autres;
            commandeVm.etat_paiement         = commande.etat_paiement;
            commandeVm.commandeREF           = commande.commandeREF;
            commandeVm.ordrePriorite         = priorite;
            commandeVm.balise_titre          = commande.balise_titre;
            commandeVm.contenu_livre         = commande.contenu_livre;
            commandeVm.projet           = projet.projet_name;
            commandeVm.commandeProjetId = projet.projetId;
            commandeVm.thematique       = theme.theme_name;
            commandeVm.commandeThemeId  = theme.themeId;
            commandeVm.statut_cmde      = statutcmde;
            commandeVm.tag  = (tags != null) ? tags.type : "";
            commandeVm.site = (site != null) ? site.site_name : "";

            commandeVm.commandeStatutId = commande.commandeStatutId;
            commandeVm.commandeTypeId   = commande.commandeTypeId;

            commandeVm.dateLivraisonReel = commande.dateLivraisonReel;
            commandeVm.remarques         = commande.remarques;

            return(commandeVm);
        }
コード例 #11
0
        public List <COMMANDEViewModel> GetListCommande()
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var req = db.COMMANDEs.ToList();
            List <COMMANDEViewModel> listeCmde = new List <COMMANDEViewModel>();

            foreach (var commande in req)
            {
                var    referenceur = this.GetUtilisateurReferenceur(commande.commandeReferenceurId);
                var    cmdeType    = this.GetCommandeType(commande.commandeTypeId);
                var    tags        = this.GetCommandeTag(commande.tagId);
                var    redacteur   = this.GetUtilisateurReferenceur(commande.commandeRedacteurId);
                string priorite    = commande.ordrePriorite == "0" ? "Moyen" : "Haut";
                var    projet      = GetProjet(commande.commandeProjetId);
                var    theme       = GetTheme(commande.commandeThemeId);
                var    statut      = GetStatutCommande(commande.commandeStatutId);
                var    site        = this.GetCommandeSite(commande.siteId);

                listeCmde.Add(new COMMANDEViewModel()
                {
                    commandeId            = commande.commandeId,
                    commandeDemandeur     = referenceur.userNom,
                    commandeReferenceurId = referenceur.userId,
                    commandeRedacteur     = redacteur.userNom,
                    commandeRedacteurId   = redacteur.userId,
                    date_cmde             = commande.date_cmde,
                    date_livraison        = commande.date_livraison,
                    commandeType          = cmdeType.Type,
                    nombre_mots           = commande.nombre_mots,
                    mot_cle_pricipal      = commande.mot_cle_pricipal,
                    mot_cle_secondaire    = commande.mot_cle_secondaire,
                    consigne_references   = commande.consigne_references,
                    texte_ancrage         = commande.texte_ancrage,
                    consigne_autres       = commande.consigne_autres,
                    etat_paiement         = commande.etat_paiement,
                    commandeREF           = commande.commandeREF,
                    ordrePriorite         = priorite,
                    balise_titre          = commande.balise_titre,
                    contenu_livre         = commande.contenu_livre,
                    projet           = projet.projet_name,
                    thematique       = theme.theme_name,
                    tag              = (tags != null) ? tags.type : "",
                    site             = (site != null) ? site.site_name : "",
                    statut_cmde      = (statut != null) ? statut.statut_cmde : "",
                    commandeThemeId  = commande.commandeThemeId,
                    commandeStatutId = commande.commandeStatutId,
                    commandeTypeId   = commande.commandeTypeId,

                    dateLivraisonReel = commande.dateLivraisonReel,
                    remarques         = commande.remarques
                });
            }
            return(listeCmde.OrderBy(x => x.date_livraison).ToList());
        }
コード例 #12
0
        public void DeleteThemesRedact(REDACT_THEME redactTheme)
        {
            using (var context = new redactapplicationEntities())
            {
                if (redactTheme != null)
                {
                    //context.Entry(redactTheme).State = System.Data.Entity.EntityState.Deleted;
                    context.REDACT_THEME.Remove(redactTheme);

                    context.SaveChanges();
                }
            }
        }
コード例 #13
0
        public IEnumerable <SelectListItem> GetListTagItem(string term)
        {
            using (var context = new redactapplicationEntities())
            {
                var tags = context.TAGS.Where(x => x.type.StartsWith(term));
                List <SelectListItem> listTag = tags
                                                .OrderBy(n => n.type)
                                                .Select(n =>
                                                        new SelectListItem
                {
                    Value = n.tagId.ToString(),
                    Text  = n.type
                }).ToList();

                return(new SelectList(listTag, "Value", "Text"));
            }
        }
コード例 #14
0
        public IEnumerable <SelectListItem> GetListSitetem(string term)
        {
            using (var context = new redactapplicationEntities())
            {
                var sites = context.SITES.Where(x => x.site_name.StartsWith(term));
                List <SelectListItem> listSite = sites
                                                 .OrderBy(n => n.site_name)
                                                 .Select(n =>
                                                         new SelectListItem
                {
                    Value = n.siteId.ToString(),
                    Text  = n.site_name
                }).ToList();

                return(new SelectList(listSite, "Value", "Text"));
            }
        }
コード例 #15
0
        public IEnumerable <SelectListItem> GetListThemeItem(string term)
        {
            using (var context = new redactapplicationEntities())
            {
                var theme = context.THEMES.Where(x => x.theme_name.StartsWith(term));
                List <SelectListItem> listtheme = theme
                                                  .OrderBy(n => n.theme_name)
                                                  .Select(n =>
                                                          new SelectListItem
                {
                    Value = n.themeId.ToString(),
                    Text  = n.theme_name
                }).ToList();

                return(new SelectList(listtheme, "Value", "Text"));
            }
        }
コード例 #16
0
 public IEnumerable <SelectListItem> GetListRedacteurItem()
 {
     using (var context = new redactapplicationEntities())
     {
         List <SelectListItem> listredacteur = context.UTILISATEURs.AsNoTracking()
                                               .OrderBy(n => n.userNom)
                                               .Select(n =>
                                                       new SelectListItem
         {
             Value = n.userId.ToString(),
             Text  = n.userNom
         }).ToList();
         var redacteurItem = new SelectListItem()
         {
             Value = null,
             Text  = "--- selectionner rédacteur ---"
         };
         listredacteur.Insert(0, redacteurItem);
         return(new SelectList(listredacteur, "Value", "Text"));
     }
 }
コード例 #17
0
 public IEnumerable <SelectListItem> GetListContenuTypeItem()
 {
     using (var context = new redactapplicationEntities())
     {
         List <SelectListItem> listcontenutype = context.CONTENU_TYPE.AsNoTracking()
                                                 .OrderBy(n => n.Type)
                                                 .Select(n =>
                                                         new SelectListItem
         {
             Value = n.contenuTypeId.ToString(),
             Text  = n.Type
         }).ToList();
         var typeItem = new SelectListItem()
         {
             Value = null,
             Text  = "--- selectionner type de contenu ---"
         };
         listcontenutype.Insert(0, typeItem);
         return(new SelectList(listcontenutype, "Value", "Text"));
     }
 }
コード例 #18
0
 public IEnumerable <SelectListItem> GetListThemeItem()
 {
     using (var context = new redactapplicationEntities())
     {
         List <SelectListItem> listtheme = context.THEMES.AsNoTracking()
                                           .OrderBy(n => n.theme_name)
                                           .Select(n =>
                                                   new SelectListItem
         {
             Value = n.themeId.ToString(),
             Text  = n.theme_name
         }).ToList();
         var themeItem = new SelectListItem()
         {
             Value = null,
             Text  = "--- selectionner thématique ---"
         };
         listtheme.Insert(0, themeItem);
         return(new SelectList(listtheme, "Value", "Text"));
     }
 }
コード例 #19
0
 public IEnumerable <SelectListItem> GetListStatutItem()
 {
     using (var context = new redactapplicationEntities())
     {
         List <SelectListItem> listcontenutype = context.STATUT_COMMANDE.AsNoTracking()
                                                 .OrderBy(n => n.statut_cmde)
                                                 .Select(n =>
                                                         new SelectListItem
         {
             Value = n.statutCommandeId.ToString(),
             Text  = n.statut_cmde
         }).ToList();
         var typeItem = new SelectListItem()
         {
             Value = null,
             Text  = "--- selectionner type de statut ---"
         };
         listcontenutype.Insert(0, typeItem);
         return(new SelectList(listcontenutype, "Value", "Text"));
     }
 }
コード例 #20
0
 public IEnumerable <SelectListItem> GetListProjetItem()
 {
     using (var context = new redactapplicationEntities())
     {
         List <SelectListItem> listprojet = context.PROJETS.AsNoTracking()
                                            .OrderBy(n => n.projet_name)
                                            .Select(n =>
                                                    new SelectListItem
         {
             Value = n.projetId.ToString(),
             Text  = n.projet_name
         }).ToList();
         var projetItem = new SelectListItem()
         {
             Value = null,
             Text  = "--- selectionner projet ---"
         };
         listprojet.Insert(0, projetItem);
         return(new SelectList(listprojet, "Value", "Text"));
     }
 }
コード例 #21
0
        public FACTUREViewModel GetDetailsFacture(Guid?factureId)
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var facture = db.FACTUREs.Find(factureId);

            var factureVm = new FACTUREViewModel();

            factureVm.factureId     = facture.factureId;
            factureVm.factureNumero = facture.factureNumero;
            factureVm.dateEmission  = facture.dateEmission;
            factureVm.COMMANDEs     = facture.COMMANDEs;
            factureVm.dateDebut     = facture.dateDebut;
            factureVm.dateFin       = facture.dateFin;
            factureVm.montant       = facture.montant;
            factureVm.etat          = facture.etat;
            factureVm.redacteurId   = facture.redacteurId;
            factureVm.REDACTEUR     = db.UTILISATEURs.Find(facture.redacteurId);
            factureVm.createurId    = facture.createurId;
            factureVm.periode       = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(facture.dateFin.Month);


            return(factureVm);
        }
コード例 #22
0
        /// <summary>
        /// Retourne une liste d'utilisateur suivant la recherche.
        /// </summary>
        /// <param name="valeur">chaine de recherche</param>
        /// <returns>List<UTILISATEUR></returns>
        public List <UTILISATEUR> UserSearch(string valeur)
        {
            if (string.IsNullOrEmpty(valeur) || (valeur.Trim() == ""))
            {
                return(null);
            }
            Func <List <UTILISATEUR>, string, List <UTILISATEUR> > testUserContaints = (userdata, userValue) =>
            {
                if (userdata != null)
                {
                    return((from user in userdata
                            where (user.userNom.ToLower().Contains(userValue.ToLower()) ||
                                   user.userPrenom.ToLower().Contains(userValue.ToLower()) ||
                                   user.userMail.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactSkype.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactModePaiement.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactNiveau.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactPhone.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactReferenceur.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactThemes.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactVolume.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactTarif.ToLower().Contains(userValue.ToLower()) ||
                                   user.redactVolumeRestant.ToLower().Contains(userValue.ToLower())

                                   )
                            select user).Distinct().OrderBy(x => x.userNom).ThenBy(x => x.redactSkype).ToList());
                }
                return(null);
            };
            List <string> str  = new List <string>();
            int           test = 0;

            if (valeur.Contains(" "))
            {
                str  = valeur.Split(' ').ToList();
                test = 1;
            }
            redactapplicationEntities db       = new redactapplicationEntities();
            List <UTILISATEUR>        tempUser = new List <UTILISATEUR>();

            foreach (var u in db.UTILISATEURs.ToList())
            {
                var uRole = db.UserRoles.FirstOrDefault(x => x.idUser == u.userId);
                if (uRole != null && uRole.idRole != 5)
                {
                    tempUser.Add(u);
                }
            }
            switch (test)
            {
            case 0:
                return(testUserContaints(tempUser, valeur));

            case 1:
                List <UTILISATEUR> data = new List <UTILISATEUR>();
                List <UTILISATEUR> temp = new List <UTILISATEUR>();
                foreach (var val in str)
                {
                    data.AddRange(testUserContaints(tempUser, val));
                    data.AddRange(temp);
                }
                return(data.Distinct().OrderBy(x => x.userNom).ThenBy(x => x.redactSkype).ToList());
            }
            return(null);
        }
コード例 #23
0
        /// <summary>
        /// Retourne une liste des commandes suivant la recherche.
        /// </summary>
        /// <param name="valeur">chaine de recherche</param>
        /// <returns>List<COMMANDE></returns>
        public List <COMMANDE> CommandesSearch(string valeur)
        {
            if (string.IsNullOrEmpty(valeur) || (valeur.Trim() == ""))
            {
                return(null);
            }
            Func <List <COMMANDE>, string, List <COMMANDE> > testCommandeContaints = (cmdedata, userValue) =>
            {
                if (cmdedata != null)
                {
                    return((from cmde in cmdedata
                            where (
                                cmde.date_cmde.ToString().ToLower().Contains(userValue.ToLower()) ||
                                cmde.date_livraison.ToString().ToLower().Contains(userValue.ToLower()) ||
                                cmde.ordrePriorite.ToString().ToLower().Contains(userValue.ToLower()))
                            select cmde).Distinct().OrderBy(x => x.date_cmde).ThenBy(x => x.date_livraison).ToList());
                }
                return(null);
            };
            List <string> str  = new List <string>();
            int           test = 0;

            if (valeur.Contains(" "))
            {
                str  = valeur.Split(' ').ToList();
                test = 1;
            }
            redactapplicationEntities db       = new redactapplicationEntities();
            List <COMMANDE>           tempCmde = new List <COMMANDE>();

            foreach (var u in db.COMMANDEs.ToList())
            {
                var uDEmandeur = db.UTILISATEURs.FirstOrDefault(x => x.userId == u.commandeReferenceurId);
                if (uDEmandeur != null)
                {
                    tempCmde.Add(u);
                }

                var uRedacteur = db.UTILISATEURs.FirstOrDefault(x => x.userId == u.commandeRedacteurId);
                if (uRedacteur != null)
                {
                    tempCmde.Add(u);
                }

                var uProjet = db.PROJETS.FirstOrDefault(x => x.projetId == u.commandeProjetId);
                if (uProjet != null)
                {
                    tempCmde.Add(u);
                }
                var uTheme = db.THEMES.FirstOrDefault(x => x.themeId == u.commandeThemeId);
                if (uTheme != null)
                {
                    tempCmde.Add(u);
                }

                var uCommandeType = db.COMMANDE_TYPE.FirstOrDefault(x => x.commandeTypeId == u.commandeTypeId);
                if (uCommandeType != null)
                {
                    tempCmde.Add(u);
                }

                var uStatutCmde = db.STATUT_COMMANDE.FirstOrDefault(x => x.statutCommandeId == u.commandeStatutId);
                if (uStatutCmde != null)
                {
                    tempCmde.Add(u);
                }
            }

            switch (test)
            {
            case 0:
                return(testCommandeContaints(tempCmde, valeur));

            case 1:
                List <COMMANDE> data    = new List <COMMANDE>();
                List <COMMANDE> tempcmd = new List <COMMANDE>();
                foreach (var val in str)
                {
                    data.AddRange(testCommandeContaints(tempCmde, val));
                    data.AddRange(tempcmd);
                }
                return(data.Distinct().OrderBy(x => x.date_cmde).ThenBy(x => x.date_livraison).ToList());
            }
            return(null);
        }
コード例 #24
0
        public MODELEViewModel GetDetailsModele(Guid?modeleId)
        {
            redactapplicationEntities db = new redactapplicationEntities();
            var modele = db.MODELEs.Find(modeleId);

            var modeleVm = new MODELEViewModel();

            modeleVm.modeleId                   = modele.modeleId;
            modeleVm.logoUrl                    = modele.logoUrl;
            modeleVm.menu1_titre                = modele.menu1_titre;
            modeleVm.menu2_titre                = modele.menu2_titre;
            modeleVm.menu3_titre                = modele.menu3_titre;
            modeleVm.menu4_titre                = modele.menu4_titre;
            modeleVm.menu1_paragraphe1_titre    = modele.menu1_paragraphe1_titre;
            modeleVm.menu1_paragraphe2_titre    = modele.menu1_paragraphe2_titre;
            modeleVm.menu1_contenu1             = modele.menu1_contenu1;
            modeleVm.menu1_contenu2             = modele.menu1_contenu2;
            modeleVm.menu1_paragraphe1_photoUrl = modele.menu1_paragraphe1_photoUrl;
            modeleVm.menu1_paragraphe2_photoUrl = modele.menu1_paragraphe2_photoUrl;
            modeleVm.menu2_paragraphe1_titre    = modele.menu2_paragraphe1_titre;
            modeleVm.menu2_paragraphe2_titre    = modele.menu2_paragraphe2_titre;
            modeleVm.menu2_contenu1             = modele.menu2_contenu1;
            modeleVm.menu2_contenu2             = modele.menu2_contenu2;
            modeleVm.menu2_paragraphe1_photoUrl = modele.menu2_paragraphe1_photoUrl;
            modeleVm.menu2_paragraphe2_photoUrl = modele.menu2_paragraphe2_photoUrl;
            modeleVm.menu3_paragraphe1_titre    = modele.menu3_paragraphe1_titre;
            modeleVm.menu3_paragraphe2_titre    = modele.menu3_paragraphe2_titre;
            modeleVm.menu3_contenu1             = modele.menu3_contenu1;
            modeleVm.menu3_contenu2             = modele.menu3_contenu2;
            modeleVm.menu3_paragraphe1_photoUrl = modele.menu3_paragraphe1_photoUrl;
            modeleVm.menu3_paragraphe2_photoUrl = modele.menu3_paragraphe2_photoUrl;
            modeleVm.menu4_paragraphe1_titre    = modele.menu4_paragraphe1_titre;
            modeleVm.menu4_paragraphe2_titre    = modele.menu4_paragraphe2_titre;
            modeleVm.menu4_contenu1             = modele.menu4_contenu1;
            modeleVm.menu4_contenu2             = modele.menu4_contenu2;
            modeleVm.menu4_paragraphe1_photoUrl = modele.menu4_paragraphe1_photoUrl;
            modeleVm.menu4_paragraphe2_photoUrl = modele.menu4_paragraphe2_photoUrl;

            modeleVm.photoALaUneUrl = modele.photoALaUneUrl;
            modeleVm.site_url       = modele.site_url;
            modeleVm.domaine        = ExtractDomainName(modele.site_url);

            modeleVm.menu1_meta_description = modele.menu1_meta_description;
            modeleVm.menu2_meta_description = modele.menu2_meta_description;
            modeleVm.menu3_meta_description = modele.menu3_meta_description;
            modeleVm.menu4_meta_description = modele.menu4_meta_description;

            modeleVm.menu1_paragraphe1_alt = modele.menu1_p1_alt;
            modeleVm.menu1_paragraphe2_alt = modele.menu1_p2_alt;
            modeleVm.menu2_paragraphe1_alt = modele.menu2_p1_alt;
            modeleVm.menu2_paragraphe2_alt = modele.menu2_p2_alt;
            modeleVm.menu3_paragraphe1_alt = modele.menu3_p1_alt;
            modeleVm.menu3_paragraphe2_alt = modele.menu3_p2_alt;
            modeleVm.menu4_paragraphe1_alt = modele.menu4_p1_alt;
            modeleVm.menu4_paragraphe2_alt = modele.menu4_p2_alt;

            modeleVm.menu1_meta_description = modele.menu1_meta_description;
            modeleVm.menu2_meta_description = modele.menu2_meta_description;
            modeleVm.menu3_meta_description = modele.menu3_meta_description;
            modeleVm.menu4_meta_description = modele.menu4_meta_description;
            modeleVm.favicone = modele.favicone;

            return(modeleVm);
        }