public ActionResult GetProfileStatistic(string userLogin)
        {
            var userService = new UsersManagementService();

            var subjectService = new SubjectManagementService();

            var user = userService.GetUser(userLogin);

            var labs = 0;
            var lects = 0;

            if (user.Lecturer == null)
            {
                labs = subjectService.LabsCountByStudent(user.Id);
            }
            else
            {
                labs = subjectService.LabsCountByLector(user.Id);
            }

            return Json(new
            {
                Labs = labs,
                Lects = lects
            });
        }
예제 #2
0
        public ActionResult GetProfileInfo(string userLogin)
        {
            var model = new ProfileVewModel();

            var service = new UsersManagementService();

            var user = service.GetUser(userLogin);

            model.UserType = user.Lecturer != null ? "1" : "2";
            model.Avatar = user.Avatar;
            model.SkypeContact = user.SkypeContact;
            model.Email = user.Email;
            model.Phone = user.Phone;
            model.About = user.About;

            model.LastLogitData = user.AttendanceList.LastOrDefault().ToString("dd/MM/yyyy hh:mm:ss");
            if (user.Lecturer != null)
            {
                model.Name = user.Lecturer.FirstName + " " + user.Lecturer.LastName;
                model.Skill = user.Lecturer.Skill;
            }
            else
            {
                model.Name = user.Student.FirstName + " " + user.Student.LastName;
                var course = int.Parse(DateTime.Now.Year.ToString()) - int.Parse(user.Student.Group.StartYear);
                if (DateTime.Now.Month >= 9)
                {
                    course += 1;
                }

                model.Skill = course > 5 ? "Окончил (-а)" : course + " курс";
            }

            return Json(model);
        }
        public ActionResult GetProfileInfoCalendar(string userLogin)
		{
			var userService = new UsersManagementService();

            var subjectService = new SubjectManagementService();
           
            var user = userService.GetUser(userLogin);
            
            var labsEvents =
		        subjectService.GetLabEvents(user.Id)
		            .Select(e => new ProfileCalendarViewModel() { color = e.Color, title = e.Title, start = e.Start })
		            .ToList();

            var lectEvents =
                subjectService.GetLecturesEvents(user.Id)
                    .Select(e => new ProfileCalendarViewModel() { color = e.Color, title = e.Title, start = e.Start })
                    .ToList();

			return Json(new
			                {
			                    Labs = labsEvents,
                                Lect = lectEvents
			                });
		}
        public ActionResult GetUserProject(string userLogin)
        {
            var service = new UsersManagementService();

            var user = service.GetUser(userLogin);
            var project = ProjectManagementService.GetProjectsOfUser(user.Id);

            return Json(project.Select(e => new
                                                {
                                                    Name = e.Project.Title
                                                }));
        }
        public ActionResult GetProfileInfoSubjects(string userLogin)
        {
            var userService = new UsersManagementService();

            var subjectService = new SubjectManagementService();

            var user = userService.GetUser(userLogin);

            List<Subject> model;

            if (user.Lecturer == null)
            {
                model = subjectService.GetSubjectsByStudent(user.Id);
            }
            else
            {
                model = subjectService.GetSubjectsByLector(user.Id);
            }


			var returnModel = new List<object>();

	        foreach (var subject in model)
	        {
		        returnModel.Add(new
                                              {
                                                  Name = subject.Name,
                                                  Id = subject.Id,
                                                  ShortName = subject.ShortName,
												  Completing = subjectService.GetSubjectCompleting(subject.Id)
                                              });
	        }

            return Json(returnModel);
        }
예제 #6
0
        public JsonResult GetDeveloperNames()
        {
            var _context = new UsersManagementService();
            var context = new ProjectManagementService();
            var projectUsers = context.GetProjectUsers(_currentProjectId).ToList().Where(e => e.ProjectRoleId == 1);

            var users = new List<User>();

             var currProjectUser =
                context.GetProjectUsers(_currentProjectId).Single(e => e.UserId == WebSecurity.CurrentUserId);
            if (currProjectUser.ProjectRoleId == 1)
            {
                users.Add(_context.GetUser(currProjectUser.UserId));
            }
            else
            {
                foreach (var user in projectUsers)
                {
                    users.Add(_context.GetUser(user.UserId));
                }
            }

            var userList = users.Select(e => new SelectListItem
            {
                Text = context.GetCreatorName(e.Id),
                Value = e.Id.ToString(CultureInfo.InvariantCulture)
            }).ToList();

            return Json(new SelectList(userList, "Value", "Text"));
        }