Exemplo n.º 1
0
 public static void CopyStyle(Style style)
 {
     var styleCard = new StyleCard();
     styleCard.GetData(style);
     styleCard._style = null;
     styleCard.ShowDialog();
 }
Exemplo n.º 2
0
        public static Style GetDefault()
        {
            var style = new Style();

            style.Title = StyleTag.TitleClear.InBrakets();
            style.Header = StyleTag.TitleClear.InBrakets();
            style.Content = StyleTag.Description.InBrakets();
            style.Footer = string.Empty;

            return style;
        }
Exemplo n.º 3
0
        private void GetData(Style style)
        {
            _style = style;

            txtName.Text = _style.Name;
            txtTitle.Text = _style.Title;
            txtHeader.Text = _style.Header;
            txtContent.Text = _style.Content;
            txtFooter.Text = _style.Footer;

            txtDefaultMrkCategory.SelectedItem = _style.DefMarketCategoryObj;
        }
Exemplo n.º 4
0
 private void SetStyle(Style style)
 {
     _style = style;
     if (_style != null)
     {
         txtStyle.Text = _style.Name;
     }
 }
Exemplo n.º 5
0
        private AppleResult Apply(Style style, StyleType styleType)
        {
            if (style == null) return _lastAppleRes;

            if (_lastAppleRes == null) _lastAppleRes = new AppleResult();

            AppleResult appleResultSpec = new AppleResult();

            appleResultSpec.Type = styleType;
            appleResultSpec.Title = Apply(style.Title, _lastAppleRes.Title);
            appleResultSpec.Header = Apply(style.Header, _lastAppleRes.Header);
            appleResultSpec.Content = Apply(style.Content, _lastAppleRes.Content);
            appleResultSpec.Footer = Apply(style.Footer, _lastAppleRes.Footer);

            SaveToDict(appleResultSpec);

            _lastAppleRes = appleResultSpec;

            return appleResultSpec;
        }
Exemplo n.º 6
0
        private void AddToDict(Product product, BegemotProduct bproduct, Style specialStyle, Sale activeSale)
        {
            valueDict.Add(StyleTag.Title, bproduct.GetClearTitle());
            valueDict.Add(StyleTag.TitleShort, bproduct.GetTitleShort());
            valueDict.Add(StyleTag.TitleClear, bproduct.GetClearTitle());
            valueDict.Add(StyleTag.TitleClearShort, bproduct.GetClearShortTitle());
            valueDict.Add(StyleTag.Description, bproduct.GetClearDescrption());
            valueDict.Add(StyleTag.Price, product.Price.ToString("f2"));
            valueDict.Add(StyleTag.PriceOld, product.PriceOld.ToString("f2"));

            var codeProduct = product.GetCode();
            valueDict.Add(StyleTag.CodeProduct, codeProduct);

            if (specialStyle != null)
            {
                var codeStyle = specialStyle.GetCode(true);
                //codeStyle = HttpUtility.UrlEncode(codeStyle);
                valueDict.Add(StyleTag.CodeStyle, codeStyle);
            }

            if (activeSale != null)
            {
                var codeSale = activeSale.GetCode(true);
                // codeSale = HttpUtility.UrlEncode(codeSale);
                valueDict.Add(StyleTag.CodeSale, codeSale);
            }

            var salesLinks = SalesLinks();
            valueDict.Add(StyleTag.Sales, salesLinks);

            var menuLinks = MenuLinks();
            valueDict.Add(StyleTag.Menu, menuLinks);
        }
Exemplo n.º 7
0
        public void ApplyStyles(Product product, BegemotProduct bproduct, Style specialStyle, Style saleStyle, Style marketStyle, Marketplace market, Adv24au adv)
        {
            //bool isNoStyles = specialStyle == null && saleStyle == null && marketStyle == null;

            var activeSale = product.GetActiveSale();

            Style defultStyle = Style.GetDefault();

            valueDict = new Dictionary<string, string>();
            AddToDict(product, bproduct, specialStyle, activeSale);

            AppleResult ar = null;
            ar = Apply(defultStyle, StyleType.SpecialDescrition);
            ar = Apply(specialStyle, StyleType.SpecialDescrition);
            ar = Apply(saleStyle, StyleType.Sale);
            ar = Apply(marketStyle, StyleType.MarketPlace);

            ar.ClearTags();
            //ar.ClearPolicyWords(market);

            var title = ar.GetResultTitle();
            var description = ar.GetResultDescription();

            if (adv == null)
            {
                product.Title = title;
                product.Description = description;
            }
            else
            {
                title = market.PrepareTitle(title);
                description = market.PrepareDescription(description);

                adv.Title = title;
                adv.Description = description;
            }
        }
Exemplo n.º 8
0
        private void Choose()
        {
            var row = (DataSourceRow)gridView1.GetFocusedRow();
            if (row == null)
            {
                return;
            }

            _style = row.GetStyle();

            DialogResult = DialogResult.OK;
        }
Exemplo n.º 9
0
 public DataSourceRow(Style style)
 {
     _style = style;
 }
Exemplo n.º 10
0
 public void SetActiveStyle(Style style)
 {
     if (Styles.Any(s => s.Id == style.Id)) return;
     Styles.Clear();
     if (style == null) return;
     Styles.Add(style);
 }
Exemplo n.º 11
0
        public static string GetCode(Style style, bool tagMode=false)
        {
            if (style == null) return string.Empty;

            string code = string.Format("s{0}", Encode(style.Id));

            if (tagMode)
            {
                code = string.Format("{0} {1}", prefix, code);
                code = HttpUtility.UrlEncode(code);
            }

            return code;
        }
Exemplo n.º 12
0
        private void Save()
        {
            if (_style == null)
            {
                _style = new Style();
                Context.Inst.StyleSet.Add(_style);

                _style.Active = true;
                _style.StyleType = _styleType;
            }

            SetData(_style);

            Context.Save();
        }
Exemplo n.º 13
0
 public static void UpdateStyle(Style style)
 {
     var styleCard = new StyleCard();
     styleCard.GetData(style);
     styleCard.ShowDialog();
 }
Exemplo n.º 14
0
        private void SetData(Style style)
        {
            style.Name = txtName.Text.Trim();
            style.Title = txtTitle.Text.Trim();
            style.Header = txtHeader.Text.Trim();
            style.Content = txtContent.Text.Trim();
            style.Footer = txtFooter.Text.Trim();

            _style.DefMarketCategoryObj = (MarketCategory)txtDefaultMrkCategory.SelectedItem;

            style.DateUpdate = DateTime.Now;
        }