crlAgent IntfDalAgent.login(string login, string motDePasse) { #region declaration crlAgent agent = new crlAgent(); IntfDalAgence serviceAgence = new ImplDalAgence(); IntfDalSessionCaisse serviceSessionCaisse = new ImplDalSessionCaisse(); #endregion #region implementation if (login != "" && motDePasse != "") { this.strCommande = "SELECT * FROM `agent` WHERE (`loginAgent`='" + login + "' AND `motDePasseAgent`='" + motDePasse + "')"; this.serviceConnectBase.openConnection(); reader = this.serviceConnectBase.select(this.strCommande); if (reader != null) { if (reader.HasRows) { reader.Read(); agent.adresseAgent = reader["adresseAgent"].ToString(); agent.cinAgent = reader["cinAgent"].ToString(); agent.dateNaissanceAgent = Convert.ToDateTime(reader["dateNaissanceAgent"].ToString()); 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(); } 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); }
void IntfDalAgence.insertToGridAgenceListe(GridView gridView, string param, string paramLike, string valueLike) { #region declaration IntfDalAgence serviceAgence = new ImplDalAgence(); #endregion #region implementation this.strCommande = "SELECT agence.numAgence, agence.typeAgence, agence.numVille,"; this.strCommande += " agence.sigleAgence, agence.nomAgence, agence.localisationAgence"; this.strCommande += " FROM agence WHERE"; this.strCommande += " " + paramLike + " LIKE '%" + valueLike + "%'"; this.strCommande += " ORDER BY " + param + " ASC"; gridView.DataSource = serviceAgence.getDataTableAgenceListe(this.strCommande); gridView.DataBind(); #endregion }
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); }
DataTable IntfDalAgence.getDataTableAgenceListe(string strRqst) { #region declaration DataTable dataTable = new DataTable(); crlAgence agence = null; IntfDalVille serviceVille = new ImplDalVille(); IntfDalAgence serviceAgence = new ImplDalAgence(); crlVille ville = null; #endregion #region implemntation #region initialisation du dataTable dataTable = new DataTable(); dataTable.Columns.Add("numAgence", typeof(string)); dataTable.Columns.Add("villeAgence", typeof(string)); dataTable.Columns.Add("nomAgence", typeof(string)); dataTable.Columns.Add("localisation", typeof(string)); dataTable.Columns.Add("typeAgence", typeof(string)); dataTable.Columns.Add("sigleAgence", typeof(string)); dataTable.Columns.Add("statut", typeof(string)); DataRow dr; #endregion this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(strRqst); if (this.reader != null) { if (this.reader.HasRows) { while (this.reader.Read()) { dr = dataTable.NewRow(); agence = serviceAgence.selectAgence(this.reader["numAgence"].ToString()); dr["numAgence"] = this.reader["numAgence"].ToString(); ville = serviceVille.selectVille(this.reader["numVille"].ToString()); if (ville != null) { dr["villeAgence"] = ville.NomVille; } else { dr["villeAgence"] = this.reader["numVille"].ToString(); } dr["nomAgence"] = this.reader["nomAgence"].ToString(); dr["sigleAgence"] = this.reader["sigleAgence"].ToString(); dr["localisation"] = this.reader["localisationAgence"].ToString(); dr["typeAgence"] = this.reader["typeAgence"].ToString(); if (agence.sessionAgence != null) { dr["statut"] = "vert16.png"; } else { dr["statut"] = "rouge16.png"; } dataTable.Rows.Add(dr); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); #endregion return(dataTable); }
crlProprietaire IntfDalProprietaire.selectProprietaire(string numProprietaire) { #region declaration crlProprietaire proprietaire = null; IntfDalIndividu serviceIndividu = new ImplDalIndividu(); IntfDalTypeProprietaire serviceTypeProprietaire = new ImplDalTypeProprietaire(); IntfDalAgence serviceAgence = new ImplDalAgence(); IntfDalSociete serviceSociete = new ImplDalSociete(); IntfDalOrganisme serviceOrganisme = new ImplDalOrganisme(); #endregion #region implementation if (numProprietaire != "") { this.strCommande = "SELECT * FROM `proprietaire` WHERE (`numProprietaire`='" + numProprietaire + "')"; this.serviceConnection.openConnection(); if (this.serviceConnection.IsConnection) { this.reader = this.serviceConnection.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { proprietaire = new crlProprietaire(); proprietaire.NumProprietaire = this.reader["numProprietaire"].ToString(); proprietaire.NumIndividu = this.reader["numIndividu"].ToString(); proprietaire.NumOrganisme = this.reader["numOrganisme"].ToString(); proprietaire.NumSociete = this.reader["numSociete"].ToString(); proprietaire.TypeProprietaire = this.reader["typeProprietaire"].ToString(); proprietaire.NumAgence = this.reader["numAgence"].ToString(); } } this.reader.Dispose(); } while (this.serviceConnection.IsConnection) { this.serviceConnection.closeConnection(); } } if (proprietaire != null) { if (proprietaire.NumIndividu != "") { proprietaire.Individu = serviceIndividu.selectIndividu(proprietaire.NumIndividu); } if (proprietaire.TypeProprietaire != "") { proprietaire.typeProprietaireObj = serviceTypeProprietaire.selectTypeProprietaire(proprietaire.TypeProprietaire); } if (proprietaire.NumAgence != "") { proprietaire.agence = serviceAgence.selectAgence(proprietaire.NumAgence); } if (proprietaire.NumOrganisme != "") { proprietaire.organisme = serviceOrganisme.selectOrganisme(proprietaire.NumOrganisme); } if (proprietaire.NumSociete != "") { proprietaire.societe = serviceSociete.selectSociete(proprietaire.NumSociete); } } } #endregion return(proprietaire); }