Esempio n. 1
0
        public void UpdateTest()
        {
            FiliereDAO target = new FiliereDAO();
            Filiere    f      = null;

            target.Update(f);
        }
        async private void BtnSave(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(filierName_Entry.Text))
            {
                await DisplayAlert("Erorr ", "Il faut remplire le champ de la filiére", "Ok", "Cancel");
            }
            else
            {
                Filiere filiere = new Filiere()
                {
                    FiliereName = filierName_Entry.Text
                };

                FiliereRepository dataFilier = new FiliereRepository();

                bool resultat = await dataFilier.AddFiliere(filiere);

                if (resultat)
                {
                    await DisplayAlert("Congratulation ", "La filiére est ajouter avec succée ", "Ok");

                    await Navigation.PushAsync(new HomePage2());
                }
                else
                {
                    await DisplayAlert("Error ", "La fliére est déja Existe", "Ok");

                    await Navigation.PushAsync(new FilierePage());
                }
            }
        }
Esempio n. 3
0
        private void win_loaded(object sender, RoutedEventArgs e)
        {
            String           query = @"Select * from Filieres";
            ISQLiteStatement stmt  = con.Prepare(query);
            ISQLiteStatement stmtForTotal;
            ISQLiteStatement stmtNbAbsence;

            while (stmt.Step() == SQLiteResult.ROW)
            {
                query        = @"Select id_etudiant from Etudiants WHERE id_filiere='" + stmt["id_filiere"].ToString() + "'";
                stmtForTotal = con.Prepare(query);
                int nb_etudiant = 0;
                int nb_absence  = 0;
                while (stmtForTotal.Step() == SQLiteResult.ROW)
                {
                    nb_etudiant++;
                    query         = @"Select id_absence from Absences WHERE id_etudiant='" + stmtForTotal["id_etudiant"].ToString() + "'";
                    stmtNbAbsence = con.Prepare(query);
                    while (stmtNbAbsence.Step() == SQLiteResult.ROW)
                    {
                        nb_absence++;
                    }
                }
                Filiere fil = new Filiere(int.Parse(stmt["id_filiere"].ToString()), stmt["nom_filiere"].ToString(), nb_etudiant, nb_absence);
                ListFilieres.Add(fil);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fil"></param>
        public FiliereClassCard(Filiere fil)
        {
            FiliereName = fil.Name.ToUpper();

            ClassList = new List <ClassCard> ();
            GetCLASS_LIST(fil.FiliereGuid);
        }
Esempio n. 5
0
        public List <Filiere> GetListeFiliere()
        {
            List <Filiere> listeFiliere = new List <Filiere>();

            connection.Open();

            string sql = "SELECT F.id, F.nom, F.type, COUNT(*) as nombreEleve FROM Utilisateur U LEFT OUTER JOIN Filiere F ON F.id = U.filiere GROUP BY U.filiere ";

            MySqlCommand command = new MySqlCommand(sql, connection);

            command.Prepare();
            MySqlDataReader reader = command.ExecuteReader();

            // Création de l'objet U de la classe User avec le résultat de la requête et sauvegarde de l'objet dans la classe Main.cs : CurrentUser
            while (reader.Read())
            {
                Filiere F = new Filiere(
                    reader.GetInt32("id"),
                    reader.GetString("nom"),
                    reader.GetString("type"),
                    reader.GetInt32("nombreEleve")
                    );

                listeFiliere.Add(F);
            }

            connection.Close();

            return(listeFiliere);
        }
        public async Task <IActionResult> PutFiliere(int id, Filiere filiere)
        {
            if (id != filiere.FiliereId)
            {
                return(BadRequest());
            }

            _context.Entry(filiere).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FiliereExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        async public void OnPickerSelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedIndex = Breed1.SelectedIndex;

            if (selectedIndex != -1)

            {
                var FilierName = Breed1.Items[selectedIndex];
                var id         = DcFilier[FilierName];


                Filiere filiere = await dataFilier.connection.GetWithChildrenAsync <Filiere>(id);

                var LessonVar = filiere.lessons;
                StudentList = new ObservableCollection <Student>(filiere.students);


                listUser.ItemsSource = StudentList;

                DcLesson = new Dictionary <string, int>();
                var NameList = new List <string>();

                foreach (Lesson Data in LessonVar)
                {
                    DcLesson.Add(Data.LessonName, Data.IdLesson);
                    NameList.Add(Data.LessonName);
                }
                LessonPicker.ItemsSource = NameList;
            }
        }
Esempio n. 8
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Filiere = await _context.Filieres
                      .Include(f => f.Responsable).FirstOrDefaultAsync(m => m.ID == id);

            if (Filiere == null)
            {
                return(NotFound());
            }

            var enseignants = _context.Enseignants
                              .Select(e => new
            {
                ID       = e.ID,
                FullName = e.Nom + " " + e.Prenom
            })
                              .ToList();

            ViewData["EnseignantID"] = new SelectList(enseignants, "ID", "FullName");
            return(Page());
        }
Esempio n. 9
0
 public Module(int id, Filiere id_f, String nom, int duree, string strategieEnseignement, string apprentisage, string evaluation, string materiel, string equipement, string competence, string presentation, string description, String code)
 {
     this.id_f = id_f;
     this.id   = id;
     this.code = code;
     this.nom  = nom; this.duree = duree; this.strategieEnseignement = strategieEnseignement; this.description = description; this.presentation = presentation; this.competence = competence; this.equipement = equipement; this.materiel = materiel; this.evaluation = evaluation; this.apprentisage = apprentisage;
 }
        public async Task <ActionResult <Filiere> > PostFiliere(Filiere filiere)
        {
            _context.Filieres.Add(filiere);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFiliere", new { id = filiere.FiliereId }, filiere));
        }
Esempio n. 11
0
        public async Task <IActionResult> MdfF(int id, [Bind("Id_Filiere,Nom_Filiere")] Filiere filiere)
        {
            if (id != filiere.Id_Filiere)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _db.Update(filiere);
                    await _db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FiliereExists(filiere.Id_Filiere))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("IndexF"));
            }
            return(View(filiere));
        }
Esempio n. 12
0
 private void itemSelected(object sender, Telerik.UI.Xaml.Controls.Grid.DataGridSelectionChangedEventArgs e)
 {
     selectedFiliere             = (Filiere)tableFilieres.SelectedItem;
     supprimerFiliere.Visibility = Visibility.Visible;
     modifierFiliere.Visibility  = Visibility.Visible;
     filiereLabel.Text           = selectedFiliere.Nom_filiere;
 }
Esempio n. 13
0
        public async Task <IActionResult> Edit(int id, [Bind("FiliereId,nom")] Filiere filiere)
        {
            if (id != filiere.FiliereId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filiere);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FiliereExists(filiere.FiliereId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(filiere));
        }
Esempio n. 14
0
        internal static bool StaticGenerateClasses(Filiere filiere, string session)
        {
            var upper = (int)filiere.Scolarite;

            for (var i = 1; i <= upper; i++)
            {
                var newClasse = new Classe {
                    ClasseGuid = Guid.NewGuid(), FiliereGuid = filiere.FiliereGuid, ClassGrade = (ClassGrades)i, Session = session
                };

                if (i == 1)
                {
                    newClasse.Name = "1 ère Année";
                }
                else
                {
                    newClasse.Name = i + " ème Année";
                }
                newClasse.Description = newClasse.Name;

                using (var db = new SchoolContext())
                {
                    db.Classes.Add(newClasse);
                    db.SaveChanges();
                }
            }
            return(true);
        }
Esempio n. 15
0
        public async Task <IActionResult> Edit(int id, [Bind("Id_Filiere,Designation_Niveau,Designation_Filiere,Designation_Option,Fk_Diplome")] Filiere filiere)
        {
            if (id != filiere.Id_Filiere)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filiere);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FiliereExists(filiere.Id_Filiere))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Fk_Diplome"] = new SelectList(_context.Diplome, "Id_Diplome", "Id_Diplome", filiere.Fk_Diplome);
            return(View(filiere));
        }
Esempio n. 16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="myFiliere"></param>
 /// <returns></returns>
 public bool AddFiliere(Filiere myFiliere)
 {
     using (var db = new Ef())
     {
         db.Filiere.Add(myFiliere);
         return(db.SaveChanges() > 0);
     }
 }
Esempio n. 17
0
        public ActionResult DeleteConfirmed(int id)
        {
            Filiere filiere = db.Filieres.Find(id);

            db.Filieres.Remove(filiere);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 18
0
        public ActionResult Update(Filiere filiere)
        {
            Filiere filiere1 = dao.getById(filiere.FiliereId);

            filiere1.Libelle = filiere.Libelle;
            dao.update(filiere1);
            return(RedirectToAction("Index"));
        }
Esempio n. 19
0
 /// <summary>
 /// Model de Filiere
 /// </summary>
 public FiliereCard(Filiere fl)
 {
     FiliereGuid  = fl.FiliereGuid;
     Name         = fl.Name.ToUpper();
     Niveau       = fl.Niveau;
     NiveauEntree = fl.NiveauEntree;
     NAnnee       = fl.NAnnee;
     GetCLASSES_COUNT();
 }
Esempio n. 20
0
        internal FiliereClasses(Filiere filiere)
        {
            FiliereName = filiere.Name.ToUpper();

            using (var db = new SchoolContext())
                ClassesList =
                    db.Classes.Where(c => c.FiliereGuid == filiere.FiliereGuid && !c.IsDeleted)
                    .OrderBy(c => c.ClassGrade).ToList();
        }
Esempio n. 21
0
        public void FindByIdTest()
        {
            FiliereDAO target   = new FiliereDAO();
            int        id       = 0;
            Filiere    expected = null;
            Filiere    actual;

            actual = target.FindById(id);
        }
Esempio n. 22
0
 /// <summary>
 /// Model de Filiere
 /// </summary>
 public FiliereCard(Filiere fl)
 {
     FiliereGuid  = fl.FiliereGuid;
     Name         = fl.Name.ToUpper();
     Niveau       = fl.Diplome;
     NiveauEntree = fl.Admission;
     Scolarite    = fl.Scolarite.GetEnumDescription();
     GetCLASSES_COUNT();
 }
Esempio n. 23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="myFiliere"></param>
 /// <returns></returns>
 public bool UpdateFiliere(Filiere myFiliere)
 {
     using (var db = new Ef())
     {
         db.Filiere.Attach(myFiliere);
         db.Entry(myFiliere).State = System.Data.Entity.EntityState.Modified;
         return(db.SaveChanges() > 0);
     }
 }
Esempio n. 24
0
 public ModifierFiliere(Filiere f)
 {
     InitializeComponent();
     filireOpration = new FiliereOperationImpl(App.Connection);
     f1             = f;
     id.Text        = f.Id_fil.ToString();
     nom.Text       = f.Nom_filiere;
     resp.Text      = f.Responsbale;
     date.Date      = f.Date_creation;
 }
Esempio n. 25
0
 public ActionResult Edit([Bind(Include = "FiliereId,Libelle")] Filiere filiere)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filiere).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(filiere));
 }
Esempio n. 26
0
        public async Task <IActionResult> AjtF([Bind("Id_Filiere,Nom_Filiere")] Filiere filiere)
        {
            if (ModelState.IsValid)
            {
                _db.Add(filiere);
                await _db.SaveChangesAsync();

                return(RedirectToAction("IndexF"));
            }
            return(View(filiere));
        }
Esempio n. 27
0
        public async Task <IActionResult> Create([Bind("FiliereId,nom")] Filiere filiere)
        {
            if (ModelState.IsValid)
            {
                _context.Add(filiere);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(filiere));
        }
Esempio n. 28
0
        public ActionResult Create([Bind(Include = "FiliereId,Libelle")] Filiere filiere)
        {
            if (ModelState.IsValid)
            {
                db.Filieres.Add(filiere);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(filiere));
        }
Esempio n. 29
0
        public bool UpdateFiliere(Filiere myFiliere)
        {
            using (var db = new SchoolContext())
            {
                myFiliere.LastEditDate = DateTime.Now;

                db.Filieres.Attach(myFiliere);
                db.Entry(myFiliere).State = EntityState.Modified;
                return(db.SaveChanges() > 0);
            }
        }
Esempio n. 30
0
 public IActionResult ModifierFiliere(Filiere model)
 {
     if (ModelState.IsValid)
     {
         string cne = HttpContext.Session.GetString("cne");
         candidat_service.setFiliere(cne, model.ID);
         TempData["message"] = "Filiere Modified succefully";
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }