bool IntfDalUSAxe.updateUSAxe(crlUSAxe axe) { #region declaration bool isUpdate = false; int nbUpdate = 0; #endregion #region implementation if (axe != null) { this.strCommande = "UPDATE `usaxe` SET `nomAxe`='" + axe.NomAxe + "',"; this.strCommande += " `descriptionAxe`='" + axe.DescriptionAxe + "' WHERE"; this.strCommande += " `numAxe`='" + axe.NumAxe + "'"; this.serviceConnectBase.openConnection(); nbUpdate = this.serviceConnectBase.requete(this.strCommande); if (nbUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } #endregion return(isUpdate); }
string IntfDalUSAxe.insertUSAxe(crlUSAxe axe, string sigleAgence) { #region declaration string numAxe = ""; IntfDalUSAxe serviceUSAxe = new ImplDalUSAxe(); int nbInsert = 0; #endregion #region implemenation if (axe != null && sigleAgence != "") { axe.NumAxe = serviceUSAxe.getNumUSAxe(sigleAgence); this.strCommande = "INSERT INTO `usaxe` (`numAxe`,`nomAxe`,`descriptionAxe`)"; this.strCommande += " VALUES ('" + axe.NumAxe + "','" + axe.NomAxe + "',"; this.strCommande += " '" + axe.DescriptionAxe + "')"; this.serviceConnectBase.openConnection(); nbInsert = this.serviceConnectBase.requete(this.strCommande); if (nbInsert == 1) { numAxe = axe.NumAxe; } this.serviceConnectBase.closeConnection(); } #endregion return(numAxe); }
string IntfDalUSAxe.isUSAxe(crlUSAxe axe) { #region declaration string numAxe = ""; #endregion #region implementation if (axe != null) { this.strCommande = "SELECT * FROM `usaxe` WHERE (`numAxe`<>'" + axe.NumAxe + "' AND `nomAxe`='" + axe.NomAxe + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { numAxe = this.reader["numAxe"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(numAxe); }
crlUSAxe IntfDalUSAxe.selectUSAxe(string numAxe) { #region declaration crlUSAxe axe = null; #endregion #region implementation if (numAxe != "") { this.strCommande = "SELECT * FROM `usaxe` WHERE (`numAxe`='" + numAxe + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { axe = new crlUSAxe(); axe.NumAxe = this.reader["numAxe"].ToString(); axe.NomAxe = this.reader["nomAxe"].ToString(); axe.DescriptionAxe = this.reader["descriptionAxe"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(axe); }
crlUSAxe IntfDalUSAxe.selectUSAxeLieu(string numLieu) { #region declaration crlUSAxe axe = null; #endregion #region implementation if (numLieu != "") { this.strCommande = "SELECT usaxe.numAxe, usaxe.nomAxe, usaxe.descriptionAxe FROM `usaxe`"; this.strCommande += " Inner Join usassocaxelieu ON usassocaxelieu.numAxe = usaxe.numAxe"; this.strCommande += " WHERE (usassocaxelieu.numLieu='" + numLieu + "')"; this.strCommande += " ORDER BY usaxe.numAxe DESC"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { axe = new crlUSAxe(); axe.NumAxe = this.reader["numAxe"].ToString(); axe.NomAxe = this.reader["nomAxe"].ToString(); axe.DescriptionAxe = this.reader["descriptionAxe"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(axe); }