public ActionResult Profile()
        {
            string username = HttpContext.User.Identity.Name;
            StudentProfileViewModel profileVm = this.studentsService.GetStudentProfileViewModel(username);

            return(this.View(profileVm));
        }
示例#2
0
        /// <summary>
        /// Student profile/ the main view for the student
        /// </summary>
        /// <returns>Student details view</returns>
        public async Task <IActionResult> Index()
        {
            // Getting the current user
            var user = await mUserManager.GetUserAsync(User);

            // Getting the current student assigned to this user
            var student = mContext.Students.Where(x => x.User == user).Include("Skills").FirstOrDefault();

            // If we have no student assign, this means this is his first time here
            if (student == null)
            {
                // Redirect him to the add view so that the student enter his information
                return(RedirectToAction("Add"));
            }

            // Get the discussion that the current user involved in
            var discussions = mContext.Discussions.Where(d => d.From.Id == user.Id || d.To.Id == user.Id)
                              .Include(x => x.From.Employer)
                              .Include(x => x.To.Employer)
                              .OrderByDescending(d => d.SendingDate)
                              .ToList();

            // Pass all the details to the view model
            var model = new StudentProfileViewModel()
            {
                Student = student, Discussions = discussions
            };

            // if we have a student assign to this user, view his information,,,
            return(View(model));
        }
示例#3
0
 public int Add(StudentProfileViewModel model,
                List <AcademicRecordsViewModel> records,
                GuardianViewModel gardian,
                InitialPaymentDetailViewModel officeFrom, int[] OriginalDocumentId)
 {
     return(_iStudent.Add(model, records, gardian, officeFrom, OriginalDocumentId));
 }
示例#4
0
        public StudentProfileViewModel ToViewModel()
        {
            var viewModel = new StudentProfileViewModel();

            viewModel.StudentProfileId = this.StudentProfileId;
            viewModel.Blog             = this.Blog;
            viewModel.CV        = this.CV;
            viewModel.Email     = this.Email;
            viewModel.Facebook  = this.Facebook;
            viewModel.FirstName = this.FirstName;
            viewModel.LastName  = this.LastName;
            viewModel.LinkedIn  = this.LinkedIn;
            viewModel.Picture   = this.Picture;
            viewModel.Twitter   = this.Twitter;

            viewModel.Education = new EducationViewModel
            {
                Jobs               = this.Jobs,
                Projects           = this.Projects,
                WorkTimePreference = this.WorkTimePreference
            };

            viewModel.Experience = new ExperienceViewModel
            {
            };

            return(viewModel);
        }
示例#5
0
        public StudentProfileViewModel getStudentInfo(Guid id)
        {
            StudentProfileViewModel list = new StudentProfileViewModel();
            var result = from std in _context.Students.ToList()
                         where std.Id == id
                         select new StudentProfileViewModel
            {
                Id                   = std.Id,
                StdNameEnglish       = std.StdNameEnglish,
                StdNameBangla        = std.StdNameBangla,
                StdFatherNameEnglish = std.StdFatherNameEnglish,
                StdFatherNameBangla  = std.StdFatherNameBangla,
                StdMotherNameEnglish = std.StdMotherNameEnglish,
                StdMotherNameBangla  = std.StdMotherNameBangla,
                Gender               = std.Gender,
                DateOfBirth          = std.DateOfBirth,
                Email                = std.Email,
                Phone                = std.Phone,
                Picture              = std.Picture,
                PresentAddress       = std.PresentAddress,
                PermanentAddress     = std.PermanentAddress,
                RegistrationNo       = std.RegistrationNo,
                ExamRollNo           = std.ExamRollNo
            };

            list = result.FirstOrDefault();
            return(list);
        }
        public StudentProfileView(string studentID)
        {
            InitializeComponent();
            KeyboardService.HideKeyboard();

            BindingContext = vm = new StudentProfileViewModel(studentID);
            vm.Nav         = this;
        }
示例#7
0
        public async Task <IActionResult> UpdateProfileAsync([FromBody] StudentProfileViewModel studentProfileViewModel)
        {
            var userId = Request.GetUserId();
            await _userService.UpdateUserRoleProfile <StudentProfile, StudentProfileViewModel>(userId, studentProfileViewModel)
            .ConfigureAwait(false);

            return(Ok());
        }
        public StudentProfileView(StudentDetails details)
        {
            InitializeComponent();
            KeyboardService.HideKeyboard();
            BindingContext = vm = new StudentProfileViewModel(details);
            vm.Nav         = this;

            //this.SizeChanged += StudentProfileView_SizeChanged;
        }
示例#9
0
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            this.ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : string.Empty;

            var userId       = this.User.Identity.GetUserId();
            var modelStudent = this.students.GetById(userId);


            // TODO : Fix AutoMapper mapping
            var mod = new StudentProfileViewModel()
            {
                FirstName     = modelStudent.FirstName,
                MiddleName    = modelStudent.MiddleName,
                LastName      = modelStudent.LastName,
                Email         = modelStudent.Email,
                University    = modelStudent.University,
                FacultyName   = modelStudent.FacultyName,
                FacultyNumber = modelStudent.FacultyNumber,
                Course        = modelStudent.Course,
                GroupNumber   = modelStudent.GroupNumber,
                // RoomName = modelStudent.Room.RoomName,
                // FloorNumber = modelStudent.Room.Floor.FloorNumber,
                // BuildingName = modelStudent.Room.Floor.Building.Name
            };

            if (modelStudent.Room == null)
            {
                mod.RoomName = "Not set yet";
            }
            else
            {
                mod.RoomName     = modelStudent.Room.RoomName;
                mod.FloorNumber  = modelStudent.Room.Floor.FloorNumber;
                mod.BuildingName = modelStudent.Room.Floor.Building.Name;
            }

            var student = this.Mapper.Map <StudentProfileViewModel>(modelStudent);
            var model   = new IndexViewModel
            {
                HasPassword       = this.HasPassword(),
                PhoneNumber       = await this.UserManager.GetPhoneNumberAsync(userId),
                TwoFactor         = await this.UserManager.GetTwoFactorEnabledAsync(userId),
                Logins            = await this.UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await this.AuthenticationManager.TwoFactorBrowserRememberedAsync(userId),
                Student           = mod
            };

            return(this.View(model));
        }
示例#10
0
        public IActionResult Profile()
        {
            var userId  = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var student = _db.Students.Include(x => x.Class).Include(x => x.Person).FirstOrDefault(x => x.PersonId == userId);
            StudentProfileViewModel vm = new StudentProfileViewModel();

            vm.Student = student;

            return(View(vm));
        }
        /// <summary>
        /// get student profile info
        /// </summary>
        /// <param name="username">username</param>
        /// <returns>StudentProfileViewModel if found, null if not found</returns>
        public StudentProfileViewModel GetStudentProfileByUsername(string username)
        {
            var all = Data.StudentData;
            StudentProfileViewModel result = null;
            var student = all.FirstOrDefault(x => x.AD_Username.ToLower() == username.ToLower());

            if (student != null)
            {
                result = student;
            }
            return(result);
        }
示例#12
0
        public async Task <IActionResult> Profile()
        {
            Student currentStudent = await _authentication.GetCurrentStudentAsync();

            IEnumerable <Subject> subjects = _subjectService.GetSubjectsByStudent(currentStudent);

            StudentProfileViewModel model = new StudentProfileViewModel {
                Student = currentStudent, Subjects = subjects
            };

            return(View(model));
        }
示例#13
0
        public ActionResult Account()
        {
            var student   = _context.Students.Include(b => b.BloodGroup).SingleOrDefault(s => s.UserName == User.Identity.Name);
            var viewModel = new StudentProfileViewModel();

            viewModel.Student = student;
            var GroupName = _context.BloodGroups.SingleOrDefault(b => b.Id == student.BloodGroupId);

            //viewModel.BloodGroupName = GroupName.GroupName;

            return(View(viewModel));
        }
示例#14
0
        public void Test_GetProfileVm_Should_Return_Vm()
        {
            // Arrange
            const string username = "******";

            // Act
            StudentProfileViewModel profileVm = this.studentsService.GetStudentProfileViewModel(username);

            // Assert
            Assert.IsNotNull(profileVm);
            Assert.AreEqual(username, profileVm.UserName);
        }
示例#15
0
        public async Task <IActionResult> Profile(StudentProfileViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var student = _db.Students.Include(x => x.Person).Where(x => x.PersonId == vm.Student.PersonId).FirstOrDefault();
                student.Person.Name    = vm.Student.Person.Name;
                student.Person.Address = vm.Student.Person.Address;
                student.Person.Email   = vm.Student.Person.Email;

                _db.Update(student);
                _db.SaveChanges();
                if (vm.IsChangePassworld)
                {// có đổi mk
                    if (vm.Password.Length < 4 || vm.CurrentPassword.Length < 4 || vm.ConfirmPassword.Length < 4)
                    {
                        ModelState.AddModelError("", "Mk ko hợp lệ");
                    }
                    else
                    {
                        try
                        {
                            var result = await _userManager.ChangePasswordAsync(student.Person, vm.CurrentPassword, vm.Password);

                            if (result.Succeeded)
                            {
                                return(RedirectToAction("index"));
                            }
                            else
                            {
                                foreach (var item in result.Errors)
                                {
                                    ModelState.AddModelError("", item.Description);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            ModelState.AddModelError("", e.Message);
                        }
                    }
                }
                else
                {
                    return(RedirectToAction("index"));
                }
            }
            return(View(vm));
        }
        public new async Task <ActionResult> Profile()
        {
            StudentProfileViewModel profileViewModel = new StudentProfileViewModel
            {
                Student = await _studentRepository.GetByUserId(User.Identity.GetUserId())
            };

            profileViewModel.ApplicationForm = await db.ApplicationForms.FirstOrDefaultAsync(f => f.StudentId == profileViewModel.Student.Id);

            profileViewModel.ApplicationStatus = (profileViewModel.ApplicationForm != null)
                ? db.ApplicationStatuses.FirstOrDefault(
                f => f.ApplicationFormId == profileViewModel.ApplicationForm.Id)
                : null;

            return(View(profileViewModel));
        }
        public ActionResult Details(string id = null)
        {
            StudentProfile studentprofile = db.StudentProfiles.Find(id);

            if (studentprofile == null)
            {
                Session["FlashMessage"] = "Student Profile not found";
                return(RedirectToAction("Index", "StudentProfile"));
            }
            StudentProfileViewModel ViewModel = new StudentProfileViewModel();

            ViewModel.student = studentprofile;
            var applications = studentprofile.Applications;
            List <ProgramAction> programactions = new List <ProgramAction>();

            foreach (var application in applications)
            {
                ProgramAction programaction = new ProgramAction();
                programaction.application = application;
                programaction.program     = application.Program;
                programaction.student     = studentprofile;

                //check student eligibility
                programaction.eligible = true;
                //check program application period
                programaction.inperiod = (application.Program.application_start_time <= DateTime.Now && DateTime.Now <= application.Program.application_end_time);
                //check if before program start time
                programaction.beforestart = (DateTime.Now < application.Program.application_start_time);
                //check existing application
                programaction.existed = true;
                //check application status
                programaction.saved = programaction.application.ApplicationStatus.name == "Saved";
                //check program status
                programaction.open = application.Program.ProgramStatus.name == "Opened";
                programactions.Add(programaction);
            }
            ViewModel.programactions  = programactions;
            ViewModel.particulartypes = db.StudentParticularTypes.ToList();
            ViewModel.experiencetypes = db.StudentExperienceTypes.ToList();
            ViewBag.profilepic        = System.IO.File.Exists(Server.MapPath("~/Images/StudentProfile/" + studentprofile.id + ".jpg"));
            return(PartialView(ViewModel));
        }
        public ActionResult MyProfile()
        {
            StudentProfileViewModel ViewModel = new StudentProfileViewModel();

            string studentid      = User.Identity.Name;
            var    studentprofile = db.StudentProfiles.Find(studentid);

            if (studentprofile == null)
            {
                Session["FlashMessage"] = "Student Profile not found";
                return(RedirectToAction("Index", "Home"));
            }
            var applications = db.Applications.ToList().Where(a => a.created_by == studentid.ToString());

            ViewModel.student = studentprofile;
            List <ProgramAction> programactions = new List <ProgramAction>();

            foreach (var application in applications)
            {
                ProgramAction programaction = new ProgramAction();
                programaction.application = application;
                programaction.program     = application.Program;
                programaction.student     = studentprofile;

                //check student eligibility
                programaction.eligible = true;
                //check program application period
                programaction.inperiod = (application.Program.application_start_time <= DateTime.Now && DateTime.Now <= application.Program.application_end_time);
                //check if before program start time
                programaction.beforestart = (DateTime.Now < application.Program.application_start_time);
                //check existing application
                programaction.existed = true;
                //check application status
                programaction.saved = programaction.application.ApplicationStatus.name == "Saved";
                //check program status
                programaction.open = application.Program.ProgramStatus.name == "Opened";
                programactions.Add(programaction);
            }
            ViewModel.programactions = programactions;
            return(View(ViewModel));
        }
示例#19
0
        public void UpdateStudentProfile(StudentProfileViewModel model)
        {
            var std = _context.Students.Where(x => x.Id == model.Id).FirstOrDefault();

            std.StdNameEnglish       = model.StdNameEnglish;
            std.StdNameBangla        = model.StdNameBangla;
            std.StdFatherNameEnglish = model.StdFatherNameEnglish;
            std.StdFatherNameBangla  = model.StdFatherNameBangla;
            std.StdMotherNameBangla  = model.StdMotherNameBangla;
            std.StdMotherNameEnglish = model.StdMotherNameEnglish;
            std.DateOfBirth          = model.DateOfBirth;
            std.Phone            = model.Phone;
            std.Picture          = model.Picture;
            std.PermanentAddress = model.PermanentAddress;
            std.PresentAddress   = model.PresentAddress;
            std.RegistrationNo   = model.RegistrationNo;
            std.ExamRollNo       = model.ExamRollNo;

            _context.Entry(std).State = EntityState.Modified;
            _context.SaveChanges();
        }
示例#20
0
        public ActionResult Index()
        {
            StudentProfileViewModel detail = new StudentProfileViewModel();

            detail.campus = _work.Campus.GetAll();
            detail.department = _work.Department.GetAll();
            detail.batch = _work.Batch.GetAll();
            detail.section = _work.Section.GetAll();

            return View(detail);
        }
示例#21
0
        private StudentProfileViewModel GetStudentProfileViewModel(User student)
        {
            var studentViewModel = new StudentProfileViewModel();

            // Get all the available teachers.
            var allTeachers = UserService.GetUsersByRole(RoleNames.TEACHER);

            studentViewModel.AvailableTeachers = allTeachers;

            var studentName = User.Identity.Name;

            // Get Global Student Rank
            studentViewModel.GlobalRank = UserService.CalculateStudentRank(studentName);

            // Get Student total points
            studentViewModel.TotalStudentPoints = UserService.CalculateStudentTotalPoints(studentName);

            // Get student total quiz points
            studentViewModel.TotalQuizPoints = UserService.CalculateStudentTotalQuizPoints(studentName);

            studentViewModel.NumberOfLocationsDetailsOpened = student.OpenedLocationDetails ?? 0;
            studentViewModel.NumberOfResourcesOpened        = student.OpenedResources ?? 0;

            var totalStudents = UserService.GetUsersByRole(RoleNames.STUDENT).Count;

            studentViewModel.StudentsAfterYou  = totalStudents - studentViewModel.GlobalRank;
            studentViewModel.StudentsBeforeYou = totalStudents - (studentViewModel.GlobalRank + 1);

            studentViewModel.RankName  = student.Rank.RankName;
            studentViewModel.RankImage = student.Rank.RankImage;
            studentViewModel.RankOrder = student.Rank.RankOrder;

            if (student.Rank.ParentRank == null)
            {
                studentViewModel.NextPointBorder = -1;
            }
            else
            {
                studentViewModel.NextPointBorder = student.Rank.ParentRank.RequiredPoints;
            }

            studentViewModel.ProgressPercent = UserService.CalculateStudentPercentProgress(studentName);

            if (student.Teacher != null)
            {
                studentViewModel.HasTeacher = true;
                var classRoomXml = student.Teacher.TeacherClassroomDefinition;

                if (!string.IsNullOrWhiteSpace(classRoomXml))
                {
                    var classroom = ClassroomSerializer.DesirializeFromXml(classRoomXml);

                    if (classroom != null)
                    {
                        studentViewModel.Classroom = classroom;
                    }
                }
            }
            else
            {
                studentViewModel.HasTeacher = false;
                studentViewModel.Classroom  = null;
            }
            return(studentViewModel);
        }
示例#22
0
        public int Add(StudentProfileViewModel model,
                       List <AcademicRecordsViewModel> records,
                       GuardianViewModel gardian,
                       InitialPaymentDetailViewModel officeFrom, int[] OriginalDocumentId)
        {
            Student std = new Student();

            std.Id                   = Guid.NewGuid();
            std.StdNameBangla        = model.StdNameBangla;
            std.StdNameEnglish       = model.StdNameEnglish;
            std.StdFatherNameBangla  = model.StdFatherNameBangla;
            std.StdFatherNameEnglish = model.StdFatherNameEnglish;
            std.StdMotherNameBangla  = model.StdMotherNameBangla;
            std.StdMotherNameEnglish = model.StdMotherNameEnglish;
            std.AdmissionDate        = DateTime.Now;
            std.DateOfBirth          = model.DateOfBirth;
            std.EntryDate            = DateTime.Now;
            std.FormNo               = _context.Students.Select(s => s.FormNo).Max() + 1;
            std.Gender               = model.Gender;
            std.IsActive             = true;
            std.IsSuspended          = model.IsSuspended;
            std.Nationality          = model.Nationality;
            std.PermanentAddress     = model.PermanentAddress;
            std.Phone                = model.Phone;
            std.Email                = model.Email;
            std.Picture              = model.Picture;
            std.PresentAddress       = model.PresentAddress;
            std.Religion             = model.Religion;
            std.SuspendedDesc        = model.SuspendedDesc;

            std.RegistrationNo    = officeFrom.RegistrationNo;
            std.ExamRollNo        = officeFrom.ExamRollNo;
            std.CourseId          = model.CourseId;
            std.AcademicSessionId = model.AcademicSessionId;
            std.SemesterId        = model.SemesterId;
            _context.Students.Add(std);

            foreach (var item in records)
            {
                if (item.ExamId > 0)
                {
                    AcademicRecord r = new AcademicRecord();
                    r.ExamId        = item.ExamId;
                    r.GroupId       = item.GroupId;
                    r.BoardId       = item.BoardId;
                    r.YearOfPassing = item.YearOfPassing;
                    r.RollOfExam    = item.RollOfExam;
                    r.Grade         = item.Grade;
                    r.StudentId     = std.Id;
                    _context.AcademicRecords.Add(r);
                }
            }

            Guardian gar = new Guardian();

            gar.Id         = Guid.NewGuid();
            gar.Name       = gardian.Name;
            gar.Occupation = gardian.Occupation;
            gar.Relation   = gardian.Relation;
            gar.Phone      = gardian.Phone;
            gar.Address    = gardian.Address;
            gar.StudentId  = std.Id;
            _context.Guardians.Add(gar);

            InitialPaymentDetail ip = new InitialPaymentDetail();

            ip.CourseFee = officeFrom.CourseFee;
            //ip.InitialPayment = officeFrom.InitialPayment;
            ip.CourseId = model.CourseId;
            //ip.PaymentScheduleId = officeFrom.PaymentScheduleId;
            ip.StudentId = std.Id;
            _context.InitialPaymentDetails.Add(ip);


            foreach (var d in OriginalDocumentId)
            {
                StudentOriginalDocument stdDOc = new StudentOriginalDocument();
                stdDOc.StudentId          = std.Id;
                stdDOc.OriginalDocumentId = d;
                _context.StudentOriginalDocuments.Add(stdDOc);
            }

            StudentSemesterMapping sm = new StudentSemesterMapping();

            sm.StudentId  = std.Id;
            sm.SemesterId = model.SemesterId;
            sm.IsActive   = true;
            _context.StudentSemesterMappings.Add(sm);

            try
            {
                _context.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                Console.WriteLine(e);
            }

            return(0);
        }
示例#23
0
 public void UpdateStudentProfile(StudentProfileViewModel model)
 {
     _iStudent.UpdateStudentProfile(model);
 }