Example #1
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());
        }
Example #2
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)
                       ]
                   ]);
        }
Example #3
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
                     ));
        }