Beispiel #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)]
                   ]);
        }
Beispiel #2
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
                     ));
        }