string IntfDalUSArret.insertUSArret(crlUSArret arret, string sigleAgence) { #region declaration string numArret = ""; IntfDalUSArret serviceUSArret = new ImplDalUSArret(); int nbInsert = 0; #endregion #region implemenation if (arret != null && sigleAgence != "") { arret.NumArret = serviceUSArret.getNumUSArret(sigleAgence); this.strCommande = "INSERT INTO `usarret` (`numArret`,`numLieu`,`nomArret`,`descriptionArret`)"; this.strCommande += " VALUES ('" + arret.NumArret + "','" + arret.NumLieu + "','" + arret.NomArret + "',"; this.strCommande += " '" + arret.DescriptionArret + "')"; this.serviceConnectBase.openConnection(); nbInsert = this.serviceConnectBase.requete(this.strCommande); if (nbInsert == 1) { numArret = arret.NomArret; } this.serviceConnectBase.closeConnection(); } #endregion return(numArret); }
bool IntfDalUSArret.updateUSArret(crlUSArret arret) { #region declaration bool isUpdate = false; int nbUpdate = 0; #endregion #region implementation if (arret != null) { this.strCommande = "UPDATE `usarret` SET `numLieu`='" + arret.NumLieu + "',"; this.strCommande += " `nomArret`='" + arret.NomArret + "',"; this.strCommande += " `descriptionArret`='" + arret.DescriptionArret + "' WHERE"; this.strCommande += " `numArret`='" + arret.NumArret + "'"; this.serviceConnectBase.openConnection(); nbUpdate = this.serviceConnectBase.requete(this.strCommande); if (nbUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } #endregion return(isUpdate); }
crlUSArret IntfDalUSArret.selectUSArret(string numArret) { #region declaration crlUSArret arret = null; #endregion #region implementation if (numArret != "") { this.strCommande = "SELECT * FROM `usarret` WHERE (`numArret`='" + numArret + "')"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { arret = new crlUSArret(); arret.DescriptionArret = this.reader["descriptionArret"].ToString(); arret.NomArret = this.reader["nomArret"].ToString(); arret.NumLieu = this.reader["numLieu"].ToString(); arret.NumArret = this.reader["numArret"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(arret); }
string IntfDalUSArret.isUSArret(crlUSArret arret) { #region declaration string numArret = ""; #endregion #region implementation if (arret != null) { this.strCommande = "SELECT * FROM `usarret` WHERE"; this.strCommande += " `nomArret`='" + arret.NomArret + "' AND"; this.strCommande += " `numLieu`='" + arret.NumLieu + "' AND"; this.strCommande += " `numArret`<>'" + arret.NumArret + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { numArret = this.reader["numArret"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(numArret); }
public crlUSTrajet() { this.NumTrajet = ""; this.DistanceTrajet = 0; this.DureeTrajet = ""; this.NumArretD = ""; this.NumArretF = ""; this.arretD = null; this.arretF = null; }
public crlUSLigne() { this.DescriptionLigne = ""; this.NomLigne = ""; this.NumCooperative = ""; this.NumLigne = ""; this.NumArretD = ""; this.NumArretF = ""; this.Zone = ""; this.NumAxe = ""; this.arretD = null; this.arretF = null; }
DataTable IntfDalUSLigne.getDataTableLigne(string strRqst) { #region declaration DataTable dataTable = new DataTable(); crlUSArret arretD = null; crlUSArret arretF = null; crlUSLieu lieuD = null; crlUSLieu lieuF = null; crlQuartier quartierD = null; crlQuartier quartierF = null; IntfDalUSArret serviceUSArret = new ImplDalUSArret(); IntfDalUSLieu serviceUSLieu = new ImplDalUSLieu(); IntfDalGeneral serviceGeneral = new ImplDalGeneral(); IntfDalQuartier serviceQuartier = new ImplDalQuartier(); #endregion #region implementation #region initialisation du dataTable dataTable = new DataTable(); dataTable.Columns.Add("numLigne", typeof(string)); dataTable.Columns.Add("nomLigne", typeof(string)); dataTable.Columns.Add("nomCooperative", typeof(string)); dataTable.Columns.Add("zone", typeof(string)); dataTable.Columns.Add("trajet", typeof(string)); DataRow dr; #endregion this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(strRqst); if (this.reader != null) { if (this.reader.HasRows) { while (this.reader.Read()) { dr = dataTable.NewRow(); dr["numLigne"] = reader["numLigne"].ToString(); dr["nomLigne"] = reader["nomLigne"].ToString(); dr["nomCooperative"] = reader["nomCooperative"].ToString(); dr["zone"] = reader["zone"].ToString(); arretD = serviceUSArret.selectUSArret(this.reader["numArretD"].ToString()); arretF = serviceUSArret.selectUSArret(this.reader["numArretF"].ToString()); if (arretD != null && arretF != null) { lieuD = serviceUSLieu.selectUSLieu(arretD.NumLieu); lieuF = serviceUSLieu.selectUSLieu(arretF.NumLieu); if (lieuD != null && lieuF != null) { quartierD = serviceQuartier.selectQuartier(lieuD.NumQuartier); quartierF = serviceQuartier.selectQuartier(lieuF.NumQuartier); if (quartierF != null && quartierF != null) { dr["trajet"] = quartierD.Quartier + "/" + arretD.NomArret + "-" + quartierF.Quartier + "/" + arretF.NomArret; } else { dr["trajet"] = arretD.NomArret + "-" + arretF.NomArret; } } else { dr["trajet"] = arretD.NomArret + "-" + arretF.NomArret; } } else { dr["trajet"] = this.reader["numArretD"].ToString() + "-" + this.reader["numArretF"].ToString(); } dataTable.Rows.Add(dr); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); #endregion return(dataTable); }