bool IntfDalVoyage.deleteVoyage(crlVoyage Voyage) { #region declaration bool isDelete = false; int nombreDelete = 0; #endregion #region implementation if (Voyage != null) { if (Voyage.IdVoyage != "") { this.strCommande = "DELETE FROM `voyage` WHERE (`idVoyage` = '" + Voyage.IdVoyage + "')"; this.serviceConnectBase.openConnection(); nombreDelete = this.serviceConnectBase.requete(this.strCommande); if (nombreDelete == 1) { isDelete = true; } this.serviceConnectBase.closeConnection(); } } #endregion return(isDelete); }
string IntfDalVoyage.insertVoyage(crlVoyage Voyage, string sigleAgence) { #region declaration IntfDalVoyage serviceVoyage = new ImplDalVoyage(); int nombreInsertion = 0; string idVoyage = ""; #endregion #region implementation if (Voyage != null) { Voyage.IdVoyage = serviceVoyage.getIdVoyage(sigleAgence); this.strCommande = "INSERT INTO `voyage` (`idVoyage`,`numIndividu`,`numerosFB`,`poidBagage`"; this.strCommande += ",`destination`,`numBillet`,`numPlace`,`pieceIdentite`)"; this.strCommande += " VALUES ('" + Voyage.IdVoyage + "', '" + Voyage.NumIndividu + "', '" + Voyage.NumerosFB + "'"; this.strCommande += ",'" + Voyage.PoidBagage + "','" + Voyage.Destination + "','" + Voyage.NumBillet + "'"; this.strCommande += ",'" + Voyage.NumPlace + "','" + Voyage.PieceIdentite + "')"; this.serviceConnectBase.openConnection(); nombreInsertion = this.serviceConnectBase.requete(this.strCommande); if (nombreInsertion == 1) { idVoyage = Voyage.IdVoyage; } this.serviceConnectBase.closeConnection(); } #endregion return(idVoyage); }
bool IntfDalVoyage.updateVoyage(crlVoyage Voyage) { #region declaration bool isUpdate = false; int nombreUpdate = 0; #endregion #region implementation if (Voyage != null) { if (Voyage.IdVoyage != "") { this.strCommande = "UPDATE `voyage` SET `numIndividu`='" + Voyage.NumIndividu + "', `numerosFB`='" + Voyage.NumerosFB + "',"; this.strCommande += "`poidBagage`='" + Voyage.PoidBagage + "', `destination`='" + Voyage.Destination + "', "; this.strCommande += "`numBillet`='" + Voyage.NumBillet + "', `numPlace`='" + Voyage.NumPlace + "', "; this.strCommande += "`pieceIdentite`='" + Voyage.PieceIdentite + "' "; this.strCommande += "WHERE (`idVoyage`='" + Voyage.IdVoyage + "')"; this.serviceConnectBase.openConnection(); nombreUpdate = this.serviceConnectBase.requete(this.strCommande); if (nombreUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } } #endregion return(isUpdate); }
bool IntfDalVoyage.deleteAllVoyage(string idVoyage) { #region declaration crlVoyage voyage = null; bool isDelete = false; IntfDalVoyage serviceVoyage = new ImplDalVoyage(); IntfDalRecu serviceRecu = new ImplDalRecu(); IntfDalBagage serviceBagage = new ImplDalBagage(); #endregion #region implementation if (idVoyage != "") { voyage = serviceVoyage.selectVoyage(idVoyage); if (voyage != null) { serviceBagage.deleteAssociationBagageVoyage(voyage.IdVoyage); if (voyage.bagage != null) { serviceRecu.deleteRecu(voyage.bagage.NumRecu); serviceBagage.deleteBagage(voyage.bagage.IdBagage); } isDelete = serviceVoyage.deleteVoyage(idVoyage); } } #endregion return(isDelete); }
crlVoyage IntfDalVoyage.selectVoyage(string idVoyage) { #region declaration crlVoyage Voyage = null; IntfDalBagage serviceBagage = new ImplDalBagage(); IntfDalIndividu serviceIndividu = new ImplDalIndividu(); IntfDalBillet serviceBillet = new ImplDalBillet(); IntfDalPlaceFB servicePlaceFB = new ImplDalPlaceFB(); #endregion #region implementation if (idVoyage != "") { this.strCommande = "SELECT * FROM `voyage` WHERE (`idVoyage`='" + idVoyage + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { Voyage = new crlVoyage(); Voyage.IdVoyage = reader["idVoyage"].ToString(); Voyage.NumIndividu = reader["numIndividu"].ToString(); Voyage.NumerosFB = reader["numerosFB"].ToString(); try { Voyage.PoidBagage = double.Parse(reader["poidBagage"].ToString()); } catch (Exception) {} Voyage.Destination = reader["destination"].ToString(); Voyage.NumBillet = reader["numBillet"].ToString(); Voyage.NumPlace = reader["numPlace"].ToString(); Voyage.PieceIdentite = reader["pieceIdentite"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (Voyage != null) { Voyage.billet = serviceBillet.selectBillet(Voyage.NumBillet); Voyage.individu = serviceIndividu.selectIndividu(Voyage.NumIndividu); Voyage.placeFB = servicePlaceFB.selectPlaceFB(Voyage.NumerosFB, Voyage.NumPlace); Voyage.bagage = serviceBagage.selectBagageForVoyage(Voyage.IdVoyage); } } #endregion return(Voyage); }
List <crlVoyage> IntfDalFicheBord.getVoyage(string numerosFB) { #region declaration List <crlVoyage> Voyages = new List <crlVoyage>(); crlVoyage tempVoyage = null; IntfDalBagage serviceBagage = new ImplDalBagage(); IntfDalIndividu serviceIndividu = new ImplDalIndividu(); IntfDalBillet serviceBillet = new ImplDalBillet(); IntfDalPlaceFB servicePlaceFB = new ImplDalPlaceFB(); #endregion #region implementation if (numerosFB != "") { this.strCommande = "SELECT * FROM `voyage` WHERE (`numerosFB`='" + numerosFB + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { while (this.reader.Read()) { tempVoyage = new crlVoyage(); tempVoyage.IdVoyage = reader["idVoyage"].ToString(); tempVoyage.NumIndividu = reader["numIndividu"].ToString(); tempVoyage.NumerosFB = reader["numerosFB"].ToString(); try { tempVoyage.PoidBagage = double.Parse(reader["poidBagage"].ToString()); } catch (Exception) {} tempVoyage.Destination = reader["destination"].ToString(); tempVoyage.NumBillet = reader["numBillet"].ToString(); tempVoyage.NumPlace = reader["numPlace"].ToString(); tempVoyage.PieceIdentite = reader["pieceIdentite"].ToString(); Voyages.Add(tempVoyage); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); for (int i = 0; i < Voyages.Count; i++) { if (Voyages[i] != null) { Voyages[i].billet = serviceBillet.selectBillet(Voyages[i].NumBillet); Voyages[i].individu = serviceIndividu.selectIndividu(Voyages[i].NumIndividu); Voyages[i].placeFB = servicePlaceFB.selectPlaceFB(Voyages[i].NumerosFB, Voyages[i].NumPlace); Voyages[i].bagage = serviceBagage.selectBagageForVoyage(Voyages[i].IdVoyage); } } } #endregion return(Voyages); }
int IntfDalVoyage.isVoyage(crlVoyage Voyage) { throw new NotImplementedException(); }