protected void ButtonSupprimer_Click(object sender, EventArgs e) { String reference = Request.Params["ref"].ToString(); Membre member = (Membre)Session["membre"]; String mail = member.ID_CLIENT; BienDAO.removeBienSelection(reference, mail); Response.Redirect("./monCompteAnnonces.aspx"); }
protected void update_counter(int nbJour) { DateTime today = DateTime.Now; string now = today.Month + "/" + today.Day + "/" + today.Year; Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); b.VISITEFICHED = (int)c.exeRequette("SELECT Count(*) AS TotalVisite FROM (SELECT ID FROM log_visite_page_bien WHERE ref='" + reference + "' AND ficheDetaillee = true AND Time > #" + now + "# - " + nbJour + ")").Tables[0].Rows[0]["TotalVisite"]; b.NBRESULTRECHERCHE = (int)c.exeRequette("SELECT Count(*) AS TotalVisite FROM (SELECT ID FROM log_visite_page_bien WHERE ref='" + reference + "' AND ficheDetaillee = false AND Time > #" + now + "# - " + nbJour + ")").Tables[0].Rows[0]["TotalVisite"]; c.Close(); if (Request.Params["ref"] != null && Request.Params["ref"].CompareTo("") != 0 && (member == null || member.STATUT != "ultranego" || b.NEGOCIATEUR != member.PRENOM + " " + member.NOM) ) { BienDAO.increaseCounterFicheDetail(reference); } }
protected void Page_Load(object sender, EventArgs e) { //AlerteMailDAO.addAlerteMailBien("aa","aaaaaa"); if ((Membre)Session["Membre"] != null) { member = (Membre)Session["Membre"]; } if ((Request.QueryString["ref"] != null) && (Request.QueryString["ref"] != "")) { reference = Request.QueryString["ref"]; Session["ref"] = Request.Params["ref"]; ficheDetail_Panel.Visible = true; } else { Response.Redirect("recherche.aspx"); } String page = "-1"; if (Request.Params["page"] != null) { page = Request.Params["page"].ToString(); } b = BienDAO.getBien(reference); int nbJour = 30; //les X derniers jours pris en compte pour le compteur de visite update_counter(nbJour); //récupération de la racine du site web pour la vérificaton de la présence des images : c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); System.Data.DataSet ds = c.exeRequette("Select * from Environnement"); c.Close(); String racine_site = (String)ds.Tables[0].Rows[0]["Chemin_racine_site"]; String path = b.REFERENCE.ToString(); string relativePath = "../images/"; string absolutePath = "~/images/"; String JpgA = relativePath + path + "A.JPG"; String JpgB = relativePath + path + "B.JPG"; String JpgC = relativePath + path + "C.JPG"; String JpgD = relativePath + path + "D.JPG"; String JpgE = relativePath + path + "E.JPG"; String JpgF = relativePath + path + "F.JPG"; String JpgG = relativePath + path + "G.JPG"; String JpgH = relativePath + path + "H.JPG"; if (b.REFERENCE.ToString().Length > 0) { if (b.REFERENCE.ToString().Substring(0, 1) == "V") { Session["Transaction"] = "achat"; } else { Session["Transaction"] = "location"; } } else { Session["Transaction"] = ""; } tabpartage.Text = Request.Url.ToString(); //Navigation entre les annonces if (Session["tabref"] != null) { if (!((Request.Params["orig"] != null) && (Request.Params["orig"].ToString() == "nego"))) { ArrayList al = Session["tabref"] as ArrayList; int indexOfRef = al.IndexOf(reference); LBLNav.Text = ""; if (indexOfRef > 0) { LBLNav.Text += "<a href=\"fichedetail1.aspx?ref=" + al[indexOfRef - 1] + "&page=" + page + "#bas\"> << </a>"; } LBLNav.Text += "Annonce " + (indexOfRef + 1) + " sur " + al.Count.ToString(); if (indexOfRef < al.Count - 1) { LBLNav.Text += "<a href=\"fichedetail1.aspx?ref=" + al[indexOfRef + 1] + "&page=" + page + "#bas\"> >></a>"; } LBLNav2.Text = LBLNav.Text; } } //TITRE LBLTitre.Text = ""; if (b.CATEGORIE != "") { LBLTitre.Text += b.CATEGORIE + " "; } else { switch (b.TYPE_BIEN) { case "A": LBLTitre.Text += "Appartement "; break; case "M": LBLTitre.Text += "Maison "; break; case "L": LBLTitre.Text += "Local "; break; case "T": LBLTitre.Text += "Terrain "; break; case "I": LBLTitre.Text += "Immeuble "; break; default: LBLTitre.Text += "Bien "; break; } } LBLTitre.Text += " à " + b.VILLE_BIEN + " (" + b.CODE_POSTAL_BIEN + ")"; LBLTitre.Text = LBLTitre.Text.ToUpper(); //On recupere le loyer et la surface carrez en (très) bourrin #I<3AncienStagiaires //String requette2 = "SELECT * FROM Biens WHERE (((Biens.ref)='" + b.REFERENCE.ToString() + "'));"; String requette2 = "SELECT * FROM Biens, optionsBiens WHERE Biens.ref=optionsBiens.refOptions AND (((Biens.ref)='" + b.REFERENCE.ToString() + "'));"; System.Data.DataSet ds1 = null; Connexion c1 = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c1.Open(); ds1 = c1.exeRequette(requette2); c1.Close(); System.Data.DataRowCollection dr1 = ds1.Tables[0].Rows; //PANNEAU ADMIN string refer = b.REFERENCE; if (member != null && (member.STATUT == "ultranego" || (member.STATUT == "nego" && b.NEGOCIATEUR == member.PRENOM + " " + member.NOM))) { Admin_Panel.Visible = true; if (refer.Contains("L")) { LBLModifBien.Text = "<a href=\"./modifier_nego_loc.aspx?reference=" + refer + "\"style='color:Gray'><img src='../img_site/flat_round/modifier.png' style='padding-left:15px' border='0' width='17px' > <strong>Modifier le bien</strong></a><br /><br />"; } if (refer.Contains("V")) { LBLModifBien.Text = "<a href=\"./modifier_nego.aspx?reference=" + refer + "\"style='color:Gray'><img src='../img_site/flat_round/modifier.png' style='padding-left:15px' border='0' width='17px' ><strong> Modifier le bien</strong></a><br /><br />"; } LBL_Envois.Text = ""; LBL_Envois.Text += get_Envois_sites(dr1); lbl_dates.Text = Get_dates(); } //INFOS IMPORTANTES //Prix if (refer.Contains("V")) { LBLPrix.Text = "<strong>" + espaceNombre(b.PRIX_VENTE.ToString()) + " €</strong>"; } if (refer.Contains("L")) { String Loyer = dr1[0]["loyer_cc"].ToString(); LBLPrix.Text = "<strong>" + espaceNombre(Loyer) + "€</strong>"; } LBLSurface.Text = "<strong>" + espaceNombre(b.S_HABITABLE.ToString()) + " m² </strong>"; if (b.TYPE_BIEN == "T") { LBLSurface.Text = "<strong>" + espaceNombre(b.S_TERRAIN.ToString()) + "</strong> m² "; } else if (b.S_HABITABLE == 0) { String S_CARREZ = dr1[0]["surface carrez"].ToString(); LBLSurface.Text = "<strong>" + espaceNombre(S_CARREZ) + "</strong> m² "; } //Zone surface/Pieces LBLPieces.Text = ""; if (b.NBRE_PIECE != 0) { LBLPieces.Text += "<td style='width:50%;border-bottom: 1px solid lightgrey ; border-left: 1px solid lightgrey;'>" + "<center><div style='font-size: 25px;text-align:left;margin-left:15px'><strong>" + b.NBRE_PIECE + "</strong> pièce(s) </div> " + "</center></td>"; } else { LBLPieces.Text += "<td style='width:30%;border-bottom: 1px solid lightgrey ;'></td>"; } //Prix par metre carre LBLPrixMetre.Text = ""; if (refer.Contains("V") && b.TYPE_BIEN != "T") { LBLPrixMetre.Text += "<tr><td style='border-bottom: 1px solid lightgrey ;' colspan='2'><div style='font-size: 25px;text-align:center;margin-left:15px'><strong>"; if (b.PRIX_VENTE < b.S_HABITABLE) { LBLPrixMetre.Text += "<br/>< 1 €/m²<br/>"; } else { if (b.S_HABITABLE != 0) { LBLPrixMetre.Text += (b.PRIX_VENTE / b.S_HABITABLE).ToString() + " €/m²"; } else if (b.S_CARREZ != 0) { LBLPrixMetre.Text += (b.PRIX_VENTE / b.S_CARREZ).ToString() + " €/m²"; } } LBLPrixMetre.Text += "</td></tr>"; } //Icones String texte_internet = b.TEXTE_INTERNET.ToLower(); LBLIcone.Text = ""; LBLIcone.Text += "<tr><td colspan='2'><center>"; List <String> icones = setIcones(texte_internet, dr1[0]["Mer"].ToString(), dr1[0]["Montagne"].ToString()); int k = 0; //On ne veux pas trop d'icones sur une même ligne (sinon pb avec le zoom) foreach (String s in icones) { LBLIcone.Text += "<div class='new_span' style='display:inline-block'><div class='zoom_simple' style='display:inline-block'><img height=32px src='../img_site/flat_round/" + s + ".png' alt='" + s + "'/></div>" + "<span style='margin-left:-60px;margin-top:45px;'>" + get_icon_text(s) + "</span> </div>"; k++; if (k % 7 == 0) { LBLIcone.Text += "<br/>"; } } if (icones.Count == 0) { LBLIcone.Text = ""; } LBLIcone.Text += "</center></td></tr>"; //PANNEAU LOCALISATION string localisation = b.VILLE_BIEN; adresse.Value = localisation; //PANNEAU NEGO LBLNego.Text = ""; if (b.NEGOCIATEUR != "") { BtnSiteNego.Visible = true; //Si l'annonce a été envoyée par un nego, on récupère dans la table Clients les coordonnées de ce nego. String PrenomNomNego = b.NEGOCIATEUR; String requette = "SELECT id_client, tel_client, adresse_client, ville_client FROM Clients WHERE `idclient`=" + b.IDCLIENT; Connexion c2 = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c2.Open(); System.Data.DataSet ds2 = c2.exeRequette(requette); c2.Close(); c2 = null; System.Data.DataRowCollection dr2 = ds2.Tables[0].Rows; LBLNego.Text += CheckPhotoProfil(b.IDCLIENT) + "<br/>"; foreach (System.Data.DataRow ligne in dr2) { mail_nego = ligne["id_client"].ToString(); LBLNego.Text += "<strong>" + PrenomNomNego + "</strong><br/>" + "Tel: " + ligne["tel_client"].ToString() + "<br/>"; if (mail_nego.Length > 24) { LBLNego.Text += "<a href='mailto:" + mail_nego + "' > " + mail_nego.Substring(0, 20) + "... </a><br/><br/>"; } else { LBLNego.Text += "<a href='mailto:" + mail_nego + "' > " + mail_nego + "</a><br/><br/>"; } } } else if (b.NOM_AGENCE != "") { LBLNego.Text += "<STRONG>Reférence : </STRONG>" + b.REFERENCE + " - tel: " + b.TEL_AGENCE + "<br />" + "<STRONG>Contact : </STRONG>" + b.NOM_AGENCE + " - " + b.ADRESSE_AGENCE + " - " + b.CODE_POSTALE_AGENCE + " " + b.VILLE_AGENCE; } //MENU BOUTONS LBLMenuBoutons.Text = "<br/><a href=\"./contact3.aspx?ref_bien=" + refer + "&appelcontact='menu'\"style='color:Gray'><img src='../img_site/flat_round/phone.png' style='margin-bottom:-10px;margin-left:5px;margin-right:5px' width='24px'><strong> Contacter l'agence </strong></a><br /><br />"; //LBLMenuBoutons.Text += "<a href='#' style='color:Gray'><img src='../img_site/flat_round/alerte.png' style='margin-bottom:-10px;margin-left:5px;margin-right:5px' width='24px'><strong> Alerte sur ce bien </strong></a><br /><br />"; LBLMenuBoutons.Text += "<a href=\"javascript:popUp('sendToFriend.aspx?ref=" + refer + "')\"style='color:Gray'><img src='../img_site/flat_round/courrier.png' style='margin-bottom:-10px;margin-left:5px;margin-right:5px;margin-top:5px' width='24px'><strong> Envoyer à un ami </strong></a><br /><br />"; LBLMenuBoutons.Text += "<a href=\"./ajoutSelection.aspx?ref=" + refer + "\"style='color:Gray'><img src='../img_site/flat_round/ajouter.png' style='margin-bottom:-10px;margin-left:5px;margin-right:5px;margin-top:5px' width='24px'><strong> Ajouter à ma selection</strong></a><br /><br />"; LBLMenuBoutons.Text += "<span id='bouton_texte' style='color:Gray; cursor:pointer ' onclick=\"javascript:afficher_cacher('texte');\" onmouseover=><img src='../img_site/flat_round/partager.png' style='margin-bottom:-10px;margin-left:5px;margin-right:5px;margin-top:5px' width='24px'><strong> Partager lien</strong></span>"; //PHOTOS LBLPhotos.Text = ""; string sourceJpgExcl = "../img_site/bandeau_exclusivite.png"; string sourceJpgSemExcl = "../img_site/bandeau_semiExclusif.png"; string sourceJpgNouveaute = "../img_site/bandeau_nouveaute.png"; int nbJourNv = -15; DateTime today = DateTime.Now; DateTime todayMoinsJourNv = today.AddDays(nbJourNv); switch (b.TYPE_MANDAT) { case "Exclusif": LBLPhotos.Text += "<img id=\"bandeau2\" alt=\"photo\" src= \"" + sourceJpgExcl + "\" width=\"240\" height=\"240\" />"; break; case "SemiExclusif": LBLPhotos.Text += "<img id=\"bandeau2\" alt=\"photo\" src= \"" + sourceJpgSemExcl + "\" />"; break; default: if (b.DATE_MODIFICATION >= todayMoinsJourNv) { LBLPhotos.Text += "<img id=\"bandeau2\" alt=\"photo\" src= \"" + sourceJpgNouveaute + "\" width=\"240\" height=\"240\" />"; } break; } if (!testFile(absolutePath + JpgA)) { JpgA = "../img_site/images_par_defaut/" + b.TYPE_BIEN + ".jpg"; } JpgA = relativePath + JpgA; LBLPhotos.Text += "<img id='grosseImage' style='vertical-align:top' src=" + JpgA + " />"; LBLPhotos.Text += "<br/><br/>"; LBLPhotos.Text += "<span id='videoAnnonce' style='margin-left:100px;'>" + b.URLVIDEO + "</span>"; LBLPhotos.Text += "<div class='fichePhotoDroite'><table><tr>"; if (testFile(absolutePath + JpgA)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgA + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:-5px' /></td>"; } if (testFile(absolutePath + JpgB)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgB + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:15px' /></td>"; } if (testFile(absolutePath + JpgC)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgC + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:15px' /></td>"; } if (testFile(absolutePath + JpgD)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgD + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:15px' /></td>"; } LBLPhotos.Text += "</tr><tr>"; if (testFile(absolutePath + JpgE)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgE + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:-5px' /></td>"; } if (testFile(absolutePath + JpgF)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgF + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:15px' /></td>"; } if (testFile(absolutePath + JpgG)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgG + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:15px' /></td>"; } if (testFile(absolutePath + JpgH)) { LBLPhotos.Text += "<td><img alt=\"Cliquez pour agrandir\" src=" + relativePath + JpgH + " onclick=\"metGrosseImage(this.src)\" style='width:100px;height:80px;margin-left:15px' /></td>"; } LBLPhotos.Text += "</tr></table></div><br/>"; //TEXTE INTERNET if (b.TEXTE_INTERNET == "") { Texte_Panel.Visible = false; } LBLTexteInternet.Text = "<strong>DESCRIPTION DU BIEN: </strong><br/><br/>"; LBLTexteInternet.Text += nl2br(b.TEXTE_INTERNET); LBLTexteInternet.Text += "<br/><br/>"; //INFOS COMPLEMENTAIRES LBLInfoCompl.Text = ""; string imgSource; if (b.COUP_DE_COEUR && b.PRESTIGE) { imgSource = "../img_site/band_CdC_Lux/Trigl_cdcPrestige.png"; LBLInfoCompl.Text += "<img id=\"imgcdcPrestige_fichedetail\" src=\"" + imgSource + "\" alt=\"Coup de coeur et Prestige\"/>"; } else if (b.COUP_DE_COEUR) { imgSource = "../img_site/band_CdC_Lux/Trigl_coupDeCoeur.png"; LBLInfoCompl.Text += "<img id=\"imgcdcPrestige_fichedetail\" src=\"" + imgSource + "\" alt=\"Coup de coeur\"/>"; } else if (b.PRESTIGE) { imgSource = "../img_site/band_CdC_Lux/Trigl_prestige.png"; LBLInfoCompl.Text += "<img id=\"imgcdcPrestige_fichedetail\" src=\"" + imgSource + "\" alt=\"Prestige\"/>"; } LBLInfoCompl.Text += "<table class='fdetail1' style='font-size: 10pt; color: black; width:92%'>" + "<tr class='fdetail2' style='vertical-align:top'><td>"; if (b.TYPE_BIEN == "M") { LBLInfoCompl.Text += "<strong>La maison</strong> <br />"; } if (b.TYPE_BIEN == "A") { LBLInfoCompl.Text += "<strong>L'appartement</strong> <br />"; } if (b.S_HABITABLE != 0) { LBLInfoCompl.Text += "Surface habitable : " + b.S_HABITABLE.ToString() + " m²<br />"; } if (b.S_TERRAIN != 0) { LBLInfoCompl.Text += "Surface terrain : " + b.S_TERRAIN + " m²<br />"; } if (b.S_SEJOUR != 0) { LBLInfoCompl.Text += "Surface séjour : " + b.S_SEJOUR + " m²<br />"; } if (b.A_CONSTRUCTION != "0" && b.A_CONSTRUCTION != "") { LBLInfoCompl.Text += "Année de construction : " + b.A_CONSTRUCTION + "<br />"; } if (b.ASCENSEUR == "OUI") { LBLInfoCompl.Text += "Ascenceur : oui <br />"; } LBLInfoCompl.Text += "</td><td><strong>Equipement</strong> <br />"; if (b.T_CUISINE != "") { LBLInfoCompl.Text += "Type de cuisine : " + b.T_CUISINE + "<br />"; } if (b.NBRE_SALLE_BAIN != "0" && b.NBRE_SALLE_BAIN != "") { LBLInfoCompl.Text += "SDB avec baignoire : " + b.NBRE_SALLE_BAIN + "<br /> "; } if (b.TYPE_CHAUFFAGE != "") { LBLInfoCompl.Text += "Type de chauffage : " + b.TYPE_CHAUFFAGE + "<br />"; } if (b.NATURE_CHAUFFAGE != "") { LBLInfoCompl.Text += "Nature du chaffage : " + b.NATURE_CHAUFFAGE + "<br />"; } if (b.BALCON == "OUI") { LBLInfoCompl.Text += "Balcon : oui <br />"; } if (b.TERRASSE == "OUI") { LBLInfoCompl.Text += "Terrasse : oui <br />"; } LBLInfoCompl.Text += "</td><td>"; if (b.ANCIEN_PRIX > b.PRIX_VENTE && b.ANCIEN_PRIX != 0) { LBLInfoCompl.Text += "<img class=\"gifPrixEnBaisse\" src=\"../img_site/prixEnBaisse.gif\" alt=\"PRIX EN BAISSE\"/><br/>"; } if (b.NEUF) { LBLInfoCompl.Text += "<img class=\"gifNeuf\" src=\"../img_site/Neuf.gif\" alt=\"PRIX EN BAISSE\"/><br/>"; } if (b.LOCALISATION != "") { LBLInfoCompl.Text += "<strong>Localisation</strong>"; } if (b.LOCALISATION != "") { LBLInfoCompl.Text += "Localisation du bien : " + b.LOCALISATION + "<br />" + "<br />"; } if (b.TAXE_FONCIERE != "0" || b.TAXE_HABITATION != "0" || b.CHARGES != "0") { LBLInfoCompl.Text += "<strong>Autre:</strong> <br />"; } if (b.TAXE_FONCIERE != "0") { LBLInfoCompl.Text += "Taxe foncière : " + b.TAXE_FONCIERE + " €<br />"; } if (b.TAXE_HABITATION != "0") { LBLInfoCompl.Text += "Taxe d'habitation : " + b.TAXE_HABITATION + " €<br />"; } if (b.CHARGES != "0") { LBLInfoCompl.Text += "Charges : " + b.CHARGES + "€ <br />"; } LBLInfoCompl.Text += "</td></tr></table>"; //CONSOMMATION LBLConso.Text = ""; if (b.LETTRE_CONSO == "" && b.LETTRE_ENERGIE == "") { Conso_Panel.Visible = false; } else { if (b.LETTRE_CONSO != "") { LBLConso.Text += "<td><center><img src=\"../img_dpe/high_quality/dpe/dpe_" + b.LETTRE_CONSO.ToLower() + ".gif\"/HEIGHT=299 WIDTH=298></center></td>"; } if (b.LETTRE_ENERGIE != "") { LBLConso.Text += "<td><center><img src=\"../img_dpe/high_quality/ges/ges_" + b.LETTRE_ENERGIE.ToLower() + ".gif\"/HEIGHT=299 WIDTH=298></center></td>"; } } }
protected void Page_Load(object sender, EventArgs e) { ((Label)Page.Master.FindControl("titrebandeau")).Text = "Statistiques<br/>Pages visitées"; string reference = Request.Params["ref"]; Membre member = (Membre)Session["Membre"]; b = BienDAO.getBien(reference); if (member != null && Request.QueryString["ref"] != null && (member.STATUT == "ultranego" || (member.STATUT == "nego" && b.NEGOCIATEUR == member.PRENOM + " " + member.NOM))) { string requete1 = "SELECT Year(Time) AS year, Month(Time) AS month, Count(*) AS nbvisite " + "FROM (SELECT ref,Time FROM log_visite_page_bien WHERE ref='" + reference + "' AND ficheDetaillee = true) " + "GROUP BY Year(Time), Month(Time) ORDER BY Year(Time),Month(Time);"; string requete2 = "SELECT Year(Time) AS year, Month(Time) AS month, Count(*) AS nbvisite " + "FROM (SELECT ref,Time FROM log_visite_page_bien WHERE ref='" + reference + "' AND ficheDetaillee = false) " + "GROUP BY Year(Time), Month(Time) ORDER BY Year(Time),Month(Time);"; Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); statsFiche = c.exeRequette(requete1).Tables[0].Rows; statsResult = c.exeRequette(requete2).Tables[0].Rows; c.Close(); listeMois = new ArrayList(); listeVisiteFiche = new ArrayList(); listeVisite = new ArrayList(); DateTime today = DateTime.Now; int y = 0; int j = 0; for (int i = 0; i < 12; i++) { string month = ((today.Month + i) % 12 + 1).ToString(); string year = (today.Month + i > 12)? today.Year.ToString() : (today.Year - 1).ToString(); listeMois.Add(((today.Month + i) % 12 + 1).ToString() + "/" + year); bool found1 = false; for (int k = j; k < statsResult.Count; k++) { if (month == statsResult[k]["month"].ToString() && year == statsResult[k]["year"].ToString()) { listeVisiteFiche.Add(statsResult[k]["nbvisite"].ToString()); j = k + 1; found1 = true; break; } } if (!found1) { listeVisiteFiche.Add("0"); } bool found2 = false; for (int x = y; x < statsFiche.Count; x++) { if (month == statsFiche[x]["month"].ToString() && year == statsFiche[x]["year"].ToString()) { listeVisite.Add(statsFiche[x]["nbvisite"].ToString()); y = x + 1; found2 = true; break; } } if (!found2) { listeVisite.Add("0"); } } } else { Response.Redirect("recherche.aspx"); Response.End(); } }
/// <summary> /// permet d'afficher un bien au format html a partir de sa reference /// /// Attention, on formate en utf8 pour la page html (grâce à "System.Web.HttpUtility.HtmlEncode"); /// /// </summary> /// <param name="reference"></param> /// <returns></returns> private String afficheBien(String reference) { String texteHtmlDeRetour = ""; Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); System.Data.DataSet ds = c.exeRequette("Select * from Environnement"); c.Close(); String racine_site = (String)ds.Tables[0].Rows[0]["Chemin_racine_site"]; String path = reference; string srcJpg = racine_site+"/images/" + path + "A.JPG"; string sourceJpg = "./" + path + "A.JPG"; if (System.IO.File.Exists(srcJpg) == false) sourceJpg = "./logo_320.jpg"; Bien b = BienDAO.getBien(reference); double prixFranc = b.PRIX_VENTE * 6.55957; String Francs = prixFranc.ToString(); String euro = b.PRIX_VENTE.ToString(); int indexF = Francs.IndexOf(','); int indexFin = Francs.Length; int indexFinEuro = euro.Length; if (indexF != -1) Francs = Francs.Remove(indexF, indexFin - indexF); indexFin = Francs.Length; do { indexFin = indexFin - 3; if (indexFin > 0) Francs = Francs.Insert(indexFin, " "); } while (indexFin > 0); do { indexFinEuro = indexFinEuro - 3; if (indexFinEuro > 0) euro = euro.Insert(indexFinEuro, " "); } while (indexFinEuro > 0); texteHtmlDeRetour += "<br />" + "<table border=\"0\" width=\"600\">" + "<tr><td width=\"128\"></td><td width=\"322\"></td><td width=\"150\"></td></tr>" //+"<div class=\"Resultat-header\">" + "<tr><td colspan=\"2\" width=\"450\" bgcolor=\"#31536c\"><b>" // + "<div class=\"Resultat-header-prix-euro\">" + "<a href=\"http://www.patrimo.fr/fichedetail.aspx?ref=" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + "\">" + "<font color=\"#FFFFFF\">" + System.Web.HttpUtility.HtmlEncode(b.CATEGORIE) + " - " + b.NBRE_PIECE + System.Web.HttpUtility.HtmlEncode(" pièces - ") + b.S_HABITABLE + System.Web.HttpUtility.HtmlEncode(" m²") + " - " + System.Web.HttpUtility.HtmlEncode(b.VILLE_BIEN) + "</b></font>" + "</a>" // + "</div>" + "</td><td colspan=\"1\" width=\"150\" bgcolor=\"#31536c\">" + "<div class=\"Resultat-header-left\" align=\"right\">" + "<a href=\"http://www.patrimo.fr/pages/fichedetail.aspx?ref=" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + "\">" + "<font color=\"#FFFFFF\"><b>" + System.Web.HttpUtility.HtmlEncode(euro) + System.Web.HttpUtility.HtmlEncode(" euros ") + "</b></font>" + "</a>" + "</div>" //+ "</div>" //+ "<div class=\"Resultat\">" + "</td></tr>" //+ "<table border=\"0\" width=\"600\">" + "<tr><td colspan=\"1\" width=\"128\">" // + "<div class=\"Resultat-photo\">" + "<a class=\"lienImage\" href=\"http://www.patrimo.fr/pages/fichedetail1.aspx?ref=" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + "\"> <img alt=\"photo\" src=\"http://www.patrimo.fr/images/" + sourceJpg + "\" style=\" border:none; float:left; width:128px; height:96px\" /></a>" // + "</div>" + "</td><td colspan=\"2\" width=\"472\">" // + "<div class=\"Resultat-text\">" + "<p align=\"justify\">"+System.Web.HttpUtility.HtmlEncode(b.TEXTE_INTERNET)+"</p>" + "<br />" + "<STRONG>" + System.Web.HttpUtility.HtmlEncode("Référence : ") + " </STRONG>" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + "<br />" + "<STRONG>Contact : </STRONG>" + System.Web.HttpUtility.HtmlEncode(b.NOM_AGENCE) + " - " + System.Web.HttpUtility.HtmlEncode(b.ADRESSE_AGENCE) + " " + System.Web.HttpUtility.HtmlEncode(b.CODE_POSTALE_AGENCE) + " " + System.Web.HttpUtility.HtmlEncode(b.VILLE_AGENCE) + "<br />Tél : " + System.Web.HttpUtility.HtmlEncode(b.TEL_AGENCE) // + "</div>" + "</td></tr></table>" //+ "</div>" + "<p> </p><hr />" ; return texteHtmlDeRetour; }
private String afficheBien(String reference) { String texteHtmlDeRetour = ""; Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); System.Data.DataSet ds = c.exeRequette("Select * from Environnement"); c.Close(); String racine_site = (String)ds.Tables[0].Rows[0]["Chemin_racine_site"]; String path = reference; string srcJpg = racine_site + "/images/" + path + "A.JPG"; string sourceJpg = "./" + path + "A.JPG"; if (System.IO.File.Exists(srcJpg) == false) { sourceJpg = "./logo_320.jpg"; } Bien b = BienDAO.getBien(reference); String euro = ""; String type = ""; if (b.LOYER == 0) { euro = b.PRIX_VENTE.ToString(); euro += " euros"; type = "4"; } else { euro = b.LOYER.ToString(); euro += " euros CC"; type = "5"; } int indexFinEuro = euro.Length; texteHtmlDeRetour += "<br />" + "<div class=\"Resultat-header-prix-euro\" style=\"float:right;font-size:12pt;font-family:Times New Roman;color:Black;background-color:White;margin-right:10px;font-weight: bold;\">" + "<a style=\"color:black;text-decoration:none\" href=http://www.patrimo.net/patrimo/pages/fichedetail1.aspx?page=" + type + "+&ref=" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + ">" + System.Web.HttpUtility.HtmlEncode(euro) + "</a>" + "</div>" + "<div class=\"Resultat-header-left\" style=\"font-weight: bold;font-size: 12pt;color: black;font-family: 'Times New Roman';text-decoration: none;margin-left:2px;\">" + "<a style=\"color:black;text-decoration:none\" href=http://www.patrimo.net/patrimo/pages/fichedetail1.aspx?page=" + type + "&ref=" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + ">" + System.Web.HttpUtility.HtmlEncode(b.CATEGORIE) + " - " + b.NBRE_PIECE + " pieces - " + b.S_HABITABLE + System.Web.HttpUtility.HtmlEncode(" m² - ") + b.CODE_POSTAL_BIEN + " - " + b.VILLE_BIEN + "</a>" + "</div>" + "</div>" + "<div class=\"Resultat\" style=\"background-color:White;border-bottom: black 1px solid;margin-bottom: 0px;\">" + "<div class=\"Resultat-photo\" style=\"float: left;height: 96px;border-top: #ffffff 2px solid;border-bottom: #ffffff 2px solid;margin-left:2px;margin-right:2px;\">" + "<a class=\"lienImage\" href=http://www.patrimo.net/patrimo/pages/fichedetail1.aspx?page=" + type + "&ref=" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + "> <img alt=\"photo\" src=http://www.patrimo.net/patrimo/images/" + sourceJpg + " style=\" border:none; float:left; width:128px; height:96px\" /></a>" + "</div>"; // Au niveau du contact de la fiche détail dans le mail envoyé, on va chercher soit les coordonnées de l'agence // Soit celles du négo if (b.REFERENCE.Substring(1, 3) == "999") // pour le négo, adresse siege mais tel et mail négo { String nom_siege = (String)ds.Tables[0].Rows[0]["nom_societe"]; String adresse_siege = (String)ds.Tables[0].Rows[0]["adresse_societe"]; String cp_siege = (String)ds.Tables[0].Rows[0]["cp_societe"]; String ville_siege = (String)ds.Tables[0].Rows[0]["ville_societe"]; String tel_siege = (String)ds.Tables[0].Rows[0]["tel_societe"]; Connexion c2 = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c2.Open(); System.Data.DataSet ds2 = c2.exeRequette("Select * from Clients WHERE `idclient`=" + b.IDCLIENT); c2.Close(); String tel_nego = (String)ds2.Tables[0].Rows[0]["tel_client"]; String email_nego = (String)ds2.Tables[0].Rows[0]["id_client"]; texteHtmlDeRetour += "<div class=\"Resultat-text\" style=\"background-color: White;color: Black;font-family: Times New Roman;font-size: 10pt;height: 110px;width: 500px;border-top: #ffffff 2px solid;border-bottom: #ffffff 2px solid;text-align: justify; \">" + System.Web.HttpUtility.HtmlEncode(b.TEXTE_INTERNET) + "<br />" + "<br />" + "<STRONG>" + System.Web.HttpUtility.HtmlEncode("Reférence : ") + " </STRONG>" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + " - tel: " + System.Web.HttpUtility.HtmlEncode(tel_nego) + "<br />" + "<STRONG>Contact : </STRONG>" + System.Web.HttpUtility.HtmlEncode(nom_siege) + " - " + System.Web.HttpUtility.HtmlEncode(adresse_siege) + " - " + System.Web.HttpUtility.HtmlEncode(cp_siege) + " " + System.Web.HttpUtility.HtmlEncode(ville_siege) + "<br />" + "<STRONG> email : </STRONG>" + System.Web.HttpUtility.HtmlEncode(email_nego) + "</div>" + "</div>" ; } else // Pour l'agence { if (b.NEGOCIATEUR != "") { //Si l'annonce a été envoyée par un nego, on récupère dans la table Clients les coordonnées de ce nego. string PrenomNomNego = b.NEGOCIATEUR; string[] WordArray; string[] stringSeparators = new string[] { " " }; WordArray = PrenomNomNego.Split(stringSeparators, StringSplitOptions.None); if (WordArray.Length > 1) { Response.Write("<tr><td>"); String NomNego = WordArray[1]; String PrenomNego = WordArray[0]; String requette = "select id_client, tel_client from Clients where `idclient`=" + b.IDCLIENT; System.Data.DataSet ds2 = null; Connexion c2 = null; c2 = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c2.Open(); ds2 = c2.exeRequette(requette); c2.Close(); c2 = null; System.Data.DataRowCollection dr2 = ds2.Tables[0].Rows; foreach (System.Data.DataRow ligne in dr2) { texteHtmlDeRetour += "<div class=\"Resultat-text\" style=\"background-color: White;color: Black;font-family: Times New Roman;font-size: 10pt;height: 110px;width: 500px;border-top: #ffffff 2px solid;border-bottom: #ffffff 2px solid;text-align: justify; \">" + System.Web.HttpUtility.HtmlEncode(b.TEXTE_INTERNET) + "<br />" + "<br />" + "<STRONG>" + System.Web.HttpUtility.HtmlEncode("Reférence : ") + " </STRONG>" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + "<br/><strong>tel vendeur:</strong> " + System.Web.HttpUtility.HtmlEncode(b.TEL_AGENCE) + "<br />" + "<br/><STRONG>Contact : </STRONG>" + System.Web.HttpUtility.HtmlEncode(PrenomNego) + " " + System.Web.HttpUtility.HtmlEncode(NomNego) + "<br/><strong>tel : </strong>" + System.Web.HttpUtility.HtmlEncode(ligne["tel_client"].ToString()) + "<br/><STRONG>email : </STRONG>" + System.Web.HttpUtility.HtmlEncode(ligne["id_client"].ToString()) + "</div>" + "</div>" ; } } } else if (b.NOM_AGENCE != "") { texteHtmlDeRetour += "<div class=\"Resultat-text\" style=\"background-color: White;color: Black;font-family: Times New Roman;font-size: 10pt;height: 110px;width: 500px;border-top: #ffffff 2px solid;border-bottom: #ffffff 2px solid;text-align: justify; \">" + System.Web.HttpUtility.HtmlEncode(b.TEXTE_INTERNET) + "<br />" + "<br />" + "<STRONG>" + System.Web.HttpUtility.HtmlEncode("Reférence : ") + " </STRONG>" + System.Web.HttpUtility.HtmlEncode(b.REFERENCE) + " - tel: " + System.Web.HttpUtility.HtmlEncode(b.TEL_AGENCE) + "<br />" + "<STRONG>Contact : </STRONG>" + System.Web.HttpUtility.HtmlEncode(b.NOM_AGENCE) + " - " + System.Web.HttpUtility.HtmlEncode(b.ADRESSE_AGENCE) + " - " + System.Web.HttpUtility.HtmlEncode(b.CODE_POSTALE_AGENCE) + " " + System.Web.HttpUtility.HtmlEncode(b.VILLE_AGENCE) + "<STRONG> email : </STRONG>" + System.Web.HttpUtility.HtmlEncode(b.MAIL_AGENCE) + "</div>" + "</div>" ; } } return(texteHtmlDeRetour); }