public void RemoveChambreReservee(int?id) { using (Entities.AppContext context = new Entities.AppContext()) { ChambreReservee crToRemove = context.ChambreReservees.Find(id); if (crToRemove != null) { context.ChambreReservees.Remove(crToRemove); context.SaveChanges(); } } }
public int AddChambreReservee(ChambreReservee cr) { using (Entities.AppContext context = new Entities.AppContext()) { if (cr != null) { context.ChambreReservees.Add(cr); context.SaveChanges(); } } return(cr.Id); }
public void UpdateChambreReservee(ChambreReservee cr) { using (Entities.AppContext context = new Entities.AppContext()) { ChambreReservee crToUpdate = context.ChambreReservees.Find(cr.Id); if (crToUpdate != null) { crToUpdate.Id = cr.Id; crToUpdate.IdentifiantRes = cr.IdentifiantRes; crToUpdate.Numero = cr.Numero; crToUpdate.NbPersonne = cr.NbPersonne; context.SaveChanges(); } } }
public ChambreReserveeViewModel(ChambreReserveeService srv, ChambreReservee cr) { Srv = srv; ChambreReservee = cr; UpdateListeChambresHotel(); observerChambre = CollectionViewSource.GetDefaultView(ListeChambresHotel); observerChambre.CurrentChanged += CurrentReservationChanged; if (NumeroChambre != 0) { observerChambre.MoveCurrentTo((from c in ListeChambresHotel where c.Numero == NumeroChambre select c).Single <ChambreViewModel>()); } OptionService osrv = Services.OptionService.Instance; List <DemandeOption> dOption = osrv.getOptionDemande(cr.Id); ListeDemandeOptions = new ObservableCollection <OptionDemandeVueModel>(); foreach (DemandeOption optionD in dOption) { OptionDemandeVueModel oDvm = new OptionDemandeVueModel(optionD); oDvm.suppresion += SupprimerOption; ListeDemandeOptions.Add(oDvm); } }
public double calculPrix(int idChambre, int nbDizaine, int nbCinq, int reste) { double prix = 0; using (Entities.AppContext context = new Entities.AppContext()) { ChambreReservee crToRemove = context.ChambreReservees.Find(idChambre); if (crToRemove != null) { Chambre chambre = context.Chambres.Find(crToRemove.Numero); if (chambre != null) { List <Prix> lstPrix = chambre.LstPrix.ToList(); if (lstPrix != null) { foreach (Prix prix1 in lstPrix) { switch (prix1.NbNuit) { case 1: prix += reste * (double)prix1.prix; break; case 5: prix += nbCinq * (double)prix1.prix; break; case 10: prix += nbDizaine * (double)prix1.prix; break; } } } } } } return(prix); }