string IntfDalTarifBaseBillet.insertTarifBaseBillet(crlTarifBaseBillet tarifBaseBillet, string sigleAgence) { #region declaration IntfDalTarifBaseBillet serviceTarifBaseBillet = new ImplDalTarifBaseBillet(); int nombreInsertion = 0; string numTarifBaseBillet = ""; #endregion #region implementation if (tarifBaseBillet != null) { tarifBaseBillet.NumTarifBaseBillet = serviceTarifBaseBillet.getNumerosTarifBaseBillet(sigleAgence); this.strCommande = "INSERT INTO `tarifbasebillet` (`numTarifBaseBillet`,`montantTarifBaseBillet`)"; this.strCommande += " VALUES ('" + tarifBaseBillet.NumTarifBaseBillet + "','" + tarifBaseBillet.MontantTarifBaseBillet + "')"; this.serviceConnectBase.openConnection(); nombreInsertion = this.serviceConnectBase.requete(this.strCommande); if (nombreInsertion == 1) { numTarifBaseBillet = tarifBaseBillet.NumTarifBaseBillet; } this.serviceConnectBase.closeConnection(); } #endregion return(numTarifBaseBillet); }
bool IntfDalTarifBaseBillet.updateTarifBaseBillet(crlTarifBaseBillet tarifBaseBillet) { #region declaration bool isUpdate = false; int nbUpdate = 0; #endregion #region implementation if (tarifBaseBillet != null) { this.strCommande = "UPDATE `tarifbasebillet` SET `montantTarifBaseBillet`='" + tarifBaseBillet.MontantTarifBaseBillet.ToString("0") + "'"; this.strCommande += " WHERE (`numTarifBaseBillet`='" + tarifBaseBillet.NumTarifBaseBillet + "')"; this.serviceConnectBase.openConnection(); nbUpdate = this.serviceConnectBase.requete(this.strCommande); if (nbUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } #endregion return(isUpdate); }
crlTarifBaseBillet IntfDalTarifBaseBillet.selectTarifBaseBillet(string numTarifBaseBillet) { #region decalaration crlTarifBaseBillet tarifBaseBillet = null; #endregion #region implementation if (numTarifBaseBillet != "") { this.strCommande = "SELECT * FROM `tarifbasebillet` WHERE (`numTarifBaseBillet`='" + numTarifBaseBillet + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { tarifBaseBillet = new crlTarifBaseBillet(); tarifBaseBillet.NumTarifBaseBillet = this.reader["numTarifBaseBillet"].ToString(); try { tarifBaseBillet.MontantTarifBaseBillet = double.Parse(this.reader["montantTarifBaseBillet"].ToString()); } catch (Exception) { } } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(tarifBaseBillet); }