crlGareRoutiere IntfDalGareRoutiere.selectGareRoutiere(string numerosGareRoutiere) { #region declaration crlGareRoutiere gareRoutiere = null; crlProvince province = null; IntfDalVille serviceVille = new ImplDalVille(); #endregion #region implementation if (numerosGareRoutiere != "") { this.strCommande = "SELECT * FROM `gareRoutiere` WHERE (`numerosGareRoutiere`='" + numerosGareRoutiere + "')"; this.serviceConnectBase.openConnection(); reader = this.serviceConnectBase.select(this.strCommande); if (reader != null) { if (reader.HasRows) { if (reader.Read()) { gareRoutiere = new crlGareRoutiere(); province = new crlProvince(); gareRoutiere.numerosGareRoutiere = reader["numerosGareRoutiere"].ToString(); gareRoutiere.nomProvince = reader["nomProvince"].ToString(); gareRoutiere.localisation = reader["localisation"].ToString(); gareRoutiere.sigleGare = reader["sigleGare"].ToString(); gareRoutiere.NumVille = reader["numVille"].ToString(); province.nomProvince = reader["nomProvince"].ToString(); gareRoutiere.province = province; } } reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (gareRoutiere != null) { if (gareRoutiere.NumVille != "") { gareRoutiere.ville = serviceVille.selectVille(gareRoutiere.NumVille); } } } #endregion return(gareRoutiere); }
crlAgent IntfDalAgent.selectAgent(string param, string paramValue) { #region declaration crlAgent agent = null; crlTypeAgent typeAgence = null; crlProvince province = null; IntfDalAgence serviceAgence = new ImplDalAgence(); IntfDalSessionCaisse serviceSessionCaisse = new ImplDalSessionCaisse(); #endregion #region implementation if (param != "" && paramValue != "") { this.strCommande = "SELECT agent.matriculeAgent, agent.numAgence, agent.typeAgent,"; this.strCommande += " agent.nomAgent, agent.prenomAgent, agent.dateNaissanceAgent, agent.lieuNaissanceAgent,"; this.strCommande += " agent.loginAgent, agent.motDePasseAgent, agent.cinAgent, agent.adresseAgent,"; this.strCommande += " agent.telephoneAgent, agent.telephoneMobileAgent, agent.imageAgent"; this.strCommande += " FROM agent WHERE (`" + param + "`='" + paramValue + "')"; this.serviceConnectBase.openConnection(); reader = this.serviceConnectBase.select(this.strCommande); if (reader != null) { if (reader.HasRows) { agent = new crlAgent(); province = new crlProvince(); typeAgence = new crlTypeAgent(); reader.Read(); agent.adresseAgent = reader["adresseAgent"].ToString(); agent.cinAgent = reader["cinAgent"].ToString(); try { agent.dateNaissanceAgent = Convert.ToDateTime(reader["dateNaissanceAgent"].ToString()); } catch (Exception) { } agent.lieuNaissanceAgent = reader["lieuNaissanceAgent"].ToString(); agent.loginAgent = reader["loginAgent"].ToString(); agent.matriculeAgent = reader["matriculeAgent"].ToString(); agent.motDePasseAgent = reader["motDePasseAgent"].ToString(); agent.nomAgent = reader["nomAgent"].ToString(); agent.numAgence = reader["numAgence"].ToString(); agent.prenomAgent = reader["prenomAgent"].ToString(); agent.telephoneAgent = reader["telephoneAgent"].ToString(); agent.telephoneMobileAgent = reader["telephoneMobileAgent"].ToString(); agent.typeAgent = reader["typeAgent"].ToString(); agent.ImageAgent = reader["imageAgent"].ToString(); agent.SituationFamilialeAgent = reader["situationFamilialeAgent"].ToString(); typeAgence.typeAgent = reader["typeAgent"].ToString(); agent.typeAgentObj = typeAgence; } reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (agent != null) { if (agent.numAgence != "") { agent.agence = serviceAgence.selectAgence(agent.numAgence); } if (agent.matriculeAgent != "") { agent.sessionCaisse = serviceSessionCaisse.getSessionCaisseEncours(agent.matriculeAgent); } } } #endregion return(agent); }