Ejemplo n.º 1
0
 public List <Reservation> GetReservations()
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         return(context.Reservations.ToList());
     }
 }
Ejemplo n.º 2
0
 public User GetUserById(int idUser)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.Ratings.FirstOrDefault(p => p.IdUser == idUser).User);
     }
 }
Ejemplo n.º 3
0
 public List <ChambreReservee> GetAllChambreReservees()
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         return(context.ChambreReservees.ToList());
     }
 }
Ejemplo n.º 4
0
 public int GetShopRateById(int idShop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.Ratings.FirstOrDefault(p => p.IdShop == idShop).Rate);
     }
 }
Ejemplo n.º 5
0
 public List <Client> GetAllClients()
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         return(context.Clients.ToList());
     }
 }
Ejemplo n.º 6
0
 public ChambreReservee GetChambreReservee(int id)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         return(context.ChambreReservees.Find(id));
     }
 }
Ejemplo n.º 7
0
        public RepasJour(DateTime date)
        {
            List <Repas> lst = new List <Repas>();

            using (Entities.AppContext context = new Entities.AppContext())
            {
                lst = context.Repas.ToList();
            }
            dateHebdo = date;
            int tempnbRepasMatin = 0, tempsnbRepasmidi = 0;

            foreach (Repas repas in lst)
            {
                if (repas.DateRepas.Date == date.Date)
                {
                    if (repas.EstPetitDejeuner)
                    {
                        tempnbRepasMatin++;
                    }
                    else
                    {
                        tempsnbRepasmidi++;
                    }
                }
            }
            _nbRepasMatin = tempnbRepasMatin;
            _nbRepasMidi  = tempsnbRepasmidi;
        }
Ejemplo n.º 8
0
 public Client GetClient(int?id)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         return(context.Clients.Find(id));
     }
 }
Ejemplo n.º 9
0
 public Address GetAddressById(int idAddress)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.Addresses.FirstOrDefault(p => p.IdAddress == idAddress));
     }
 }
Ejemplo n.º 10
0
 internal void ChambreEstNettoyee(int numero)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         context.Database.ExecuteSqlCommand("UPDATE Chambres SET DateDernierMenage = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' WHERE Chambres.Numero = " + numero);
     }
 }
Ejemplo n.º 11
0
 public Shop GetShopById(int idShop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.Shops.FirstOrDefault(p => p.IdShop == idShop));
     }
 }
Ejemplo n.º 12
0
 public TypeOfShop GetTypeOfShopById(int idTypeOfShop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.TypeOfShops.FirstOrDefault(p => p.Id == idTypeOfShop));
     }
 }
Ejemplo n.º 13
0
 public Reservation GetReservation(int id)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         return(context.Reservations.Find(id));
     }
 }
Ejemplo n.º 14
0
 public void AddTypeOfShop(TypeOfShop typeOfShop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.TypeOfShops.Add(typeOfShop);
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 15
0
 public void UpdateAddress(Address address)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <Address>(address).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 16
0
 public void AddAddress(Address address)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Addresses.Add(address);
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 17
0
 public void UpdateTypeOfShop(TypeOfShop typeOfShop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <TypeOfShop>(typeOfShop).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 18
0
 public void AddDemandeOption(DemandeOption opt)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         context.DemandeOptions.Add(opt);
         context.SaveChanges();
     }
 }
Ejemplo n.º 19
0
 public bool SignIn(User user)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.Users.Any(p =>
                                     p.Hashpassword == user.Hashpassword && p.Login == user.Login));
     }
 }
Ejemplo n.º 20
0
 public void UpdateUser(User user)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <User>(user).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 21
0
 public void UpdateShop(Shop shop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Entry <Shop>(shop).State = EntityState.Modified;
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 22
0
 public void SignUp(User user)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Users.Add(user);
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 23
0
 public void AddShop(Shop shop)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         appContext.Shops.Add(shop);
         appContext.SaveChanges();
     }
 }
Ejemplo n.º 24
0
        public bool CheckData(DemandeOption option)
        {
            using (Entities.AppContext context = new Entities.AppContext())
            {
                DemandeOption Dopt = (from opt in context.DemandeOptions where (opt.IdChambreReservee == option.IdChambreReservee) && (opt.IdOption == option.IdOption) select opt).SingleOrDefault <DemandeOption>();

                return(Dopt != null);
            }
        }
Ejemplo n.º 25
0
 public List <ChambreReservee> GetChambresReservées(int?idResa)
 {
     using (Entities.AppContext context = new Entities.AppContext())
     {
         return((from cr in context.ChambreReservees
                 where cr.IdentifiantRes == idResa
                 select cr).ToList());
     }
 }
Ejemplo n.º 26
0
 public IEnumerable <TypeOfShop> GetAllTypeOfShops()
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.TypeOfShops
                .Include(p => p.Description)
                .ToList());
     }
 }
Ejemplo n.º 27
0
        /// <summary>
        ///  Permet de recuperer la liste des chambre résérvé avec les chambre associé
        /// </summary>
        /// <returns></returns>
        public List <ChambreReservee> chargerListChambre()
        {
            List <ChambreReservee> lst = new List <ChambreReservee>();

            using (Entities.AppContext context = new Entities.AppContext())
            {
                lst = context.ChambreReservees.ToList();
            }
            return(lst);
        }
Ejemplo n.º 28
0
 public User GetUserByName(string nameUser)
 {
     using (Entities.AppContext appContext = new Entities.AppContext())
     {
         return(appContext.Users
                //.Include(p => p.DateOfBirth)
                .Include(p => p.ShopList)
                .FirstOrDefault(p => p.NameUser == nameUser));
     }
 }
Ejemplo n.º 29
0
        public List <Client> ChargerClients()
        {
            List <Client> lst = new List <Client>();

            using (Entities.AppContext context = new Entities.AppContext())
            {
                lst = context.Clients.ToList();
            }
            return(lst);
        }
Ejemplo n.º 30
0
        public List <Chambre> getChambresANettoyer(int numEtage)
        {
            List <Chambre> chambres = new List <Chambre>();

            using (Entities.AppContext context = new Entities.AppContext())
            {
                chambres = context.Database.SqlQuery <Chambre>("CALL menageByEtage(" + numEtage + ")").ToList();
                return(chambres);
            }
        }