Exemplo n.º 1
0
        public void UpdateGrade(List <string> grade, string courseName)
        {
            cours course = new cours();

            try
            {
                using (var context = new BAProjectEntities())
                {
                    course = context.courses.FirstOrDefault(x => x.name.Equals(courseName));

                    foreach (var gradeDatabase in course.grades_database)
                    {
                        gradeDatabase.grade = grade.First();
                        grade.Remove(grade.First());
                    }
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                if (ex is EntityException || ex is NullReferenceException)
                {
                    MessageBox.Show("Couldn't connect to the database. Please try again later.");
                }
                else
                {
                    throw;
                }
            }
            Response.Redirect("~/ReportCard/LecturerView/" + course.course_id);
        }
        public JsonResult inscrire()
        {
            inscription i = new inscription();

            i.cours   = int.Parse(Request["cours"].ToString());
            i.student = Request["pw"].ToString();

            try
            {
                student e1 = (from el in db.students
                              where el.Id == Session["id"].ToString() && el.pw == i.student
                              select el).Single <student>();

                cours cc = (from el in db.cours where el.Id == i.cours select el).Single <cours>();

                inscription validatesubs = new inscription();
                validatesubs.cours   = i.cours;
                validatesubs.student = Session["id"].ToString();

                db.inscriptions.InsertOnSubmit(validatesubs);
                db.SubmitChanges();
            }
            catch (System.InvalidOperationException ex)
            {
                return(Json("false", JsonRequestBehavior.AllowGet));
            }
            return(Json("true", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        private void getData()
        {
            using (Entities context = new Entities())
            {
                //Select cources of a student without final grade for current year
                var selected =
                    from c in context.Student_Courses where c.stud_Id == Utility.User.ID.ToString() && c.final_grade == null
                    from i in context.Lecture_Course where i.Course_ID == c.course_id select i;

                //Place each Course into DataGridView
                foreach (var s in selected)
                {
                    cours course = context.courses.FirstOrDefault(c => c.Course_id == s.Course_ID);

                    if (!courseList.Contains(course.Course_id))
                    {
                        courseList.Add(course.Course_id);                                            //Add course id to list if necessary
                    }
                    for (int i = Convert.ToInt32(s.Start_time); i < Convert.ToInt32(s.End_time); i++)
                    {
                        this.calendarGridView.Rows[i - 8].Cells[s.Date.Trim()].Value           = course.Course_name;
                        this.calendarGridView.Rows[i - 8].Cells[s.Date.Trim()].Style.BackColor = Color.FromArgb(((int)(((byte)(116)))), ((int)(((byte)(172)))), ((int)(((byte)(228)))));
                        this.calendarGridView.Rows[i - 8].Cells[s.Date.Trim()].Style.ForeColor = Color.White;
                        this.calendarGridView.ColumnHeadersDefaultCellStyle.BackColor          = Utility.HeaderBackColor;
                        this.calendarGridView.GridColor = Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(229)))));


                        this.calendarGridView.Rows[i - 8].Cells[s.Date.Trim()].Value           = course.Course_name.Trim() + " Room:" + s.Class_number;      //Print data to cell
                        this.calendarGridView.Rows[i - 8].Cells[s.Date.Trim()].Style.BackColor = Utility.getColorByID(courseList.IndexOf(course.Course_id)); //Paint cell
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void bCreer_Click(object sender, EventArgs e)
        {
            if ((Utilitaires.conditionsRespectees(tBNom.Text, true, true, true, true, 2, 100)) &&
                (Utilitaires.conditionsRespectees(tBHoraires.Text, false, true, false, false, 1, 3)) &&
                (Utilitaires.conditionsRespectees(cBType.Text, cBType)))
            {
                lErreur.Visible = false;

                // Ajouter un cours
                cours cours = new cours();
                cours.nom             = this.tBNom.Text;
                cours.volume_horraire = Convert.ToInt32(this.tBHoraires.Text);

                type_cours tc = Requetes.retrouveTypeDeCoursViaTexte(cBType.Text);
                cours.type_cours = tc;
                tc.cours.Add(cours);

                cours.ec = _e;
                _e.cours.Add(cours);

                // Ajouter l'enregistrement à la BDD
                Requetes.ajouterCours(cours);

                Requetes.enregistreLaBDD();

                MessageBox.Show("Le cours " + cours.nom + " a été ajouté avec succès.");

                _cadre.Actualiser();
            }
            else
            {
                lErreur.Visible = true;
            }
        }
Exemplo n.º 5
0
 public static void ViewStudentSchedule(student s, cours c)
 {
     using (var ef = new baron_project1Entities())
     {
         var course   = ef.studentCourseLists.Find(s.studentID);
         var schedule = ef.courses.Find(course.courseID);
     }
 }
Exemplo n.º 6
0
        public FenetreAssignationPersonnel(UC_OngletDiplomes cadre, cours cours)
        {
            InitializeComponent();
            _cadre = cadre;
            _cours = cours;

            initialisation();
        }
Exemplo n.º 7
0
        public ActionResult DeleteConfirmed(int id)
        {
            cours cours = db.courses.Find(id);

            db.courses.Remove(cours);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
 public UC_ElementCoursAccueil(UC_OngletAccueil cadre, cours c) : base(cadre)
 {
     InitializeComponent();
     _cours            = c;
     gBAffElement.Text = _cours.nom;
     tBCours.Text      = Requetes.obtientTypeduCours(_cours).nom;
     tBHoraires.Text   = _cours.volume_horraire.ToString();
     tBEC.Text         = Requetes.obtientECduCours(_cours).nom;
 }
Exemplo n.º 9
0
        public FenetreSupprimerCoursD(UC_ElementCoursDiplome cadre, cours c)
        {
            InitializeComponent();
            _cadre = cadre;
            _cours = c;

            lTitre.Text      = "Êtes vous sûr de vouloir supprimer le cours suivant : ";
            lNomElement.Text = _cours.nom;
        }
Exemplo n.º 10
0
        private void get_List_Etudiant_select_etudiant(cours cours_selectionne)
        {
            liste_etudiant_observable_de_main_view_cours.Clear();
            List <etudiant_cours> my_cours = context.etudiant_cours.Where(sc => sc.FK_cour == cours_selectionne.Id).ToList();

            foreach (etudiant_cours e in my_cours)
            {
                liste_etudiant_observable_de_main_view_cours.Add(e.etudiants);
            }
        }
Exemplo n.º 11
0
 public static void RemoveStudentFromCourse(student s, cours c)
 {
     using (var ef = new baron_project1Entities())
     {
         ef.studentCourseLists.Remove(new studentCourseList {
             studentID = s.studentID, courseID = c.courseID
         });
         ef.SaveChanges();
     }
 }
Exemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "id,course,duration")] cours cours)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cours).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cours));
 }
Exemplo n.º 13
0
        public void filArianeCoursApparait(cours c)
        {
            nbOngletsOuverts = 7;
            _c = c;
            couleurdeFondBlanche(lEC);
            couleurdeFondBleue(lCours);

            lCours.Visible = true;
            lCours.Text    = "Cours :" + Environment.NewLine + _c.nom;
        }
Exemplo n.º 14
0
 public static void RegistrarAddCourse(cours c)
 {
     using (var ef = new baron_project1Entities())
     {
         ef.courses.Add(new cours {
             courseDepartment = c.courseDepartment, courseName = c.courseName, courseNumber = c.courseNumber, courseEnrollment = c.courseEnrollment, courseTime = c.courseTime, courseDate = c.courseDate, professorID = c.professorID
         });
         ef.SaveChanges();
     }
 }
Exemplo n.º 15
0
 public ActionResult Edit([Bind(Include = "id,name,workload,duration_in_years,course_type")] cours cours)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cours).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.course_type = new SelectList(db.courses_type, "id", "name", cours.course_type);
     return(View(cours));
 }
        public ActionResult Create([Bind(Include = "course_id,course_name,course_code,teacher_name")] cours cours)
        {
            if (ModelState.IsValid)
            {
                db.courses.Add(cours);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cours));
        }
Exemplo n.º 17
0
        public FenetreModifCoursD(UC_ElementCoursDiplome cadre, cours c)
        {
            InitializeComponent();
            _cadre = cadre;
            _cours = c;

            tBNom.Text      = _cours.nom;
            tBHoraires.Text = _cours.volume_horraire.ToString();

            initialiseCBType();
        }
Exemplo n.º 18
0
        public ActionResult Create([Bind(Include = "id,course,duration")] cours cours)
        {
            if (ModelState.IsValid)
            {
                db.courses.Add(cours);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cours));
        }
Exemplo n.º 19
0
 private bool txtTrouveDans(cours c)
 {
     if ((c.nom.ToLower().Contains(tbRecherche.Text.ToLower())) ||
         (c.type_cours.nom.ToLower().Contains(tbRecherche.Text.ToLower())) ||
         (c.volume_horraire.ToString().Contains(tbRecherche.Text)) ||
         ((c.personnel != null) && (c.personnel.nom.ToLower().Contains(tbRecherche.Text.ToLower()))) ||
         (c.ec.nom.ToLower().Contains(tbRecherche.Text.ToLower())))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 20
0
        private void insertCourseExamResults()
        {
            foreach (Student_Courses i in choosenCourses)
            {
                Debug.WriteLine(i.course_id);
                cours  tempCourse = studentCourses.First(course => course.Course_id == i.course_id);
                string courseName = tempCourse.Course_name;
                string Nakaz      = tempCourse.Nakaz.ToString();

                ExamResultDataGridView.Rows.Add(courseName, i.course_id, Nakaz, i.quiz1, i.quiz2, i.grade_a, i.grade_b, i.grade_c, i.final_grade);
            }
        }
Exemplo n.º 21
0
        public UC_ElementCoursPersonnel(UC_OngletPersonnels cadre, cours c) : base(cadre)
        {
            _cours = c;
            InitializeComponent();
            gBAffElement.Text = _cours.nom;
            tBCours.Text      = Requetes.obtientTypeduCours(_cours).nom;
            tBHoraires.Text   = _cours.volume_horraire.ToString();
            tBEC.Text         = Requetes.obtientECduCours(_cours).nom;

            // Nous sommes sûr d'avoir un personnel assigné ici
            _personnel = Requetes.obtientPersonnelduCours(c);
        }
 public ActionResult Edit([Bind(Include = "courseID,room,coursecode,coursename,ects,section,prerequisites,day,coursetype,departmentID,semesterno,instructorID,examdate,examtime,coursestart,courseend,quota")] cours cours)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cours).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.departmentID = new SelectList(db.departments, "departmentID", "depname", cours.departmentID);
     ViewBag.instructorID = new SelectList(db.instructors, "instructorID", "instfullname", cours.instructorID);
     return(View(cours));
 }
Exemplo n.º 23
0
        public UC_ElementFenCours(FenetreAssignationCours cadre, cours c)
        {
            InitializeComponent();
            _cadre = cadre;
            _cours = c;

            gBAffElement.Text = _cours.nom;
            tBCours.Text      = Requetes.obtientTypeduCours(_cours).nom;
            tBHoraires.Text   = _cours.volume_horraire.ToString();
            tBEC.Text         = Requetes.obtientECduCours(_cours).nom;

            toolTip1.SetToolTip(this.pBAjouterCours, "Ajouter un cours au personnel");
        }
Exemplo n.º 24
0
        private void fillInfoGridView()
        {
            cours selected =
                (from sc in selectedCourse
                 from oc in openCourses where oc.Course_id == sc.Course_ID
                 select oc).FirstOrDefault();

            courseGridView.Rows[0].Cells["Fact"].Value = selected.Course_id;
            courseGridView.Rows[1].Cells["Fact"].Value = selected.Nakaz;
            courseGridView.Rows[2].Cells["Fact"].Value = selected.Year;
            courseGridView.Rows[3].Cells["Fact"].Value = selected.Semester;
            courseGridView.Rows[4].Cells["Fact"].Value = selected.Blocking_Cource;
        }
Exemplo n.º 25
0
        public FenetreRetraitCours(UC_OngletPersonnels cadre, personnel p, cours c)
        {
            InitializeComponent();
            _cadre     = cadre;
            _personnel = p;
            _cours     = c;

            lNomCours.Text     = _cours.nom;
            lNomPersonnel.Text = _personnel.nom + " " + _personnel.prenom;

            lNomCours.ForeColor     = Color.FromArgb(83, 181, 0);
            lNomPersonnel.ForeColor = Color.FromArgb(83, 181, 0);
        }
Exemplo n.º 26
0
        public ActionResult AddANEWClasss(cours c, HttpPostedFileBase file)
        {
            c.Owner = Session["id"].ToString().Trim();

            db.cours.InsertOnSubmit(c);
            db.SubmitChanges();

            var path = Path.Combine(Server.MapPath("~/CoursIMG"), c.Id + ".jpg");

            file.SaveAs(path);

            return(RedirectToAction("LesCours"));
        }
Exemplo n.º 27
0
        public FenetreRetraitPersonnel(UC_OngletDiplomes cadre, cours c)
        {
            InitializeComponent();
            _cadre = cadre;
            _cours = c;

            personnel p = Database.instance.personnel.Where(x => x.id == _cours.personnel.id).FirstOrDefault <personnel>();

            lNomPersonnel.Text = p.nom + " " + p.prenom;
            lNomCours.Text     = _cours.nom;

            lNomPersonnel.ForeColor = Color.FromArgb(83, 181, 0);
            lNomCours.ForeColor     = Color.FromArgb(83, 181, 0);
        }
Exemplo n.º 28
0
        // GET: Course/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            cours cours = db.courses.Find(id);

            if (cours == null)
            {
                return(HttpNotFound());
            }
            return(View(cours));
        }
Exemplo n.º 29
0
        public void AssigneCours(cours c)
        {
            if ((Requetes.nbrHeureManquantes(_personnel) - c.volume_horraire) >= 0)
            {
                _personnel.cours.Add(c);
                Requetes.enregistreLaBDD();
            }
            else
            {
                MessageBox.Show("Le volume horraire disponible est insuffisant");
            }

            _cadre.Actualiser();
        }
Exemplo n.º 30
0
        // GET: Course/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            cours cours = db.courses.Find(id);

            if (cours == null)
            {
                return(HttpNotFound());
            }
            ViewBag.course_type = new SelectList(db.courses_type, "id", "name", cours.course_type);
            return(View(cours));
        }