Esempio n. 1
0
File: Dal.cs Progetto: lacpat01/pjv
 public int AjouterRepresentant(Representant representant)
 {
     representant.MotDePasse = EncodeMD5(representant.MotDePasse);
     bdd.Representant.Add(representant);
     bdd.SaveChanges();
     return(representant.Id);
 }
Esempio n. 2
0
 public Commande(Magasin magasin, List <ItemCommande> produitsCommande, Representant representant)
 {
     this.DateCommande     = DateTime.Now;
     this.Magasin          = magasin;
     this.ProduitsCommande = produitsCommande;
     this.Representant     = representant;
 }
Esempio n. 3
0
        public bool EnvoyerCourriel(string sujet, string message, Representant rep)
        {
            MailMessage email = new MailMessage();

            email.From = new System.Net.Mail.MailAddress(rep.Courriel);
            email.To.Add(new MailAddress(System.Configuration.ConfigurationManager.AppSettings["courrielPjv"]));
            email.IsBodyHtml = true;

            email.Subject = sujet;
            email.Body    = message;
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
            smtp.Host        = System.Configuration.ConfigurationManager.AppSettings["host"];
            smtp.Port        = int.Parse(System.Configuration.ConfigurationManager.AppSettings["port"]);
            smtp.EnableSsl   = true;
            smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Tableau1!");
            try
            {
                smtp.Send(email);
                return(true);
            }
            catch (SmtpException ex)
            {
                return(false);
            }
        }
Esempio n. 4
0
 public Appel(Representant representant, DateTime dateAppel, Magasin magasin, string nomAppelant, string notesAppel, string departement)
 {
     this.Representant = representant;
     this.DateAppel    = dateAppel;
     this.Magasin      = magasin;
     this.NomAppelant  = nomAppelant;
     this.NotesAppel   = notesAppel;
     this.Departement  = departement;
 }
Esempio n. 5
0
File: Dal.cs Progetto: lacpat01/pjv
        public int AjouterRepresentant(string courriel, string motDePasse)
        {
            string       motDePasseEncode = EncodeMD5(motDePasse);
            Representant representant     = new Representant {
                Courriel = courriel, MotDePasse = motDePasseEncode
            };

            bdd.Representant.Add(representant);
            bdd.SaveChanges();
            return(representant.Id);
        }
Esempio n. 6
0
        protected override void Seed(BddContext context)
        {
            Utilitaires utilitaires = new Utilitaires();

            Representant rep1 = new Representant {
                Id = 1, Courriel = "*****@*****.**", Photo = utilitaires.convertir("C:/pat.png"), Prenom = "Patrick", Nom = "Lachance", MotDePasse = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.Default.GetBytes("Tableau1")))
            };

            context.Representant.Add(rep1);
            Magasin magasin = new Magasin {
                Id = 1, Succursale = "BMR Val D'Or", Numero = 61524563, Region = "Abitibi", Adresse = "1234, Boul, Tremblay, Val-D'Or, GHT 1V8"
            };
            Produit produit = new Produit {
                Id = 1, Code = "A21", Libelle = "Ampoule DEL A21"
            };

            context.Representant.Add(new Representant {
                Id = 2, Courriel = "*****@*****.**", Prenom = "Jeff", Photo = utilitaires.convertir("C:/jeff.png"), Nom = "Léveillé", MotDePasse = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.Default.GetBytes("Bonjour2017")))
            });
            context.Magasins.Add(magasin);
            context.Magasins.Add(new Magasin {
                Id = 2, Succursale = "BMR Val D'Or", Numero = 61524563, Region = "Abitibi", Adresse = "1234, Boul, Tremblay, Val-D'Or, GHT 1V8"
            });
            context.Magasins.Add(new Magasin {
                Id = 3, Succursale = "BMR Québec", Numero = 61524563, Region = "Abitibi", Adresse = "1234, Boul, Tremblay, Val-D'Or, GHT 1V8"
            });
            context.Magasins.Add(new Magasin {
                Id = 4, Succursale = "BMR Château-Richer", Numero = 61524563, Region = "Abitibi", Adresse = "1234, Boul, Tremblay, Val-D'Or, GHT 1V8"
            });

            context.Produits.Add(produit);
            context.Produits.Add(new Produit {
                Id = 2, Code = "A22", Libelle = "Ampoule DEL A22"
            });
            context.Produits.Add(new Produit {
                Id = 3, Code = "A23", Libelle = "Ampoule DEL A23"
            });
            context.Produits.Add(new Produit {
                Id = 4, Code = "A24", Libelle = "Ampoule DEL A24"
            });

            context.LuminairesActuel.Add(new LuminaireActuel {
                Id = 1, IdProduit = 2, IdMagasin = 1, Quantitee = 10
            });

            base.Seed(context);
        }