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)); }
public TagDiv BestTestUser(List <User> users) { if (!users.Any()) { return(null); } return(div[h3["Лучшие за " + MonthUtil.GetName(MonthUtil.GetPrevious())], Ul(users.Select(x => Html.Encode(x.FullName)))]); }
public override object Get() { var webcal = "webcal://" + CommonConst.PureRoot + Url.Rss().Urls.TimeSheetCalendar(User.Employee_TC); var view = div[ GetScript("/Scripts/Views/Lms/timesheetview.js", "TimesheetView.init", Url.Lms().Urls.TimeSheet(null)), h2[MonthUtil.GetName(Model.DateBegin.Month) + " " + Model.DateBegin.Year, Buttons() ], GetLecturesView(), LmsViews.SupportInfo, Anchor(webcal, "Экспортировать расписание")]; return(view); }
public static List <SelectListItem> GetAllMoreThen(int monthIndex) { var result = new List <SelectListItem>(); result.Add(new SelectListItem { Text = "Нет", Selected = true }); for (var i = monthIndex; i <= 12; i++) { var monthName = MonthUtil.GetName(i); result.Add(new SelectListItem { Text = monthName, Value = i.ToString() }); } return(result); }
private static string GetDateText(Group g) { return(g.DateBeg.Value.Day + " " + MonthUtil.GetName(g.DateBeg.Value.Month, true)); }
public Tuple <bool, StudentInGroup> CreateOrExists(decimal sigId) { if (CheckTemplateFile(sigId)) { return(Tuple.Create(false, (StudentInGroup)null)); } var fileSys = UserImages.GetGroupCertFileSys(sigId); StudentInGroup sig = null; if (!System.IO.File.Exists(fileSys)) { sig = GetFullSig(sigId); if (sig == null) { return(Tuple.Create(false, sig)); } if (BerthTypes.AllForCert.Contains(sig.BerthType_TC) && sig.Group.IsFinished) { var cert = CertificateService.GetAll(x => x.StudentInGroup_ID == sigId) .OrderByDescending(x => x.ForPrint).ThenByDescending(x => x.Certificate_ID) .FirstOrDefault(); if (cert == null) { return(Tuple.Create(false, sig)); } Func <DateTime, string> format = x => "{0} {1} {2} г.".FormatWith(x.Day, MonthUtil.GetName(x.Month, true), x.Year); var orgName = OurOrgs.Names.GetValueOrDefault(cert.OurOrg_TC) ?? OurOrgs.RuName; var certTemplate = GetCertTemplate(cert); if (certTemplate < 0) { return(Tuple.Create(false, sig)); } using (var image = Image.FromFile(UserImages.GetGroupCertFileSys(certTemplate))) { if (cert.CertType_TC == CertTypes.OldCert) { var date = "c {0} по {1}".FormatWith(format(cert.DateBeg.GetValueOrDefault()), format(cert.DateEnd.GetValueOrDefault())); ImageUtils.DrawGroupCertText(image, sig.Student.FullName, cert.CourseFullName, cert.Hours, date, cert.FullNumber, sig.Student.Sex, orgName).Save(fileSys); } else { var date = format(cert.DateEnd.GetValueOrDefault()); ImageUtils.DrawGroupCertText2016(image, sig.Student.FullName, cert.CourseFullName, cert.Hours, date, cert.FullNumber, sig.Student.Sex, orgName, cert.CertType_TC == CertTypes.Y16).Save(fileSys); } } } else { return(Tuple.Create(false, sig)); } } return(Tuple.Create(true, sig)); }