コード例 #1
0
        /// <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);

            ModeLivraisonElementPanier elm = ECommerceServer.Panier.FraisPort;

            if (elm == null)
            {
                return;
            }

            this.Text = elm.Libelle;
        }
コード例 #2
0
        private string GetLibelle(ModeLivraisonElementPanier chosen)
        {
            if (Libelles == null)
            {
                return(chosen.Libelle);
            }

            foreach (ProductLivraisonLibelle c in Libelles)
            {
                if (c.ModeGuid == chosen.ModeLivraisonGuid)
                {
                    return(c.Libelle);
                }
            }

            return(chosen.Libelle);
        }
コード例 #3
0
        /// <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);

            ModeLivraisonElementPanier elm = ECommerceServer.Panier.FraisPort;

            if (elm == null)
            {
                DateTime?dtMEF = PanierProvider.Extensions.GetDateLivraison();
                if (dtMEF.HasValue)
                {
                    this.Text = dtMEF.Value.ToString(Format);
                }
                return;
            }

            this.Text = elm.DateLivraisonPrevue.ToString(Format);
        }
コード例 #4
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));
            }
        }