bool IntfDalCheque.updateCheque(crlCheque cheque) { #region declaration bool isUpdate = false; int nombreUpdate = 0; #endregion #region implementation if (cheque != null) { this.strCommande = "UPDATE `cheque` SET `dateCheque`='" + cheque.DateCheque.ToString("yyyy-MM-dd") + "',"; this.strCommande += " `banque`='" + cheque.Banque + "', `numerosCheque`='" + cheque.NumerosCheque + "',"; this.strCommande += " `montantCheque`='" + cheque.MontantCheque + "',`matriculeAgent`='" + cheque.MatriculeAgent + "',"; this.strCommande += " `numCompte`='" + cheque.NumCompte + "',`titulaireCheque`='" + cheque.TitulaireCheque + "',"; this.strCommande += " `adresseTitulaireCheque`='" + cheque.AdresseTitulaireCheque + "'"; this.strCommande += " WHERE `numCheque`='" + cheque.NumCheque + "'"; this.serviceConnectBase.openConnection(); nombreUpdate = this.serviceConnectBase.requete(this.strCommande); if (nombreUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } #endregion return(isUpdate); }
string IntfDalCheque.insertCheque(crlCheque cheque, string sigleAgence) { #region declaration string numCheque = ""; int nombreInsert = 0; IntfDalCheque serviceCheque = new ImplDalCheque(); #endregion #region implementation if (cheque != null) { if (sigleAgence != "") { cheque.NumCheque = serviceCheque.getNumCheque(sigleAgence); this.strCommande = "INSERT INTO `cheque` (`numCheque`,`dateCheque`,`banque`,`numerosCheque`,"; this.strCommande += " `montantCheque`,`matriculeAgent`,`numCompte`,`titulaireCheque`,`adresseTitulaireCheque`)"; this.strCommande += " VALUES ('" + cheque.NumCheque + "','" + cheque.DateCheque.ToString("yyyy-MM-dd") + "',"; this.strCommande += " '" + cheque.Banque + "','" + cheque.NumerosCheque + "','" + cheque.MontantCheque + "',"; this.strCommande += " '" + cheque.MatriculeAgent + "','" + cheque.NumCompte + "','" + cheque.TitulaireCheque + "',"; this.strCommande += " '" + cheque.AdresseTitulaireCheque + "')"; this.serviceConnectBase.openConnection(); nombreInsert = this.serviceConnectBase.requete(this.strCommande); if (nombreInsert == 1) { numCheque = cheque.NumCheque; } this.serviceConnectBase.closeConnection(); } } #endregion return(numCheque); }
crlCheque IntfDalCheque.selectCheque(string numCheque) { #region declaration crlCheque cheque = null; IntfDalAgent serviceAgent = new ImplDalAgent(); #endregion #region implementation if (numCheque != "") { this.strCommande = "SELECT * FROM `cheque` WHERE (`numCheque`='" + numCheque + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { cheque = new crlCheque(); cheque.NumCheque = this.reader["numCheque"].ToString(); cheque.NumerosCheque = this.reader["numerosCheque"].ToString(); try { cheque.DateCheque = Convert.ToDateTime(this.reader["dateCheque"].ToString()); } catch (Exception) { } try { cheque.MontantCheque = double.Parse(this.reader["montantCheque"].ToString()); } catch (Exception) { } cheque.MatriculeAgent = this.reader["matriculeAgent"].ToString(); cheque.AdresseTitulaireCheque = this.reader["adresseTitulaireCheque"].ToString(); cheque.Banque = this.reader["banque"].ToString(); cheque.NumCompte = this.reader["numCompte"].ToString(); cheque.TitulaireCheque = this.reader["titulaireCheque"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (cheque != null) { if (cheque.MatriculeAgent != "") { cheque.agent = serviceAgent.selectAgent(cheque.MatriculeAgent); } } } #endregion return(cheque); }
crlCheque IntfDalCheque.isChequeCredit(string numCheque) { #region declaration crlCheque cheque = null; #endregion #region implementation if (numCheque != "") { this.strCommande = "SELECT cheque.numCheque, cheque.banque, cheque.numerosCheque,"; this.strCommande += " cheque.dateCheque, cheque.montantCheque, cheque.matriculeAgent, cheque.numCompte,"; this.strCommande += " cheque.titulaireCheque, cheque.adresseTitulaireCheque FROM cheque"; this.strCommande += " Left Join recuabonnement ON recuabonnement.numCheque = cheque.numCheque"; this.strCommande += " WHERE recuabonnement.numCheque IS NULL AND"; this.strCommande += " cheque.numCheque = '" + numCheque + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { cheque = new crlCheque(); try { cheque.DateCheque = Convert.ToDateTime(this.reader["dateCheque"].ToString()); } catch (Exception) { } cheque.MatriculeAgent = this.reader["matriculeAgent"].ToString(); cheque.MontantCheque = double.Parse(this.reader["montantCheque"].ToString()); cheque.NumCheque = this.reader["numCheque"].ToString(); cheque.NumerosCheque = this.reader["numerosCheque"].ToString(); cheque.Banque = this.reader["banque"].ToString(); cheque.NumCompte = this.reader["numCompte"].ToString(); cheque.TitulaireCheque = this.reader["titulaireCheque"].ToString(); cheque.AdresseTitulaireCheque = this.reader["adresseTitulaireCheque"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(cheque); }