Exemple #1
0
 public ActionResult CreateStudent()
 {
     if ((string)Session["role"] == "Admin")
     {
         var         student     = UserAction.GetAll();
         List <User> lst_student = new List <User>();
         for (int i = 0; i < student.Count; i++)
         {
             if (student[i].role == "Student" && StudentAction.Find(student[i].id_number) == null)
             {
                 lst_student.Add(student[i]);
             }
         }
         ViewBag.Account     = lst_student;
         ViewBag.Nganh       = MajorAction.GetAll();
         ViewBag.ChuyenNganh = SpecializedAction.GetAll();
         ViewBag.Lop         = ClassAction.GetAll();
         ViewBag.SV          = StudentAction.ShowAll();
         return(View());
     }
     else
     {
         return(Redirect("~/Home/Index"));
     }
 }
Exemple #2
0
        public ActionResult RegisterSubject(string Id_Class, string Id_Subject, string Id_Teacher, int Year_Term)
        {
            if (Session["student_subject"] == null)
            {
                var gv            = TeacherAction.GetAll();
                var mh            = SubjectAction.GetAll();
                var lop           = ClassAction.GetAll();
                var nam           = YearTermAction.GetAll();
                var teacher_info  = gv.Find(a => a.id == Id_Teacher);
                var subject_infor = mh.Find(a => a.id == Id_Subject);
                var class_info    = lop.Find(a => a.id == Id_Class);
                var year_info     = nam.Find(a => a.year_term == Year_Term);
                List <Tuple <Subject, YearTerm, Class, Teacher> > lst = new List <Tuple <Subject, YearTerm, Class, Teacher> >();
                Tuple <Subject, YearTerm, Class, Teacher>         tup = new Tuple <Subject, YearTerm, Class, Teacher>(subject_infor, year_info, class_info, teacher_info);
                lst.Add(tup);
                Session["student_subject"] = lst;
            }
            else
            {
                List <Tuple <Subject, YearTerm, Class, Teacher> > lst = (List <Tuple <Subject, YearTerm, Class, Teacher> >)Session["student_subject"];
                var gv            = TeacherAction.GetAll();
                var mh            = SubjectAction.GetAll();
                var lop           = ClassAction.GetAll();
                var nam           = YearTermAction.GetAll();
                var teacher_info  = gv.Find(a => a.id == Id_Teacher);
                var subject_infor = mh.Find(a => a.id == Id_Subject);
                var class_info    = lop.Find(a => a.id == Id_Class);
                var year_info     = nam.Find(a => a.year_term == Year_Term);
                Tuple <Subject, YearTerm, Class, Teacher> tup = new Tuple <Subject, YearTerm, Class, Teacher>(subject_infor, year_info, class_info, teacher_info);
                lst.Add(tup);
                Session["student_subject"] = lst;
            }

            return(Redirect("~/Student/RegisterSubject"));
        }
Exemple #3
0
 public ActionResult CreateSubject()
 {
     if ((string)Session["role"] == "Admin")
     {
         ViewBag.ChuyenNganh = SpecializedAction.GetAll();
         ViewBag.Nganh       = MajorAction.GetAll();
         ViewBag.Lop         = ClassAction.GetAll();
         ViewBag.MH          = SubjectAction.ShowAll();
         ViewBag.GV          = TeacherAction.GetAll();
         ViewBag.YearTerm    = YearTermAction.GetAll();
         return(View());
     }
     else
     {
         return(Redirect("~/Home/Index"));
     }
 }
Exemple #4
0
 public ActionResult CreateTeacher()
 {
     if ((string)Session["role"] == "Admin")
     {
         var         teacher  = UserAction.GetAll();
         List <User> lst_user = new List <User>();
         for (int i = 0; i < teacher.Count; i++)
         {
             if (teacher[i].role == "Teacher" && TeacherAction.Find(teacher[i].id_number) == null)
             {
                 lst_user.Add(teacher[i]);
             }
         }
         ViewBag.Account = lst_user;
         ViewBag.Nganh   = MajorAction.GetAll();
         ViewBag.Lop     = ClassAction.GetAll();
         ViewBag.GV      = TeacherAction.ShowAll();
         return(View());
     }
     else
     {
         return(Redirect("~/Home/Index"));
     }
 }