Beispiel #1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            PanierProvider prv = ECommerceServer.Panier;

            if (!string.IsNullOrEmpty(LabelIfEmpty) && (string.IsNullOrEmpty(prv.AdresseLivraisonCodePays) || string.IsNullOrEmpty(prv.AdresseLivraisonCodePostal) || (prv.AdresseLivraisonCodePays.Equals(ECommerceServer.CurrentSite.DefaultPaysPk) && prv.AdresseLivraisonCodePostal.Equals(ECommerceServer.CurrentSite.DefaultCP))))
            {
                this.Text = LabelIfEmpty;
            }
            else
            {
                string fmt = Convert(Format);
                string pay = prv.AdresseLivraisonCodePays;
                PaysDS.params_paysRow r = ECommerceServer.DataCache.Pays.params_pays.FindBypay_pk(pay);
                if (r != null)
                {
                    this.Text = string.Format(fmt, prv.AdresseLivraisonCodePostal, r.pay_libelle);
                }
                else
                {
                    throw new BusinessException("Le pays " + pay + " est inconnu !")
                          {
                              ErrorCode = ErrorCodes.AdresseDonneeInvalide
                          }
                };
            }
        }
        /// <summary>
        /// Déclenche l'événement <see cref="E:System.Web.UI.Control.Load" />.
        /// </summary>
        /// <param name="e">Objet <see cref="T:System.EventArgs" /> qui contient les données d'événement.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            PanierProvider prv = ECommerceServer.Panier;

            if (AfficherSiPointRelais.HasValue)
            {
                if (prv.FraisPort != null)
                {
                    if (prv.FraisPort.PointsLivraison != AfficherSiPointRelais.Value)
                    {
                        this.Visible = false;
                    }
                }
            }

            if (TypeAffichage == TypeAffichageAdresses.UniquementSiDifferentes)
            {
                if (prv.AdresseFacturationGuid.Equals(prv.AdresseLivraisonGuid))
                {
                    this.Visible = false;
                }
            }
            else if (TypeAffichage == TypeAffichageAdresses.UniquementSiIdentiques)
            {
                if (!prv.AdresseFacturationGuid.Equals(prv.AdresseLivraisonGuid))
                {
                    this.Visible = false;
                }
            }
        }
        /// <summary>
        /// Déclenche l'événement <see cref="E:System.Web.UI.Control.PreRender" />.
        /// </summary>
        /// <param name="e">Objet <see cref="T:System.EventArgs" /> qui contient les données d'événement.</param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            PanierProvider prv = ECommerceServer.Panier;

            this.Text = string.Format(Format, prv.MontantNonPayeSaufPrincipal);
        }
        public override void DataBind()
        {
            base.DataBind();

            PanierProvider prv = ECommerceServer.Panier;

            if (prv == null || prv.FraisPort == null)
            {
                this.Text = "";
            }
            else
            {
                this.Text = prv.FraisPort.Libelle;
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            PanierProvider prv = ECommerceServer.Panier;

            if (prv == null || prv.FraisPort == null)
            {
                this.Text = "";
            }
            else
            {
                this.Text = prv.FraisPort.Libelle;
            }
        }
Beispiel #6
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            PanierProvider     prv = ECommerceServer.Panier;
            IncitationAvantage inc = prv.GetIncitation();

            if (inc == null)
            {
                this.Text = "";
            }
            else
            {
                this.Text = inc.Message;
            }
        }
        public override void DataBind()
        {
            base.DataBind();

            PanierProvider prv = ECommerceServer.Panier;

            if (prv == null || prv.FraisPort == null)
            {
                this.Text = "";
            }
            else if (!string.IsNullOrEmpty(Format))
            {
                this.Text = prv.MontantFraisPort.ToString(Format);
            }
            else
            {
                this.Text = prv.MontantFraisPort.ToString();
            }
        }
        /// <summary>
        /// Déclenche l'événement <see cref="E:System.Web.UI.Control.PreRender" />.
        /// </summary>
        /// <param name="e">Objet <see cref="T:System.EventArgs" /> qui contient les données d'événement.</param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            PanierProvider prv = ECommerceServer.Panier;

            if (!InclureElementsMagasin)
            {
                this.Text = string.Format(Format, prv.Montant);
            }
            else
            {
                decimal mnt = 0;
                foreach (var pn in prv.TousLesElements)
                {
                    mnt += (pn.PuTTC * pn.Quantite);
                }
                this.Text = string.Format(Format, mnt);
            }
        }
Beispiel #9
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            PanierProvider     prv = ECommerceServer.Panier;
            IncitationAvantage inc = prv.GetIncitation();

            if (inc == null)
            {
                return;
            }
            VueArticlesWebDS.ecommerce_articles_webRow r;
            r = ECommerceServer.DataCache.GetArticle(inc.ArticleResultatGuid);
            if (r == null)
            {
                this.Text = "";
            }
            else
            {
                this.Text = r.arw_libelle;
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            PanierProvider prv = ECommerceServer.Panier;

            if (prv == null || prv.FraisPort == null)
            {
                this.Text = "";
            }
            else if (prv.FraisPort.MontantTTC == 0 && !string.IsNullOrEmpty(MessageSiOffert))
            {
                this.Text = MessageSiOffert;
            }
            else if (!string.IsNullOrEmpty(Format))
            {
                this.Text = prv.FraisPort.MontantTTC.ToString(Format);
            }
            else
            {
                this.Text = prv.FraisPort.MontantTTC.ToString();
            }
        }
Beispiel #11
0
        /// <summary>
        /// Effectue le traitement spécifique de déconnexion
        /// de l'utilisateur
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoggedOut(EventArgs e)
        {
            PanierProvider prv = ECommerceServer.Panier;

            prv.DefinirClient(Guid.Empty);
            if (ECommerceServer.User.EstImpersonnalise)
            {
                try
                {
                    ECommerceServer.User.PanierSauvegarde = "";
                }
                catch
                {
                }
            }

            ECommerceServer.User.ClientGuid        = Guid.Empty;
            ECommerceServer.User.EstImpersonnalise = false;
            FormsAuthentication.SignOut();
            ECommerceServer.User.ClearLogin();
            Page.Session.Abandon();
            base.OnLoggedOut(e);
        }
        /// <summary>
        /// Déclenche l'événement <see cref="E:System.Web.UI.Control.PreRender" />.
        /// </summary>
        /// <param name="e">Objet <see cref="T:System.EventArgs" /> qui contient les données d'événement.</param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            PanierProvider prv = ECommerceServer.Panier;

            // Si il y a un code avantage associé au panier
            // on l'affiche avec formattage
            if (!string.IsNullOrEmpty(prv.CodeAvantage))
            {
                this.Text = string.Format(TextIfActive, prv.CodeAvantage);
            }
            // Sinon, on affiche le message par défaut si
            // il est renseigné
            else if (!string.IsNullOrEmpty(TextIfInactive))
            {
                this.Text = TextIfInactive;
            }
            // ou on retire le contrôle de la page HTML
            else
            {
                this.Visible = false;
            }
        }
Beispiel #13
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            PanierProvider     prv = ECommerceServer.Panier;
            IncitationAvantage inc = prv.GetIncitation();

            if (inc == null)
            {
                return;
            }

            VueArticlesWebDS.ecommerce_articles_webRow r;
            r = ECommerceServer.DataCache.GetArticle(inc.ArticleResultatGuid);
            if (r == null)
            {
                return;
            }
            if (!r.Isarw_url_img_imagetteNull())
            {
                string url = r.arw_url_img_imagette;
                ImageUrl = url;
            }
        }
Beispiel #14
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));
            }
        }
Beispiel #15
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            PanierProvider     prv = ECommerceServer.Panier;
            IncitationAvantage inc = prv.GetIncitation();

            if (inc == null)
            {
                return;
            }
            VueArticlesWebDS.ecommerce_articles_webRow r;
            r = ECommerceServer.DataCache.GetArticle(inc.ArticleResultatGuid);
            if (r == null)
            {
                this.Text = "";
            }
            else
            {
                switch (Field)
                {
                case ProduitField.Reference:
                    this.Text = r.Isart_refNull()?"":r.art_ref;
                    break;

                case ProduitField.Libelle:
                    this.Text = r.arw_libelle;
                    break;

                case ProduitField.PrixUnitaireHt:
                    if (r.arw_pu_ht == 0)
                    {
                        if (!string.IsNullOrEmpty(CssClassSiPromo))
                        {
                            this.CssClass = CssClassSiPromo;
                        }
                        if (!string.IsNullOrEmpty(TextePrixZero))
                        {
                            this.Text = TextePrixZero;
                            break;
                        }
                    }
                    this.Text = string.IsNullOrEmpty(Format) ? r.arw_pu_ht.ToString("###,##0.00") : r.arw_pu_ht.ToString(Format);
                    break;

                case ProduitField.PrixUnitaireTtc:
                    if (r.arw_pu_ttc == 0)
                    {
                        if (!string.IsNullOrEmpty(CssClassSiPromo))
                        {
                            this.CssClass = CssClassSiPromo;
                        }
                        if (!string.IsNullOrEmpty(TextePrixZero))
                        {
                            this.Text = TextePrixZero;
                            break;
                        }
                    }
                    this.Text = string.IsNullOrEmpty(Format) ? r.arw_pu_ttc.ToString("###,##0.00") : r.arw_pu_ttc.ToString(Format);
                    break;

                case ProduitField.Quantite:
                    this.Text = string.IsNullOrEmpty(Format) ? inc.QteArticle.ToString("###,##0") : inc.QteArticle.ToString(Format);
                    break;

                case ProduitField.MontantHt:
                    if (r.arw_pu_ht == 0)
                    {
                        if (!string.IsNullOrEmpty(CssClassSiPromo))
                        {
                            this.CssClass = CssClassSiPromo;
                        }
                        if (!string.IsNullOrEmpty(TextePrixZero))
                        {
                            this.Text = TextePrixZero;
                            break;
                        }
                    }

                    this.Text = string.IsNullOrEmpty(Format) ? (inc.QteArticle * r.arw_pu_ht).ToString("###,##0.00") : (inc.QteArticle * r.arw_pu_ht).ToString(Format);
                    break;

                case ProduitField.MontantTtc:
                    if (r.arw_pu_ttc == 0)
                    {
                        if (!string.IsNullOrEmpty(CssClassSiPromo))
                        {
                            this.CssClass = CssClassSiPromo;
                        }
                        if (!string.IsNullOrEmpty(TextePrixZero))
                        {
                            this.Text = TextePrixZero;
                            break;
                        }
                    }
                    this.Text = string.IsNullOrEmpty(Format) ? (inc.QteArticle * r.arw_pu_ttc).ToString("###,##0.00") : (inc.QteArticle * r.arw_pu_ttc).ToString(Format);
                    break;
                }
            }
        }