public IActionResult GetStudentsbyCourseview(int CourseId)
        { //GetStudentsbyCourseview
          //IEnumerable<StudentCourse> model = _studentsCoursesRepository.GetStudent(id);

            ViewData["PageTitle"] = _coursesRepository.GetCourses(CourseId).CourseName;
            IEnumerable <StudentCourse> sinCId = _studentsCoursesRepository.GetStudent(CourseId);
            var studentsincourse = _studentsRepository.GetStudent(sinCId);

            return(PartialView("StudentsListView", studentsincourse));
        }
Ejemplo n.º 2
0
    public ActionResult LookUpStudentId(string id)
    {
        var student = _repository.GetStudent(id);

        if (student == null)
        {
            return(new RedirectResult("~/Error/NotFound"));
        }
        return(View(student));
    }
Ejemplo n.º 3
0
        public StudentViewModel GetStudent(string email)
        {
            var e = _studentsRepo.GetStudent(email);

            if (e != null)
            {
                var result = _autoMapper.Map <StudentViewModel>(e);
                return(result);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        public async Task GetStudent_Success()
        {
            var student = _universityDbContext.Students.Add(new Student()
            {
                FirstName = "Test", LastName = "Get"
            });

            _universityDbContext.SaveChanges();
            var retrievedStudent = await _studentRepository.GetStudent(student.Id);

            Assert.IsNotNull(retrievedStudent);
            Assert.AreEqual(student.Id, retrievedStudent.Id);
            Assert.AreEqual("Test", student.FirstName);
            Assert.AreEqual("Get", student.LastName);
        }
Ejemplo n.º 5
0
 public async Task <StudentEntity> GetStudent([FromRoute] string id)
 {
     return(await _studentsRepository.GetStudent(id));
 }
 public async Task <ActionResult <Student> > GetStudent(int id) => await _studentsRepository.GetStudent(id);
Ejemplo n.º 7
0
        public IActionResult StudentsListView(string id)
        {
            IEnumerable <Student> model = _studentsRepository.GetStudent(id);

            return(View(model));
        }
        private bool ValidateFinger(FeatureSet FeatureSet)
        {
            MemoryStream fingerprintData = null;
            Result       result          = null;

            foreach (Biometric biometric in _Biometrics) // Loop on the FPT List from DB to Compare the feature set with the DB templates
            {
                fingerprintData = new MemoryStream(biometric.FingerPrintTemplate);
                _Template       = new Template(fingerprintData);
                result          = new Result();
                _Verificator.Verify(FeatureSet, _Template, ref result);

                if (result.Verified)
                {
                    _Verificator  = new DPFP.Verification.Verification();
                    _relBiometric = _relBiometricsRepository.GetRelBiometric(biometric.FingerID);

                    if (_relBiometric != null)  //Check if finger is enrolled.
                    {
                        _student    = _studentsRepository.GetStudent(_relBiometric.StudentID);
                        Student     = _student;
                        _attendance = _attendancesRepository.GetAttendanceByStudentID(_student.StudentGuid);

                        if (_attendance != null)             //Check if student has already logged in for the day.
                        {
                            if (_attendance.TimeOut == null) //Check if student already logged out for the day
                            {
                                DateTime login  = _attendance.TimeIn;
                                DateTime logout = DateTime.Now;
                                logout = new DateTime(logout.Year, logout.Month, logout.Day, logout.Hour, logout.Minute, 0);

                                if (logout > login.Add(new TimeSpan(1, 0, 0))) //Check if TimeSpan between login and logout is greater than allowed threshold
                                {
                                    _attendance.IsOverstay = false;
                                    _attendance.IsEarlyOut = false;

                                    //Update student logout
                                    _attendance.TimeOut = logout;

                                    //Check if student is overstay or undertime;
                                    TimeSpan timeOut = logout.TimeOfDay;
                                    timeOut = new TimeSpan(timeOut.Hours, timeOut.Minutes, 0);
                                    TimeSpan endTime = _student.Section.EndTime;

                                    if (timeOut >= endTime.Add(new TimeSpan(1, 0, 0)))
                                    {
                                        _attendance.IsOverstay = true;
                                    }

                                    if (timeOut < endTime)
                                    {
                                        _attendance.IsEarlyOut = true;
                                    }

                                    _attendancesRepository.UpdateAttendance(_attendance); //Updated attendance record
                                    Application.Current.Dispatcher.Invoke(delegate
                                    {
                                        _attendanceLogs.Insert(0, new AttendanceLog(_student.ImageData, _student.FirstName, _student.LastName, "logged out.", _attendance.TimeOut)); //Add action to attendance log
                                    });

                                    ProcessSMSIntegration(_attendance.AttendanceID.ToString(), false, (DateTime)_attendance.TimeOut, _student);
                                    Remarks = "Student logged out.";
                                }
                                else
                                {
                                    Remarks = "Student is not allowed to logout 1 hour after logging in.";
                                }
                            }
                            else
                            {
                                Remarks = "Student is not allowed to logout twice a day.";
                            }
                        }
                        else
                        {
                            DateTime login = DateTime.Now;
                            login = new DateTime(login.Year, login.Month, login.Day, login.Hour, login.Minute, 0);
                            //Create new attendance record for the student.
                            _attendance = new Attendance
                            {
                                AttendanceID = Guid.NewGuid(),
                                StudentID    = _student.StudentGuid,
                                TimeIn       = login
                            };

                            TimeSpan timeIn    = _attendance.TimeIn.TimeOfDay;
                            TimeSpan startTime = _student.Section.StartTime;

                            if (timeIn > startTime)
                            {
                                _attendance.IsLate = true;
                            }
                            else
                            {
                                _attendance.IsLate = false;
                            }

                            _attendancesRepository.AddAttendance(_attendance); //Add Record
                            Application.Current.Dispatcher.Invoke(delegate
                            {
                                _attendanceLogs.Insert(0, new AttendanceLog(_student.ImageData, _student.FirstName, _student.LastName, "logged in.", _attendance.TimeIn));
                            });

                            ProcessSMSIntegration(_attendance.AttendanceID.ToString(), true, _attendance.TimeIn, _student);
                            Remarks = "Student logged in.";
                        }

                        return(true);
                    }
                    else
                    {
                        Remarks = "Fingerprint in system but not linked to any student.";
                        break;
                    }
                }
            }

            return(false);
        }