Example #1
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);
                }
            }
        }
Example #2
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);
                }
            }
        }
Example #3
0
        //
        //Fonction de modification d'un commercial
        //
        public bool updateCommercial(CommerciauxEntity commercial)
        {
            using (var context = new MADERA_V1Entities())
            {
                MDR_Commerciaux updatingCommercial = (from c in context.MDR_Commerciaux
                                                      where c.Com_Index == commercial.Com_Index
                                                      select c).SingleOrDefault();

                updatingCommercial.Com_Identifiant = commercial.Com_Identifiant;
                updatingCommercial.Com_Mdp         = commercial.Com_Mdp;
                updatingCommercial.Com_Nom         = commercial.Com_Nom;

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