Пример #1
0
        public static string CourseLinkByGroup(this HtmlHelper helper, Group gr)
        {
            var name = gr.Title;

            return(gr.Course.IsActive ?
                   CourseLinkAnchor(helper, gr.Course.UrlName, name).ToString()
                                : name);
        }
Пример #2
0
        private static string UpdateStatus(User user, Group g, string template)
        {
            var dateText  = GetDateText(g);
            var courseUrl = GetCourseUrl(g);
            var message   = TemplateEngine.GetText(template,
                                                   new {
                CourseName = StringUtils.AngleBrackets(g.Course.WebName),
                Date       = dateText,
                CourseUrl  = courseUrl
            });

            PostStatusUpdate(user, message);
            return(message);
        }
Пример #3
0
        private static void CreateEvent(Group g, User user, string message)
        {
            var month = DateTime.Today.AddDays(30);

            if (g.DateBeg == month && g.TimeBeg.HasValue)
            {
                var eventName = g.Course.GetShortName();
                if (eventName.Length > 75)
                {
                    eventName = "Группа " + (g.MegaGroup_ID ?? g.Group_ID);
                }
                PostCreateEvent(user, g.DateBeg.Value
                                .Add(g.TimeBeg.Value.TimeOfDay), eventName, message);
            }
        }
Пример #4
0
        public static string Discount(Group g, bool withDash = false)
        {
            if (g == null || g.Discount == null)
            {
                return(string.Empty);
            }
            var result        = string.Empty;
            var discountClass = "discount_color";

            if (CommonConst.IsMobile)
            {
                discountClass = "discount";
            }
            var span = H.span.Class(discountClass)[g.Discount + "%"];

            result = span.ToString();
            if (!g.IsOpenLearning && g.DateBeg.HasValue &&
                g.DateBeg.Value.AddDays(-6) <= DateTime.Today)
            {
                var before = g.DateBeg.Value.AddDays(-4).Date;
                if (before < DateTime.Today)
                {
                    before = DateTime.Today;
                }

                var sufix = before == DateTime.Today ? " на " : " до ";

                var dateText = "скидка" + sufix + before.DefaultString();
                result += (withDash ? " " : "<br/>") + dateText;
                if (CommonConst.IsMobile)
                {
                    span.Add(" " + dateText);
                }
            }
            else if (CommonConst.IsMobile)
            {
                span.Add(" скидка");
            }
            if (CommonConst.IsMobile)
            {
                return(span.ToString());
            }

            return((withDash ? "Ч " : "") + result);
        }
Пример #5
0
 public static string GroupLink(this HtmlHelper helper,
                                Group group)
 {
     return(helper.GroupLink(group.Group_ID, "Страница группы"));
 }
Пример #6
0
 private static string GetDateText(Group g)
 {
     return(g.DateBeg.Value.Day + " " +
            MonthUtil.GetName(g.DateBeg.Value.Month, true));
 }
Пример #7
0
 private static string GetCourseUrl(Group g)
 {
     return(Links.CourseLinkAnchor(null, g.Course).AbsoluteHref().Attribute("href").Value);
 }