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); }
bool IntfDalVoyageAbonnement.updateVoyageAbonnement(crlVoyageAbonnement voyageAbonnement) { #region declaration bool isUpdate = false; string strTrajet = ""; int nombreUpdate = 0; string numCalculCategorieBillet = "NULL"; string numCalculReductionBillet = "NULL"; string modePaiement = "NULL"; #endregion #region implementation if (voyageAbonnement != null) { if (voyageAbonnement.NumTrajet != "") { strTrajet = "'" + voyageAbonnement.NumTrajet + "'"; } else { strTrajet = "NULL"; } if (voyageAbonnement.NumCalculCategorieBillet != "") { numCalculCategorieBillet = "'" + voyageAbonnement.NumCalculCategorieBillet + "'"; } if (voyageAbonnement.NumCalculReductionBillet != "") { numCalculReductionBillet = "'" + voyageAbonnement.NumCalculReductionBillet + "'"; } if (voyageAbonnement.ModePaiement != "") { modePaiement = "'" + voyageAbonnement.ModePaiement + "'"; } this.strCommande = "UPDATE `voyageabonnement` SET `dateVoyageAbonnement`='" + voyageAbonnement.DateVoyageAbonnement.ToString("yyyy-MM-dd") + "',"; this.strCommande += " `matriculeAgent`='" + voyageAbonnement.MatriculeAgent + "',`numAbonnement`='" + voyageAbonnement.NumAbonnement + "',"; this.strCommande += " `numTrajet`=" + strTrajet + ",`prixUnitaire`='" + voyageAbonnement.PrixUnitaire + "',"; this.strCommande += " `zone`='" + voyageAbonnement.Zone + "',`nbVoyageAbonnement`='" + voyageAbonnement.NbVoyageAbonnement + "',"; this.strCommande += " `numCalculCategorieBillet`=" + numCalculCategorieBillet + ",`numCalculReductionBillet`=" + numCalculReductionBillet + ","; this.strCommande += " `modePaiement`=" + modePaiement; this.strCommande += " WHERE `numVoyageAbonnement`='" + voyageAbonnement.NumVoyageAbonnement + "'"; this.serviceConnectBase.openConnection(); nombreUpdate = this.serviceConnectBase.requete(this.strCommande); if (nombreUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } #endregion return(isUpdate); }
crlVoyageAbonnement IntfDalVoyageAbonnement.selectVoyageAbonnement(string numVoyageAbonnement) { #region declaration crlVoyageAbonnement voyageAbonnement = null; IntfDalAgent serviceAgent = new ImplDalAgent(); IntfDalTrajet serviceTrajet = new ImplDalTrajet(); IntfDalZone serviceZone = new ImplDalZone(); IntfDalAbonnement serviceAbonnement = new ImplDalAbonnement(); IntfDalCalculCategorieBillet serviceCalculCategorieBillet = new ImplDalCalculCategorieBillet(); IntfDalCalculReductionBillet serviceCalculReductionBillet = new ImplDalCalculReductionBillet(); #endregion #region implementation if (numVoyageAbonnement != "") { this.strCommande = "SELECT * FROM `voyageabonnement` WHERE `numVoyageAbonnement`='" + numVoyageAbonnement + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { voyageAbonnement = new crlVoyageAbonnement(); try { voyageAbonnement.DateVoyageAbonnement = Convert.ToDateTime(this.reader["dateVoyageAbonnement"].ToString()); } catch (Exception) { } voyageAbonnement.MatriculeAgent = this.reader["matriculeAgent"].ToString(); try { voyageAbonnement.NbVoyageAbonnement = int.Parse(this.reader["nbVoyageAbonnement"].ToString()); } catch (Exception) { } voyageAbonnement.NumAbonnement = this.reader["numAbonnement"].ToString(); voyageAbonnement.NumTrajet = this.reader["numTrajet"].ToString(); voyageAbonnement.NumVoyageAbonnement = this.reader["numVoyageAbonnement"].ToString(); try { voyageAbonnement.PrixUnitaire = double.Parse(this.reader["prixUnitaire"].ToString()); } catch (Exception) { } voyageAbonnement.Zone = this.reader["zone"].ToString(); voyageAbonnement.NumCalculCategorieBillet = this.reader["numCalculCategorieBillet"].ToString(); voyageAbonnement.NumCalculReductionBillet = this.reader["numCalculReductionBillet"].ToString(); voyageAbonnement.ModePaiement = this.reader["modePaiement"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (voyageAbonnement != null) { if (voyageAbonnement.MatriculeAgent != "") { voyageAbonnement.agent = serviceAgent.selectAgent(voyageAbonnement.MatriculeAgent); } if (voyageAbonnement.NumAbonnement != "") { voyageAbonnement.abonnement = serviceAbonnement.selectAbonnement(voyageAbonnement.NumAbonnement); } if (voyageAbonnement.NumTrajet != "") { voyageAbonnement.trajet = serviceTrajet.selectTrajet(voyageAbonnement.NumTrajet); } if (voyageAbonnement.Zone != "") { voyageAbonnement.zoneObj = serviceZone.selectZone(voyageAbonnement.Zone); } if (voyageAbonnement.NumCalculCategorieBillet != "") { voyageAbonnement.calculCategorieBillet = serviceCalculCategorieBillet.selectCalculCategorieBillet(voyageAbonnement.NumCalculCategorieBillet); } if (voyageAbonnement.NumCalculReductionBillet != "") { voyageAbonnement.calculReductionBillet = serviceCalculReductionBillet.selectCalculReductionBillet(voyageAbonnement.NumCalculReductionBillet); } } } #endregion return(voyageAbonnement); }
string IntfDalVoyageAbonnement.insertVoyageAbonnement(crlVoyageAbonnement voyageAbonnement) { #region declaration string numVoyageAbonnement = ""; int nombreInsert = 0; IntfDalVoyageAbonnement serviceVoyageAbonnement = new ImplDalVoyageAbonnement(); string strTrajet = ""; string numCalculCategorieBillet = "NULL"; string numCalculReductionBillet = "NULL"; string modePaiement = "NULL"; #endregion #region implementation if (voyageAbonnement != null) { if (voyageAbonnement.agent != null) { if (voyageAbonnement.NumTrajet != "") { strTrajet = "'" + voyageAbonnement.NumTrajet + "'"; } else { strTrajet = "NULL"; } if (voyageAbonnement.NumCalculCategorieBillet != "") { numCalculCategorieBillet = "'" + voyageAbonnement.NumCalculCategorieBillet + "'"; } if (voyageAbonnement.NumCalculReductionBillet != "") { numCalculReductionBillet = "'" + voyageAbonnement.NumCalculReductionBillet + "'"; } if (voyageAbonnement.ModePaiement != "") { modePaiement = "'" + voyageAbonnement.ModePaiement + "'"; } voyageAbonnement.NumVoyageAbonnement = serviceVoyageAbonnement.getNumVoyageAbonnement(voyageAbonnement.agent.agence.SigleAgence); this.strCommande = "INSERT INTO `voyageabonnement` (`numVoyageAbonnement`,`numTrajet`,`zone`,`prixUnitaire`,"; this.strCommande += " `nbVoyageAbonnement`,`numAbonnement`,`matriculeAgent`,`dateVoyageAbonnement`,"; this.strCommande += " `numCalculCategorieBillet`,`numCalculReductionBillet`,`modePaiement`)"; this.strCommande += " VALUES ('" + voyageAbonnement.NumVoyageAbonnement + "'," + strTrajet + ","; this.strCommande += " '" + voyageAbonnement.Zone + "','" + voyageAbonnement.PrixUnitaire + "',"; this.strCommande += " '" + voyageAbonnement.NbVoyageAbonnement + "','" + voyageAbonnement.NumAbonnement + "',"; this.strCommande += " '" + voyageAbonnement.MatriculeAgent + "','" + voyageAbonnement.DateVoyageAbonnement.ToString("yyyy-MM-dd") + "',"; this.strCommande += " " + numCalculCategorieBillet + "," + numCalculReductionBillet + "," + modePaiement + ")"; this.serviceConnectBase.openConnection(); nombreInsert = this.serviceConnectBase.requete(this.strCommande); if (nombreInsert == 1) { numVoyageAbonnement = voyageAbonnement.NumVoyageAbonnement; } this.serviceConnectBase.closeConnection(); } } #endregion return(numVoyageAbonnement); }