コード例 #1
0
		public Promise SignIn(string domain, string username, string password)
		{
			Promise promise = new Promise();

			try
			{
				Uri serverUri = new Uri(appSettings.ServerURI, UriKind.RelativeOrAbsolute);
				Uri restUri = new Uri(serverUri, "rest/");

				StudentRepository repo = new StudentRepository(restUri);
				if (repo == null)
				{
					throw new Exception("StudentRepository is not initialized.");
				}
				
				repo.SignIn(domain, username, password, (StudentRepository.Response response) =>
				{
					if (response.Success)
					{
						Token = Guid.NewGuid().ToString();
						promise.Resolve(response.Item);
					}
					else
					{
						promise.Reject(new Exception(response.Error));
					}
				});                   
			}
			catch (Exception e)
			{
				promise.Reject(e);
			}

			return promise;
		}
コード例 #2
0
ファイル: Program.cs プロジェクト: csergiu/Labs
 static void Main(string[] args)
 {
     StudentRepository<Student> repo = new StudentRepository<Student>();
     Validator val = new Validator(repo);
     StudentController ctrl = new StudentController(repo, val);
     UI.Console cons = new UI.Console(ctrl);
 }
コード例 #3
0
        // GET: AddOfficeVisit
        public async System.Threading.Tasks.Task<ActionResult> EditStudent(string id)
        {

            StudentCollection coll = new StudentCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();
                var result = new StudentRepository(connection).GetStudent(id);

                //get all possible values
                var result1 = new StudentRepository(connection).GetStudent(id);
                var result2 = new GradeRepository(connection).GetSortedGrades(result.Result.First().grade_id.ToString());
                var result3 = new SchoolRepository(connection).GetSortedSchools(result.Result.First().school_id.ToString());
                var result4 = new GenderRepository(connection).GetSortedGenders(result.Result.First().gender.ToString());
                var result5 = new HomeRoomRepository(connection).GetSortedHomeRooms(result.Result.First().homeroom_id.ToString());

                coll.singleStudent = (IEnumerable <Models.Student>)result1.Result.ToArray();
                coll.allGrades = (IEnumerable<Models.Grade>)result2.Result.ToArray();
                coll.allSchools = (IEnumerable<Models.School>)result3.Result.ToArray();
                coll.allGenders = (IEnumerable<Models.Gender>)result4.Result.ToArray();
                coll.allHomeRooms = (IEnumerable<Models.HomeRoom>)result5.Result.ToArray();

                coll.gradeselectlist = new SelectList(result2.Result.ToList(), "grade_id", "grade_value", new { id = "TxtGrade", @required = "required" });
                coll.schoolselectlist = new SelectList(result3.Result.ToList(), "school_id", "name", new { id = "TxtSchool", @required = "required" });
                coll.genderselectlist = new SelectList(result4.Result.ToList(), "gender", "gender", new { id = "TxtGender", @required = "required" });
                coll.homeroomselectlist = new SelectList(result5.Result.ToList(), "homeroom_id", "homeroom_name", new { id = "TxtHomeroom", @required = "required" });

            }
            return View(coll);
        }
コード例 #4
0
        OfficeVisitCollection PopulateAddOfficeVisit()
        {
            OfficeVisitCollection coll = new OfficeVisitCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {

                var result = new StudentRepository(connection).GetStudents();
                var result2 = new ContactRepository(connection).GetContacts();
                var result3 = new ContentCourseRepository(connection).GetContentCourses();
                var result4 = new CodeOfConductViolationRepository(connection).GetCodeOfConductViolations();
                var result5 = new HomeRoomRepository(connection).GetHomeRooms();
                var result6 = new RemedialActionRepository(connection).GetRemedialActions();


                coll.allStudents = (IEnumerable<Models.Student>)result.Result.ToArray();
                coll.allReporters = coll.allHandledBys = (IEnumerable<Models.Contact>)result2.Result.ToArray();
                coll.allLocations = (IEnumerable<Models.ContentCourse>)result3.Result.ToArray();
                coll.allCodeViolations = (IEnumerable<Models.CodeOfConductViolation>)result4.Result.ToArray();
                coll.allHomeRooms = (IEnumerable<Models.HomeRoom>)result5.Result.ToArray();
                coll.allRemedials = (IEnumerable<Models.RemedialAction>)result6.Result.ToArray();

                coll.StudentSelectList = new SelectList(coll.allStudents, "student_id", "student_name", null);
                coll.ReportersSelectList = new SelectList(coll.allReporters, "contact_id", "contact_name", null);
                coll.HomeRoomSelectList = new SelectList(coll.allHomeRooms, "homeroom_id", "homeroom_name", null);
                coll.HandleBySelectList = new SelectList(coll.allHandledBys, "contact_id", "contact_name", null);
                coll.LocationSelectList = new SelectList(coll.allLocations, "content_course_id", "name", null);
                coll.RemedialSelectList = new SelectList(coll.allRemedials, "remedial_action_id", "name", null);
                coll.ViolationSelectList = new SelectList(coll.allCodeViolations, "code_of_conduct_violation_id", "name", null);

                Session["AddVisitModel"] = coll;
            }
            return coll;
        }
コード例 #5
0
        public bool AuthenticateUser(string username, string password, UserTypeEnum userType)
        {
            LoggedUser = null;
            UserType = null;

            AppContext ctx = new AppContext();

            switch (userType)
            {
                case UserTypeEnum.Administrator:
                    AdministratorRepository adminRepo = new AdministratorRepository(new AppContext());
                    LoggedUser = unitOfWork.AdminRepository.GetByUsername(username);
                    break;
                case UserTypeEnum.Student:
                    StudentRepository studentRepo = new StudentRepository(new AppContext());
                    LoggedUser = unitOfWork.StudentRepository.GetByUsername(username);
                    break;
                case UserTypeEnum.Teacher:
                    TeacherRepository teacherRepo = new TeacherRepository(new AppContext());
                    LoggedUser = unitOfWork.TeacherRepository.GetByUsername(username);
                    break;
            }

            if (LoggedUser != null)
            {
                if (PasswordHasher.Equals(password, LoggedUser.Salt, LoggedUser.Hash))
                {
                    UserType = userType;
                    return true;
                }
                LoggedUser = null;
            }

            return false;
        }
コード例 #6
0
		public ActionResult Apply(StudentApplicationModel studentApplicationModel)
		{
			//Validate from JICS that studentID is valid
			// if not valid, show error invalid student id.

			//IStudentRepository repository = new Jenzabar();
			IStudentRepository repository = new StudentRepository();

			var isValidId = repository.VerifyStudentId(studentApplicationModel.StudentId);

			if (!isValidId)
			{
				return View("InvalidStudentId");
			}

			var student = repository.GetApplicant(studentApplicationModel.StudentId);

			//return View("Apply", StudentApplicationModel);
			//TempData["Id"] = StudentApplicationModel.StudentId;
			//TempData["VehicleType"] = StudentApplicationModel.VehicleType.ToString();


			//Redirect to appropriate controller- Vehicle, Bicycle, or Motorcycle
			var controllerName = studentApplicationModel.VehicleType.ToString();

			return RedirectToAction("Register", controllerName, new
			{
				id = student.Id,
				firstName = student.Firstname.Trim(),
				lastName = student.Lastname.Trim()
			});
		}
コード例 #7
0
 public ActionResult Index()
 {
     if (AuthenticationManager.LoggedUser == null)
     {
         return RedirectToAction("Login", "Default");
     }
     Student student = new Student();
     StudentRepository studentRepository = new StudentRepository();
     student = studentRepository.GetById(AuthenticationManager.LoggedUser.Id);
     StudentControllerStudentVM model = new StudentControllerStudentVM();
     Course course = new Course();
     CourseRepository courseRepository = new CourseRepository();
     course = courseRepository.GetAll(filter: c => c.Id == student.CourseID).FirstOrDefault();
     List<Subject> subjectList = new List<Subject>();
     CourseSubjectRepository courseSubjectRepository = new CourseSubjectRepository();
     subjectList = courseSubjectRepository.GetAll(filter: c => c.CourseID == course.Id).Select(s => s.Subject).ToList();
     List<string> subjectNames = new List<string>();
     foreach (var subject in subjectList)
     {
         subjectNames.Add(subject.Name);
     }
     model.Subjects = subjectNames;
     model.FirstName = student.FirstName;
     model.LastName = student.LastName;
     model.StudentID = AuthenticationManager.LoggedUser.Id;
     model.Course = course.Name;
     model.FaculityNumber = student.FacultyNumber;
     return View(model);
 }
コード例 #8
0
        public bool AuthenticateUser(string username, string password, User.UserType userType)
        {
            switch (userType)
            {
                case User.UserType.Teacher:
                    TeacherRepository teacherRepository = new TeacherRepository();
                    user = teacherRepository.GetAll(filter: u => u.UserName == username && u.IsActive == true).FirstOrDefault();
                    break;
                case User.UserType.Administrator:
                    AdministratorRepository adminRepository = new AdministratorRepository();
                    user = adminRepository.GetAll(filter: u => u.UserName == username && u.IsActive == true).FirstOrDefault();
                    break;
                case User.UserType.Student:
                    StudentRepository studentRepository = new StudentRepository();
                    user = studentRepository.GetAll(filter: u => u.UserName == username && u.IsActive == true).FirstOrDefault();
                    break;
                default:
                    LoggedUser = null;
                    break;
            }
            if (SecurityService.ValidatePassword(password, user.Password))
                LoggedUser = user;

            return LoggedUser != null;
        }
コード例 #9
0
        public void StudentRepositoryTest1()
        {
            var repo = new StudentRepository();

            var student = repo.GetAll().FirstOrDefault();

            Assert.IsInstanceOfType(student, typeof(Student));
        }
コード例 #10
0
 public ActionResult ChangePassword(int id)
 {
     Student student = new Student();
     StudentRepository studentRepository = new StudentRepository();
     student = studentRepository.GetById(id);
     StudentControllerStudentVM model = new StudentControllerStudentVM();
     return View(model);
 }
コード例 #11
0
 public ActionResult ChangePassword(int id, StudentControllerStudentVM model)
 {
     TryUpdateModel(model);
     if (ModelState.IsValid)
     {
         Student student = new Student();
         StudentRepository studentRepository = new StudentRepository();
         student = studentRepository.GetById(id);
         student.Password = model.Password;
         studentRepository.Save(student);
         return RedirectToAction("Index");
     }
     return View(model);
 }
コード例 #12
0
        public async System.Threading.Tasks.Task<ActionResult> EditOfficeVisit(string id)
        {

            OfficeVisitCollection coll = new OfficeVisitCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();
               
                var result = new StudentRepository(connection).GetStudents();
                var result2 = new ContactRepository(connection).GetContacts();
                var result3 = new ContentCourseRepository(connection).GetContentCourses();
                var result4 = new CodeOfConductViolationRepository(connection).GetCodeOfConductViolations();
                var result5 = new HomeRoomRepository(connection).GetHomeRooms();
                var result6 = new RemedialActionRepository(connection).GetRemedialActions();
                var result7 = new OfficeVisitRepository(connection).GetOfficeVisitByID(Convert.ToInt32(id));

                coll.officeVisit = result7.Result;
                
                coll.allStudents = (IEnumerable<Models.Student>)result.Result.ToArray();
                coll.allReporters = coll.allHandledBys = (IEnumerable<Models.Contact>)result2.Result.ToArray();
                coll.allLocations = (IEnumerable<Models.ContentCourse>)result3.Result.ToArray();
                coll.allCodeViolations = (IEnumerable<Models.CodeOfConductViolation>)result4.Result.ToArray();
                coll.allHomeRooms = (IEnumerable<Models.HomeRoom>)result5.Result.ToArray();
                coll.allRemedials = (IEnumerable<Models.RemedialAction>)result6.Result.ToArray();

                coll.remedialAction = new OfficeVisitRepository(connection).GetOfficeVisitRemedyAction(coll.officeVisit.office_visit_id);
                coll.CodeViolation = new OfficeVisitRepository(connection).GetOfficeVisitCodeViolation(coll.officeVisit.office_visit_id);

                coll.office_visit_id = coll.officeVisit.office_visit_id;
                coll.arrival_dt = coll.officeVisit.arrival_dt;
                coll.office_visit_dt = coll.officeVisit.office_visit_dt;
                coll.nap = coll.officeVisit.nap;
                coll.comments = coll.officeVisit.comments;

                coll.StudentSelectList =  new SelectList(coll.allStudents, "student_id", "student_name", coll.officeVisit.student_id);
                coll.ReportersSelectList = new SelectList(coll.allReporters, "contact_id", "contact_name", coll.officeVisit.sent_by_contact_id);
                coll.HomeRoomSelectList = new SelectList(coll.allHomeRooms, "homeroom_id", "homeroom_name", coll.officeVisit.homeroom_id);
                coll.HandleBySelectList = new SelectList(coll.allHandledBys, "contact_id", "contact_name", coll.officeVisit.handled_by_contact_id);
                coll.LocationSelectList = new SelectList(coll.allLocations, "content_course_id", "name", coll.officeVisit.content_course_id);
                
                coll.RemedialSelectList = new SelectList(coll.allRemedials, "remedial_action_id", "name", coll.remedialAction);
                coll.ViolationSelectList = new SelectList(coll.allCodeViolations, "code_of_conduct_violation_id", "name", coll.CodeViolation);
                Session["OfficeVisitId"] = id;
            }

            return View(coll);
        }
コード例 #13
0
 public System.Web.Mvc.RedirectResult EditChild(string STUDENTID, string TxtID, string TxtFirstName, string TxtLastName, string schoolselectlist, string gradeselectlist, string genderselectlist, string homeroomselectlist)
 {
     using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
     {
         var result = new StudentRepository(connection).EditChild(STUDENTID, TxtID, TxtFirstName, TxtLastName, schoolselectlist, gradeselectlist, genderselectlist, homeroomselectlist);
         if (result == "success")
         {
             return Redirect("Student/Student/?error=fileloaded");
         }
         else
         {
             //do something else here.
             return Redirect("Student/Student/?error=invalidfile");
         }
     }
 }
コード例 #14
0
 public System.Web.Mvc.RedirectResult AddChild(string TxtID, string TxtFirstName, string TxtLastName, string allSchools, string allGrades, string allGenders, string allHomerooms)
 {
     using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
     {
         var result = new StudentRepository(connection).AddChild(TxtID, TxtFirstName, TxtLastName, allSchools, allGrades, allGenders, allHomerooms);
         if (result == "success")
         {
             return Redirect("Student/Student/?error=fileloaded");
         }
         else
         {
             //do something else here.
             return Redirect("Student/Student/?error=invalidfile");
         }
     }
 }
コード例 #15
0
ファイル: UnitOfWork.cs プロジェクト: Rashid75/Fyp
 public UnitOfWork(FypDbContext db)
 {
     _context = db;
     Campus = new CampusRepository(_context);
     Department = new DepartmentRepository(_context);
     Batch = new BatchRepository(_context);
     Section = new SectionRepository(_context);
     Student = new StudentRepository(_context);
     File = new FileRepository(_context);
     Teacher = new TeacherRepository(_context);
     EnrollDep = new EnrollDepartmentRepository(_context);
     EnrollBatch = new EnrollBatchRepository(_context);
     EnrollSection = new EnrollSectionRepository(_context);
     Course = new CourseRepository(_context);
     CourseToDep = new CourseToDepRepository(_context);
     StudentRegistration = new StudentRegistrationRepository(_context);
     subjectallocate = new SubjectAllocatRepository(_context);
 }
コード例 #16
0
        public DataTable SubjectGrades(Subject subject)
        {
            List<Grade> gradeList = new List<Grade>();
            GradeRepository gradeRepository = new GradeRepository();
            gradeList = gradeRepository.GetAll(filter: s => s.Subject.Id == subject.Id);
            StudentRepository studentRepository = new StudentRepository();
            var gradeTable = new DataTable("SubjectsGrades");
            gradeTable.Columns.Add("StudentName",typeof(string));
            gradeTable.Columns.Add("GradeValue", typeof(string));
            Dictionary<string, string> details = new Dictionary<string, string>();
            List<string> gradeValues = new List<string>();
            List<int> studentList = new List<int>();
            foreach (var item in gradeList)
            {
                studentList.Add(item.Student.Id);
            }
            studentList = studentList.Distinct().ToList();
            foreach (var item in studentList)
            {
                StringBuilder sb = new StringBuilder();
                List<Grade> grades = new List<Grade>();
                grades = gradeRepository.GetAll(filter: s => s.Student.Id == item && s.Subject.Id == subject.Id);
                foreach (var grade in grades)
                {
                    sb.Append(grade.GradeValue);
                    sb.Append(",");
                }
                sb.Length -= 1;
                Student student = new Student();
                student = studentRepository.GetAll(filter: s=> s.Id == item).FirstOrDefault();
                string fullName = student.FirstName + " " + student.LastName;
                details.Add(fullName, sb.ToString());
            }

            foreach (var item in details)
            {
                gradeTable.Rows.Add(item.Key, item.Value);
            }
            return gradeTable;
        }
コード例 #17
0
        // GET: AddOfficeVisit
        public async System.Threading.Tasks.Task<ActionResult> EditHomeRoom(string id)
        {

            HomeRoomCollection coll = new HomeRoomCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();
                var result = new HomeRoomRepository(connection).GetHomeRoom(id);

                //get all possible values
                var result1 = new StudentRepository(connection).GetStudent(id);
                var result2 = new SchoolRepository(connection).GetSortedSchools(result.Result.First().school_id.ToString());

                coll.singleHomeRoom = (IEnumerable<Models.HomeRoom>)result.Result.ToArray();
                coll.allSchools = (IEnumerable<Models.School>)result2.Result.ToArray();

                coll.schoolselectlist = new SelectList(result2.Result.ToList(), "school_id", "name", new { id = "TxtSchool", @required = "required" });

            }
            return View(coll);
        }
コード例 #18
0
        public JsonResult ShowStudents(int CourseID)
        {
            StudentRepository studentRepository = new StudentRepository();
            var students = studentRepository.GetAll(filter: s => s.CourseID == CourseID && s.IsActive == true);
            List<SelectListItem> studentList = new List<SelectListItem>();

            foreach (var item in students)
            {
                string name = item.FirstName + " " + item.LastName;
                studentList.Add(new SelectListItem() { Text = name, Value = item.Id.ToString() });
            }

            return Json(studentList, JsonRequestBehavior.AllowGet);
        }
コード例 #19
0
 public StudentManager()
 {
     TestEntities testEntities = new TestEntities();
     thisDao = new StudentRepository(testEntities);
 }
コード例 #20
0
        // GET: Students
        public ActionResult StudentsTable(string sortOrder, string searchfirstname, string searchlastname, int?searchminage, int?searchmaxage, DateTime?searchmindate, DateTime?searchmaxdate, int?page, int?pSize)
        {
            ViewBag.CurrentFirstName = searchfirstname;
            ViewBag.CurrentLastName  = searchlastname;
            ViewBag.CurrentMinAge    = searchminage;
            ViewBag.CurrentMaxAge    = searchmaxage;
            ViewBag.CurrentMinDate   = searchmindate;
            ViewBag.CurrentMaxDate   = searchmaxdate;
            ViewBag.CurrentSortOrder = sortOrder;
            ViewBag.CurrentpSize     = pSize;


            ViewBag.FirstNameSortParam = String.IsNullOrEmpty(sortOrder) ? "FirstNameDesc" : "";
            ViewBag.LastNameSortParam  = sortOrder == "LastNameAsc" ? "LastNameDesc" : "LastNameAsc";
            ViewBag.AgeSortParam       = sortOrder == "AgeAsc" ? "AgeDesc" : "AgeAsc";
            ViewBag.DateSortParam      = sortOrder == "DateAsc" ? "DateDesc" : "DateAsc";
            ViewBag.DetailsSortParam   = sortOrder == "DetailsAsc" ? "DetailsDesc" : "DetailsAsc";


            ViewBag.FNView = "badge badge-primary";
            ViewBag.LNView = "badge badge-primary";
            ViewBag.AGView = "badge badge-primary";
            ViewBag.DTView = "badge badge-primary";


            StudentRepository studentRepository = new StudentRepository();
            var students = studentRepository.GetAll();

            //studentRepository.Dispose();

            //======================FILTERS===============================
            //Filtering  FirstName
            if (!string.IsNullOrWhiteSpace(searchfirstname))
            {
                students = students.Where(x => x.FirstName.ToUpper().Contains(searchfirstname.ToUpper()));
            }
            //Filtering  LastName
            if (!string.IsNullOrWhiteSpace(searchlastname))
            {
                students = students.Where(x => x.LastName.ToUpper().Contains(searchlastname.ToUpper()));
            }
            //Filtering  Minimum Age
            if (!(searchminage is null)) //40
            {
                students = students.Where(x => x.Age >= searchminage);
            }
            //Filtering  Maximum Age
            if (!(searchmaxage is null)) //50
            {
                students = students.Where(x => x.Age <= searchmaxage);
            }
            //Filtering Minimum Date
            if (!(searchmindate is null))
            {
                students = students.Where(x => x.DateOfBirth >= searchmindate);
            }
            //Filtering Maximum Date
            if (!(searchmaxdate is null))
            {
                students = students.Where(x => x.DateOfBirth >= searchmaxdate);
            }


            //Sorting
            switch (sortOrder)
            {
            case "FirstNameDesc": students = students.OrderByDescending(x => x.FirstName); ViewBag.FNView = "badge badge-danger"; break;

            case "LastNameAsc": students = students.OrderBy(x => x.LastName); ViewBag.LNView = "badge badge-success"; break;

            case "LastNameDesc": students = students.OrderByDescending(x => x.LastName); ViewBag.LNView = "badge badge-danger"; break;

            case "AgeAsc": students = students.OrderBy(x => x.Age); ViewBag.AGView = "badge badge-success"; break;

            case "AgeDesc": students = students.OrderByDescending(x => x.Age); ViewBag.AGView = "badge badge-danger"; break;

            case "DateAsc": students = students.OrderBy(x => x.DateOfBirth); ViewBag.AGView = "badge badge-success"; break;

            case "DateDesc": students = students.OrderByDescending(x => x.DateOfBirth); ViewBag.AGView = "badge badge-danger"; break;

            case "DetailsAsc": students = students.OrderBy(x => x.Courses.ToList()[0].Title); ViewBag.DTView = "badge badge-success"; break;

            case "DetailsDesc": students = students.OrderByDescending(x => x.Courses.ToList()[0].Title); ViewBag.DTView = "badge badge-danger"; break;

            default: students = students.OrderBy(x => x.FirstName); ViewBag.FNView = "badge badge-success"; break;
            }

            int pageSize   = pSize ?? 10;
            int pageNumber = page ?? 1;


            return(View(students.ToPagedList(pageNumber, pageSize)));
        }
コード例 #21
0
        public static async Task <IList <StudentPreview> > GetListAsync()
        {
            var repo = new StudentRepository(UowFactory.Get());

            return(ModelHelper.FetchList <StudentPreview, Student>(await repo.GetAllAsync()));
        }
コード例 #22
0
 public void ClearUp()
 {
     repo = null;
 }
コード例 #23
0
        static void Main(string[] args)
        {
            StudentRepository studentRepo = new StudentRepository();

            StudentService studentService = new StudentService(studentRepo);


            // Merit student names
            List <string> meritStudents = studentService.GetMeritStudentNames();

            Console.WriteLine("Merit students whose average mark is equal to or above 75:");
            foreach (var name in meritStudents)
            {
                Console.WriteLine(name);
            }
            Console.WriteLine();


            // Non-merit student names
            List <string> nonMeritStudents = studentService.GetNonMeritStudentNames();

            Console.WriteLine("Non-merit students whose average mark is below 75:");
            foreach (var name in nonMeritStudents)
            {
                Console.WriteLine(name);
            }
            Console.WriteLine();


            // Students with total marks over 265
            var totalMarks = 265;

            List <Student> studentsWithHighTotal = studentService.GetStudentsWithTotalMarksOver(totalMarks);

            Console.WriteLine($"Students with total marks over {totalMarks}:");
            foreach (var student in studentsWithHighTotal)
            {
                Console.WriteLine($"{student.Name} scored {student.AcademicRecord.GetTotalMarks()}.");
            }
            Console.WriteLine();


            // Students with marks in all subjects over 80
            var mark = 80;

            List <Student> studentsWithHighMarks = studentService.GetStudentsWithMarkInEachSubjectOver(mark);

            Console.WriteLine($"Students with marks in all subjects over {mark}:");
            foreach (var student in studentsWithHighMarks)
            {
                Console.WriteLine($"{student.Name} scored over {mark} in all subjects:");
                foreach (var subject in student.AcademicRecord.Subjects)
                {
                    Console.WriteLine($"{subject.Name}: {subject.Mark}");
                }
                Console.WriteLine();
            }


            // Print XML for the merit student list
            var xmlWriter = new StudentListXmlWriter(studentRepo.GetStudents());

            Console.WriteLine("XML output:");

            xmlWriter.PrintXml();
        }
コード例 #24
0
 public StudentController(SynapseContext dbContext)
 {
     _adminRepository   = new AdminRepository(dbContext);
     _studentRepository = new StudentRepository(dbContext);
     _teacherRepository = new TeacherRepository(dbContext);
 }
コード例 #25
0
 public StudentsController(ApplicationDbContext context)
 {
     _studentRepository = new StudentRepository(context);
 }
コード例 #26
0
 public StudentController()
 {
     _studentService = new StudentService(ConnectionString.DB);
     _studentRepo    = new StudentRepository(ConnectionString.DB);
 }
コード例 #27
0
 public StudentController(StudentRepository studentRepository, CourseRepository courseRepository)
 {
     this.studentRepository = studentRepository;
     this.courseRepository  = courseRepository;
 }
コード例 #28
0
 public StudentAppService(StudentRepository studentRepository, ITeacherRepository teacherRepository, string test)
 {
     _studentRepository = studentRepository;
 }
コード例 #29
0
 public StudentAppService(StudentRepository studentRepository)
 {
     _studentRepository = studentRepository;
 }
コード例 #30
0
 public BookRentDetailsForm(BookRentRepository bookRentRepository, BookRepository bookRepository, StudentRepository studentRepository)
 {
     InitializeComponent();
     BookRentRepository = bookRentRepository;
     BookRepository     = bookRepository;
     StudentRepository  = studentRepository;
 }
コード例 #31
0
 public JsonResult EditGrade(int gradeId, double gradeValue, int subjectId, int studentId)
 {
     Grade grade = new Grade();
     GradeRepository gradeRepo = new GradeRepository();
     SelectListItem gradeItem = null;
     if (gradeId != 0)
     {
         grade = gradeRepo.GetById(gradeId);
         gradeValue = System.Math.Round(gradeValue, 2);
         grade.GradeValue = gradeValue;
         gradeRepo.Save(grade);
     }
     else
     {
         UnitOfWork unitOfWork = new UnitOfWork();
         StudentRepository studentRepository = new StudentRepository(unitOfWork);
         GradeRepository gradeRepository = new GradeRepository(unitOfWork);
         SubjectRepository subjectRepository = new SubjectRepository(unitOfWork);
         Student student = new Student();
         student = studentRepository.GetById(studentId);
         Subject subject = new Subject();
         subject = subjectRepository.GetById(subjectId);
         grade.SubjectID = subjectId;
         grade.Subject = subject;
         grade.Student = student;
         gradeValue = System.Math.Round(gradeValue, 2);
         grade.GradeValue = gradeValue;
         gradeRepository.Save(grade);
         unitOfWork.Commit();
     }
     gradeItem = new SelectListItem() { Text = grade.GradeValue.ToString(), Value = grade.Id.ToString() };
     return Json(gradeItem, JsonRequestBehavior.AllowGet);
 }
コード例 #32
0
        public ActionResult Delete(StudentVM studentVM)
        {
            StudentRepository.Delete(studentVM.Student.StudentId);

            return(RedirectToAction("List"));
        }
コード例 #33
0
        public ActionResult Delete(int id)
        {
            var student = StudentRepository.Get(id);

            return(View(student));
        }
コード例 #34
0
        public ActionResult List()
        {
            var model = StudentRepository.GetAll();

            return(View(model));
        }
コード例 #35
0
 public void RepoInstanceIsNotNull()
 {
     repo = new StudentRepository();
     Assert.IsNotNull(repo);
 }
コード例 #36
0
 public StudentController()
 {
     studentRepository = new StudentRepository();
 }
コード例 #37
0
 public StudentService()
 {
     repository = new StudentRepository();
 }
コード例 #38
0
        public static IList <StudentPreview> GetList()
        {
            var repo = new StudentRepository(UowFactory.Get());

            return(ModelHelper.FetchList <StudentPreview, Student>(repo.GetAll()));
        }
        public JsonResult SelectStudentBasic()
        {
            Student_Register  _obj   = new Student_Register();
            StudentRepository objRep = new StudentRepository();

            _obj.studentid = Session["studentid"].ToString();
            DataSet ds = objRep.Select_Student_Information(_obj);
            List <Student_Register>       _list        = new List <Student_Register>();
            List <Student_AddressDetails> _listAddress = new List <Student_AddressDetails>();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Student_Register objBasic = new Student_Register();
                        objBasic.studentid         = row["studentid"].ToString();
                        objBasic.FirstName         = row["FirstName"].ToString();
                        objBasic.LastName          = row["LastName"].ToString();
                        objBasic.MiddleName        = row["MiddleName"].ToString();
                        objBasic.DateOfBirth       = row["DateOfBirth"].ToString();
                        objBasic.Gender            = row["Gender"].ToString();
                        objBasic.Email             = row["Email"].ToString();
                        objBasic.Mobile            = row["Mobile"].ToString();
                        objBasic.CountryCode       = row["CountryCode"].ToString();
                        objBasic.Nationality       = row["Nationality"].ToString();
                        objBasic.Country           = row["CountryID"].ToString();
                        objBasic.CountryToStay     = row["CountryToStay"].ToString();
                        objBasic.student_path      = row["student_path"].ToString();
                        objBasic.bCopyAddress      = row["bCopyAddress"].ToString();
                        objBasic.ApplyingForCourse = row["ApplyingForCourse"].ToString();
                        Session["studentname"]     = row["FirstName"].ToString() + ' ' + row["MiddleName"].ToString() + ' ' + row["LastName"].ToString();
                        _list.Add(objBasic);
                    }
                }
                if (ds.Tables[1].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[1].Rows)
                    {
                        Student_AddressDetails objadd = new Student_AddressDetails();
                        objadd.studentid    = row["studentid"].ToString();
                        objadd.AddressType  = row["AddressType"].ToString();
                        objadd.Addressline1 = row["Addressline1"].ToString();
                        objadd.Country      = row["Country"].ToString();
                        objadd.State        = row["State"].ToString();
                        objadd.State_name   = row["State_name"].ToString();
                        objadd.City         = row["City"].ToString();
                        objadd.City_name    = row["City_name"].ToString();
                        objadd.Area         = row["Area"].ToString();
                        _listAddress.Add(objadd);
                    }
                }
            }
            return(Json(new
            {
                List = _list,
                ListAdd = _listAddress
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
コード例 #40
0
 public StudentService()
 {
     studentRepository = new StudentRepository();
 }
コード例 #41
0
 public StudentValidation(ActionOnError actionOnErrorFunction)
 {
     _studentRepository     = new StudentRepository();
     _actionOnErrorFunction = actionOnErrorFunction;
 }
コード例 #42
0
 public void GetStudent()
 {
     IRepositoryContext uow = new EntityFrameworkRepositoryContext();
     var repo = new StudentRepository(uow);
     var result = repo.GetAll();
     Assert.IsTrue(result.Count() > 0);
 }
コード例 #43
0
 public StudentRepositoryShould()
 {
     _context         = TestContext.Context;
     _repository      = new StudentRepository(_context);
     _groupRepository = new GroupRepository(_context);
 }
コード例 #44
0
 public CoursesTakenController(CourseTakenRepository courseTakenRepository, CourseRepository courseRepository, StudentRepository studentRepository)
 {
     this.courseTakenRepository = courseTakenRepository;
     this.courseRepository = courseRepository;
     this.studentRepository = studentRepository;
 }
コード例 #45
0
        public ActionResult ExportGrade(int studentId)
        {
            Student student = new Student();
            StudentRepository studentRepository = new StudentRepository();
            student = studentRepository.GetById(studentId);
            Export export = new Export();
            DataTable gradeTable = export.StudentsGradesToExcel(student);

            GridView Grid = new GridView();
            Grid.DataSource = gradeTable;
            Grid.DataBind();

            string filename = "attachment; filename=" + student.FirstName + "_" + student.LastName + "_" + student.FacultyNumber + ".xls";
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", filename);
            Response.ContentType = "application/ms-excel";

            Response.Charset = "";
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            Grid.RenderControl(htw);

            Response.Output.Write(sw.ToString());
            Response.Flush();
            Response.End();
            return View();
        }
コード例 #46
0
        public JsonResult SelectAcademicinformation(string studentid = "", int id = 0)
        {
            //StudentAcademic_information _obj = new StudentAcademic_information();
            StudentRepository objRep = new StudentRepository();
            //_obj.studentid = Session["studentid"].ToString();
            DataSet ds = objRep.select_StudentAcademic_information(studentid, id);
            List <StudentAcademic_information> _list    = new List <StudentAcademic_information>();
            List <StudentAcademic_information> _listJee = new List <StudentAcademic_information>();

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        StudentAcademic_information objacademic = new StudentAcademic_information();
                        objacademic.studentid = row["studentid"].ToString();
                        objacademic.Education_Qualification_Name = row["Education_Qualification_Name"].ToString();
                        objacademic.ProgramLevel          = row["ProgramLevel_Id"].ToString();
                        objacademic.Degree_name           = row["Degree_name"].ToString();
                        objacademic.board_uni_name        = row["board_uni_name"].ToString();
                        objacademic.NameofCourse          = row["NameofCourse"].ToString();
                        objacademic.Academicinformationid = row["Academicinformationid"].ToString();
                        objacademic.passing_year          = row["passing_year"].ToString();
                        objacademic.Marks_obtains         = row["Marks_obtains"].ToString();
                        objacademic.min_marks             = row["min_marks"].ToString();
                        objacademic.subject_studied       = row["subject_studied"].ToString();
                        objacademic.country_id            = row["country_id"].ToString();
                        objacademic.country_name          = row["country_name"].ToString();
                        objacademic.address = row["address"].ToString();
                        objacademic.GradeConversionDocument = row["GradeConversionDocument"].ToString();
                        objacademic.TotalMarksinPercentage  = row["TotalMarksinPercentage"].ToString();
                        _list.Add(objacademic);
                    }
                }
                if (ds.Tables[1].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[1].Rows)
                    {
                        StudentAcademic_information objacademicjeee = new StudentAcademic_information();
                        objacademicjeee.jeeadvance      = row["jeeadvance"].ToString();
                        objacademicjeee.jeeadvancescore = row["jeeadvancescore"].ToString();
                        objacademicjeee.jeemain         = row["jeemain"].ToString();
                        objacademicjeee.jeemainscore    = row["jeemainscore"].ToString();
                        objacademicjeee.ielts           = row["ielts"].ToString();
                        objacademicjeee.ieltsscore      = row["ieltsscore"].ToString();
                        objacademicjeee.GMAT            = row["GMAT"].ToString();
                        objacademicjeee.GMATscore       = row["GMATscore"].ToString();
                        objacademicjeee.TOFEL           = row["TOFEL"].ToString();
                        objacademicjeee.TOFELscore      = row["TOFELscore"].ToString();
                        objacademicjeee.SAT             = row["SAT"].ToString();
                        objacademicjeee.SATscore        = row["SATscore"].ToString();
                        objacademicjeee.experience      = row["experience"].ToString();
                        objacademicjeee.experiencescore = row["experiencescore"].ToString();
                        _listJee.Add(objacademicjeee);
                    }
                }
            }
            return(Json(new
            {
                List = _list,
                ListJee = _listJee
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
コード例 #47
0
        public ActionResult StudentDetails(int StudentID)
        {
            if (!AuthenticationManager.LoggedUser.GetType().BaseType.Equals(typeof(Teacher)))
            {
                return RedirectToAction("Default", "Login");
            }
            List<Grade> studentGrades = new List<Grade>();
            GradeRepository gradeRepository = new GradeRepository();
            Student student = new Student();
            StudentRepository studentRepository = new StudentRepository();
            student = studentRepository.GetById(StudentID);
            TeacherControllerStudentsVM model = new TeacherControllerStudentsVM();
            studentGrades = gradeRepository.GetAll(filter: g => g.Student.Id == StudentID);

            model.FirstName = student.FirstName;
            model.LastName = student.LastName;
            model.FaculityNumber = student.FacultyNumber;
            model.Course = student.Course.Name;
            model.StudentID = student.Id;
            model.CourseID = student.Course.Id;

            Dictionary<string, List<Grade>> details = new Dictionary<string, List<Grade>>();
            List<string> subjectNameList = new List<string>();

            foreach (var item in studentGrades)
            {
                subjectNameList.Add(item.Subject.Name);
            }
            subjectNameList = subjectNameList.Distinct().ToList();

            foreach (var item in subjectNameList)
            {
                List<Grade> grades = new List<Grade>();
                grades = gradeRepository.GetAll(filter: s => s.Subject.Name == item && s.Student.Id == StudentID);
                details.Add(item, grades);
            }
            model.SubjectGradeList = details;

            List<Subject> subjects = new List<Subject>();
            CourseSubjectRepository courseSubjectRepo = new CourseSubjectRepository();
            List<CourseSubject> courseSubjectList = new List<CourseSubject>();
            courseSubjectList = courseSubjectRepo.GetAll(filter: c => c.CourseID == student.CourseID);
            foreach (var item in courseSubjectList)
            {
                subjects.Add(item.Subject);
            }
            model.SubjectList = subjects;
            return View(model);
        }
コード例 #48
0
 public StudentsController(ApplicationDbContext context)
 {
     _repository           = new StudentRepository(context);
     _departmentRepository = new DepartmentRepository(context);
     _semesterRepository   = new SemesterRepository(context);
 }
コード例 #49
0
 // GET: api/Student
 public IEnumerable<Student> Get()
 {
     if (_studrep == null) _studrep = new StudentRepository();
     return _studrep.StudentenLijst;
 }
コード例 #50
0
ファイル: Validator.cs プロジェクト: tudorgergely/Labs
 public Validator(StudentRepository repo)
 {
     this.repo = repo;
 }
コード例 #51
0
        private void Init()
        {
            _studentRepo = new StudentRepository(_dbProvider);
            _courseRepo = new CourseRepository(_dbProvider);
            _courseRosterRepo = new CourseRosterRepository(_dbProvider);
            _emailRepo = new EmailRepository(_dbProvider);

            _coureCodeCache = new CourseCodeCache(_dbProvider);
            _semesterCache = new SemesterCache(_dbProvider);

            _coureCodeCache.Refresh();
            _semesterCache.Refresh();
        }
コード例 #52
0
 public StudentEditViewModel(int id)
 {
     Student = StudentRepository.GetStudent(id);
     BuildCohortOptions();
 }
コード例 #53
0
 public HomeController(StudentRepository studentRepository)
 {
     _studentRepository = studentRepository;
 }
コード例 #54
0
 public HomeController(StudentRepository studentRepository, ILogger <HomeController> logger)
 {
     this.studentRepository = studentRepository;
     this.logger            = logger;
 }
コード例 #55
0
        public ActionResult ShowDetails(int id)
        {
            StudentControllerStudentVM model = new StudentControllerStudentVM();
            List<Grade> gradeList = new List<Grade>();
            GradeRepository gradeRepository = new GradeRepository();
            gradeList = gradeRepository.GetAll(filter: s => s.Student.Id == id);
            Dictionary<string, List<string>> details = new Dictionary<string, List<string>>();
            var subjectList = new List<string>();

            foreach (var item in gradeList)
            {
                subjectList.Add(item.Subject.Name);
            }
            subjectList = subjectList.Distinct().ToList();

            foreach (var item in subjectList)
            {
                var gradeValueList = new List<string>();
                List<Grade> grades = new List<Grade>();
                grades = gradeRepository.GetAll(filter: s => s.Subject.Name == item && s.Student.Id == id);
                foreach (var grade in grades)
                {
                    gradeValueList.Add(grade.GradeValue.ToString());
                }
                details.Add(item, gradeValueList);
            }
            model.SubjectGradeList = details;
            Student student = new Student();
            StudentRepository studentRepository = new StudentRepository();
            student = studentRepository.GetById(id);
            model.FirstName = student.FirstName;
            model.LastName = student.LastName;
            return View(model);
        }
コード例 #56
0
 public ChatController() : base()
 {
     _chatRepository    = new ChatRepository();
     _userRepository    = new UserRepository();
     _studentRepository = new StudentRepository();
 }
コード例 #57
0
 public ActionResult ManageStudents()
 {
     StudentRepository studentRepository = new StudentRepository();
     AdminControllerStudentVM studentModel = new AdminControllerStudentVM();
     studentModel.studentList = studentRepository.GetAll();
     return View(studentModel);
 }
コード例 #58
0
 public StudentController(StudentRepository repo, Validator val)
 {
     this.repo = repo;
     this.val  = val;
 }
コード例 #59
0
 public StudentData(StudentRepository studentRepository)
 {
     _studentRepository = studentRepository;
 }
コード例 #60
0
        public ActionResult SignUp(Student student, int sessionId, int locationId)
        {
            try
            {
                var studentRepository = new StudentRepository();
                var session = _db.Sessions.SingleOrDefault(s => s.Id == sessionId);
                var location = _db.Locations.SingleOrDefault(s => s.Id == locationId);
                studentRepository.SignUp(student.Id, session.Id);
            }
            catch (Exception e)
            {
                var st = _db.Students.SingleOrDefault(s => s.Id == student.Id);
                ViewBag.LocationId = _db.Locations
                .ToList()
                .Select(inst => new SelectListItem
                {
                    Text = inst.Name,
                    Value = inst.Id.ToString()
                });
                ViewBag.SessionId = _db.Sessions
                    .ToList()
                    .Select(inst => new SelectListItem
                    {
                        Text = inst.Name,
                        Value = inst.Id.ToString()
                    });

                ModelState.AddModelError("", e.Message);
                return View(student);
            }
            return RedirectToAction("Index");
        }