コード例 #1
0
        public ActionResult DeleteAll()
        {
            MSSEntities db = new MSSEntities();

            db.Database.ExecuteSqlCommand("Delete from Student_Specification_Log");
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult ReportStudent(string id)
        {
            var           Roll        = id.Split('^')[0];
            var           Semester_ID = id.Split('^')[2];
            var           Subject_ID  = id.Split('^')[1];
            var           maxDate     = new MSSEntities().Student_Course_Log.OrderByDescending(o => o.Date_Import).FirstOrDefault().Date_Import;
            var           list        = new MSSEntities().Student_Course_Log.Where(l => l.Roll == Roll && l.Semester_ID == Semester_ID && l.Subject_ID == Subject_ID && l.Date_Import == maxDate).ToList();
            StringBuilder sb          = new StringBuilder();

            foreach (var lst in list)
            {
                var    complete                  = lst.Completed == true ? "Yes" : "No";
                var    status                    = lst.Status == true ? "Yes" : "No";
                var    completeTime              = lst.Completion_Time.ToString().Contains("1/1/1970") ? "" : Convert.ToDateTime(lst.Completion_Time).ToString("dd/MM/yyyy");
                string Course_Enrollment_Time    = lst.Course_Enrollment_Time.ToString().Contains("1/1/1970") ? "" : Convert.ToDateTime(lst.Course_Enrollment_Time).ToString("dd/MM/yyyy");
                string Last_Course_Activity_Time = lst.Last_Course_Activity_Time.ToString().Contains("1/1/1970") ? "" : Convert.ToDateTime(lst.Last_Course_Activity_Time).ToString("dd/MM/yyyy");
                string Course_Start_Time         = lst.Course_Start_Time.ToString().Contains("1/1/1970") ? "" : Convert.ToDateTime(lst.Course_Start_Time).ToString("dd/MM/yyyy");
                string date = Convert.ToDateTime(lst.Date_Import).ToString("dd/MM/yyyy");

                sb.Append("<tr><td>" + lst.Course_Name + "</td><td>" + lst.Course_Slug + "</td>" +
                          "<td>" + lst.Campus + "</td><td> " + lst.University + "</td>" +
                          "<td>" + Course_Enrollment_Time + " </td><td> " + Course_Start_Time + "</td>" +
                          "<td>" + Last_Course_Activity_Time + "</td><td> " + lst.Overall_Progress + "</td>" +
                          "<td>" + lst.Estimated + "</td><td> " + complete + "</td>" +
                          "<td>" + status + "</td><td> " + lst.Program_Slug + "</td>" +
                          "<td>" + lst.Program_Name + "</td><td> " + lst.Enrollment_Source + "</td>" +
                          "<td>" + completeTime + "</td><td> " + lst.Course_Grade + "</td>" +
                          "<td>" + date + "</td>" +
                          "</tr>");
            }
            return((ActionResult)this.Json((object)new
            {
                list = sb.ToString()
            }));
        }
コード例 #3
0
        public List <Cour_dealine> GetPageList()
        {
            List <Cour_dealine> cour = new List <Cour_dealine>();

            using (MSSEntities db = new MSSEntities())
            {
                cour = (from cd in db.Course_Deadline
                        join c in db.Courses on cd.Course_ID equals c.Course_ID
                        join s in db.Semesters on cd.Semester_ID equals s.Semester_ID
                        into tempTable from ed in tempTable.DefaultIfEmpty()
                        select new Cour_dealine
                {
                    Course_Deadline_ID = cd.Course_Deadline_ID,
                    Course_ID = cd.Course_ID,
                    Courses_Name = c.Course_Name,
                    Semester_ID = ed.Semester_ID == null ? "" : ed.Semester_ID,
                    Semester_Name = ed.Semester_Name == null ? "" : ed.Semester_Name,
                    Deadline = cd.Deadline
                })
                       .ToList();
                cour = (from o in cour
                        orderby o.Course_ID descending
                        select o)
                       .ToList();
                return(cour);
            }
        }
コード例 #4
0
ファイル: ReportController.cs プロジェクト: thinhnn136/MSS
        private int Campus(string subjectId, string campus)
        {
            var context = new MSSEntities();
            var student = 0;

            if (subjectId == "" && campus != "")
            {
                student = (from a in context.Subjects
                           join b in context.Subject_Student on a.Subject_ID equals b.Subject_ID
                           join c in context.Students on b.Roll equals c.Roll
                           where c.Campus == campus
                           select c.Roll).Count();
            }
            else if (subjectId == "" && campus == "")
            {
                student = (from a in context.Subjects
                           join b in context.Subject_Student on a.Subject_ID equals b.Subject_ID
                           join c in context.Students on b.Roll equals c.Roll
                           select c.Roll).Count();
            }
            else
            {
                student = (from a in context.Subjects
                           join b in context.Subject_Student on a.Subject_ID equals b.Subject_ID
                           join c in context.Students on b.Roll equals c.Roll
                           where subjectId == a.Subject_ID && c.Campus == campus
                           select c.Roll).Count();
            }

            return(student);
        }
コード例 #5
0
        public List <Specification> GetPageList()
        {
            List <Specification> cour = new List <Specification>();

            using (MSSEntities db = new MSSEntities())
            {
                cour = (from o in db.Specifications
                        orderby o.Specification_ID descending
                        select o)
                       .ToList();

                return(cour);
            }
        }
コード例 #6
0
        public List <Student_Specification_Log> GetPageList()
        {
            List <Student_Specification_Log> student = new List <Student_Specification_Log>();

            using (MSSEntities db = new MSSEntities())
            {
                student = (from o in db.Student_Specification_Log
                           orderby o.Specification_Log_ID descending
                           select o)
                          .ToList();

                return(student);
            }
        }
コード例 #7
0
ファイル: UserRepository.cs プロジェクト: trungtd19/MSS
        public List <User_Role> GetPageList()
        {
            List <User_Role> users = new List <User_Role>();

            using (MSSEntities db = new MSSEntities())
            {
                users = (from o in db.User_Role
                         orderby o.User_ID ascending
                         select o)
                        .ToList();

                return(users);
            }
        }
コード例 #8
0
        public List <Specification> GetListID()
        {
            List <Specification> spec = new List <Specification>();

            using (MSSEntities db = new MSSEntities())
            {
                spec = (from sp in db.Specifications
                        join su in db.Subjects on sp.Subject_ID equals su.Subject_ID
                        select new Specification {
                    Subject_ID = su.Subject_ID, Specification_ID = sp.Specification_ID
                }).ToList();
                return(spec);
            }
        }
コード例 #9
0
        public List <Subject> GetPageList()
        {
            List <Subject> cour = new List <Subject>();

            using (MSSEntities db = new MSSEntities())
            {
                cour = (from o in db.Subjects
                        orderby o.Subject_ID descending
                        select o)
                       .ToList();

                return(cour);
            }
        }
コード例 #10
0
        public List <Course_Spec_Sub> GetListID()
        {
            List <Course_Spec_Sub> cour = new List <Course_Spec_Sub>();

            using (MSSEntities db = new MSSEntities())
            {
                cour = (from cou in db.Courses
                        join sp in db.Specifications on cou.Specification_ID equals sp.Specification_ID
                        join su in db.Subjects on sp.Subject_ID equals su.Subject_ID
                        select new Course_Spec_Sub {
                    Course_ID = cou.Course_ID, Subject_ID = su.Subject_ID
                }).ToList();
                return(cour);
            }
        }
コード例 #11
0
        public List <Cours_Spec> GetPageList()
        {
            List <Cours_Spec> cour = new List <Cours_Spec>();

            if (context.Courses.Count() == 0)
            {
                return(cour);
            }
            int coursesCount = 1;
            int growRow      = 1;
            int growRowNo    = 1;

            using (MSSEntities db = new MSSEntities())
            {
                cour = (from cou in db.Courses
                        join dl in db.Specifications on cou.Specification_ID equals dl.Specification_ID into empSpec
                        from ed in empSpec.DefaultIfEmpty()
                        select new Cours_Spec {
                    Course_ID = cou.Course_ID, Course_Name = cou.Course_Name, Specification_ID = cou.Specification_ID, Specification_Name = ed.Specification_Name == null ? "Not Map" : ed.Specification_Name
                }).ToList();
                cour = (from o in cour
                        orderby o.Specification_ID descending
                        select o)
                       .ToList();
                cour[0].groupRow   = growRow;
                cour[0].groupRowNo = growRowNo;
                while (coursesCount < cour.Count())
                {
                    if (cour[coursesCount - 1].Specification_ID == cour[coursesCount].Specification_ID)
                    {
                        cour[coursesCount].groupRow = growRow;
                        growRowNo++;
                        cour[coursesCount].groupRowNo = growRowNo;
                    }
                    else
                    {
                        growRow++;
                        growRowNo = 1;
                        cour[coursesCount].groupRow   = growRow;
                        cour[coursesCount].groupRowNo = growRowNo;
                    }
                    coursesCount++;
                }
                return(cour);
            }
        }
コード例 #12
0
 public ActionResult AddNote(string id, string note)
 {
     try
     {
         var         userMentor  = (UserLogin)HttpContext.Session[CommonConstants.User_Session];
         MSSEntities context     = new MSSEntities();
         Mentor_Log  log         = new Mentor_Log();
         var         Roll        = id.Split('^')[0];
         var         Semester_ID = id.Split('^')[2];
         var         Subject_ID  = id.Split('^')[1];
         var         noteLog     = context.Mentor_Log.Where(o => o.Roll.Trim() == Roll && o.Semester_ID.Trim() == Semester_ID.Trim() && o.Subject_ID.Trim() == Subject_ID.Trim()).FirstOrDefault();
         if (noteLog == null)
         {
             context.Mentor_Log.Add(new Mentor_Log
             {
                 Roll        = Roll,
                 Semester_ID = Semester_ID,
                 Subject_ID  = Subject_ID,
                 Note        = "[" + userMentor.UserName.Split('@')[0] + "-" + Convert.ToDateTime(DateTime.Now).ToString("dd/MM/yyyy HH:mm:ss") + "]" + note + "\n"
             });
             context.SaveChanges();
         }
         else
         if (noteLog.Note.Trim().Length == note.Trim().Length)
         {
             return(Json(new { check = true }));
         }
         else
         {
             if (note.Trim().Length > noteLog.Note.Trim().Length)
             {
                 noteLog.Note = noteLog.Note + "\n" + "[" + userMentor.UserName.Split('@')[0] + "-" + Convert.ToDateTime(DateTime.Now).ToString("dd/MM/yyyy HH:mm:ss") + "]" + note.Substring(noteLog.Note.Length, note.Length - noteLog.Note.Length);
             }
             else
             {
                 noteLog.Note = note;
             }
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         return(Json(new { check = false }));
     }
     return(Json(new { check = true }));
 }
コード例 #13
0
        public ActionResult StudentDetails(string id)
        {
            MSSEntities             context = new MSSEntities();
            StudentDetailsViewModel model   = new StudentDetailsViewModel();
            var Roll        = id.Split('^')[0];
            var Semester_ID = id.Split('^')[2];
            var Subject_ID  = id.Split('^')[1];
            var maxDate     = context.Student_Course_Log.OrderByDescending(o => o.Date_Import).FirstOrDefault().Date_Import;
            var list        = context.Student_Course_Log.Where(l => l.Roll == Roll && l.Semester_ID == Semester_ID && l.Subject_ID == Subject_ID && l.Date_Import == maxDate).ToList();

            model.UsageReport = list;
            var note = context.Mentor_Log.Where(l => l.Roll == Roll && l.Semester_ID == Semester_ID && l.Subject_ID == Subject_ID).FirstOrDefault();

            model.Note         = note == null ? "" : note.Note;
            ViewBag.id         = id;
            model.MemberReport = unitOfWork.CoursesLog.MemberReport(Roll, Semester_ID, maxDate);
            return(View(model));
        }
コード例 #14
0
ファイル: ReportController.cs プロジェクト: thinhnn136/MSS
        private int Count(string subject, string campus)
        {
            //double per;
            int count   = 0;
            var context = new MSSEntities();

            if (subject != "" && campus == "")
            {
                count = (from a in context.Student_Course_Log
                         join b in context.Courses on a.Course_ID equals b.Course_ID
                         join c in context.Specifications on b.Specification_ID equals c.Specification_ID
                         join d in context.Subjects on c.Subject_ID equals d.Subject_ID
                         where subject == d.Subject_ID
                         select a.Roll).Distinct().Count();
            }
            else if (subject == "" && campus == "")
            {
                count = (from a in context.Student_Course_Log
                         join b in context.Courses on a.Course_ID equals b.Course_ID
                         join c in context.Specifications on b.Specification_ID equals c.Specification_ID
                         join d in context.Subjects on c.Subject_ID equals d.Subject_ID
                         select a.Roll).Distinct().Count();
            }
            else if (subject != "" && campus != "")
            {
                count = (from a in context.Student_Course_Log
                         join b in context.Courses on a.Course_ID equals b.Course_ID
                         join c in context.Specifications on b.Specification_ID equals c.Specification_ID
                         join d in context.Subjects on c.Subject_ID equals d.Subject_ID
                         where  a.Campus == campus && a.Subject_ID == subject
                         select a.Roll).Distinct().Count();
            }
            else if (subject == "" && campus != "")
            {
                count = (from a in context.Student_Course_Log
                         join b in context.Courses on a.Course_ID equals b.Course_ID
                         join c in context.Specifications on b.Specification_ID equals c.Specification_ID
                         join d in context.Subjects on c.Subject_ID equals d.Subject_ID
                         where a.Campus == campus
                         select a.Roll).Distinct().Count();
            }
            return(count);
        }
コード例 #15
0
        public List <Cours_Spec> GetPageList()
        {
            List <Cours_Spec> cour = new List <Cours_Spec>();

            using (MSSEntities db = new MSSEntities())
            {
                cour = (from cou in db.Courses
                        join dl in db.Specifications on cou.Specification_ID equals dl.Specification_ID into empSpec
                        from ed in empSpec.DefaultIfEmpty()
                        select new Cours_Spec {
                    Course_ID = cou.Course_ID, Course_Name = cou.Course_Name, Specification_ID = cou.Specification_ID, Specification_Name = ed.Specification_Name == null ? "Not Map" : ed.Specification_Name
                }).ToList();
                cour = (from o in cour
                        orderby o.Course_ID descending
                        select o)
                       .ToList();
                return(cour);
            }
        }
コード例 #16
0
 public List <_Semester> toList()
 {
     using (MSSEntities db = new MSSEntities())
     {
         var sem = (from o in db.Semesters
                    orderby o.Start_Date descending
                    select new
         {
             Semester_ID = o.Semester_ID,
             Semester_Name = o.Semester_Name,
             Start_Date = o.Start_Date,
             End_Date = o.End_Date
         }).ToList().Select(x => new _Semester
         {
             Semester_ID   = x.Semester_ID,
             Semester_Name = x.Semester_Name,
             dateStart     = convertDate(x.Start_Date),
             dateEnd       = convertDate(x.End_Date),
         })
                   .ToList();
         return(sem);
     }
 }
コード例 #17
0
ファイル: LoginController.cs プロジェクト: trungtd19/MSS
        private bool checkMentor(string userMentor)
        {
            MSSEntities           context         = new MSSEntities();
            Semester              semester        = new Semester();
            DateTime              date            = DateTime.Now;
            CourseraApiSoapClient courseraApiSoap = new CourseraApiSoapClient();

            semester = context.Semesters.Where(sem => sem.Start_Date <date && sem.End_Date> date).FirstOrDefault();
            var    listSubjectID             = context.Subjects.Where(o => o.Subject_Active == true).Select(o => o.Subject_ID).ToArray();
            string authenKey                 = "A90C9954-1EDD-4330-B9F3-3D8201772EEA";
            List <MentorObject> objectMentor = new List <MentorObject>();

            try
            {
                string jsonData         = courseraApiSoap.GetScheduledSubject(authenKey, userMentor.Split('@')[0], listSubjectID, semester.Semester_Name.Replace(" ", ""));
                var    scheduledSubject = Newtonsoft.Json.JsonConvert.DeserializeObject <List <MertorFAP> >(jsonData);
                scheduledSubject = scheduledSubject.Distinct(new ListComparer()).ToList();

                foreach (var scheduled in scheduledSubject)
                {
                    objectMentor.Add(new MentorObject
                    {
                        Subject_ID = scheduled.SubjectCode,
                        Class_ID   = scheduled.ClassName
                    });
                }
            }
            catch
            {
                objectMentor = new List <MentorObject>();
            }
            if (objectMentor.Count > 0)
            {
                return(true);
            }
            return(false);
        }
コード例 #18
0
        public ActionResult Detail(StatusOverviewModel model, string id, string searchCheck, string selectCoursCompleted, string selectFinalStatus)
        {
            DateTime date                         = DateTime.Now;
            var      semester                     = unitOfWork.Semesters.GetAll().Where(sem => sem.Start_Date <date && sem.End_Date> date).FirstOrDefault();
            var      userMentor                   = (UserLogin)HttpContext.Session[CommonConstants.User_Session];
            var      listSubjectClass             = unitOfWork.CoursesLog.getListSubjectClass(userMentor.UserName, semester);
            CourseraApiSoapClient courseraApiSoap = new CourseraApiSoapClient();
            string jsonDataClass                  = "";

            model.searchCheck = searchCheck;
            List <StatusOverviewModel> Status = new List <StatusOverviewModel>();

            if (!String.IsNullOrEmpty(searchCheck))
            {
                try
                {
                    foreach (var subjectClass in listSubjectClass)
                    {
                        if (id == subjectClass.id)
                        {
                            string authenKey = "A90C9954-1EDD-4330-B9F3-3D8201772EEA";
                            jsonDataClass = courseraApiSoap.getStudents(authenKey, userMentor.UserName.Split('@')[0], subjectClass.Subject_ID.Trim(), subjectClass.Class_ID.Trim(), semester.Semester_Name);
                            var rollFap = Newtonsoft.Json.JsonConvert.DeserializeObject <List <RollFAP> >(jsonDataClass);
                            var rolls   = rollFap[0].RollNumber.ToString().Trim();
                            rolls = "," + rolls + ",";
                            var maxDate    = new MSSEntities().Student_Course_Log.Where(o => o.Semester_ID == semester.Semester_ID).OrderByDescending(o => o.Date_Import).FirstOrDefault().Date_Import;
                            var statusList = new MSSEntities().sp_Get_Main_Report(maxDate, semester.Semester_ID, -1, "", "", "", "", rolls).ToList();
                            foreach (var item in statusList)
                            {
                                if (item.Subject_ID.Trim().Equals(id.Split('^')[0].Trim()))
                                {
                                    Status.Add(new StatusOverviewModel
                                    {
                                        Roll                 = item.Roll,
                                        Email                = item.Email,
                                        Note                 = item.Note,
                                        SubjectID            = item.Subject_ID,
                                        SubjectName          = item.Subject_Name,
                                        No_Compulsory_Course = item.No_Compulsory_Course,
                                        No_Course_Completed  = item.No_Course_Completed,
                                        Spec_Completed       = item.Spec_Completed,
                                        Final_Status         = item.Final_status,
                                        Campus               = item.Campus_ID
                                    });
                                }
                            }
                            break;
                        }
                    }
                }
                catch
                {
                    Status = new List <StatusOverviewModel>();
                }
                if (!string.IsNullOrWhiteSpace(model.Roll))
                {
                    Status = Status.Where(s => s.Roll.Trim().Contains(model.Roll.Trim())).ToList();
                }
                if (Convert.ToInt32(selectCoursCompleted) != -1)
                {
                    Status = Status.Where(s => s.No_Course_Completed == Convert.ToInt32(selectCoursCompleted)).ToList();
                }
                if (!string.IsNullOrWhiteSpace(selectFinalStatus))
                {
                    Status = Status.Where(s => s.Final_Status.Trim().Equals(selectFinalStatus.Trim())).ToList();
                }
                if (Status.Count == 0)
                {
                    ViewBag.Nodata = "No data found";
                }
                else
                {
                    ViewBag.Nodata = "";
                }
            }
            ViewBag.Subject    = id.Split('^')[0];
            ViewBag.Class      = id.Split('^')[1];
            ViewBag.SemesterID = semester != null ? semester.Semester_ID : "";
            List <SelectListItem> selectFinal = new List <SelectListItem>();

            selectFinal.Add(new SelectListItem {
                Text = "--All--", Value = ""
            });
            selectFinal.Add(new SelectListItem {
                Text = "Completed", Value = "Completed"
            });
            selectFinal.Add(new SelectListItem {
                Text = "Not Completed", Value = "Not Completed"
            });
            ViewBag.selectFinalStatus = selectFinal;
            ViewBag.CountRoll         = Status.Select(o => o.Roll).Distinct().Count();
            ViewBag.CountLog          = Status.Count();
            model.OverviewList        = Status;
            return(View(model));
        }
コード例 #19
0
 public SubjectStudentRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #20
0
ファイル: LoginController.cs プロジェクト: trungtd19/MSS
        public ActionResult LoginWithGoogle(string Email)
        {
            User_Role user = null;

            string[] temp      = Email.Split('@');
            string   checkmail = temp[1];
            string   checkStudent;

            checkStudent = temp[0].Substring(temp[0].Length - 5);
            using (var ctx = new MSSEntities())
            {
                user = ctx.User_Role
                       .SqlQuery("Select * from User_Role where Login=@Login", new SqlParameter("@Login", Email))
                       .FirstOrDefault();
            }
            if (user != null)
            {
                if (user.isActive == false)
                {
                    ViewBag.Error = "Login Fail!";
                    return(View("Login"));
                }
                else
                {
                    var RoleSession = new RoleLogin();
                    RoleSession.Role = user.Role_ID;
                    var UserSession = new UserLogin();
                    UserSession.UserID   = user.User_ID;
                    UserSession.UserName = Email;
                    Session.Add(CommonConstants.ROLE_Session, RoleSession);
                    Session.Add(CommonConstants.User_Session, UserSession);
                    return(RedirectToAction("Index", "Home"));
                }
            }
            if (user == null)
            {
                if (!checkmail.Equals("fpt.edu.vn"))
                {
                    ViewBag.Error = "Login Fail!";
                    return(View("Login"));
                }
                else if (IsNumber(checkStudent))
                {
                    var RoleSession = new RoleLogin();
                    RoleSession.Role = 5;
                    var UserSession = new UserLogin();
                    UserSession.UserID   = 5;
                    UserSession.UserName = Email;
                    Session.Add(CommonConstants.ROLE_Session, RoleSession);
                    Session.Add(CommonConstants.User_Session, UserSession);
                    return(RedirectToAction("Index", "Home"));
                }
                else if (checkMentor(Email) == true)
                {
                    var RoleSession = new RoleLogin();
                    RoleSession.Role = 3;
                    var UserSession = new UserLogin();
                    UserSession.UserID   = 3;
                    UserSession.UserName = Email;
                    Session.Add(CommonConstants.ROLE_Session, RoleSession);
                    Session.Add(CommonConstants.User_Session, UserSession);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ViewBag.Error = "Login Fail!";
                    return(View("Login"));
                }
            }
            else
            {
                ViewBag.Error = "Login Fail!";
                return(View("Login"));
            }
        }
コード例 #21
0
ファイル: UserRepository.cs プロジェクト: trungtd19/MSS
 public UserRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #22
0
 public ClassStudentRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #23
0
 public StudentCoursesLogRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #24
0
ファイル: SemestersRepository.cs プロジェクト: thinhnn136/MSS
 public SemestersRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #25
0
 public CampusRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #26
0
 public SpecificationsRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #27
0
ファイル: ReportController.cs プロジェクト: thinhnn136/MSS
        // GET: Report

        public ActionResult Index(Report rp)
        {
            List <Report> rep  = new List <Report>();
            List <Report> rep2 = new List <Report>();

            var context = new MSSEntities();

            foreach (var sub in context.Subjects)
            {
                var Totall = (from a in context.Subjects
                              join b in context.Subject_Student on a.Subject_ID equals b.Subject_ID
                              join c in context.Students on b.Roll equals c.Roll
                              where sub.Subject_ID == a.Subject_ID
                              select c.Roll).Count();

                var Type = (from a in context.Specifications
                            where sub.Subject_ID == a.Subject_ID && a.Is_Real_Specification == true
                            select a.Specification_ID).Count();
                String ListType = "";
                if (Type == 1)
                {
                    ListType = "Spec";
                }
                else
                {
                    ListType = "Course";
                }

                List <double> count = new List <double>();
                List <string> name  = new List <string>();

                foreach (var cp in context.Campus)
                {
                    count.Add(Campus(sub.Subject_ID, cp.Campus_ID));
                    name.Add(cp.Campus_ID);
                }
                ViewBag.Name = name;
                ViewBag.Cmp  = count;

                rep.Add(new Report {
                    Sub = sub.Subject_ID, Name = sub.Subject_Name, Type = ListType, Total = Totall, Cmp = count
                });

                List <double> count2 = new List <double>();
                int           Total  = Count(sub.Subject_ID, "");

                foreach (var cp in context.Campus)
                {
                    count2.Add(Count(sub.Subject_ID, cp.Campus_ID));
                }
                rep2.Add(new Report {
                    Sub = sub.Subject_ID, Name = sub.Subject_Name, Study = percent(Total, Totall), Total = Total, Cmp = count2
                });
            }
            var TotalStudent = (from a in context.Students
                                select a.Roll).Count();
            List <double> temp = new List <double>();

            temp.Add(Campus("", ""));
            foreach (var cp in context.Campus)
            {
                temp.Add(Campus("", cp.Campus_ID));
            }
            ViewBag.Count         = temp;
            ViewBag.TotalStudent1 = TotalStudent;
            int TotalStudent2 = Count("", "");

            ViewBag.TotalStudent2 = TotalStudent2;


            List <double> temp2 = new List <double>();

            ViewBag.TotalPercent = percent(TotalStudent2, TotalStudent);
            temp2.Add(Count("", ""));
            foreach (var cp in context.Campus)
            {
                temp2.Add(Count("", cp.Campus_ID));
            }
            ViewBag.Count2 = temp2;

            List <double> per = new List <double>();

            //per.Add(percent(Count("", ""), Campus("", "")));
            foreach (var cp in context.Campus)
            {
                per.Add(percent(Count("", cp.Campus_ID), Campus("", cp.Campus_ID)));
            }
            ViewBag.Per = per;

            var studentComplete = (from a in context.Student_Course_Log
                                   join b in context.Courses on a.Course_ID equals b.Course_ID
                                   join c in context.Specifications on b.Specification_ID equals c.Specification_ID
                                   where a.Completed == true
                                   select a.Roll).Distinct().Count();
            var courseComplete = (from a in context.Student_Course_Log
                                  join b in context.Courses on a.Course_ID equals b.Course_ID
                                  join c in context.Specifications on b.Specification_ID equals c.Specification_ID
                                  where a.Completed == true
                                  select a.Course_ID).Count();

            ViewBag.studentComplete = studentComplete;
            ViewBag.courseComplete  = courseComplete;


            var Estimated = (from a in context.Student_Course_Log
                             where a.Estimated < 5
                             select a.Roll).Distinct().Count();
            var perc = percent(Estimated, TotalStudent);

            ViewBag.Estimated = Estimated;
            ViewBag.Percent   = perc;

            rp.rp1 = rep;
            rp.rp2 = rep2;
            return(View("Index", rp));
        }
コード例 #28
0
 public StudentSpecificationLogRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #29
0
 public CoursesRepository(MSSEntities context)
     : base(context)
 {
 }
コード例 #30
0
ファイル: ReportController.cs プロジェクト: thinhnn136/MSS
        public ActionResult Member(ListStudent ls, string searchString, string searchCheck, string selectString2, string selectString3)
        {
            var                context      = new MSSEntities();
            List <string>      NoEnrollment = new List <string>();
            List <ListStudent> s            = new List <ListStudent>();

            var CourseStudent = (from a in context.Student_Course_Log
                                 select new
            {
                Roll = a.Roll
            }).Distinct().ToList();
            var Student = (from a in context.Student_Course_Log
                           join b in context.Courses on a.Course_ID equals b.Course_ID
                           join c in context.Specifications on b.Specification_ID equals c.Specification_ID
                           join d in context.Subjects on c.Subject_ID equals d.Subject_ID
                           select new
            {
                Roll = a.Roll
            }).Distinct().ToList();

            foreach (var cs in CourseStudent)
            {
                int temp = 0;
                foreach (var st in Student)
                {
                    if (cs.Roll.Equals(st.Roll))
                    {
                        temp = 0;
                        break;
                    }
                    else
                    {
                        temp = 1;
                    }
                }
                if (temp == 1)
                {
                    NoEnrollment.Add(cs.Roll);
                }
            }
            if (!String.IsNullOrEmpty(searchCheck))
            {
                int rowNo = 0;
                foreach (var b in NoEnrollment)
                {
                    List <ListStudent> infoStudent = (from c in context.Students
                                                      where c.Roll == b
                                                      select new
                    {
                        Email = c.Email,
                        Roll = c.Roll,
                        Full_Name = c.Full_Name,
                        Campus = c.Campus
                    }).ToList().Select(p => new ListStudent
                    {
                        STT       = rowNo++,
                        Email     = p.Email,
                        Roll      = p.Roll,
                        Full_Name = p.Full_Name,
                        Campus    = p.Campus
                    }).ToList();
                    List <string> subjectStudent = (from c in context.Students
                                                    join d in context.Subject_Student on c.Roll equals d.Roll
                                                    join e in context.Subjects on d.Subject_ID equals e.Subject_ID
                                                    where c.Roll == b
                                                    select e.Subject_Name).ToList();


                    foreach (var i in infoStudent)
                    {
                        s.Add(new ListStudent {
                            STT = rowNo, Email = i.Email, Roll = i.Roll, Full_Name = i.Full_Name, Campus = i.Campus, ListSubject = subjectStudent
                        });
                    }
                }
                if (!String.IsNullOrEmpty(searchString))
                {
                    s = s.Where(a => a.Roll.Contains(searchString)).ToList();
                }
                if (!String.IsNullOrEmpty(selectString2))
                {
                    s = s.Where(a => a.Campus.Contains(selectString2)).ToList();
                }
                if (!String.IsNullOrEmpty(selectString3))
                {
                    s = s.Where(a => a.ListSubject.Contains(selectString3)).ToList();
                }
            }
            var listCampus = (from a in context.Campus
                              select a.Campus_ID).ToList();
            var listSubject = (from a in context.Subjects
                               select a.Subject_Name).ToList();
            List <SelectListItem> selectCp = new List <SelectListItem>();
            List <SelectListItem> selectSj = new List <SelectListItem>();

            selectCp.Add(new SelectListItem
            {
                Text  = "--Select Campus--",
                Value = ""
            });
            foreach (var a in listCampus)
            {
                selectCp.Add(new SelectListItem
                {
                    Text  = a,
                    Value = a
                });
            }

            selectSj.Add(new SelectListItem
            {
                Text  = "--Select Subject--",
                Value = ""
            });
            foreach (var a in listSubject)
            {
                selectSj.Add(new SelectListItem
                {
                    Text  = a,
                    Value = a
                });
            }
            ViewBag.SelectString3 = selectSj;
            ViewBag.SelectString2 = selectCp;
            ls.ls1 = s;
            //rp.Students = s;
            return(View("Member", ls));
        }