Esempio n. 1
0
        public TagTable FullTimePrice(CourseBaseVM model)
        {
            var hasWebinar              = model.HasWebinar;
            var hasIntraExtra           = model.HasIntraExtra;
            var grayStyle               = "color:gray;font-size:12px;";
            Func <int, string> discount = x => "<br/>{0} {1}"
                                          .FormatWith(span["Экономия до"].Style(grayStyle), span[x + "%"].Class("discount_color"));

            Func <short?, string> discountHead = disc => (model.Course.IsTrackBool || !disc.HasValue ? "" :
                                                          discount(disc.Value));
            var morningHead = th["с 10:00 до 17:00" +
                                 discountHead(model.MorningDiscount)].Id("morning-head");
            var eveningHead = th["Вечер или Выходные" + br +
                                 span["Стандартная цена"].Style(grayStyle)];
            var webinarHead = th[SimpleLinks.Webinar("Вебинар") +
                                 discountHead(model.WebinarFinalDiscount)].Id("webinar-head");
            var unlimitHead    = th[SimpleLinks.Unlimited()];
            var intraExtraHead = th["Очно-заочно"];

            return(table.Class("table")[
                       TableHead(" ",
                                 morningHead,
                                 eveningHead,
                                 hasIntraExtra ? intraExtraHead : null,
                                 hasWebinar ? webinarHead : null,
                                 model.UnlimitPrice.HasValue ? unlimitHead : null,
                                 "Записаться"),
                       tbody[
                           GetPriceRows(model, hasWebinar, hasIntraExtra, model.MorningDiscount)]
                   ]);
        }
Esempio n. 2
0
        private static string GetWebinarPriceBlock(CourseBaseVM model)
        {
            var price = model.GetPrice(PriceTypes.Webinar);

            if (model.WebinarFinalDiscount > 0)
            {
                var postfix = model.WebinarDiscount > 0
                                        ? "<br/>скидка {0}% {1}".FormatWith(model.WebinarFinalDiscount,
                                                                            DateTime.Today <= new DateTime(2015, 12, 31) ? "до 31 декабря" : "")
                                        : "";
                return(Htmls2.DiscountPrice(model.WebinarFinalDiscount, price) + postfix);
            }
            return(price.MoneyString());
        }
Esempio n. 3
0
        public TagTable DistancePrice(CourseBaseVM Model)
        {
            var heads = Model.DistanceTypes.Select(x =>
                                                   PriceTypes.GetFullName(x.PriceType_TC)).ToList()
                        .AddFluent("Записаться").Cast <object>().ToArray();

            var values = Model.DistanceTypes.Select(x =>
                                                    td[Model.GetPrice(x.PriceType_TC).MoneyString()]).ToList()
                         .AddFluent(
                td.Class("last_td")[Html.AddToCart(Model.Course, priceTypeTC:
                                                   Model.DistanceTypes.FirstOrDefault()
                                                   .GetOrDefault(y => y.PriceType_TC))]).Cast <object>().ToArray();

            return(table.Class("table")[
                       TableHead(heads),
                       tbody[
                           TableRow(values)
                       ]
                   ]);
        }
Esempio n. 4
0
 public object AddCourseButton(CourseBaseVM model)
 {
     return(model.HasPPPrice ? Html.AddToCart(x => x.AddCourse(model.Course.Course_TC, null), true) : null);
 }
Esempio n. 5
0
        private TagList GetPriceRows(CourseBaseVM model,
                                     bool hasWebinar, bool hasIntraExtra, short?monDiscount)
        {
            var unlimitPrice       = model.UnlimitPrice;
            var price              = model.GetPrice(PriceTypes.PrivatePersonWeekend);
            var orgPrice           = model.GetPrice(PriceTypes.Corporate);
            var intraExtraPrice    = model.GetPrice(PriceTypes.IntraExtra);
            var intraExtraOrgPrice = model.GetPrice(PriceTypes.IntraExtraOrg);
            var orgTitle           = "Организации";

            if (CourseTC.MsVoucher.Contains(model.Course.Course_TC))
            {
                orgTitle += br.ToString() + span["(Данный курс можно", br, "оплатить ваучерами ", br,
                                                 Anchor("/news/2297", "Software Assurance"), ")"]
                            .Style("font-size:10px;color:black;font-weight:normal;");
            }
            var ppTitle = "Частные лица";

            if (CourseTC.CiscoPrepay.Contains(model.Course.Course_TC))
            {
                ppTitle += br.ToString() + span["По предоплате"]
                           .Style("font-size:10px;color:grey;");
            }

            var webinarPrice = model.GetPrice(PriceTypes.Webinar);
            Func <decimal?, string> getFirstPayment = x => x.HasValue
                                ? (OrderDetail.FloorToFifty(x.Value * CommonConst.FirstPaymentPercent)).MoneyString()
                            : null;
            var firstPayment = model.Course.IsTrackBool ?
                               TableRow(td.Class("td_entrant")[Anchor(SimplePages.FullUrls.FirstPaymentNews,
                                                                      "Первый взнос (для частных лиц)").Style("color:red;")],
                                        td[getFirstPayment(price)],
                                        td[getFirstPayment(price)],
                                        hasIntraExtra ? td[getFirstPayment(intraExtraPrice)] : null,
                                        hasWebinar ? td[getFirstPayment(webinarPrice)] : null,
                                        unlimitPrice.HasValue ? td : null,
                                        td.Class("last_td")).Style("color:red;") : null;

            return
                (l(
                     TableRow(td.Class("td_entrant")[ppTitle],
                              td[Htmls2.DiscountPrice(monDiscount, price)],
                              td[price.MoneyString()],
                              hasIntraExtra ? td[intraExtraPrice.MoneyString()] : null,
                              hasWebinar ? td[GetWebinarPriceBlock(model)] : null,
                              unlimitPrice.HasValue ? td[
                                  SimpleLinks.Unlimited(unlimitPrice > 0 ? unlimitPrice.MoneyString() : "Бесплатно")] : null,
                              td.Class("last_td")[
                                  Html.AddToCart(model.Course, priceTypeTC: PriceTypes.PrivatePersonWeekend)]),
                     TableRow(td.Class("td_entrant")[orgTitle],
                              td[orgPrice.MoneyString()],
                              td[orgPrice.MoneyString()],
                              hasIntraExtra ? td[intraExtraOrgPrice.MoneyString()] : null,
                              hasWebinar ? td[model.GetPrice(PriceTypes.WebinarOrg).MoneyString()] : null,

                              unlimitPrice.HasValue ? td[""] : null,
                              td.Class("last_td")[
                                  Html.AddToCart(model.Course, priceTypeTC: PriceTypes.Corporate)]),
                     firstPayment
                     ));
        }
Esempio n. 6
0
 private static string GetTitle(CourseBaseVM model)
 {
     return(model.HtmlTitle);
 }