Ejemplo n.º 1
0
        //
        // UPDATE
        //
        public bool updateComposant(ComposantsEntity composants)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Composants addComposant = (from c in context.MDR_Composants
                                               where c.Comp_Index == composants.Comp_Index
                                               select c).SingleOrDefault();

                addComposant.Comp_Actif   = composants.Comp_Actif;
                addComposant.Comp_Couleur = composants.Comp_Couleur;
                addComposant.Comp_Nom     = composants.Comp_Nom;
                addComposant.Comp_Type    = composants.Comp_Type;
                addComposant.Comp_Index   = composants.Comp_Index;

                try
                {
                    context.MDR_Composants.Add(addComposant);
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 2
0
        //
        // UPDATE
        //
        public bool updateEtatPaiement(EtatPaiementEntity etat)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Etat_Paiement addEtat = (from e in context.MDR_Etat_Paiement
                                             where e.EPai_Index == etat.EPai_Index
                                             select e).SingleOrDefault();

                addEtat.EPai_Actif = etat.EPai_Actif;
                addEtat.EPai_Date  = etat.EPai_Date;
                addEtat.EPai_Etat  = etat.EPai_Etat;
                addEtat.EPai_Index = etat.EPai_Index;

                try
                {
                    context.MDR_Etat_Paiement.Add(addEtat);
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 3
0
        //
        // Fonction d'update d'un client
        //
        public bool updateClient(ClientEntity client)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Clients updatingClient = (from c in context.MDR_Clients
                                              where c.Cli_Index == client.Cli_Index
                                              select c).SingleOrDefault();

                updatingClient.Cli_Actif   = client.Cli_Actif;
                updatingClient.Cli_Adresse = client.Cli_Adresse;
                updatingClient.Cli_Age     = client.Cli_Age;
                updatingClient.Cli_CP      = client.Cli_CP;
                updatingClient.Cli_Email   = client.Cli_Email;
                updatingClient.Cli_Nom     = client.Cli_Nom;
                updatingClient.Cli_Phone   = client.Cli_Phone;
                updatingClient.Cli_Prenom  = client.Cli_Prenom;
                updatingClient.Cli_Ville   = client.Cli_Ville;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 4
0
        //
        // Fonction de création d'un client
        //
        public bool createClient(ClientEntity client)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Clients addCLient = new MDR_Clients();

                addCLient.Cli_Actif   = 1;
                addCLient.Cli_Adresse = client.Cli_Adresse;
                addCLient.Cli_Age     = client.Cli_Age;
                addCLient.Cli_CP      = client.Cli_CP;
                addCLient.Cli_Email   = client.Cli_Email;
                addCLient.Cli_Nom     = client.Cli_Nom;
                addCLient.Cli_Phone   = client.Cli_Phone;
                addCLient.Cli_Prenom  = client.Cli_Prenom;
                addCLient.Cli_Ville   = client.Cli_Ville;



                try
                {
                    context.MDR_Clients.Add(addCLient);
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 5
0
        //
        // UPDATE
        //
        public bool updateModule(ModulesEntity module)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Modules addModule = (from m in context.MDR_Modules
                                         where m.Mod_Index == module.Mod_Index
                                         select m).SingleOrDefault();

                addModule.Mod_Actif = module.Mod_Actif;
                addModule.Mod_Date  = module.Mod_Date;
                addModule.Mod_Nom   = module.Mod_Nom;
                addModule.Mod_Prix  = module.Mod_Prix;
                addModule.Mod_Index = module.Mod_Index;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 6
0
        //
        //Fonction de création d'un commercial
        //
        public bool createCommercial(CommerciauxEntity commercial)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Commerciaux addCommercial = new MDR_Commerciaux();

                addCommercial.Com_Actif       = 1;
                addCommercial.Com_Identifiant = commercial.Com_Identifiant;
                addCommercial.Com_Mdp         = commercial.Com_Mdp;
                addCommercial.Com_Nom         = commercial.Com_Nom;

                try
                {
                    context.MDR_Commerciaux.Add(addCommercial);
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception

                       e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 7
0
        public static List <ClientEntity> GetSearchAll(string search)
        {
            using (var context = new MADERA_V1Entities())
            {
                var numCount1 =
                    (from c in context.MDR_Clients
                     where c.Cli_Nom.Contains(search) || c.Cli_Prenom.Contains(search) || c.Cli_Email.Contains(search)

                     select new ClientEntity
                {
                    Cli_Index = c.Cli_Index,
                    Cli_Adresse = c.Cli_Adresse,
                    Cli_Age = c.Cli_Age,
                    Cli_CP = c.Cli_CP,
                    Cli_Email = c.Cli_Email,
                    Cli_Nom = c.Cli_Nom,
                    Cli_Phone = c.Cli_Phone,
                    Cli_Prenom = c.Cli_Prenom,
                    Cli_Ville = c.Cli_Ville,
                    Cli_Actif = c.Cli_Actif
                }).ToList();

                context.MDR_Clients.Where(c => c.Cli_Nom.Contains(search)).Select(c => new ClientEntity()
                {
                }).ToList();


                return(numCount1);
            }
        }
Ejemplo n.º 8
0
 //
 // SELECT ALL
 //
 public List <GammesEntity> selectAllGamme()
 {
     using (var context = new MADERA_V1Entities())
     {
         var gamme = (from g in context.MDR_Gammes
                      select new GammesEntity
         {
             Gam_Actif = g.Gam_Actif,
             Gam_Index = g.Gam_Index,
             Gam_Nom = g.Gam_Nom
         }).ToList();
         return(gamme);
     }
 }
Ejemplo n.º 9
0
 //
 // SELECT ALL
 //
 public SitesEntity getAllSitesById(int IdSite)
 {
     using (var context = new MADERA_V1Entities())
     {
         var site = (from s in context.MDR_Sites
                     where s.Sts_Index == IdSite
                     select new SitesEntity
         {
             Sts_Actif = s.Sts_Actif,
             Sts_Index = s.Sts_Index,
             Sts_Ville = s.Sts_Ville
         }).SingleOrDefault();
         return(site);
     }
 }
Ejemplo n.º 10
0
 //
 // SELECT ALL
 //
 public GammesEntity selectAllGamme(int IdGamme)
 {
     using (var context = new MADERA_V1Entities())
     {
         var gamme = (from g in context.MDR_Gammes
                      where g.Gam_Index == IdGamme
                      select new GammesEntity
         {
             Gam_Actif = g.Gam_Actif,
             Gam_Index = g.Gam_Index,
             Gam_Nom = g.Gam_Nom
         }).SingleOrDefault();
         return(gamme);
     }
 }
Ejemplo n.º 11
0
 //
 // SELECT ALL
 //
 public TypesPaiementEntity getAllTypePaiementById(int IdType)
 {
     using (var context = new MADERA_V1Entities())
     {
         var type = (from t in context.MDR_Types_Paiement
                     where t.TPai_Index == IdType
                     select new TypesPaiementEntity
         {
             TPai_Actif = t.TPai_Actif,
             TPai_Index = t.TPai_Index,
             TPai_Nom = t.TPai_Nom
         }).SingleOrDefault();
         return(type);
     }
 }
Ejemplo n.º 12
0
        //
        // SELECT ALL
        //
        public DevisEntity getAllDevisById(int IdDevis)
        {
            using (var context = new MADERA_V1Entities())
            {
                var devis = (from d in context.MDR_Devis
                             where d.Dev_Index == IdDevis
                             select new DevisEntity
                {
                    Dev_Index = d.Dev_Index,
                    Dev_Actif = d.Dev_Actif,
                    Dev_Prix = d.Dev_Prix
                }).SingleOrDefault();

                return(devis);
            }
        }
Ejemplo n.º 13
0
        //
        // Fonction de récupération peu importe actif ou non
        //
        public CommandesEntity getAllCommandeById(int IdCommande)
        {
            using (var context = new MADERA_V1Entities())
            {
                var commande = (from c in context.MDR_Commandes
                                where c.Comma_Index == IdCommande
                                select new CommandesEntity
                {
                    Comma_Index = c.Comma_Index,
                    Comma_Actif = c.Comma_Actif,
                    Comma_Prix = c.Comma_Prix
                }).SingleOrDefault();

                return(commande);
            }
        }
Ejemplo n.º 14
0
        //
        // SELECT ALL
        //
        public ModelesEntity getAllModelesById(int IdModeles)
        {
            using (var context = new MADERA_V1Entities())
            {
                var modele = (from m in context.MDR_Modeles
                              where m.Model_Index == IdModeles
                              select new ModelesEntity
                {
                    Model_Actif = m.Model_Actif,
                    Model_Index = m.Model_Index,
                    Model_Nom = m.Model_Nom
                }).SingleOrDefault();

                return(modele);
            }
        }
Ejemplo n.º 15
0
        //
        // SELECT ALL
        //
        public FournisseursEntity selectAllFournisseur(int IdFournisseur)
        {
            using (var context = new MADERA_V1Entities())
            {
                var fournisseur = (from f in context.MDR_Fournisseurs
                                   where f.Four_Index == IdFournisseur
                                   select new FournisseursEntity
                {
                    Four_Actif = f.Four_Actif,
                    Four_Index = f.Four_Index,
                    Four_Nom = f.Four_Nom
                }).SingleOrDefault();

                return(fournisseur);
            }
        }
Ejemplo n.º 16
0
 //
 // SELECT ALL
 //
 public PaiementEntity getAllPaiementById(int IdPaiement)
 {
     using (var context = new MADERA_V1Entities())
     {
         var paiement = (from p in context.MDR_Paiement
                         where p.Pai_Index == IdPaiement
                         select new PaiementEntity
         {
             Pai_Actif = p.Pai_Actif,
             Pai_Etat = p.Pai_Etat,
             Pai_Index = p.Pai_Index,
             Pai_Type = p.Pai_Type
         }).SingleOrDefault();
         return(paiement);
     }
 }
Ejemplo n.º 17
0
        //
        // SELECT ALL
        //
        public List <ComposantsEntity> getAllComposant()
        {
            using (var context = new MADERA_V1Entities())
            {
                var composant = (from c in context.MDR_Composants
                                 select new ComposantsEntity
                {
                    Comp_Index = c.Comp_Index,
                    Comp_Actif = c.Comp_Actif,
                    Comp_Couleur = c.Comp_Couleur,
                    Comp_Nom = c.Comp_Nom,
                    Comp_Type = c.Comp_Type
                }).ToList();

                return(composant);
            }
        }
Ejemplo n.º 18
0
        //
        // SELECT ALL
        //
        public EtatPaiementEntity getAllEtatPaiement(int IdEtatPaiement)
        {
            using (var context = new MADERA_V1Entities())
            {
                var Etat = (from e in context.MDR_Etat_Paiement
                            where e.EPai_Index == IdEtatPaiement
                            select new EtatPaiementEntity
                {
                    EPai_Actif = e.EPai_Actif,
                    EPai_Date = e.EPai_Date,
                    EPai_Index = e.EPai_Index,
                    EPai_Etat = e.EPai_Etat
                }).SingleOrDefault();

                return(Etat);
            }
        }
Ejemplo n.º 19
0
 //
 // SELECT ACTIVE
 //
 public ModulesEntity getActiveModulesById(int IdModules)
 {
     using (var context = new MADERA_V1Entities())
     {
         var modules = (from m in context.MDR_Modules
                        where m.Mod_Index == IdModules && m.Mod_Actif == 1
                        select new ModulesEntity
         {
             Mod_Actif = m.Mod_Actif,
             Mod_Index = m.Mod_Index,
             Mod_Date = m.Mod_Date,
             Mod_Nom = m.Mod_Nom,
             Mod_Prix = m.Mod_Prix
         }).SingleOrDefault();
         return(modules);
     }
 }
Ejemplo n.º 20
0
        //
        // Fonction de récupération d'une commande par ID (Toutes commandes, même inactives)
        //
        public CommerciauxEntity getAllCommercialById(int IdCommercial)
        {
            using (var context = new MADERA_V1Entities())
            {
                var commercial = (from c in context.MDR_Commerciaux
                                  where c.Com_Index == IdCommercial
                                  select new CommerciauxEntity
                {
                    Com_Actif = c.Com_Actif,
                    Com_Identifiant = c.Com_Identifiant,
                    Com_Index = c.Com_Index,
                    Com_Mdp = c.Com_Mdp,
                    Com_Nom = c.Com_Nom
                }).SingleOrDefault();

                return(commercial);
            }
        }
Ejemplo n.º 21
0
        //
        //Fonction de récupération d'un commercial (Il doit etre actif)
        //
        public CommerciauxEntity getActiveCommercialByEmail(string EmailCommercial)
        {
            using (var context = new MADERA_V1Entities())
            {
                var commercial = (from c in context.MDR_Commerciaux
                                  where c.Com_Identifiant == EmailCommercial && c.Com_Actif == 1
                                  select new CommerciauxEntity
                {
                    Com_Actif = c.Com_Actif,
                    Com_Identifiant = c.Com_Identifiant,
                    Com_Index = c.Com_Index,
                    Com_Mdp = c.Com_Mdp,
                    Com_Nom = c.Com_Nom
                }).SingleOrDefault();

                return(commercial);
            }
        }
Ejemplo n.º 22
0
        //
        // SELECT
        //
        public ComposantsEntity getActiveComposantById(int IdComposants)
        {
            using (var context = new MADERA_V1Entities())
            {
                var composant = (from c in context.MDR_Composants
                                 where c.Comp_Index == IdComposants && c.Comp_Actif == 1
                                 select new ComposantsEntity
                {
                    Comp_Index = c.Comp_Index,
                    Comp_Actif = c.Comp_Actif,
                    Comp_Couleur = c.Comp_Couleur,
                    Comp_Nom = c.Comp_Nom,
                    Comp_Type = c.Comp_Type
                }).SingleOrDefault();

                return(composant);
            }
        }
Ejemplo n.º 23
0
        //
        // DELETE
        //
        public bool disabledPaiement(int IdPaiement)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Paiement addPaiement = (from p in context.MDR_Paiement
                                            where p.Pai_Index == IdPaiement
                                            select p).SingleOrDefault();

                addPaiement.Pai_Actif = 0;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 24
0
        //
        // Fonction de désactivation d'un commercial
        //
        public bool disabledCommercial(int IdCommercial)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Commerciaux updatingCommercial = (from c in context.MDR_Commerciaux
                                                      where c.Com_Index == IdCommercial
                                                      select c).SingleOrDefault();

                updatingCommercial.Com_Actif = 0;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 25
0
        //
        // CREATE
        //
        public bool createGamme(GammesEntity gamme)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Gammes addGamme = new MDR_Gammes();

                addGamme.Gam_Actif = 1;
                addGamme.Gam_Nom   = gamme.Gam_Nom;

                try
                {
                    context.MDR_Gammes.Add(addGamme);
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 26
0
        //
        // DELETE
        //
        public bool deleteDevis(DevisEntity devis)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Devis addDevis = (from d in context.MDR_Devis
                                      where d.Dev_Index == devis.Dev_Index
                                      select d).SingleOrDefault();

                addDevis.Dev_Actif = 0;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 27
0
        //
        // Fonction de suppression d'un client
        //
        public bool disabledClientById(int IdClient)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Clients updatingClient = (from c in context.MDR_Clients
                                              where c.Cli_Index == IdClient
                                              select c).SingleOrDefault();

                updatingClient.Cli_Actif = 0;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 28
0
        //
        // CREATE
        //
        public bool createDevis(DevisEntity devis)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Devis addDevis = new MDR_Devis();

                addDevis.Dev_Actif = devis.Dev_Actif;
                addDevis.Dev_Prix  = devis.Dev_Prix;

                try
                {
                    context.MDR_Devis.Add(addDevis);
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 29
0
        //
        // CREATE
        //
        public bool createSites(SitesEntity site)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Sites addSite = new MDR_Sites();

                addSite.Sts_Actif = 1;
                addSite.Sts_Ville = site.Sts_Ville;

                try
                {
                    context.MDR_Sites.Add(addSite);
                    context.SaveChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 30
0
        //
        // DELETE
        //
        public bool disabledSite(int IdSite)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Sites addSite = (from s in context.MDR_Sites
                                     where s.Sts_Index == IdSite
                                     select s).SingleOrDefault();

                addSite.Sts_Actif = 0;

                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }