void IntfDalAutorisationDepart.insertToGridAutorisationDepart(GridView gridView, string param, string paramLike, string valueLike, string numAgence) { #region declaration IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); #endregion #region implementation this.strCommande = "SELECT Sum(recuad.montant) AS sommeRecu, fichebord.dateHeurDepart,"; this.strCommande += " fichebord.numerosFB, itineraire.numVilleItineraireDebut, itineraire.numVilleItineraireFin,"; this.strCommande += " vehicule.matriculeVehicule, chauffeur.nomChauffeur, chauffeur.prenomChauffeur, licence.nombrePlacePayante,"; this.strCommande += " vehicule.marqueVehicule, vehicule.couleurVehicule,autorisationdepart.numAutorisationDepart FROM autorisationdepart"; this.strCommande += " Inner Join prelevement ON prelevement.numAutorisationDepart = autorisationdepart.numAutorisationDepart"; this.strCommande += " Inner Join recuad ON recuad.numPrelevement = prelevement.numPrelevement"; this.strCommande += " Inner Join fichebord ON fichebord.numerosFB = autorisationdepart.numerosFB"; this.strCommande += " Inner Join autorisationvoyage ON autorisationvoyage.numerosAV = fichebord.numerosAV"; 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 = autorisationdepart.matriculeAgent"; this.strCommande += " Left Join assocautorisationdepartfacture ON assocautorisationdepartfacture.numAutorisationDepart = autorisationdepart.numAutorisationDepart"; this.strCommande += " WHERE agent.numAgence = '" + numAgence + "' AND"; this.strCommande += " assocautorisationdepartfacture.numFacture IS NULL AND"; this.strCommande += " " + paramLike + " LIKE '%" + valueLike + "%'"; this.strCommande += " GROUP BY autorisationdepart.numAutorisationDepart ORDER BY " + param + " ASC"; gridView.DataSource = serviceAutorisationDepart.getDataTableAutorisationDepart(this.strCommande); gridView.DataBind(); #endregion }
string IntfDalFacture.insertFactureAssoc(crlFacture Facture) { #region declaration string numFacture = ""; IntfDalFacture serviceFacture = new ImplDalFacture(); IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); #endregion #region implementation if (Facture != null) { if (Facture.autorisationDeparts != null) { Facture.NumFacture = serviceFacture.insertFacture(Facture); if (Facture.NumFacture != "") { for (int i = 0; i < Facture.autorisationDeparts.Count; i++) { serviceFacture.insertAssocFactureAD(Facture.NumFacture, Facture.autorisationDeparts[i].NumAutorisationDepart); Facture.autorisationDeparts[i].ResteRegle = 0; serviceAutorisationDepart.updateAutorisationDepart(Facture.autorisationDeparts[i]); } numFacture = Facture.NumFacture; } } } #endregion return(numFacture); }
string IntfDalAutorisationDepart.insertAutorisationDepart(crlAutorisationDepart AutorisationDepart) { #region declaration int nombreInsertion = 0; string numAutorisationDepart = ""; IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); #endregion #region implementation if (AutorisationDepart != null) { AutorisationDepart.NumAutorisationDepart = serviceAutorisationDepart.getNumAutorisationDepart(AutorisationDepart.agent.agence.SigleAgence); this.strCommande = "INSERT INTO `autorisationdepart` (`numAutorisationDepart`"; this.strCommande += " ,`numerosFB`,`matriculeAgent`,`dateAD`,`recetteTotale`,`resteRegle`) "; this.strCommande += " VALUES ('" + AutorisationDepart.NumAutorisationDepart + "'"; this.strCommande += " ,'" + AutorisationDepart.NumerosFB + "','" + AutorisationDepart.MatriculeAgent + "',"; this.strCommande += " '" + AutorisationDepart.DateAD.ToString("yyyy-MM-dd") + "','" + AutorisationDepart.RecetteTotale + "',"; this.strCommande += " '" + AutorisationDepart.ResteRegle + "')"; this.serviceConnectBase.openConnection(); nombreInsertion = this.serviceConnectBase.requete(this.strCommande); if (nombreInsertion == 1) { numAutorisationDepart = AutorisationDepart.NumAutorisationDepart; } this.serviceConnectBase.closeConnection(); } #endregion return(numAutorisationDepart); }
List <crlAutorisationDepart> IntfDalFacture.selectADForFacture(string numFacture) { #region declaration List <crlAutorisationDepart> autorisationDeparts = null; IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); #endregion #region implementation if (numFacture != "") { this.strCommande = "SELECT autorisationdepart.numAutorisationDepart FROM autorisationdepart"; this.strCommande += " Inner Join assocautorisationdepartfacture ON assocautorisationdepartfacture.numAutorisationDepart = autorisationdepart.numAutorisationDepart"; this.strCommande += " WHERE assocautorisationdepartfacture.numFacture = '" + numFacture + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { autorisationDeparts = new List <crlAutorisationDepart>(); while (this.reader.Read()) { autorisationDeparts.Add(serviceAutorisationDepart.selectAutorisationDepart(this.reader["numAutorisationDepart"].ToString())); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(autorisationDeparts); }
bool IntfDalRecuAD.isValideMontant(double montant, string numAutorisationDepart) { #region declaration bool isValide = false; IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); IntfDalFicheBord serviceFicheBord = new ImplDalFicheBord(); crlAutorisationDepart autorisationDepart = null; double montantFacture = 0.00; double montantReste = 0.00; #endregion #region implementation if (numAutorisationDepart != "") { autorisationDepart = serviceAutorisationDepart.selectAutorisationDepart(numAutorisationDepart); if (autorisationDepart != null) { /*montantFacture = serviceFicheBord.getPrixTotalBagage(autorisationDepart.NumerosFB) + * serviceFicheBord.getPrixTotalBillet(autorisationDepart.NumerosFB) + * serviceFicheBord.getPrixTotalCommission(autorisationDepart.NumerosFB); * * montantReste = montantFacture - serviceAutorisationDepart.getMontanRecu(numAutorisationDepart);*/ if (autorisationDepart.ResteRegle >= montant) { isValide = true; } } } #endregion return(isValide); }
crlPrelevement IntfDalPrelevement.selectPrelevement(string numPrelevement) { #region declaration crlPrelevement Prelevement = null; IntfDalAgent serviceAgent = new ImplDalAgent(); IntfDalTypePrelevement serviceTypePrelevement = new ImplDalTypePrelevement(); IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); #endregion #region implementation if (numPrelevement != "") { this.strCommande = "SELECT * FROM `prelevement` WHERE (`numPrelevement`='" + numPrelevement + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { Prelevement = new crlPrelevement(); Prelevement.NumPrelevement = this.reader["numPrelevement"].ToString(); Prelevement.DatePrelevement = Convert.ToDateTime(this.reader["datePrelevement"].ToString()); Prelevement.MatriculeAgent = this.reader["matriculeAgent"].ToString(); Prelevement.MontantPrelevement = double.Parse(this.reader["montantPrelevement"].ToString()); Prelevement.NumAutorisationDepart = this.reader["numAutorisationDepart"].ToString(); Prelevement.TypePrelevement = this.reader["typePrelevement"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (Prelevement != null) { if (Prelevement.MatriculeAgent != "") { Prelevement.agent = serviceAgent.selectAgent(Prelevement.MatriculeAgent); } if (Prelevement.NumAutorisationDepart != "") { Prelevement.autorisationDepart = serviceAutorisationDepart.selectAutorisationDepart(Prelevement.NumAutorisationDepart); } if (Prelevement.TypePrelevement != "") { Prelevement.objTypePrelevement = serviceTypePrelevement.selectTypePrelevement(Prelevement.TypePrelevement); } } } #endregion return(Prelevement); }
List <crlAutorisationDepart> IntfDalVehicule.getAutorisationDepartsForFacture(string numVehicule) { #region declaration List <crlAutorisationDepart> autorisationDepart = null; IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); #endregion #region implementation if (numVehicule != "") { this.strCommande = "SELECT autorisationdepart.numAutorisationDepart FROM autorisationdepart"; this.strCommande += " Inner Join fichebord ON fichebord.numerosFB = autorisationdepart.numerosFB"; this.strCommande += " Inner Join autorisationvoyage ON autorisationvoyage.numerosAV = fichebord.numerosAV"; this.strCommande += " Inner Join verification ON verification.idVerification = autorisationvoyage.idVerification"; this.strCommande += " Inner Join licence ON licence.numLicence = verification.numLicence"; this.strCommande += " WHERE licence.numVehicule = '" + numVehicule + "' AND"; this.strCommande += " autorisationdepart.resteRegle > '0'"; this.serviceConnection.openConnection(); this.reader = this.serviceConnection.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { autorisationDepart = new List <crlAutorisationDepart>(); while (this.reader.Read()) { autorisationDepart.Add(serviceAutorisationDepart.selectAutorisationDepart(this.reader["numAutorisationDepart"].ToString())); } } this.reader.Dispose(); } this.serviceConnection.closeConnection(); } #endregion return(autorisationDepart); }
DataTable IntfDalProprietaire.getDataTableVoyageVoitureProprietaire(string strRqst) { #region declaration DataTable dataTable = new DataTable(); IntfDalVille serviceVille = new ImplDalVille(); IntfDalFicheBord serviceFicheBord = new ImplDalFicheBord(); IntfDalAutorisationDepart serviceAutorisationDepart = new ImplDalAutorisationDepart(); IntfDalGeneral serviceGeneral = new ImplDalGeneral(); crlVille villeD = new crlVille(); crlVille villeF = new crlVille(); #endregion #region implementation #region initialisation du dataTable dataTable = new DataTable(); dataTable.Columns.Add("vehicule", typeof(string)); dataTable.Columns.Add("chauffeur", typeof(string)); dataTable.Columns.Add("dateVoyage", typeof(DateTime)); dataTable.Columns.Add("Itineraire", typeof(string)); dataTable.Columns.Add("recette", typeof(string)); dataTable.Columns.Add("reste", typeof(string)); DataRow dr; #endregion this.serviceConnection.openConnection(); this.reader = this.serviceConnection.select(strRqst); if (this.reader != null) { if (this.reader.HasRows) { while (this.reader.Read()) { dr = dataTable.NewRow(); dr["vehicule"] = reader["matriculeVehicule"].ToString() + " " + reader["marqueVehicule"]; dr["chauffeur"] = reader["nomChauffeur"].ToString() + " " + reader["prenomChauffeur"].ToString(); dr["dateVoyage"] = Convert.ToDateTime(reader["dateHeurDepart"].ToString()); villeD = serviceVille.selectVille(reader["numVilleItineraireDebut"].ToString()); villeF = serviceVille.selectVille(reader["numVilleItineraireFin"].ToString()); if (villeD != null && villeF != null) { dr["Itineraire"] = villeD.NomVille + "-" + villeF.NomVille; } else { dr["Itineraire"] = reader["numVilleItineraireDebut"].ToString() + "-" + reader["numVilleItineraireFin"].ToString(); } dr["recette"] = serviceGeneral.separateurDesMilles(reader["recetteTotale"].ToString()) + "Ar"; dr["reste"] = serviceGeneral.separateurDesMilles(reader["resteRegle"].ToString()) + "Ar"; dataTable.Rows.Add(dr); } } this.reader.Dispose(); } this.serviceConnection.closeConnection(); #endregion return(dataTable); }