internal static SqlCeDataReader ExecuteReader(string req) { try { var con = new Connexion(); SqlCeConnection conne = con.OpenConnection(); var sqlCommand = new SqlCeCommand(req, conne); SqlCeDataReader myReader = sqlCommand.ExecuteReader(); return myReader; } catch (Exception e) { Console.WriteLine(e.ToString()); return null; } }
internal static int ExecuteUpdate(string requête) { // on gère les éventuelles exceptions try { var con = new Connexion(); // ouverture connexion SqlCeConnection conne = con.OpenConnection(); // exécute sqlCommand avec requête de mise à jour var sqlCommand = new SqlCeCommand(requête, conne); int nbLignes = sqlCommand.ExecuteNonQuery(); return nbLignes; } catch (Exception) { return -1; } }
internal static DataSet ExecuteSelect(string requête) { // on gère les éventuelles exceptions try { var con = new Connexion(); SqlCeConnection connexion = con.OpenConnection(); SqlCeCommand cmd = connexion.CreateCommand(); cmd.CommandText = requête; var da = new SqlCeDataAdapter(cmd); var ds = new DataSet(); da.Fill(ds); return ds; } catch (Exception e) { Console.WriteLine(e.ToString()); return null; } }
public override Enseignant update(int idAupdate, Enseignant update) { using (SqlCommand command_u = new SqlCommand(@"UPDATE enseignant SET nom='" + update.Nom + "', prenom='" + update.Prenom + "', nb_heures_assignees=" + update.nbHeuresTravaillees.ToString().Replace(",", ".") + ", id_categorie_enseignant=" + update.Categorie.Id + ", image='" + update.lienImage + "' WHERE id=" + idAupdate + ";", Connexion.getInstance())) { command_u.ExecuteNonQuery(); } return(update); }
protected void Page_Load(object sender, EventArgs e) { ((Label)Page.Master.FindControl("titrebandeau")).Text = "Mon espace"; try { if (Session["logged"].Equals(true)) { // permet le "Bonjour Mr X" Membre member = (Membre)Session["Membre"]; } } catch { Response.Redirect("./moncompte.aspx"); } if (!IsPostBack) { DropDownListPageSize.SelectedValue = Session["annoncesPage"].ToString(); GridViewHist.PageSize = int.Parse(DropDownListPageSize.SelectedValue); BindData(); } //Pour afficher les données du acquereur String idAcquereur; idAcquereur = (String)Session["idacquereur"]; //le variable pour recuperer les pages Web string sql = "SELECT Acquereurs.id_acq, Acquereurs.civilite, Acquereurs.date_ajout, Acquereurs.negociateur, Acquereurs.nom, Acquereurs.prenom, Acquereurs.adresse, Acquereurs.ville, Acquereurs.code_postal, Acquereurs.pays, Acquereurs.portable , Acquereurs.mail FROM Acquereurs WHERE (((Acquereurs.id_acq)=" + idAcquereur + "))"; Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); System.Data.DataSet ds = c.exeRequette(sql); c.Close(); ///clients try { lblNom.Text = (String)ds.Tables[0].Rows[0]["nom"].ToString().ToUpper() + " " + (String)ds.Tables[0].Rows[0]["prenom"].ToString().ToUpper(); } catch { lblNom.Text = " "; } try { lblVille.Text = (String)ds.Tables[0].Rows[0]["ville"]; } catch { lblVille.Text = " "; } try { lblcp.Text = (String)ds.Tables[0].Rows[0]["code_postal"]; } catch { lblcp.Text = " "; } try { lblMail.Text = (String)ds.Tables[0].Rows[0]["mail"]; } catch { lblMail.Text = " "; } try { lbltel.Text = (String)ds.Tables[0].Rows[0]["portable"]; } catch { lbltel.Text = " "; } }
private void btnAdd_Click(object sender, EventArgs e) { Connexion.ajouterSaison(((support)bsSerie.Current).serie, nupAnnee.Value, nupNbEp.Value); MessageBox.Show("Ajouté !"); this.Close(); }
public BaseRepository() { _connexion = new Connexion(_ConnectionString.ConnectionString, SqlClientFactory.Instance); }
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>"; } } }
bool CalculateRelevantConnexion(ref Connexion relevantConnexion) { // Check if a unit is on this node if (_unitOnNode == null) { // Otherwise, return that it couldn't succesfully calculate the most relevant connexion Debug.Log("Error - " + this + " : SortFrontNodesByRelevancy() called but a unit on this node is needed to sort nodes by relevancy."); return false; } // Check if the front node list isn't empty if (_frontNodes.Count <= 0) { // Otherwise, return that it couldn't succesfully calculate the most relevant connexion Debug.Log("Debug - " + this + " : SortFrontNodesByRelevancy() : _frontNodes.Count <= 0"); return false; } // Select the only connexion if there is only one contained in the front node list if(_frontNodes.Count == 1) { // _debug_ Check if the the connexion is viable if (_frontNodes[0]._connectedNode != null && _unitOnNode._age <= _frontNodes[0]._age + pathAgeTolerance) { relevantConnexion = _frontNodes[0]; return true; } } else { // Select the most recent and accesible one if there are more bool firstRelevantConnexionFound = false; foreach (Connexion connexion in _frontNodes) { // If no relevant connexion has already been found if (!firstRelevantConnexionFound){ // _debug_ Check if the the connexion is viable if(connexion._connectedNode != null && _unitOnNode._age <= _frontNodes[0]._age + pathAgeTolerance) { relevantConnexion = connexion; firstRelevantConnexionFound = true; } } else if (connexion._creationTime >= relevantConnexion._creationTime) { // _debug_ Check if the the connexion is viable if (connexion._connectedNode != null && _unitOnNode._age <= _frontNodes[0]._age + pathAgeTolerance) { relevantConnexion = connexion; } } } if (firstRelevantConnexionFound) return true; } Debug.Log("Debug - " + this + " : SortFrontNodesByRelevancy() : firstRelevantConnexionFound = false"); // Return that no relevant connexions have been found return false; }
protected void Page_Load(object sender, EventArgs e) { Membre member = (Membre)Session["Membre"]; if (member == null || (member.STATUT != "nego" && member.STATUT != "ultranego")) { Response.Redirect("recherche.aspx"); Response.Close(); } string action = Request.QueryString["action"]; if (action != null) { if (action == "modif") { msg.Text = "La location a été mise à jour"; } } if (action == "ajout") { msg.Text = "La location a été ajoutée"; } ((System.Web.UI.WebControls.Label)Page.Master.FindControl("titrebandeau")).Text = "Accueil"; Connexion cI = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); cI.Open(); System.Data.DataSet dsI = cI.exeRequette("Select * from Environnement"); cI.Close(); racine_site = (String)dsI.Tables[0].Rows[0]["Chemin_racine_site"]; if (!IsPostBack) { Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); DataRowCollection listAcq = c.exeRequetteOpen("SELECT id_acq,nom,prenom FROM Acquereurs WHERE idclient = " + member.IDCLIENT + "AND type_acquereur = 'Loueur' AND actif = 'actif' ORDER BY nom ASC").Tables[0].Rows; c.Close(); c = null; //Remplissage des listes deroulantes foreach (DataRow ligne in listAcq) { FuAsp_acq.Items.Add(new ListItem(ligne["nom"].ToString().ToUpper() + " " + ligne["prenom"], ligne["id_acq"].ToString())); } //Remplissage avec les anciens criteres de recherches if (Session["annoncesPage"] != null) { DropDownListPageSize.SelectedValue = Session["annoncesPage"].ToString(); } else { DropDownListPageSize.SelectedValue = "30"; } GridView1.PageSize = int.Parse(DropDownListPageSize.SelectedValue); if (Session["mesLocations_validePropMy"] != null) { valideProp.SelectedValue = Session["mesLocations_validePropMy"].ToString(); } if (Session["mesLocations_valideLocation"] != null) { valideLocation.SelectedValue = Session["mesLocations_valideLocation"].ToString(); } if (Session["mesLocations_dateBailMin"] != null) { TB_DateSignBailMin.Text = Session["mesLocations_dateBailMin"].ToString(); } if (Session["mesLocations_dateBailMax"] != null) { TB_DateSignBailMax.Text = Session["mesVentes_dateBailMax"].ToString(); } //if (Session["mesVentes_dateSignatureMin"] != null) //TB_DateSignatureMin.Text = Session["mesVentes_dateSignatureMin"].ToString(); //if (Session["mesVentes_dateSignatureMax"] != null) //TB_DateSignatureMax.Text = Session["mesVentes_dateSignatureMax"].ToString(); if (Session["mesLocations_FuAsp_acq"] != null) { FuAsp_acq.SelectedValue = Session["mesLocations_FuAsp_acq"].ToString(); } BindData(); } }
public override Departement find(int id) { Departement dep = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom FROM departement WHERE id=" + id + ";", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { dep = new Departement(reader_f.GetInt32(0), reader_f.GetString(1)); reader_f.NextResult(); } } else { throw new Exception("Aucun objet avec cet id n'a été trouvé."); } reader_f.Close(); } } return(dep); }
public override Departement create(Departement obj) { if (obj.Id == -1) { obj.Id = OutilsSQL.getLastInsertedId("departement", Connexion.getInstance()) + 1; } using (SqlCommand command_c = new SqlCommand("INSERT INTO departement VALUES (" + obj.Id + ", '" + obj.Nom + "');", Connexion.getInstance())) { command_c.ExecuteNonQuery(); } return(obj); }
// Transmit the unit on this node toward the relevant connexion's node bool SendUnit(Connexion relevantConnexion) { // Check if there is a unit to send if (_unitOnNode == null) { // Otherwise, // Return that it couldn't succesfully send the inexisting unit Debug.Log("Error - " +this +" : SendUnit() called with no unit to send."); return false; } // Check if the unit can start traveling to the relevant node if (!_unitOnNode.IsReadyToExecuteOrder()) { // Otherwise, // Return that it couldn't succesfully send the inexisting unit Debug.Log("Error - " + this + " : SendUnit() called but the unit isnt't ready to travel to it's new destination."); return false; } // Transmit the unit on this node to the target node system if (!relevantConnexion._connectedNode.RecieveUnit(_unitOnNode)) { // If the target node couldn't recive the unit, // Return that it couldn't succesfully send the unit Debug.Log("Error - " + this + " : SendUnit() called but couldn't successfully transmit the unit to it's destination node."); return false; } // Make the unit travel to it's relevant node _unitOnNode.RecieveOrder(relevantConnexion._path); // Set the target node on unit _unitOnNode._currentNode = relevantConnexion._connectedNode; // Set the last node on unit _unitOnNode._lastNode = this; // Check if the unit has a child if (_unitOnNode._childCount > 0) { // If it does, spawn it on this node _unitOnNode._childCount--; _unitOnNode = SpawnUnitOnNode(); // Calculate relevant destination _relevantConnexionFound = CalculateRelevantConnexion(ref _relevantConnexion); } else { // Otherwise, remove the stored unit from this node if it was sucessfully sent _unitOnNode = null; // Reset relevant connexion _relevantConnexionFound = false; } // Return that it succesfully send the unit return true; }
public override void delete(Enseignant obj) { using (SqlCommand command_d = new SqlCommand("DELETE FROM enseignant WHERE id=" + obj.Id + ";", Connexion.getInstance())) { command_d.ExecuteNonQuery(); } }
public override Departement find(string nom) { Departement dep = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom FROM departement WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { dep = new Departement(reader_f.GetInt32(0), reader_f.GetString(1)); reader_f.NextResult(); } } reader_f.Close(); } } return(dep); }
public override List <Enseignant> findAll() { List <Enseignant> enss = new List <Enseignant>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignant;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Categorie> TPSQL = factoSQL.getCategorieDAO(); Categorie categ2 = TPSQL.find(reader_f.GetInt32(4)); enss.Add(new Enseignant(reader_f.GetInt32(0), reader_f.GetString(1), reader_f.GetString(2), reader_f.GetDouble(3), categ2, reader_f.GetString(5))); } } } } return(enss); }
public override List <Departement> findAll() { List <Departement> deps = new List <Departement>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM departement;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { deps.Add(new Departement(reader_f.GetInt32(0), reader_f.GetString(1))); } } } } return(deps); }
public static Facture getOneFacture(String reference) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from yvs_com_doc_ventes where num_piece = '" + reference + "' or num_doc = '" + reference + "'"; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); Facture a = new Facture(); if (lect.HasRows) { while (lect.Read()) { a.Id = Convert.ToInt64(lect["id"].ToString()); a.Supp = (Boolean)((lect["supp"] != null) ? (!lect["supp"].ToString().Trim().Equals("") ? lect["supp"] : false) : false); a.Impression = (Int32)((lect["impression"] != null) ? (!lect["impression"].ToString().Trim().Equals("") ? lect["impression"] : 0) : 0); a.Solde = Convert.ToBoolean((lect["solde"] != null) ? (!lect["solde"].ToString().Trim().Equals("") ? lect["solde"].ToString().Trim() : "false") : "false"); a.Categorie = (lect["categorie_comptable"] != null ? (!lect["categorie_comptable"].ToString().Trim().Equals("") ? BLL.CategorieComptableBll.One(Convert.ToInt64(lect["categorie_comptable"].ToString())) : new CategorieComptable()) : new CategorieComptable()); a.Client = (lect["client"] != null ? (!lect["client"].ToString().Trim().Equals("") ? BLL.ClientBll.One(Convert.ToInt64(lect["client"].ToString())) : new Client()) : new Client()); a.HeureDoc = Convert.ToDateTime((lect["heure_doc"] != null) ? (!lect["heure_doc"].ToString().Trim().Equals("") ? lect["heure_doc"].ToString().Trim() : "00/00/0000") : "00/00/0000"); a.NumDoc = lect["num_doc"].ToString(); a.NumPiece = lect["num_piece"].ToString(); a.TypeDoc = lect["type_doc"].ToString(); a.Statut = lect["statut"].ToString(); a.MontantAvance = (Double)((lect["montant_avance"] != null) ? ((!lect["montant_avance"].ToString().Trim().Equals("")) ? lect["montant_avance"] : 0) : 0); a.Contenus = BLL.ContenuBll.Liste("select * from yvs_com_contenu_doc_vente where doc_vente = " + a.Id); a.Remises = BLL.RemiseFactureBll.Liste("select * from yvs_com_remise_doc_vente where doc_vente = " + a.Id); a.Mensualites = BLL.MensualiteBll.Liste("select * from yvs_com_mensualite_facture_vente where facture = " + a.Id + " order by date_reglement"); double mtant = 0; foreach (Mensualite m in a.Mensualites) { mtant += m.MontantVerse; foreach (PieceCaisse p in m.Reglements) { a.Reglements.Add(p); } } if (mtant > a.MontantAvance) { a.MontantAvance = mtant; } Utils.MontantTotalDoc(a); a.Update = true; } lect.Close(); } return(a); } catch (NpgsqlException e) { Messages.Exception(e); return(null); } finally { Connexion.Deconnection(con); } }
protected void ButtonImpressionBon_Click2(object sender, EventArgs e) { //Bon de visite + enregistrement de la visite string requete = ""; Membre member = null; if (Session["logged"].Equals(true)) { // permet le "Bonjour Mr X" member = (Membre)Session["Membre"]; LabelPrenom.Text = member.CIVILITE; LabelNom.Text = member.NOM; } else { Response.Redirect("./recherche.aspx"); } cb_CheckedChanged(null, null); int i = 0; Session["ref_sel"] = ""; //Parcours des checkboxs de la page for (i = 2; i < TablePlanif.Rows.Count; i++) { if (Session["ref_sel"] == "") { if (((CheckBox)TablePlanif.Rows[i].Cells[8].Controls[0]).Checked) { Session["ref_sel"] = ((CheckBox)TablePlanif.Rows[i].Cells[8].Controls[0]).ID; } } else { if (((CheckBox)TablePlanif.Rows[i].Cells[8].Controls[0]).Checked) { Session["ref_sel"] = Session["ref_sel"] + ";" + ((CheckBox)TablePlanif.Rows[i].Cells[8].Controls[0]).ID; } } } if (Session["ref_sel"] != null) { //On recupere la liste des biens dans la variable de session string Ref = (string)Session["ref_sel"]; string[] WordArray; string[] stringSeparators = new string[] { ";" }; WordArray = Ref.Split(stringSeparators, StringSplitOptions.None); i = 0; if (Session["ref_sel"] == "" || DropDownListAcquereurs.SelectedValue == "0") { LabelMessage.Text = "La visite ne peut être enregistrée tant que ne sont pas sélectionnés, au moins, un acquéreur et un bien."; } else { //On ajoute dans la base if (WordArray.Length >= 1) { while (i < WordArray.Length) { requete = " INSERT INTO visite(" + "`id_bien`," + "`acquereur`," + "`idclient`," + "`actif`," + "`date_visite`)" + "values('" + WordArray[i] + "','" + DropDownListAcquereurs.SelectedValue + "','" + member.IDCLIENT + "','" + "actif" + "','" + DateTime.Now.ToString() + "'" + ")"; System.Data.DataSet ds = null; Connexion c = null; c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); ds = c.exeRequette(requete); c.Close(); c = null; i++; } } LabelMessage.Text = "La visite a bien été enregistrée."; } } }
public DGVQuery(DataGridView dgv, Connexion.Connexion connexion) { this.dgv = dgv; this.connexion = connexion; }
//CONSTRUCTION DU TABLEAU DES BIENS protected void fill_table(string whose) { //PRINCIPE : on déclare le strict minimum du tableau dans la page aspx. //On remplit le tableau en c#. On met dans une cellule du texte ou une checkbox rattachée à un event. // On peut aisément générer des ID dynamiquement. //On insère cette cellule dans une ligne. On ajoute cette ligne à une varaible tableau. //On rattache cette variable tableau au tableau déclaré dans la page aspx. TablePlanif.Rows.Clear(); TableRow tRow; TableCell tCell1; CheckBox cb; int j = 0; // indice pour l'alternance des couleurs // affichage du nom des colonnes tRow = new TableRow(); tCell1 = new TableCell(); tCell1.Text = "<strong>Référence</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = "<strong>Négociateur</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = "<strong>Prix de vente</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = "<strong>Type de bien</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = "<strong>Date de dossier</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = "<strong>Ville</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = "<strong>Code postal</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = "<strong>Surface</strong>"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1 = new TableCell(); cb = new CheckBox(); cb.ID = "CheckBoxGlobale"; cb.AutoPostBack = true; cb.CheckedChanged += new EventHandler(globale_cb_changed); tCell1.Controls.Add(cb); tRow.Cells.Add(tCell1); // tCell1.Text = "<strong>Visite</strong>"; tRow.CssClass = "champs"; TablePlanif.Rows.Add(tRow); // Cases de tri. Les fleches sont des liens vers la meme page en ajoutant des variables dans l'url tRow = new TableRow(); // Cellule fleche ref tCell1 = new TableCell(); Table minitab = new Table(); TableRow tMiniRow = new TableRow(); TableCell tMiniCell = new TableCell(); ImageButton fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "refDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "refASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); // Cellule fleche nego tCell1 = new TableCell(); minitab = new Table(); tMiniRow = new TableRow(); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "negoDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "negoASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); // Cellule fleche prix de vente tCell1 = new TableCell(); minitab = new Table(); tMiniRow = new TableRow(); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "prixDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "prixASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); // Cellule fleche type tCell1 = new TableCell(); minitab = new Table(); tMiniRow = new TableRow(); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "typeDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "typeASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); // Cellule fleche date tCell1 = new TableCell(); minitab = new Table(); tMiniRow = new TableRow(); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "dateDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "dateASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); // Cellule fleche ville tCell1 = new TableCell(); minitab = new Table(); tMiniRow = new TableRow(); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "villeDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "villeASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); // Cellule fleche cp tCell1 = new TableCell(); minitab = new Table(); tMiniRow = new TableRow(); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "cpDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "cpASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); // Cellule fleche type tCell1 = new TableCell(); minitab = new Table(); tMiniRow = new TableRow(); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_bas.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "surfaceDESC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); tMiniCell = new TableCell(); fleche = new ImageButton(); fleche.ImageUrl = "../img_site/fleche_tri_haut.png"; fleche.Click += new ImageClickEventHandler(ImageButton_Click); fleche.ID = "surfaceASC"; tMiniCell.Controls.Add(fleche); tMiniRow.Cells.Add(tMiniCell); minitab.Rows.Add(tMiniRow); tCell1.Controls.Add(minitab); tRow.Cells.Add(tCell1); tRow.CssClass = "tritableaudebord"; TablePlanif.Rows.Add(tRow); // Choix du tri. Variables récupérées dans l'url String Ordre = "ASC"; String OrderBy = "ref"; // selon la variable récupérée, on forme le orderby pour la requette if (Session["type"] != null) { if (Session["type"].ToString() == "refASC") { OrderBy = "ref"; Ordre = "ASC"; } else if (Session["type"].ToString() == "refDESC") { OrderBy = "ref"; Ordre = "DESC"; } else if (Session["type"].ToString() == "negoASC") { OrderBy = "negociateur"; Ordre = "ASC"; } else if (Session["type"].ToString() == "negoDESC") { OrderBy = "negociateur"; Ordre = "DESC"; } else if (Session["type"].ToString() == "prixASC") { OrderBy = "prix de vente"; Ordre = "ASC"; } else if (Session["type"].ToString() == "prixDESC") { OrderBy = "prix de vente"; Ordre = "DESC"; } else if (Session["type"].ToString() == "typeASC") { OrderBy = "type de bien"; Ordre = "ASC"; } else if (Session["type"].ToString() == "typeDESC") { OrderBy = "type de bien"; Ordre = "DESC"; } else if (Session["type"].ToString() == "dateASC") { OrderBy = "date dossier"; Ordre = "ASC"; } else if (Session["type"].ToString() == "dateDESC") { OrderBy = "date dossier"; Ordre = "DESC"; } else if (Session["type"].ToString() == "villeASC") { OrderBy = "ville du bien"; Ordre = "ASC"; } else if (Session["type"].ToString() == "villeDESC") { OrderBy = "ville du bien"; Ordre = "DESC"; } else if (Session["type"].ToString() == "cpASC") { OrderBy = "code postal du bien"; Ordre = "ASC"; } else if (Session["type"].ToString() == "cpDESC") { OrderBy = "code postal du bien"; Ordre = "DESC"; } else if (Session["type"].ToString() == "surfaceASC") { OrderBy = "surface habitable"; Ordre = "ASC"; } else if (Session["type"].ToString() == "surfaceDESC") { OrderBy = "surface habitable"; Ordre = "DESC"; } } Membre member1 = (Membre)Session["Membre"]; int idClientNego = member1.IDCLIENT; // On forme la requette sur la table bien suivant les biens ou tous les biens String requette = ""; if (whose == "Mes biens") { requette = "select ref, `negociateur`, `loyer_cc`, `prix de vente`, `ville du bien`, `code postal du bien`, `type de bien`, `date dossier`, `surface habitable` from biens where `actif`='actif' AND `idclient`=" + idClientNego + " ORDER BY Biens.[" + OrderBy + "]" + Ordre; } else if (whose == "Tous les biens") { requette = "select ref, `negociateur`, `loyer_cc`, `prix de vente`, `ville du bien`, `code postal du bien`, `type de bien`, `date dossier`, `surface habitable` from biens where `actif`='actif' ORDER BY Biens.[" + OrderBy + "]" + Ordre; } else if (whose == "Mon agence") { requette = "select ref, `negociateur`, `loyer_cc`, `prix de vente`, `ville du bien`, `code postal du bien`, `type de bien`, `date dossier`, `surface habitable` from biens where `actif`='actif' AND `num`='" + member1.NUM_AGENCE + "' ORDER BY Biens.[" + OrderBy + "]" + Ordre; } System.Data.DataSet ds = null; Connexion c = null; c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); ds = c.exeRequette(requette); c.Close(); c = null; // Boucle d'affichage des biens System.Data.DataRowCollection dr = ds.Tables[0].Rows; foreach (System.Data.DataRow ligne in dr) { tRow = new TableRow(); tCell1 = new TableCell(); tCell1.Text = ((String)ligne["ref"].ToString()); tCell1.CssClass = "centre"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = ((String)ligne["negociateur"].ToString()); tCell1.CssClass = "centre"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); if ((String)ligne["ref"].ToString().Substring(0, 1) == "V") { tCell1.Text = ((String)ligne["prix de vente"].ToString()) + " €"; } else { tCell1.Text = ((String)ligne["loyer_cc"].ToString()) + " €"; } tCell1.CssClass = "droite"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = ((String)ligne["type de bien"].ToString()); tCell1.CssClass = "centre"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = ((String)ligne["date dossier"].ToString().Substring(0, 10)); tCell1.CssClass = "centre"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = ((String)ligne["ville du bien"].ToString()); tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = ((String)ligne["code postal du bien"].ToString()); tCell1.CssClass = "centre"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); tCell1.Text = ((String)ligne["surface habitable"].ToString()); tCell1.CssClass = "centre"; tRow.Cells.Add(tCell1); tCell1 = new TableCell(); cb = new CheckBox(); cb.ID = ((String)ligne["ref"]); cb.AutoPostBack = false; //cb.CheckedChanged += new EventHandler(cb_CheckedChanged); tCell1.Controls.Add(cb); tRow.Cells.Add(tCell1); if ((j % 2) == 0) { tRow.CssClass = "pair"; } else { tRow.CssClass = "impair"; } j++; TablePlanif.Rows.Add(tRow); // Ajout de la ligne dans la table } }
protected void Buttonlestimer_Click(object sender, EventArgs e) { SmtpClient smtp = new SmtpClient(); MailMessage message = new MailMessage(); String ip = Request.UserHostAddress.ToString(); String date = DateTime.Now.ToString(); if (Page.IsValid) { try { Session["typedebienlestimer"] = TextBoxTypedebienlestimer.Text.Trim(); Session["Surfacehabitablelestimer"] = TextBoxSurfacehabitablelestimer.Text.Trim(); Session["Surfaceterrainlestimer"] = TextBoxSurfaceterrainlestimer.Text.Trim(); Session["nombredepiecelestimer"] = TextBoxnombredepiecelestimer.Text.Trim(); Session["localisationlestimer"] = TextBoxlocalisationlestimer.Text.Trim(); Session["prixlestimer"] = TextBoxprixlestimer.Text.Trim(); Session["nomlestimer"] = TextBoxNomlestimer.Text.Trim(); Session["emaillestimer"] = TextBoxEmaillestimer.Text.Trim(); Session["prenomlestimer"] = TextBoxPrenomlestimer.Text.Trim(); Session["telephonelestimer"] = TextBoxTellestimer.Text.Trim(); Session["adresselestimer"] = TextBoxAdresselestimer.Text.Trim(); Session["codepostallestimer"] = TextBoxCodePostallestimer.Text.Trim(); Session["villelestimer"] = TextBoxVillelestimer.Text.Trim(); MailAddress estimerfrom = new MailAddress(TextBoxEmaillestimer.Text.Trim()); Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); System.Data.DataSet ds = c.exeRequette("Select * from Environnement"); c.Close(); String strhost = (String)ds.Tables[0].Rows[0]["HostSMTP"]; string stremail = (string)ds.Tables[0].Rows[0]["email_commande"]; smtp.Host = strhost; smtp.Port = 25; message.From = new MailAddress(TextBoxEmaillestimer.Text.Trim()); message.Subject = "Je loue contact Patrimo"; message.To.Add(stremail); message.IsBodyHtml = true; message.Body = "<form border='1'><tr><td>nom:</td><td>" + Session["nomlestimer"] + "</td></tr>" + "<tr><td>prenom:</td><td>" + Session["prenomlestimer"] + "</td></tr>" + "<tr><td>telephone:</td><td>" + Session["telephonelestimer"] + "</td></tr>" + "<tr><td>email:</td><td>" + Session["emaillestimer"] + "</td></tr>" + "<tr><td>adress:</td><td>" + Session["adresselestimer"] + "</td></tr>" + "<tr><td>codepostal:</td><td>" + Session["codepostallestimer"] + "</td></tr>" + "<tr><td>ville:</td><td>" + Session["villelestimer"] + "</td></tr>" + "<tr><td>Type de bien:</td><td>" + Session["typedebienlestimer"] + "</td></tr>" + "<tr><td>Surface habitable:</td><td>" + Session["Surfacehabitablelestimer"] + "</td></tr>" + "<tr><td>Surface terrain:</td><td>" + Session["Surfaceterrainlestimer"] + "</td></tr>" + "<tr><td>Nombre de pièces:</td><td>" + Session["nombredepiecelestimer"] + "</td></tr>" + "<tr><td>Localisation:</td><td>" + Session["localisationlestimer"] + "</td></tr>" + "<tr><td>Prix de vente souhaité:</td><td>" + Session["prixlestimer"] + "</td></tr>" + "<tr><td>content:</td><td>" + TextBoxmessagelestimer.Text + "</td></tr>" + "</form>"; smtp.Send(message); Style avisstyle = new Style(); Label1.ForeColor = System.Drawing.Color.Red; Label1.Font.Size = new FontUnit(18); Label1.Text = "Formulare envoyé avec succès"; this.formavis.Visible = false; } catch (Exception ex) { Label1.ForeColor = System.Drawing.Color.Red; Label1.Text = "Erreur email : " + ex.Message; } } }
public PlancherCAD(Connexion co) { Listeplancher = new List <Plancher>(); this.conn = co; listAllPlancher(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["new"] == "1") { Session["ajout_acquereur"] = "true"; } ((Label)Page.Master.FindControl("titrebandeau")).Text = "Mon espace"; string requete = "SELECT TITRE_PAYS FROM PAYS"; System.Data.DataSet ds2 = null; Connexion c2 = null; c2 = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c2.Open(); ds2 = c2.exeRequette(requete); c2.Close(); c2 = null; DropDownListPays.DataSource = ds2; DropDownListPays.DataTextField = "TITRE_PAYS"; DropDownListPays.DataValueField = "TITRE_PAYS"; DropDownListPays.DataBind(); DropDownListPays.SelectedIndex = 68; if (Request.QueryString["reference"] != null) { //ucAjoutAcquereur.UpdatePanel1_Init(sender, e); //ucAjoutAcquereur.UpdatePanel1_Init(sender, e); if (!Page.IsPostBack) { #region pré-remplissage // On remplit tous les champs du formulaire avec les données dans la table bien String idAcq; idAcq = Request.QueryString["reference"]; String requette = "Select * From Acquereurs where `id_acq`=" + idAcq + ""; System.Data.DataSet ds = null; Connexion c = null; c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); ds = c.exeRequette(requette); c.Close(); c = null; System.Data.DataRowCollection dr = ds.Tables[0].Rows; foreach (System.Data.DataRow ligne in dr) { // Général if (ligne["civilite"].ToString() == "Mr") { RadioButtonMr.Checked = true; } else if (ligne["civilite"].ToString() == "Mlle") { RadioButtonMlle.Checked = true; } else if (ligne["civilite"].ToString() == "Mme") { RadioButtonMme.Checked = true; } TextBoxNom.Text = ligne["nom"].ToString(); TextBoxPrenom.Text = ligne["prenom"].ToString(); TextBoxAdresse.Text = ligne["adresse"].ToString(); TextBoxCodePostal.Text = ligne["code_postal"].ToString(); TextBoxVille.Text = ligne["ville"].ToString(); DropDownListPays.Text = ligne["pays"].ToString(); TextBoxTel.Text = ligne["tel"].ToString(); TextBoxPortable.Text = ligne["portable"].ToString(); TextBoxMail.Text = ligne["mail"].ToString(); DropDownListTypeAcq.SelectedValue = ligne["type_acquereur"].ToString(); DDLCategorieAcquereur.SelectedValue = ligne["categorie"].ToString(); //Caractéristiques principales if (ligne["appartement"].ToString() == "True") { CheckBoxAppartement.Checked = true; } if (ligne["maison"].ToString() == "True") { CheckBoxMaison.Checked = true; } if (ligne["terrain"].ToString() == "True") { CheckBoxTerrain.Checked = true; } if (ligne["autre"].ToString() == "True") { CheckBoxAutre.Checked = true; } DropDownListEtatAvancement.SelectedValue = ligne["etat_avancement"].ToString(); TextBoxPrixMin.Text = ligne["prix_min"].ToString(); TextBoxPrixMax.Text = ligne["prix_max"].ToString(); //Caractéristiques complémentaires TextBoxPiecesMin.Text = ligne["nombre_de_pieces_min"].ToString(); TextBoxPiecesMax.Text = ligne["nombre_de_pieces_max"].ToString(); TextBoxChambresMin.Text = ligne["nombre_de_chambres_min"].ToString(); TextBoxChambresMax.Text = ligne["nombre_de_chambres_max"].ToString(); TextBoxSurfaceHabitableMin.Text = ligne["surface_habitable_min"].ToString(); TextBoxSurfaceHabitableMax.Text = ligne["surface_habitable_max"].ToString(); TextBoxSurfaceSejourMin.Text = ligne["surface_sejour_min"].ToString(); TextBoxSurfaceSejourMax.Text = ligne["surface_sejour_max"].ToString(); TextBoxFacade.Text = ligne["facade"].ToString(); TextBoxProfondeur.Text = ligne["profondeur"].ToString(); TextBoxSurfaceTerrainMin.Text = ligne["surface_terrain_min"].ToString(); TextBoxSurfaceTerrainMax.Text = ligne["surface_terrain_max"].ToString(); if ((string)ligne["ascenseur"] == "OUI") { CheckBoxAscenseur.Checked = true; } if ((string)ligne["sous-sol"] == "OUI") { CheckBoxSousSol.Checked = true; } if ((string)ligne["parking/box"] == "OUI") { CheckBoxParking.Checked = true; } TextBoxTexteComplementaire.Text = ligne["texte_complementaire"].ToString(); //acquereur.Cible = ucAjoutAcquereur.listeVilleRecherche.createString(); } #endregion } } }
public override Enseignement create(Enseignement obj) { if (obj.Id == -1) { obj.Id = OutilsSQL.getLastInsertedId("enseignement", Connexion.getInstance()) + 1; } using (SqlCommand command_c = new SqlCommand("INSERT INTO enseignement VALUES (" + obj.Id + ", '" + obj.Nom + "', " + obj.PartieAnnee.Id + ", '" + obj.Description + "');", Connexion.getInstance())) { command_c.ExecuteNonQuery(); } return(obj); }
//-----------Ancienes versions des fonctions d'écriture dans les fichiers de conf--------------------------- public Boolean EcrireConfigurationConnexionBD(String adresseServeur, String utilisateur, String passwordBD) { //**************cryptage des infos de la BD //String adresseServeur1 = Cryptage.Encrypt(adresseServeur, Cryptage.clefDuCryptage); //String utilisateur1 = Cryptage.Encrypt(utilisateur, Cryptage.clefDuCryptage); //String passwordBD1 = Cryptage.Encrypt(passwordBD, Cryptage.clefDuCryptage); // new xdoc instance XmlDocument xDoc = new XmlDocument(); XmlDocument xDoc2 = new XmlDocument(); //load up the xml from the location //xDoc.Load("C:\\projet C#\\workspace\\Projet Ecole 2\\App.Config"); //xDoc.Load(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\\Debug\\", "App.Config")); // MessageBox.Show(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); xDoc2.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); //**************** DEBUT Partie qui écrit les paramètres de connexion à la BD //XmlNode GeneralInformationConnexionBD = // xDoc.SelectSingleNode("/configuration/connectionStrings"); XmlNode GeneralInformationConnexionBD2 = xDoc2.SelectSingleNode("/configuration/connectionStrings"); //for (int i = 0; i < GeneralInformationConnexionBD.ChildNodes.Count; i++) //{ // if (GeneralInformationConnexionBD.ChildNodes[i].Name.Equals("add")) // { // if (GeneralInformationConnexionBD.ChildNodes[i].Attributes["name"].Value.Equals("connexion")) // { // GeneralInformationConnexionBD.ChildNodes[i].Attributes["connectionString"].Value = "SERVER=" + adresseServeur + "; DATABASE=ecole; UID=" + utilisateur + "; PASSWORD="******"add")) { if (GeneralInformationConnexionBD2.ChildNodes[i].Attributes["name"].Value.Equals("connexion")) { GeneralInformationConnexionBD2.ChildNodes[i].Attributes["connectionString"].Value = "SERVER=" + adresseServeur + "; DATABASE=ecole; UID=" + utilisateur + "; PASSWORD="******"SERVER=" + adresseServeur + "; DATABASE=" + utilisateur + "; UID=root; PASSWORD="******"connectionStrings"); //*************** FIN Partie qui écrit les paramètres de connexion à la BD //xDoc.Save("C:\\projet C#\\workspace\\Projet Ecole 2\\App.Config"); //xDoc.Save(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\\Debug\\", "App.Config")); xDoc2.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); Connexion.resetConnexion(); this.utilisateurDA = new UtilisateurDA(); // journalDA.journaliser("modification de la chaine de connexion à la BD dans le fichier de configuration "); return(true); }
public override Enseignement find(int id) { Enseignement ens = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_partie_annee, description FROM enseignement WHERE id=" + id + ";", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <PartieAnnee> TPSQL = factoSQL.getPartieAnneeDAO(); PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2)); ens = new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3)); reader_f.NextResult(); } } else { throw new Exception("Aucun objet avec cet id n'a été trouvé."); } reader_f.Close(); } } return(ens); }
protected void updateMember(Membre member) { DataSet ds = null; Connexion c = new Connexion(_ConnectionString); c.Open(); ds = c.exeRequette("select * from Clients WHERE id_client ='" + member.ID_CLIENTA + "'"); c.Close(); if (((int)ds.Tables[0].Rows.Count) != 1) { member = new Membre(); } else { OdbcConnection c3 = new OdbcConnection(_ConnectionString); OdbcCommand commande = new OdbcCommand("UPDATE Clients SET civilite= ?,nom_client=?, prenom_client= ?, adresse_client=?, postal_client=?, ville_client=?, tel_client=?, id_client=?, pass_client=?, société_client= ?, pays_client=? WHERE id_client= ?", c3); #region parametres odbc OdbcParameter param0 = new OdbcParameter("", DbType.String); param0.Value = member.CIVILITE; commande.Parameters.Add(param0); OdbcParameter param1 = new OdbcParameter("", DbType.String); param1.Value = member.NOM; commande.Parameters.Add(param1); OdbcParameter paramIdClient = new OdbcParameter("", DbType.String); paramIdClient.Value = member.PRENOM; commande.Parameters.Add(paramIdClient); OdbcParameter param2 = new OdbcParameter("", DbType.String); param2.Value = member.ADRESSE; commande.Parameters.Add(param2); OdbcParameter param3 = new OdbcParameter("", DbType.String); param3.Value = member.CODE_POSTAL; commande.Parameters.Add(param3); OdbcParameter param4 = new OdbcParameter("", DbType.String); param4.Value = member.VILLE; commande.Parameters.Add(param4); OdbcParameter param5 = new OdbcParameter("", DbType.String); param5.Value = member.TEL; commande.Parameters.Add(param5); OdbcParameter param50 = new OdbcParameter("", DbType.String); param50.Value = member.ID_CLIENT; commande.Parameters.Add(param50); OdbcParameter param6 = new OdbcParameter("", DbType.String); param6.Value = member.PASSWORD; commande.Parameters.Add(param6); OdbcParameter param7 = new OdbcParameter("", DbType.String); param7.Value = member.SOCIETE; commande.Parameters.Add(param7); OdbcParameter param8 = new OdbcParameter("", DbType.String); param8.Value = member.PAYS; commande.Parameters.Add(param8); OdbcParameter param9 = new OdbcParameter("", DbType.String); param9.Value = member.ID_CLIENTA; commande.Parameters.Add(param9); #endregion c3.Open(); commande.ExecuteNonQuery(); c3.Close(); save_Quote(); } }
public override Enseignement find(string nom) { Enseignement ens = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_partie_annee, description FROM enseignement WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <PartieAnnee> TPSQL = factoSQL.getPartieAnneeDAO(); PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2)); ens = new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3)); reader_f.NextResult(); } } reader_f.Close(); } } return(ens); }
public override Enseignant create(Enseignant obj) { if (obj.Id == -1) { obj.Id = OutilsSQL.getLastInsertedId("enseignant", Connexion.getInstance()) + 1; } using (SqlCommand command_c = new SqlCommand("INSERT INTO enseignant VALUES (" + obj.Id + ", '" + obj.Nom + "', '" + obj.Prenom + "', " + obj.nbHeuresTravaillees.ToString().Replace(",", ".") + ", " + obj.Categorie.Id + ", '" + obj.lienImage + "');", Connexion.getInstance())) { command_c.ExecuteNonQuery(); } return(obj); }
public override List <Enseignement> findAll() { List <Enseignement> enses = new List <Enseignement>(); using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignement;", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <PartieAnnee> TPSQL = factoSQL.getPartieAnneeDAO(); PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2)); enses.Add(new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3))); } } } } return(enses); }
public override Enseignant find(string nom) { Enseignant ens = null; using (SqlCommand command_f = new SqlCommand("SELECT id, nom, prenom, nb_heures_assignees, id_categorie_enseignant, image FROM enseignant WHERE nom='" + nom + "';", Connexion.getInstance())) { using (SqlDataReader reader_f = command_f.ExecuteReader()) { if (reader_f.HasRows) { while (reader_f.Read()) { AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY); DAO <Categorie> TPSQL = factoSQL.getCategorieDAO(); Categorie categ2 = TPSQL.find(reader_f.GetInt32(4)); ens = new Enseignant(reader_f.GetInt32(0), reader_f.GetString(1), reader_f.GetString(2), reader_f.GetDouble(3), categ2, reader_f.GetString(5)); reader_f.NextResult(); } } reader_f.Close(); } } return(ens); }
protected void Page_Load(object sender, EventArgs e) { Membre member = (Membre)Session["Membre"]; if (member == null || member.STATUT != "ultranego") { Response.Redirect("recherche.aspx"); Response.Close(); } ((Label)Page.Master.FindControl("titrebandeau")).Text = "Accueil"; string action = Request.QueryString["action"]; if (action != null) { if (action == "add") { msg.Text = "La commission a été ajoutée"; } } if (!IsPostBack) { Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); DataRowCollection listNego = c.exeRequetteOpen("SELECT idclient,nom_client,prenom_client FROM Clients WHERE statut = 'nego' OR statut = 'ultranego' ORDER BY nom_client ASC").Tables[0].Rows; c.Close(); c = null; //Remplissage des listes deroulantes foreach (DataRow ligne in listNego) { FuAsp_nego.Items.Add(new ListItem(ligne["nom_client"].ToString().ToUpper() + " " + ligne["prenom_client"], ligne["idclient"].ToString())); } //Remplissage avec les anciens criteres de recherches if (Session["annoncesPage"] != null) { DropDownListPageSize.SelectedValue = Session["annoncesPage"].ToString(); } else { DropDownListPageSize.SelectedValue = "30"; } GridView1.PageSize = int.Parse(DropDownListPageSize.SelectedValue); if (Session["dateCompromisMin"] != null) { TB_DateCompromisMin.Text = Session["dateCompromisMin"].ToString(); } if (Session["dateCompromisMax"] != null) { TB_DateCompromisMax.Text = Session["dateCompromisMax"].ToString(); } if (Session["dateSignatureMin"] != null) { TB_DateSignatureMin.Text = Session["dateSignatureMin"].ToString(); } if (Session["dateSignatureMax"] != null) { TB_DateSignatureMax.Text = Session["dateSignatureMax"].ToString(); } if (Session["dateSignBailMin"] != null) { TB_DateSignBailMin.Text = Session["dateSignBailMin"].ToString(); } if (Session["dateSignBailMax"] != null) { TB_DateSignBailMax.Text = Session["dateSignBailMax"].ToString(); } if (Session["FuAsp_nego"] != null) { FuAsp_nego.SelectedValue = Session["FuAsp_nego"].ToString(); } BindData(); } }
// Use this for initialization void Start() { connexion = gameObject.GetComponent <Connexion>(); }
private string DisplayQueryData(Connexion.Connexion connexion, string SQL, DataGridView dataGridViewOracleData, BackgroundWorker worker, DoWorkEventArgs eArgs) { string result = null; try { //string SelectedTable = treeViewOracleSchema.SelectedNode.Text; using (DbCommand cmd = connexion.Cnn.CreateCommand()) { cmd.Transaction = connexion.MyTransaction; int NumRec = 0; try { string SQLCount = "SELECT count(*) " + SQL.Substring(SQL.ToUpper().IndexOf("FROM")); cmd.CommandText = SQLCount; // string.Format("SELECT count(*) FROM {0}", SelectedTable); cmd.Prepare(); NumRec = Convert.ToInt32(cmd.ExecuteScalar()) + dataGridViewOracleData.Rows.Count; } catch (Exception e) { Console.WriteLine(e.Message); NumRec = 0; } //string SQL = string.Format("SELECT * FROM {0}", SelectedTable); cmd.CommandText = SQL; cmd.Prepare(); //int colno = 0; using (DbDataReader rd = cmd.ExecuteReader()) { if (ClearData) { if (dataGridViewOracleData.InvokeRequired) { if (!worker.CancellationPending) dataGridViewOracleData.Invoke(new datagridClear(ClearDataGrid)); } else { dataGridViewOracleData.Rows.Clear(); dataGridViewOracleData.Columns.Clear(); } for (int i = 0; i < rd.FieldCount && !worker.CancellationPending; i++) { if (dataGridViewOracleData.InvokeRequired) { dataGridViewOracleData.Invoke(new datagridAddCol(AddColDataGrid), new object[] { rd.GetName(i), rd.GetName(i) }); } else dataGridViewOracleData.Columns.Add(rd.GetName(i), rd.GetName(i)); } } while (rd.Read() && !worker.CancellationPending) { DataGridViewRow dgrv = new DataGridViewRow(); for (int i = 0; i < dataGridViewOracleData.Columns.Count; i++) { dgrv.Cells.Add(new DataGridViewTextBoxCell()); dgrv.Cells[i].Value = rd.GetValue(i); } if (dataGridViewOracleData.InvokeRequired) { dataGridViewOracleData.Invoke(new datagridAddRow(AddRowDataGrid), new object[] { dgrv }); } else dataGridViewOracleData.Rows.Add(dgrv); int CurrentNumRec = dataGridViewOracleData.Rows.Count; if (worker.WorkerReportsProgress) { if (NumRec != 0) { int percentComplete = (int)((float)CurrentNumRec / (float)NumRec * 100); worker.ReportProgress(percentComplete); } else { worker.ReportProgress(CurrentNumRec % 100); } } } if (worker.WorkerSupportsCancellation) { if (worker.CancellationPending) { eArgs.Cancel = true; result = string.Format("Aborted by user. {0} records found", dataGridViewOracleData.Rows.Count); } else { result = string.Format("{0} records found", dataGridViewOracleData.Rows.Count); } } if (dataGridViewOracleData.InvokeRequired) { dataGridViewOracleData.Invoke(new datagridAutoResizeColumns(DatagridAutoResizeColumns), new object[] { dataGridViewOracleData }); } else dataGridViewOracleData.AutoResizeColumns(); rd.Close(); } } return result; } catch (Exception e) { Exception ee = e; string errorMessage = e.Message; while (e.InnerException != null) { e = e.InnerException; errorMessage += "\n" + e.Message; } MessageBox.Show(errorMessage, "Unexpected error", MessageBoxButtons.OK, MessageBoxIcon.Error); return errorMessage; } }
public MetaSlotCAD(Connexion co) { this.conn = co; listemetaslot = new List <MetaSlot>(); }
public DGVQuery(Connexion.Connexion connexion) { this.connexion = connexion; }
protected void Update_modifierAcquereur(object sender, EventArgs e) { //id acquereur string idAcq = (string)Session["ajout_acquereur_id"]; string requete = "SELECT cible FROM Acquereurs WHERE `id_acq`=" + idAcq + ""; System.Data.DataSet ds = null; Connexion c = null; c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); c.Open(); ds = c.exeRequette(requete); c.Close(); c = null; System.Data.DataRowCollection dr = ds.Tables[0].Rows; Regex regexPays = new Regex("%type:pays%"); Regex regexVille = new Regex("%type:vil%"); Regex regexDep = new Regex("%type:dep%"); Regex regexArr = new Regex("%arr:"); String cibles = ""; foreach (System.Data.DataRow ligne in dr) { cibles = ligne["cible"].ToString(); } string[] cible = cibles.Split('|'); int k; ClickableTableCell cell = new ClickableTableCell(); for (int i = 0; i < cible.Length - 1; i++) // i = boucle des villes ou département d'un acquereur { string currentCible = cible[i]; cible[i].Trim(); cible[i] = cible[i].Replace("type:pays", ""); cible[i] = cible[i].Replace("type:dep", ""); cible[i] = cible[i].Replace("type:vil", ""); string[] temp = cible[i].Split('%'); string[] cibleInfo = new string[4]; k = 0; for (int j = 0; j < temp.Length; j++) // j = boucle des données de la ville i de l'acquereur { if (temp[j] != "") { cibleInfo[k] = temp[j]; k++; } } string cibleCode = cibleInfo[0].Split(':')[1]; // code de la ville ou du département i de l'acquereur string cibleNom = cibleInfo[1].Split(':')[1]; // nom de la ville ou du département i de l'acquereur string cibleCP = ""; if (cibleInfo[2] != null) { cibleCP = cibleInfo[2].Split(':')[1]; // CP de la ville ou du département i de l'acquereur } string cibleArr = ""; if (cibleInfo[3] != null) { cibleArr = cibleInfo[3].Split(':')[1]; // Arrondissement de la ville i de l'acquereur } if (regexPays.IsMatch(currentCible)) { List <Arrondissement> listeArrondissement = null; ListeEmplacementRecherche listeVille = new ListeEmplacementRecherche(); Emplacement toto = new Emplacement(false, cibleNom, false, false, cibleCode, listeVille, cibleCP, 0, listeArrondissement); toto.IsPays = true; emplacementAffiche.Add(toto); } if (regexVille.IsMatch(currentCible) && !regexArr.IsMatch(currentCible)) { List <Arrondissement> listeArrondissement = null; ListeEmplacementRecherche listeVille = new ListeEmplacementRecherche(); Emplacement toto = new Emplacement(false, cibleNom, false, false, cibleCode, listeVille, cibleCP, 0, listeArrondissement); emplacementAffiche.Add(toto); } else if (regexDep.IsMatch(currentCible)) { List <Arrondissement> listeArrondissement = null; ListeEmplacementRecherche listeVille = new ListeEmplacementRecherche(); Emplacement toto = new Emplacement(true, cibleNom, false, false, cibleCode, listeVille, cibleCP, 0, listeArrondissement); emplacementAffiche.Add(toto); } else if (regexArr.IsMatch(currentCible)) { List <Arrondissement> listeArrondissement = new List <Arrondissement>(); listeArrondissement = construireListeArrond(cibleCode); ListeEmplacementRecherche listeVille = new ListeEmplacementRecherche(); Emplacement toto = new Emplacement(false, cibleNom, false, true, cibleCode, listeVille, cibleCP, 0, listeArrondissement); toto.HasArrondissement = true; emplacementAffiche.Add(toto); } } rafraichirEmplacementAffiche(); }
public static void SendConnectionInfo(Connexion.Connexion connexion, PlugEvent sender) { if (connexion.IsOpen && !String.IsNullOrEmpty(connexion.OracleConnexion.UserId) && !String.IsNullOrEmpty(connexion.OracleConnexion.Password) && !String.IsNullOrEmpty(connexion.OracleConnexion.DataSource)) { //Personnes personne = (Personnes)PersonListBox.SelectedItem; XmlDocument doc = new XmlDocument(); XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(docNode); XmlNode rootNode = doc.CreateElement("ToadDotNet"); doc.AppendChild(rootNode); XmlNode actionNode = doc.CreateElement("action"); actionNode.InnerText = "connect"; //XmlAttribute actionAttr = doc.CreateAttribute("connection") rootNode.AppendChild(actionNode); XmlNode productNode = doc.CreateElement("connection"); XmlAttribute productAttribute = doc.CreateAttribute("userid"); productAttribute.Value = connexion.OracleConnexion.UserId; productNode.Attributes.Append(productAttribute); productAttribute = doc.CreateAttribute("password"); productAttribute.Value = connexion.OracleConnexion.Password; productNode.Attributes.Append(productAttribute); productAttribute = doc.CreateAttribute("datasource"); productAttribute.Value = connexion.OracleConnexion.DataSource; productNode.Attributes.Append(productAttribute); actionNode.AppendChild(productNode); if (sender != null) sender.Send(doc.OuterXml); } }