Example #1
0
        public ActionResult All(int?year)
        {
            var yearOrCurrent = year ?? DateTime.Today.Year;
            var html          = MethodBase.GetCurrentMethod().CacheWith(() => {
                var yearsBlock = H.h2[Enumerable.Range(2001, DateTime.Today.Year - 2001 + 1).Reverse()
                                      .Select(x => x == yearOrCurrent ? (IHtmlTag)H.b[x] : Url.SiteNews().All(x, x.ToString()))];
                var news = NewsService.GetAll().Where(x => x.IsActive &&
                                                      x.PublishDate.Year == yearOrCurrent).OrderByDescending(n => n.PublishDate)
                           .Select(x => new {
                    x.NewsID, x.Title, x.PublishDate
                }).ToList()
                           .Select(x => new News {
                    NewsID = x.NewsID, Title = x.Title, PublishDate = x.PublishDate
                });

                return(H.div[yearsBlock, news.GroupBy(x => x.PublishDate.Month)
                             .Select(x => H.div[H.h3[MonthUtil.GetName(x.Key)],
                                                H.Ul(x.Select(y => y.PublishDate.DefaultString() + " " + Html.NewsLink(y)))])].ToString());
            }, yearOrCurrent, 24);

            var model = new AllNewsVM {
                Year = yearOrCurrent
            };
            var view = InlineBaseView.New(model, x => html);

            return(BaseViewWithModel(view, model));
        }
Example #2
0
        public ActionResult ClassRooms(string complexTC)
        {
            var rooms = ClassRoomService.GetAll(x => x.Complex_TC == complexTC && x.IsInUse)
                        .Select(x => x.ClassRoom_TC).ToList();
            var view = new InlineBaseView <ClassRoomsVM>(v =>
                                                         H.Ul(v.Model.ClassRooms.Select(x => H.Anchor(Urls.ClassRoom(x), x)
                                                                                        .Class("fancy-box"))));

            return(BaseViewWithModel(view, new ClassRoomsVM {
                ClassRooms = rooms
            }));
        }
Example #3
0
        public ActionResult GroupCerts()
        {
            StudentInGroupRepository.LoadWith(b => b.Load(x => x.Group).And <Group>(x => x.Course));
            var sigIds = CertificateService.GetAll(x => x.StudentInGroup.Student_ID ==
                                                   User.Student_ID.GetValueOrDefault()).Select(x => x.StudentInGroup_ID).ToList();
            var sigs = StudentInGroupRepository
                       .GetAll(sig =>
                               sig.Student_ID == User.Student_ID &&
                               (
                                   sig.CertGiven ||
                                   FinalExamMarks.MOCert.Contains(sig.FinalExamMark_TC) ||
                                   sigIds.Contains(sig.StudentInGroup_ID)) &&
                               (sig.Group.Course_TC == CourseTC.Itil ||
                                !AuthorizationTypes.WithoutMOCert.ToList().Contains(sig.Group.Course.AuthorizationType_TC ?? "")) &&
                               BerthTypes.AllForCert.Contains(sig.BerthType_TC) &&
                               sig.Group.DateEnd <= DateTime.Today
                               )
                       .OrderByDescending(x => x.Group.DateEnd)
                       .ToList();
//      var types = CertTypes.ForCert.ToList();
//			var certs = CertificateService.GetAll(x => sigIds.Contains(x.StudentInGroup_ID)
//				&& types.Contains(x.CertType_TC)).OrderByDescending(x => x.DateEnd).ToList();

            var model = new CertificateListVM()
            {
                List = sigs
            };
            var enterEngName = string.IsNullOrWhiteSpace(User.EngFullName)
                                ? H.Div("attention2")[
                H.p["Для отображения  сертификата международного образца необходимо  зайти в  раздел {0} и  заполнить  поле  «Полное имя на английском языке». После этого в разделе «Мои сертификаты» появится Ваш сертификат  международного образца.".FormatWith(Url.Profile().EditProfile("«Редактировать профиль»"))]]
                                : null;
            var view = InlineBaseView.New(model, x =>
                                          x.Model.List.Any()
                                        ? (object)H.div[enterEngName,
                                                        H.table[
                                                            H.Head(
                                                                "Дата окончания обучения",
                                                                "Название курса",
                                                                "Сертификат"
                                                                ),
                                                            x.Model.List.Select(c => H.Row(
                                                                                    c.Group.DateEnd.DefaultString(),
                                                                                    c.Group.Course.NameOfficial ?? c.Group.Course.Name,
                                                                                    x.Url.Graduate().GroupCert(c.StudentInGroup_ID, "Открыть")
                                                                                    ))].Class("table")]
                                        : H.b["Вы еще не закончили ни один курс"]);

            return(BaseViewWithModel(view, model));
        }
Example #4
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)));
        }
Example #5
0
        public ActionResult Guide(int id)
        {
            var guide = GuideService.GetByPK(id);

            if (guide == null)
            {
                return(null);
            }
            var mapBlock = H.l(
                H.map[AddTarget(guide.Areas)].Name("map").Id("guide-map"),
                H.JavaScript().Src("/Scripts/Views/Center/guide.js?v=2"));

            var model = new GuideVM {
                Guide = guide
            };
            var view = InlineBaseView.New(model, x =>
                                          H.div[
                                              Images.Guide(guide.Image).Id("guide-img").Usemap("#map"),
                                              guide.Areas.IsEmpty() ? null : mapBlock,
                                              Htmls.Mapster
                                          ]);

            return(BaseViewWithModel(view, model));
        }