Esempio n. 1
0
        public void Application_Startup(object sender, StartupEventArgs e)
        {
            //C'est ici, dans la méthode Application_Startup, qu'on instancie nos objets Dbal et Dao

            mydbal             = new Dbal("Escp_Game");
            thedaoclients      = new DaoClient(mydbal);
            thedaotheme        = new DaoTheme(mydbal);
            thedaoavis         = new DaoAvis(mydbal, thedaoclients, thedaotheme);
            thedaoobstacles    = new DaoObstacle(mydbal, thedaotheme);
            thedaoville        = new DaoVille(mydbal);
            thedaosalles       = new DaoSalle(mydbal, thedaoville, thedaotheme);
            thedaoutilisateurs = new DaoUtilisateur(mydbal, thedaoville);
            thedaoreservation  = new DaoReservation(mydbal, thedaoclients, thedaosalles, thedaoutilisateurs, thedaotheme);
            thedaoplacement    = new DaoPlacement_Obst(mydbal, thedaoreservation, thedaoobstacles);
            thedaoheure        = new DaoHeure(mydbal);



            // Create the startup window
            //là, on lance la fenêtre souhaitée en instanciant la classe de notre fenêtre
            directeur wnd = new directeur(thedaoavis, thedaoclients, thedaoobstacles, thedaoplacement, thedaoreservation, thedaosalles, thedaotheme, thedaoutilisateurs, thedaoville, thedaoheure);            //et on utilise la méthode Show() de notre objet fenêtre pour afficher la fenêtre

            //exemple: MainWindow lafenetre = new MainWindow(); (et on y passe en paramètre Dbal et Dao au besoin)
            wnd.Show();
        }
Esempio n. 2
0
 public directeur(DaoAvis thedaoavis, DaoClient thedaoclient, DaoObstacle thedaoobstacle, DaoPlacement_Obst thedaoPlacement_Obst, DaoReservation theDaoReservation, DaoSalle thedaosalle, DaoTheme thedaotheme, DaoUtilisateur thedaoutilisateur, DaoVille thedaoville, DaoHeure thedaoheure)
 {
     InitializeComponent();
     Globale.DataContext = new viewModel.viewModelSalles(thedaoavis, thedaoclient, thedaoobstacle, thedaoPlacement_Obst, theDaoReservation, thedaosalle, thedaotheme, thedaoutilisateur, thedaoville, thedaoheure);
     grid1.Visibility    = Visibility.Hidden;
     grid2.Visibility    = Visibility.Hidden;
     grid3.Visibility    = Visibility.Hidden;
     grid4.Visibility    = Visibility.Hidden;
     HOME.Visibility     = Visibility.Visible;
 }
        private string GenerationAvis()
        {
            DaoHebergement daohebergement = new DaoHebergement();
            Client         Utilisateur    = null;

            if (Session["Client"] != null)
            {
                Utilisateur = (Client)Session["Client"];
            }
            int IdClient = Utilisateur.IdClient;
            List <Hebergement> listeHebergement = daohebergement.GetHebergementProprietaire(IdClient);

            StringBuilder CodeAvis = new StringBuilder();

            CodeAvis.Append("<div class=\"accordion\" id=\"accordionExample\">");

            int i = 0;

            foreach (Hebergement hebergement in listeHebergement)
            {
                DaoAvis     daoAvis   = new DaoAvis();
                List <Avis> listeAvis = daoAvis.GetAvisHebergement(hebergement.IdHebergement);
                //Creation du bouton du collapse
                if (listeAvis.Count() > 0)
                {
                    CodeAvis.Append("<div class=\"card\">");
                    CodeAvis.Append("<div class=\"card - header\" id=\"heading" + i + "\">");
                    CodeAvis.Append("<h2 class=\"mb-0\">");
                    CodeAvis.Append("<button class=\"btn btn-secondary collapsed\" type=\"button\" data-toggle=\"collapse\" data-target=\"#collapse" + i + "\" aria-expanded=\"false\" aria-controls=\"collapse" + i + "\">");
                    CodeAvis.Append(hebergement.Nom + "  <span class=\"badge badge-light\">" + (listeAvis.Count()).ToString() + "</span>");
                    CodeAvis.Append("</button>");
                    CodeAvis.Append("</h2></div> ");

                    //Les avis de cette hebergement
                    CodeAvis.Append("<div id=\"collapse" + i + "\" class=\"collapse\" aria-labelledby=\"heading" + i + "\" data-parent=\"#accordionExample\"><div class=\"card-body\">");
                    CodeAvis.Append("<div class=\"list-group\">");
                    foreach (Avis avis in listeAvis)
                    {
                        CodeAvis.Append("<span class=\"list-group-item list-group-item-action border\">");
                        CodeAvis.Append("<div class=\"d-flex w-100 justify-content-between\">");
                        CodeAvis.Append("<h6 class=\"mb-1\">Note : " + avis.Note + "</h6>");
                        CodeAvis.Append("<small>" + (avis.Date).ToString("d") + "</small>");
                        CodeAvis.Append("</div>");
                        CodeAvis.Append("<p class=\"mb-1\">" + avis.Commentaire + "</p>");
                        CodeAvis.Append("</span");
                    }
                    CodeAvis.Append("</div>");
                    CodeAvis.Append("</div></div>");
                    CodeAvis.Append("</div>");
                    i++;
                }
            }
            CodeAvis.Append("</div>");
            return(CodeAvis.ToString());
        }
Esempio n. 4
0
        // COMMANDES

        #endregion

        #region Constructeur

        public ViewModelAvis(DaoTheme daoTheme, DaoAvis daoAvis)
        {
            // DAO
            _daoTheme = daoTheme;
            _daoAvis  = daoAvis;
            // AFFICHAGE
            FullAvis     = "";
            PseudoJoueur = "Joueur : ";
            DateAvis     = "Date : ";
            // LISTES
            _listAvis  = new ObservableCollection <Avis>();
            ListThemes = new ObservableCollection <Theme>(_daoTheme.GetAllTheme());
        }
Esempio n. 5
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     mydbal            = new Dbal("Escp_Game");
     theDaoAvis        = new DaoAvis(mydbal, theDaoClient, theDaoTheme);
     theDaoClient      = new DaoClient(mydbal);
     theDaoObstacle    = new DaoObstacle(mydbal, theDaoTheme);
     theDaoPObstacle   = new DaoPlacement_Obst(mydbal, theDaoReservation, theDaoObstacle);
     theDaoReservation = new DaoReservation(mydbal, theDaoClient, theDaoSalle, theDaoUtilisateur, theDaoTheme);
     theDaoSalle       = new DaoSalle(mydbal, theDaoVille, theDaoTheme);
     theDaoTheme       = new DaoTheme(mydbal);
     theDaoTransaction = new DaoTransaction(mydbal, theDaoClient, theDaoReservation);
     theDaoUtilisateur = new DaoUtilisateur(mydbal, theDaoVille);
     theDaoVille       = new DaoVille(mydbal);
 }
 protected void btnAvis_Click(object sender, EventArgs e)
 {
     try
     {
         //Recuperation des variables.
         string Avis          = this.txtAvis.Text;
         int    Note          = Convert.ToInt32(this.txtNote.Text);
         int    IdHebergement = Convert.ToInt32(this.hidHebergementAvis.Value);
         Client Utilisateur   = null;
         if (Session["Client"] != null)
         {
             Utilisateur = (Client)Session["Client"];
         }
         int IdClient = Utilisateur.IdClient;
         // Variables stockées en BDD
         DaoAvis daoAvis = new DaoAvis();
         daoAvis.InsertAvisHebergement(IdClient, IdHebergement, Note, Avis);
         Response.Redirect("BackendCommandes.aspx", false);
     }
     catch (Exception ex)
     {
         ((backend)Page.Master).AddError(ex);
     }
 }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Session["ListeHebergement"] != null)
                    {
                        if (Request.QueryString["id"] != null && !string.IsNullOrEmpty(Request.QueryString["id"]))
                        {
                            Session["IdHebergement"] = Convert.ToInt32(Request.QueryString["id"]);
                        }
                        if (Session["IdHebergement"] != null)
                        {
                            //On utilise la DAO Hebergement pour recupere un logement dont l'Id est stocké en session
                            DaoHebergement daoHebergement = new DaoHebergement();
                            int            IdHebergement  = (int)Session["IdHebergement"];
                            Hebergement    MaSelection    = daoHebergement.GetHebergement(IdHebergement);

                            this.imgHebergement.ImageUrl = MaSelection.Photo;
                            this.lblTitre.Text           = MaSelection.Nom;
                            this.lblDescription.Text     = MaSelection.Description;
                            Adresse AdresseLgt = MaSelection.Adresse;
                            if (AdresseLgt != null)
                            {
                                this.lblAdresse.Text = AdresseLgt.CodePostal + " " + AdresseLgt.Ville;
                            }
                            this.lblPrix.Text = String.Format("{0:N2}", MaSelection.PrixDeBase);
                            this.btnFavori.CommandArgument  = Convert.ToString(MaSelection.IdHebergement);
                            this.btnReserve.CommandArgument = Convert.ToString(MaSelection.IdHebergement);

                            // AVIS
                            DaoAvis     daoavis   = new DaoAvis();
                            List <Avis> listeAvis = daoavis.GetAvisHebergement(IdHebergement);
                            if (listeAvis.Count() > 0)
                            {
                                double note = Math.Round(((from n in listeAvis
                                                           select n.Note).Average()), 1);
                                this.litNoteGlobale.Text = note.ToString();
                                this.panAvis.Visible     = true;
                                this.litNbreAvis.Text    = Convert.ToString(listeAvis.Count());
                                this.lvwAvis.DataSource  = listeAvis;
                                this.lvwAvis.DataBind();
                            }
                            else
                            {
                                this.panAvis.Visible = false;
                            }
                        }
                        else
                        {
                            Response.Redirect("Default.aspx");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ((SiteMaster)Page.Master).AddError(ex);
            }
        }
Esempio n. 8
0
        static void Hydrate(DateTime debut, DateTime fin)
        {
            Dbal dbal = new Dbal("ppe3_mmd");

            dbal.DBinit();
            dbal.DBhydrate();
            DaoClient   daoClient   = new DaoClient(dbal);
            DaoSalle    daoSalle    = new DaoSalle(dbal);
            DaoHoraire  daoHoraire  = new DaoHoraire(dbal);
            DaoJoueur   daoJoueur   = new DaoJoueur(dbal);
            DaoPartie   daoPartie   = new DaoPartie(dbal);
            DaoObstacle daoObstacle = new DaoObstacle(dbal);
            DaoAvis     daoAvis     = new DaoAvis(dbal);

            var randNb        = new Random();
            var randFirstName = RandomizerFactory.GetRandomizer(new FieldOptionsFirstName());
            var randLastName  = RandomizerFactory.GetRandomizer(new FieldOptionsLastName());
            var randNaissance = RandomizerFactory.GetRandomizer(new FieldOptionsDateTime
            {
                From = new DateTime(1970, 1, 1), To = DateTime.Today.AddYears(-18), IncludeTime = false
            });
            var randComm = RandomizerFactory.GetRandomizer(new FieldOptionsTextLipsum());

            for (int i = 0; i < 100; i++)
            {
                string nom = randFirstName.Generate();
                daoClient.NouveauClient(new Client(randLastName.Generate(), nom, randNaissance.Generate().Value,
                                                   nom + "@gmail.com", "0600000000", "une adresse", 100));
            }

            for (DateTime j = debut; j < fin; j = j.AddDays(1))
            {
                foreach (Salle salle in daoSalle.GetAll())
                {
                    foreach (Horaire horaire in daoHoraire.GetHorairesForSite(salle.Site))
                    {
                        if (randNb.Next(4) != 0) // 75 %
                        {
                            Partie partie   = new Partie(salle, horaire, j);
                            int    nbJoueur = randNb.Next(2, 8);
                            for (int i = 0; i < nbJoueur; i++)
                            {
                                string name   = randFirstName.Generate();
                                Joueur joueur = new Joueur(name, name + "@gmail.com");
                                daoJoueur.AddJoueur(ref joueur);
                                partie.LstJoueur.Add(joueur);

                                if (randNb.Next(2) != 0) // 50 %
                                {
                                    daoAvis.Add(joueur, j, randComm.Generate());
                                }
                            }
                            // int nbObstacle = randNb.Next(6, 13);
                            // for (int i = 0; i < nbObstacle; i++)
                            // {
                            //
                            // }
                            partie.LstObstacle = daoObstacle.GetAllObstacle(); // temporaire (rajouter des obstacle dans la bdd
                            daoPartie.NouvellePartie(partie);
                        }
                    }
                }
            }
        }