Пример #1
0
        public bool InsertEncounter(EncounterModel em)
        {
            //Mappers
            EncounterEntity ee = new EncounterEntity();

            ee.Id         = em.Id;
            ee.Name       = em.Name;
            ee.IdInstance = em.IdInstance;
            ee.Media      = em.Media;

            return(_encounterRepo.Insert(ee));
        }
Пример #2
0
        public bool SaveBien(BienModel bm)
        {
            //MAppers
            BienEntity be = new BienEntity();

            be.Titre      = bm.Titre;
            be.DescCourte = bm.DescCourte;
            be.DescLong   = bm.DescLong;
            be.Photo      = bm.Photo;
            be.Pays       = bm.Pays;



            //int idBien = 0;
            //bool test = ((BienRepository)_bienRepo).InsertWithId(be, out idBien);
            //if (test)
            //{
            //    bm.IdBien = idBien;

            //    return ((PaysRepository)_paysRepo).InsertFromProject(bm.Pays, idBien);
            //}
            //else
            //    return false;

            return(_bienRepo.Insert(be));
        }
Пример #3
0
        public bool SaveCard(CardModel card)
        {
            //Je dois traiter separement les deux insert d'availability et du card???


            CardEntity ce = new CardEntity();

            ce.IdUser      = card.IdUser;
            ce.IdDance     = card.IdDance;
            ce.IdLevel     = card.IdLevel;
            ce.IdObjective = card.IdObjective;
            ce.IdRole      = card.IdRole;
            ce.IdCity      = card.IdCity;
            ce.Nickname    = card.Nickname;
            ce.Comment     = card.Comment;
            return(_cardRepository.Insert(ce));

            //Solution 1  - Creer une nouvelle methode insert permettant de recevoir l idDance apres insertion dans la db
            //Solution 2  - creer une procedure stockee qui va inserer la card et l avaibility
            //List<AvailabilityEntity> la = new List<AvailabilityEntity>();
            //foreach (AvailabilityEntity item1 in la)
            //{
            //    AvailabilityEntity ae = new AvailabilityEntity();
            //    ae.IdDancer = card.Availabilities[count].IdDancer;
            //    ae.Day = card.Availabilities[count].Day;
            //    ae.StartTime = card.Availabilities[count].StartTime;  //Comment va reconannitre qu'il s'agit du format (hh:mm)???  car le type dans le table est time
            //    ae.EndTime = card.Availabilities[count].EndTime;
            //    count++;
            //    _availabilityRepository.Insert(ae);
            //}
        }
Пример #4
0
        public bool AjouterBien(BienAEchangerModel bm, int idmembre)
        { //todo: l'assurance est toujours en false alors qu'elle devrait dépendre de la checkbox
            BienEchangeEntity be = new BienEchangeEntity()
            {
                Titre        = bm.Titre,
                DescCourte   = bm.DescCourte,
                DescLong     = bm.DescLongue,
                NombrePerson = bm.NombrePersonne,
                Pays         = bm.Pays,
                Ville        = bm.Ville,
                Rue          = bm.Rue,
                Numero       = bm.Numero,
                CodePostal   = bm.CodePostal,
                // todo: mettre en place l'upload
                Photo = "photopardefaut.jpg",
                AssuranceObligatoire = bm.AssuranceObligatoire,
                IsEnabled            = true,
                // todo: devrait être null
                DisabledDate = DateTime.Now,
                Latitude     = bm.Latitude,
                Longitude    = bm.Longitude,
                IdMembre     = idmembre,
                DateCreation = DateTime.Now,
            };

            return(_bienEchangeRepo.Insert(be));
        }
Пример #5
0
        //version foreach

        /*List<PaysEntity> ListePaysFromDB = _paysRepo.Get();
         *  List<PaysModel> ListePaysForCtrl = new List<PaysModel>();
         *
         *  foreach (PaysEntity pe in ListePaysFromDB)
         *  {
         *      PaysModel pm = new PaysModel();
         *      pm.IdPays = pe.IdPays;
         *      pm.NomPays = pe.Libelle;
         *      ListePaysForCtrl.Add(pm);
         *  }
         *  return ListePaysForCtrl;*/


        // ajouter un bien
        public bool AddBien(AjoutBienModel abm)
        {
            MembreModel     owner = (MembreModel)HttpContext.Current.Session["ConnectedUser"];
            AjoutBienEntity abe   = new AjoutBienEntity();

            //mapping partie Bien
            abe.Titre        = abm.Titre;
            abe.DescCourte   = abm.DescCourte;
            abe.DescLong     = abm.DescLong;
            abe.Numero       = abm.Numero;
            abe.Rue          = abm.Rue;
            abe.CodePostal   = abm.CodePostal;
            abe.Ville        = abm.Ville;
            abe.Pays         = abm.Pays;
            abe.NombrePerson = abm.NombrePerson;
            abe.NbrSBD       = abm.NbrSBD;
            abe.NbrWC        = abm.NbrWC;
            abe.IdMembre     = owner.IdMembre;
            if (abm.Latitude is null)
            {
                abe.Latitude = "000000000";
            }
            else
            {
                abe.Latitude = abm.Latitude;
            }

            if (abm.Longitude is null)
            {
                abe.Longitude = "000000000";
            }
            else
            {
                abe.Longitude = abm.Longitude;
            }

            if (abm.Photo is null)
            {
                abe.Photo = "pas de photo disponible";
            }
            else
            {
                abe.Photo = abm.Photo;
            }


            //je traiterai les options plus tard

            /*//mapping partie OptionBien
             * abe.ListeOption = new List<OptionEntity>();
             * foreach (OptionModel item in abm.ListeIdOption)
             * {
             *  OptionEntity option = new OptionEntity();
             *  option.IdOption = item.IdOption;
             *  option.Libelle = item.Libelle;
             *  abe.ListeOption.Add(option);
             * }*/
            return(_ajoutBienRepo.Insert(abe));
        }
Пример #6
0
        public bool SaveSignUp(SignUpModel sm)
        {
            UserClientEntity signUp = new UserClientEntity();

            //signUp.Rue = sm.Rue;
            //signUp.Numero = sm.Numero;
            //signUp.Ville = sm.Ville;
            //signUp.CodePostal = sm.CodePostal;
            signUp.Nom             = sm.Nom;
            signUp.Prenom          = sm.Prenom;
            signUp.Email           = sm.Email;
            signUp.DateDeNaissance = sm.DateDeNaissance;
            signUp.Password        = sm.Password;
            signUp.Login           = sm.Login;


            return(_userRepository.Insert(signUp));
        }
Пример #7
0
        public bool SaveMessage(SendMessageModel send)
        {
            SendMessageEntity se = new SendMessageEntity();

            se.IdUserFrom = send.IdUserFrom;
            se.IdUserTo   = send.IdUserTo;
            se.Text       = send.Text;
            return(_sendMessageRepository.Insert(se));
        }
Пример #8
0
        public bool SaveContact(ContactModel cm)
        {
            MessageEntity me = new MessageEntity();

            me.Nom         = cm.Nom;
            me.Email       = cm.Email;
            me.Sujet       = cm.Sujet;
            me.Information = cm.Message;
            return(_messageRepo.Insert(me));
        }
Пример #9
0
        public bool InsertEncounterItem(EncounterItemModel em)
        {
            //Mappers
            EncounterItemEntity ee = new EncounterItemEntity();

            ee.IdEncounter = em.IdEncounter;
            ee.IdItem      = em.IdItem;

            return(_encounterItemRepo.Insert(ee));
        }
Пример #10
0
        public bool SaveContact(ContactModel cm)
        {
            MessageEntity me = new MessageEntity();

            me.Prenom  = cm.Prenom;
            me.Nom     = cm.Nom;
            me.Email   = cm.Email;
            me.Message = cm.Message;

            return(_messageRepo.Insert(me));
        }
Пример #11
0
        public bool CreateMembre(MembreModel um)
        {
            MembreEntity membreEntity = new MembreEntity()
            {
                Name      = um.Name,
                FirstName = um.FirstName,
                Email     = um.Email,
                Password  = um.Password
            };

            return(_membreRepo.Insert(membreEntity));
        }
Пример #12
0
        public bool CreateClient(ClientModel cm)
        {
            ClientEntity clientEntity = new ClientEntity()
            {
                Prenom   = cm.Prenom,
                Nom      = cm.Nom,
                Email    = cm.Email,
                Password = cm.Password,
            };

            return(_clientRepo.Insert(clientEntity));
        }
Пример #13
0
        public bool SaveContact(ContactModel cm)
        {
            //MAppers
            MessageEntity me = new MessageEntity();

            me.Nom         = cm.Nom;
            me.Email       = cm.Email;
            me.Information = cm.Message;
            me.Phone       = cm.Phone;

            return(_messageRepository.Insert(me));
        }
Пример #14
0
        public bool SaveSignUp(MembreModel mm)
        {
            MembreEntity me = new MembreEntity();

            me.Nom       = mm.Nom;
            me.Prenom    = mm.Prenom;
            me.Email     = mm.Email;
            me.Pays      = mm.Pays;
            me.Telephone = mm.Telephone;
            me.Login     = mm.Login;
            me.Password  = mm.Password;
            return(_membreRepo.Insert(me));
        }
Пример #15
0
        public bool SaveContact(ContactModel cm)
        {
            //MAppers
            MessageEntity me = new MessageEntity();

            me.Nom         = cm.Nom;
            me.Email       = cm.Email;
            me.Telephone   = cm.Telephone;
            me.Information = cm.Information;


            return(_messRepo.Insert(me));
        }
Пример #16
0
        public bool InsertInstance(InstanceModel im)
        {
            //Mappers
            InstanceEntity ie = new InstanceEntity();

            ie.Id          = im.Id;
            ie.Name        = im.Name;
            ie.Type        = im.Type;
            ie.Location    = im.Location;
            ie.Media       = im.Media;
            ie.Description = im.Description;

            return(_instanceRepo.Insert(ie));
        }
Пример #17
0
        public bool SaveSignUp(RegisterModel rm, PaysListModel plm)
        {
            RegisterEntity r = new RegisterEntity();

            r.Nom       = rm.Nom;
            r.Prenom    = rm.Prenom;
            r.Email     = rm.Email;
            r.Login     = rm.Login;
            r.Password  = rm.Password;
            r.Telephone = rm.Telephone;
            r.IdPays    = plm.IdPays;
            r.IdMembre  = rm.IdMembre;
            return(_registerRepo.Insert(r));
        }
Пример #18
0
        public bool CreateMember(MembreModel mm)
        {
            MembreEntity me = new MembreEntity()
            {
                Nom       = mm.Nom,
                Prenom    = mm.Prenom,
                Login     = mm.Login,
                Password  = mm.Password,
                Email     = mm.Email,
                Telephone = mm.Telephone,
                Pays      = mm.Pays,
            };

            return(_membreRepo.Insert(me));
        }
Пример #19
0
        public bool InsertItem(ItemModel im)
        {
            //Mappers
            ItemEntity ie = new ItemEntity();

            ie.Id           = im.Id;
            ie.Name         = im.Name;
            ie.Type         = im.Type;
            ie.SubType      = im.SubType;
            ie.CreatureName = im.CreatureName;
            ie.Icon         = im.Icon;
            ie.Media        = im.Media;


            return(_itemRepo.Insert(ie));
        }
Пример #20
0
        public bool SaveSignUp(SignUpModel sm)
        {
            SignUpEntity signUp = new SignUpEntity();

            signUp.Rue       = sm.Rue;
            signUp.Numero    = sm.Numero;
            signUp.Ville     = sm.Ville;
            signUp.CP        = sm.CP;
            signUp.Nom       = sm.Nom;
            signUp.Prenom    = sm.Prenom;
            signUp.Email     = sm.Email;
            signUp.DateNaiss = sm.DateNaiss;
            signUp.Photo     = sm.Photo;
            signUp.Password  = sm.Password;
            signUp.Login     = sm.Login;
            signUp.Telephone = sm.Telephone;

            return(_signUpRepo.Insert(signUp));
        }
Пример #21
0
        public bool InsertProduct(ProfilModel pf)
        {
            DonateProductEntity dpe = new DonateProductEntity();

            dpe.IdUtilisateur  = pf.IdUser;
            dpe.IdAdresse      = pf.IdAdresse;
            dpe.Quantite       = pf.DonateProduct.Quantite;
            dpe.IdType         = pf.DonateProduct.IdType;
            dpe.NameProduct    = pf.DonateProduct.Nom;
            dpe.Bio            = pf.DonateProduct.Bio;
            dpe.DatePeremption = pf.DonateProduct.DatePeremption;
            dpe.Description    = pf.DonateProduct.Description;
            dpe.LabelEtat      = pf.DonateProduct.Etat;
            dpe.Pays           = pf.DonateProduct.Pays;
            dpe.NomMarque      = pf.DonateProduct.Marque;


            return(_donateProductRepo.Insert(dpe));
        }
Пример #22
0
        public bool SaveSignUp(SignUpModel sm)
        {
            MembreEntity signUp = new MembreEntity();

            //signUp.Rue = sm.Rue;
            //signUp.Numero = sm.Numero;
            //signUp.Ville = sm.Ville;
            //signUp.CodePostal = sm.CodePostal;
            signUp.Nom       = sm.Nom;
            signUp.Prenom    = sm.Prenom;
            signUp.Email     = sm.Email;
            signUp.Pays      = sm.Pays;
            signUp.Telephone = sm.Telephone;
            signUp.Login     = sm.Login;
            signUp.Password  = sm.Password;



            return(_membreRepo.Insert(signUp));
        }
Пример #23
0
        public bool SaveUser(UserModel user)
        {
            //string uniqueFileName = UploadedFile(user);

            //    byte[] salt;
            //new rngcryptoserviceprovider().getbytes(salt = new byte[16]);
            //var pbkdf2 = new rfc2898derivebytes(password, salt, 100000);
            //byte[] hash = pbkdf2.getbytes(20);
            //byte[] hashbytes = new byte[36];
            //array.copy(salt, 0, hashbytes, 0, 16);
            //    array.copy(hash, 0, hashbytes, 16, 20);
            //    string savedpasswordhash = convert.tobase64string(hashbytes);

            SP_UserEntity us = new SP_UserEntity();

            us.Name     = user.Name;
            us.LastName = user.LastName;
            us.Email    = user.Email;
            us.Password = user.Password;  //comme je peux le convertir bit | string
            us.Image    = user.Image;
            return(_spUserRepository.Insert(us));
        }
Пример #24
0
        // add new bien
        public bool CreateBien(BienModel bm)
        {
            BienEntity bienEntity = new BienEntity()
            {
                Titre                = bm.Titre,
                DescCourte           = bm.DescCourte,
                DescLong             = bm.DescLong,
                NombrePerson         = bm.NombrePerson,
                Pays                 = bm.Pays,
                Ville                = bm.Ville,
                Rue                  = bm.Rue,
                Numero               = bm.Numero,
                CodePostal           = bm.CodePostal,
                Photo                = bm.Photo,
                AssuranceObligatoire = bm.AssuranceObligatoire,
                IsEnabled            = bm.IsEnabled,
                Latitude             = bm.Latitude,
                Longitude            = bm.Longitude,
            };

            return(_bienRepo.Insert(bienEntity));
        }
Пример #25
0
        public bool CreateMembre(MembreModel mm)
        {
            SecurityHelper sh = new SecurityHelper();
            // Mapping
            MembreEntity me = new MembreEntity();

            me.IdMembre  = mm.IdMembre;
            me.Nom       = mm.Nom;
            me.Prenom    = mm.Prenom;
            me.Email     = mm.Email;
            me.Login     = mm.Login;
            me.Pays      = mm.Pays;
            me.Telephone = mm.Telephone;

            byte[] newSalt = sh.GenerateLongRandomSalt();
            me.Salt = Convert.ToBase64String(newSalt);

            string hashPwd = sh.createHash(mm.Password, newSalt);

            me.Password = hashPwd;
            return(_membreRepo.Insert(me));
        }
Пример #26
0
        public bool InsertBien(BienEchangeModel bem)
        {
            BienEchangeEntity bee = new BienEchangeEntity();

            bee.Titre                = bem.Titre;
            bee.CodePostale          = bem.CodePostale;
            bee.DateCreation         = bem.DateCreation;
            bee.DescCourte           = bem.DescCourte;
            bee.DescLong             = bem.DescLong;
            bee.IdMembre             = bem.IdMembre;
            bee.IsEnabled            = bem.IsEnabled;
            bee.Latitude             = bem.Latitude;
            bee.Longitude            = bem.Longitude;
            bee.NombrePerson         = bem.NombrePerson;
            bee.Numero               = bem.Numero;
            bee.Libelle              = bem.Pays;
            bee.Photo                = bem.Photo;
            bee.Rue                  = bem.Rue;
            bee.Ville                = bem.Ville;
            bee.Pays                 = bem.IdPays;
            bee.AssuranceObligatoire = bem.AssuranceObligatoire;
            return(_bienEchangeRepo.Insert(bee));
        }