Пример #1
0
        public ActionResult HotGroups()
        {
            var groups = GroupVMService.GetAllForMain();
            var url    = RootUrl +
                         Url.Action <RssController>(c => c.HotGroups());
            var feed =
                new SyndicationFeed("Курсы со скидками www.specialist.ru",
                                    "Курсы со скидками www.specialist.ru",
                                    new Uri(url),
                                    "hotgroupfeed",
                                    DateTime.Now);
            var items = new List <SyndicationItem>();

            foreach (var group in groups)
            {
                var item =
                    new SyndicationItem(group.Course.WebName,
                                        group.DateBeg.DefaultString() +
                                        " скидка " + group.Discount + "%",
                                        new Uri(RootUrl + Url.Action <CourseController>(
                                                    c => c.Details(group.Course.UrlName))),
                                        group.Group_ID.ToString(),
                                        DateTimeOffset.Now);
                items.Add(item);
            }

            feed.Items = items;
            return(FeedOrChrome(feed));
        }
Пример #2
0
        public ActionResult HotGroupsForMain(string viewName)
        {
            var announces = GroupVMService.GetAllForMain();
            var model     = new GroupsForMainVM();

            model.Groups = announces;
            return(View(PartialViewNames.HotGroupsForMain, model));
        }
Пример #3
0
        public ActionResult HotGroupsWithSort(int sortType)
        {
            var groups = GroupVMService.DiscountGroups();

            groups = GroupListSortTypes.Sort(sortType, PriceService.CoursePriceIndex(), groups);
            return(View(PartialViewNames.NearestGroupList,
                        new NearestGroupsVM(groups)
            {
                ShowAllDiscountLink = true
            }));
        }
Пример #4
0
        public void AddControlForIntramuralExtramural(SimplePageVM model)
        {
            var openClasses = GroupService.GetPlannedAndNotBegin()
                              .Where(x => x.IsIntraExtramural).Take(30).ToList();

            var groups = GroupVMService.GetSectionGroups(openClasses)
                         .Select(x => Tuple.Create(x.Key, new NearestGroupsVM(x.ToList()))).ToList();

            model.Controls.Add(
                new SimplePageVM.Control(Views.Shared.Education.NearestGroupListWithSections, groups));
        }
Пример #5
0
        public ActionResult Details(decimal groupID)
        {
            var groupVM = GroupVMService.GetGroup(groupID);

            if (groupVM != null)
            {
                groupVM.ShowLibrary = User.GetOrDefault(x => x.IsStudent) &&
                                      CourseFileVMService.GetFiles(_.List(Tuple.Create(groupVM.Group.Course_TC, groupVM.Group.Teacher_TC))).Any();
                var vkGroupId = GetVkGroupId(groupID);
                groupVM.VkGroupUrl = GetVkGroupUrl(vkGroupId);
            }
            return(MView(Views.Group.Details, groupVM));
        }
Пример #6
0
        public void AddControlForAboutDiplom(SimplePageVM model)
        {
            var diploms  = CourseService.DiplomTracks().ToList();
            var sections = UniqCourseInSection(GroupVMService.GetSectionCourseTCs(diploms));
            var data     = sections.Select(x => Tuple.Create(x.Key,
                                                             CourseListVMService.GetAll(new TrackListVM {
                IsDiplomPage = true,
                Courses      = x.ToList()
            }).FluentUpdate(y => y.EntityName = x.Key.Name))).ToList();
            var list = new DiplomProgramListVM {
                List = data
            };

            model.Controls.Add(new SimplePageVM.Control(Views.Page.DiplomProgramList, list));
        }
Пример #7
0
 private DiplomProgramListVM GetTrainingPrograms(PageController page)
 {
     return(MethodBase.GetCurrentMethod().CacheDay(() => {
         var programs = CourseService.GetAllHitTracks()
                        .Select(x => x.Course_TC).Except(CourseTC.HalfTracks.Keys).ToList();
         var sectionCourseTCs = GroupVMService.GetSectionCourseTCs(programs);
         var sections = UniqCourseInSection(sectionCourseTCs);
         var data = sections.Select(x => Tuple.Create(x.Key,
                                                      CourseListVMService.GetAll(new TrackListVM {
             IsTrainingProgramsPage = true,
             Courses = x.ToList()
         }).FluentUpdate(y => {
             y.EntityName = x.Key.Name;
             y.EntityUrl = page.Html.Url().Section().Urls.Details(x.Key.UrlName);
         }))).ToList();
         var list = new DiplomProgramListVM {
             List = data
         };
         return list;
     }));
 }
Пример #8
0
        public virtual ActionResult List(GroupFilter filter, int?pageIndex)
        {
            pageIndex = pageIndex ?? 1;
            var model = GroupVMService
                        .GetAllGroups(filter, pageIndex.Value - 1);

            InitDictionary(model.Filter);
            if (filter.ForPrint.GetValueOrDefault())
            {
                if (filter.SectionId.IsNull())
                {
                    var groups = model.Groups.Source;
                    if (filter.ForPdf.GetValueOrDefault())
                    {
                        groups = groups.Take(500);
                    }
                    var sectionGroups = GroupVMService.GetSectionGroups(groups.ToList());
                    model.SectionGroups = sectionGroups;
                }

                return(View(ViewNames.ListForPrint, model));
            }
            return(View(ViewNames.GroupList, model));
        }
Пример #9
0
        public ActionResult Videos(decimal groupId)
        {
//			var emails = _.List("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**");
//			if (!emails.Contains(User.Email)) {
//				return null;
//			}
            var r     = GroupVMService.HideVimeoGroupVideo(groupId);
            var hide  = r.Item1;
            var group = r.Item2;

            if (hide)
            {
                return(BaseViewWithTitle("Записи не доступны"));
            }
            var videoIds = AlbumVideoService.GetVideos(group.VimeoAlbumId);
            var videos   = InlineBaseView.New(new GroupVideosVM {
                Group = group
            },
                                              z => SiteHtmls.VimeoPlayers(videoIds, group.WbnRecPwd));

            return(BaseViewWithTitle(
                       "Записи " + StringUtils.AngleBrackets(group.Course.WebName),
                       new PagePart(videos)));
        }
Пример #10
0
 private List <Group> GetMobileGroups()
 {
     return(CacheUtils.Get(MethodBase.GetCurrentMethod(),
                           () => GroupVMService.GetAllForMain()));
 }