From 61237414edc59de58f5ae8d2f740d33112a454c6 Mon Sep 17 00:00:00 2001 From: Antoine Tritschberger <antoine.tritschberger@etu.unistra.fr> Date: Wed, 1 Apr 2020 14:40:57 +0200 Subject: [PATCH] Ajout de plein de fonction dans le gestionnaire et eleve --- .../psychorientation/Form1.Designer.cs | 1 + psychorientation/psychorientation/Form1.cs | 4 +- .../psychorientation/GestionnaireEleve.cs | 47 +++++++++++++++++++ .../InterfaceInfoEleve.Designer.cs | 41 ++++++++++++---- .../psychorientation/InterfaceInfoEleve.cs | 12 ++++- psychorientation/psychorientation/eleve.cs | 21 ++++++++- 6 files changed, 112 insertions(+), 14 deletions(-) diff --git a/psychorientation/psychorientation/Form1.Designer.cs b/psychorientation/psychorientation/Form1.Designer.cs index 27d8364..2d1bc73 100644 --- a/psychorientation/psychorientation/Form1.Designer.cs +++ b/psychorientation/psychorientation/Form1.Designer.cs @@ -41,6 +41,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Psychorientation"; this.Load += new System.EventHandler(this.Form1_Load); + this.ResumeLayout(false); } diff --git a/psychorientation/psychorientation/Form1.cs b/psychorientation/psychorientation/Form1.cs index 7d4e096..184d665 100644 --- a/psychorientation/psychorientation/Form1.cs +++ b/psychorientation/psychorientation/Form1.cs @@ -47,7 +47,7 @@ namespace psychorientation TypeMessage tm = TypeMessage.INFORMATION; Message m = new Message(-1,"Bonjour apprenti prof, vous allez apprendre à éduquer des joueurs !! ","Début",tm); - m.ShowDialog(); + // m.ShowDialog(); InterfaceInfoEleve ii = new InterfaceInfoEleve(); @@ -55,7 +55,7 @@ namespace psychorientation ii.Left = 0; ii.Top = 0; ii.BorderStyle = BorderStyle.Fixed3D; - this.Controls.Add(ii); + //this.Controls.Add(ii); } diff --git a/psychorientation/psychorientation/GestionnaireEleve.cs b/psychorientation/psychorientation/GestionnaireEleve.cs index d4aa6b2..40509fd 100644 --- a/psychorientation/psychorientation/GestionnaireEleve.cs +++ b/psychorientation/psychorientation/GestionnaireEleve.cs @@ -39,5 +39,52 @@ namespace psychorientation return this.listEleve[indice]; } + public double getMoyenneClasse() + { + double res = -1; + if (this.listEleve.Count > 0) + { + foreach (Eleve el in this.listEleve) + { + res += el.getMoyenne(); + } + } + return res / this.listEleve.Count; + } + + public double getCompetenceClasse() + { + double res = -1; + if (this.listEleve.Count > 0) + { + foreach (Eleve el in this.listEleve) + { + res += el.getCompetence(); + } + } + return res / this.listEleve.Count; + } + + public double getEffortClasse() + { + double res = -1; + if (this.listEleve.Count > 0) + { + foreach (Eleve el in this.listEleve) + { + res += el.getEffort(); + } + } + return res / this.listEleve.Count; + } + + public void faireControle(string nom) + { + foreach(Eleve e in this.listEleve) + { + e.ajouterNote(nom); + } + } + } } diff --git a/psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs b/psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs index 88dad84..af44eda 100644 --- a/psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs +++ b/psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs @@ -39,6 +39,8 @@ this.pnlCompetence = new System.Windows.Forms.Panel(); this.lblEffort = new System.Windows.Forms.Label(); this.lblCompetence = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.lblMoyenne = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.SuspendLayout(); @@ -56,7 +58,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(43, 105); + this.label1.Location = new System.Drawing.Point(60, 96); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(50, 13); this.label1.TabIndex = 1; @@ -65,7 +67,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(52, 145); + this.label2.Location = new System.Drawing.Point(69, 136); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(41, 13); this.label2.TabIndex = 2; @@ -74,7 +76,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(17, 186); + this.label3.Location = new System.Drawing.Point(34, 177); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(76, 13); this.label3.TabIndex = 3; @@ -83,7 +85,7 @@ // lblClasse // this.lblClasse.AutoSize = true; - this.lblClasse.Location = new System.Drawing.Point(99, 105); + this.lblClasse.Location = new System.Drawing.Point(116, 96); this.lblClasse.Name = "lblClasse"; this.lblClasse.Size = new System.Drawing.Size(35, 13); this.lblClasse.TabIndex = 4; @@ -93,7 +95,7 @@ // this.panel1.BackColor = System.Drawing.Color.Silver; this.panel1.Controls.Add(this.pnlEffort); - this.panel1.Location = new System.Drawing.Point(99, 140); + this.panel1.Location = new System.Drawing.Point(116, 131); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(139, 26); this.panel1.TabIndex = 5; @@ -110,7 +112,7 @@ // this.panel2.BackColor = System.Drawing.Color.Silver; this.panel2.Controls.Add(this.pnlCompetence); - this.panel2.Location = new System.Drawing.Point(99, 182); + this.panel2.Location = new System.Drawing.Point(116, 173); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(139, 26); this.panel2.TabIndex = 6; @@ -126,7 +128,7 @@ // lblEffort // this.lblEffort.AutoSize = true; - this.lblEffort.Location = new System.Drawing.Point(255, 144); + this.lblEffort.Location = new System.Drawing.Point(272, 144); this.lblEffort.Name = "lblEffort"; this.lblEffort.Size = new System.Drawing.Size(0, 13); this.lblEffort.TabIndex = 7; @@ -134,16 +136,35 @@ // lblCompetence // this.lblCompetence.AutoSize = true; - this.lblCompetence.Location = new System.Drawing.Point(254, 189); + this.lblCompetence.Location = new System.Drawing.Point(271, 189); this.lblCompetence.Name = "lblCompetence"; this.lblCompetence.Size = new System.Drawing.Size(0, 13); this.lblCompetence.TabIndex = 8; - + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(12, 215); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(98, 13); + this.label4.TabIndex = 9; + this.label4.Text = "Moyenne général : "; + // + // lblMoyenne + // + this.lblMoyenne.AutoSize = true; + this.lblMoyenne.Location = new System.Drawing.Point(116, 215); + this.lblMoyenne.Name = "lblMoyenne"; + this.lblMoyenne.Size = new System.Drawing.Size(35, 13); + this.lblMoyenne.TabIndex = 10; + this.lblMoyenne.Text = "label5"; // // InterfaceInfoEleve // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lblMoyenne); + this.Controls.Add(this.label4); this.Controls.Add(this.lblCompetence); this.Controls.Add(this.lblEffort); this.Controls.Add(this.panel2); @@ -176,5 +197,7 @@ private System.Windows.Forms.Panel pnlCompetence; private System.Windows.Forms.Label lblEffort; private System.Windows.Forms.Label lblCompetence; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label lblMoyenne; } } diff --git a/psychorientation/psychorientation/InterfaceInfoEleve.cs b/psychorientation/psychorientation/InterfaceInfoEleve.cs index 264b5c9..c8c93df 100644 --- a/psychorientation/psychorientation/InterfaceInfoEleve.cs +++ b/psychorientation/psychorientation/InterfaceInfoEleve.cs @@ -37,13 +37,23 @@ namespace psychorientation lblClasse.Text = listClasse[eleve.getClasse()]; lblEffort.Text = eleve.getEffort().ToString(); lblCompetence.Text = eleve.getCompetence().ToString(); + double moyenne = eleve.getMoyenne(); + if (moyenne == -1) + { + lblMoyenne.Text="Pas encore d'évaluation"; + } + else + { + lblMoyenne.Text = eleve.getMoyenne().ToString()+"/20"; + } + MajPanel(pnlCompetence,eleve.getCompetence()); MajPanel(pnlEffort, eleve.getEffort()); } private void MajPanel(Panel p, double valeur) { int val = (int)valeur; - p.Size = new Size(val * 133 / 100, p.Height); + p.Size = new Size(val * 133 / 10, p.Height); } } } diff --git a/psychorientation/psychorientation/eleve.cs b/psychorientation/psychorientation/eleve.cs index 48bea3e..2f53009 100644 --- a/psychorientation/psychorientation/eleve.cs +++ b/psychorientation/psychorientation/eleve.cs @@ -83,12 +83,29 @@ namespace psychorientation + public double getMoyenne() + { + double res = -1; + if (this.listNote.Count > 0) + { + foreach(Note n in listNote) + { + res += n.getNote(); + } + } + return res/ this.listNote.Count; + } - public void ajouterNote(string nom, double note) + public void ajouterNote(string nom) { - Note n = new Note(nom, note, this.competence, this.effort); + Note n = new Note(nom,calculerNote() , this.competence, this.effort); this.listNote.Add(n); } + + private double calculerNote() + { + return this.effort*0.2+this.competence*1.8; + } } } -- GitLab