示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder html         = new StringBuilder();
        DevisService  devisService = new DevisService();
        Devis         devis        = (Devis)Session["currentDevis"];

        foreach (var produit in devis.Produits)
        {
            html.Append("<div class='row'>");
            html.Append("<div class='col-md-10'>");
            html.Append("<h4>Produit : " + produit.Nom + "</h4>");
            html.Append("<div class='row'><div class='col-md-10'><div class='col-md-offset-2'>");
            html.Append("<h4>Gamme : " + produit.Gamme.Nom + "</4>");
            html.Append("<div class='row'><div class='col-md-1O col-md-offset-2'>");
            html.Append("<h4>Modele de Gamme : " + produit.ModeleDeGamme.Nom + "</h4></div></div>");
            html.Append("<div class='row'><div class='col-md-10 col-md-offset-2'>");
            html.Append("<h4>Finitions : </h4>");
            foreach (var finition in produit.ModeleDeGamme.Finitions)
            {
                html.Append("<div class='row'><div class='col-md-12'>");
                html.Append(finition.TypeFinition.Nom + " : " + finition.Nom);
                html.Append("</div></div>");
            }
            html.Append("</div></div>");
            html.Append("<div class='row'><div class='col-md-10 col-md-offset-2'>");
            html.Append("<h4>Modules : </h4>");
            foreach (var module in produit.ModeleDeGamme.Modules)
            {
                html.Append("<div class='row'><div class='col-md-12'>");
                html.Append(module.Module.TypeModule.Nom + " : " + module.Module.Nom + "<br>");
                html.Append("Hauteur : " + module.Hauteur + "<br/>");
                html.Append("Longueur : " + module.Longueur + "<br/>");
                html.Append("Prix : " + devisService.GetPriceOfModule(module.Module) + " Euros<br/>");
                html.Append("Identification : " + module.Identification + "<br/><br/>");
            }
            html.Append("</div></div>");
            html.Append("</div></div>");
            html.Append("</div></div>");
            html.Append("</div></div>");
        }

        //TARIF

        double  total     = (double)devisService.CalculateEstimatedPrice(devis);
        decimal?prixFinal = devis.EstimationPrix;
        decimal?remise    = ((decimal)total) - prixFinal;

        html.Append("<div class='col-md-2'>");
        html.Append("<h3>Total : " + total + " Euros</h3>");
        if (remise > 0)
        {
            html.Append("<h3> - " + remise + " Euros de remise</h3>");
            html.Append("<h3>Total avec remise: " + prixFinal + " Euros</h3>");
        }

        html.Append("</div>");
        PlaceHolder1.Controls.Add(new Literal {
            Text = html.ToString()
        });
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (null != Session["currentDevis"])
        {
            recordedDevis     = (Devis)Session["currentDevis"];
            LblNomProjet.Text = recordedDevis.NomProjet;
            LblNomClient.Text = recordedDevis.Client.Name;
            if (recordedDevis.EstimationPrix == null)
            {
                recordedDevis.EstimationPrix = 0;
            }

            if (TxtRemise.Text != "")
            {
                remise = 1 - (decimal.Parse(TxtRemise.Text) / 100);
            }

            recordedDevis.EstimationPrix = serviceDevis.CalculateEstimatedPrice(recordedDevis);
            recordedDevis.EstimationPrix = recordedDevis.EstimationPrix * remise;

            LblPrix.Text = recordedDevis.EstimationPrix.ToString();
        }
        refreshProductPanel();
    }