string IntfAutorisationVoyage.insertAutorisationVoyage(crlAutorisationVoyage AutorisationVoyage) { #region declaration int nombreInsertion = 0; string numerosAV = ""; IntfAutorisationVoyage serviceAutorisationVoyage = new ImplAutorisationVoyage(); #endregion #region implementation if (AutorisationVoyage != null) { AutorisationVoyage.NumerosAV = serviceAutorisationVoyage.getNumerosAV(AutorisationVoyage.Agent.agence.SigleAgence); this.strCommande = "INSERT INTO `autorisationvoyage` (`numerosAV`,`idVerification`,"; this.strCommande += " `matriculeAgent`,`datePrevueDepart`) "; this.strCommande += " VALUES ('" + AutorisationVoyage.NumerosAV + "','" + AutorisationVoyage.IdVerification + "'"; this.strCommande += " ,'" + AutorisationVoyage.MatriculeAgent + "','" + AutorisationVoyage.DatePrevueDepart.ToString("yyyy-MM-dd") + "')"; this.serviceConnectBase.openConnection(); nombreInsertion = this.serviceConnectBase.requete(this.strCommande); if (nombreInsertion == 1) { numerosAV = AutorisationVoyage.NumerosAV; } this.serviceConnectBase.closeConnection(); } #endregion return(numerosAV); }
void IntfAutorisationVoyage.insertToGridAutorisationSansFicheBordASC(GridView gridView, string param, string paramLike, string valueLike, string numAgence) { #region declaration IntfAutorisationVoyage serviceAutorisationVoyage = new ImplAutorisationVoyage(); #endregion #region implementation this.strCommande = "SELECT autorisationvoyage.numerosAV, autorisationvoyage.datePrevueDepart,"; this.strCommande += " itineraire.numVilleItineraireDebut, itineraire.numVilleItineraireFin, vehicule.matriculeVehicule, "; this.strCommande += " vehicule.marqueVehicule, vehicule.couleurVehicule,"; this.strCommande += " chauffeur.nomChauffeur, chauffeur.prenomChauffeur FROM autorisationvoyage"; this.strCommande += " Inner Join verification ON verification.idVerification = autorisationvoyage.idVerification"; this.strCommande += " Inner Join itineraire ON itineraire.idItineraire = verification.idItineraire"; this.strCommande += " Inner Join licence ON licence.numLicence = verification.numLicence"; this.strCommande += " Inner Join vehicule ON vehicule.numVehicule = licence.numVehicule"; this.strCommande += " Inner Join chauffeur ON chauffeur.idChauffeur = verification.idChauffeur"; this.strCommande += " Inner Join agent ON agent.matriculeAgent = autorisationvoyage.matriculeAgent"; this.strCommande += " Left Join fichebord ON fichebord.numerosAV = autorisationvoyage.numerosAV"; this.strCommande += " WHERE agent.numAgence = '" + numAgence + "' AND"; this.strCommande += " fichebord.numerosAV IS NULL AND (" + paramLike + " LIKE '%" + valueLike + "%')"; this.strCommande += " GROUP BY autorisationvoyage.numerosAV ORDER BY " + param + " ASC"; gridView.DataSource = serviceAutorisationVoyage.getDataTableAutorisationSansFicheBord(this.strCommande); gridView.DataBind(); #endregion }
crlFicheBord IntfDalFicheBord.selectFicheBord(string numerosFB) { #region declaration crlFicheBord FicheBord = null; IntfDalAgent serviceAgent = new ImplDalAgent(); IntfAutorisationVoyage serviceAutorisationVoyage = new ImplAutorisationVoyage(); IntfDalFicheBord serviceFicheBord = new ImplDalFicheBord(); IntfDalPlaceFB servicePlaceFB = new ImplDalPlaceFB(); #endregion #region implementation if (numerosFB != "") { this.strCommande = "SELECT * FROM `fichebord` WHERE (`numerosFB`='" + numerosFB + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { FicheBord = new crlFicheBord(); FicheBord.NumerosFB = reader["numerosFB"].ToString(); FicheBord.MatriculeAgent = reader["matriculeAgent"].ToString(); FicheBord.NumerosAV = reader["numerosAV"].ToString(); FicheBord.DateHeurDepart = Convert.ToDateTime(reader["dateHeurDepart"].ToString()); FicheBord.DateHeurPrevue = Convert.ToDateTime(reader["dateHeurPrevue"].ToString()); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (FicheBord != null) { FicheBord.agent = serviceAgent.selectAgent(FicheBord.MatriculeAgent); FicheBord.autorisationVoyage = serviceAutorisationVoyage.selectAutorisationVoyage(FicheBord.NumerosAV); FicheBord.commission = serviceFicheBord.getCommission(FicheBord.NumerosFB); //FicheBord.escorteVoyage = serviceFicheBord.getEscorteVoyage(FicheBord.NumerosFB); FicheBord.voyage = serviceFicheBord.getVoyage(FicheBord.NumerosFB); FicheBord.placeFB = servicePlaceFB.selectPlaceFB(FicheBord.NumerosFB); } } #endregion return(FicheBord); }
List <crlFicheBord> IntfDalFicheBord.selectFicheBord(DateTime date, string heure, string idItineraire, string numAgence) { #region declaration List <crlFicheBord> ficheBords = null; crlFicheBord tempFicheBord = null; IntfDalAgent serviceAgent = new ImplDalAgent(); IntfAutorisationVoyage serviceAutorisationVoyage = new ImplAutorisationVoyage(); IntfDalFicheBord serviceFicheBord = new ImplDalFicheBord(); IntfDalPlaceFB servicePlaceFB = new ImplDalPlaceFB(); #endregion #region implementation if (heure != "" && idItineraire != "" && numAgence != "") { this.strCommande = "SELECT (fichebord.numerosFB) AS numFB, (fichebord.matriculeAgent) AS matrAgent, (fichebord.numerosAV) AS numAV,"; this.strCommande += " fichebord.dateHeurDepart, fichebord.dateHeurPrevue FROM fichebord"; this.strCommande += " Inner Join autorisationvoyage ON autorisationvoyage.numerosAV = fichebord.numerosAV"; this.strCommande += " Inner Join verification ON verification.idVerification = autorisationvoyage.idVerification"; this.strCommande += " Left Join autorisationdepart ON autorisationdepart.numerosFB = fichebord.numerosFB"; this.strCommande += " Inner Join agent ON agent.matriculeAgent = fichebord.matriculeAgent"; this.strCommande += " WHERE fichebord.dateHeurPrevue LIKE '" + date.ToString("yyyy-MM-dd") + " " + heure + "%' AND"; this.strCommande += " autorisationdepart.numerosFB IS NULL AND"; this.strCommande += " agent.numAgence = '" + numAgence + "' AND"; this.strCommande += " verification.idItineraire = '" + idItineraire + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { ficheBords = new List <crlFicheBord>(); while (this.reader.Read()) { tempFicheBord = new crlFicheBord(); tempFicheBord.NumerosFB = reader["numFB"].ToString(); tempFicheBord.MatriculeAgent = reader["matrAgent"].ToString(); tempFicheBord.NumerosAV = reader["numAV"].ToString(); tempFicheBord.DateHeurDepart = Convert.ToDateTime(reader["dateHeurDepart"].ToString()); tempFicheBord.DateHeurPrevue = Convert.ToDateTime(reader["dateHeurPrevue"].ToString()); ficheBords.Add(tempFicheBord); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (ficheBords != null) { for (int i = 0; i < ficheBords.Count; i++) { ficheBords[i].agent = serviceAgent.selectAgent(ficheBords[i].MatriculeAgent); ficheBords[i].autorisationVoyage = serviceAutorisationVoyage.selectAutorisationVoyage(ficheBords[i].NumerosAV); ficheBords[i].commission = serviceFicheBord.getCommission(ficheBords[i].NumerosFB); //FicheBord.escorteVoyage = serviceFicheBord.getEscorteVoyage(FicheBord.NumerosFB); ficheBords[i].voyage = serviceFicheBord.getVoyage(ficheBords[i].NumerosFB); ficheBords[i].placeFB = servicePlaceFB.selectPlaceFB(ficheBords[i].NumerosFB); } } } #endregion return(ficheBords); }