Example #1
0
        public ActionResult CorporateClients(string urlName, int?pageIndex)
        {
            if (!pageIndex.HasValue)
            {
                return(RedirectToAction(() => CorporateClients(urlName, 1)));
            }
            var index = pageIndex.Value - 1;

            var model = new CorporateClientsVM();

            model.UrlName = urlName;
            model.Page    = GetCorporateClients();


            if (model.IsResponses)
            {
                model.Responses = OrgResponseService.GetAll().IsActive().OrderByDescending(r => r.OrgResponseID)
                                  .ToPagedList(index, 10);
            }

            if (model.IsProjects)
            {
                model.OrgProjects = OrgProjectService.GetAll().IsActive()
                                    .ToPagedList(index, 10);
            }



            return(View(model));
        }
Example #2
0
        public ActionResult CourseResponses(string urlName, int?pageIndex)
        {
            if (!pageIndex.HasValue)
            {
                return(RedirectToAction(() => CourseResponses(urlName, 1)));
            }
            var course = CourseService.GetAll(c => c.IsActive && c.UrlName == urlName)
                         .OrderBy(x => x.Course_ID).FirstOrDefault();

            if (course == null)
            {
                return(null);
            }
            var responses = ResponseService.GetAllForCourse(course.Course_TC)
                            .OrderByDescending(x => x.Rating)
                            .ThenByDescending(x => x.UpdateDate).ToPagedList(pageIndex.GetValueOrDefault(1) - 1, 10);
            var orgResponses =
                OrgResponseService.GetAll(r => r.Course_TC == course.Course_TC)
                .Take(20).ToList();
            var model = new CourseResponsesVM {
                Course       = course,
                Responses    = responses,
                OrgResponses = orgResponses
            };

            return(View(ViewNames.CourseResponses, model));
        }
Example #3
0
        public EmployeeVM GetEmployee(string employeeTC)
        {
            var employee = EmployeeService.GetByPK(employeeTC);

            if (employee == null || !employee.FinalSiteVisible)
            {
                return(null);
            }
            var groups = new List <Group>();

            if (employee.IsTrainer)
            {
                groups = GroupService.GetAllByTrainer(employeeTC)
                         .OrderBy(x => x.DateBeg).Take(CommonConst.NearestGroupCount).ToList();
            }

            var orgResponses = OrgResponseService.GetAll().IsActive()
                               .Where(r => r.Employee_TC.Contains(employeeTC))
                               .OrderByDescending(o => o.UpdateDate).ToList();
            var model = new EmployeeVM
            {
                Employee     = employee,
                OrgResponses = orgResponses,
                Groups       = groups,
            };

            return
                (model);
        }
Example #4
0
        public ActionResult OrgResponse(int responseID)
        {
            var model = new OrgResponseVM {
                Response         = OrgResponseService.GetByPK(responseID),
                CorporateClients = GetCorporateClients()
            };

            if (model.Response == null)
            {
                return(null);
            }
            return(View(model));
        }
Example #5
0
        public ActionResult AboutTrainer(string employeeTC, string urlName, int?pageIndex)
        {
            if (employeeTC.IsEmpty())
            {
                return(NotFound());
            }
            if (!pageIndex.HasValue &&
                urlName.In(
                    SimplePages.Urls.TrainerOrgResponses,
                    SimplePages.Urls.TrainerResponses,
                    SimplePages.Urls.TrainerTests,
                    SimplePages.Urls.TrainerAdvices,
                    SimplePages.Urls.TrainerWorks,
                    SimplePages.Urls.TrainerVideos))
            {
                return(RedirectToAction(() => AboutTrainer(employeeTC, urlName, 1)));
            }
            var index = pageIndex.GetValueOrDefault() - 1;

            var model = new AboutTrainerVM();

            model.UrlName  = urlName;
            model.Page     = GetAboutTrainer();
            employeeTC     = employeeTC.ToUpper();
            model.Employee = EmployeeVMService.GetEmployee(employeeTC);
            if (model.Employee == null || !model.Employee.Employee.IsTrainer)
            {
                return(Redirect(SimplePages.FullUrls.Trainers));
            }
            var orgResponses = OrgResponseService.GetAll().IsActive()
                               .Where(r => ("," + r.Employee_TC + ",").Contains("," + employeeTC + ","))
                               .OrderByDescending(o => o.UpdateDate);
            var responses = ResponseService.GetAllForEmployee(employeeTC)
                            .OrderByDescending(x => x.Course.IsActive)
                            .ThenByDescending(o => o.Rating).ThenByDescending(x => x.UpdateDate);

            var advices = AdviceService.GetAll().IsActive()
                          .Where(r => r.Employee_TC == employeeTC)
                          .OrderByDescending(o => o.UpdateDate);
            var tests = TestService.GetAll().Where(x => x.Status == TestStatus.Active)
                        .Where(r => r.Author_TC == employeeTC)
                        .OrderByDescending(o => o.Id);
            var videos = VideoService.GetAll().IsActive()
                         .Where(r => r.Employee_TC == employeeTC)
                         .OrderByDescending(o => o.VideoID);
            var userWorks = UserWorkService.GetAll().IsActive()
                            .Where(r => r.Trainer_TC == employeeTC)
                            .OrderByDescending(o => o.UserWorkID);

            model.HasOrgResponses = orgResponses.Any();
            model.HasResponses    = responses.Any();
            model.HasAdvices      = advices.Any();
            model.HasTests        = tests.Any();
            model.HasVideos       = videos.Any();
            model.HasPortfolio    = Images.GetGallaryFiles(model.Employee.Employee, "Portfolio").Any();
            model.HasWorks        = userWorks.Any();

            if (model.IsTrainerResponses)
            {
                model.Responses = responses.ToPagedList(index, 20);
            }

            if (model.IsTrainerOrgResponses)
            {
                model.OrgResponses = orgResponses.ToPagedList(index, 10);;
            }

            if (model.IsAdvices)
            {
                model.Advices = advices.ToPagedList(index, 10);
            }
            if (model.IsTests)
            {
                model.Tests = tests.ToPagedList(index, 10);
            }
            if (model.IsVideos)
            {
                model.Videos = videos.ToList();
            }
            if (model.IsWorks)
            {
                model.UserWorks = userWorks.ToPagedList(index, 10);
            }
            if (model.IsAboutTrainer)
            {
                model.Certifications = EmployeeCertificationService.GetAll(
                    x => x.EmployeeFK_TC == employeeTC && x.Certification.IsActive)
                                       .OrderBy(x => x.SortOrder)
                                       .Select(x => x.Certification).ToList();
            }
            return(View(model));
        }