public 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]; MarquesDS.catalog_marquesRow r2 = null; if (!r.Isart_mar_pkNull()) { r2 = ECommerceServer.DataCache.Marques.catalog_marques.FindBymar_pk(r.art_mar_pk); } if (r2 != null) { this.Text = r2.mar_libelle; if (r2.Table.Columns.Contains("mar_url_redirection") && !r2.IsNull("mar_url_redirection")) { this.NavigateUrl = ResolveUrl(r2["mar_url_redirection"] as string); } else { this.NavigateUrl = ECommerceServer.Contexte.GetSearchPagePath(-1, Guid.Empty, r2.mar_pk, null, null, true); } } else { this.Text = ""; } } if (o is VueArticlesWebDS.ecommerce_articles_webRow) { VueArticlesWebDS.ecommerce_articles_webRow r = (o as VueArticlesWebDS.ecommerce_articles_webRow); this.Text = ""; if (!r.Isart_mar_pkNull()) { MarquesDS.catalog_marquesRow r2 = ECommerceServer.DataCache.Marques.catalog_marques.FindBymar_pk(r.art_mar_pk); if (r2 != null) { this.Text = r2.mar_libelle; this.NavigateUrl = ECommerceServer.Contexte.GetSearchPagePath(-1, Guid.Empty, r2.mar_pk, null, null, true); } } else { this.Text = ""; } } }
/// <summary> /// Effectue le databinding vers l'objet de données /// </summary> public virtual void BindTo(object o) { if (o == null) { return; } if (o is MarquesDS.catalog_marquesRow) { MarquesDS.catalog_marquesRow r = o as MarquesDS.catalog_marquesRow; if (!string.IsNullOrEmpty(TextFormat)) { this.Text = string.Format(TextFormat, r.mar_libelle); } else { this.Text = r.mar_libelle; } switch (TypeLien) { case TypeMarqueLink.PagePersoOuMoteur: try { if (r.Table.Columns.Contains("mar_url_redirection") && !r.IsNull("mar_url_redirection")) { this.NavigateUrl = ResolveUrl(r["mar_url_redirection"] as string); } } catch { goto case TypeMarqueLink.MoteurDeRecherche; } break; case TypeMarqueLink.MoteurDeRecherche: this.NavigateUrl = ECommerceServer.Contexte.GetSearchPagePath(-1, Guid.Empty, r.mar_pk, null, null, true); break; case TypeMarqueLink.SiteWeb: break; } } else if (o is RechercheMarque) { RechercheMarque r = o as RechercheMarque; if (!string.IsNullOrEmpty(TextFormat)) { this.Text = string.Format(TextFormat, r.Label); } else { this.Text = r.Label; } this.NavigateUrl = ECommerceServer.Contexte.GetSearchPagePath(-1, Guid.Empty, r.Id, null, null, true); } else if (o is ArticlesDataSourceResult) { ArticlesDataSourceResult res = o as ArticlesDataSourceResult; if (res.Marque != null && res.Marque.catalog_marques.Count == 1) { MarquesDS.catalog_marquesRow r = res.Marque.catalog_marques[0]; if (!string.IsNullOrEmpty(TextFormat)) { this.Text = string.Format(TextFormat, r.mar_libelle); } else { this.Text = r.mar_libelle; } this.NavigateUrl = ECommerceServer.Contexte.GetSearchPagePath(-1, Guid.Empty, r.mar_pk, null, null, true); } else { this.Visible = false; } } if (o is VueArticlesWebDS.ecommerce_articles_webRow) { ContexteProvider prv = ECommerceServer.Contexte; } }