private void ClearBannerText(Sitelink sitelink) { if (sitelink == null) { return; } // banner.Title = YandexDirectTextUtils.RemoveDateAndDiscount(banner.Title); // banner.Text = YandexDirectTextUtils.RemoveDateAndDiscount(banner.Text); sitelink.Title = YandexDirectTextUtils.RemoveDateAndDiscount(sitelink.Title); }
private void UpdateText(Sitelink link, DateTime?date, short?discount, int textLimit) { ClearBannerText(link); string autoText; if (discount.HasValue) { autoText = YandexDirectTextUtils.GetDiscountText(discount.Value, textLimit - link.Title.Length); link.Title += autoText; return; } if (date.HasValue) { autoText = YandexDirectTextUtils.GetDateText(date.Value, textLimit - link.Title.Length); link.Title += autoText; } }