crlVoyageAbonnement IntfDalVoyageAbonnementDevis.getVoyageAbonnement(crlVoyageAbonnementDevis voyageAbonnementDevis, crlAgent agent) { #region declaration crlVoyageAbonnement abonnementVoyage = null; #endregion #region implementation if (voyageAbonnementDevis != null && agent != null) { abonnementVoyage = new crlVoyageAbonnement(); abonnementVoyage.agent = agent; abonnementVoyage.calculCategorieBillet = voyageAbonnementDevis.calculCategorieBillet; abonnementVoyage.calculReductionBillet = voyageAbonnementDevis.calculReductionBillet; abonnementVoyage.MatriculeAgent = agent.matriculeAgent; abonnementVoyage.ModePaiement = "Commande"; abonnementVoyage.NbVoyageAbonnement = voyageAbonnementDevis.NbVoyageAbonnement; abonnementVoyage.NumAbonnement = voyageAbonnementDevis.NumAbonnement; abonnementVoyage.NumCalculCategorieBillet = voyageAbonnementDevis.NumCalculCategorieBillet; abonnementVoyage.NumCalculReductionBillet = voyageAbonnementDevis.NumCalculReductionBillet; abonnementVoyage.NumTrajet = voyageAbonnementDevis.NumTrajet; abonnementVoyage.PrixUnitaire = voyageAbonnementDevis.PrixUnitaire; abonnementVoyage.trajet = voyageAbonnementDevis.trajet; abonnementVoyage.Zone = voyageAbonnementDevis.Zone; abonnementVoyage.zoneObj = voyageAbonnementDevis.zoneObj; } #endregion return(abonnementVoyage); }
string IntfDalVoyageAbonnementDevis.insertVoyageAbonnementDevis(crlVoyageAbonnementDevis voyageAbonnementDevis, string sigleAgence) { #region declaration string numVoyageAbonnementDevis = ""; int nombreInsert = 0; IntfDalVoyageAbonnementDevis serviceVoyageAbonnementDevis = new ImplDalVoyageAbonnementDevis(); string strTrajet = ""; string numCalculCategorieBillet = ""; string numCalculReductionBillet = ""; #endregion #region implementation if (voyageAbonnementDevis != null) { if (voyageAbonnementDevis.NumTrajet != "") { strTrajet = "'" + voyageAbonnementDevis.NumTrajet + "'"; } else { strTrajet = "NULL"; } if (voyageAbonnementDevis.NumCalculCategorieBillet != "") { numCalculCategorieBillet = "'" + voyageAbonnementDevis.NumCalculCategorieBillet + "'"; } else { numCalculCategorieBillet = "NULL"; } if (voyageAbonnementDevis.NumCalculReductionBillet != "") { numCalculReductionBillet = "'" + voyageAbonnementDevis.NumCalculReductionBillet + "'"; } else { numCalculReductionBillet = "NULL"; } voyageAbonnementDevis.NumVoyageAbonnementDevis = serviceVoyageAbonnementDevis.getNumVoyageAbonnementDevis(sigleAgence); this.strCommande = "INSERT INTO `voyageabonnementdevis` (`numVoyageAbonnementDevis`,`numTrajet`,`zone`,`prixUnitaire`,"; this.strCommande += " `nbVoyageAbonnement`,`numProforma`,`numCalculCategorieBillet`,`numCalculReductionBillet`,`numAbonnement`)"; this.strCommande += " VALUES ('" + voyageAbonnementDevis.NumVoyageAbonnementDevis + "'," + strTrajet + ","; this.strCommande += " '" + voyageAbonnementDevis.Zone + "','" + voyageAbonnementDevis.PrixUnitaire + "',"; this.strCommande += " '" + voyageAbonnementDevis.NbVoyageAbonnement + "','" + voyageAbonnementDevis.NumProforma + "',"; this.strCommande += " " + numCalculCategorieBillet + "," + numCalculReductionBillet + ",'" + voyageAbonnementDevis.NumAbonnement + "')"; this.serviceConnectBase.openConnection(); nombreInsert = this.serviceConnectBase.requete(this.strCommande); if (nombreInsert == 1) { numVoyageAbonnementDevis = voyageAbonnementDevis.NumVoyageAbonnementDevis; } this.serviceConnectBase.closeConnection(); } #endregion return(numVoyageAbonnementDevis); }
bool IntfDalVoyageAbonnementDevis.updateVoyageAbonnementDevis(crlVoyageAbonnementDevis voyageAbonnementDevis) { #region declaration bool isUpdate = false; string strTrajet = ""; int nombreUpdate = 0; string numCalculCategorieBillet = ""; string numCalculReductionBillet = ""; #endregion #region implementation if (voyageAbonnementDevis != null) { if (voyageAbonnementDevis.NumTrajet != "") { strTrajet = "'" + voyageAbonnementDevis.NumTrajet + "'"; } else { strTrajet = "NULL"; } if (voyageAbonnementDevis.NumCalculCategorieBillet != "") { numCalculCategorieBillet = "'" + voyageAbonnementDevis.NumCalculCategorieBillet + "'"; } else { numCalculCategorieBillet = "NULL"; } if (voyageAbonnementDevis.NumCalculReductionBillet != "") { numCalculReductionBillet = "'" + voyageAbonnementDevis.NumCalculReductionBillet + "'"; } else { numCalculReductionBillet = "NULL"; } this.strCommande = "UPDATE `voyageabonnementdevis` SET "; this.strCommande += " `numProforma`='" + voyageAbonnementDevis.NumProforma + "',"; this.strCommande += " `numTrajet`=" + strTrajet + ",`prixUnitaire`='" + voyageAbonnementDevis.PrixUnitaire + "',"; this.strCommande += " `zone`='" + voyageAbonnementDevis.Zone + "',`nbVoyageAbonnement`='" + voyageAbonnementDevis.NbVoyageAbonnement + "',"; this.strCommande += " `numCalculCategorieBillet`=" + numCalculCategorieBillet + ",`numCalculReductionBillet`=" + numCalculReductionBillet + ","; this.strCommande += " `numAbonnement`='" + voyageAbonnementDevis.NumAbonnement + "'"; this.strCommande += " WHERE `numVoyageAbonnementDevis`='" + voyageAbonnementDevis.NumVoyageAbonnementDevis + "'"; this.serviceConnectBase.openConnection(); nombreUpdate = this.serviceConnectBase.requete(this.strCommande); if (nombreUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } #endregion return(isUpdate); }
crlVoyageAbonnementDevis IntfDalVoyageAbonnementDevis.selectVoyageAbonnementDevis(string numVoyageAbonnementDevis) { #region declaration crlVoyageAbonnementDevis voyageAbonnementDevis = null; IntfDalTrajet serviceTrajet = new ImplDalTrajet(); IntfDalZone serviceZone = new ImplDalZone(); IntfDalCalculCategorieBillet serviceCalculCategorieBillet = new ImplDalCalculCategorieBillet(); IntfDalCalculReductionBillet serviceCalculReductionBillet = new ImplDalCalculReductionBillet(); #endregion #region implementation if (numVoyageAbonnementDevis != "") { this.strCommande = "SELECT * FROM `voyageabonnementdevis` WHERE `numVoyageAbonnementDevis`='" + numVoyageAbonnementDevis + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { voyageAbonnementDevis = new crlVoyageAbonnementDevis(); try { voyageAbonnementDevis.NbVoyageAbonnement = int.Parse(this.reader["nbVoyageAbonnement"].ToString()); } catch (Exception) { } voyageAbonnementDevis.NumProforma = this.reader["numProforma"].ToString(); voyageAbonnementDevis.NumTrajet = this.reader["numTrajet"].ToString(); voyageAbonnementDevis.NumVoyageAbonnementDevis = this.reader["numVoyageAbonnementDevis"].ToString(); try { voyageAbonnementDevis.PrixUnitaire = double.Parse(this.reader["prixUnitaire"].ToString()); } catch (Exception) { } voyageAbonnementDevis.Zone = this.reader["zone"].ToString(); voyageAbonnementDevis.NumCalculCategorieBillet = this.reader["numCalculCategorieBillet"].ToString(); voyageAbonnementDevis.NumCalculReductionBillet = this.reader["numCalculReductionBillet"].ToString(); voyageAbonnementDevis.NumAbonnement = this.reader["numAbonnement"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (voyageAbonnementDevis != null) { if (voyageAbonnementDevis.NumTrajet != "") { voyageAbonnementDevis.trajet = serviceTrajet.selectTrajet(voyageAbonnementDevis.NumTrajet); } if (voyageAbonnementDevis.Zone != "") { voyageAbonnementDevis.zoneObj = serviceZone.selectZone(voyageAbonnementDevis.Zone); } if (voyageAbonnementDevis.NumCalculCategorieBillet != "") { voyageAbonnementDevis.calculCategorieBillet = serviceCalculCategorieBillet.selectCalculCategorieBillet(voyageAbonnementDevis.NumCalculCategorieBillet); } if (voyageAbonnementDevis.NumCalculReductionBillet != "") { voyageAbonnementDevis.calculReductionBillet = serviceCalculReductionBillet.selectCalculReductionBillet(voyageAbonnementDevis.NumCalculReductionBillet); } } } #endregion return(voyageAbonnementDevis); }