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)); }
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 } } } }
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; } }
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); } }
public FenetreAssignationPersonnel(UC_OngletDiplomes cadre, cours cours) { InitializeComponent(); _cadre = cadre; _cours = cours; initialisation(); }
public ActionResult DeleteConfirmed(int id) { cours cours = db.courses.Find(id); db.courses.Remove(cours); db.SaveChanges(); return(RedirectToAction("Index")); }
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; }
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; }
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); } }
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(); } }
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)); }
public void filArianeCoursApparait(cours c) { nbOngletsOuverts = 7; _c = c; couleurdeFondBlanche(lEC); couleurdeFondBleue(lCours); lCours.Visible = true; lCours.Text = "Cours :" + Environment.NewLine + _c.nom; }
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(); } }
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)); }
public FenetreModifCoursD(UC_ElementCoursDiplome cadre, cours c) { InitializeComponent(); _cadre = cadre; _cours = c; tBNom.Text = _cours.nom; tBHoraires.Text = _cours.volume_horraire.ToString(); initialiseCBType(); }
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)); }
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); }
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); } }
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)); }
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"); }
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; }
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); }
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")); }
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); }
// 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)); }
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(); }
// 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)); }