/// <summary> /// Load the srid of the selected data table /// </summary> private void LoadSRID() { if (cn == null || cn.State != ConnectionState.Open) { InitConnection(); } if (cn.Database != comboBoxDatabases.Text) { cn.ChangeDatabase(comboBoxDatabases.Text); } string[] tableName = comboBoxDataTable.Text.Trim().Split(new char[] { '.' }); string geomCol = comboBoxGeomCol.Text.ToLower().Replace("(geometry)", "").Replace("(geography)", "").Trim(); if (geomCol.Length == 0) { return; } System.Data.SqlClient.SqlCommand SqlCom = new System.Data.SqlClient.SqlCommand(); SqlCom.Connection = cn; SqlCom.CommandType = CommandType.Text; if (tableName.Length > 1) { SqlCom.CommandText = "select top 1 [" + geomCol + "].STSrid, [" + geomCol + "].STGeometryType() from [" + tableName[0] + "].[" + tableName[1] + "] where [" + geomCol + "] is not null"; } else { return; } this.Cursor = Cursors.WaitCursor; System.Data.SqlClient.SqlDataReader SqlDR; using (SqlDR = SqlCom.ExecuteReader()) { while (SqlDR.Read()) { if (!SqlDR.IsDBNull(0)) { textBoxSRID.Text = SqlDR.GetInt32(0).ToString(); } else { textBoxSRID.Text = ""; } geometryType = SqlDR.GetString(1); break; } } this.Cursor = Cursors.Default; }
public static void SetIdEmployeUsagerConnecte() { Employe employe = new Employe(); if (ConnexionBD.Instance().EstConnecte()) { string requete = "SELECT e.idEmploye emp, p.nom pos FROM Employes e " + "INNER JOIN Postes p ON p.idPoste = e.idPoste " + "INNER JOIN Usagers us ON e.idEmploye = us.idEmploye " + "WHERE us.nomUtilisateur = '" + UsagerConnecte.Usager.NomUtilisateur + "' "; ConnexionBD.Instance().ExecuterRequete(requete, SqlDR => { UsagerConnecte.Usager.idEmploye = SqlDR.GetInt32("emp"); UsagerConnecte.Usager.Poste = SqlDR.GetString("pos"); }); } }
public static int GetidEmploye(Employe employeRecherche) { int idEmployeTrouve = new int(); if (ConnexionBD.Instance().EstConnecte()) { string requete = "SELECT idEmploye idEmp FROM Employes e " + "JOIN Citoyens c ON c.idCitoyen = e.idCitoyen " + "WHERE e.numEmploye = '" + employeRecherche.NumEmploye + "' "; ConnexionBD.Instance().ExecuterRequete(requete, SqlDR => { idEmployeTrouve = SqlDR.GetInt32("idEmp"); }); } return(idEmployeTrouve); }