public ActionResult RankOfProfessorInCollege(string id = null, string term = null) { SetViewBag(title: "رتبه بندی اساتید در سطح دانشکده", menuItem: "RankOfProfessorInCollege"); var collegeId = 0; var termId = 0; ViewBag.CollegeList = new SelectList(_collegeService.GetAll(), "Id", "Name"); ViewBag.TermList = new SelectList(_termService.GetAll().OrderByDescending(o => o.TermCode), "Id", "Name"); if (!string.IsNullOrEmpty(id)) { int.TryParse(id, out collegeId); } var user = (Models.User)Session["UserInfo"]; if (user != null && user.College != null) { collegeId = user.College.Id; } if (!string.IsNullOrEmpty(term) && int.TryParse(term, out termId) && termId > 0 && collegeId > 0) { ViewBag.CollegeName = _collegeService.Get(w => w.Id == collegeId).Name; //// Old Methode Start // var counter = 0; // var professors = _collegeService.Get(w => w.Id == collegeId).EducationalGroups.SelectMany(s => s.EducationalClasses).Where(w => w.Term.Id == termId) // .Select(s => s.Professor).OrderByDescending(o => o.ProfessorScores.Where(w => w.Term != null && w.Term.Id == termId).Sum(s => s.CurrentScore)).Distinct() // .Select(s => new Models.Professor // { // //Colleges = Mapper.Map<ICollection<Model.Models.College>, ICollection<Models.College>>(s.Colleges), // //EducationalGroups = Mapper.Map<ICollection<Model.Models.EducationalGroup>, ICollection<Models.EducationalGroup>>(s.EducationalGroups), // EducationalClasses = Mapper.Map<ICollection<Model.Models.EducationalClass>, ICollection<Models.EducationalClass>>(s.EducationalClasses), // ProfessorScores = Mapper.Map<ICollection<Model.Models.ProfessorScore>, ICollection<Models.ProfessorScore>>(s.ProfessorScores), // Name = s.Name, // Family = s.Family, // NationalCode = s.NationalCode, // ProfessorCode = s.ProfessorCode, // Gender = Convert.ToBoolean(s.Gender), // RankInUniversity = ++counter // }).ToList(); // return View(professors); //// Old Methode End var collegeList = new List <int>(); collegeList.Add(collegeId); var model = _reportService.GetProfessorReport(termId, collegeList: collegeList, allColleges: false).General.ToList(); foreach (var item in model) { item.RowNumber = model.IndexOf(item) + 1; } return(View(model)); } //else show error return(View()); }
public ActionResult RankOfEducationalGroupInCollege(string id = null, string term = null) { SetViewBag(title: "رتبه بندی گروه ها در سطح دانشکده ها", menuItem: "RankOfEducationalGroupInCollege"); var collegeId = 0; var termId = 0; ViewBag.CollegeList = new SelectList(_collegeService.GetAll(), "Id", "Name"); ViewBag.TermList = new SelectList(_termService.GetAll().OrderByDescending(o => o.TermCode), "Id", "Name"); if (!string.IsNullOrEmpty(id)) { int.TryParse(id, out collegeId); } var user = (Models.User)Session["UserInfo"]; if (user != null && user.College != null) { collegeId = user.College.Id; } if (!string.IsNullOrEmpty(term) && int.TryParse(term, out termId) && termId > 0 && collegeId > 0) { ViewBag.CollegeName = _collegeService.Get(w => w.Id == collegeId).Name; //// Old Methode Start //var counter = 0; //var groups = _educationalGroupService.GetMany(g=> g.College.Id == collegeId).Select(s=> new Models.EducationalGroup { // Id = s.Id, // EducationalGroupCode = s.EducationalGroupCode, // Name = s.Name, // EducationalGroupScores = Mapper.Map<List<Models.EducationalGroupScore>>(s.EducationalGroupScores), // EducationalClasses = Mapper.Map<List<Models.EducationalClass>>(s.EducationalClasses), // GroupManger = Mapper.Map<Models.Professor>(s.GroupManger), // College = Mapper.Map<Models.College>(s.College), // RankInUniversity = ++counter //}) //.ToList(); //return View(groups); //// Old Methode End var currentTerm = GetCurrentTerm(); var collegeList = new List <int>(); collegeList.Add(collegeId); var model = _reportService.GetGroupReport(termId, collegeList: collegeList, allColleges: false).General.ToList(); foreach (var item in model) { item.RowNumber = model.IndexOf(item) + 1; } return(View(model)); } return(View()); }
public ActionResult ShowUser(int id = 0) { var allGroups = _educationalGroupService.GetAll(); ViewBag.CollegeList = new SelectList(_collegeService.GetAll(), "Id", "Name"); ViewBag.GroupList = new SelectList(allGroups.Where(w => 1 == 2), "EducationalGroupCode", "Name"); if (id > 0) { var item = _userService.Get(g => g.ID == id); var serviceUser = _serviceUsersMappingService.Get(g => g.Username == item.Username); return(View(new Models.User { //College = Mapper.Map<Models.College>(item.College), College = item.College != null ? new Models.College { Id = item.College.Id, CollegeCode = item.College.CollegeCode, Name = item.College.Name } : null, EducationalGroupCode = item.EducationalGroupCode, EducationalGroupName = allGroups.Where(w => w.EducationalGroupCode == item.EducationalGroupCode).FirstOrDefault()?.Name,//_educationalGroupService.GetMany(g=> g.EducationalGroupCode == item.EducationalGroupCode).FirstOrDefault()?.Name, FirstName = item.FirstName, LastName = item.LastName, ID = item.ID, IsAdministrator = item.IsAdministrator, IsPowerUser = item.IsPowerUser, ServiceUsername = serviceUser != null ? serviceUser.ServiceUsername : string.Empty, Username = item.Username })); } return(View(new Models.User())); }
public SelectList GetColleges() { List <Master_College> List = new List <Master_College>(); List = _ICollegeService.GetAll(null, null, "").ToList(); // List = List.OrderBy(x => x.College).ToList(); SelectList selList = new SelectList(List, "CollegeID", "CollegeNAme"); return(selList); }
public ActionResult Index() { Dashboard dashboard = new Dashboard { NumberOfColleges = _collegeService.GetAll().Count(), NumberOfCourses = _courseService.GetAll().Count(), NumberOfDepartment = _departmentService.GetAll().Count(), NumberOfLecturers = _lecturerService.GetAll().Count(), NumberOfStudents = _studentService.GetAll().Count(), NumberOfStudies = _studyService.GetAll().Count() }; return(View(dashboard)); }
public List <CollegeViewModel> GetAll(Guid idEnvironment) { return(_mapper.Map <List <CollegeViewModel> >(_collegeService.GetAll(idEnvironment))); }