/// <summary>
        /// Effectue le databinding de contrĂ´le
        /// </summary>
        /// <param name="o"></param>
        public virtual void BindTo(object o)
        {
            if (o == null)
            {
                return;
            }
            if (o is ArticlesDataSourceResult)
            {
                ArticlesDataSourceResult res = o as ArticlesDataSourceResult;
                VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0];
                BindTo(r);
            }
            else if (o is VueArticlesWebDS.ecommerce_articles_webRow)
            {
                VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow;

                ArticleGuid      = r.art_guid;
                ArticleReference = r.art_ref;
                ArticleLibelle   = r.arw_libelle;
            }
        }
        public virtual void BindTo(object o)
        {
            if (o == null)
            {
                return;
            }
            if (o is ArticlesDataSourceResult)
            {
                ArticlesDataSourceResult res = o as ArticlesDataSourceResult;
                VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0];
                BindTo(r);
            }
            if (o is VueArticlesWebDS.ecommerce_articles_webRow)
            {
                VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow;
                string url = ECommerceServer.Contexte.GetProductPage(r.arw_sit_pk, r.art_guid, r.art_pk,
                                                                     r.art_ref,
                                                                     r.Isarw_url_persoNull() ? "" : r.arw_url_perso,
                                                                     (int)r.arw_seg_pk_principale);

                StringBuilder blr = new StringBuilder();
                blr.Append(Page.Request.Url.Scheme);
                blr.Append("://");
                blr.Append(Page.Request.Url.Host);
                blr.Append(VirtualPathUtility.ToAbsolute(url));
                url = blr.ToString();

                blr = new StringBuilder();
                blr.Append("mailto:");
                blr.Append("?subject=");
                blr.Append(Prepare(Subject, r, url));
                blr.Append("&");
                blr.Append("body=");
                blr.Append(Prepare(Content, r, url));

                this.NavigateUrl = blr.ToString();
            }
        }
Example #3
0
        private void Afficher(VueArticlesWebDS.ecommerce_articles_webRow r)
        {
            if (r.art_est_immateriel)
            {
                if (!string.IsNullOrEmpty(MessageImmateriel))
                {
                    this.Text = MessageImmateriel;
                }
                else
                {
                    this.Visible = false;
                }
                return;
            }

            PanierProvider prv = ECommerceServer.Panier;
            ExpeditionsBll bll = new ExpeditionsBll(ECommerceServer.RjsId);

            string cp = prv.AdresseLivraisonCodePostal;

            if (string.IsNullOrEmpty(cp))
            {
                if (!string.IsNullOrEmpty(ECommerceServer.CurrentSite.DefaultCP))
                {
                    cp = ECommerceServer.CurrentSite.DefaultCP;
                }
                else
                {
                    cp = "75000";
                }
            }
            string pay = prv.AdresseLivraisonCodePays;

            if (string.IsNullOrEmpty(pay))
            {
                if (!string.IsNullOrEmpty(ECommerceServer.CurrentSite.DefaultPaysPk))
                {
                    pay = ECommerceServer.CurrentSite.DefaultPaysPk;
                }
                else
                {
                    pay = "FRA";
                }
            }


            var modes = ECommerceServer.Livraisons.GetFraisPortPossibles(new ElementPanier[] { new ElementPanier()
                                                                                               {
                                                                                                   ArticleGuid = r.art_guid,
                                                                                                   TypeArticle = MetaTypeArticle.Produit,
                                                                                                   Quantite    = 1,
                                                                                                   PuHT        = 0,
                                                                                                   PuTTC       = 0
                                                                                               } }, cp, pay);

            Context.Trace.Write("FicheProduit", string.Format("Recherche modes livraison pour {0}-{1} : {2} mode(s)",
                                                              cp, pay, modes == null ? 0 : modes.Length));


            if (modes == null || modes.Length == 0)
            {
                if (!string.IsNullOrEmpty(MessageNonLivrable))
                {
                    this.Text = MessageNonLivrable;
                }
                else
                {
                    this.Visible = false;
                }
                return;
            }

            ModeLivraisonElementPanier chosen = null;


            if (Preference == TypePreference.DateMin)
            {
                DateTime minDate = DateTime.MaxValue;

                foreach (var mode in modes)
                {
                    if (!mode.EstActif)
                    {
                        continue;
                    }
                    if (Libelles != null && Libelles.Count >= 0)
                    {
                        bool not = false;
                        foreach (ProductLivraisonLibelle c in Libelles)
                        {
                            if (c.Disabled && c.ModeGuid == mode.ModeLivraisonGuid)
                            {
                                not = true;
                            }
                        }
                        if (not)
                        {
                            continue;
                        }
                    }

                    if (mode.DateLivraisonPrevue <= minDate)
                    {
                        chosen  = mode;
                        minDate = mode.DateLivraisonPrevue;
                    }
                }
            }
            else if (Preference == TypePreference.PrixMin)
            {
                decimal minval = decimal.MaxValue;

                foreach (var mode in modes)
                {
                    if (!mode.EstActif)
                    {
                        continue;
                    }
                    if (Libelles != null && Libelles.Count >= 0)
                    {
                        bool not = false;
                        foreach (ProductLivraisonLibelle c in Libelles)
                        {
                            if (c.Disabled && c.ModeGuid == mode.ModeLivraisonGuid)
                            {
                                not = true;
                            }
                        }
                        if (not)
                        {
                            continue;
                        }
                    }

                    if (mode.PuTTC <= minval)
                    {
                        chosen = mode;
                        minval = mode.PuTTC;
                    }
                }
            }


            if (chosen == null)
            {
                if (!string.IsNullOrEmpty(MessageNonLivrable))
                {
                    this.Text = MessageNonLivrable;
                }
                else
                {
                    this.Visible = false;
                }
                return;
            }
            else
            {
                this.Text = string.Format(Format, GetLibelle(chosen), chosen.DateLivraisonPrevue, chosen.MontantTTC, GetDelai(DateTime.Today, chosen.DateLivraisonPrevue));
            }
        }
        public void BindTo(object o)
        {
            if (o == null)
            {
                return;
            }
            int sit_pk = ECommerceServer.SiteId;

            ServerConfigSection config = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite);


            if (o is ArticlesDataSourceResult)
            {
                ArticlesDataSourceResult res = o as ArticlesDataSourceResult;
                VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0];
                BindTo(r);
            }
            else if (o is PromotionsLotsRepeater.ProduitLotRepeaterItemData)
            {
                PromotionsLotsRepeater.ProduitLotRepeaterItemData res = o as PromotionsLotsRepeater.ProduitLotRepeaterItemData;
                VueArticlesWebDS.ecommerce_articles_webRow        r   = res.ArticleLot;
                BindTo(r);
            }
            else if (o is VueArticlesWebDS.ecommerce_articles_webRow)
            {
                VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow;
                if (string.IsNullOrEmpty(ImageUrl))
                {
                    if (config.ECommerce.DocumentBase.ProductImages.UseDocumentBase)
                    {
                        string code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny;
                        switch (_typeImage)
                        {
                        case TypeProduitImage.Petite:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForSmall;
                            break;

                        case TypeProduitImage.Intermediaire:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForIntermediate;
                            break;

                        case TypeProduitImage.Tiny:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny;
                            break;

                        case TypeProduitImage.Thumb:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForThumb;
                            break;

                        case TypeProduitImage.Detail:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForDetails;
                            break;

                        case TypeProduitImage.Aucune:
                            this.ImageUrl = ECommerceServer.ResolveResourceUrl(this.ImageUrl);
                            break;
                        }

                        //if (string.IsNullOrEmpty(this.ImageUrl))
                        //{
                        //    this.ImageUrl = _GetResourceUrl(DocBaseHelper.(config.ECommerce.DocumentBase.ProductImages.MainDocumentType,
                        //                            r.art_guid,
                        //                            code));
                        //}
                    }
                    else
                    {
                        switch (_typeImage)
                        {
                        case TypeProduitImage.Petite:
                            this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_smallNull() ? null : r.arw_url_img_small);
                            break;

                        case TypeProduitImage.Intermediaire:
                            this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_intermediateNull() ? (r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette) : r.arw_url_img_intermediate);
                            break;

                        case TypeProduitImage.Tiny:
                            this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_tinyNull() ? null : r.arw_url_img_tiny);
                            break;

                        case TypeProduitImage.Thumb:
                            this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette);
                            break;

                        case TypeProduitImage.Detail:
                            this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big);
                            break;

                        case TypeProduitImage.Aucune:
                            this.ImageUrl = ECommerceServer.ResolveResourceUrl(this.ImageUrl);
                            break;
                        }
                    }
                }

                if (string.IsNullOrEmpty(this.ImageUrl))
                {
                    this.ImageUrl = ECommerceServer.ResolveResourceUrl(ImageUrlIfNone);
                }

                this.ToolTip       = r.arw_libelle;
                this.AlternateText = r.arw_libelle;
            }
        }
        public void BindTo(object o)
        {
            if (o == null)
            {
                return;
            }
            int sit_pk = ECommerceServer.SiteId;

            ServerConfigSection config = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite);


            if (o is ArticlesDataSourceResult)
            {
                ArticlesDataSourceResult res = o as ArticlesDataSourceResult;
                VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0];
                BindTo(r);
            }
            else if (o is PromotionsLotsRepeater.ProduitLotRepeaterItemData)
            {
                PromotionsLotsRepeater.ProduitLotRepeaterItemData res = o as PromotionsLotsRepeater.ProduitLotRepeaterItemData;
                VueArticlesWebDS.ecommerce_articles_webRow        r   = res.ArticleLot;
                BindTo(r);
            }
            else if (o is VueArticlesWebDS.ecommerce_articles_webRow)
            {
                VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow;
                if (string.IsNullOrEmpty(ImageUrl) && !RenderAsText)
                {
                    if (config.ECommerce.DocumentBase.ProductImages.UseDocumentBase)
                    {
                        string code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny;
                        switch (_typeImage)
                        {
                        case TypeProduitImage.Petite:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForSmall;
                            break;

                        case TypeProduitImage.Intermediaire:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForIntermediate;
                            break;

                        case TypeProduitImage.Tiny:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny;
                            break;

                        case TypeProduitImage.Thumb:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForThumb;
                            break;

                        case TypeProduitImage.Detail:
                            code = config.ECommerce.DocumentBase.ProductImages.CodeForDetails;
                            break;

                        case TypeProduitImage.Aucune:
                            this.ImageUrl = _GetResourceUrl(this.ImageUrl);
                            break;
                        }

                        //if (string.IsNullOrEmpty(this.ImageUrl))
                        //{
                        //    this.ImageUrl = _GetResourceUrl(DocBaseHelper.(config.ECommerce.DocumentBase.ProductImages.MainDocumentType,
                        //                            r.art_guid,
                        //                            code));
                        //}
                    }
                    else
                    {
                        switch (_typeImage)
                        {
                        case TypeProduitImage.Petite:
                            this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_smallNull() ? null : r.arw_url_img_small);
                            break;

                        case TypeProduitImage.Intermediaire:
                            this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_intermediateNull() ? (r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette) : r.arw_url_img_intermediate);
                            break;

                        case TypeProduitImage.Tiny:
                            this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_tinyNull() ? null : r.arw_url_img_tiny);
                            break;

                        case TypeProduitImage.Thumb:
                            this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette);
                            break;

                        case TypeProduitImage.Detail:
                            this.ImageUrl = _GetResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big);
                            break;

                        case TypeProduitImage.Aucune:
                            this.ImageUrl = _GetResourceUrl(this.ImageUrl);
                            break;
                        }
                    }
                }

                if (string.IsNullOrEmpty(this.ImageUrl))
                {
                    this.ImageUrl = _GetResourceUrl(ImageUrlIfNone);
                }

                switch (LinkType)
                {
                case TypeLienProduit.Detail:
                    string url = ECommerceServer.Contexte.GetProductPage(r.arw_sit_pk, r.art_guid, r.art_pk,
                                                                         r.art_ref,
                                                                         r.Isarw_url_persoNull() ? null : r.arw_url_perso,
                                                                         (int)r.arw_seg_pk_principale);
                    if (PourPageAmp)
                    {
                        url = System.IO.Path.ChangeExtension(url, ".amp");
                    }
                    this.NavigateUrl = url;
                    break;

                case TypeLienProduit.Image:
                    this.NavigateUrl = _GetResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big);
                    if (this.NavigateUrl.Equals(this.ImageUrl, StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (CacherSiAucunZoom)
                        {
                            this.Visible = false;
                        }
                    }
                    if (!IsZoomable())
                    {
                        break;
                    }
                    this.ToolTip = r.arw_libelle;
                    break;
                }

                this.ToolTip = r.arw_libelle;
                this.Text    = r.arw_libelle;
            }
        }
Example #6
0
        void IEquihiraBindable.BindTo(object o)
        {
            if (o == null)
            {
                return;
            }
            int sit_pk = ECommerceServer.SiteId;

            ServerConfigSection config = EConfigurationManager.GetConfig(ECommerceServer.CurrentSite);


            if (o is ArticlesDataSourceResult)
            {
                ArticlesDataSourceResult res = o as ArticlesDataSourceResult;
                VueArticlesWebDS.ecommerce_articles_webRow r = res.Article.ecommerce_articles_web[0];
                (this as IEquihiraBindable).BindTo(r);
            }
            else if (o is VueArticlesWebDS.ecommerce_articles_webRow)
            {
                VueArticlesWebDS.ecommerce_articles_webRow r = o as VueArticlesWebDS.ecommerce_articles_webRow;

                if (config.ECommerce.DocumentBase.ProductImages.UseDocumentBase)
                {
                    string code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny;
                    switch (_typeImage)
                    {
                    case TypeProduitImage.Petite:
                        code = config.ECommerce.DocumentBase.ProductImages.CodeForSmall;
                        break;

                    case TypeProduitImage.Intermediaire:
                        code = config.ECommerce.DocumentBase.ProductImages.CodeForIntermediate;
                        break;

                    case TypeProduitImage.Tiny:
                        code = config.ECommerce.DocumentBase.ProductImages.CodeForTiny;
                        break;

                    case TypeProduitImage.Thumb:
                        code = config.ECommerce.DocumentBase.ProductImages.CodeForThumb;
                        break;

                    case TypeProduitImage.Detail:
                        code = config.ECommerce.DocumentBase.ProductImages.CodeForDetails;
                        break;
                    }
                }
                else
                {
                    switch (_typeImage)
                    {
                    case TypeProduitImage.Petite:
                        this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_smallNull() ? null : r.arw_url_img_small);
                        break;

                    case TypeProduitImage.Intermediaire:
                        this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_intermediateNull() ? (r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette) : r.arw_url_img_intermediate);
                        break;

                    case TypeProduitImage.Tiny:
                        this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_tinyNull() ? null : r.arw_url_img_tiny);
                        break;

                    case TypeProduitImage.Thumb:
                        this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_imagetteNull() ? null : r.arw_url_img_imagette);
                        break;

                    case TypeProduitImage.Detail:
                        this.ImageUrl = ECommerceServer.ResolveResourceUrl(r.Isarw_url_img_bigNull() ? null : r.arw_url_img_big);
                        break;

                    case TypeProduitImage.Aucune:
                        this.ImageUrl = ECommerceServer.ResolveResourceUrl(this.ImageUrl);
                        break;
                    }
                }

                string url = ECommerceServer.Contexte.GetProductPage(r.arw_sit_pk, r.art_guid, r.art_pk,
                                                                     r.art_ref,
                                                                     r.Isarw_url_persoNull()?null:r.arw_url_perso,
                                                                     (int)r.arw_seg_pk_principale);
                url        = System.IO.Path.ChangeExtension(url, ".amp");
                ProductUrl = Page.ResolveUrl(url);

                if (string.IsNullOrEmpty(this.ImageUrl))
                {
                    this.ImageUrl = ECommerceServer.ResolveResourceUrl(ImageUrlIfNone);
                }

                this.ToolTip = r.arw_libelle;
            }
        }