bool IntfDalBillet.deleteBillet(crlBillet Billet) { #region declaration bool isDelete = false; int nombreDelete = 0; #endregion #region implementation if (Billet != null) { if (Billet.NumBillet != "") { this.strCommande = "DELETE FROM `billet` WHERE (`numBillet` = '" + Billet.NumBillet + "')"; this.serviceConnectBase.openConnection(); nombreDelete = this.serviceConnectBase.requete(this.strCommande); if (nombreDelete == 1) { isDelete = true; } this.serviceConnectBase.closeConnection(); } } #endregion return(isDelete); }
public List <crlBillet> getBillet(crlBilletCommande billetCommande, crlAgent agent) { #region declaration List <crlBillet> billets = null; crlBillet tempBillet = null; #endregion #region implementation if (billetCommande != null && agent != null) { if (billetCommande.NombreBilletCommande > 0) { billets = new List <crlBillet>(); for (int i = 0; i < billetCommande.NombreBilletCommande; i++) { tempBillet = new crlBillet(); tempBillet.agent = agent; tempBillet.calculCategorieBillet = billetCommande.calculCategorieBillet; tempBillet.calculReductionBillet = billetCommande.calculReductionBillet; try { tempBillet.DateDeValidite = DateTime.Now.AddMonths(int.Parse(ReGlobalParam.nbValiditeBillet)); } catch (Exception) { tempBillet.DateDeValidite = DateTime.Now.AddMonths(1); } tempBillet.MatriculeAgent = agent.matriculeAgent; tempBillet.ModePaiement = "Commande"; tempBillet.NumCalculCategorieBillet = billetCommande.NumCalculCategorieBillet; tempBillet.NumCalculReductionBillet = billetCommande.NumCalculReductionBillet; tempBillet.NumTrajet = billetCommande.NumTrajet; tempBillet.PrixBillet = billetCommande.MontantBilletCommande.ToString("0"); tempBillet.trajet = billetCommande.trajet; tempBillet.NumIndividu = billetCommande.NumIndividu; tempBillet.individu = billetCommande.individu; tempBillet.NumBilletCommande = billetCommande.NumBilletCommande; billets.Add(tempBillet); tempBillet = null; } } } #endregion return(billets); }
public crlVoyage() { this.NumIndividu = ""; this.IdVoyage = ""; this.NumerosFB = ""; this.NumBillet = ""; this.Destination = ""; this.NumPlace = ""; this.PieceIdentite = ""; this.poidBagage = 0.00; this.bagage = null; this.individu = null; this.billet = null; this.placeFB = null; }
string IntfDalBillet.insertBillet(crlBillet Billet) { #region declaration string numBillet = ""; int nombreInsert = 0; IntfDalBillet serviceBillet = new ImplDalBillet(); string modePaiement = ""; string numIndividu = ""; string numCalculCategorieBillet = ""; string numCalculReductionBillet = ""; string numTrajet = "NULL"; string numDureeAbonnement = "NULL"; string numVoyageAbonnement = "NULL"; string numBilletCommande = "NULL"; #endregion #region implementation if (Billet != null) { if (Billet.ModePaiement != "") { modePaiement = "'" + Billet.ModePaiement + "'"; } else { modePaiement = "NULL"; } if (Billet.NumIndividu != "") { numIndividu = "'" + Billet.NumIndividu + "'"; } else { numIndividu = "NULL"; } if (Billet.NumCalculCategorieBillet != "") { numCalculCategorieBillet = "'" + Billet.NumCalculCategorieBillet + "'"; } else { numCalculCategorieBillet = "NULL"; } if (Billet.NumCalculReductionBillet != "") { numCalculReductionBillet = "'" + Billet.NumCalculReductionBillet + "'"; } else { numCalculReductionBillet = "NULL"; } if (Billet.NumTrajet != "") { numTrajet = "'" + Billet.NumTrajet + "'"; } if (Billet.NumDureeAbonnement != "") { numDureeAbonnement = "'" + Billet.NumDureeAbonnement + "'"; } if (Billet.NumVoyageAbonnement != "") { numVoyageAbonnement = "'" + Billet.NumVoyageAbonnement + "'"; } if (Billet.NumBilletCommande != "") { numBilletCommande = "'" + Billet.NumBilletCommande + "'"; } Billet.NumBillet = serviceBillet.getNumBillet(Billet.agent.agence.SigleAgence); this.strCommande = "INSERT INTO `billet` (`numBillet`,`dateDeValidite`,`numTrajet`,`modePaiement`,`numIndividu`,`matriculeAgent`,"; this.strCommande += " `prixBillet`,`numCalculCategorieBillet`,`numCalculReductionBillet`,`dateBillet`,`numDureeAbonnement`,"; this.strCommande += " `numVoyageAbonnement`,`numBilletCommande`)"; this.strCommande += " VALUES ('" + Billet.NumBillet + "','" + Billet.DateDeValidite.ToString("yyyy-MM-dd") + "',"; this.strCommande += " " + numTrajet + "," + modePaiement + "," + numIndividu + ","; this.strCommande += " '" + Billet.MatriculeAgent + "','" + Billet.PrixBillet + "'," + numCalculCategorieBillet + ","; this.strCommande += " " + numCalculReductionBillet + ",'" + Billet.DateBillet.ToString("yyyy-MM-dd") + "',"; this.strCommande += " " + numDureeAbonnement + "," + numVoyageAbonnement + "," + numBilletCommande + ")"; this.serviceConnectBase.openConnection(); nombreInsert = this.serviceConnectBase.requete(this.strCommande); if (nombreInsert == 1) { numBillet = Billet.NumBillet; } this.serviceConnectBase.closeConnection(); } #endregion return(numBillet); }
crlBillet IntfDalBillet.isValide(string numBillet, string idItineraire) { #region declaration crlBillet Billet = null; IntfDalTrajet serviceTrajet = new ImplDalTrajet(); IntfDalIndividu serviceIndividu = new ImplDalIndividu(); IntfDalAgent serviceAgent = new ImplDalAgent(); IntfDalCalculCategorieBillet serviceCalculCategorieBillet = new ImplDalCalculCategorieBillet(); IntfDalCalculReductionBillet serviceCalculReductionBillet = new ImplDalCalculReductionBillet(); #endregion #region implementation if (numBillet != "") { this.strCommande = "SELECT billet.numBillet, billet.dateDeValidite, billet.numTrajet,"; this.strCommande += " billet.modePaiement, billet.numIndividu, billet.matriculeAgent, billet.prixBillet,"; this.strCommande += " billet.numCalculCategorieBillet, billet.numCalculReductionBillet, billet.dateBillet,"; this.strCommande += " billet.numDureeAbonnement, billet.numVoyageAbonnement, billet.numBilletCommande FROM billet"; this.strCommande += " Left Join voyage ON voyage.numBillet = billet.numBillet"; this.strCommande += " Inner Join trajet ON trajet.numTrajet = billet.numTrajet"; this.strCommande += " Inner Join associationtrajetitineraire ON associationtrajetitineraire.numTrajet = trajet.numTrajet"; this.strCommande += " WHERE voyage.numBillet IS NULL AND"; this.strCommande += " billet.numBillet = '" + numBillet + "' AND"; this.strCommande += " billet.dateDeValidite >= '" + DateTime.Now.ToString("yyyyMMdd") + "' AND"; this.strCommande += " associationtrajetitineraire.idItineraire = '" + idItineraire + "'"; this.serviceConnectBase.openConnection(); reader = this.serviceConnectBase.select(this.strCommande); if (reader != null) { if (reader.HasRows) { if (reader.Read()) { Billet = new crlBillet(); Billet.NumBillet = reader["numBillet"].ToString(); Billet.DateDeValidite = Convert.ToDateTime(reader["dateDeValidite"].ToString()); Billet.NumTrajet = reader["numTrajet"].ToString(); Billet.ModePaiement = reader["modePaiement"].ToString(); Billet.NumIndividu = reader["numIndividu"].ToString(); Billet.MatriculeAgent = reader["matriculeAgent"].ToString(); Billet.PrixBillet = reader["prixBillet"].ToString(); Billet.NumCalculCategorieBillet = reader["numCalculCategorieBillet"].ToString(); Billet.NumCalculReductionBillet = reader["numCalculReductionBillet"].ToString(); Billet.DateBillet = Convert.ToDateTime(reader["dateBillet"].ToString()); Billet.NumDureeAbonnement = reader["numDureeAbonnement"].ToString(); Billet.NumVoyageAbonnement = reader["numVoyageAbonnement"].ToString(); Billet.NumBilletCommande = reader["numBilletCommande"].ToString(); } } reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (Billet != null) { if (Billet.NumTrajet != "") { Billet.trajet = serviceTrajet.selectTrajet(Billet.NumTrajet); } if (Billet.NumIndividu != "") { Billet.individu = serviceIndividu.selectIndividu(Billet.NumIndividu); } if (Billet.MatriculeAgent != "") { Billet.agent = serviceAgent.selectAgent(Billet.MatriculeAgent); } if (Billet.NumCalculCategorieBillet != "") { Billet.calculCategorieBillet = serviceCalculCategorieBillet.selectCalculCategorieBillet(Billet.NumCalculCategorieBillet); } if (Billet.NumCalculReductionBillet != "") { Billet.calculReductionBillet = serviceCalculReductionBillet.selectCalculReductionBillet(Billet.NumCalculReductionBillet); } } } #endregion return(Billet); }
crlBillet IntfDalBillet.selectBillet(string numBillet) { #region declaration crlBillet Billet = null; IntfDalTrajet serviceTrajet = new ImplDalTrajet(); IntfDalIndividu serviceIndividu = new ImplDalIndividu(); IntfDalAgent serviceAgent = new ImplDalAgent(); IntfDalCalculCategorieBillet serviceCalculCategorieBillet = new ImplDalCalculCategorieBillet(); IntfDalCalculReductionBillet serviceCalculReductionBillet = new ImplDalCalculReductionBillet(); #endregion #region implementation if (numBillet != "") { this.strCommande = "SELECT * FROM `billet` WHERE (`numBillet`='" + numBillet + "')"; this.serviceConnectBase.openConnection(); reader = this.serviceConnectBase.select(this.strCommande); if (reader != null) { if (reader.HasRows) { if (reader.Read()) { Billet = new crlBillet(); Billet.NumBillet = reader["numBillet"].ToString(); Billet.DateDeValidite = Convert.ToDateTime(reader["dateDeValidite"].ToString()); Billet.NumTrajet = reader["numTrajet"].ToString(); Billet.ModePaiement = reader["modePaiement"].ToString(); Billet.NumIndividu = reader["numIndividu"].ToString(); Billet.MatriculeAgent = reader["matriculeAgent"].ToString(); Billet.PrixBillet = reader["prixBillet"].ToString(); Billet.NumCalculCategorieBillet = reader["numCalculCategorieBillet"].ToString(); Billet.NumCalculReductionBillet = reader["numCalculReductionBillet"].ToString(); Billet.DateBillet = Convert.ToDateTime(reader["dateBillet"].ToString()); Billet.NumDureeAbonnement = reader["numDureeAbonnement"].ToString(); Billet.NumVoyageAbonnement = reader["numVoyageAbonnement"].ToString(); Billet.NumBilletCommande = reader["numBilletCommande"].ToString(); } } reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (Billet != null) { if (Billet.NumTrajet != "") { Billet.trajet = serviceTrajet.selectTrajet(Billet.NumTrajet); } if (Billet.NumIndividu != "") { Billet.individu = serviceIndividu.selectIndividu(Billet.NumIndividu); } if (Billet.MatriculeAgent != "") { Billet.agent = serviceAgent.selectAgent(Billet.MatriculeAgent); } if (Billet.NumCalculCategorieBillet != "") { Billet.calculCategorieBillet = serviceCalculCategorieBillet.selectCalculCategorieBillet(Billet.NumCalculCategorieBillet); } if (Billet.NumCalculReductionBillet != "") { Billet.calculReductionBillet = serviceCalculReductionBillet.selectCalculReductionBillet(Billet.NumCalculReductionBillet); } } } #endregion return(Billet); }
bool IntfDalBillet.updateBillet(crlBillet Billet) { #region declaration bool isUpdate = false; int nombreUpdate = 0; string modePaiement = ""; string numIndividu = ""; string numCalculCategorieBillet = ""; string numCalculReductionBillet = ""; string numTrajet = "NULL"; string numDureeAbonnement = "NULL"; string numVoyageAbonnement = "NULL"; string numBilletCommande = "NULL"; #endregion #region implementation if (Billet != null) { if (Billet.NumBillet != "") { if (Billet.ModePaiement != "") { modePaiement = "'" + Billet.ModePaiement + "'"; } else { modePaiement = "NULL"; } if (Billet.NumIndividu != "") { numIndividu = "'" + Billet.NumIndividu + "'"; } else { numIndividu = "NULL"; } if (Billet.NumCalculCategorieBillet != "") { numCalculCategorieBillet = "'" + Billet.NumCalculCategorieBillet + "'"; } else { numCalculCategorieBillet = "NULL"; } if (Billet.NumCalculReductionBillet != "") { numCalculReductionBillet = "'" + Billet.NumCalculReductionBillet + "'"; } else { numCalculReductionBillet = "NULL"; } if (Billet.NumTrajet != "") { numTrajet = "'" + Billet.NumTrajet + "'"; } if (Billet.NumDureeAbonnement != "") { numDureeAbonnement = "'" + Billet.NumDureeAbonnement + "'"; } if (Billet.NumVoyageAbonnement != "") { numVoyageAbonnement = "'" + Billet.NumVoyageAbonnement + "'"; } if (Billet.NumBilletCommande != "") { numBilletCommande = "'" + Billet.NumBilletCommande + "'"; } this.strCommande = "UPDATE `billet` SET `dateDeValidite`='" + Billet.DateDeValidite.ToString("yyyy-MM-dd") + "',"; this.strCommande += " `numTrajet`=" + numTrajet + ",`modePaiement`=" + modePaiement + ", `numIndividu`=" + numIndividu + ","; this.strCommande += " `matriculeAgent`= '" + Billet.MatriculeAgent + "', `prixBillet`='" + Billet.PrixBillet + "',"; this.strCommande += " `numCalculCategorieBillet`=" + numCalculCategorieBillet + ",`numCalculReductionBillet`=" + numCalculReductionBillet + ","; this.strCommande += " `dateBillet`='" + Billet.DateBillet.ToString("yyyy-MM-dd") + "',`numDureeAbonnement`=" + numDureeAbonnement + ","; this.strCommande += " `numVoyageAbonnement`=" + numVoyageAbonnement + ",`numBilletCommande`=" + numBilletCommande; this.strCommande += " WHERE (`numBillet`='" + Billet.NumBillet + "')"; this.serviceConnectBase.openConnection(); nombreUpdate = this.serviceConnectBase.requete(this.strCommande); if (nombreUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } } #endregion return(isUpdate); }